@wordpress/edit-site 5.29.0 → 5.30.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 (364) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/actions/index.js +1 -1
  3. package/build/components/actions/index.js.map +1 -1
  4. package/build/components/block-editor/editor-canvas.js +10 -11
  5. package/build/components/block-editor/editor-canvas.js.map +1 -1
  6. package/build/components/editor/index.js +1 -15
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/global-styles/color-palette-panel.js +9 -0
  9. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  10. package/build/components/global-styles/font-families.js +1 -1
  11. package/build/components/global-styles/font-families.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/collection-font-variant.js +2 -2
  13. package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/context.js +62 -58
  15. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/font-card.js +10 -15
  17. package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/font-collection.js +118 -76
  19. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/font-demo.js +29 -8
  21. package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/index.js +19 -6
  23. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  24. package/build/components/global-styles/font-library-modal/installed-fonts.js +151 -79
  25. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  26. package/build/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  27. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  28. package/build/components/global-styles/font-library-modal/upload-fonts.js +8 -14
  29. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  30. package/build/components/global-styles/font-library-modal/utils/index.js +38 -4
  31. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  32. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +1 -1
  33. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  34. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  35. package/build/components/global-styles/header.js +1 -1
  36. package/build/components/global-styles/header.js.map +1 -1
  37. package/build/components/global-styles/highlighted-colors.js +50 -0
  38. package/build/components/global-styles/highlighted-colors.js.map +1 -0
  39. package/build/components/global-styles/preview-colors.js +62 -0
  40. package/build/components/global-styles/preview-colors.js.map +1 -0
  41. package/build/components/global-styles/preview-iframe.js +131 -0
  42. package/build/components/global-styles/preview-iframe.js.map +1 -0
  43. package/build/components/global-styles/preview-styles.js +163 -0
  44. package/build/components/global-styles/preview-styles.js.map +1 -0
  45. package/build/components/global-styles/preview-typography.js +65 -0
  46. package/build/components/global-styles/preview-typography.js.map +1 -0
  47. package/build/components/global-styles/screen-block-list.js +1 -1
  48. package/build/components/global-styles/screen-block-list.js.map +1 -1
  49. package/build/components/global-styles/screen-block.js +1 -1
  50. package/build/components/global-styles/screen-block.js.map +1 -1
  51. package/build/components/global-styles/screen-colors.js +10 -2
  52. package/build/components/global-styles/screen-colors.js.map +1 -1
  53. package/build/components/global-styles/screen-revisions/index.js +2 -2
  54. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  55. package/build/components/global-styles/screen-root.js +2 -2
  56. package/build/components/global-styles/screen-root.js.map +1 -1
  57. package/build/components/global-styles/screen-typography.js +10 -2
  58. package/build/components/global-styles/screen-typography.js.map +1 -1
  59. package/build/components/global-styles/style-variations-container.js +12 -84
  60. package/build/components/global-styles/style-variations-container.js.map +1 -1
  61. package/build/components/global-styles/{typogrphy-elements.js → typography-elements.js} +1 -1
  62. package/build/components/global-styles/typography-elements.js.map +1 -0
  63. package/build/components/global-styles/ui.js +27 -2
  64. package/build/components/global-styles/ui.js.map +1 -1
  65. package/build/components/global-styles/utils.js +22 -0
  66. package/build/components/global-styles/utils.js.map +1 -1
  67. package/build/components/global-styles/variations/variation.js +90 -0
  68. package/build/components/global-styles/variations/variation.js.map +1 -0
  69. package/build/components/global-styles/variations/variations-color.js +36 -0
  70. package/build/components/global-styles/variations/variations-color.js.map +1 -0
  71. package/build/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  72. package/build/components/global-styles/variations/variations-panel.js.map +1 -0
  73. package/build/components/global-styles/variations/variations-typography.js +64 -0
  74. package/build/components/global-styles/variations/variations-typography.js.map +1 -0
  75. package/build/components/header-edit-mode/index.js +12 -11
  76. package/build/components/header-edit-mode/index.js.map +1 -1
  77. package/build/components/header-edit-mode/more-menu/index.js +10 -2
  78. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  79. package/build/components/layout/index.js +4 -1
  80. package/build/components/layout/index.js.map +1 -1
  81. package/build/components/page-patterns/index.js +14 -14
  82. package/build/components/page-patterns/index.js.map +1 -1
  83. package/build/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -61
  84. package/build/components/page-templates-template-parts/hooks.js.map +1 -0
  85. package/build/components/page-templates-template-parts/index.js +14 -6
  86. package/build/components/page-templates-template-parts/index.js.map +1 -1
  87. package/build/components/resizable-frame/index.js +2 -1
  88. package/build/components/resizable-frame/index.js.map +1 -1
  89. package/build/components/revisions/index.js.map +1 -1
  90. package/build/components/save-panel/index.js +18 -3
  91. package/build/components/save-panel/index.js.map +1 -1
  92. package/build/components/sidebar/index.js +1 -1
  93. package/build/components/sidebar/index.js.map +1 -1
  94. package/build/components/sidebar-dataviews/default-views.js +2 -0
  95. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  96. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  97. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  98. package/build/components/sidebar-navigation-screen-main/index.js +1 -2
  99. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  100. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  101. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
  102. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  103. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  105. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +2 -2
  106. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  107. package/build/components/sidebar-navigation-screen-template/index.js +2 -2
  108. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  109. package/build/components/sidebar-navigation-screen-templates-browse/content.js +4 -4
  110. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  111. package/build/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
  112. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  113. package/build/components/start-template-options/index.js.map +1 -1
  114. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -0
  115. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  116. package/build-module/components/actions/index.js +1 -1
  117. package/build-module/components/actions/index.js.map +1 -1
  118. package/build-module/components/block-editor/editor-canvas.js +10 -11
  119. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  120. package/build-module/components/editor/index.js +2 -16
  121. package/build-module/components/editor/index.js.map +1 -1
  122. package/build-module/components/global-styles/color-palette-panel.js +8 -0
  123. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  124. package/build-module/components/global-styles/font-families.js +1 -1
  125. package/build-module/components/global-styles/font-families.js.map +1 -1
  126. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +4 -4
  127. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  128. package/build-module/components/global-styles/font-library-modal/context.js +63 -59
  129. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  130. package/build-module/components/global-styles/font-library-modal/font-card.js +11 -16
  131. package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
  132. package/build-module/components/global-styles/font-library-modal/font-collection.js +121 -79
  133. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  134. package/build-module/components/global-styles/font-library-modal/font-demo.js +30 -9
  135. package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  136. package/build-module/components/global-styles/font-library-modal/index.js +19 -6
  137. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  138. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +151 -79
  139. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  140. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +4 -4
  141. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  142. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +9 -15
  143. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  144. package/build-module/components/global-styles/font-library-modal/utils/index.js +37 -4
  145. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  146. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +1 -1
  147. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  148. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  149. package/build-module/components/global-styles/header.js +1 -1
  150. package/build-module/components/global-styles/header.js.map +1 -1
  151. package/build-module/components/global-styles/highlighted-colors.js +43 -0
  152. package/build-module/components/global-styles/highlighted-colors.js.map +1 -0
  153. package/build-module/components/global-styles/preview-colors.js +54 -0
  154. package/build-module/components/global-styles/preview-colors.js.map +1 -0
  155. package/build-module/components/global-styles/preview-iframe.js +124 -0
  156. package/build-module/components/global-styles/preview-iframe.js.map +1 -0
  157. package/build-module/components/global-styles/preview-styles.js +155 -0
  158. package/build-module/components/global-styles/preview-styles.js.map +1 -0
  159. package/build-module/components/global-styles/preview-typography.js +58 -0
  160. package/build-module/components/global-styles/preview-typography.js.map +1 -0
  161. package/build-module/components/global-styles/screen-block-list.js +1 -1
  162. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  163. package/build-module/components/global-styles/screen-block.js +1 -1
  164. package/build-module/components/global-styles/screen-block.js.map +1 -1
  165. package/build-module/components/global-styles/screen-colors.js +10 -2
  166. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  167. package/build-module/components/global-styles/screen-revisions/index.js +2 -2
  168. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  169. package/build-module/components/global-styles/screen-root.js +2 -2
  170. package/build-module/components/global-styles/screen-root.js.map +1 -1
  171. package/build-module/components/global-styles/screen-typography.js +10 -2
  172. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  173. package/build-module/components/global-styles/style-variations-container.js +13 -85
  174. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  175. package/build-module/components/global-styles/{typogrphy-elements.js → typography-elements.js} +1 -1
  176. package/build-module/components/global-styles/typography-elements.js.map +1 -0
  177. package/build-module/components/global-styles/ui.js +27 -2
  178. package/build-module/components/global-styles/ui.js.map +1 -1
  179. package/build-module/components/global-styles/utils.js +21 -0
  180. package/build-module/components/global-styles/utils.js.map +1 -1
  181. package/build-module/components/global-styles/variations/variation.js +82 -0
  182. package/build-module/components/global-styles/variations/variation.js.map +1 -0
  183. package/build-module/components/global-styles/variations/variations-color.js +28 -0
  184. package/build-module/components/global-styles/variations/variations-color.js.map +1 -0
  185. package/build-module/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  186. package/build-module/components/global-styles/variations/variations-panel.js.map +1 -0
  187. package/build-module/components/global-styles/variations/variations-typography.js +56 -0
  188. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -0
  189. package/build-module/components/header-edit-mode/index.js +13 -12
  190. package/build-module/components/header-edit-mode/index.js.map +1 -1
  191. package/build-module/components/header-edit-mode/more-menu/index.js +13 -5
  192. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  193. package/build-module/components/layout/index.js +4 -1
  194. package/build-module/components/layout/index.js.map +1 -1
  195. package/build-module/components/page-patterns/index.js +14 -14
  196. package/build-module/components/page-patterns/index.js.map +1 -1
  197. package/build-module/components/{list/added-by.js → page-templates-template-parts/hooks.js} +2 -59
  198. package/build-module/components/page-templates-template-parts/hooks.js.map +1 -0
  199. package/build-module/components/page-templates-template-parts/index.js +13 -5
  200. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  201. package/build-module/components/resizable-frame/index.js +2 -1
  202. package/build-module/components/resizable-frame/index.js.map +1 -1
  203. package/build-module/components/revisions/index.js.map +1 -1
  204. package/build-module/components/save-panel/index.js +18 -3
  205. package/build-module/components/save-panel/index.js.map +1 -1
  206. package/build-module/components/sidebar/index.js +1 -1
  207. package/build-module/components/sidebar/index.js.map +1 -1
  208. package/build-module/components/sidebar-dataviews/default-views.js +3 -1
  209. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  210. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  211. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  212. package/build-module/components/sidebar-navigation-screen-main/index.js +1 -2
  213. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  214. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  215. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
  216. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  217. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  218. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  219. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  220. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  221. package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
  222. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  223. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  224. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  225. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
  226. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  227. package/build-module/components/start-template-options/index.js.map +1 -1
  228. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +63 -1
  229. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  230. package/build-style/style-rtl.css +163 -286
  231. package/build-style/style.css +163 -286
  232. package/package.json +42 -42
  233. package/src/components/actions/index.js +1 -1
  234. package/src/components/block-editor/editor-canvas.js +13 -12
  235. package/src/components/block-editor/style.scss +0 -3
  236. package/src/components/editor/index.js +0 -20
  237. package/src/components/global-styles/color-palette-panel.js +11 -1
  238. package/src/components/global-styles/font-families.js +1 -1
  239. package/src/components/global-styles/font-library-modal/collection-font-variant.js +5 -5
  240. package/src/components/global-styles/font-library-modal/context.js +116 -104
  241. package/src/components/global-styles/font-library-modal/font-card.js +11 -26
  242. package/src/components/global-styles/font-library-modal/font-collection.js +297 -218
  243. package/src/components/global-styles/font-library-modal/font-demo.js +38 -4
  244. package/src/components/global-styles/font-library-modal/index.js +23 -16
  245. package/src/components/global-styles/font-library-modal/installed-fonts.js +243 -114
  246. package/src/components/global-styles/font-library-modal/library-font-variant.js +5 -5
  247. package/src/components/global-styles/font-library-modal/style.scss +15 -8
  248. package/src/components/global-styles/font-library-modal/upload-fonts.js +17 -19
  249. package/src/components/global-styles/font-library-modal/utils/index.js +44 -4
  250. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +2 -1
  251. package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js +7 -18
  252. package/src/components/global-styles/gradients-palette-panel.js +2 -2
  253. package/src/components/global-styles/header.js +1 -1
  254. package/src/components/global-styles/highlighted-colors.js +39 -0
  255. package/src/components/global-styles/preview-colors.js +61 -0
  256. package/src/components/global-styles/preview-iframe.js +153 -0
  257. package/src/components/global-styles/preview-styles.js +185 -0
  258. package/src/components/global-styles/preview-typography.js +62 -0
  259. package/src/components/global-styles/screen-block-list.js +1 -1
  260. package/src/components/global-styles/screen-block.js +4 -1
  261. package/src/components/global-styles/screen-colors.js +13 -1
  262. package/src/components/global-styles/screen-revisions/index.js +5 -2
  263. package/src/components/global-styles/screen-root.js +2 -2
  264. package/src/components/global-styles/screen-typography.js +19 -2
  265. package/src/components/global-styles/style-variations-container.js +14 -92
  266. package/src/components/global-styles/style.scss +0 -34
  267. package/src/components/global-styles/ui.js +26 -2
  268. package/src/components/global-styles/utils.js +37 -0
  269. package/src/components/global-styles/variations/style.scss +44 -0
  270. package/src/components/global-styles/variations/variation.js +93 -0
  271. package/src/components/global-styles/variations/variations-color.js +30 -0
  272. package/src/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  273. package/src/components/global-styles/variations/variations-typography.js +85 -0
  274. package/src/components/header-edit-mode/index.js +20 -27
  275. package/src/components/header-edit-mode/more-menu/index.js +17 -8
  276. package/src/components/header-edit-mode/style.scss +4 -0
  277. package/src/components/layout/index.js +5 -0
  278. package/src/components/page-patterns/index.js +21 -21
  279. package/src/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -66
  280. package/src/components/page-templates-template-parts/index.js +20 -3
  281. package/src/components/page-templates-template-parts/style.scss +48 -0
  282. package/src/components/resizable-frame/index.js +1 -0
  283. package/src/components/revisions/index.js +1 -1
  284. package/src/components/save-panel/index.js +34 -12
  285. package/src/components/sidebar/index.js +1 -1
  286. package/src/components/sidebar-dataviews/default-views.js +3 -1
  287. package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -1
  288. package/src/components/sidebar-edit-mode/template-panel/index.js +1 -1
  289. package/src/components/sidebar-navigation-screen-main/index.js +0 -2
  290. package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +1 -1
  291. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -2
  292. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  293. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +1 -1
  294. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  295. package/src/components/sidebar-navigation-screen-template/index.js +1 -1
  296. package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  297. package/src/components/sidebar-navigation-screen-templates-browse/index.js +5 -3
  298. package/src/components/start-template-options/index.js +1 -1
  299. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +173 -0
  300. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +68 -1
  301. package/src/style.scss +2 -2
  302. package/build/components/global-styles/font-library-modal/collection-font-details.js +0 -50
  303. package/build/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
  304. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -30
  305. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
  306. package/build/components/global-styles/font-library-modal/library-font-card.js +0 -39
  307. package/build/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
  308. package/build/components/global-styles/font-library-modal/tab-panel-layout.js +0 -67
  309. package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
  310. package/build/components/global-styles/preview.js +0 -271
  311. package/build/components/global-styles/preview.js.map +0 -1
  312. package/build/components/global-styles/typogrphy-elements.js.map +0 -1
  313. package/build/components/global-styles/variations-panel.js.map +0 -1
  314. package/build/components/list/added-by.js.map +0 -1
  315. package/build/components/list/header.js +0 -55
  316. package/build/components/list/header.js.map +0 -1
  317. package/build/components/list/index.js +0 -80
  318. package/build/components/list/index.js.map +0 -1
  319. package/build/components/list/table.js +0 -94
  320. package/build/components/list/table.js.map +0 -1
  321. package/build/components/list/use-register-shortcuts.js +0 -51
  322. package/build/components/list/use-register-shortcuts.js.map +0 -1
  323. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +0 -36
  324. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
  325. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -36
  326. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
  327. package/build-module/components/global-styles/font-library-modal/collection-font-details.js +0 -42
  328. package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
  329. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -23
  330. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
  331. package/build-module/components/global-styles/font-library-modal/library-font-card.js +0 -31
  332. package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
  333. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +0 -60
  334. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
  335. package/build-module/components/global-styles/preview.js +0 -264
  336. package/build-module/components/global-styles/preview.js.map +0 -1
  337. package/build-module/components/global-styles/typogrphy-elements.js.map +0 -1
  338. package/build-module/components/global-styles/variations-panel.js.map +0 -1
  339. package/build-module/components/list/added-by.js.map +0 -1
  340. package/build-module/components/list/header.js +0 -47
  341. package/build-module/components/list/header.js.map +0 -1
  342. package/build-module/components/list/index.js +0 -72
  343. package/build-module/components/list/index.js.map +0 -1
  344. package/build-module/components/list/table.js +0 -86
  345. package/build-module/components/list/table.js.map +0 -1
  346. package/build-module/components/list/use-register-shortcuts.js +0 -45
  347. package/build-module/components/list/use-register-shortcuts.js.map +0 -1
  348. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +0 -29
  349. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
  350. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -27
  351. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
  352. package/src/components/global-styles/font-library-modal/collection-font-details.js +0 -56
  353. package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -33
  354. package/src/components/global-styles/font-library-modal/library-font-card.js +0 -34
  355. package/src/components/global-styles/font-library-modal/tab-panel-layout.js +0 -85
  356. package/src/components/global-styles/preview.js +0 -327
  357. package/src/components/list/header.js +0 -48
  358. package/src/components/list/index.js +0 -87
  359. package/src/components/list/style.scss +0 -188
  360. package/src/components/list/table.js +0 -140
  361. package/src/components/list/use-register-shortcuts.js +0 -49
  362. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +0 -34
  363. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -22
  364. /package/src/components/global-styles/{typogrphy-elements.js → typography-elements.js} +0 -0
