@wordpress/edit-site 5.28.5 → 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 (446) hide show
  1. package/CHANGELOG.md +4 -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/block-editor/use-site-editor-settings.js +2 -1
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/code-editor/index.js +3 -2
  9. package/build/components/code-editor/index.js.map +1 -1
  10. package/build/components/editor/index.js +5 -19
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/editor-canvas-container/index.js +1 -1
  13. package/build/components/editor-canvas-container/index.js.map +1 -1
  14. package/build/components/global-styles/color-palette-panel.js +9 -0
  15. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  16. package/build/components/global-styles/font-families.js +1 -1
  17. package/build/components/global-styles/font-families.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  19. package/build/components/global-styles/font-library-modal/context.js +11 -0
  20. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  21. package/build/components/global-styles/font-library-modal/font-collection.js +5 -16
  22. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  23. package/build/components/global-styles/font-library-modal/index.js +2 -2
  24. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  25. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  26. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  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.map +1 -1
  29. package/build/components/global-styles/font-library-modal/utils/index.js +27 -0
  30. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  31. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +1 -1
  32. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  33. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  34. package/build/components/global-styles/header.js +1 -1
  35. package/build/components/global-styles/header.js.map +1 -1
  36. package/build/components/global-styles/highlighted-colors.js +50 -0
  37. package/build/components/global-styles/highlighted-colors.js.map +1 -0
  38. package/build/components/global-styles/preview-colors.js +62 -0
  39. package/build/components/global-styles/preview-colors.js.map +1 -0
  40. package/build/components/global-styles/preview-iframe.js +131 -0
  41. package/build/components/global-styles/preview-iframe.js.map +1 -0
  42. package/build/components/global-styles/preview-styles.js +163 -0
  43. package/build/components/global-styles/preview-styles.js.map +1 -0
  44. package/build/components/global-styles/preview-typography.js +65 -0
  45. package/build/components/global-styles/preview-typography.js.map +1 -0
  46. package/build/components/global-styles/screen-block-list.js +1 -1
  47. package/build/components/global-styles/screen-block-list.js.map +1 -1
  48. package/build/components/global-styles/screen-block.js +1 -1
  49. package/build/components/global-styles/screen-block.js.map +1 -1
  50. package/build/components/global-styles/screen-colors.js +10 -2
  51. package/build/components/global-styles/screen-colors.js.map +1 -1
  52. package/build/components/global-styles/screen-root.js +2 -2
  53. package/build/components/global-styles/screen-root.js.map +1 -1
  54. package/build/components/global-styles/screen-typography.js +10 -2
  55. package/build/components/global-styles/screen-typography.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +12 -84
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/{typogrphy-elements.js → typography-elements.js} +1 -1
  59. package/build/components/global-styles/typography-elements.js.map +1 -0
  60. package/build/components/global-styles/utils.js +22 -0
  61. package/build/components/global-styles/utils.js.map +1 -1
  62. package/build/components/global-styles/variations/variation.js +90 -0
  63. package/build/components/global-styles/variations/variation.js.map +1 -0
  64. package/build/components/global-styles/variations/variations-color.js +36 -0
  65. package/build/components/global-styles/variations/variations-color.js.map +1 -0
  66. package/build/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  67. package/build/components/global-styles/variations/variations-panel.js.map +1 -0
  68. package/build/components/global-styles/variations/variations-typography.js +64 -0
  69. package/build/components/global-styles/variations/variations-typography.js.map +1 -0
  70. package/build/components/header-edit-mode/document-tools/index.js +1 -2
  71. package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
  72. package/build/components/header-edit-mode/index.js +16 -13
  73. package/build/components/header-edit-mode/index.js.map +1 -1
  74. package/build/components/header-edit-mode/more-menu/index.js +17 -6
  75. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  76. package/build/components/keyboard-shortcuts/edit-mode.js +0 -13
  77. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  78. package/build/components/keyboard-shortcuts/register.js +0 -18
  79. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  80. package/build/components/layout/index.js +4 -2
  81. package/build/components/layout/index.js.map +1 -1
  82. package/build/components/page-patterns/dataviews-pattern-actions.js +25 -8
  83. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  84. package/build/components/page-patterns/header.js +2 -1
  85. package/build/components/page-patterns/header.js.map +1 -1
  86. package/build/components/page-patterns/index.js +0 -1
  87. package/build/components/page-patterns/index.js.map +1 -1
  88. package/build/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -61
  89. package/build/components/page-templates-template-parts/hooks.js.map +1 -0
  90. package/build/components/page-templates-template-parts/index.js +14 -6
  91. package/build/components/page-templates-template-parts/index.js.map +1 -1
  92. package/build/components/revisions/index.js.map +1 -1
  93. package/build/components/save-button/index.js +2 -1
  94. package/build/components/save-button/index.js.map +1 -1
  95. package/build/components/save-panel/index.js +18 -3
  96. package/build/components/save-panel/index.js.map +1 -1
  97. package/build/components/sidebar/index.js +1 -1
  98. package/build/components/sidebar/index.js.map +1 -1
  99. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +5 -5
  100. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  101. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  102. package/build/components/sidebar-edit-mode/template-panel/hooks.js +20 -5
  103. package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
  104. package/build/components/sidebar-edit-mode/template-panel/index.js +48 -5
  105. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  106. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +2 -9
  107. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-global-styles/index.js +6 -2
  109. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  110. package/build/components/sidebar-navigation-screen-main/index.js +1 -2
  111. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  113. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
  114. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  115. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  116. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  117. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +2 -2
  118. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  119. package/build/components/sidebar-navigation-screen-template/index.js +2 -2
  120. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  121. package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  122. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  123. package/build/components/start-template-options/index.js.map +1 -1
  124. package/build/hooks/commands/use-edit-mode-commands.js +3 -171
  125. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  126. package/build/hooks/index.js +0 -1
  127. package/build/hooks/index.js.map +1 -1
  128. package/build/hooks/push-changes-to-global-styles/index.js +4 -5
  129. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  130. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +156 -0
  131. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -0
  132. package/build/store/actions.js +19 -50
  133. package/build/store/actions.js.map +1 -1
  134. package/build/utils/clone-deep.js +15 -0
  135. package/build/utils/clone-deep.js.map +1 -0
  136. package/build-module/components/actions/index.js +1 -1
  137. package/build-module/components/actions/index.js.map +1 -1
  138. package/build-module/components/block-editor/editor-canvas.js +10 -11
  139. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  140. package/build-module/components/block-editor/use-site-editor-settings.js +2 -1
  141. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  142. package/build-module/components/code-editor/index.js +3 -2
  143. package/build-module/components/code-editor/index.js.map +1 -1
  144. package/build-module/components/editor/index.js +6 -20
  145. package/build-module/components/editor/index.js.map +1 -1
  146. package/build-module/components/editor-canvas-container/index.js +2 -2
  147. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  148. package/build-module/components/global-styles/color-palette-panel.js +8 -0
  149. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  150. package/build-module/components/global-styles/font-families.js +1 -1
  151. package/build-module/components/global-styles/font-families.js.map +1 -1
  152. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  153. package/build-module/components/global-styles/font-library-modal/context.js +12 -1
  154. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  155. package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -18
  156. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  157. package/build-module/components/global-styles/font-library-modal/index.js +2 -2
  158. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  159. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  160. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  161. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  162. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  163. package/build-module/components/global-styles/font-library-modal/utils/index.js +26 -0
  164. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  165. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +1 -1
  166. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  167. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  168. package/build-module/components/global-styles/header.js +1 -1
  169. package/build-module/components/global-styles/header.js.map +1 -1
  170. package/build-module/components/global-styles/highlighted-colors.js +43 -0
  171. package/build-module/components/global-styles/highlighted-colors.js.map +1 -0
  172. package/build-module/components/global-styles/preview-colors.js +54 -0
  173. package/build-module/components/global-styles/preview-colors.js.map +1 -0
  174. package/build-module/components/global-styles/preview-iframe.js +124 -0
  175. package/build-module/components/global-styles/preview-iframe.js.map +1 -0
  176. package/build-module/components/global-styles/preview-styles.js +155 -0
  177. package/build-module/components/global-styles/preview-styles.js.map +1 -0
  178. package/build-module/components/global-styles/preview-typography.js +58 -0
  179. package/build-module/components/global-styles/preview-typography.js.map +1 -0
  180. package/build-module/components/global-styles/screen-block-list.js +1 -1
  181. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  182. package/build-module/components/global-styles/screen-block.js +1 -1
  183. package/build-module/components/global-styles/screen-block.js.map +1 -1
  184. package/build-module/components/global-styles/screen-colors.js +10 -2
  185. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  186. package/build-module/components/global-styles/screen-root.js +2 -2
  187. package/build-module/components/global-styles/screen-root.js.map +1 -1
  188. package/build-module/components/global-styles/screen-typography.js +10 -2
  189. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  190. package/build-module/components/global-styles/style-variations-container.js +13 -85
  191. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  192. package/build-module/components/global-styles/{typogrphy-elements.js → typography-elements.js} +1 -1
  193. package/build-module/components/global-styles/typography-elements.js.map +1 -0
  194. package/build-module/components/global-styles/utils.js +21 -0
  195. package/build-module/components/global-styles/utils.js.map +1 -1
  196. package/build-module/components/global-styles/variations/variation.js +82 -0
  197. package/build-module/components/global-styles/variations/variation.js.map +1 -0
  198. package/build-module/components/global-styles/variations/variations-color.js +28 -0
  199. package/build-module/components/global-styles/variations/variations-color.js.map +1 -0
  200. package/build-module/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  201. package/build-module/components/global-styles/variations/variations-panel.js.map +1 -0
  202. package/build-module/components/global-styles/variations/variations-typography.js +56 -0
  203. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -0
  204. package/build-module/components/header-edit-mode/document-tools/index.js +1 -2
  205. package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
  206. package/build-module/components/header-edit-mode/index.js +17 -14
  207. package/build-module/components/header-edit-mode/index.js.map +1 -1
  208. package/build-module/components/header-edit-mode/more-menu/index.js +19 -8
  209. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  210. package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -13
  211. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  212. package/build-module/components/keyboard-shortcuts/register.js +0 -18
  213. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  214. package/build-module/components/layout/index.js +5 -3
  215. package/build-module/components/layout/index.js.map +1 -1
  216. package/build-module/components/page-patterns/dataviews-pattern-actions.js +25 -8
  217. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  218. package/build-module/components/page-patterns/header.js +2 -1
  219. package/build-module/components/page-patterns/header.js.map +1 -1
  220. package/build-module/components/page-patterns/index.js +0 -1
  221. package/build-module/components/page-patterns/index.js.map +1 -1
  222. package/build-module/components/{list/added-by.js → page-templates-template-parts/hooks.js} +2 -59
  223. package/build-module/components/page-templates-template-parts/hooks.js.map +1 -0
  224. package/build-module/components/page-templates-template-parts/index.js +13 -5
  225. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  226. package/build-module/components/revisions/index.js.map +1 -1
  227. package/build-module/components/save-button/index.js +2 -1
  228. package/build-module/components/save-button/index.js.map +1 -1
  229. package/build-module/components/save-panel/index.js +18 -3
  230. package/build-module/components/save-panel/index.js.map +1 -1
  231. package/build-module/components/sidebar/index.js +1 -1
  232. package/build-module/components/sidebar/index.js.map +1 -1
  233. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +5 -5
  234. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  235. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  236. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +20 -5
  237. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
  238. package/build-module/components/sidebar-edit-mode/template-panel/index.js +50 -7
  239. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  240. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +2 -9
  241. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
  242. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +6 -2
  243. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  244. package/build-module/components/sidebar-navigation-screen-main/index.js +1 -2
  245. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  246. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  247. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
  248. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  249. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  250. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  251. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  252. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  253. package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
  254. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  255. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +1 -1
  256. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  257. package/build-module/components/start-template-options/index.js.map +1 -1
  258. package/build-module/hooks/commands/use-edit-mode-commands.js +4 -172
  259. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  260. package/build-module/hooks/index.js +0 -1
  261. package/build-module/hooks/index.js.map +1 -1
  262. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -3
  263. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  264. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +144 -0
  265. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -0
  266. package/build-module/store/actions.js +19 -50
  267. package/build-module/store/actions.js.map +1 -1
  268. package/build-module/utils/clone-deep.js +9 -0
  269. package/build-module/utils/clone-deep.js.map +1 -0
  270. package/build-style/style-rtl.css +152 -472
  271. package/build-style/style.css +152 -472
  272. package/package.json +43 -42
  273. package/src/components/actions/index.js +1 -1
  274. package/src/components/block-editor/editor-canvas.js +13 -12
  275. package/src/components/block-editor/style.scss +0 -3
  276. package/src/components/block-editor/use-site-editor-settings.js +1 -0
  277. package/src/components/code-editor/index.js +3 -2
  278. package/src/components/editor/index.js +10 -27
  279. package/src/components/editor-canvas-container/index.js +2 -5
  280. package/src/components/{test → error-boundary/test}/error-boundary.js +7 -5
  281. package/src/components/global-styles/color-palette-panel.js +11 -1
  282. package/src/components/global-styles/font-families.js +1 -1
  283. package/src/components/global-styles/font-library-modal/collection-font-variant.js +1 -1
  284. package/src/components/global-styles/font-library-modal/context.js +24 -0
  285. package/src/components/global-styles/font-library-modal/font-collection.js +7 -24
  286. package/src/components/global-styles/font-library-modal/index.js +2 -2
  287. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  288. package/src/components/global-styles/font-library-modal/library-font-variant.js +1 -1
  289. package/src/components/global-styles/font-library-modal/upload-fonts.js +1 -1
  290. package/src/components/global-styles/font-library-modal/utils/index.js +34 -0
  291. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +2 -1
  292. package/src/components/global-styles/gradients-palette-panel.js +2 -2
  293. package/src/components/global-styles/header.js +1 -1
  294. package/src/components/global-styles/highlighted-colors.js +39 -0
  295. package/src/components/global-styles/preview-colors.js +61 -0
  296. package/src/components/global-styles/preview-iframe.js +153 -0
  297. package/src/components/global-styles/preview-styles.js +185 -0
  298. package/src/components/global-styles/preview-typography.js +62 -0
  299. package/src/components/global-styles/screen-block-list.js +1 -1
  300. package/src/components/global-styles/screen-block.js +4 -1
  301. package/src/components/global-styles/screen-colors.js +13 -1
  302. package/src/components/global-styles/screen-revisions/style.scss +2 -2
  303. package/src/components/global-styles/screen-root.js +2 -2
  304. package/src/components/global-styles/screen-typography.js +19 -2
  305. package/src/components/global-styles/style-variations-container.js +14 -92
  306. package/src/components/global-styles/style.scss +1 -35
  307. package/src/components/global-styles/utils.js +37 -0
  308. package/src/components/global-styles/variations/style.scss +44 -0
  309. package/src/components/global-styles/variations/variation.js +93 -0
  310. package/src/components/global-styles/variations/variations-color.js +30 -0
  311. package/src/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  312. package/src/components/global-styles/variations/variations-typography.js +85 -0
  313. package/src/components/header-edit-mode/document-tools/index.js +1 -2
  314. package/src/components/header-edit-mode/index.js +22 -31
  315. package/src/components/header-edit-mode/more-menu/index.js +25 -11
  316. package/src/components/header-edit-mode/style.scss +4 -0
  317. package/src/components/keyboard-shortcuts/edit-mode.js +0 -11
  318. package/src/components/keyboard-shortcuts/register.js +0 -19
  319. package/src/components/layout/index.js +5 -2
  320. package/src/components/page-patterns/dataviews-pattern-actions.js +41 -10
  321. package/src/components/page-patterns/header.js +1 -0
  322. package/src/components/page-patterns/index.js +1 -2
  323. package/src/components/page-patterns/style.scss +0 -182
  324. package/src/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -66
  325. package/src/components/page-templates-template-parts/index.js +20 -3
  326. package/src/components/page-templates-template-parts/style.scss +48 -0
  327. package/src/components/revisions/index.js +1 -1
  328. package/src/components/save-button/index.js +2 -1
  329. package/src/components/save-hub/style.scss +1 -1
  330. package/src/components/save-panel/index.js +34 -12
  331. package/src/components/sidebar/index.js +1 -1
  332. package/src/components/sidebar-button/style.scss +1 -1
  333. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +5 -7
  334. package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -1
  335. package/src/components/sidebar-edit-mode/style.scss +4 -0
  336. package/src/components/sidebar-edit-mode/template-panel/hooks.js +37 -24
  337. package/src/components/sidebar-edit-mode/template-panel/index.js +76 -18
  338. package/src/components/sidebar-edit-mode/template-panel/style.scss +5 -14
  339. package/src/components/sidebar-edit-mode/template-panel/template-actions.js +1 -12
  340. package/src/components/sidebar-navigation-screen-global-styles/index.js +4 -1
  341. package/src/components/sidebar-navigation-screen-main/index.js +0 -2
  342. package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +1 -1
  343. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -2
  344. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  345. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +1 -1
  346. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  347. package/src/components/sidebar-navigation-screen-template/index.js +1 -1
  348. package/src/components/sidebar-navigation-screen-templates-browse/content.js +1 -1
  349. package/src/components/start-template-options/index.js +1 -1
  350. package/src/hooks/commands/use-edit-mode-commands.js +3 -184
  351. package/src/hooks/index.js +0 -1
  352. package/src/hooks/push-changes-to-global-styles/index.js +1 -4
  353. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1137 -0
  354. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +159 -0
  355. package/src/store/actions.js +21 -85
  356. package/src/store/test/actions.js +0 -75
  357. package/src/style.scss +3 -8
  358. package/src/utils/clone-deep.js +8 -0
  359. package/build/components/global-styles/preview.js +0 -271
  360. package/build/components/global-styles/preview.js.map +0 -1
  361. package/build/components/global-styles/typogrphy-elements.js.map +0 -1
  362. package/build/components/global-styles/variations-panel.js.map +0 -1
  363. package/build/components/header-edit-mode/mode-switcher/index.js +0 -62
  364. package/build/components/header-edit-mode/mode-switcher/index.js.map +0 -1
  365. package/build/components/list/added-by.js.map +0 -1
  366. package/build/components/list/header.js +0 -55
  367. package/build/components/list/header.js.map +0 -1
  368. package/build/components/list/index.js +0 -80
  369. package/build/components/list/index.js.map +0 -1
  370. package/build/components/list/table.js +0 -94
  371. package/build/components/list/table.js.map +0 -1
  372. package/build/components/list/use-register-shortcuts.js +0 -51
  373. package/build/components/list/use-register-shortcuts.js.map +0 -1
  374. package/build/components/page-patterns/duplicate-menu-item.js +0 -93
  375. package/build/components/page-patterns/duplicate-menu-item.js.map +0 -1
  376. package/build/components/page-patterns/grid-item.js +0 -223
  377. package/build/components/page-patterns/grid-item.js.map +0 -1
  378. package/build/components/page-patterns/grid.js +0 -31
  379. package/build/components/page-patterns/grid.js.map +0 -1
  380. package/build/components/page-patterns/no-patterns.js +0 -18
  381. package/build/components/page-patterns/no-patterns.js.map +0 -1
  382. package/build/components/page-patterns/patterns-list.js +0 -168
  383. package/build/components/page-patterns/patterns-list.js.map +0 -1
  384. package/build/components/page-patterns/rename-menu-item.js +0 -105
  385. package/build/components/page-patterns/rename-menu-item.js.map +0 -1
  386. package/build/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -83
  387. package/build/components/sidebar-edit-mode/template-panel/replace-template-button.js.map +0 -1
  388. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +0 -36
  389. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
  390. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -36
  391. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
  392. package/build/hooks/navigation-menu-edit.js +0 -82
  393. package/build/hooks/navigation-menu-edit.js.map +0 -1
  394. package/build-module/components/global-styles/preview.js +0 -264
  395. package/build-module/components/global-styles/preview.js.map +0 -1
  396. package/build-module/components/global-styles/typogrphy-elements.js.map +0 -1
  397. package/build-module/components/global-styles/variations-panel.js.map +0 -1
  398. package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -56
  399. package/build-module/components/header-edit-mode/mode-switcher/index.js.map +0 -1
  400. package/build-module/components/list/added-by.js.map +0 -1
  401. package/build-module/components/list/header.js +0 -47
  402. package/build-module/components/list/header.js.map +0 -1
  403. package/build-module/components/list/index.js +0 -72
  404. package/build-module/components/list/index.js.map +0 -1
  405. package/build-module/components/list/table.js +0 -86
  406. package/build-module/components/list/table.js.map +0 -1
  407. package/build-module/components/list/use-register-shortcuts.js +0 -45
  408. package/build-module/components/list/use-register-shortcuts.js.map +0 -1
  409. package/build-module/components/page-patterns/duplicate-menu-item.js +0 -85
  410. package/build-module/components/page-patterns/duplicate-menu-item.js.map +0 -1
  411. package/build-module/components/page-patterns/grid-item.js +0 -215
  412. package/build-module/components/page-patterns/grid-item.js.map +0 -1
  413. package/build-module/components/page-patterns/grid.js +0 -23
  414. package/build-module/components/page-patterns/grid.js.map +0 -1
  415. package/build-module/components/page-patterns/no-patterns.js +0 -11
  416. package/build-module/components/page-patterns/no-patterns.js.map +0 -1
  417. package/build-module/components/page-patterns/patterns-list.js +0 -160
  418. package/build-module/components/page-patterns/patterns-list.js.map +0 -1
  419. package/build-module/components/page-patterns/rename-menu-item.js +0 -98
  420. package/build-module/components/page-patterns/rename-menu-item.js.map +0 -1
  421. package/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -76
  422. package/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js.map +0 -1
  423. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +0 -29
  424. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
  425. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -27
  426. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
  427. package/build-module/hooks/navigation-menu-edit.js +0 -75
  428. package/build-module/hooks/navigation-menu-edit.js.map +0 -1
  429. package/src/components/global-styles/preview.js +0 -327
  430. package/src/components/header-edit-mode/mode-switcher/index.js +0 -60
  431. package/src/components/list/header.js +0 -48
  432. package/src/components/list/index.js +0 -87
  433. package/src/components/list/style.scss +0 -188
  434. package/src/components/list/table.js +0 -140
  435. package/src/components/list/use-register-shortcuts.js +0 -49
  436. package/src/components/page-patterns/duplicate-menu-item.js +0 -105
  437. package/src/components/page-patterns/grid-item.js +0 -331
  438. package/src/components/page-patterns/grid.js +0 -22
  439. package/src/components/page-patterns/no-patterns.js +0 -12
  440. package/src/components/page-patterns/patterns-list.js +0 -229
  441. package/src/components/page-patterns/rename-menu-item.js +0 -132
  442. package/src/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -89
  443. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +0 -34
  444. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -22
  445. package/src/hooks/navigation-menu-edit.js +0 -92
  446. /package/src/components/global-styles/{typogrphy-elements.js → typography-elements.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["__","__experimentalVStack","VStack","store","editorStore","useSelect","TypographyElements","FontFamilies","ScreenHeader","ScreenTypography","fontLibraryEnabled","select","getEditorSettings","createElement","Fragment","title","description","className","spacing"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport TypographyElements from './typogrphy-elements';\nimport FontFamilies from './font-families';\nimport ScreenHeader from './header';\n\nfunction ScreenTypography() {\n\tconst fontLibraryEnabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().fontLibraryEnabled,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the typography settings for different elements.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-typography\">\n\t\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t\t{ fontLibraryEnabled && <FontFamilies /> }\n\t\t\t\t\t<TypographyElements />\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,YAAY,MAAM,UAAU;AAEnC,SAASC,gBAAgBA,CAAA,EAAG;EAC3B,MAAMC,kBAAkB,GAAGL,SAAS,CACjCM,MAAM,IACPA,MAAM,CAAEP,WAAY,CAAC,CAACQ,iBAAiB,CAAC,CAAC,CAACF,kBAAkB,EAC7D,EACD,CAAC;EAED,OACCG,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACL,YAAY;IACZO,KAAK,EAAGf,EAAE,CAAE,YAAa,CAAG;IAC5BgB,WAAW,EAAGhB,EAAE,CACf,wDACD;EAAG,CACH,CAAC,EACFa,aAAA;IAAKI,SAAS,EAAC;EAA2C,GACzDJ,aAAA,CAACX,MAAM;IAACgB,OAAO,EAAG;EAAG,GAClBR,kBAAkB,IAAIG,aAAA,CAACN,YAAY,MAAE,CAAC,EACxCM,aAAA,CAACP,kBAAkB,MAAE,CACd,CACJ,CACJ,CAAC;AAEL;AAEA,eAAeG,gBAAgB"}
1
+ {"version":3,"names":["__","__experimentalVStack","VStack","store","editorStore","useSelect","TypographyElements","TypographyVariations","FontFamilies","ScreenHeader","useCurrentMergeThemeStyleVariationsWithUserConfig","ScreenTypography","fontLibraryEnabled","select","getEditorSettings","typographyVariations","property","filter","variation","settings","typography","fontFamilies","Object","keys","length","createElement","Fragment","title","description","className","spacing","window","__experimentalDisableFontLibrary"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport TypographyElements from './typography-elements';\nimport TypographyVariations from './variations/variations-typography';\nimport FontFamilies from './font-families';\nimport ScreenHeader from './header';\nimport { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';\n\nfunction ScreenTypography() {\n\tconst fontLibraryEnabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().fontLibraryEnabled,\n\t\t[]\n\t);\n\tconst typographyVariations =\n\t\tuseCurrentMergeThemeStyleVariationsWithUserConfig( {\n\t\t\tproperty: 'typography',\n\t\t\tfilter: ( variation ) =>\n\t\t\t\tvariation?.settings?.typography?.fontFamilies &&\n\t\t\t\tObject.keys( variation?.settings?.typography?.fontFamilies )\n\t\t\t\t\t.length,\n\t\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the typography settings for different elements.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-typography\">\n\t\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t\t{ !! typographyVariations.length && (\n\t\t\t\t\t\t<TypographyVariations />\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! window.__experimentalDisableFontLibrary && (\n\t\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t\t{ fontLibraryEnabled && <FontFamilies /> }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t<TypographyElements />\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,uBAAuB;AACtD,OAAOC,oBAAoB,MAAM,oCAAoC;AACrE,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,YAAY,MAAM,UAAU;AACnC,SAASC,iDAAiD,QAAQ,+EAA+E;AAEjJ,SAASC,gBAAgBA,CAAA,EAAG;EAC3B,MAAMC,kBAAkB,GAAGP,SAAS,CACjCQ,MAAM,IACPA,MAAM,CAAET,WAAY,CAAC,CAACU,iBAAiB,CAAC,CAAC,CAACF,kBAAkB,EAC7D,EACD,CAAC;EACD,MAAMG,oBAAoB,GACzBL,iDAAiD,CAAE;IAClDM,QAAQ,EAAE,YAAY;IACtBC,MAAM,EAAIC,SAAS,IAClBA,SAAS,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,YAAY,IAC7CC,MAAM,CAACC,IAAI,CAAEL,SAAS,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,YAAa,CAAC,CAC1DG;EACJ,CAAE,CAAC;EAEJ,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAChB,YAAY;IACZkB,KAAK,EAAG3B,EAAE,CAAE,YAAa,CAAG;IAC5B4B,WAAW,EAAG5B,EAAE,CACf,wDACD;EAAG,CACH,CAAC,EACFyB,aAAA;IAAKI,SAAS,EAAC;EAA2C,GACzDJ,aAAA,CAACvB,MAAM;IAAC4B,OAAO,EAAG;EAAG,GAClB,CAAC,CAAEf,oBAAoB,CAACS,MAAM,IAC/BC,aAAA,CAAClB,oBAAoB,MAAE,CACvB,EACC,CAAEwB,MAAM,CAACC,gCAAgC,IAC1CP,aAAA,CAACvB,MAAM;IAAC4B,OAAO,EAAG;EAAG,GAClBlB,kBAAkB,IAAIa,aAAA,CAACjB,YAAY,MAAE,CAChC,CACR,EACDiB,aAAA,CAACnB,kBAAkB,MAAE,CACd,CACJ,CACJ,CAAC;AAEL;AAEA,eAAeK,gBAAgB"}
@@ -1,95 +1,18 @@
1
1
  import { createElement } from "react";
2
- /**
3
- * External dependencies
4
- */
5
- import classnames from 'classnames';
6
-
7
2
  /**
8
3
  * WordPress dependencies
9
4
  */
10
5
  import { store as coreStore } from '@wordpress/core-data';
11
6
  import { useSelect } from '@wordpress/data';
12
- import { useMemo, useContext, useState } from '@wordpress/element';
13
- import { ENTER } from '@wordpress/keycodes';
7
+ import { useMemo } from '@wordpress/element';
14
8
  import { __experimentalGrid as Grid } from '@wordpress/components';
15
- import { __, sprintf } from '@wordpress/i18n';
16
- import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
9
+ import { __ } from '@wordpress/i18n';
17
10
 
18
11
  /**
19
12
  * Internal dependencies
20
13
  */
21
- import { mergeBaseAndUserConfigs } from './global-styles-provider';
22
- import StylesPreview from './preview';
23
- import { unlock } from '../../lock-unlock';
24
- const {
25
- GlobalStylesContext,
26
- areGlobalStyleConfigsEqual
27
- } = unlock(blockEditorPrivateApis);
28
- function Variation({
29
- variation
30
- }) {
31
- const [isFocused, setIsFocused] = useState(false);
32
- const {
33
- base,
34
- user,
35
- setUserConfig
36
- } = useContext(GlobalStylesContext);
37
- const context = useMemo(() => {
38
- var _variation$settings, _variation$styles;
39
- return {
40
- user: {
41
- settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
42
- styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {}
43
- },
44
- base,
45
- merged: mergeBaseAndUserConfigs(base, variation),
46
- setUserConfig: () => {}
47
- };
48
- }, [variation, base]);
49
- const selectVariation = () => {
50
- setUserConfig(() => {
51
- return {
52
- settings: variation.settings,
53
- styles: variation.styles
54
- };
55
- });
56
- };
57
- const selectOnEnter = event => {
58
- if (event.keyCode === ENTER) {
59
- event.preventDefault();
60
- selectVariation();
61
- }
62
- };
63
- const isActive = useMemo(() => {
64
- return areGlobalStyleConfigsEqual(user, variation);
65
- }, [user, variation]);
66
- let label = variation?.title;
67
- if (variation?.description) {
68
- label = sprintf( /* translators: %1$s: variation title. %2$s variation description. */
69
- __('%1$s (%2$s)'), variation?.title, variation?.description);
70
- }
71
- return createElement(GlobalStylesContext.Provider, {
72
- value: context
73
- }, createElement("div", {
74
- className: classnames('edit-site-global-styles-variations_item', {
75
- 'is-active': isActive
76
- }),
77
- role: "button",
78
- onClick: selectVariation,
79
- onKeyDown: selectOnEnter,
80
- tabIndex: "0",
81
- "aria-label": label,
82
- "aria-current": isActive,
83
- onFocus: () => setIsFocused(true),
84
- onBlur: () => setIsFocused(false)
85
- }, createElement("div", {
86
- className: "edit-site-global-styles-variations_item-preview"
87
- }, createElement(StylesPreview, {
88
- label: variation?.title,
89
- isFocused: isFocused,
90
- withHoverView: true
91
- }))));
92
- }
14
+ import PreviewStyles from './preview-styles';
15
+ import Variation from './variations/variation';
93
16
  export default function StyleVariationsContainer() {
94
17
  const variations = useSelect(select => {
95
18
  return select(coreStore).__experimentalGetCurrentThemeGlobalStylesVariations();
@@ -100,11 +23,11 @@ export default function StyleVariationsContainer() {
100
23
  settings: {},
101
24
  styles: {}
102
25
  }, ...(variations !== null && variations !== void 0 ? variations : []).map(variation => {
103
- var _variation$settings2, _variation$styles2;
26
+ var _variation$settings, _variation$styles;
104
27
  return {
105
28
  ...variation,
106
- settings: (_variation$settings2 = variation.settings) !== null && _variation$settings2 !== void 0 ? _variation$settings2 : {},
107
- styles: (_variation$styles2 = variation.styles) !== null && _variation$styles2 !== void 0 ? _variation$styles2 : {}
29
+ settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
30
+ styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {}
108
31
  };
109
32
  })];
110
33
  }, [variations]);
@@ -114,6 +37,11 @@ export default function StyleVariationsContainer() {
114
37
  }, withEmptyVariation.map((variation, index) => createElement(Variation, {
115
38
  key: index,
116
39
  variation: variation
117
- })));
40
+ }, isFocused => createElement(PreviewStyles, {
41
+ label: variation?.title,
42
+ withHoverView: true,
43
+ isFocused: isFocused,
44
+ variation: variation
45
+ }))));
118
46
  }
119
47
  //# sourceMappingURL=style-variations-container.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","store","coreStore","useSelect","useMemo","useContext","useState","ENTER","__experimentalGrid","Grid","__","sprintf","privateApis","blockEditorPrivateApis","mergeBaseAndUserConfigs","StylesPreview","unlock","GlobalStylesContext","areGlobalStyleConfigsEqual","Variation","variation","isFocused","setIsFocused","base","user","setUserConfig","context","_variation$settings","_variation$styles","settings","styles","merged","selectVariation","selectOnEnter","event","keyCode","preventDefault","isActive","label","title","description","createElement","Provider","value","className","role","onClick","onKeyDown","tabIndex","onFocus","onBlur","withHoverView","StyleVariationsContainer","variations","select","__experimentalGetCurrentThemeGlobalStylesVariations","withEmptyVariation","map","_variation$settings2","_variation$styles2","columns","index","key"],"sources":["@wordpress/edit-site/src/components/global-styles/style-variations-container.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, useContext, useState } from '@wordpress/element';\nimport { ENTER } from '@wordpress/keycodes';\nimport { __experimentalGrid as Grid } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from './global-styles-provider';\nimport StylesPreview from './preview';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction Variation( { variation } ) {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\tconst { base, user, setUserConfig } = useContext( GlobalStylesContext );\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tuser: {\n\t\t\t\tsettings: variation.settings ?? {},\n\t\t\t\tstyles: variation.styles ?? {},\n\t\t\t},\n\t\t\tbase,\n\t\t\tmerged: mergeBaseAndUserConfigs( base, variation ),\n\t\t\tsetUserConfig: () => {},\n\t\t};\n\t}, [ variation, base ] );\n\n\tconst selectVariation = () => {\n\t\tsetUserConfig( () => {\n\t\t\treturn {\n\t\t\t\tsettings: variation.settings,\n\t\t\t\tstyles: variation.styles,\n\t\t\t};\n\t\t} );\n\t};\n\n\tconst selectOnEnter = ( event ) => {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tselectVariation();\n\t\t}\n\t};\n\n\tconst isActive = useMemo( () => {\n\t\treturn areGlobalStyleConfigsEqual( user, variation );\n\t}, [ user, variation ] );\n\n\tlet label = variation?.title;\n\tif ( variation?.description ) {\n\t\tlabel = sprintf(\n\t\t\t/* translators: %1$s: variation title. %2$s variation description. */\n\t\t\t__( '%1$s (%2$s)' ),\n\t\t\tvariation?.title,\n\t\t\tvariation?.description\n\t\t);\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t<div\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-global-styles-variations_item',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isActive,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\trole=\"button\"\n\t\t\t\tonClick={ selectVariation }\n\t\t\t\tonKeyDown={ selectOnEnter }\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\taria-label={ label }\n\t\t\t\taria-current={ isActive }\n\t\t\t\tonFocus={ () => setIsFocused( true ) }\n\t\t\t\tonBlur={ () => setIsFocused( false ) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-global-styles-variations_item-preview\">\n\t\t\t\t\t<StylesPreview\n\t\t\t\t\t\tlabel={ variation?.title }\n\t\t\t\t\t\tisFocused={ isFocused }\n\t\t\t\t\t\twithHoverView\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n\nexport default function StyleVariationsContainer() {\n\tconst variations = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore\n\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\t}, [] );\n\n\tconst withEmptyVariation = useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: __( 'Default' ),\n\t\t\t\tsettings: {},\n\t\t\t\tstyles: {},\n\t\t\t},\n\t\t\t...( variations ?? [] ).map( ( variation ) => ( {\n\t\t\t\t...variation,\n\t\t\t\tsettings: variation.settings ?? {},\n\t\t\t\tstyles: variation.styles ?? {},\n\t\t\t} ) ),\n\t\t];\n\t}, [ variations ] );\n\n\treturn (\n\t\t<Grid\n\t\t\tcolumns={ 2 }\n\t\t\tclassName=\"edit-site-global-styles-style-variations-container\"\n\t\t>\n\t\t\t{ withEmptyVariation.map( ( variation, index ) => (\n\t\t\t\t<Variation key={ index } variation={ variation } />\n\t\t\t) ) }\n\t\t</Grid>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,EAAEC,UAAU,EA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,aAAa;EAAA,CACb,CACG,CACD,CACwB,CAAC;AAEjC;AAEA,eAAe,SAASC,wBAAwBA,CAAA,EAAG;EAClD,MAAMC,UAAU,GAAGlD,SAAS,CAAImD,MAAM,IAAM;IAC3C,OAAOA,MAAM,CACZpD,SACD,CAAC,CAACqD,mDAAmD,CAAC,CAAC;EACxD,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,kBAAkB,GAAGpD,OAAO,CAAE,MAAM;IACzC,OAAO,CACN;MACCmC,KAAK,EAAE7B,EAAE,CAAE,SAAU,CAAC;MACtBmB,QAAQ,EAAE,CAAC,CAAC;MACZC,MAAM,EAAE,CAAC;IACV,CAAC,EACD,GAAG,CAAEuB,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,EAAE,EAAGI,GAAG,CAAIrC,SAAS;MAAA,IAAAsC,oBAAA,EAAAC,kBAAA;MAAA,OAAQ;QAC/C,GAAGvC,SAAS;QACZS,QAAQ,GAAA6B,oBAAA,GAAEtC,SAAS,CAACS,QAAQ,cAAA6B,oBAAA,cAAAA,oBAAA,GAAI,CAAC,CAAC;QAClC5B,MAAM,GAAA6B,kBAAA,GAAEvC,SAAS,CAACU,MAAM,cAAA6B,kBAAA,cAAAA,kBAAA,GAAI,CAAC;MAC9B,CAAC;IAAA,CAAG,CAAC,CACL;EACF,CAAC,EAAE,CAAEN,UAAU,CAAG,CAAC;EAEnB,OACCZ,aAAA,CAAChC,IAAI;IACJmD,OAAO,EAAG,CAAG;IACbhB,SAAS,EAAC;EAAoD,GAE5DY,kBAAkB,CAACC,GAAG,CAAE,CAAErC,SAAS,EAAEyC,KAAK,KAC3CpB,aAAA,CAACtB,SAAS;IAAC2C,GAAG,EAAGD,KAAO;IAACzC,SAAS,EAAGA;EAAW,CAAE,CACjD,CACG,CAAC;AAET"}