@@ -0,0 +1,155 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
6
+ import { __experimentalHStack as HStack, __experimentalVStack as VStack, __unstableMotion as motion } from '@wordpress/components';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { unlock } from '../../lock-unlock';
12
+ import { useStylesPreviewColors } from './hooks';
13
+ import PreviewTypography from './preview-typography';
14
+ import HighlightedColors from './highlighted-colors';
15
+ import PreviewIframe from './preview-iframe';
16
+ const {
17
+ useGlobalStyle
18
+ } = unlock(blockEditorPrivateApis);
19
+ const firstFrameVariants = {
20
+ start: {
21
+ scale: 1,
22
+ opacity: 1
23
+ },
24
+ hover: {
25
+ scale: 0,
26
+ opacity: 0
27
+ }
28
+ };
29
+ const midFrameVariants = {
30
+ hover: {
31
+ opacity: 1
32
+ },
33
+ start: {
34
+ opacity: 0.5
35
+ }
36
+ };
37
+ const secondFrameVariants = {
38
+ hover: {
39
+ scale: 1,
40
+ opacity: 1
41
+ },
42
+ start: {
43
+ scale: 0,
44
+ opacity: 0
45
+ }
46
+ };
47
+ const PreviewStyles = ({
48
+ label,
49
+ isFocused,
50
+ withHoverView,
51
+ variation
52
+ }) => {
53
+ const [fontWeight] = useGlobalStyle('typography.fontWeight');
54
+ const [fontFamily = 'serif'] = useGlobalStyle('typography.fontFamily');
55
+ const [headingFontFamily = fontFamily] = useGlobalStyle('elements.h1.typography.fontFamily');
56
+ const [headingFontWeight = fontWeight] = useGlobalStyle('elements.h1.typography.fontWeight');
57
+ const [textColor = 'black'] = useGlobalStyle('color.text');
58
+ const [headingColor = textColor] = useGlobalStyle('elements.h1.color.text');
59
+ const {
60
+ paletteColors
61
+ } = useStylesPreviewColors();
62
+ return createElement(PreviewIframe, {
63
+ label: label,
64
+ isFocused: isFocused,
65
+ withHoverView: withHoverView
66
+ }, ({
67
+ ratio,
68
+ key
69
+ }) => createElement(motion.div, {
70
+ key: key,
71
+ variants: firstFrameVariants,
72
+ style: {
73
+ height: '100%',
74
+ overflow: 'hidden'
75
+ }
76
+ }, createElement(HStack, {
77
+ spacing: 10 * ratio,
78
+ justify: "center",
79
+ style: {
80
+ height: '100%',
81
+ overflow: 'hidden'
82
+ }
83
+ }, createElement(PreviewTypography, {
84
+ fontSize: 65 * ratio,
85
+ variation: variation
86
+ }), createElement(VStack, {
87
+ spacing: 4 * ratio
88
+ }, createElement(HighlightedColors, {
89
+ normalizedColorSwatchSize: 32,
90
+ ratio: ratio
91
+ })))), ({
92
+ key
93
+ }) => createElement(motion.div, {
94
+ key: key,
95
+ variants: withHoverView && midFrameVariants,
96
+ style: {
97
+ height: '100%',
98
+ width: '100%',
99
+ position: 'absolute',
100
+ top: 0,
101
+ overflow: 'hidden',
102
+ filter: 'blur(60px)',
103
+ opacity: 0.1
104
+ }
105
+ }, createElement(HStack, {
106
+ spacing: 0,
107
+ justify: "flex-start",
108
+ style: {
109
+ height: '100%',
110
+ overflow: 'hidden'
111
+ }
112
+ }, paletteColors.slice(0, 4).map(({
113
+ color
114
+ }, index) => createElement("div", {
115
+ key: index,
116
+ style: {
117
+ height: '100%',
118
+ background: color,
119
+ flexGrow: 1
120
+ }
121
+ })))), ({
122
+ ratio,
123
+ key
124
+ }) => createElement(motion.div, {
125
+ key: key,
126
+ variants: secondFrameVariants,
127
+ style: {
128
+ height: '100%',
129
+ width: '100%',
130
+ overflow: 'hidden',
131
+ position: 'absolute',
132
+ top: 0
133
+ }
134
+ }, createElement(VStack, {
135
+ spacing: 3 * ratio,
136
+ justify: "center",
137
+ style: {
138
+ height: '100%',
139
+ overflow: 'hidden',
140
+ padding: 10 * ratio,
141
+ boxSizing: 'border-box'
142
+ }
143
+ }, label && createElement("div", {
144
+ style: {
145
+ fontSize: 40 * ratio,
146
+ fontFamily: headingFontFamily,
147
+ color: headingColor,
148
+ fontWeight: headingFontWeight,
149
+ lineHeight: '1em',
150
+ textAlign: 'center'
151
+ }
152
+ }, label))));
153
+ };
154
+ export default PreviewStyles;
155
+ //# sourceMappingURL=preview-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["privateApis","blockEditorPrivateApis","__experimentalHStack","HStack","__experimentalVStack","VStack","__unstableMotion","motion","unlock","useStylesPreviewColors","PreviewTypography","HighlightedColors","PreviewIframe","useGlobalStyle","firstFrameVariants","start","scale","opacity","hover","midFrameVariants","secondFrameVariants","PreviewStyles","label","isFocused","withHoverView","variation","fontWeight","fontFamily","headingFontFamily","headingFontWeight","textColor","headingColor","paletteColors","createElement","ratio","key","div","variants","style","height","overflow","spacing","justify","fontSize","normalizedColorSwatchSize","width","position","top","filter","slice","map","color","index","background","flexGrow","padding","boxSizing","lineHeight","textAlign"],"sources":["@wordpress/edit-site/src/components/global-styles/preview-styles.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useStylesPreviewColors } from './hooks';\nimport PreviewTypography from './preview-typography';\nimport HighlightedColors from './highlighted-colors';\nimport PreviewIframe from './preview-iframe';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst firstFrameVariants = {\n\tstart: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\thover: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst midFrameVariants = {\n\thover: {\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\topacity: 0.5,\n\t},\n};\n\nconst secondFrameVariants = {\n\thover: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst PreviewStyles = ( { label, isFocused, withHoverView, variation } ) => {\n\tconst [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );\n\tconst [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );\n\tconst [ headingFontFamily = fontFamily ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontFamily'\n\t);\n\tconst [ headingFontWeight = fontWeight ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontWeight'\n\t);\n\tconst [ textColor = 'black' ] = useGlobalStyle( 'color.text' );\n\tconst [ headingColor = textColor ] = useGlobalStyle(\n\t\t'elements.h1.color.text'\n\t);\n\n\tconst { paletteColors } = useStylesPreviewColors();\n\n\treturn (\n\t\t<PreviewIframe\n\t\t\tlabel={ label }\n\t\t\tisFocused={ isFocused }\n\t\t\twithHoverView={ withHoverView }\n\t\t>\n\t\t\t{ ( { ratio, key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ firstFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PreviewTypography\n\t\t\t\t\t\t\tfontSize={ 65 * ratio }\n\t\t\t\t\t\t\tvariation={ variation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<VStack spacing={ 4 * ratio }>\n\t\t\t\t\t\t\t<HighlightedColors\n\t\t\t\t\t\t\t\tnormalizedColorSwatchSize={ 32 }\n\t\t\t\t\t\t\t\tratio={ ratio }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t{ ( { key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ withHoverView && midFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tfilter: 'blur(60px)',\n\t\t\t\t\t\topacity: 0.1,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ paletteColors\n\t\t\t\t\t\t\t.slice( 0, 4 )\n\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t{ ( { ratio, key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ secondFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tspacing={ 3 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpadding: 10 * ratio,\n\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tfontSize: 40 * ratio,\n\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\tlineHeight: '1em',\n\t\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t</PreviewIframe>\n\t);\n};\n\nexport default PreviewStyles;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SACCC,oBAAoB,IAAI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B,UAAU,EAAE,KAAK;MACjBC,SAAS,EAAE;IACZ;EAAG,GAEDpC,KACE,CAEC,CACG,CAEC,CAAC;AAElB,CAAC;AAED,eAAeD,aAAa"}
@@ -0,0 +1,58 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { useContext } from '@wordpress/element';
6
+ import { __unstableMotion as motion } from '@wordpress/components';
7
+ import { _x } from '@wordpress/i18n';
8
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { mergeBaseAndUserConfigs } from './global-styles-provider';
14
+ import { unlock } from '../../lock-unlock';
15
+ import { getFamilyPreviewStyle } from './font-library-modal/utils/preview-styles';
16
+ import { getFontFamilies } from './utils';
17
+ const {
18
+ GlobalStylesContext
19
+ } = unlock(blockEditorPrivateApis);
20
+ export default function PreviewTypography({
21
+ fontSize,
22
+ variation
23
+ }) {
24
+ const {
25
+ base
26
+ } = useContext(GlobalStylesContext);
27
+ let config = base;
28
+ if (variation) {
29
+ config = mergeBaseAndUserConfigs(base, variation);
30
+ }
31
+ const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config);
32
+ const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {};
33
+ const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {};
34
+ if (fontSize) {
35
+ bodyPreviewStyle.fontSize = fontSize;
36
+ headingPreviewStyle.fontSize = fontSize;
37
+ }
38
+ return createElement(motion.div, {
39
+ className: "edit-site-global-styles_preview-typography",
40
+ animate: {
41
+ scale: 1,
42
+ opacity: 1
43
+ },
44
+ initial: {
45
+ scale: 0.1,
46
+ opacity: 0
47
+ },
48
+ transition: {
49
+ delay: 0.3,
50
+ type: 'tween'
51
+ }
52
+ }, createElement("span", {
53
+ style: headingPreviewStyle
54
+ }, _x('A', 'Uppercase letter A')), createElement("span", {
55
+ style: bodyPreviewStyle
56
+ }, _x('a', 'Lowercase letter A')));
57
+ }
58
+ //# sourceMappingURL=preview-typography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","__unstableMotion","motion","_x","privateApis","blockEditorPrivateApis","mergeBaseAndUserConfigs","unlock","getFamilyPreviewStyle","getFontFamilies","GlobalStylesContext","PreviewTypography","fontSize","variation","base","config","bodyFontFamilies","headingFontFamilies","bodyPreviewStyle","headingPreviewStyle","createElement","div","className","animate","scale","opacity","initial","transition","delay","type","style"],"sources":["@wordpress/edit-site/src/components/global-styles/preview-typography.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { _x } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from './global-styles-provider';\nimport { unlock } from '../../lock-unlock';\nimport { getFamilyPreviewStyle } from './font-library-modal/utils/preview-styles';\nimport { getFontFamilies } from './utils';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\nexport default function PreviewTypography( { fontSize, variation } ) {\n\tconst { base } = useContext( GlobalStylesContext );\n\tlet config = base;\n\tif ( variation ) {\n\t\tconfig = mergeBaseAndUserConfigs( base, variation );\n\t}\n\tconst [ bodyFontFamilies, headingFontFamilies ] = getFontFamilies( config );\n\tconst bodyPreviewStyle = bodyFontFamilies\n\t\t? getFamilyPreviewStyle( bodyFontFamilies )\n\t\t: {};\n\tconst headingPreviewStyle = headingFontFamilies\n\t\t? getFamilyPreviewStyle( headingFontFamilies )\n\t\t: {};\n\n\tif ( fontSize ) {\n\t\tbodyPreviewStyle.fontSize = fontSize;\n\t\theadingPreviewStyle.fontSize = fontSize;\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName=\"edit-site-global-styles_preview-typography\"\n\t\t\tanimate={ {\n\t\t\t\tscale: 1,\n\t\t\t\topacity: 1,\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tscale: 0.1,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\ttransition={ {\n\t\t\t\tdelay: 0.3,\n\t\t\t\ttype: 'tween',\n\t\t\t} }\n\t\t>\n\t\t\t<span style={ headingPreviewStyle }>\n\t\t\t\t{ _x( 'A', 'Uppercase letter A' ) }\n\t\t\t</span>\n\t\t\t<span style={ bodyPreviewStyle }>\n\t\t\t\t{ _x( 'a', 'Lowercase letter A' ) }\n\t\t\t</span>\n\t\t</motion.div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,qBAAqB,QAAQ,2CAA2C;AACjF,SAASC,eAAe,QAAQ,SAAS;AAEzC,MAAM;EAAEC;AAAoB,CAAC,GAAGH,MAAM,CAAEF,sBAAuB,CAAC;AAEhE,eAAe,SAASM,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC;AAAU,CAAC,EAAG;EACpE,MAAM;IAAEC;EAAK,CAAC,GAAGd,UAAU,CAAEU,mBAAoB,CAAC;EAClD,IAAIK,MAAM,GAAGD,IAAI;EACjB,IAAKD,SAAS,EAAG;IAChBE,MAAM,GAAGT,uBAAuB,CAAEQ,IAAI,EAAED,SAAU,CAAC;EACpD;EACA,MAAM,CAAEG,gBAAgB,EAAEC,mBAAmB,CAAE,GAAGR,eAAe,CAAEM,MAAO,CAAC;EAC3E,MAAMG,gBAAgB,GAAGF,gBAAgB,GACtCR,qBAAqB,CAAEQ,gBAAiB,CAAC,GACzC,CAAC,CAAC;EACL,MAAMG,mBAAmB,GAAGF,mBAAmB,GAC5CT,qBAAqB,CAAES,mBAAoB,CAAC,GAC5C,CAAC,CAAC;EAEL,IAAKL,QAAQ,EAAG;IACfM,gBAAgB,CAACN,QAAQ,GAAGA,QAAQ;IACpCO,mBAAmB,CAACP,QAAQ,GAAGA,QAAQ;EACxC;EAEA,OACCQ,aAAA,CAAClB,MAAM,CAACmB,GAAG;IACVC,SAAS,EAAC,4CAA4C;IACtDC,OAAO,EAAG;MACTC,KAAK,EAAE,CAAC;MACRC,OAAO,EAAE;IACV,CAAG;IACHC,OAAO,EAAG;MACTF,KAAK,EAAE,GAAG;MACVC,OAAO,EAAE;IACV,CAAG;IACHE,UAAU,EAAG;MACZC,KAAK,EAAE,GAAG;MACVC,IAAI,EAAE;IACP;EAAG,GAEHT,aAAA;IAAMU,KAAK,EAAGX;EAAqB,GAChChB,EAAE,CAAE,GAAG,EAAE,oBAAqB,CAC3B,CAAC,EACPiB,aAAA;IAAMU,KAAK,EAAGZ;EAAkB,GAC7Bf,EAAE,CAAE,GAAG,EAAE,oBAAqB,CAC3B,CACK,CAAC;AAEf"}
@@ -14,7 +14,7 @@ import { speak } from '@wordpress/a11y';
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
- import { useBlockVariations } from './variations-panel';
17
+ import { useBlockVariations } from './variations/variations-panel';
18
18
  import ScreenHeader from './header';