1
+ {"version":3,"names":["store","coreStore","useSelect","useMemo","__experimentalGrid","Grid","__","PreviewStyles","Variation","StyleVariationsContainer","variations","select","__experimentalGetCurrentThemeGlobalStylesVariations","withEmptyVariation","title","settings","styles","map","variation","_variation$settings","_variation$styles","createElement","columns","className","index","key","isFocused","label","withHoverView"],"sources":["@wordpress/edit-site/src/components/global-styles/style-variations-container.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalGrid as Grid } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PreviewStyles from './preview-styles';\nimport Variation from './variations/variation';\n\nexport default function StyleVariationsContainer() {\n\tconst variations = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore\n\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\t}, [] );\n\n\tconst withEmptyVariation = useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: __( 'Default' ),\n\t\t\t\tsettings: {},\n\t\t\t\tstyles: {},\n\t\t\t},\n\t\t\t...( variations ?? [] ).map( ( variation ) => ( {\n\t\t\t\t...variation,\n\t\t\t\tsettings: variation.settings ?? {},\n\t\t\t\tstyles: variation.styles ?? {},\n\t\t\t} ) ),\n\t\t];\n\t}, [ variations ] );\n\n\treturn (\n\t\t<Grid\n\t\t\tcolumns={ 2 }\n\t\t\tclassName=\"edit-site-global-styles-style-variations-container\"\n\t\t>\n\t\t\t{ withEmptyVariation.map( ( variation, index ) => (\n\t\t\t\t<Variation key={ index } variation={ variation }>\n\t\t\t\t\t{ ( isFocused ) => (\n\t\t\t\t\t\t<PreviewStyles\n\t\t\t\t\t\t\tlabel={ variation?.title }\n\t\t\t\t\t\t\twithHoverView\n\t\t\t\t\t\t\tisFocused={ isFocused }\n\t\t\t\t\t\t\tvariation={ variation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Variation>\n\t\t\t) ) }\n\t\t</Grid>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,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B,GAAG,EAAGD,KAAO;IAACN,SAAS,EAAGA;EAAW,GAC3CQ,SAAS,IACZL,aAAA,CAACd,aAAa;IACboB,KAAK,EAAGT,SAAS,EAAEJ,KAAO;IAC1Bc,aAAa;IACbF,SAAS,EAAGA,SAAW;IACvBR,SAAS,EAAGA;EAAW,CACvB,CAEQ,CACV,CACG,CAAC;AAET"}
@@ -84,4 +84,4 @@ function TypographyElements() {
84
84
  })));