19
19
  import { NavigationButtonAsItem } from './navigation-button';
20
20
  import { unlock } from '../../lock-unlock';
@@ -1 +1 @@
1
- {"version":3,"names":["store","blocksStore","__","sprintf","_n","FlexItem","SearchControl","__experimentalHStack","HStack","useSelect","useState","useEffect","useRef","useDeferredValue","memo","BlockIcon","privateApis","blockEditorPrivateApis","useDebounce","speak","useBlockVariations","ScreenHeader","NavigationButtonAsItem","unlock","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useSortedBlockTypes","blockItems","select","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","createElement","path","encodeURIComponent","justify","icon","BlockList","filterValue","sortedBlockTypes","debouncedSpeak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","ref","className","map","key","MemoizedBlockList","ScreenBlockList","setFilterValue","deferredFilterValue","Fragment","description","__nextHasNoMarginBottom","onChange","value","label","placeholder"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"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 {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseDeferredValue,\n\tmemo,\n} 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 '../../lock-unlock';\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 BlockList( { filterValue } ) {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst { isMatchingSearchTerm } = useSelect( blocksStore );\n\n\tconst filteredBlockTypes = ! filterValue\n\t\t? sortedBlockTypes\n\t\t: sortedBlockTypes.filter( ( blockType ) =>\n\t\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t );\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<div\n\t\t\tref={ blockTypesListRef }\n\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t>\n\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t<BlockMenuItem\n\t\t\t\t\tblock={ block }\n\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nconst MemoizedBlockList = memo( BlockList );\n\nfunction ScreenBlockList() {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst deferredFilterValue = useDeferredValue( filterValue );\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<MemoizedBlockList filterValue={ deferredFilterValue } />\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACjD,SACCC,QAAQ,EACRC,aAAa,EACbC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,QAAQ,EACRC,SAAS,EACTC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,QACE,oBAAoB;AAC3B,SACCC,SAAS,EACTC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,OAAOC,YAAY,MAAM,UAAU;AACnC,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EACLC,qBAAqB;EACrBC,qBAAqB;EACrBC,iBAAiB;EACjBC,gBAAgB;EAChBC,0BAA0B;EAC1BC;AACD,CAAC,GAAGN,MAAM,CAAEN,sBAAuB,CAAC;AAEpC,SAASa,mBAAmBA,CAAA,EAAG;EAC9B,MAAMC,UAAU,GAAGtB,SAAS,CACzBuB,MAAM,IAAM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AqB,CAAE,CACvD,CAAC;AAEL;AAEA,eAAeF,eAAe"}
1
+ {"version":3,"names":["store","blocksStore","__","sprintf","_n","FlexItem","SearchControl","__experimentalHStack","HStack","useSelect","useState","useEffect","useRef","useDeferredValue","memo","BlockIcon","privateApis","blockEditorPrivateApis","useDebounce","speak","useBlockVariations","ScreenHeader","NavigationButtonAsItem","unlock","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useSortedBlockTypes","blockItems","select","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","createElement","path","encodeURIComponent","justify","icon","BlockList","filterValue","sortedBlockTypes","debouncedSpeak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","ref","className","map","key","MemoizedBlockList","ScreenBlockList","setFilterValue","deferredFilterValue","Fragment","description","__nextHasNoMarginBottom","onChange","value","label","placeholder"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"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 {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseDeferredValue,\n\tmemo,\n} 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/variations-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { unlock } from '../../lock-unlock';\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 BlockList( { filterValue } ) {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst { isMatchingSearchTerm } = useSelect( blocksStore );\n\n\tconst filteredBlockTypes = ! filterValue\n\t\t? sortedBlockTypes\n\t\t: sortedBlockTypes.filter( ( blockType ) =>\n\t\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t );\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<div\n\t\t\tref={ blockTypesListRef }\n\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t>\n\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t<BlockMenuItem\n\t\t\t\t\tblock={ block }\n\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nconst MemoizedBlockList = memo( BlockList );\n\nfunction ScreenBlockList() {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst deferredFilterValue = useDeferredValue( filterValue );\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<MemoizedBlockList filterValue={ deferredFilterValue } />\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACjD,SACCC,QAAQ,EACRC,aAAa,EACbC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,QAAQ,EACRC,SAAS,EACTC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,QACE,oBAAoB;AAC3B,SACCC,SAAS,EACTC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;A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AG3D,EAAE,CAAE,QAAS,CAAG;IACxBuF,WAAW,EAAGvF,EAAE,CACf,qEACD;EAAG,CACH,CAAC,EACF4D,aAAA,CAACxD,aAAa;IACboF,uBAAuB;IACvBT,SAAS,EAAC,8BAA8B;IACxCU,QAAQ,EAAGL,cAAgB;IAC3BM,KAAK,EAAGxB,WAAa;IACrByB,KAAK,EAAG3F,EAAE,CAAE,mBAAoB,CAAG;IACnC4F,WAAW,EAAG5F,EAAE,CAAE,QAAS;EAAG,CAC9B,CAAC,EACF4D,aAAA,CAACsB,iBAAiB;IAAChB,WAAW,EAAGmB;EAAqB,CAAE,CACvD,CAAC;AAEL;AAEA,eAAeF,eAAe"}
@@ -17,7 +17,7 @@ import ScreenHeader from './header';
17
17
  import BlockPreviewPanel from './block-preview-panel';
18
18
  import { unlock } from '../../lock-unlock';
19
19
  import Subtitle from './subtitle';
20
- import { useBlockVariations, VariationsPanel } from './variations-panel';
20
+ import { useBlockVariations, VariationsPanel } from './variations/variations-panel';
21
21
  function applyFallbackStyle(border) {
22
22
  if (!border) {
23
23
  return border;
@@ -1 +1 @@
1
- {"version":3,"names":["getBlockType","privateApis","blockEditorPrivateApis","useMemo","useSelect","store","coreStore","PanelBody","__experimentalVStack","VStack","__experimentalHasSplitBorders","hasSplitBorders","__","sprintf","ScreenHeader","BlockPreviewPanel","unlock","Subtitle","useBlockVariations","VariationsPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","dimensions","aspectRatio","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","createElement","Fragment","title","label","className","inheritedValue","value","onChange","includeLayoutControls","initialOpen"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"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\t__experimentalHasSplitBorders as hasSplitBorders,\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 '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\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 [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\t// Only allow `aspectRatio` support if the block is not the grouping block.\n\t// The grouping block allows the user to use Group, Row and Stack variations,\n\t// and it is highly likely that the user will not want to set an aspect ratio\n\t// for all three at once. Until there is the ability to set a different aspect\n\t// ratio for each variation, we disable the aspect ratio controls for the\n\t// grouping block in global styles.\n\tif ( settings?.dimensions?.aspectRatio && name === 'core/group' ) {\n\t\tsettings.dimensions.aspectRatio = false;\n\t}\n\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 hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\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: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\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: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.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 !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\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={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\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={ setStyle }\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{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\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. You do not need to include a CSS selector, just add the property and value.'\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,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Gd,gBAAkB;IAC7Ba,KAAK,EAAGnD,YAAc;IACtBkD,cAAc,EAAG/C;EAAU,CAC3B,CACD,EAECmB,UAAU,IACXuB,aAAA,CAACtG,SAAS;IAACwG,KAAK,EAAGnG,EAAE,CAAE,UAAW,CAAG;IAAC0G,WAAW,EAAG;EAAO,GAC1DT,aAAA,YACGhG,OAAO;EACR;EACAD,EAAE,CACD,2IACD,CAAC,EACDwD,SAAS,EAAE2C,KACZ,CACE,CAAC,EACJF,aAAA,CAACxD,mBAAmB;IACnB8D,KAAK,EAAG1F,KAAO;IACf2F,QAAQ,EAAGrD,QAAU;IACrBmD,cAAc,EAAGpD;EAAgB,CACjC,CACS,CAEX,CAAC;AAEL;AAEA,eAAeR,WAAW"}
1
+ {"version":3,"names":["getBlockType","privateApis","blockEditorPrivateApis","useMemo","useSelect","store","coreStore","PanelBody","__experimentalVStack","VStack","__experimentalHasSplitBorders","hasSplitBorders","__","sprintf","ScreenHeader","BlockPreviewPanel","unlock","Subtitle","useBlockVariations","VariationsPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","dimensions","aspectRatio","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","createElement","Fragment","title","label","className","inheritedValue","value","onChange","includeLayoutControls","initialOpen"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"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\t__experimentalHasSplitBorders as hasSplitBorders,\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 '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport {\n\tuseBlockVariations,\n\tVariationsPanel,\n} from './variations/variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\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 [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\t// Only allow `aspectRatio` support if the block is not the grouping block.\n\t// The grouping block allows the user to use Group, Row and Stack variations,\n\t// and it is highly likely that the user will not want to set an aspect ratio\n\t// for all three at once. Until there is the ability to set a different aspect\n\t// ratio for each variation, we disable the aspect ratio controls for the\n\t// grouping block in global styles.\n\tif ( settings?.dimensions?.aspectRatio && name === 'core/group' ) {\n\t\tsettings.dimensions.aspectRatio = false;\n\t}\n\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 hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\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: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\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: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.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 !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\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={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\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={ setStyle }\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{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\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. You do not need to include a CSS selector, just add the property and value.'\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,SAAS,EACTC,oBAAoB,IAAIC,MAAM,EAC9BC,6BAA6B,IAAIC,eAAe,QAC1C,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iB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AAA,YACGhG,OAAO;EACR;EACAD,EAAE,CACD,2IACD,CAAC,EACDwD,SAAS,EAAE2C,KACZ,CACE,CAAC,EACJF,aAAA,CAACxD,mBAAmB;IACnB8D,KAAK,EAAG1F,KAAO;IACf2F,QAAQ,EAAGrD,QAAU;IACrBmD,cAAc,EAAGpD;EAAgB,CACjC,CACS,CAEX,CAAC;AAEL;AAEA,eAAeR,WAAW"}
@@ -12,6 +12,8 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
12
12
  import ScreenHeader from './header';
13
13
  import Palette from './palette';
14
14
  import { unlock } from '../../lock-unlock';
15
+ import ColorVariations from './variations/variations-color';
16
+ import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
15
17
  const {
16
18
  useGlobalStyle,
17
19
  useGlobalSetting,
@@ -27,14 +29,20 @@ function ScreenColors() {
27
29
  });
28
30
  const [rawSettings] = useGlobalSetting('');
29
31
  const settings = useSettingsForBlockElement(rawSettings);
32
+ const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig({
33
+ property: 'color',
34
+ filter: variation => variation?.settings?.color && Object.keys(variation?.settings?.color).length
35
+ });
30
36
  return createElement(Fragment, null, createElement(ScreenHeader, {
31
37
  title: __('Colors'),
32
38
  description: __('Manage palettes and the default color of different global elements on the site.')
33
39
  }), createElement("div", {
34
40
  className: "edit-site-global-styles-screen-colors"
35
41
  }, createElement(VStack, {
36
- spacing: 10
37
- }, createElement(Palette, null), createElement(StylesColorPanel, {
42
+ spacing: 3
43
+ }, !!colorVariations.length && createElement(ColorVariations, {
44
+ variations: colorVariations
45
+ }), createElement(Palette, null), createElement(StylesColorPanel, {
38
46
  inheritedValue: inheritedStyle,
39
47
  value: style,
40
48
  onChange: setStyle,
@@ -1 +1 @@
1
- {"version":3,"names":["__","__experimentalVStack","VStack","privateApis","blockEditorPrivateApis","ScreenHeader","Palette","unlock","useGlobalStyle","useGlobalSetting","useSettingsForBlockElement","ColorPanel","StylesColorPanel","ScreenColors","style","undefined","shouldDecodeEncode","inheritedStyle","setStyle","rawSettings","settings","createElement","Fragment","title","description","className","spacing","inheritedValue","value","onChange"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-colors.js"],"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 { unlock } from '../../lock-unlock';\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\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,Q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AAEA,eAAeP,YAAY"}
1
+ {"version":3,"names":["__","__experimentalVStack","VStack","privateApis","blockEditorPrivateApis","ScreenHeader","Palette","unlock","ColorVariations","useCurrentMergeThemeStyleVariationsWithUserConfig","useGlobalStyle","useGlobalSetting","useSettingsForBlockElement","ColorPanel","StylesColorPanel","ScreenColors","style","undefined","shouldDecodeEncode","inheritedStyle","setStyle","rawSettings","settings","colorVariations","property","filter","variation","color","Object","keys","length","createElement","Fragment","title","description","className","spacing","variations","inheritedValue","value","onChange"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-colors.js"],"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 { unlock } from '../../lock-unlock';\nimport ColorVariations from './variations/variations-color';\nimport { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';\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\tconst colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\t\tproperty: 'color',\n\t\tfilter: ( variation ) =>\n\t\t\tvariation?.settings?.color &&\n\t\t\tObject.keys( variation?.settings?.color ).length,\n\t} );\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\t\t\t<div className=\"edit-site-global-styles-screen-colors\">\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t{ !! colorVariations.length && (\n\t\t\t\t\t\t<ColorVariations variations={ colorVariations } />\n\t\t\t\t\t) }\n\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,OAAOC,YAAY,MAAM,UAAU;AACnC,OAAOC,OAAO,MAAM,WAAW;AAC/B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,eAAe,MAAM,+BAA+B;AAC3D,SAASC,iDAAiD,QAAQ,+EAA+E;AAEjJ,MAAM;EACLC,cAAc;EACdC,gBAAgB;EAChBC,0BAA0B;EAC1BC,UAAU,EAAEC;AACb,CAAC,GAAGP,MAAM,CAAEH,sBAAuB,CAAC;AAEpC,SAASW,YAAYA,CAAA,EAAG;EACvB,MAAM,CAAEC,KAAK,CAAE,GAAGN,cAAc,CAAE,EAAE,EAAEO,SAAS,EAAE,MAAM,EAAE;IACxDC,kBAAkB,EAAE;EACrB,CAAE,CAAC;EACH,MAAM,CAAEC,cAAc,EAAEC,QAAQ,CAAE,GAAGV,cAAc,CAAE,EAAE,EAAEO,SAAS,EAAE,KAAK,EAAE;IAC1EC,kBAAkB,EAAE;EACrB,CAAE,CAAC;EACH,MAAM,CAAEG,WAAW,CAAE,GAAGV,gBAAgB,CAAE,EAAG,CAAC;EAC9C,MAAMW,QAAQ,GAAGV,0BAA0B,CAAES,WAAY,CAAC;EAE1D,MAAME,eAAe,GAAGd,iDAAiD,CAAE;IAC1Ee,QAAQ,EAAE,OAAO;IACjBC,MAAM,EAAIC,SAAS,IAClBA,SAAS,EAAEJ,QAAQ,EAAEK,KAAK,IAC1BC,MAAM,CAACC,IAAI,CAAEH,SAAS,EAAEJ,QAAQ,EAAEK,KAAM,CAAC,CAACG;EAC5C,CAAE,CAAC;EACH,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAC1B,YAAY;IACZ4B,KAAK,EAAGjC,EAAE,CAAE,QAAS,CAAG;IACxBkC,WAAW,EAAGlC,EAAE,CACf,iFACD;EAAG,CACH,CAAC,EACF+B,aAAA;IAAKI,SAAS,EAAC;EAAuC,GACrDJ,aAAA,CAAC7B,MAAM;IAACkC,OAAO,EAAG;EAAG,GAClB,CAAC,CAAEb,eAAe,CAACO,MAAM,IAC1BC,aAAA,CAACvB,eAAe;IAAC6B,UAAU,EAAGd;EAAiB,CAAE,CACjD,EAEDQ,aAAA,CAACzB,OAAO,MAAE,CAAC,EAEXyB,aAAA,CAACjB,gBAAgB;IAChBwB,cAAc,EAAGnB,cAAgB;IACjCoB,KAAK,EAAGvB,KAAO;IACfwB,QAAQ,EAAGpB,QAAU;IACrBE,QAAQ,EAAGA;EAAU,CACrB,CACM,CACJ,CACJ,CAAC;AAEL;AAEA,eAAeP,YAAY"}
@@ -61,7 +61,8 @@ function ScreenRevisions() {
61
61
  const selectedRevisionMatchesEditorStyles = areGlobalStyleConfigsEqual(currentlySelectedRevision, currentEditorGlobalStyles);
62
62
  const onCloseRevisions = () => {
63
63
  goTo('/'); // Return to global styles main panel.
64
- setEditorCanvasContainerView(undefined);
64
+ const canvasContainerView = editorCanvasContainerView === 'global-styles-revisions:style-book' ? 'style-book' : undefined;
65
+ setEditorCanvasContainerView(canvasContainerView);
65
66
  };
66
67
  const restoreRevision = revision => {
67
68
  setUserConfig(() => ({
@@ -81,7 +82,6 @@ function ScreenRevisions() {
81
82
  useEffect(() => {
82
83
  if (!editorCanvasContainerView || !editorCanvasContainerView.startsWith('global-styles-revisions')) {
83
84
  goTo('/'); // Return to global styles main panel.
84
- setEditorCanvasContainerView(editorCanvasContainerView);
85
85
  }
86
86
  }, [editorCanvasContainerView]);
87
87
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","__experimentalUseNavigator","useNavigator","__experimentalConfirmDialog","ConfirmDialog","Spinner","useSelect","useDispatch","useContext","useState","useEffect","privateApis","blockEditorPrivateApis","store","blockEditorStore","ScreenHeader","unlock","Revisions","editSiteStore","useGlobalStylesRevisions","RevisionsButtons","StyleBook","Pagination","GlobalStylesContext","areGlobalStyleConfigsEqual","PAGE_SIZE","ScreenRevisions","goTo","user","currentEditorGlobalStyles","setUserConfig","blocks","editorCanvasContainerView","select","getEditorCanvasContainerView","getBlocks","currentPage","setCurrentPage","currentRevisions","setCurrentRevisions","revisions","isLoading","hasUnsavedChanges","revisionsCount","query","per_page","page","numPages","Math","ceil","currentlySelectedRevision","setCurrentlySelectedRevision","isLoadingRevisionWithUnsavedChanges","setIsLoadingRevisionWithUnsavedChanges","setEditorCanvasContainerView","selectedRevisionMatchesEditorStyles","onCloseRevisions","undefined","restoreRevision","revision","styles","settings","selectRevision","id","startsWith","length","firstRevision","currentlySelectedRevisionId","shouldSelectFirstItem","isLoadButtonEnabled","hasRevisions","createElement","Fragment","title","description","onBack","className","userConfig","isSelected","onClose","closeButtonLabel","onChange","selectedRevisionId","userRevisions","canApplyRevision","onApplyRevision","changePage","totalItems","disabled","label","isOpen","confirmButtonText","onConfirm","onCancel"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext, useState, useEffect } from '@wordpress/element';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from '../header';\nimport { unlock } from '../../../lock-unlock';\nimport Revisions from '../../revisions';\nimport { store as editSiteStore } from '../../../store';\nimport useGlobalStylesRevisions from './use-global-styles-revisions';\nimport RevisionsButtons from './revisions-buttons';\nimport StyleBook from '../../style-book';\nimport Pagination from '../../pagination';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst PAGE_SIZE = 10;\n\nfunction ScreenRevisions() {\n\tconst { goTo } = useNavigator();\n\tconst { user: currentEditorGlobalStyles, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\tconst { blocks, editorCanvasContainerView } = useSelect(\n\t\t( select ) => ( {\n\t\t\teditorCanvasContainerView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tblocks: select( blockEditorStore ).getBlocks(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\tconst [ currentRevisions, setCurrentRevisions ] = useState( [] );\n\tconst { revisions, isLoading, hasUnsavedChanges, revisionsCount } =\n\t\tuseGlobalStylesRevisions( {\n\t\t\tquery: {\n\t\t\t\tper_page: PAGE_SIZE,\n\t\t\t\tpage: currentPage,\n\t\t\t},\n\t\t} );\n\n\tconst numPages = Math.ceil( revisionsCount / PAGE_SIZE );\n\n\tconst [ currentlySelectedRevision, setCurrentlySelectedRevision ] =\n\t\tuseState( currentEditorGlobalStyles );\n\tconst [\n\t\tisLoadingRevisionWithUnsavedChanges,\n\t\tsetIsLoadingRevisionWithUnsavedChanges,\n\t] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst selectedRevisionMatchesEditorStyles = areGlobalStyleConfigsEqual(\n\t\tcurrentlySelectedRevision,\n\t\tcurrentEditorGlobalStyles\n\t);\n\n\tconst onCloseRevisions = () => {\n\t\tgoTo( '/' ); // Return to global styles main panel.\n\t\tsetEditorCanvasContainerView( undefined );\n\t};\n\n\tconst restoreRevision = ( revision ) => {\n\t\tsetUserConfig( () => ( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t} ) );\n\t\tsetIsLoadingRevisionWithUnsavedChanges( false );\n\t\tonCloseRevisions();\n\t};\n\n\tconst selectRevision = ( revision ) => {\n\t\tsetCurrentlySelectedRevision( {\n\t\t\tstyles: revision?.styles || {},\n\t\t\tsettings: revision?.settings || {},\n\t\t\tid: revision?.id,\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! editorCanvasContainerView ||\n\t\t\t! editorCanvasContainerView.startsWith( 'global-styles-revisions' )\n\t\t) {\n\t\t\tgoTo( '/' ); // Return to global styles main panel.\n\t\t\tsetEditorCanvasContainerView( editorCanvasContainerView );\n\t\t}\n\t}, [ editorCanvasContainerView ] );\n\n\tuseEffect( () => {\n\t\tif ( ! isLoading && revisions.length ) {\n\t\t\tsetCurrentRevisions( revisions );\n\t\t}\n\t}, [ revisions, isLoading ] );\n\n\tconst firstRevision = revisions[ 0 ];\n\tconst currentlySelectedRevisionId = currentlySelectedRevision?.id;\n\tconst shouldSelectFirstItem =\n\t\t!! firstRevision?.id &&\n\t\t! selectedRevisionMatchesEditorStyles &&\n\t\t! currentlySelectedRevisionId;\n\n\tuseEffect( () => {\n\t\t/*\n\t\t * Ensure that the first item is selected and loaded into the preview pane\n\t\t * when no revision is selected and the selected styles don't match the current editor styles.\n\t\t * This is required in case editor styles are changed outside the revisions panel,\n\t\t * e.g., via the reset styles function of useGlobalStylesReset().\n\t\t * See: https://github.com/WordPress/gutenberg/issues/55866\n\t\t */\n\t\tif ( shouldSelectFirstItem ) {\n\t\t\tsetCurrentlySelectedRevision( {\n\t\t\t\tstyles: firstRevision?.styles || {},\n\t\t\t\tsettings: firstRevision?.settings || {},\n\t\t\t\tid: firstRevision?.id,\n\t\t\t} );\n\t\t}\n\t}, [ shouldSelectFirstItem, firstRevision ] );\n\n\t// Only display load button if there is a revision to load,\n\t// and it is different from the current editor styles.\n\tconst isLoadButtonEnabled =\n\t\t!! currentlySelectedRevisionId &&\n\t\tcurrentlySelectedRevisionId !== 'unsaved' &&\n\t\t! selectedRevisionMatchesEditorStyles;\n\tconst hasRevisions = !! currentRevisions.length;\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={\n\t\t\t\t\trevisionsCount &&\n\t\t\t\t\t// translators: %s: number of revisions.\n\t\t\t\t\tsprintf( __( 'Revisions (%s)' ), revisionsCount )\n\t\t\t\t}\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Click on previously saved styles to preview them. To restore a selected version to the editor, hit \"Apply.\" When you\\'re ready, use the Save button to save your changes.'\n\t\t\t\t) }\n\t\t\t\tonBack={ onCloseRevisions }\n\t\t\t/>\n\t\t\t{ ! hasRevisions && (\n\t\t\t\t<Spinner className=\"edit-site-global-styles-screen-revisions__loading\" />\n\t\t\t) }\n\t\t\t{ hasRevisions &&\n\t\t\t\t( editorCanvasContainerView ===\n\t\t\t\t'global-styles-revisions:style-book' ? (\n\t\t\t\t\t<StyleBook\n\t\t\t\t\t\tuserConfig={ currentlySelectedRevision }\n\t\t\t\t\t\tisSelected={ () => {} }\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t'global-styles-revisions'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<Revisions\n\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\tuserConfig={ currentlySelectedRevision }\n\t\t\t\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t<RevisionsButtons\n\t\t\t\tonChange={ selectRevision }\n\t\t\t\tselectedRevisionId={ currentlySelectedRevisionId }\n\t\t\t\tuserRevisions={ currentRevisions }\n\t\t\t\tcanApplyRevision={ isLoadButtonEnabled }\n\t\t\t\tonApplyRevision={ () =>\n\t\t\t\t\thasUnsavedChanges\n\t\t\t\t\t\t? setIsLoadingRevisionWithUnsavedChanges( true )\n\t\t\t\t\t\t: restoreRevision( currentlySelectedRevision )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-revisions__footer\">\n\t\t\t\t\t<Pagination\n\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__pagination\"\n\t\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\t\tnumPages={ numPages }\n\t\t\t\t\t\tchangePage={ setCurrentPage }\n\t\t\t\t\t\ttotalItems={ revisionsCount }\n\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\tlabel={ __( 'Global Styles pagination navigation' ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ isLoadingRevisionWithUnsavedChanges && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ isLoadingRevisionWithUnsavedChanges }\n\t\t\t\t\tconfirmButtonText={ __( 'Apply' ) }\n\t\t\t\t\tonConfirm={ () =>\n\t\t\t\t\t\trestoreRevision( currentlySelectedRevision )\n\t\t\t\t\t}\n\t\t\t\t\tonCancel={ () =>\n\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges( false )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Any unsaved changes will be lost when you apply this revision.'\n\t\t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AS,EAAC;EAAkD,GAChEL,aAAA,CAACjD,UAAU;IACVsD,SAAS,EAAC,sDAAsD;IAChExC,WAAW,EAAGA,WAAa;IAC3BW,QAAQ,EAAGA,QAAU;IACrBuC,UAAU,EAAGjD,cAAgB;IAC7BkD,UAAU,EAAG5C,cAAgB;IAC7B6C,QAAQ,EAAG/C,SAAW;IACtBgD,KAAK,EAAG1F,EAAE,CAAE,qCAAsC;EAAG,CACrD,CACG,CACL,EACCqD,mCAAmC,IACpCmB,aAAA,CAACnE,aAAa;IACbsF,MAAM,EAAGtC,mCAAqC;IAC9CuC,iBAAiB,EAAG5F,EAAE,CAAE,OAAQ,CAAG;IACnC6F,SAAS,EAAGA,CAAA,KACXlC,eAAe,CAAER,yBAA0B,CAC3C;IACD2C,QAAQ,EAAGA,CAAA,KACVxC,sCAAsC,CAAE,KAAM;EAC9C,GAECtD,EAAE,CACH,gEACD,CACc,CAEf,CAAC;AAEL;AAEA,eAAe2B,eAAe"}
1
+ {"version":3,"names":["__","sprintf","__experimentalUseNavigator","useNavigator","__experimentalConfirmDialog","ConfirmDialog","Spinner","useSelect","useDispatch","useContext","useState","useEffect","privateApis","blockEditorPrivateApis","store","blockEditorStore","ScreenHeader","unlock","Revisions","editSiteStore","useGlobalStylesRevisions","RevisionsButtons","StyleBook","Pagination","GlobalStylesContext","areGlobalStyleConfigsEqual","PAGE_SIZE","ScreenRevisions","goTo","user","currentEditorGlobalStyles","setUserConfig","blocks","editorCanvasContainerView","select","getEditorCanvasContainerView","getBlocks","currentPage","setCurrentPage","currentRevisions","setCurrentRevisions","revisions","isLoading","hasUnsavedChanges","revisionsCount","query","per_page","page","numPages","Math","ceil","currentlySelectedRevision","setCurrentlySelectedRevision","isLoadingRevisionWithUnsavedChanges","setIsLoadingRevisionWithUnsavedChanges","setEditorCanvasContainerView","selectedRevisionMatchesEditorStyles","onCloseRevisions","canvasContainerView","undefined","restoreRevision","revision","styles","settings","selectRevision","id","startsWith","length","firstRevision","currentlySelectedRevisionId","shouldSelectFirstItem","isLoadButtonEnabled","hasRevisions","createElement","Fragment","title","description","onBack","className","userConfig","isSelected","onClose","closeButtonLabel","onChange","selectedRevisionId","userRevisions","canApplyRevision","onApplyRevision","changePage","totalItems","disabled","label","isOpen","confirmButtonText","onConfirm","onCancel"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext, useState, useEffect } from '@wordpress/element';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from '../header';\nimport { unlock } from '../../../lock-unlock';\nimport Revisions from '../../revisions';\nimport { store as editSiteStore } from '../../../store';\nimport useGlobalStylesRevisions from './use-global-styles-revisions';\nimport RevisionsButtons from './revisions-buttons';\nimport StyleBook from '../../style-book';\nimport Pagination from '../../pagination';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst PAGE_SIZE = 10;\n\nfunction ScreenRevisions() {\n\tconst { goTo } = useNavigator();\n\tconst { user: currentEditorGlobalStyles, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\tconst { blocks, editorCanvasContainerView } = useSelect(\n\t\t( select ) => ( {\n\t\t\teditorCanvasContainerView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tblocks: select( blockEditorStore ).getBlocks(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\tconst [ currentRevisions, setCurrentRevisions ] = useState( [] );\n\tconst { revisions, isLoading, hasUnsavedChanges, revisionsCount } =\n\t\tuseGlobalStylesRevisions( {\n\t\t\tquery: {\n\t\t\t\tper_page: PAGE_SIZE,\n\t\t\t\tpage: currentPage,\n\t\t\t},\n\t\t} );\n\n\tconst numPages = Math.ceil( revisionsCount / PAGE_SIZE );\n\n\tconst [ currentlySelectedRevision, setCurrentlySelectedRevision ] =\n\t\tuseState( currentEditorGlobalStyles );\n\tconst [\n\t\tisLoadingRevisionWithUnsavedChanges,\n\t\tsetIsLoadingRevisionWithUnsavedChanges,\n\t] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst selectedRevisionMatchesEditorStyles = areGlobalStyleConfigsEqual(\n\t\tcurrentlySelectedRevision,\n\t\tcurrentEditorGlobalStyles\n\t);\n\n\tconst onCloseRevisions = () => {\n\t\tgoTo( '/' ); // Return to global styles main panel.\n\t\tconst canvasContainerView =\n\t\t\teditorCanvasContainerView === 'global-styles-revisions:style-book'\n\t\t\t\t? 'style-book'\n\t\t\t\t: undefined;\n\t\tsetEditorCanvasContainerView( canvasContainerView );\n\t};\n\n\tconst restoreRevision = ( revision ) => {\n\t\tsetUserConfig( () => ( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t} ) );\n\t\tsetIsLoadingRevisionWithUnsavedChanges( false );\n\t\tonCloseRevisions();\n\t};\n\n\tconst selectRevision = ( revision ) => {\n\t\tsetCurrentlySelectedRevision( {\n\t\t\tstyles: revision?.styles || {},\n\t\t\tsettings: revision?.settings || {},\n\t\t\tid: revision?.id,\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! editorCanvasContainerView ||\n\t\t\t! editorCanvasContainerView.startsWith( 'global-styles-revisions' )\n\t\t) {\n\t\t\tgoTo( '/' ); // Return to global styles main panel.\n\t\t}\n\t}, [ editorCanvasContainerView ] );\n\n\tuseEffect( () => {\n\t\tif ( ! isLoading && revisions.length ) {\n\t\t\tsetCurrentRevisions( revisions );\n\t\t}\n\t}, [ revisions, isLoading ] );\n\n\tconst firstRevision = revisions[ 0 ];\n\tconst currentlySelectedRevisionId = currentlySelectedRevision?.id;\n\tconst shouldSelectFirstItem =\n\t\t!! firstRevision?.id &&\n\t\t! selectedRevisionMatchesEditorStyles &&\n\t\t! currentlySelectedRevisionId;\n\n\tuseEffect( () => {\n\t\t/*\n\t\t * Ensure that the first item is selected and loaded into the preview pane\n\t\t * when no revision is selected and the selected styles don't match the current editor styles.\n\t\t * This is required in case editor styles are changed outside the revisions panel,\n\t\t * e.g., via the reset styles function of useGlobalStylesReset().\n\t\t * See: https://github.com/WordPress/gutenberg/issues/55866\n\t\t */\n\t\tif ( shouldSelectFirstItem ) {\n\t\t\tsetCurrentlySelectedRevision( {\n\t\t\t\tstyles: firstRevision?.styles || {},\n\t\t\t\tsettings: firstRevision?.settings || {},\n\t\t\t\tid: firstRevision?.id,\n\t\t\t} );\n\t\t}\n\t}, [ shouldSelectFirstItem, firstRevision ] );\n\n\t// Only display load button if there is a revision to load,\n\t// and it is different from the current editor styles.\n\tconst isLoadButtonEnabled =\n\t\t!! currentlySelectedRevisionId &&\n\t\tcurrentlySelectedRevisionId !== 'unsaved' &&\n\t\t! selectedRevisionMatchesEditorStyles;\n\tconst hasRevisions = !! currentRevisions.length;\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={\n\t\t\t\t\trevisionsCount &&\n\t\t\t\t\t// translators: %s: number of revisions.\n\t\t\t\t\tsprintf( __( 'Revisions (%s)' ), revisionsCount )\n\t\t\t\t}\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Click on previously saved styles to preview them. To restore a selected version to the editor, hit \"Apply.\" When you\\'re ready, use the Save button to save your changes.'\n\t\t\t\t) }\n\t\t\t\tonBack={ onCloseRevisions }\n\t\t\t/>\n\t\t\t{ ! hasRevisions && (\n\t\t\t\t<Spinner className=\"edit-site-global-styles-screen-revisions__loading\" />\n\t\t\t) }\n\t\t\t{ hasRevisions &&\n\t\t\t\t( editorCanvasContainerView ===\n\t\t\t\t'global-styles-revisions:style-book' ? (\n\t\t\t\t\t<StyleBook\n\t\t\t\t\t\tuserConfig={ currentlySelectedRevision }\n\t\t\t\t\t\tisSelected={ () => {} }\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t'global-styles-revisions'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<Revisions\n\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\tuserConfig={ currentlySelectedRevision }\n\t\t\t\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t<RevisionsButtons\n\t\t\t\tonChange={ selectRevision }\n\t\t\t\tselectedRevisionId={ currentlySelectedRevisionId }\n\t\t\t\tuserRevisions={ currentRevisions }\n\t\t\t\tcanApplyRevision={ isLoadButtonEnabled }\n\t\t\t\tonApplyRevision={ () =>\n\t\t\t\t\thasUnsavedChanges\n\t\t\t\t\t\t? setIsLoadingRevisionWithUnsavedChanges( true )\n\t\t\t\t\t\t: restoreRevision( currentlySelectedRevision )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-revisions__footer\">\n\t\t\t\t\t<Pagination\n\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__pagination\"\n\t\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\t\tnumPages={ numPages }\n\t\t\t\t\t\tchangePage={ setCurrentPage }\n\t\t\t\t\t\ttotalItems={ revisionsCount }\n\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\tlabel={ __( 'Global Styles pagination navigation' ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ isLoadingRevisionWithUnsavedChanges && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ isLoadingRevisionWithUnsavedChanges }\n\t\t\t\t\tconfirmButtonText={ __( 'Apply' ) }\n\t\t\t\t\tonConfirm={ () =>\n\t\t\t\t\t\trestoreRevision( currentlySelectedRevision )\n\t\t\t\t\t}\n\t\t\t\t\tonCancel={ () =>\n\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges( false )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Any unsaved changes will be lost when you apply this revision.'\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenRevisions;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,0BAA0B,IAAIC,YAAY,EAC1CC,2BAA2B,IAAIC,aAAa,EAC5CC,OAAO,QACD,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACpE,SACCC,WAAW,IAAIC,sBAAsB,EACrCC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;;AAEhC;AACA;AACA;AACA,OAAOC,YAAY,MAAM,WAAW;AACpC,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,OAAOC,SAAS,MAAM,iBAAiB;AACvC,SAASJ,KAAK,IAAIK,aAAa,QAAQ,gBAAgB;AACvD,OAAOC,wBAAwB,MAAM,+BAA+B;AACpE,OAAOC,gBAAgB,MAAM,qBAAqB;AAClD,OAAOC,SAAS,MAAM,kBAAkB;AACxC,OAAOC,UAAU,MAAM,kBAAkB;AAEzC,MAAM;EAAEC,mBAAmB;EAAEC;AAA2B,CAAC,GAAGR,MAAM,CACjEJ,sBACD,CAAC;AAED,MAAMa,SAAS,GAAG,EAAE;AAEpB,SAASC,eAAeA,CAAA,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,gBAAgB,EAAGlF,EAAE,CAAE,iBAAkB;EAAG,CAC5C,CACD,CAAE,EACJyE,aAAA,CAACpD,gBAAgB;IAChB8D,QAAQ,EAAGnB,cAAgB;IAC3BoB,kBAAkB,EAAGf,2BAA6B;IAClDgB,aAAa,EAAG9C,gBAAkB;IAClC+C,gBAAgB,EAAGf,mBAAqB;IACxCgB,eAAe,EAAGA,CAAA,KACjB5C,iBAAiB,GACdW,sCAAsC,CAAE,IAAK,CAAC,GAC9CM,eAAe,CAAET,yBAA0B;EAC9C,CACD,CAAC,EACAH,QAAQ,GAAG,CAAC,IACbyB,aAAA;IAAKK,SAAS,EAAC;EAAkD,GAChEL,aAAA,CAAClD,UAAU;IACVuD,SAAS,EAAC,sDAAsD;IAChEzC,WAAW,EAAGA,WAAa;IAC3BW,QAAQ,EAAGA,QAAU;IACrBwC,UAAU,EAAGlD,cAAgB;IAC7BmD,UAAU,EAAG7C,cAAgB;IAC7B8C,QAAQ,EAAGhD,SAAW;IACtBiD,KAAK,EAAG3F,EAAE,CAAE,qCAAsC;EAAG,CACrD,CACG,CACL,EACCqD,mCAAmC,IACpCoB,aAAA,CAACpE,aAAa;IACbuF,MAAM,EAAGvC,mCAAqC;IAC9CwC,iBAAiB,EAAG7F,EAAE,CAAE,OAAQ,CAAG;IACnC8F,SAAS,EAAGA,CAAA,KACXlC,eAAe,CAAET,yBAA0B,CAC3C;IACD4C,QAAQ,EAAGA,CAAA,KACVzC,sCAAsC,CAAE,KAAM;EAC9C,GAECtD,EAAE,CACH,gEACD,CACc,CAEf,CAAC;AAEL;AAEA,eAAe2B,eAAe"}
@@ -15,7 +15,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
15
15
  import { IconWithCurrentColor } from './icon-with-current-color';
16
16
  import { NavigationButtonAsItem } from './navigation-button';
17
17
  import RootMenu from './root-menu';
18
- import StylesPreview from './preview';
18
+ import PreviewStyles from './preview-styles';
19
19
  import { unlock } from '../../lock-unlock';
20
20
  const {
21
21
  useGlobalStyle
@@ -43,7 +43,7 @@ function ScreenRoot() {
43
43
  className: "edit-site-global-styles-screen-root"
44
44
  }, createElement(CardBody, null, createElement(VStack, {
45
45
  spacing: 4
46
- }, createElement(Card, null, createElement(CardMedia, null, createElement(StylesPreview, null))), hasVariations && createElement(ItemGroup, null, createElement(NavigationButtonAsItem, {
46
+ }, createElement(Card, null, createElement(CardMedia, null, createElement(PreviewStyles, null))), hasVariations && createElement(ItemGroup, null, createElement(NavigationButtonAsItem, {
47
47
  path: "/variations",
48
48
  "aria-label": __('Browse styles')
49
49
  }, createElement(HStack, {