85
85
  }
86
86
  export default TypographyElements;
87
- //# sourceMappingURL=typogrphy-elements.js.map
87
+ //# sourceMappingURL=typography-elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","sprintf","__experimentalItemGroup","ItemGroup","__experimentalVStack","VStack","__experimentalHStack","HStack","FlexItem","privateApis","blockEditorPrivateApis","NavigationButtonAsItem","Subtitle","unlock","useGlobalStyle","ElementItem","parentMenu","element","label","prefix","extraStyles","textDecoration","fontFamily","fontStyle","fontWeight","letterSpacing","backgroundColor","gradientValue","color","navigationButtonLabel","createElement","path","justify","className","style","background","TypographyElements","spacing","level","isBordered","isSeparated"],"sources":["@wordpress/edit-site/src/components/global-styles/typography-elements.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n} from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { NavigationButtonAsItem } from './navigation-button';\nimport Subtitle from './subtitle';\n\nimport { unlock } from '../../lock-unlock';\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction ElementItem( { parentMenu, element, label } ) {\n\tconst prefix =\n\t\telement === 'text' || ! element ? '' : `elements.${ element }.`;\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\tconst [ fontFamily ] = useGlobalStyle( prefix + 'typography.fontFamily' );\n\tconst [ fontStyle ] = useGlobalStyle( prefix + 'typography.fontStyle' );\n\tconst [ fontWeight ] = useGlobalStyle( prefix + 'typography.fontWeight' );\n\tconst [ letterSpacing ] = useGlobalStyle(\n\t\tprefix + 'typography.letterSpacing'\n\t);\n\tconst [ backgroundColor ] = useGlobalStyle( prefix + 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient' );\n\tconst [ color ] = useGlobalStyle( prefix + 'color.text' );\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is a subset of Typography, e.g., 'text' or 'links'.\n\t\t__( 'Typography %s styles' ),\n\t\tlabel\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/typography/' + element }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem\n\t\t\t\t\tclassName=\"edit-site-global-styles-screen-typography__indicator\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\tletterSpacing,\n\t\t\t\t\t\t...extraStyles,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Aa' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>{ label }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction TypographyElements() {\n\tconst parentMenu = '';\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<Subtitle level={ 3 }>{ __( 'Elements' ) }</Subtitle>\n\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t<ElementItem\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\telement=\"text\"\n\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t/>\n\t\t\t\t<ElementItem\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\telement=\"link\"\n\t\t\t\t\tlabel={ __( 'Links' ) }\n\t\t\t\t/>\n\t\t\t\t<ElementItem\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\telement=\"heading\"\n\t\t\t\t\tlabel={ __( 'Headings' ) }\n\t\t\t\t/>\n\t\t\t\t<ElementItem\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\telement=\"caption\"\n\t\t\t\t\tlabel={ __( 'Captions' ) }\n\t\t\t\t/>\n\t\t\t\t<ElementItem\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\telement=\"button\"\n\t\t\t\t\tlabel={ __( 'Buttons' ) }\n\t\t\t\t/>\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nexport default TypographyElements;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,QAAQ,QACF,uBAAuB;AAC9B,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,OAAOC,QAAQ,MAAM,YAAY;AAEjC,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,MAAM;EAAEC;AAAe,CAAC,GAAGD,MAAM,CAAEH,sBAAuB,CAAC;AAE3D,SAASK,WAAWA,CAAE;EAAEC,UAAU;EAAEC,OAAO;EAAEC;AAAM,CAAC,EAAG;EACtD,MAAMC,MAAM,GACXF,OAAO,KAAK,MAAM,IAAI,CAAEA,OAAO,GAAG,EAAE,GAAI,YAAYA,OAAS,GAAE;EAChE,MAAMG,WAA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iB,CACtB,CACe,CAAC;AAE3B;AAEA,SAASkB,kBAAkBA,CAAA,EAAG;EAC7B,MAAMpB,UAAU,GAAG,EAAE;EAErB,OACCc,aAAA,CAACzB,MAAM;IAACgC,OAAO,EAAG;EAAG,GACpBP,aAAA,CAAClB,QAAQ;IAAC0B,KAAK,EAAG;EAAG,GAAGtC,EAAE,CAAE,UAAW,CAAa,CAAC,EACrD8B,aAAA,CAAC3B,SAAS;IAACoC,UAAU;IAACC,WAAW;EAAA,GAChCV,aAAA,CAACf,WAAW;IACXC,UAAU,EAAGA,UAAY;IACzBC,OAAO,EAAC,MAAM;IACdC,KAAK,EAAGlB,EAAE,CAAE,MAAO;EAAG,CACtB,CAAC,EACF8B,aAAA,CAACf,WAAW;IACXC,UAAU,EAAGA,UAAY;IACzBC,OAAO,EAAC,MAAM;IACdC,KAAK,EAAGlB,EAAE,CAAE,OAAQ;EAAG,CACvB,CAAC,EACF8B,aAAA,CAACf,WAAW;IACXC,UAAU,EAAGA,UAAY;IACzBC,OAAO,EAAC,SAAS;IACjBC,KAAK,EAAGlB,EAAE,CAAE,UAAW;EAAG,CAC1B,CAAC,EACF8B,aAAA,CAACf,WAAW;IACXC,UAAU,EAAGA,UAAY;IACzBC,OAAO,EAAC,SAAS;IACjBC,KAAK,EAAGlB,EAAE,CAAE,UAAW;EAAG,CAC1B,CAAC,EACF8B,aAAA,CAACf,WAAW;IACXC,UAAU,EAAGA,UAAY;IACzBC,OAAO,EAAC,QAAQ;IAChBC,KAAK,EAAGlB,EAAE,CAAE,SAAU;EAAG,CACzB,CACS,CACJ,CAAC;AAEX;AAEA,eAAeoC,kBAAkB"}
@@ -10,4 +10,25 @@ export function getVariationClassName(variation) {
10
10
  }
11
11
  return `is-style-${variation}`;
12
12
  }
13
+ function getFontFamilyFromSetting(fontFamilies, setting) {
14
+ if (!setting) {
15
+ return null;
16
+ }
17
+ const fontFamilyVariable = setting.replace('var(', '').replace(')', '');
18
+ const fontFamilySlug = fontFamilyVariable?.split('--').slice(-1)[0];
19
+ return fontFamilies.find(fontFamily => fontFamily.slug === fontFamilySlug);
20
+ }
21
+ export function getFontFamilies(themeJson) {
22
+ const fontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; // TODO this could not be under theme.
23
+ const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
24
+ const bodyFontFamily = getFontFamilyFromSetting(fontFamilies, bodyFontFamilySetting);
25
+ const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily;
26
+ let headingFontFamily;
27
+ if (!headingFontFamilySetting) {
28
+ headingFontFamily = bodyFontFamily;
29
+ } else {
30
+ headingFontFamily = getFontFamilyFromSetting(fontFamilies, themeJson?.styles?.elements?.heading?.typography?.fontFamily);
31
+ }
32
+ return [bodyFontFamily, headingFontFamily];
33
+ }
13
34
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getVariationClassName","variation"],"sources":["@wordpress/edit-site/src/components/global-styles/utils.js"],"sourcesContent":["/**\n *\n * @param {string} variation The variation name.\n *\n * @return {string} The variation class name.\n */\nexport function getVariationClassName( variation ) {\n\tif ( ! variation ) {\n\t\treturn '';\n\t}\n\treturn `is-style-${ variation }`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAqBA,CAAEC,SAAS,EAAG;EAClD,IAAK,CAAEA,SAAS,EAAG;IAClB,OAAO,EAAE;EACV;EACA,OAAQ,YAAYA,SAAW,EAAC;AACjC"}
1
+ {"version":3,"names":["getVariationClassName","variation","getFontFamilyFromSetting","fontFamilies","setting","fontFamilyVariable","replace","fontFamilySlug","split","slice","find","fontFamily","slug","getFontFamilies","themeJson","settings","typography","theme","bodyFontFamilySetting","styles","bodyFontFamily","headingFontFamilySetting","elements","heading","headingFontFamily"],"sources":["@wordpress/edit-site/src/components/global-styles/utils.js"],"sourcesContent":["/**\n *\n * @param {string} variation The variation name.\n *\n * @return {string} The variation class name.\n */\nexport function getVariationClassName( variation ) {\n\tif ( ! variation ) {\n\t\treturn '';\n\t}\n\treturn `is-style-${ variation }`;\n}\n\nfunction getFontFamilyFromSetting( fontFamilies, setting ) {\n\tif ( ! setting ) {\n\t\treturn null;\n\t}\n\n\tconst fontFamilyVariable = setting.replace( 'var(', '' ).replace( ')', '' );\n\tconst fontFamilySlug = fontFamilyVariable?.split( '--' ).slice( -1 )[ 0 ];\n\n\treturn fontFamilies.find(\n\t\t( fontFamily ) => fontFamily.slug === fontFamilySlug\n\t);\n}\n\nexport function getFontFamilies( themeJson ) {\n\tconst fontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; // TODO this could not be under theme.\n\tconst bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;\n\tconst bodyFontFamily = getFontFamilyFromSetting(\n\t\tfontFamilies,\n\t\tbodyFontFamilySetting\n\t);\n\n\tconst headingFontFamilySetting =\n\t\tthemeJson?.styles?.elements?.heading?.typography?.fontFamily;\n\n\tlet headingFontFamily;\n\tif ( ! headingFontFamilySetting ) {\n\t\theadingFontFamily = bodyFontFamily;\n\t} else {\n\t\theadingFontFamily = getFontFamilyFromSetting(\n\t\t\tfontFamilies,\n\t\t\tthemeJson?.styles?.elements?.heading?.typography?.fontFamily\n\t\t);\n\t}\n\n\treturn [ bodyFontFamily, headingFontFamily ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAqBA,CAAEC,SAAS,EAAG;EAClD,IAAK,CAAEA,SAAS,EAAG;IAClB,OAAO,EAAE;EACV;EACA,OAAQ,YAAYA,SAAW,EAAC;AACjC;AAEA,SAASC,wBAAwBA,CAAEC,YAAY,EAAEC,OAAO,EAAG;EAC1D,IAAK,CAAEA,OAAO,EAAG;IAChB,OAAO,IAAI;EACZ;EAEA,MAAMC,kBAAkB,GAAGD,OAAO,CAACE,OAAO,CAAE,MAAM,EAAE,EAAG,CAAC,CAACA,OAAO,CAAE,GAAG,EAAE,EAAG,CAAC;EAC3E,MAAMC,cAAc,GAAGF,kBAAkB,EAAEG,KAAK,CAAE,IAAK,CAAC,CAACC,KAAK,CAAE,CAAC,CAAE,CAAC,CAAE,CAAC,CAAE;EAEzE,OAAON,YAAY,CAACO,IAAI,CACrBC,UAAU,IAAMA,UAAU,CAACC,IAAI,KAAKL,cACvC,CAAC;AACF;AAEA,OAAO,SAASM,eAAeA,CAAEC,SAAS,EAAG;EAC5C,MAAMX,YAAY,GAAGW,SAAS,EAAEC,QAAQ,EAAEC,UAAU,EAAEb,YAAY,EAAEc,KAAK,CAAC,CAAC;EAC3E,MAAMC,qBAAqB,GAAGJ,SAAS,EAAEK,MAAM,EAAEH,UAAU,EAAEL,UAAU;EACvE,MAAMS,cAAc,GAAGlB,wBAAwB,CAC9CC,YAAY,EACZe,qBACD,CAAC;EAED,MAAMG,wBAAwB,GAC7BP,SAAS,EAAEK,MAAM,EAAEG,QAAQ,EAAEC,OAAO,EAAEP,UAAU,EAAEL,UAAU;EAE7D,IAAIa,iBAAiB;EACrB,IAAK,CAAEH,wBAAwB,EAAG;IACjCG,iBAAiB,GAAGJ,cAAc;EACnC,CAAC,MAAM;IACNI,iBAAiB,GAAGtB,wBAAwB,CAC3CC,YAAY,EACZW,SAAS,EAAEK,MAAM,EAAEG,QAAQ,EAAEC,OAAO,EAAEP,UAAU,EAAEL,UACnD,CAAC;EACF;EAEA,OAAO,CAAES,cAAc,EAAEI,iBAAiB,CAAE;AAC7C"}
@@ -0,0 +1,82 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import classnames from 'classnames';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ import { useMemo, useContext, useState } from '@wordpress/element';
11
+ import { ENTER } from '@wordpress/keycodes';
12
+ import { __, sprintf } from '@wordpress/i18n';
13
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { mergeBaseAndUserConfigs } from '../global-styles-provider';
19
+ import { unlock } from '../../../lock-unlock';
20
+ const {
21
+ GlobalStylesContext,
22
+ areGlobalStyleConfigsEqual
23
+ } = unlock(blockEditorPrivateApis);
24
+ export default function Variation({
25
+ variation,
26
+ children
27
+ }) {
28
+ const [isFocused, setIsFocused] = useState(false);
29
+ const {
30
+ base,
31
+ user,
32
+ setUserConfig
33
+ } = useContext(GlobalStylesContext);
34
+ const context = useMemo(() => {
35
+ var _variation$settings, _variation$styles;
36
+ return {
37
+ user: {
38
+ settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
39
+ styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {}
40
+ },
41
+ base,
42
+ merged: mergeBaseAndUserConfigs(base, variation),
43
+ setUserConfig: () => {}
44
+ };
45
+ }, [variation, base]);
46
+ const selectVariation = () => {
47
+ setUserConfig(() => ({
48
+ settings: variation.settings,
49
+ styles: variation.styles
50
+ }));
51
+ };
52
+ const selectOnEnter = event => {
53
+ if (event.keyCode === ENTER) {
54
+ event.preventDefault();
55
+ selectVariation();
56
+ }
57
+ };
58
+ const isActive = useMemo(() => areGlobalStyleConfigsEqual(user, variation), [user, variation]);
59
+ let label = variation?.title;
60
+ if (variation?.description) {
61
+ label = sprintf( /* translators: %1$s: variation title. %2$s variation description. */
62
+ __('%1$s (%2$s)'), variation?.title, variation?.description);
63
+ }
64
+ return createElement(GlobalStylesContext.Provider, {
65
+ value: context
66
+ }, createElement("div", {
67
+ className: classnames('edit-site-global-styles-variations_item', {
68
+ 'is-active': isActive
69
+ }),
70
+ role: "button",
71
+ onClick: selectVariation,
72
+ onKeyDown: selectOnEnter,
73
+ tabIndex: "0",
74
+ "aria-label": label,
75
+ "aria-current": isActive,
76
+ onFocus: () => setIsFocused(true),
77
+ onBlur: () => setIsFocused(false)
78
+ }, createElement("div", {
79
+ className: "edit-site-global-styles-variations_item-preview"
80
+ }, children(isFocused))));
81
+ }
82
+ //# sourceMappingURL=variation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["classnames","useMemo","useContext","useState","ENTER","__","sprintf","privateApis","blockEditorPrivateApis","mergeBaseAndUserConfigs","unlock","GlobalStylesContext","areGlobalStyleConfigsEqual","Variation","variation","children","isFocused","setIsFocused","base","user","setUserConfig","context","_variation$settings","_variation$styles","settings","styles","merged","selectVariation","selectOnEnter","event","keyCode","preventDefault","isActive","label","title","description","createElement","Provider","value","className","role","onClick","onKeyDown","tabIndex","onFocus","onBlur"],"sources":["@wordpress/edit-site/src/components/global-styles/variations/variation.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useContext, useState } from '@wordpress/element';\nimport { ENTER } from '@wordpress/keycodes';\nimport { __, sprintf } 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';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport default function Variation( { variation, children } ) {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\tconst { base, user, setUserConfig } = useContext( GlobalStylesContext );\n\tconst context = useMemo(\n\t\t() => ( {\n\t\t\tuser: {\n\t\t\t\tsettings: variation.settings ?? {},\n\t\t\t\tstyles: variation.styles ?? {},\n\t\t\t},\n\t\t\tbase,\n\t\t\tmerged: mergeBaseAndUserConfigs( base, variation ),\n\t\t\tsetUserConfig: () => {},\n\t\t} ),\n\t\t[ variation, base ]\n\t);\n\n\tconst selectVariation = () => {\n\t\tsetUserConfig( () => ( {\n\t\t\tsettings: variation.settings,\n\t\t\tstyles: variation.styles,\n\t\t} ) );\n\t};\n\n\tconst selectOnEnter = ( event ) => {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tselectVariation();\n\t\t}\n\t};\n\n\tconst isActive = useMemo(\n\t\t() => areGlobalStyleConfigsEqual( user, variation ),\n\t\t[ user, variation ]\n\t);\n\n\tlet label = variation?.title;\n\tif ( variation?.description ) {\n\t\tlabel = sprintf(\n\t\t\t/* translators: %1$s: variation title. %2$s variation description. */\n\t\t\t__( '%1$s (%2$s)' ),\n\t\t\tvariation?.title,\n\t\t\tvariation?.description\n\t\t);\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t<div\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-global-styles-variations_item',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isActive,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\trole=\"button\"\n\t\t\t\tonClick={ selectVariation }\n\t\t\t\tonKeyDown={ selectOnEnter }\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\taria-label={ label }\n\t\t\t\taria-current={ isActive }\n\t\t\t\tonFocus={ () => setIsFocused( true ) }\n\t\t\t\tonBlur={ () => setIsFocused( false ) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-global-styles-variations_item-preview\">\n\t\t\t\t\t{ children( isFocused ) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,OAAO,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AAClE,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAM;EAAEC,mBAAmB;EAAEC;AAA2B,CAAC,GAAGF,MAAM,CACjEF,sBACD,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AK,GAAGnB,SAAS,EAAEoB,KAAK;EAC5B,IAAKpB,SAAS,EAAEqB,WAAW,EAAG;IAC7BF,KAAK,GAAG3B,OAAO,EACd;IACAD,EAAE,CAAE,aAAc,CAAC,EACnBS,SAAS,EAAEoB,KAAK,EAChBpB,SAAS,EAAEqB,WACZ,CAAC;EACF;EAEA,OACCC,aAAA,CAACzB,mBAAmB,CAAC0B,QAAQ;IAACC,KAAK,EAAGjB;EAAS,GAC9Ce,aAAA;IACCG,SAAS,EAAGvC,UAAU,CACrB,yCAAyC,EACzC;MACC,WAAW,EAAEgC;IACd,CACD,CAAG;IACHQ,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAGd,eAAiB;IAC3Be,SAAS,EAAGd,aAAe;IAC3Be,QAAQ,EAAC,GAAG;IACZ,cAAaV,KAAO;IACpB,gBAAeD,QAAU;IACzBY,OAAO,EAAGA,CAAA,KAAM3B,YAAY,CAAE,IAAK,CAAG;IACtC4B,MAAM,EAAGA,CAAA,KAAM5B,YAAY,CAAE,KAAM;EAAG,GAEtCmB,aAAA;IAAKG,SAAS,EAAC;EAAiD,GAC7DxB,QAAQ,CAAEC,SAAU,CAClB,CACD,CACwB,CAAC;AAEjC"}
@@ -0,0 +1,28 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { __experimentalGrid as Grid, __experimentalVStack as VStack } from '@wordpress/components';
6
+ import { __ } from '@wordpress/i18n';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import Subtitle from '../subtitle';
12
+ import Variation from './variation';
13
+ import StylesPreviewColors from '../preview-colors';
14
+ export default function ColorVariations({
15
+ variations
16
+ }) {
17
+ return createElement(VStack, {
18
+ spacing: 3
19
+ }, createElement(Subtitle, {
20
+ level: 3
21
+ }, __('Presets')), createElement(Grid, {
22
+ columns: 3
23
+ }, variations.map((variation, index) => createElement(Variation, {
24
+ key: index,
25
+ variation: variation
26
+ }, () => createElement(StylesPreviewColors, null)))));
27
+ }
28
+ //# sourceMappingURL=variations-color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__experimentalGrid","Grid","__experimentalVStack","VStack","__","Subtitle","Variation","StylesPreviewColors","ColorVariations","variations","createElement","spacing","level","columns","map","variation","index","key"],"sources":["@wordpress/edit-site/src/components/global-styles/variations/variations-color.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalGrid as Grid,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Subtitle from '../subtitle';\nimport Variation from './variation';\nimport StylesPreviewColors from '../preview-colors';\n\nexport default function ColorVariations( { variations } ) {\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<Subtitle level={ 3 }>{ __( 'Presets' ) }</Subtitle>\n\t\t\t<Grid columns={ 3 }>\n\t\t\t\t{ variations.map( ( variation, index ) => (\n\t\t\t\t\t<Variation key={ index } variation={ variation }>\n\t\t\t\t\t\t{ () => <StylesPreviewColors /> }\n\t\t\t\t\t</Variation>\n\t\t\t\t) ) }\n\t\t\t</Grid>\n\t\t</VStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,mBAAmB,MAAM,mBAAmB;AAEnD,eAAe,SAASC,eAAeA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACzD,OACCC,aAAA,CAACP,MAAM;IAACQ,OAAO,EAAG;EAAG,GACpBD,aAAA,CAACL,QAAQ;IAACO,KAAK,EAAG;EAAG,GAAGR,EAAE,CAAE,SAAU,CAAa,CAAC,EACpDM,aAAA,CAACT,IAAI;IAACY,OAAO,EAAG;EAAG,GAChBJ,UAAU,CAACK,GAAG,CAAE,CAAEC,SAAS,EAAEC,KAAK,KACnCN,aAAA,CAACJ,SAAS;IAACW,GAAG,EAAGD,KAAO;IAACD,SAAS,EAAGA;EAAW,GAC7C,MAAML,aAAA,CAACH,mBAAmB,MAAE,CACpB,CACV,CACG,CACC,CAAC;AAEX"}
@@ -9,7 +9,7 @@ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
9
9
  * Internal dependencies
10
10
  */
11
11
 
12
- import { NavigationButtonAsItem } from './navigation-button';
12
+ import { NavigationButtonAsItem } from '../navigation-button';
13
13
  function getCoreBlockStyles(blockStyles) {
14
14
  return blockStyles?.filter(style => style.source === 'block');
15
15
  }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["store","blocksStore","useSelect","__experimentalItemGroup","ItemGroup","NavigationButtonAsItem","getCoreBlockStyles","blockStyles","filter","style","source","useBlockVariations","name","select","getBlockStyles","coreBlockStyles","VariationsPanel","createElement","isBordered","isSeparated","map","index","isDefault","key","path","encodeURIComponent","label"],"sources":["@wordpress/edit-site/src/components/global-styles/variations/variations-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n/**\n * Internal dependencies\n */\n\nimport { NavigationButtonAsItem } from '../navigation-button';\n\nfunction getCoreBlockStyles( blockStyles ) {\n\treturn blockStyles?.filter( ( style ) => style.source === 'block' );\n}\n\nexport function useBlockVariations( name ) {\n\tconst blockStyles = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tconst coreBlockStyles = getCoreBlockStyles( blockStyles );\n\treturn coreBlockStyles;\n}\n\nexport function VariationsPanel( { name } ) {\n\tconst coreBlockStyles = useBlockVariations( name );\n\n\treturn (\n\t\t<ItemGroup isBordered isSeparated>\n\t\t\t{ coreBlockStyles.map( ( style, index ) => {\n\t\t\t\tif ( style?.isDefault ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tpath={\n\t\t\t\t\t\t\t'/blocks/' +\n\t\t\t\t\t\t\tencodeURIComponent( name ) +\n\t\t\t\t\t\t\t'/variations/' +\n\t\t\t\t\t\t\tencodeURIComponent( style.name )\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ style.label }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ style.label }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E;AACA;AACA;;AAEA,SAASC,sBAAsB,QAAQ,sBAAsB;AAE7D,SAASC,kBAAkBA,CAAEC,WAAW,EAAG;EAC1C,OAAOA,WAAW,EAAEC,MAAM,CAAIC,KAAK,IAAMA,KAAK,CAACC,MAAM,KAAK,OAAQ,CAAC;AACpE;AAEA,OAAO,SAASC,kBAAkBA,CAAEC,IAAI,EAAG;EAC1C,MAAML,WAAW,GAAGL,SAAS,CAC1BW,MAAM,IAAM;IACb,MAAM;MAAEC;IAAe,CAAC,GAAGD,MAAM,CAAEZ,WAAY,CAAC;IAChD,OAAOa,cAAc,CAAEF,IAAK,CAAC;EAC9B,CAAC,EACD,CAAEA,IAAI,CACP,CAAC;EACD,MAAMG,eAAe,GAAGT,kBAAkB,CAAEC,WAAY,CAAC;EACzD,OAAOQ,eAAe;AACvB;AAEA,OAAO,SAASC,eAAeA,CAAE;EAAEJ;AAAK,CAAC,EAAG;EAC3C,MAAMG,eAAe,GAAGJ,kBAAkB,CAAEC,IAAK,CAAC;EAElD,OACCK,aAAA,CAACb,SAAS;IAACc,UAAU;IAACC,WAAW;EAAA,GAC9BJ,eAAe,CAACK,GAAG,CAAE,CAAEX,KAAK,EAAEY,KAAK,KAAM;IAC1C,IAAKZ,KAAK,EAAEa,SAAS,EAAG;MACvB,OAAO,IAAI;IACZ;IACA,OACCL,aAAA,CAACZ,sBAAsB;MACtBkB,GAAG,EAAGF,KAAO;MACbG,IAAI,EACH,UAAU,GACVC,kBAAkB,CAAEb,IAAK,CAAC,GAC1B,cAAc,GACda,kBAAkB,CAAEhB,KAAK,CAACG,IAAK,CAC/B;MACD,cAAaH,KAAK,CAACiB;IAAO,GAExBjB,KAAK,CAACiB,KACe,CAAC;EAE3B,CAAE,CACQ,CAAC;AAEd"}
@@ -0,0 +1,56 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { useContext } from '@wordpress/element';
6
+ import { __experimentalGrid as Grid, __experimentalVStack as VStack } from '@wordpress/components';
7
+ import { __ } 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 { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
16
+ import PreviewTypography from '../preview-typography';
17
+ import Subtitle from '../subtitle';
18
+ import { getFontFamilies } from '../utils';
19
+ import Variation from './variation';
20
+ const {
21
+ GlobalStylesContext
22
+ } = unlock(blockEditorPrivateApis);
23
+ export default function TypographyVariations() {
24
+ const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig({
25
+ property: 'typography',
26
+ filter: variation => variation?.settings?.typography?.fontFamilies && Object.keys(variation?.settings?.typography?.fontFamilies).length
27
+ });
28
+ const {
29
+ base
30
+ } = useContext(GlobalStylesContext);
31
+
32
+ /*
33
+ * Filter duplicate variations based on the font families used in the variation.
34
+ */
35
+ const uniqueTypographyVariations = typographyVariations?.length ? Object.values(typographyVariations.reduce((acc, variation) => {
36
+ const [bodyFontFamily, headingFontFamily] = getFontFamilies(mergeBaseAndUserConfigs(base, variation));
37
+ if (headingFontFamily?.name && bodyFontFamily?.name && !acc[`${headingFontFamily?.name}:${bodyFontFamily?.name}`]) {
38
+ acc[`${headingFontFamily?.name}:${bodyFontFamily?.name}`] = variation;
39
+ }
40
+ return acc;
41
+ }, {})) : [];
42
+ return createElement(VStack, {
43
+ spacing: 3
44
+ }, createElement(Subtitle, {
45
+ level: 3
46
+ }, __('Presets')), createElement(Grid, {
47
+ columns: 3,
48
+ className: "edit-site-global-styles-style-variations-container"
49
+ }, typographyVariations && typographyVariations.length ? uniqueTypographyVariations.map((variation, index) => createElement(Variation, {
50
+ key: index,
51
+ variation: variation
52
+ }, () => createElement(PreviewTypography, {
53
+ variation: variation
54
+ }))) : null));
55
+ }
56
+ //# sourceMappingURL=variations-typography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","__experimentalGrid","Grid","__experimentalVStack","VStack","__","privateApis","blockEditorPrivateApis","mergeBaseAndUserConfigs","unlock","useCurrentMergeThemeStyleVariationsWithUserConfig","PreviewTypography","Subtitle","getFontFamilies","Variation","GlobalStylesContext","TypographyVariations","typographyVariations","property","filter","variation","settings","typography","fontFamilies","Object","keys","length","base","uniqueTypographyVariations","values","reduce","acc","bodyFontFamily","headingFontFamily","name","createElement","spacing","level","columns","className","map","index","key"],"sources":["@wordpress/edit-site/src/components/global-styles/variations/variations-typography.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport {\n\t__experimentalGrid as Grid,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } 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 { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';\nimport PreviewTypography from '../preview-typography';\nimport Subtitle from '../subtitle';\nimport { getFontFamilies } from '../utils';\nimport Variation from './variation';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\nexport default function TypographyVariations() {\n\tconst typographyVariations =\n\t\tuseCurrentMergeThemeStyleVariationsWithUserConfig( {\n\t\t\tproperty: 'typography',\n\t\t\tfilter: ( variation ) =>\n\t\t\t\tvariation?.settings?.typography?.fontFamilies &&\n\t\t\t\tObject.keys( variation?.settings?.typography?.fontFamilies )\n\t\t\t\t\t.length,\n\t\t} );\n\n\tconst { base } = useContext( GlobalStylesContext );\n\n\t/*\n\t * Filter duplicate variations based on the font families used in the variation.\n\t */\n\tconst uniqueTypographyVariations = typographyVariations?.length\n\t\t? Object.values(\n\t\t\t\ttypographyVariations.reduce( ( acc, variation ) => {\n\t\t\t\t\tconst [ bodyFontFamily, headingFontFamily ] =\n\t\t\t\t\t\tgetFontFamilies(\n\t\t\t\t\t\t\tmergeBaseAndUserConfigs( base, variation )\n\t\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\theadingFontFamily?.name &&\n\t\t\t\t\t\tbodyFontFamily?.name &&\n\t\t\t\t\t\t! acc[\n\t\t\t\t\t\t\t`${ headingFontFamily?.name }:${ bodyFontFamily?.name }`\n\t\t\t\t\t\t]\n\t\t\t\t\t) {\n\t\t\t\t\t\tacc[\n\t\t\t\t\t\t\t`${ headingFontFamily?.name }:${ bodyFontFamily?.name }`\n\t\t\t\t\t\t] = variation;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn acc;\n\t\t\t\t}, {} )\n\t\t )\n\t\t: [];\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<Subtitle level={ 3 }>{ __( 'Presets' ) }</Subtitle>\n\t\t\t<Grid\n\t\t\t\tcolumns={ 3 }\n\t\t\t\tclassName=\"edit-site-global-styles-style-variations-container\"\n\t\t\t>\n\t\t\t\t{ typographyVariations && typographyVariations.length\n\t\t\t\t\t? uniqueTypographyVariations.map( ( variation, index ) => (\n\t\t\t\t\t\t\t<Variation key={ index } variation={ variation }>\n\t\t\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t\t\t<PreviewTypography\n\t\t\t\t\t\t\t\t\t\tvariation={ variation }\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</Variation>\n\t\t\t\t\t ) )\n\t\t\t\t\t: null }\n\t\t\t</Grid>\n\t\t</VStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SACCC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,iDAAiD,QAAQ,kFAAkF;AACpJ,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,eAAe,QAAQ,UAAU;AAC1C,OAAOC,SAAS,MAAM,aAAa;AAEnC,MAAM;EAAEC;AAAoB,CAAC,GAAGN,MAAM,CAAEF,sBAAuB,CAAC;AAEhE,eAAe,SAASS,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,oBAAoB,GACzBP,iDAAiD,CAAE;IAClDQ,QAAQ,EAAE,YAAY;IACtBC,MAAM,EAAIC,SAAS,IAClBA,SAAS,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,YAAY,IAC7CC,MAAM,CAACC,IA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;EAAW,CACvB,CAEQ,CACT,CAAC,GACH,IACE,CACC,CAAC;AAEX"}
@@ -13,7 +13,6 @@ import { store as editorStore, privateApis as editorPrivateApis } from '@wordpre
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
- import { store as editSiteStore } from '../../../store';
17
16
  import { unlock } from '../../../lock-unlock';
18
17
  const {
19
18
  DocumentTools: EditorDocumentTools
@@ -28,7 +27,7 @@ export default function DocumentTools({
28
27
  } = useSelect(select => {
29
28
  const {
30
29
  getEditorMode
31
- } = select(editSiteStore);
30
+ } = select(editorStore);
32
31
  return {
33
32
  isVisualMode: getEditorMode() === 'visual'
34
33
  };
@@ -1 +1 @@
1
- {"version":3,"names":["useViewportMatch","store","blockEditorStore","useSelect","useDispatch","__","chevronUpDown","Button","ToolbarItem","editorStore","privateApis","editorPrivateApis","editSiteStore","unlock","DocumentTools","EditorDocumentTools","blockEditorMode","hasFixedToolbar","isDistractionFree","isVisualMode","select","getEditorMode","__unstableSetEditorMode","setDeviceType","isLargeViewport","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","createElement","disableBlockTools","listViewLabel","as","className","icon","isPressed","label","onClick","size"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { chevronUpDown } from '@wordpress/icons';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { DocumentTools: EditorDocumentTools } = unlock( editorPrivateApis );\n\nexport default function DocumentTools( {\n\tblockEditorMode,\n\thasFixedToolbar,\n\tisDistractionFree,\n} ) {\n\tconst { isVisualMode } = useSelect( ( select ) => {\n\t\tconst { getEditorMode } = select( editSiteStore );\n\n\t\treturn {\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t};\n\t}, [] );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\treturn (\n\t\t<EditorDocumentTools\n\t\t\tdisableBlockTools={ ! isVisualMode }\n\t\t\tlistViewLabel={ __( 'List View' ) }\n\t\t>\n\t\t\t{ isZoomedOutViewExperimentEnabled &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\t! hasFixedToolbar && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__zoom-out-view-toggle\"\n\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetDeviceType( 'Desktop' );\n\t\t\t\t\t\t\t__unstableSetEditorMode(\n\t\t\t\t\t\t\t\tisZoomedOutView ? 'edit' : 'zoom-out'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</EditorDocumentTools>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,SAAS,EAAEC,W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AQ;IACb0B,SAAS,EAAC,kDAAkD;IAC5DC,IAAI,EAAG5B,aAAe;IACtB6B,SAAS,EAAGP;IACZ;IACAQ,KAAK,EAAG/B,EAAE,CAAE,eAAgB,CAAG;IAC/BgC,OAAO,EAAGA,CAAA,KAAM;MACfd,aAAa,CAAE,SAAU,CAAC;MAC1BD,uBAAuB,CACtBM,eAAe,GAAG,MAAM,GAAG,UAC5B,CAAC;IACF,CAAG;IACHU,IAAI,EAAC;EAAS,CACd,CAEiB,CAAC;AAExB"}
1
+ {"version":3,"names":["useViewportMatch","store","blockEditorStore","useSelect","useDispatch","__","chevronUpDown","Button","ToolbarItem","editorStore","privateApis","editorPrivateApis","unlock","DocumentTools","EditorDocumentTools","blockEditorMode","hasFixedToolbar","isDistractionFree","isVisualMode","select","getEditorMode","__unstableSetEditorMode","setDeviceType","isLargeViewport","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","createElement","disableBlockTools","listViewLabel","as","className","icon","isPressed","label","onClick","size"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { chevronUpDown } from '@wordpress/icons';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { DocumentTools: EditorDocumentTools } = unlock( editorPrivateApis );\n\nexport default function DocumentTools( {\n\tblockEditorMode,\n\thasFixedToolbar,\n\tisDistractionFree,\n} ) {\n\tconst { isVisualMode } = useSelect( ( select ) => {\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t};\n\t}, [] );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\treturn (\n\t\t<EditorDocumentTools\n\t\t\tdisableBlockTools={ ! isVisualMode }\n\t\t\tlistViewLabel={ __( 'List View' ) }\n\t\t>\n\t\t\t{ isZoomedOutViewExperimentEnabled &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\t! hasFixedToolbar && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__zoom-out-view-toggle\"\n\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetDeviceType( 'Desktop' );\n\t\t\t\t\t\t\t__unstableSetEditorMode(\n\t\t\t\t\t\t\t\tisZoomedOutView ? 'edit' : 'zoom-out'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</EditorDocumentTools>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,MAAM,EAAEC,WAAW,QAAQ,uB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aAAa,CAAE,SAAU,CAAC;MAC1BD,uBAAuB,CACtBM,eAAe,GAAG,MAAM,GAAG,UAC5B,CAAC;IACF,CAAG;IACHU,IAAI,EAAC;EAAS,CACd,CAEiB,CAAC;AAExB"}
@@ -8,7 +8,7 @@ import classnames from 'classnames';
8
8
  * WordPress dependencies
9
9
  */
10
10
  import { useViewportMatch, useReducedMotion } from '@wordpress/compose';
11
- import { BlockToolbar, store as blockEditorStore } from '@wordpress/block-editor';
11
+ import { BlockToolbar, privateApis as blockEditorPrivateApis, store as blockEditorStore } from '@wordpress/block-editor';
12
12
  import { useSelect } from '@wordpress/data';
13
13
  import { useEffect, useRef, useState } from '@wordpress/element';
14
14
  import { PinnedItems } from '@wordpress/interface';
@@ -28,6 +28,9 @@ import { store as editSiteStore } from '../../store';
28
28
  import { getEditorCanvasContainerTitle, useHasEditorCanvasContainer } from '../editor-canvas-container';
29
29
  import { unlock } from '../../lock-unlock';
30
30
  import { FOCUSABLE_ENTITIES } from '../../utils/constants';
31
+ const {
32
+ useShowBlockTools
33
+ } = unlock(blockEditorPrivateApis);
31
34
  const {
32
35
  PostViewLink,
33
36
  PreviewDropdown
@@ -39,9 +42,7 @@ export default function HeaderEditMode() {
39
42
  blockEditorMode,
40
43
  blockSelectionStart,
41
44
  showIconLabels,
42
- editorCanvasView,
43
- hasFixedToolbar,
44
- isZoomOutMode
45
+ editorCanvasView
45
46
  } = useSelect(select => {
46
47
  const {
47
48
  getEditedPostType
@@ -63,20 +64,20 @@ export default function HeaderEditMode() {
63
64
  blockSelectionStart: getBlockSelectionStart(),
64
65
  showIconLabels: getPreference('core', 'showIconLabels'),
65
66
  editorCanvasView: unlock(select(editSiteStore)).getEditorCanvasContainerView(),
66
- hasFixedToolbar: getPreference('core', 'fixedToolbar'),
67
- isDistractionFree: getPreference('core', 'distractionFree'),
68
- isZoomOutMode: __unstableGetEditorMode() === 'zoom-out'
67
+ isDistractionFree: getPreference('core', 'distractionFree')
69
68
  };
70
69
  }, []);
71
70
  const isLargeViewport = useViewportMatch('medium');
72
- const isTopToolbar = !isZoomOutMode && hasFixedToolbar && isLargeViewport;
71
+ const {
72
+ showFixedToolbar
73
+ } = useShowBlockTools();
74
+ const showTopToolbar = isLargeViewport && showFixedToolbar;
73
75
  const blockToolbarRef = useRef();
74
76
  const disableMotion = useReducedMotion();
75
77
  const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer();
76
78
  const isFocusMode = FOCUSABLE_ENTITIES.includes(templateType);
77
79
  const isZoomedOutView = blockEditorMode === 'zoom-out';
78
80
  const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = useState(true);
79
- const hasBlockSelected = !!blockSelectionStart;
80
81
  useEffect(() => {
81
82
  // If we have a new block selection, show the block tools
82
83
  if (blockSelectionStart) {
@@ -113,16 +114,16 @@ export default function HeaderEditMode() {
113
114
  }, createElement(DocumentTools, {
114
115
  blockEditorMode: blockEditorMode,
115
116
  isDistractionFree: isDistractionFree
116
- }), isTopToolbar && createElement(Fragment, null, createElement("div", {
117
+ }), showTopToolbar && createElement(Fragment, null, createElement("div", {
117
118
  className: classnames('selected-block-tools-wrapper', {
118
- 'is-collapsed': isBlockToolsCollapsed || !hasBlockSelected
119
+ 'is-collapsed': isBlockToolsCollapsed
119
120
  })
120
121
  }, createElement(BlockToolbar, {
121
122
  hideDragHandle: true
122
123
  })), createElement(Popover.Slot, {
123
124
  ref: blockToolbarRef,
124
125
  name: "block-toolbar"
125
- }), hasBlockSelected && createElement(Button, {
126
+ }), createElement(Button, {
126
127
  className: "edit-site-header-edit-mode__block-tools-toggle",
127
128
  icon: isBlockToolsCollapsed ? next : previous,
128
129
  onClick: () => {
@@ -131,7 +132,7 @@ export default function HeaderEditMode() {
131
132
  label: isBlockToolsCollapsed ? __('Show block tools') : __('Hide block tools')
132
133
  }))), !isDistractionFree && createElement("div", {
133
134
  className: classnames('edit-site-header-edit-mode__center', {
134
- 'is-collapsed': !isBlockToolsCollapsed && isLargeViewport
135
+ 'is-collapsed': !isBlockToolsCollapsed && showTopToolbar
135
136
  })
136
137
  }, !hasDefaultEditorCanvasView ? getEditorCanvasContainerTitle(editorCanvasView) : createElement(DocumentBar, null)), createElement("div", {
137
138
  className: "edit-site-header-edit-mode__end"
@@ -145,7 +146,9 @@ export default function HeaderEditMode() {
145
146
  })
146
147
  }, createElement(PreviewDropdown, {
147
148
  disabled: isFocusMode || !hasDefaultEditorCanvasView
148
- })), createElement(PostViewLink, null), createElement(SaveButton, null), !isDistractionFree && createElement(PinnedItems.Slot, {
149
+ })), createElement(PostViewLink, null), createElement(SaveButton, {
150
+ size: "compact"
151
+ }), !isDistractionFree && createElement(PinnedItems.Slot, {
149
152
  scope: "core/edit-site"
150
153
  }), createElement(MoreMenu, {
151
154
  showIconLabels: showIconLabels