@wordpress/edit-site 5.34.0 → 6.0.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 (977) hide show
  1. package/CHANGELOG.md +16 -3
  2. package/build/components/add-new-page/index.js +33 -27
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +95 -78
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/add-new-template/add-custom-generic-template-modal-content.js +35 -30
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/add-custom-template-modal-content.js +119 -95
  9. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  10. package/build/components/add-new-template/index.js +89 -73
  11. package/build/components/add-new-template/index.js.map +1 -1
  12. package/build/components/add-new-template/utils.js +36 -17
  13. package/build/components/add-new-template/utils.js.map +1 -1
  14. package/build/components/app/index.js +13 -5
  15. package/build/components/app/index.js.map +1 -1
  16. package/build/components/block-editor/block-inspector-button.js +5 -4
  17. package/build/components/block-editor/block-inspector-button.js.map +1 -1
  18. package/build/components/block-editor/use-editor-iframe-props.js +88 -0
  19. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -0
  20. package/build/components/canvas-loader/index.js +13 -12
  21. package/build/components/canvas-loader/index.js.map +1 -1
  22. package/build/components/dataviews-actions/index.js +49 -0
  23. package/build/components/dataviews-actions/index.js.map +1 -0
  24. package/build/components/editor/index.js +107 -140
  25. package/build/components/editor/index.js.map +1 -1
  26. package/build/components/editor-canvas-container/index.js +27 -29
  27. package/build/components/editor-canvas-container/index.js.map +1 -1
  28. package/build/components/error-boundary/index.js +2 -2
  29. package/build/components/error-boundary/index.js.map +1 -1
  30. package/build/components/error-boundary/warning.js +13 -11
  31. package/build/components/error-boundary/warning.js.map +1 -1
  32. package/build/components/global-styles/background-panel.js +19 -6
  33. package/build/components/global-styles/background-panel.js.map +1 -1
  34. package/build/components/global-styles/block-preview-panel.js +19 -17
  35. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  36. package/build/components/global-styles/color-indicator-wrapper.js +4 -4
  37. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  38. package/build/components/global-styles/color-palette-panel.js +32 -28
  39. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  40. package/build/components/global-styles/dimensions-panel.js +2 -2
  41. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  42. package/build/components/global-styles/font-families.js +55 -39
  43. package/build/components/global-styles/font-families.js.map +1 -1
  44. package/build/components/global-styles/font-family-item.js +17 -13
  45. package/build/components/global-styles/font-family-item.js.map +1 -1
  46. package/build/components/global-styles/font-library-modal/collection-font-variant.js +25 -22
  47. package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  48. package/build/components/global-styles/font-library-modal/context.js +7 -30
  49. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  50. package/build/components/global-styles/font-library-modal/font-card.js +24 -16
  51. package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
  52. package/build/components/global-styles/font-library-modal/font-collection.js +195 -152
  53. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  54. package/build/components/global-styles/font-library-modal/font-demo.js +14 -12
  55. package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  56. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +29 -20
  57. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  58. package/build/components/global-styles/font-library-modal/index.js +41 -36
  59. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  60. package/build/components/global-styles/font-library-modal/installed-fonts.js +153 -109
  61. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  62. package/build/components/global-styles/font-library-modal/library-font-details.js +16 -14
  63. package/build/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
  64. package/build/components/global-styles/font-library-modal/library-font-variant.js +25 -22
  65. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  66. package/build/components/global-styles/font-library-modal/upload-fonts.js +40 -34
  67. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  68. package/build/components/global-styles/font-library-modal/utils/index.js +3 -3
  69. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  70. package/build/components/global-styles/gradients-palette-panel.js +41 -38
  71. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  72. package/build/components/global-styles/header.js +37 -28
  73. package/build/components/global-styles/header.js.map +1 -1
  74. package/build/components/global-styles/highlighted-colors.js +3 -4
  75. package/build/components/global-styles/highlighted-colors.js.map +1 -1
  76. package/build/components/global-styles/hooks.js +11 -20
  77. package/build/components/global-styles/hooks.js.map +1 -1
  78. package/build/components/global-styles/icon-with-current-color.js +4 -4
  79. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  80. package/build/components/global-styles/navigation-button.js +15 -11
  81. package/build/components/global-styles/navigation-button.js.map +1 -1
  82. package/build/components/global-styles/palette.js +39 -32
  83. package/build/components/global-styles/palette.js.map +1 -1
  84. package/build/components/global-styles/preset-colors.js +28 -0
  85. package/build/components/global-styles/preset-colors.js.map +1 -0
  86. package/build/components/global-styles/preview-colors.js +23 -25
  87. package/build/components/global-styles/preview-colors.js.map +1 -1
  88. package/build/components/global-styles/preview-iframe.js +34 -29
  89. package/build/components/global-styles/preview-iframe.js.map +1 -1
  90. package/build/components/global-styles/preview-styles.js +95 -90
  91. package/build/components/global-styles/preview-styles.js.map +1 -1
  92. package/build/components/global-styles/root-menu.js +28 -21
  93. package/build/components/global-styles/root-menu.js.map +1 -1
  94. package/build/components/global-styles/screen-background.js +6 -4
  95. package/build/components/global-styles/screen-background.js.map +1 -1
  96. package/build/components/global-styles/screen-block-list.js +33 -27
  97. package/build/components/global-styles/screen-block-list.js.map +1 -1
  98. package/build/components/global-styles/screen-block.js +62 -53
  99. package/build/components/global-styles/screen-block.js.map +1 -1
  100. package/build/components/global-styles/screen-color-palette.js +29 -19
  101. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  102. package/build/components/global-styles/screen-colors.js +18 -17
  103. package/build/components/global-styles/screen-colors.js.map +1 -1
  104. package/build/components/global-styles/screen-css.js +20 -14
  105. package/build/components/global-styles/screen-css.js.map +1 -1
  106. package/build/components/global-styles/screen-layout.js +9 -4
  107. package/build/components/global-styles/screen-layout.js.map +1 -1
  108. package/build/components/global-styles/screen-revisions/index.js +52 -42
  109. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  110. package/build/components/global-styles/screen-revisions/revisions-buttons.js +82 -71
  111. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  112. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -0
  113. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  114. package/build/components/global-styles/screen-root.js +76 -42
  115. package/build/components/global-styles/screen-root.js.map +1 -1
  116. package/build/components/global-styles/screen-shadows.js +22 -0
  117. package/build/components/global-styles/screen-shadows.js.map +1 -0
  118. package/build/components/global-styles/screen-style-variations.js +14 -9
  119. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  120. package/build/components/global-styles/screen-typography-element.js +50 -45
  121. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  122. package/build/components/global-styles/screen-typography.js +15 -11
  123. package/build/components/global-styles/screen-typography.js.map +1 -1
  124. package/build/components/global-styles/shadow-utils.js +230 -0
  125. package/build/components/global-styles/shadow-utils.js.map +1 -0
  126. package/build/components/global-styles/shadows-edit-panel.js +458 -0
  127. package/build/components/global-styles/shadows-edit-panel.js.map +1 -0
  128. package/build/components/global-styles/shadows-panel.js +128 -0
  129. package/build/components/global-styles/shadows-panel.js.map +1 -0
  130. package/build/components/global-styles/style-variations-container.js +67 -18
  131. package/build/components/global-styles/style-variations-container.js.map +1 -1
  132. package/build/components/global-styles/subtitle.js +5 -4
  133. package/build/components/global-styles/subtitle.js.map +1 -1
  134. package/build/components/global-styles/typography-elements.js +53 -45
  135. package/build/components/global-styles/typography-elements.js.map +1 -1
  136. package/build/components/global-styles/typography-example.js +16 -10
  137. package/build/components/global-styles/typography-example.js.map +1 -1
  138. package/build/components/global-styles/typography-panel.js +2 -2
  139. package/build/components/global-styles/typography-panel.js.map +1 -1
  140. package/build/components/global-styles/typography-preview.js +5 -4
  141. package/build/components/global-styles/typography-preview.js.map +1 -1
  142. package/build/components/global-styles/ui.js +124 -89
  143. package/build/components/global-styles/ui.js.map +1 -1
  144. package/build/components/global-styles/utils.js +28 -0
  145. package/build/components/global-styles/utils.js.map +1 -1
  146. package/build/components/global-styles/variations/variation.js +36 -25
  147. package/build/components/global-styles/variations/variation.js.map +1 -1
  148. package/build/components/global-styles/variations/variations-color.js +19 -14
  149. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  150. package/build/components/global-styles/variations/variations-panel.js +27 -17
  151. package/build/components/global-styles/variations/variations-panel.js.map +1 -1
  152. package/build/components/global-styles/variations/variations-typography.js +37 -31
  153. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  154. package/build/components/global-styles-renderer/index.js +5 -1
  155. package/build/components/global-styles-renderer/index.js.map +1 -1
  156. package/build/components/global-styles-sidebar/default-sidebar.js +56 -0
  157. package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -0
  158. package/build/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +37 -26
  159. package/build/components/global-styles-sidebar/index.js.map +1 -0
  160. package/build/components/layout/index.js +113 -99
  161. package/build/components/layout/index.js.map +1 -1
  162. package/build/components/layout/router.js +110 -75
  163. package/build/components/layout/router.js.map +1 -1
  164. package/build/components/media/index.js +2 -2
  165. package/build/components/media/index.js.map +1 -1
  166. package/build/components/{header-edit-mode/more-menu → more-menu}/index.js +7 -3
  167. package/build/components/more-menu/index.js.map +1 -0
  168. package/build/components/{header-edit-mode/more-menu → more-menu}/site-export.js +5 -4
  169. package/build/components/more-menu/site-export.js.map +1 -0
  170. package/build/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +5 -4
  171. package/build/components/more-menu/welcome-guide-menu-item.js.map +1 -0
  172. package/build/components/page/header.js +24 -20
  173. package/build/components/page/header.js.map +1 -1
  174. package/build/components/page/index.js +14 -12
  175. package/build/components/page/index.js.map +1 -1
  176. package/build/components/page-pages/index.js +136 -66
  177. package/build/components/page-pages/index.js.map +1 -1
  178. package/build/components/page-patterns/delete-category-menu-item.js +23 -20
  179. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  180. package/build/components/page-patterns/header.js +47 -32
  181. package/build/components/page-patterns/header.js.map +1 -1
  182. package/build/components/page-patterns/index.js +120 -125
  183. package/build/components/page-patterns/index.js.map +1 -1
  184. package/build/components/page-patterns/rename-category-menu-item.js +14 -11
  185. package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
  186. package/build/components/page-patterns/use-patterns.js +7 -6
  187. package/build/components/page-patterns/use-patterns.js.map +1 -1
  188. package/build/components/page-templates/index.js +83 -72
  189. package/build/components/page-templates/index.js.map +1 -1
  190. package/build/components/pagination/index.js +51 -42
  191. package/build/components/pagination/index.js.map +1 -1
  192. package/build/components/plugin-template-setting-panel/index.js +4 -2
  193. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  194. package/build/components/resizable-frame/index.js +48 -34
  195. package/build/components/resizable-frame/index.js.map +1 -1
  196. package/build/components/revisions/index.js +31 -22
  197. package/build/components/revisions/index.js.map +1 -1
  198. package/build/components/routes/link.js +5 -4
  199. package/build/components/routes/link.js.map +1 -1
  200. package/build/components/save-button/index.js +5 -4
  201. package/build/components/save-button/index.js.map +1 -1
  202. package/build/components/save-hub/index.js +12 -11
  203. package/build/components/save-hub/index.js.map +1 -1
  204. package/build/components/save-panel/index.js +36 -30
  205. package/build/components/save-panel/index.js.map +1 -1
  206. package/build/components/sidebar/index.js +68 -35
  207. package/build/components/sidebar/index.js.map +1 -1
  208. package/build/components/sidebar-button/index.js +4 -4
  209. package/build/components/sidebar-button/index.js.map +1 -1
  210. package/build/components/sidebar-dataviews/add-new-view.js +56 -48
  211. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  212. package/build/components/sidebar-dataviews/custom-dataviews-list.js +106 -89
  213. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  214. package/build/components/sidebar-dataviews/dataview-item.js +14 -12
  215. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  216. package/build/components/sidebar-dataviews/default-views.js +48 -0
  217. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  218. package/build/components/sidebar-dataviews/index.js +21 -22
  219. package/build/components/sidebar-dataviews/index.js.map +1 -1
  220. package/build/components/sidebar-navigation-item/index.js +32 -28
  221. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  222. package/build/components/sidebar-navigation-screen/index.js +56 -70
  223. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  224. package/build/components/sidebar-navigation-screen-details-footer/index.js +24 -17
  225. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  226. package/build/components/sidebar-navigation-screen-details-panel/index.js +9 -7
  227. package/build/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
  228. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +5 -4
  229. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
  230. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +7 -7
  231. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  232. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +5 -4
  233. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
  234. package/build/components/sidebar-navigation-screen-global-styles/index.js +57 -45
  235. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  236. package/build/components/sidebar-navigation-screen-main/index.js +45 -22
  237. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  238. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +5 -4
  239. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  240. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +20 -12
  241. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  242. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +61 -35
  243. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  244. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +10 -8
  245. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  246. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +42 -36
  247. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  248. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +18 -12
  249. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  250. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  251. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  252. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +36 -22
  253. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  254. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +48 -40
  255. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  256. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +12 -9
  257. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  258. package/build/components/sidebar-navigation-screen-patterns/category-item.js +12 -10
  259. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  260. package/build/components/sidebar-navigation-screen-patterns/index.js +62 -77
  261. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  262. package/build/components/sidebar-navigation-screen-templates-browse/content.js +17 -17
  263. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  264. package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -5
  265. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  266. package/build/components/site-hub/index.js +83 -74
  267. package/build/components/site-hub/index.js.map +1 -1
  268. package/build/components/site-icon/index.js +9 -8
  269. package/build/components/site-icon/index.js.map +1 -1
  270. package/build/components/style-book/index.js +122 -103
  271. package/build/components/style-book/index.js.map +1 -1
  272. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -30
  273. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  274. package/build/components/table/index.js +23 -15
  275. package/build/components/table/index.js.map +1 -1
  276. package/build/components/template-part-converter/convert-to-regular.js +5 -4
  277. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  278. package/build/components/template-part-converter/convert-to-template-part.js +23 -17
  279. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  280. package/build/components/template-part-converter/index.js +30 -11
  281. package/build/components/template-part-converter/index.js.map +1 -1
  282. package/build/components/welcome-guide/editor.js +20 -15
  283. package/build/components/welcome-guide/editor.js.map +1 -1
  284. package/build/components/welcome-guide/image.js +13 -12
  285. package/build/components/welcome-guide/image.js.map +1 -1
  286. package/build/components/welcome-guide/index.js +4 -2
  287. package/build/components/welcome-guide/index.js.map +1 -1
  288. package/build/components/welcome-guide/page.js +18 -13
  289. package/build/components/welcome-guide/page.js.map +1 -1
  290. package/build/components/welcome-guide/styles.js +45 -28
  291. package/build/components/welcome-guide/styles.js.map +1 -1
  292. package/build/components/welcome-guide/template.js +18 -13
  293. package/build/components/welcome-guide/template.js.map +1 -1
  294. package/build/deprecated.js +4 -4
  295. package/build/deprecated.js.map +1 -1
  296. package/build/hooks/commands/use-common-commands.js +12 -24
  297. package/build/hooks/commands/use-common-commands.js.map +1 -1
  298. package/build/hooks/commands/use-edit-mode-commands.js +2 -116
  299. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  300. package/build/hooks/index.js +0 -1
  301. package/build/hooks/index.js.map +1 -1
  302. package/build/hooks/push-changes-to-global-styles/index.js +25 -16
  303. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  304. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +7 -3
  305. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  306. package/build/index.js +3 -3
  307. package/build/index.js.map +1 -1
  308. package/build/store/private-actions.js +7 -1
  309. package/build/store/private-actions.js.map +1 -1
  310. package/build/store/selectors.js +2 -2
  311. package/build/store/selectors.js.map +1 -1
  312. package/build/utils/template-part-create.js +0 -62
  313. package/build/utils/template-part-create.js.map +1 -1
  314. package/build/utils/use-activate-theme.js +9 -7
  315. package/build/utils/use-activate-theme.js.map +1 -1
  316. package/build-module/components/add-new-page/index.js +34 -27
  317. package/build-module/components/add-new-page/index.js.map +1 -1
  318. package/build-module/components/add-new-pattern/index.js +98 -78
  319. package/build-module/components/add-new-pattern/index.js.map +1 -1
  320. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +36 -30
  321. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  322. package/build-module/components/add-new-template/add-custom-template-modal-content.js +121 -95
  323. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  324. package/build-module/components/add-new-template/index.js +91 -73
  325. package/build-module/components/add-new-template/index.js.map +1 -1
  326. package/build-module/components/add-new-template/utils.js +36 -17
  327. package/build-module/components/add-new-template/utils.js.map +1 -1
  328. package/build-module/components/app/index.js +15 -6
  329. package/build-module/components/app/index.js.map +1 -1
  330. package/build-module/components/block-editor/block-inspector-button.js +5 -4
  331. package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
  332. package/build-module/components/block-editor/use-editor-iframe-props.js +80 -0
  333. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -0
  334. package/build-module/components/canvas-loader/index.js +14 -13
  335. package/build-module/components/canvas-loader/index.js.map +1 -1
  336. package/build-module/components/dataviews-actions/index.js +41 -0
  337. package/build-module/components/dataviews-actions/index.js.map +1 -0
  338. package/build-module/components/editor/index.js +113 -144
  339. package/build-module/components/editor/index.js.map +1 -1
  340. package/build-module/components/editor-canvas-container/index.js +29 -30
  341. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  342. package/build-module/components/error-boundary/index.js +2 -2
  343. package/build-module/components/error-boundary/index.js.map +1 -1
  344. package/build-module/components/error-boundary/warning.js +13 -11
  345. package/build-module/components/error-boundary/warning.js.map +1 -1
  346. package/build-module/components/global-styles/background-panel.js +18 -6
  347. package/build-module/components/global-styles/background-panel.js.map +1 -1
  348. package/build-module/components/global-styles/block-preview-panel.js +19 -17
  349. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  350. package/build-module/components/global-styles/color-indicator-wrapper.js +4 -4
  351. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  352. package/build-module/components/global-styles/color-palette-panel.js +32 -28
  353. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  354. package/build-module/components/global-styles/dimensions-panel.js +2 -2
  355. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  356. package/build-module/components/global-styles/font-families.js +58 -40
  357. package/build-module/components/global-styles/font-families.js.map +1 -1
  358. package/build-module/components/global-styles/font-family-item.js +18 -13
  359. package/build-module/components/global-styles/font-family-item.js.map +1 -1
  360. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +26 -22
  361. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  362. package/build-module/components/global-styles/font-library-modal/context.js +7 -30
  363. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  364. package/build-module/components/global-styles/font-library-modal/font-card.js +25 -16
  365. package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
  366. package/build-module/components/global-styles/font-library-modal/font-collection.js +198 -153
  367. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  368. package/build-module/components/global-styles/font-library-modal/font-demo.js +14 -12
  369. package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  370. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +30 -20
  371. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  372. package/build-module/components/global-styles/font-library-modal/index.js +42 -36
  373. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  374. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +157 -111
  375. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  376. package/build-module/components/global-styles/font-library-modal/library-font-details.js +18 -14
  377. package/build-module/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
  378. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +26 -22
  379. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  380. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +42 -35
  381. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  382. package/build-module/components/global-styles/font-library-modal/utils/index.js +3 -3
  383. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  384. package/build-module/components/global-styles/gradients-palette-panel.js +42 -38
  385. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  386. package/build-module/components/global-styles/header.js +38 -28
  387. package/build-module/components/global-styles/header.js.map +1 -1
  388. package/build-module/components/global-styles/highlighted-colors.js +3 -4
  389. package/build-module/components/global-styles/highlighted-colors.js.map +1 -1
  390. package/build-module/components/global-styles/hooks.js +11 -20
  391. package/build-module/components/global-styles/hooks.js.map +1 -1
  392. package/build-module/components/global-styles/icon-with-current-color.js +4 -4
  393. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  394. package/build-module/components/global-styles/navigation-button.js +16 -11
  395. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  396. package/build-module/components/global-styles/palette.js +42 -34
  397. package/build-module/components/global-styles/palette.js.map +1 -1
  398. package/build-module/components/global-styles/preset-colors.js +21 -0
  399. package/build-module/components/global-styles/preset-colors.js.map +1 -0
  400. package/build-module/components/global-styles/preview-colors.js +23 -25
  401. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  402. package/build-module/components/global-styles/preview-iframe.js +36 -29
  403. package/build-module/components/global-styles/preview-iframe.js.map +1 -1
  404. package/build-module/components/global-styles/preview-styles.js +96 -90
  405. package/build-module/components/global-styles/preview-styles.js.map +1 -1
  406. package/build-module/components/global-styles/root-menu.js +31 -22
  407. package/build-module/components/global-styles/root-menu.js.map +1 -1
  408. package/build-module/components/global-styles/screen-background.js +8 -4
  409. package/build-module/components/global-styles/screen-background.js.map +1 -1
  410. package/build-module/components/global-styles/screen-block-list.js +35 -27
  411. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  412. package/build-module/components/global-styles/screen-block.js +64 -53
  413. package/build-module/components/global-styles/screen-block.js.map +1 -1
  414. package/build-module/components/global-styles/screen-color-palette.js +31 -19
  415. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  416. package/build-module/components/global-styles/screen-colors.js +20 -17
  417. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  418. package/build-module/components/global-styles/screen-css.js +22 -14
  419. package/build-module/components/global-styles/screen-css.js.map +1 -1
  420. package/build-module/components/global-styles/screen-layout.js +11 -4
  421. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  422. package/build-module/components/global-styles/screen-revisions/index.js +54 -42
  423. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  424. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +83 -71
  425. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  426. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -0
  427. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  428. package/build-module/components/global-styles/screen-root.js +78 -42
  429. package/build-module/components/global-styles/screen-root.js.map +1 -1
  430. package/build-module/components/global-styles/screen-shadows.js +13 -0
  431. package/build-module/components/global-styles/screen-shadows.js.map +1 -0
  432. package/build-module/components/global-styles/screen-style-variations.js +16 -9
  433. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  434. package/build-module/components/global-styles/screen-typography-element.js +52 -45
  435. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  436. package/build-module/components/global-styles/screen-typography.js +17 -11
  437. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  438. package/build-module/components/global-styles/shadow-utils.js +221 -0
  439. package/build-module/components/global-styles/shadow-utils.js.map +1 -0
  440. package/build-module/components/global-styles/shadows-edit-panel.js +452 -0
  441. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -0
  442. package/build-module/components/global-styles/shadows-panel.js +121 -0
  443. package/build-module/components/global-styles/shadows-panel.js.map +1 -0
  444. package/build-module/components/global-styles/style-variations-container.js +68 -19
  445. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  446. package/build-module/components/global-styles/subtitle.js +5 -4
  447. package/build-module/components/global-styles/subtitle.js.map +1 -1
  448. package/build-module/components/global-styles/typography-elements.js +54 -45
  449. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  450. package/build-module/components/global-styles/typography-example.js +16 -9
  451. package/build-module/components/global-styles/typography-example.js.map +1 -1
  452. package/build-module/components/global-styles/typography-panel.js +2 -2
  453. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  454. package/build-module/components/global-styles/typography-preview.js +5 -4
  455. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  456. package/build-module/components/global-styles/ui.js +126 -89
  457. package/build-module/components/global-styles/ui.js.map +1 -1
  458. package/build-module/components/global-styles/utils.js +27 -0
  459. package/build-module/components/global-styles/utils.js.map +1 -1
  460. package/build-module/components/global-styles/variations/variation.js +35 -24
  461. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  462. package/build-module/components/global-styles/variations/variations-color.js +21 -15
  463. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  464. package/build-module/components/global-styles/variations/variations-panel.js +28 -18
  465. package/build-module/components/global-styles/variations/variations-panel.js.map +1 -1
  466. package/build-module/components/global-styles/variations/variations-typography.js +38 -31
  467. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  468. package/build-module/components/global-styles-renderer/index.js +5 -1
  469. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  470. package/build-module/components/global-styles-sidebar/default-sidebar.js +51 -0
  471. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -0
  472. package/build-module/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +38 -26
  473. package/build-module/components/global-styles-sidebar/index.js.map +1 -0
  474. package/build-module/components/layout/index.js +116 -100
  475. package/build-module/components/layout/index.js.map +1 -1
  476. package/build-module/components/layout/router.js +110 -76
  477. package/build-module/components/layout/router.js.map +1 -1
  478. package/build-module/components/media/index.js +2 -2
  479. package/build-module/components/media/index.js.map +1 -1
  480. package/build-module/components/{header-edit-mode/more-menu → more-menu}/index.js +9 -3
  481. package/build-module/components/more-menu/index.js.map +1 -0
  482. package/build-module/components/{header-edit-mode/more-menu → more-menu}/site-export.js +5 -4
  483. package/build-module/components/more-menu/site-export.js.map +1 -0
  484. package/build-module/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +5 -4
  485. package/build-module/components/more-menu/welcome-guide-menu-item.js.map +1 -0
  486. package/build-module/components/page/header.js +25 -19
  487. package/build-module/components/page/header.js.map +1 -1
  488. package/build-module/components/page/index.js +16 -13
  489. package/build-module/components/page/index.js.map +1 -1
  490. package/build-module/components/page-pages/index.js +141 -69
  491. package/build-module/components/page-pages/index.js.map +1 -1
  492. package/build-module/components/page-patterns/delete-category-menu-item.js +25 -20
  493. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  494. package/build-module/components/page-patterns/header.js +48 -32
  495. package/build-module/components/page-patterns/header.js.map +1 -1
  496. package/build-module/components/page-patterns/index.js +121 -125
  497. package/build-module/components/page-patterns/index.js.map +1 -1
  498. package/build-module/components/page-patterns/rename-category-menu-item.js +16 -11
  499. package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
  500. package/build-module/components/page-patterns/use-patterns.js +7 -6
  501. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  502. package/build-module/components/page-templates/index.js +85 -72
  503. package/build-module/components/page-templates/index.js.map +1 -1
  504. package/build-module/components/pagination/index.js +52 -42
  505. package/build-module/components/pagination/index.js.map +1 -1
  506. package/build-module/components/plugin-template-setting-panel/index.js +4 -2
  507. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  508. package/build-module/components/resizable-frame/index.js +51 -35
  509. package/build-module/components/resizable-frame/index.js.map +1 -1
  510. package/build-module/components/revisions/index.js +31 -21
  511. package/build-module/components/revisions/index.js.map +1 -1
  512. package/build-module/components/routes/link.js +5 -4
  513. package/build-module/components/routes/link.js.map +1 -1
  514. package/build-module/components/save-button/index.js +5 -4
  515. package/build-module/components/save-button/index.js.map +1 -1
  516. package/build-module/components/save-hub/index.js +12 -11
  517. package/build-module/components/save-hub/index.js.map +1 -1
  518. package/build-module/components/save-panel/index.js +37 -30
  519. package/build-module/components/save-panel/index.js.map +1 -1
  520. package/build-module/components/sidebar/index.js +69 -36
  521. package/build-module/components/sidebar/index.js.map +1 -1
  522. package/build-module/components/sidebar-button/index.js +4 -4
  523. package/build-module/components/sidebar-button/index.js.map +1 -1
  524. package/build-module/components/sidebar-dataviews/add-new-view.js +58 -48
  525. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  526. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +108 -89
  527. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  528. package/build-module/components/sidebar-dataviews/dataview-item.js +15 -12
  529. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  530. package/build-module/components/sidebar-dataviews/default-views.js +49 -1
  531. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  532. package/build-module/components/sidebar-dataviews/index.js +23 -22
  533. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  534. package/build-module/components/sidebar-navigation-item/index.js +33 -28
  535. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  536. package/build-module/components/sidebar-navigation-screen/index.js +58 -70
  537. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  538. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +25 -17
  539. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  540. package/build-module/components/sidebar-navigation-screen-details-panel/index.js +10 -7
  541. package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
  542. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +5 -4
  543. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
  544. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +7 -7
  545. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  546. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +5 -4
  547. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
  548. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +59 -45
  549. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  550. package/build-module/components/sidebar-navigation-screen-main/index.js +47 -22
  551. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  552. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +5 -4
  553. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  554. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +20 -12
  555. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  556. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +63 -35
  557. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  558. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +10 -8
  559. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  560. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +43 -36
  561. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  562. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +19 -12
  563. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  564. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  565. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  566. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +36 -22
  567. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  568. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +50 -40
  569. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  570. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -9
  571. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  572. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +12 -10
  573. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  574. package/build-module/components/sidebar-navigation-screen-patterns/index.js +64 -77
  575. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  576. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +18 -17
  577. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  578. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +8 -5
  579. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  580. package/build-module/components/site-hub/index.js +85 -75
  581. package/build-module/components/site-hub/index.js.map +1 -1
  582. package/build-module/components/site-icon/index.js +9 -8
  583. package/build-module/components/site-icon/index.js.map +1 -1
  584. package/build-module/components/style-book/index.js +122 -102
  585. package/build-module/components/style-book/index.js.map +1 -1
  586. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -30
  587. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  588. package/build-module/components/table/index.js +24 -15
  589. package/build-module/components/table/index.js.map +1 -1
  590. package/build-module/components/template-part-converter/convert-to-regular.js +5 -4
  591. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  592. package/build-module/components/template-part-converter/convert-to-template-part.js +25 -16
  593. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  594. package/build-module/components/template-part-converter/index.js +30 -11
  595. package/build-module/components/template-part-converter/index.js.map +1 -1
  596. package/build-module/components/welcome-guide/editor.js +22 -15
  597. package/build-module/components/welcome-guide/editor.js.map +1 -1
  598. package/build-module/components/welcome-guide/image.js +14 -12
  599. package/build-module/components/welcome-guide/image.js.map +1 -1
  600. package/build-module/components/welcome-guide/index.js +6 -2
  601. package/build-module/components/welcome-guide/index.js.map +1 -1
  602. package/build-module/components/welcome-guide/page.js +20 -13
  603. package/build-module/components/welcome-guide/page.js.map +1 -1
  604. package/build-module/components/welcome-guide/styles.js +47 -28
  605. package/build-module/components/welcome-guide/styles.js.map +1 -1
  606. package/build-module/components/welcome-guide/template.js +20 -13
  607. package/build-module/components/welcome-guide/template.js.map +1 -1
  608. package/build-module/deprecated.js +4 -4
  609. package/build-module/deprecated.js.map +1 -1
  610. package/build-module/hooks/commands/use-common-commands.js +12 -23
  611. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  612. package/build-module/hooks/commands/use-edit-mode-commands.js +4 -118
  613. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  614. package/build-module/hooks/index.js +0 -1
  615. package/build-module/hooks/index.js.map +1 -1
  616. package/build-module/hooks/push-changes-to-global-styles/index.js +27 -16
  617. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  618. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +6 -2
  619. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  620. package/build-module/index.js +3 -3
  621. package/build-module/index.js.map +1 -1
  622. package/build-module/store/private-actions.js +7 -1
  623. package/build-module/store/private-actions.js.map +1 -1
  624. package/build-module/store/selectors.js +2 -2
  625. package/build-module/store/selectors.js.map +1 -1
  626. package/build-module/utils/template-part-create.js +0 -52
  627. package/build-module/utils/template-part-create.js.map +1 -1
  628. package/build-module/utils/use-activate-theme.js +9 -7
  629. package/build-module/utils/use-activate-theme.js.map +1 -1
  630. package/build-style/style-rtl.css +486 -981
  631. package/build-style/style.css +486 -981
  632. package/package.json +44 -47
  633. package/src/components/add-new-pattern/index.js +46 -37
  634. package/src/components/add-new-template/index.js +4 -2
  635. package/src/components/add-new-template/utils.js +77 -39
  636. package/src/components/app/index.js +5 -2
  637. package/src/components/block-editor/style.scss +4 -139
  638. package/src/components/block-editor/use-editor-iframe-props.js +79 -0
  639. package/src/components/canvas-loader/index.js +5 -2
  640. package/src/components/dataviews-actions/index.js +43 -0
  641. package/src/components/editor/index.js +129 -215
  642. package/src/components/editor/style.scss +2 -17
  643. package/src/components/editor-canvas-container/index.js +30 -35
  644. package/src/components/editor-canvas-container/style.scss +16 -0
  645. package/src/components/global-styles/background-panel.js +20 -4
  646. package/src/components/global-styles/color-indicator-wrapper.js +2 -2
  647. package/src/components/global-styles/color-palette-panel.js +3 -4
  648. package/src/components/global-styles/font-families.js +25 -18
  649. package/src/components/global-styles/font-family-item.js +2 -2
  650. package/src/components/global-styles/font-library-modal/collection-font-variant.js +2 -1
  651. package/src/components/global-styles/font-library-modal/context.js +6 -44
  652. package/src/components/global-styles/font-library-modal/font-collection.js +3 -5
  653. package/src/components/global-styles/font-library-modal/installed-fonts.js +42 -12
  654. package/src/components/global-styles/font-library-modal/library-font-variant.js +2 -1
  655. package/src/components/global-styles/font-library-modal/upload-fonts.js +1 -4
  656. package/src/components/global-styles/font-library-modal/utils/index.js +1 -1
  657. package/src/components/global-styles/gradients-palette-panel.js +1 -4
  658. package/src/components/global-styles/hooks.js +10 -36
  659. package/src/components/global-styles/icon-with-current-color.js +2 -2
  660. package/src/components/global-styles/palette.js +9 -18
  661. package/src/components/global-styles/preset-colors.js +18 -0
  662. package/src/components/global-styles/preview-colors.js +4 -7
  663. package/src/components/global-styles/root-menu.js +16 -12
  664. package/src/components/global-styles/screen-block.js +1 -1
  665. package/src/components/global-styles/screen-color-palette.js +4 -4
  666. package/src/components/global-styles/screen-colors.js +0 -2
  667. package/src/components/global-styles/screen-layout.js +9 -2
  668. package/src/components/global-styles/screen-revisions/index.js +6 -0
  669. package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  670. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -0
  671. package/src/components/global-styles/screen-shadows.js +13 -0
  672. package/src/components/global-styles/screen-typography.js +1 -1
  673. package/src/components/global-styles/shadow-utils.js +158 -0
  674. package/src/components/global-styles/shadows-edit-panel.js +555 -0
  675. package/src/components/global-styles/shadows-panel.js +147 -0
  676. package/src/components/global-styles/stories/index.story.js +2 -1
  677. package/src/components/global-styles/style-variations-container.js +73 -10
  678. package/src/components/global-styles/style.scss +54 -5
  679. package/src/components/global-styles/test/shadow-utils.spec.js +251 -0
  680. package/src/components/global-styles/test/utils.spec.js +59 -0
  681. package/src/components/global-styles/typography-example.js +2 -1
  682. package/src/components/global-styles/ui.js +15 -7
  683. package/src/components/global-styles/utils.js +27 -0
  684. package/src/components/global-styles/variations/style.scss +17 -30
  685. package/src/components/global-styles/variations/variation.js +15 -10
  686. package/src/components/global-styles/variations/variations-color.js +7 -9
  687. package/src/components/global-styles/variations/variations-panel.js +16 -5
  688. package/src/components/global-styles/variations/variations-typography.js +2 -1
  689. package/src/components/global-styles-renderer/index.js +7 -1
  690. package/src/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +7 -2
  691. package/src/components/{sidebar-edit-mode → global-styles-sidebar}/style.scss +0 -11
  692. package/src/components/layout/index.js +10 -10
  693. package/src/components/layout/router.js +96 -61
  694. package/src/components/layout/style.scss +10 -6
  695. package/src/components/{header-edit-mode/more-menu → more-menu}/index.js +1 -1
  696. package/src/components/page/header.js +17 -13
  697. package/src/components/page/index.js +3 -7
  698. package/src/components/page/style.scss +21 -7
  699. package/src/components/page-pages/index.js +162 -68
  700. package/src/components/page-pages/style.scss +14 -10
  701. package/src/components/page-patterns/delete-category-menu-item.js +1 -2
  702. package/src/components/page-patterns/header.js +45 -33
  703. package/src/components/page-patterns/index.js +25 -81
  704. package/src/components/page-patterns/style.scss +21 -14
  705. package/src/components/page-patterns/use-patterns.js +13 -6
  706. package/src/components/page-templates/index.js +10 -29
  707. package/src/components/pagination/index.js +2 -2
  708. package/src/components/resizable-frame/index.js +17 -5
  709. package/src/components/revisions/index.js +2 -1
  710. package/src/components/save-panel/index.js +5 -7
  711. package/src/components/sidebar/index.js +61 -37
  712. package/src/components/sidebar-button/index.js +2 -5
  713. package/src/components/sidebar-dataviews/add-new-view.js +5 -5
  714. package/src/components/sidebar-dataviews/custom-dataviews-list.js +5 -7
  715. package/src/components/sidebar-dataviews/dataview-item.js +6 -9
  716. package/src/components/sidebar-dataviews/default-views.js +61 -1
  717. package/src/components/sidebar-dataviews/index.js +4 -9
  718. package/src/components/sidebar-navigation-item/index.js +10 -10
  719. package/src/components/sidebar-navigation-screen/index.js +7 -31
  720. package/src/components/sidebar-navigation-screen/style.scss +11 -9
  721. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  722. package/src/components/sidebar-navigation-screen-global-styles/index.js +10 -3
  723. package/src/components/sidebar-navigation-screen-main/index.js +14 -4
  724. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +6 -1
  725. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +18 -1
  726. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  727. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  728. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +8 -4
  729. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +6 -13
  730. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -61
  731. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -3
  732. package/src/components/sidebar-navigation-screen-patterns/index.js +8 -29
  733. package/src/components/sidebar-navigation-screen-templates-browse/content.js +1 -1
  734. package/src/components/sidebar-navigation-screen-templates-browse/index.js +3 -2
  735. package/src/components/site-hub/index.js +14 -15
  736. package/src/components/site-hub/style.scss +46 -9
  737. package/src/components/site-icon/index.js +2 -2
  738. package/src/components/style-book/index.js +8 -7
  739. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +18 -23
  740. package/src/components/template-part-converter/convert-to-template-part.js +4 -1
  741. package/src/components/template-part-converter/index.js +16 -3
  742. package/src/hooks/commands/use-common-commands.js +12 -23
  743. package/src/hooks/commands/use-edit-mode-commands.js +4 -118
  744. package/src/hooks/index.js +0 -1
  745. package/src/hooks/push-changes-to-global-styles/index.js +2 -1
  746. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +7 -2
  747. package/src/index.js +1 -1
  748. package/src/store/private-actions.js +9 -1
  749. package/src/store/selectors.js +2 -2
  750. package/src/style.scss +1 -17
  751. package/src/utils/template-part-create.js +0 -67
  752. package/src/utils/use-activate-theme.js +5 -5
  753. package/build/components/block-editor/editor-canvas.js +0 -153
  754. package/build/components/block-editor/editor-canvas.js.map +0 -1
  755. package/build/components/block-editor/resizable-editor.js +0 -86
  756. package/build/components/block-editor/resizable-editor.js.map +0 -1
  757. package/build/components/block-editor/resize-handle.js +0 -57
  758. package/build/components/block-editor/resize-handle.js.map +0 -1
  759. package/build/components/block-editor/site-editor-canvas.js +0 -95
  760. package/build/components/block-editor/site-editor-canvas.js.map +0 -1
  761. package/build/components/code-editor/index.js +0 -111
  762. package/build/components/code-editor/index.js.map +0 -1
  763. package/build/components/create-template-part-modal/index.js +0 -151
  764. package/build/components/create-template-part-modal/index.js.map +0 -1
  765. package/build/components/global-styles/global-styles-provider.js +0 -129
  766. package/build/components/global-styles/global-styles-provider.js.map +0 -1
  767. package/build/components/header-edit-mode/document-tools/index.js +0 -68
  768. package/build/components/header-edit-mode/document-tools/index.js.map +0 -1
  769. package/build/components/header-edit-mode/index.js +0 -150
  770. package/build/components/header-edit-mode/index.js.map +0 -1
  771. package/build/components/header-edit-mode/more-menu/index.js.map +0 -1
  772. package/build/components/header-edit-mode/more-menu/site-export.js.map +0 -1
  773. package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +0 -1
  774. package/build/components/page-patterns/dataviews-pattern-actions.js +0 -387
  775. package/build/components/page-patterns/dataviews-pattern-actions.js.map +0 -1
  776. package/build/components/pattern-modal/duplicate.js +0 -70
  777. package/build/components/pattern-modal/duplicate.js.map +0 -1
  778. package/build/components/pattern-modal/index.js +0 -23
  779. package/build/components/pattern-modal/index.js.map +0 -1
  780. package/build/components/pattern-modal/rename.js +0 -45
  781. package/build/components/pattern-modal/rename.js.map +0 -1
  782. package/build/components/rename-post-menu-item/index.js +0 -109
  783. package/build/components/rename-post-menu-item/index.js.map +0 -1
  784. package/build/components/sidebar-edit-mode/default-sidebar.js +0 -52
  785. package/build/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
  786. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
  787. package/build/components/sidebar-edit-mode/index.js +0 -147
  788. package/build/components/sidebar-edit-mode/index.js.map +0 -1
  789. package/build/components/sidebar-edit-mode/page-panels/index.js +0 -129
  790. package/build/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
  791. package/build/components/sidebar-edit-mode/page-panels/page-content.js +0 -34
  792. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
  793. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +0 -46
  794. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
  795. package/build/components/sidebar-edit-mode/settings-header/index.js +0 -42
  796. package/build/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
  797. package/build/components/sidebar-edit-mode/template-panel/hooks.js +0 -86
  798. package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
  799. package/build/components/sidebar-edit-mode/template-panel/index.js +0 -127
  800. package/build/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
  801. package/build/components/sidebar-navigation-screen-page/index.js +0 -163
  802. package/build/components/sidebar-navigation-screen-page/index.js.map +0 -1
  803. package/build/components/sidebar-navigation-screen-page/page-details.js +0 -127
  804. package/build/components/sidebar-navigation-screen-page/page-details.js.map +0 -1
  805. package/build/components/sidebar-navigation-screen-page/status-label.js +0 -65
  806. package/build/components/sidebar-navigation-screen-page/status-label.js.map +0 -1
  807. package/build/components/sidebar-navigation-screen-pattern/index.js +0 -72
  808. package/build/components/sidebar-navigation-screen-pattern/index.js.map +0 -1
  809. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -38
  810. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +0 -1
  811. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -29
  812. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +0 -1
  813. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -37
  814. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +0 -1
  815. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -45
  816. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +0 -1
  817. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -88
  818. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +0 -1
  819. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -29
  820. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map +0 -1
  821. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -138
  822. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +0 -1
  823. package/build/components/sidebar-navigation-screen-template/home-template-details.js +0 -110
  824. package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +0 -1
  825. package/build/components/sidebar-navigation-screen-template/index.js +0 -118
  826. package/build/components/sidebar-navigation-screen-template/index.js.map +0 -1
  827. package/build/components/sidebar-navigation-screen-template/template-areas.js +0 -117
  828. package/build/components/sidebar-navigation-screen-template/template-areas.js.map +0 -1
  829. package/build/components/start-template-options/index.js +0 -191
  830. package/build/components/start-template-options/index.js.map +0 -1
  831. package/build/components/template-actions/index.js +0 -131
  832. package/build/components/template-actions/index.js.map +0 -1
  833. package/build/hooks/components.js +0 -10
  834. package/build/hooks/components.js.map +0 -1
  835. package/build/utils/get-is-list-page.js +0 -28
  836. package/build/utils/get-is-list-page.js.map +0 -1
  837. package/build/utils/math.js +0 -98
  838. package/build/utils/math.js.map +0 -1
  839. package/build-module/components/block-editor/editor-canvas.js +0 -145
  840. package/build-module/components/block-editor/editor-canvas.js.map +0 -1
  841. package/build-module/components/block-editor/resizable-editor.js +0 -79
  842. package/build-module/components/block-editor/resizable-editor.js.map +0 -1
  843. package/build-module/components/block-editor/resize-handle.js +0 -50
  844. package/build-module/components/block-editor/resize-handle.js.map +0 -1
  845. package/build-module/components/block-editor/site-editor-canvas.js +0 -86
  846. package/build-module/components/block-editor/site-editor-canvas.js.map +0 -1
  847. package/build-module/components/code-editor/index.js +0 -103
  848. package/build-module/components/code-editor/index.js.map +0 -1
  849. package/build-module/components/create-template-part-modal/index.js +0 -143
  850. package/build-module/components/create-template-part-modal/index.js.map +0 -1
  851. package/build-module/components/global-styles/global-styles-provider.js +0 -120
  852. package/build-module/components/global-styles/global-styles-provider.js.map +0 -1
  853. package/build-module/components/header-edit-mode/document-tools/index.js +0 -61
  854. package/build-module/components/header-edit-mode/document-tools/index.js.map +0 -1
  855. package/build-module/components/header-edit-mode/index.js +0 -142
  856. package/build-module/components/header-edit-mode/index.js.map +0 -1
  857. package/build-module/components/header-edit-mode/more-menu/index.js.map +0 -1
  858. package/build-module/components/header-edit-mode/more-menu/site-export.js.map +0 -1
  859. package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +0 -1
  860. package/build-module/components/page-patterns/dataviews-pattern-actions.js +0 -380
  861. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +0 -1
  862. package/build-module/components/pattern-modal/duplicate.js +0 -62
  863. package/build-module/components/pattern-modal/duplicate.js.map +0 -1
  864. package/build-module/components/pattern-modal/index.js +0 -14
  865. package/build-module/components/pattern-modal/index.js.map +0 -1
  866. package/build-module/components/pattern-modal/rename.js +0 -37
  867. package/build-module/components/pattern-modal/rename.js.map +0 -1
  868. package/build-module/components/rename-post-menu-item/index.js +0 -102
  869. package/build-module/components/rename-post-menu-item/index.js.map +0 -1
  870. package/build-module/components/sidebar-edit-mode/default-sidebar.js +0 -45
  871. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
  872. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
  873. package/build-module/components/sidebar-edit-mode/index.js +0 -138
  874. package/build-module/components/sidebar-edit-mode/index.js.map +0 -1
  875. package/build-module/components/sidebar-edit-mode/page-panels/index.js +0 -121
  876. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
  877. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +0 -27
  878. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
  879. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -39
  880. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
  881. package/build-module/components/sidebar-edit-mode/settings-header/index.js +0 -35
  882. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
  883. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +0 -79
  884. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
  885. package/build-module/components/sidebar-edit-mode/template-panel/index.js +0 -119
  886. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
  887. package/build-module/components/sidebar-navigation-screen-page/index.js +0 -155
  888. package/build-module/components/sidebar-navigation-screen-page/index.js.map +0 -1
  889. package/build-module/components/sidebar-navigation-screen-page/page-details.js +0 -120
  890. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +0 -1
  891. package/build-module/components/sidebar-navigation-screen-page/status-label.js +0 -57
  892. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +0 -1
  893. package/build-module/components/sidebar-navigation-screen-pattern/index.js +0 -64
  894. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +0 -1
  895. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -30
  896. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +0 -1
  897. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -20
  898. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +0 -1
  899. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -29
  900. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +0 -1
  901. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -36
  902. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +0 -1
  903. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -80
  904. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +0 -1
  905. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -22
  906. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map +0 -1
  907. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -130
  908. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +0 -1
  909. package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +0 -103
  910. package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +0 -1
  911. package/build-module/components/sidebar-navigation-screen-template/index.js +0 -110
  912. package/build-module/components/sidebar-navigation-screen-template/index.js.map +0 -1
  913. package/build-module/components/sidebar-navigation-screen-template/template-areas.js +0 -109
  914. package/build-module/components/sidebar-navigation-screen-template/template-areas.js.map +0 -1
  915. package/build-module/components/start-template-options/index.js +0 -184
  916. package/build-module/components/start-template-options/index.js.map +0 -1
  917. package/build-module/components/template-actions/index.js +0 -123
  918. package/build-module/components/template-actions/index.js.map +0 -1
  919. package/build-module/hooks/components.js +0 -7
  920. package/build-module/hooks/components.js.map +0 -1
  921. package/build-module/utils/get-is-list-page.js +0 -22
  922. package/build-module/utils/get-is-list-page.js.map +0 -1
  923. package/build-module/utils/math.js +0 -92
  924. package/build-module/utils/math.js.map +0 -1
  925. package/src/components/block-editor/editor-canvas.js +0 -178
  926. package/src/components/block-editor/resizable-editor.js +0 -82
  927. package/src/components/block-editor/resize-handle.js +0 -66
  928. package/src/components/block-editor/site-editor-canvas.js +0 -107
  929. package/src/components/code-editor/index.js +0 -94
  930. package/src/components/code-editor/style.scss +0 -95
  931. package/src/components/create-template-part-modal/index.js +0 -199
  932. package/src/components/create-template-part-modal/style.scss +0 -69
  933. package/src/components/global-styles/global-styles-provider.js +0 -162
  934. package/src/components/header-edit-mode/document-tools/index.js +0 -68
  935. package/src/components/header-edit-mode/index.js +0 -190
  936. package/src/components/header-edit-mode/style.scss +0 -201
  937. package/src/components/page-patterns/dataviews-pattern-actions.js +0 -439
  938. package/src/components/pattern-modal/duplicate.js +0 -55
  939. package/src/components/pattern-modal/index.js +0 -19
  940. package/src/components/pattern-modal/rename.js +0 -30
  941. package/src/components/rename-post-menu-item/index.js +0 -138
  942. package/src/components/sidebar-edit-mode/index.js +0 -173
  943. package/src/components/sidebar-edit-mode/page-panels/index.js +0 -133
  944. package/src/components/sidebar-edit-mode/page-panels/page-content.js +0 -29
  945. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +0 -61
  946. package/src/components/sidebar-edit-mode/settings-header/index.js +0 -43
  947. package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -14
  948. package/src/components/sidebar-edit-mode/template-panel/hooks.js +0 -114
  949. package/src/components/sidebar-edit-mode/template-panel/index.js +0 -134
  950. package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -16
  951. package/src/components/sidebar-navigation-screen-page/index.js +0 -204
  952. package/src/components/sidebar-navigation-screen-page/page-details.js +0 -161
  953. package/src/components/sidebar-navigation-screen-page/status-label.js +0 -71
  954. package/src/components/sidebar-navigation-screen-page/style.scss +0 -69
  955. package/src/components/sidebar-navigation-screen-pattern/index.js +0 -63
  956. package/src/components/sidebar-navigation-screen-pattern/style.scss +0 -26
  957. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -31
  958. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -21
  959. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -33
  960. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -36
  961. package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -98
  962. package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -32
  963. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -205
  964. package/src/components/sidebar-navigation-screen-template/home-template-details.js +0 -144
  965. package/src/components/sidebar-navigation-screen-template/index.js +0 -133
  966. package/src/components/sidebar-navigation-screen-template/style.scss +0 -53
  967. package/src/components/sidebar-navigation-screen-template/template-areas.js +0 -135
  968. package/src/components/start-template-options/index.js +0 -231
  969. package/src/components/start-template-options/style.scss +0 -55
  970. package/src/components/template-actions/index.js +0 -165
  971. package/src/hooks/components.js +0 -11
  972. package/src/utils/get-is-list-page.js +0 -25
  973. package/src/utils/math.js +0 -93
  974. package/src/utils/test/template-part-create.js +0 -63
  975. /package/src/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  976. /package/src/components/{header-edit-mode/more-menu → more-menu}/site-export.js +0 -0
  977. /package/src/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +0 -0
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = exports.FontLibraryContext = void 0;
8
- var _react = require("react");
9
8
  var _element = require("@wordpress/element");
10
9
  var _blockEditor = require("@wordpress/block-editor");
11
10
  var _data = require("@wordpress/data");
@@ -16,6 +15,7 @@ var _lockUnlock = require("../../../lock-unlock");
16
15
  var _utils = require("./utils");
17
16
  var _toggleFont = require("./utils/toggleFont");
18
17
  var _setNestedValue = _interopRequireDefault(require("../../../utils/set-nested-value"));
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
19
  /**
20
20
  * WordPress dependencies
21
21
  */
@@ -45,7 +45,6 @@ function FontLibraryProvider({
45
45
  };
46
46
  });
47
47
  const globalStyles = (0, _coreData.useEntityRecord)('root', 'globalStyles', globalStylesId);
48
- const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies;
49
48
  const [isInstalling, setIsInstalling] = (0, _element.useState)(false);
50
49
  const [refreshKey, setRefreshKey] = (0, _element.useState)(0);
51
50
  const [notice, setNotice] = (0, _element.useState)(null);
@@ -54,8 +53,7 @@ function FontLibraryProvider({
54
53
  };
55
54
  const {
56
55
  records: libraryPosts = [],
57
- isResolving: isResolvingLibrary,
58
- hasResolved: hasResolvedLibrary
56
+ isResolving: isResolvingLibrary
59
57
  } = (0, _coreData.useEntityRecords)('postType', 'wp_font_family', {
60
58
  refreshKey,
61
59
  _embed: true
@@ -70,8 +68,6 @@ function FontLibraryProvider({
70
68
 
71
69
  // Global Styles (settings) font families
72
70
  const [fontFamilies, setFontFamilies] = useGlobalSetting('typography.fontFamilies');
73
- // theme.json file font families
74
- const [baseFontFamilies] = useGlobalSetting('typography.fontFamilies', undefined, 'base');
75
71
 
76
72
  /*
77
73
  * Save the font families to the database.
@@ -102,18 +98,6 @@ function FontLibraryProvider({
102
98
  const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => (0, _utils.setUIValuesNeeded)(f, {
103
99
  source: 'theme'
104
100
  })).sort((a, b) => a.name.localeCompare(b.name)) : [];
105
- const themeFontsSlugs = new Set(themeFonts.map(f => f.slug));
106
-
107
- /*
108
- * Base Theme Fonts are the fonts defined in the theme.json *file*.
109
- *
110
- * Uses the fonts from global styles + the ones from the theme.json file that hasn't repeated slugs.
111
- * Avoids inconsistencies with the fonts listed in the font library modal as base (inactivated).
112
- * These inconsistencies can happen when the active theme fonts in global styles aren't defined in theme.json file as when a theme style variation is applied.
113
- */
114
- const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(baseFontFamilies.theme.filter(f => !themeFontsSlugs.has(f.slug)).map(f => (0, _utils.setUIValuesNeeded)(f, {
115
- source: 'theme'
116
- })).sort((a, b) => a.name.localeCompare(b.name))) : [];
117
101
  const customFonts = fontFamilies?.custom ? fontFamilies.custom.map(f => (0, _utils.setUIValuesNeeded)(f, {
118
102
  source: 'custom'
119
103
  })).sort((a, b) => a.name.localeCompare(b.name)) : [];
@@ -143,9 +127,6 @@ function FontLibraryProvider({
143
127
  source: font.source
144
128
  });
145
129
  };
146
- const toggleModal = tabName => {
147
- setModalTabOpen(tabName || null);
148
- };
149
130
 
150
131
  // Demo
151
132
  const [loadedFontUrls] = (0, _element.useState)(new Set());
@@ -393,14 +374,11 @@ function FontLibraryProvider({
393
374
  (0, _element.useEffect)(() => {
394
375
  getFontCollections();
395
376
  }, []);
396
- return (0, _react.createElement)(FontLibraryContext.Provider, {
377
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(FontLibraryContext.Provider, {
397
378
  value: {
398
379
  libraryFontSelected,
399
380
  handleSetLibraryFontSelected,
400
381
  fontFamilies,
401
- themeFonts,
402
- baseThemeFonts,
403
- customFonts,
404
382
  baseCustomFonts,
405
383
  isFontActivated,
406
384
  getFontFacesActivated,
@@ -410,19 +388,18 @@ function FontLibraryProvider({
410
388
  toggleActivateFont,
411
389
  getAvailableFontsOutline,
412
390
  modalTabOpen,
413
- toggleModal,
391
+ setModalTabOpen,
414
392
  refreshLibrary,
415
393
  notice,
416
394
  setNotice,
417
395
  saveFontFamilies,
418
- fontFamiliesHasChanges,
419
396
  isResolvingLibrary,
420
- hasResolvedLibrary,
421
397
  isInstalling,
422
398
  collections,
423
399
  getFontCollection
424
- }
425
- }, children);
400
+ },
401
+ children: children
402
+ });
426
403
  }
427
404
  var _default = exports.default = FontLibraryProvider;
428
405
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_blockEditor","_data","_coreData","_i18n","_resolvers","_lockUnlock","_utils","_toggleFont","_setNestedValue","_interopRequireDefault","useGlobalSetting","unlock","blockEditorPrivateApis","FontLibraryContext","exports","createContext","FontLibraryProvider","children","saveEntityRecord","useDispatch","coreStore","globalStylesId","useSelect","select","__experimentalGetCurrentGlobalStylesId","globalStyles","useEntityRecord","fontFamiliesHasChanges","edits","settings","typography","fontFamilies","isInstalling","setIsInstalling","useState","refreshKey","setRefreshKey","notice","setNotice","refreshLibrary","Date","now","records","libraryPosts","isResolving","isResolvingLibrary","hasResolved","hasResolvedLibrary","useEntityRecords","_embed","libraryFonts","map","fontFamilyPost","id","font_family_settings","fontFace","_embedded","font_faces","face","font_face_settings","setFontFamilies","baseFontFamilies","undefined","saveFontFamilies","fonts","updatedGlobalStyles","record","setNestedValue","modalTabOpen","setModalTabOpen","libraryFontSelected","setLibraryFontSelected","themeFonts","theme","f","setUIValuesNeeded","source","sort","a","b","name","localeCompare","themeFontsSlugs","Set","slug","baseThemeFonts","concat","filter","has","customFonts","custom","baseCustomFonts","useEffect","handleSetLibraryFontSelected","font","fontSelected","find","toggleModal","tabName","loadedFontUrls","getAvailableFontsOutline","availableFontFamilies","outline","reduce","acc","availableFontFaces","length","fontStyle","fontWeight","getActivatedFontsOutline","isFontActivated","style","weight","includes","getFontFacesActivated","installFonts","fontFamiliesToInstall","fontFamiliesToActivate","installationErrors","fontFamilyToInstall","isANewFontFamily","installedFontFamily","fetchGetFontFamilyBySlug","fetchInstallFontFamily","makeFontFamilyFormData","alreadyInstalledFontFaces","fontFaceToInstall","checkFontFaceInstalled","successfullyInstalledFontFaces","unsuccessfullyInstalledFontFaces","response","batchInstallFontFaces","makeFontFacesFormData","successes","errors","push","fetchUninstallFontFamily","unique","item","message","activeFonts","activateCustomFontFamilies","installError","Error","__","uninstallFontFamily","fontFamilyToUninstall","uninstalledFontFamily","deleted","deactivateFontFamily","error","console","_fontFamilies$font$so","initialCustomFonts","newCustomFonts","forEach","unloadFontFaceInBrowser","fontsToAdd","fontsToActivate","cleanFontsForSave","mergeFontFamilies","loadFontsInBrowser","_familyDbId","_faceDbId","loadFontFaceInBrowser","getDisplaySrcFromFontFace","src","toggleActivateFont","_fontFamilies$font$so2","initialFonts","newFonts","toggleFont","isFaceActivated","loadFontFaceAsset","add","collections","setFontCollections","getFontCollections","fetchFontCollections","getFontCollection","hasData","collection","font_families","fetchFontCollection","updatedCollections","e","_react","createElement","Provider","value","_default","default"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useState, useEffect } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseEntityRecord,\n\tuseEntityRecords,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tfetchGetFontFamilyBySlug,\n\tfetchInstallFontFamily,\n\tfetchUninstallFontFamily,\n\tfetchFontCollections,\n\tfetchFontCollection,\n} from './resolvers';\nimport { unlock } from '../../../lock-unlock';\nconst { useGlobalSetting } = unlock( blockEditorPrivateApis );\nimport {\n\tsetUIValuesNeeded,\n\tmergeFontFamilies,\n\tloadFontFaceInBrowser,\n\tunloadFontFaceInBrowser,\n\tgetDisplaySrcFromFontFace,\n\tmakeFontFacesFormData,\n\tmakeFontFamilyFormData,\n\tbatchInstallFontFaces,\n\tcheckFontFaceInstalled,\n} from './utils';\nimport { toggleFont } from './utils/toggleFont';\nimport setNestedValue from '../../../utils/set-nested-value';\n\nexport const FontLibraryContext = createContext( {} );\n\nfunction FontLibraryProvider( { children } ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { globalStylesId } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetCurrentGlobalStylesId } = select( coreStore );\n\t\treturn { globalStylesId: __experimentalGetCurrentGlobalStylesId() };\n\t} );\n\n\tconst globalStyles = useEntityRecord(\n\t\t'root',\n\t\t'globalStyles',\n\t\tglobalStylesId\n\t);\n\tconst fontFamiliesHasChanges =\n\t\t!! globalStyles?.edits?.settings?.typography?.fontFamilies;\n\n\tconst [ isInstalling, setIsInstalling ] = useState( false );\n\tconst [ refreshKey, setRefreshKey ] = useState( 0 );\n\tconst [ notice, setNotice ] = useState( null );\n\n\tconst refreshLibrary = () => {\n\t\tsetRefreshKey( Date.now() );\n\t};\n\n\tconst {\n\t\trecords: libraryPosts = [],\n\t\tisResolving: isResolvingLibrary,\n\t\thasResolved: hasResolvedLibrary,\n\t} = useEntityRecords( 'postType', 'wp_font_family', {\n\t\trefreshKey,\n\t\t_embed: true,\n\t} );\n\n\tconst libraryFonts =\n\t\t( libraryPosts || [] ).map( ( fontFamilyPost ) => {\n\t\t\treturn {\n\t\t\t\tid: fontFamilyPost.id,\n\t\t\t\t...fontFamilyPost.font_family_settings,\n\t\t\t\tfontFace:\n\t\t\t\t\tfontFamilyPost?._embedded?.font_faces.map(\n\t\t\t\t\t\t( face ) => face.font_face_settings\n\t\t\t\t\t) || [],\n\t\t\t};\n\t\t} ) || [];\n\n\t// Global Styles (settings) font families\n\tconst [ fontFamilies, setFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies'\n\t);\n\t// theme.json file font families\n\tconst [ baseFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies',\n\t\tundefined,\n\t\t'base'\n\t);\n\n\t/*\n\t * Save the font families to the database.\n\n\t * This function is called when the user activates or deactivates a font family.\n\t * It only updates the global styles post content in the database for new font families.\n\t * This avoids saving other styles/settings changed by the user using other parts of the editor.\n\t *\n\t * It uses the font families from the param to avoid using the font families from an outdated state.\n\t *\n\t * @param {Array} fonts - The font families that will be saved to the database.\n\t */\n\tconst saveFontFamilies = async ( fonts ) => {\n\t\t// Gets the global styles database post content.\n\t\tconst updatedGlobalStyles = globalStyles.record;\n\n\t\t// Updates the database version of global styles with the edited font families in the client.\n\t\tsetNestedValue(\n\t\t\tupdatedGlobalStyles,\n\t\t\t[ 'settings', 'typography', 'fontFamilies' ],\n\t\t\tfonts\n\t\t);\n\n\t\t// Saves a new version of the global styles in the database.\n\t\tawait saveEntityRecord( 'root', 'globalStyles', updatedGlobalStyles );\n\t};\n\n\t// Library Fonts\n\tconst [ modalTabOpen, setModalTabOpen ] = useState( false );\n\tconst [ libraryFontSelected, setLibraryFontSelected ] = useState( null );\n\n\t// Themes Fonts are the fonts defined in the global styles (database persisted theme.json data).\n\tconst themeFonts = fontFamilies?.theme\n\t\t? fontFamilies.theme\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst themeFontsSlugs = new Set( themeFonts.map( ( f ) => f.slug ) );\n\n\t/*\n\t * Base Theme Fonts are the fonts defined in the theme.json *file*.\n\t *\n\t * Uses the fonts from global styles + the ones from the theme.json file that hasn't repeated slugs.\n\t * Avoids inconsistencies with the fonts listed in the font library modal as base (inactivated).\n\t * These inconsistencies can happen when the active theme fonts in global styles aren't defined in theme.json file as when a theme style variation is applied.\n\t */\n\tconst baseThemeFonts = baseFontFamilies?.theme\n\t\t? themeFonts.concat(\n\t\t\t\tbaseFontFamilies.theme\n\t\t\t\t\t.filter( ( f ) => ! themeFontsSlugs.has( f.slug ) )\n\t\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t )\n\t\t: [];\n\n\tconst customFonts = fontFamilies?.custom\n\t\t? fontFamilies.custom\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst baseCustomFonts = libraryFonts\n\t\t? libraryFonts\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tuseEffect( () => {\n\t\tif ( ! modalTabOpen ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t}\n\t}, [ modalTabOpen ] );\n\n\tconst handleSetLibraryFontSelected = ( font ) => {\n\t\tsetNotice( null );\n\n\t\t// If font is null, reset the selected font\n\t\tif ( ! font ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst fonts = font.source === 'theme' ? themeFonts : baseCustomFonts;\n\n\t\t// Tries to find the font in the installed fonts\n\t\tconst fontSelected = fonts.find( ( f ) => f.slug === font.slug );\n\t\t// If the font is not found (it is only defined in custom styles), use the font from custom styles\n\t\tsetLibraryFontSelected( {\n\t\t\t...( fontSelected || font ),\n\t\t\tsource: font.source,\n\t\t} );\n\t};\n\n\tconst toggleModal = ( tabName ) => {\n\t\tsetModalTabOpen( tabName || null );\n\t};\n\n\t// Demo\n\tconst [ loadedFontUrls ] = useState( new Set() );\n\n\tconst getAvailableFontsOutline = ( availableFontFamilies ) => {\n\t\tconst outline = availableFontFamilies.reduce( ( acc, font ) => {\n\t\t\tconst availableFontFaces =\n\t\t\t\tfont?.fontFace && font.fontFace?.length > 0\n\t\t\t\t\t? font?.fontFace.map(\n\t\t\t\t\t\t\t( face ) => `${ face.fontStyle + face.fontWeight }`\n\t\t\t\t\t )\n\t\t\t\t\t: [ 'normal400' ]; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400\n\n\t\t\tacc[ font.slug ] = availableFontFaces;\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn outline;\n\t};\n\n\tconst getActivatedFontsOutline = ( source ) => {\n\t\tswitch ( source ) {\n\t\t\tcase 'theme':\n\t\t\t\treturn getAvailableFontsOutline( themeFonts );\n\t\t\tcase 'custom':\n\t\t\tdefault:\n\t\t\t\treturn getAvailableFontsOutline( customFonts );\n\t\t}\n\t};\n\n\tconst isFontActivated = ( slug, style, weight, source ) => {\n\t\tif ( ! style && ! weight ) {\n\t\t\treturn !! getActivatedFontsOutline( source )[ slug ];\n\t\t}\n\t\treturn !! getActivatedFontsOutline( source )[ slug ]?.includes(\n\t\t\tstyle + weight\n\t\t);\n\t};\n\n\tconst getFontFacesActivated = ( slug, source ) => {\n\t\treturn getActivatedFontsOutline( source )[ slug ] || [];\n\t};\n\n\tasync function installFonts( fontFamiliesToInstall ) {\n\t\tsetIsInstalling( true );\n\t\ttry {\n\t\t\tconst fontFamiliesToActivate = [];\n\t\t\tlet installationErrors = [];\n\n\t\t\tfor ( const fontFamilyToInstall of fontFamiliesToInstall ) {\n\t\t\t\tlet isANewFontFamily = false;\n\n\t\t\t\t// Get the font family if it already exists.\n\t\t\t\tlet installedFontFamily = await fetchGetFontFamilyBySlug(\n\t\t\t\t\tfontFamilyToInstall.slug\n\t\t\t\t);\n\n\t\t\t\t// Otherwise create it.\n\t\t\t\tif ( ! installedFontFamily ) {\n\t\t\t\t\tisANewFontFamily = true;\n\t\t\t\t\t// Prepare font family form data to install.\n\t\t\t\t\tinstalledFontFamily = await fetchInstallFontFamily(\n\t\t\t\t\t\tmakeFontFamilyFormData( fontFamilyToInstall )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Collect font faces that have already been installed (to be activated later)\n\t\t\t\tconst alreadyInstalledFontFaces =\n\t\t\t\t\tinstalledFontFamily.fontFace && fontFamilyToInstall.fontFace\n\t\t\t\t\t\t? installedFontFamily.fontFace.filter(\n\t\t\t\t\t\t\t\t( fontFaceToInstall ) =>\n\t\t\t\t\t\t\t\t\tcheckFontFaceInstalled(\n\t\t\t\t\t\t\t\t\t\tfontFaceToInstall,\n\t\t\t\t\t\t\t\t\t\tfontFamilyToInstall.fontFace\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: [];\n\n\t\t\t\t// Filter out Font Faces that have already been installed (so that they are not re-installed)\n\t\t\t\tif (\n\t\t\t\t\tinstalledFontFamily.fontFace &&\n\t\t\t\t\tfontFamilyToInstall.fontFace\n\t\t\t\t) {\n\t\t\t\t\tfontFamilyToInstall.fontFace =\n\t\t\t\t\t\tfontFamilyToInstall.fontFace.filter(\n\t\t\t\t\t\t\t( fontFaceToInstall ) =>\n\t\t\t\t\t\t\t\t! checkFontFaceInstalled(\n\t\t\t\t\t\t\t\t\tfontFaceToInstall,\n\t\t\t\t\t\t\t\t\tinstalledFontFamily.fontFace\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Install the fonts (upload the font files to the server and create the post in the database).\n\t\t\t\tlet successfullyInstalledFontFaces = [];\n\t\t\t\tlet unsuccessfullyInstalledFontFaces = [];\n\t\t\t\tif ( fontFamilyToInstall?.fontFace?.length > 0 ) {\n\t\t\t\t\tconst response = await batchInstallFontFaces(\n\t\t\t\t\t\tinstalledFontFamily.id,\n\t\t\t\t\t\tmakeFontFacesFormData( fontFamilyToInstall )\n\t\t\t\t\t);\n\t\t\t\t\tsuccessfullyInstalledFontFaces = response?.successes;\n\t\t\t\t\tunsuccessfullyInstalledFontFaces = response?.errors;\n\t\t\t\t}\n\n\t\t\t\t// Use the successfully installed font faces\n\t\t\t\t// As well as any font faces that were already installed (those will be activated)\n\t\t\t\tif (\n\t\t\t\t\tsuccessfullyInstalledFontFaces?.length > 0 ||\n\t\t\t\t\talreadyInstalledFontFaces?.length > 0\n\t\t\t\t) {\n\t\t\t\t\t// Use font data from REST API not from client to ensure\n\t\t\t\t\t// correct font information is used.\n\t\t\t\t\tinstalledFontFamily.fontFace = [\n\t\t\t\t\t\t...successfullyInstalledFontFaces,\n\t\t\t\t\t];\n\n\t\t\t\t\tfontFamiliesToActivate.push( installedFontFamily );\n\t\t\t\t}\n\n\t\t\t\t// If it's a system font but was installed successfully, activate it.\n\t\t\t\tif (\n\t\t\t\t\tinstalledFontFamily &&\n\t\t\t\t\t! fontFamilyToInstall?.fontFace?.length\n\t\t\t\t) {\n\t\t\t\t\tfontFamiliesToActivate.push( installedFontFamily );\n\t\t\t\t}\n\n\t\t\t\t// If the font family is new and is not a system font, delete it to avoid having font families without font faces.\n\t\t\t\tif (\n\t\t\t\t\tisANewFontFamily &&\n\t\t\t\t\tfontFamilyToInstall?.fontFace?.length > 0 &&\n\t\t\t\t\tsuccessfullyInstalledFontFaces?.length === 0\n\t\t\t\t) {\n\t\t\t\t\tawait fetchUninstallFontFamily( installedFontFamily.id );\n\t\t\t\t}\n\n\t\t\t\tinstallationErrors = installationErrors.concat(\n\t\t\t\t\tunsuccessfullyInstalledFontFaces\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tinstallationErrors = installationErrors.reduce(\n\t\t\t\t( unique, item ) =>\n\t\t\t\t\tunique.includes( item.message )\n\t\t\t\t\t\t? unique\n\t\t\t\t\t\t: [ ...unique, item.message ],\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\tif ( fontFamiliesToActivate.length > 0 ) {\n\t\t\t\t// Activate the font family (add the font family to the global styles).\n\t\t\t\tconst activeFonts = activateCustomFontFamilies(\n\t\t\t\t\tfontFamiliesToActivate\n\t\t\t\t);\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveFontFamilies( activeFonts );\n\n\t\t\t\trefreshLibrary();\n\t\t\t}\n\n\t\t\tif ( installationErrors.length > 0 ) {\n\t\t\t\tconst installError = new Error(\n\t\t\t\t\t__( 'There was an error installing fonts.' )\n\t\t\t\t);\n\n\t\t\t\tinstallError.installationErrors = installationErrors;\n\n\t\t\t\tthrow installError;\n\t\t\t}\n\t\t} finally {\n\t\t\tsetIsInstalling( false );\n\t\t}\n\t}\n\n\tasync function uninstallFontFamily( fontFamilyToUninstall ) {\n\t\ttry {\n\t\t\t// Uninstall the font family.\n\t\t\t// (Removes the font files from the server and the posts from the database).\n\t\t\tconst uninstalledFontFamily = await fetchUninstallFontFamily(\n\t\t\t\tfontFamilyToUninstall.id\n\t\t\t);\n\n\t\t\t// Deactivate the font family if delete request is successful\n\t\t\t// (Removes the font family from the global styles).\n\t\t\tif ( uninstalledFontFamily.deleted ) {\n\t\t\t\tconst activeFonts = deactivateFontFamily(\n\t\t\t\t\tfontFamilyToUninstall\n\t\t\t\t);\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveFontFamilies( activeFonts );\n\t\t\t}\n\n\t\t\t// Refresh the library (the library font families from database).\n\t\t\trefreshLibrary();\n\n\t\t\treturn uninstalledFontFamily;\n\t\t} catch ( error ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t`There was an error uninstalling the font family:`,\n\t\t\t\terror\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tconst deactivateFontFamily = ( font ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialCustomFonts = fontFamilies?.[ font.source ] ?? [];\n\t\tconst newCustomFonts = initialCustomFonts.filter(\n\t\t\t( f ) => f.slug !== font.slug\n\t\t);\n\t\tconst activeFonts = {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newCustomFonts,\n\t\t};\n\t\tsetFontFamilies( activeFonts );\n\n\t\tif ( font.fontFace ) {\n\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\tunloadFontFaceInBrowser( face, 'all' );\n\t\t\t} );\n\t\t}\n\t\treturn activeFonts;\n\t};\n\n\tconst activateCustomFontFamilies = ( fontsToAdd ) => {\n\t\tconst fontsToActivate = cleanFontsForSave( fontsToAdd );\n\n\t\tconst activeFonts = {\n\t\t\t...fontFamilies,\n\t\t\t// Merge the existing custom fonts with the new fonts.\n\t\t\tcustom: mergeFontFamilies( fontFamilies?.custom, fontsToActivate ),\n\t\t};\n\n\t\t// Activate the fonts by set the new custom fonts array.\n\t\tsetFontFamilies( activeFonts );\n\n\t\tloadFontsInBrowser( fontsToActivate );\n\n\t\treturn activeFonts;\n\t};\n\n\t// Removes the id from the families and faces to avoid saving that to global styles post content.\n\tconst cleanFontsForSave = ( fonts ) => {\n\t\treturn fonts.map( ( { id: _familyDbId, fontFace, ...font } ) => ( {\n\t\t\t...font,\n\t\t\t...( fontFace && fontFace.length > 0\n\t\t\t\t? {\n\t\t\t\t\t\tfontFace: fontFace.map(\n\t\t\t\t\t\t\t( { id: _faceDbId, ...face } ) => face\n\t\t\t\t\t\t),\n\t\t\t\t }\n\t\t\t\t: {} ),\n\t\t} ) );\n\t};\n\n\tconst loadFontsInBrowser = ( fonts ) => {\n\t\t// Add custom fonts to the browser.\n\t\tfonts.forEach( ( font ) => {\n\t\t\tif ( font.fontFace ) {\n\t\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\t\t// Load font faces just in the iframe because they already are in the document.\n\t\t\t\t\tloadFontFaceInBrowser(\n\t\t\t\t\t\tface,\n\t\t\t\t\t\tgetDisplaySrcFromFontFace( face.src ),\n\t\t\t\t\t\t'all'\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst toggleActivateFont = ( font, face ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialFonts = fontFamilies?.[ font.source ] ?? [];\n\t\t// Toggles the received font family or font face\n\t\tconst newFonts = toggleFont( font, face, initialFonts );\n\t\t// Updates the font families activated in global settings:\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newFonts,\n\t\t} );\n\n\t\tconst isFaceActivated = isFontActivated(\n\t\t\tfont.slug,\n\t\t\tface?.fontStyle,\n\t\t\tface?.fontWeight,\n\t\t\tfont.source\n\t\t);\n\n\t\tif ( isFaceActivated ) {\n\t\t\tloadFontFaceInBrowser(\n\t\t\t\tface,\n\t\t\t\tgetDisplaySrcFromFontFace( face?.src ),\n\t\t\t\t'all'\n\t\t\t);\n\t\t} else {\n\t\t\tunloadFontFaceInBrowser( face, 'all' );\n\t\t}\n\t};\n\n\tconst loadFontFaceAsset = async ( fontFace ) => {\n\t\t// If the font doesn't have a src, don't load it.\n\t\tif ( ! fontFace.src ) {\n\t\t\treturn;\n\t\t}\n\t\t// Get the src of the font.\n\t\tconst src = getDisplaySrcFromFontFace( fontFace.src );\n\t\t// If the font is already loaded, don't load it again.\n\t\tif ( ! src || loadedFontUrls.has( src ) ) {\n\t\t\treturn;\n\t\t}\n\t\t// Load the font in the browser.\n\t\tloadFontFaceInBrowser( fontFace, src, 'document' );\n\t\t// Add the font to the loaded fonts list.\n\t\tloadedFontUrls.add( src );\n\t};\n\n\t// Font Collections\n\tconst [ collections, setFontCollections ] = useState( [] );\n\tconst getFontCollections = async () => {\n\t\tconst response = await fetchFontCollections();\n\t\tsetFontCollections( response );\n\t};\n\tconst getFontCollection = async ( slug ) => {\n\t\ttry {\n\t\t\tconst hasData = !! collections.find(\n\t\t\t\t( collection ) => collection.slug === slug\n\t\t\t)?.font_families;\n\t\t\tif ( hasData ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst response = await fetchFontCollection( slug );\n\t\t\tconst updatedCollections = collections.map( ( collection ) =>\n\t\t\t\tcollection.slug === slug\n\t\t\t\t\t? { ...collection, ...response }\n\t\t\t\t\t: collection\n\t\t\t);\n\t\t\tsetFontCollections( updatedCollections );\n\t\t} catch ( e ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( e );\n\t\t\tthrow e;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tgetFontCollections();\n\t}, [] );\n\n\treturn (\n\t\t<FontLibraryContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tlibraryFontSelected,\n\t\t\t\thandleSetLibraryFontSelected,\n\t\t\t\tfontFamilies,\n\t\t\t\tthemeFonts,\n\t\t\t\tbaseThemeFonts,\n\t\t\t\tcustomFonts,\n\t\t\t\tbaseCustomFonts,\n\t\t\t\tisFontActivated,\n\t\t\t\tgetFontFacesActivated,\n\t\t\t\tloadFontFaceAsset,\n\t\t\t\tinstallFonts,\n\t\t\t\tuninstallFontFamily,\n\t\t\t\ttoggleActivateFont,\n\t\t\t\tgetAvailableFontsOutline,\n\t\t\t\tmodalTabOpen,\n\t\t\t\ttoggleModal,\n\t\t\t\trefreshLibrary,\n\t\t\t\tnotice,\n\t\t\t\tsetNotice,\n\t\t\t\tsaveFontFamilies,\n\t\t\t\tfontFamiliesHasChanges,\n\t\t\t\tisResolvingLibrary,\n\t\t\t\thasResolvedLibrary,\n\t\t\t\tisInstalling,\n\t\t\t\tcollections,\n\t\t\t\tgetFontCollection,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</FontLibraryContext.Provider>\n\t);\n}\n\nexport default FontLibraryProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,K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3BC,KAAK,EAAG;MACPvH,mBAAmB;MACnBuB,4BAA4B;MAC5B9D,YAAY;MACZyC,UAAU;MACVa,cAAc;MACdI,WAAW;MACXE,eAAe;MACfmB,eAAe;MACfI,qBAAqB;MACrB2D,iBAAiB;MACjB1D,YAAY;MACZ8B,mBAAmB;MACnBsB,kBAAkB;MAClBnE,wBAAwB;MACxBhC,YAAY;MACZ6B,WAAW;MACX1D,cAAc;MACdF,MAAM;MACNC,SAAS;MACTyB,gBAAgB;MAChBpC,sBAAsB;MACtBkB,kBAAkB;MAClBE,kBAAkB;MAClBf,YAAY;MACZ+I,WAAW;MACXI;IACD;EAAG,GAEDlK,QAC0B,CAAC;AAEhC;AAAC,IAAA6K,QAAA,GAAAhL,OAAA,CAAAiL,OAAA,GAEc/K,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_blockEditor","_data","_coreData","_i18n","_resolvers","_lockUnlock","_utils","_toggleFont","_setNestedValue","_interopRequireDefault","_jsxRuntime","useGlobalSetting","unlock","blockEditorPrivateApis","FontLibraryContext","exports","createContext","FontLibraryProvider","children","saveEntityRecord","useDispatch","coreStore","globalStylesId","useSelect","select","__experimentalGetCurrentGlobalStylesId","globalStyles","useEntityRecord","isInstalling","setIsInstalling","useState","refreshKey","setRefreshKey","notice","setNotice","refreshLibrary","Date","now","records","libraryPosts","isResolving","isResolvingLibrary","useEntityRecords","_embed","libraryFonts","map","fontFamilyPost","id","font_family_settings","fontFace","_embedded","font_faces","face","font_face_settings","fontFamilies","setFontFamilies","saveFontFamilies","fonts","updatedGlobalStyles","record","setNestedValue","modalTabOpen","setModalTabOpen","libraryFontSelected","setLibraryFontSelected","themeFonts","theme","f","setUIValuesNeeded","source","sort","a","b","name","localeCompare","customFonts","custom","baseCustomFonts","useEffect","handleSetLibraryFontSelected","font","fontSelected","find","slug","loadedFontUrls","Set","getAvailableFontsOutline","availableFontFamilies","outline","reduce","acc","availableFontFaces","length","fontStyle","fontWeight","getActivatedFontsOutline","isFontActivated","style","weight","includes","getFontFacesActivated","installFonts","fontFamiliesToInstall","fontFamiliesToActivate","installationErrors","fontFamilyToInstall","isANewFontFamily","installedFontFamily","fetchGetFontFamilyBySlug","fetchInstallFontFamily","makeFontFamilyFormData","alreadyInstalledFontFaces","filter","fontFaceToInstall","checkFontFaceInstalled","successfullyInstalledFontFaces","unsuccessfullyInstalledFontFaces","response","batchInstallFontFaces","makeFontFacesFormData","successes","errors","push","fetchUninstallFontFamily","concat","unique","item","message","activeFonts","activateCustomFontFamilies","installError","Error","__","uninstallFontFamily","fontFamilyToUninstall","uninstalledFontFamily","deleted","deactivateFontFamily","error","console","_fontFamilies$font$so","initialCustomFonts","newCustomFonts","forEach","unloadFontFaceInBrowser","fontsToAdd","fontsToActivate","cleanFontsForSave","mergeFontFamilies","loadFontsInBrowser","_familyDbId","_faceDbId","loadFontFaceInBrowser","getDisplaySrcFromFontFace","src","toggleActivateFont","_fontFamilies$font$so2","initialFonts","newFonts","toggleFont","isFaceActivated","loadFontFaceAsset","has","add","collections","setFontCollections","getFontCollections","fetchFontCollections","getFontCollection","hasData","collection","font_families","fetchFontCollection","updatedCollections","e","jsx","Provider","value","_default","default"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useState, useEffect } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseEntityRecord,\n\tuseEntityRecords,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tfetchGetFontFamilyBySlug,\n\tfetchInstallFontFamily,\n\tfetchUninstallFontFamily,\n\tfetchFontCollections,\n\tfetchFontCollection,\n} from './resolvers';\nimport { unlock } from '../../../lock-unlock';\nconst { useGlobalSetting } = unlock( blockEditorPrivateApis );\nimport {\n\tsetUIValuesNeeded,\n\tmergeFontFamilies,\n\tloadFontFaceInBrowser,\n\tunloadFontFaceInBrowser,\n\tgetDisplaySrcFromFontFace,\n\tmakeFontFacesFormData,\n\tmakeFontFamilyFormData,\n\tbatchInstallFontFaces,\n\tcheckFontFaceInstalled,\n} from './utils';\nimport { toggleFont } from './utils/toggleFont';\nimport setNestedValue from '../../../utils/set-nested-value';\n\nexport const FontLibraryContext = createContext( {} );\n\nfunction FontLibraryProvider( { children } ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { globalStylesId } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetCurrentGlobalStylesId } = select( coreStore );\n\t\treturn { globalStylesId: __experimentalGetCurrentGlobalStylesId() };\n\t} );\n\n\tconst globalStyles = useEntityRecord(\n\t\t'root',\n\t\t'globalStyles',\n\t\tglobalStylesId\n\t);\n\n\tconst [ isInstalling, setIsInstalling ] = useState( false );\n\tconst [ refreshKey, setRefreshKey ] = useState( 0 );\n\tconst [ notice, setNotice ] = useState( null );\n\n\tconst refreshLibrary = () => {\n\t\tsetRefreshKey( Date.now() );\n\t};\n\n\tconst { records: libraryPosts = [], isResolving: isResolvingLibrary } =\n\t\tuseEntityRecords( 'postType', 'wp_font_family', {\n\t\t\trefreshKey,\n\t\t\t_embed: true,\n\t\t} );\n\n\tconst libraryFonts =\n\t\t( libraryPosts || [] ).map( ( fontFamilyPost ) => {\n\t\t\treturn {\n\t\t\t\tid: fontFamilyPost.id,\n\t\t\t\t...fontFamilyPost.font_family_settings,\n\t\t\t\tfontFace:\n\t\t\t\t\tfontFamilyPost?._embedded?.font_faces.map(\n\t\t\t\t\t\t( face ) => face.font_face_settings\n\t\t\t\t\t) || [],\n\t\t\t};\n\t\t} ) || [];\n\n\t// Global Styles (settings) font families\n\tconst [ fontFamilies, setFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies'\n\t);\n\n\t/*\n\t * Save the font families to the database.\n\n\t * This function is called when the user activates or deactivates a font family.\n\t * It only updates the global styles post content in the database for new font families.\n\t * This avoids saving other styles/settings changed by the user using other parts of the editor.\n\t *\n\t * It uses the font families from the param to avoid using the font families from an outdated state.\n\t *\n\t * @param {Array} fonts - The font families that will be saved to the database.\n\t */\n\tconst saveFontFamilies = async ( fonts ) => {\n\t\t// Gets the global styles database post content.\n\t\tconst updatedGlobalStyles = globalStyles.record;\n\n\t\t// Updates the database version of global styles with the edited font families in the client.\n\t\tsetNestedValue(\n\t\t\tupdatedGlobalStyles,\n\t\t\t[ 'settings', 'typography', 'fontFamilies' ],\n\t\t\tfonts\n\t\t);\n\n\t\t// Saves a new version of the global styles in the database.\n\t\tawait saveEntityRecord( 'root', 'globalStyles', updatedGlobalStyles );\n\t};\n\n\t// Library Fonts\n\tconst [ modalTabOpen, setModalTabOpen ] = useState( false );\n\tconst [ libraryFontSelected, setLibraryFontSelected ] = useState( null );\n\n\t// Themes Fonts are the fonts defined in the global styles (database persisted theme.json data).\n\tconst themeFonts = fontFamilies?.theme\n\t\t? fontFamilies.theme\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst customFonts = fontFamilies?.custom\n\t\t? fontFamilies.custom\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst baseCustomFonts = libraryFonts\n\t\t? libraryFonts\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tuseEffect( () => {\n\t\tif ( ! modalTabOpen ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t}\n\t}, [ modalTabOpen ] );\n\n\tconst handleSetLibraryFontSelected = ( font ) => {\n\t\tsetNotice( null );\n\n\t\t// If font is null, reset the selected font\n\t\tif ( ! font ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst fonts = font.source === 'theme' ? themeFonts : baseCustomFonts;\n\n\t\t// Tries to find the font in the installed fonts\n\t\tconst fontSelected = fonts.find( ( f ) => f.slug === font.slug );\n\t\t// If the font is not found (it is only defined in custom styles), use the font from custom styles\n\t\tsetLibraryFontSelected( {\n\t\t\t...( fontSelected || font ),\n\t\t\tsource: font.source,\n\t\t} );\n\t};\n\n\t// Demo\n\tconst [ loadedFontUrls ] = useState( new Set() );\n\n\tconst getAvailableFontsOutline = ( availableFontFamilies ) => {\n\t\tconst outline = availableFontFamilies.reduce( ( acc, font ) => {\n\t\t\tconst availableFontFaces =\n\t\t\t\tfont?.fontFace && font.fontFace?.length > 0\n\t\t\t\t\t? font?.fontFace.map(\n\t\t\t\t\t\t\t( face ) => `${ face.fontStyle + face.fontWeight }`\n\t\t\t\t\t )\n\t\t\t\t\t: [ 'normal400' ]; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400\n\n\t\t\tacc[ font.slug ] = availableFontFaces;\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn outline;\n\t};\n\n\tconst getActivatedFontsOutline = ( source ) => {\n\t\tswitch ( source ) {\n\t\t\tcase 'theme':\n\t\t\t\treturn getAvailableFontsOutline( themeFonts );\n\t\t\tcase 'custom':\n\t\t\tdefault:\n\t\t\t\treturn getAvailableFontsOutline( customFonts );\n\t\t}\n\t};\n\n\tconst isFontActivated = ( slug, style, weight, source ) => {\n\t\tif ( ! style && ! weight ) {\n\t\t\treturn !! getActivatedFontsOutline( source )[ slug ];\n\t\t}\n\t\treturn !! getActivatedFontsOutline( source )[ slug ]?.includes(\n\t\t\tstyle + weight\n\t\t);\n\t};\n\n\tconst getFontFacesActivated = ( slug, source ) => {\n\t\treturn getActivatedFontsOutline( source )[ slug ] || [];\n\t};\n\n\tasync function installFonts( fontFamiliesToInstall ) {\n\t\tsetIsInstalling( true );\n\t\ttry {\n\t\t\tconst fontFamiliesToActivate = [];\n\t\t\tlet installationErrors = [];\n\n\t\t\tfor ( const fontFamilyToInstall of fontFamiliesToInstall ) {\n\t\t\t\tlet isANewFontFamily = false;\n\n\t\t\t\t// Get the font family if it already exists.\n\t\t\t\tlet installedFontFamily = await fetchGetFontFamilyBySlug(\n\t\t\t\t\tfontFamilyToInstall.slug\n\t\t\t\t);\n\n\t\t\t\t// Otherwise create it.\n\t\t\t\tif ( ! installedFontFamily ) {\n\t\t\t\t\tisANewFontFamily = true;\n\t\t\t\t\t// Prepare font family form data to install.\n\t\t\t\t\tinstalledFontFamily = await fetchInstallFontFamily(\n\t\t\t\t\t\tmakeFontFamilyFormData( fontFamilyToInstall )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Collect font faces that have already been installed (to be activated later)\n\t\t\t\tconst alreadyInstalledFontFaces =\n\t\t\t\t\tinstalledFontFamily.fontFace && fontFamilyToInstall.fontFace\n\t\t\t\t\t\t? installedFontFamily.fontFace.filter(\n\t\t\t\t\t\t\t\t( fontFaceToInstall ) =>\n\t\t\t\t\t\t\t\t\tcheckFontFaceInstalled(\n\t\t\t\t\t\t\t\t\t\tfontFaceToInstall,\n\t\t\t\t\t\t\t\t\t\tfontFamilyToInstall.fontFace\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: [];\n\n\t\t\t\t// Filter out Font Faces that have already been installed (so that they are not re-installed)\n\t\t\t\tif (\n\t\t\t\t\tinstalledFontFamily.fontFace &&\n\t\t\t\t\tfontFamilyToInstall.fontFace\n\t\t\t\t) {\n\t\t\t\t\tfontFamilyToInstall.fontFace =\n\t\t\t\t\t\tfontFamilyToInstall.fontFace.filter(\n\t\t\t\t\t\t\t( fontFaceToInstall ) =>\n\t\t\t\t\t\t\t\t! checkFontFaceInstalled(\n\t\t\t\t\t\t\t\t\tfontFaceToInstall,\n\t\t\t\t\t\t\t\t\tinstalledFontFamily.fontFace\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Install the fonts (upload the font files to the server and create the post in the database).\n\t\t\t\tlet successfullyInstalledFontFaces = [];\n\t\t\t\tlet unsuccessfullyInstalledFontFaces = [];\n\t\t\t\tif ( fontFamilyToInstall?.fontFace?.length > 0 ) {\n\t\t\t\t\tconst response = await batchInstallFontFaces(\n\t\t\t\t\t\tinstalledFontFamily.id,\n\t\t\t\t\t\tmakeFontFacesFormData( fontFamilyToInstall )\n\t\t\t\t\t);\n\t\t\t\t\tsuccessfullyInstalledFontFaces = response?.successes;\n\t\t\t\t\tunsuccessfullyInstalledFontFaces = response?.errors;\n\t\t\t\t}\n\n\t\t\t\t// Use the successfully installed font faces\n\t\t\t\t// As well as any font faces that were already installed (those will be activated)\n\t\t\t\tif (\n\t\t\t\t\tsuccessfullyInstalledFontFaces?.length > 0 ||\n\t\t\t\t\talreadyInstalledFontFaces?.length > 0\n\t\t\t\t) {\n\t\t\t\t\t// Use font data from REST API not from client to ensure\n\t\t\t\t\t// correct font information is used.\n\t\t\t\t\tinstalledFontFamily.fontFace = [\n\t\t\t\t\t\t...successfullyInstalledFontFaces,\n\t\t\t\t\t];\n\n\t\t\t\t\tfontFamiliesToActivate.push( installedFontFamily );\n\t\t\t\t}\n\n\t\t\t\t// If it's a system font but was installed successfully, activate it.\n\t\t\t\tif (\n\t\t\t\t\tinstalledFontFamily &&\n\t\t\t\t\t! fontFamilyToInstall?.fontFace?.length\n\t\t\t\t) {\n\t\t\t\t\tfontFamiliesToActivate.push( installedFontFamily );\n\t\t\t\t}\n\n\t\t\t\t// If the font family is new and is not a system font, delete it to avoid having font families without font faces.\n\t\t\t\tif (\n\t\t\t\t\tisANewFontFamily &&\n\t\t\t\t\tfontFamilyToInstall?.fontFace?.length > 0 &&\n\t\t\t\t\tsuccessfullyInstalledFontFaces?.length === 0\n\t\t\t\t) {\n\t\t\t\t\tawait fetchUninstallFontFamily( installedFontFamily.id );\n\t\t\t\t}\n\n\t\t\t\tinstallationErrors = installationErrors.concat(\n\t\t\t\t\tunsuccessfullyInstalledFontFaces\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tinstallationErrors = installationErrors.reduce(\n\t\t\t\t( unique, item ) =>\n\t\t\t\t\tunique.includes( item.message )\n\t\t\t\t\t\t? unique\n\t\t\t\t\t\t: [ ...unique, item.message ],\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\tif ( fontFamiliesToActivate.length > 0 ) {\n\t\t\t\t// Activate the font family (add the font family to the global styles).\n\t\t\t\tconst activeFonts = activateCustomFontFamilies(\n\t\t\t\t\tfontFamiliesToActivate\n\t\t\t\t);\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveFontFamilies( activeFonts );\n\n\t\t\t\trefreshLibrary();\n\t\t\t}\n\n\t\t\tif ( installationErrors.length > 0 ) {\n\t\t\t\tconst installError = new Error(\n\t\t\t\t\t__( 'There was an error installing fonts.' )\n\t\t\t\t);\n\n\t\t\t\tinstallError.installationErrors = installationErrors;\n\n\t\t\t\tthrow installError;\n\t\t\t}\n\t\t} finally {\n\t\t\tsetIsInstalling( false );\n\t\t}\n\t}\n\n\tasync function uninstallFontFamily( fontFamilyToUninstall ) {\n\t\ttry {\n\t\t\t// Uninstall the font family.\n\t\t\t// (Removes the font files from the server and the posts from the database).\n\t\t\tconst uninstalledFontFamily = await fetchUninstallFontFamily(\n\t\t\t\tfontFamilyToUninstall.id\n\t\t\t);\n\n\t\t\t// Deactivate the font family if delete request is successful\n\t\t\t// (Removes the font family from the global styles).\n\t\t\tif ( uninstalledFontFamily.deleted ) {\n\t\t\t\tconst activeFonts = deactivateFontFamily(\n\t\t\t\t\tfontFamilyToUninstall\n\t\t\t\t);\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveFontFamilies( activeFonts );\n\t\t\t}\n\n\t\t\t// Refresh the library (the library font families from database).\n\t\t\trefreshLibrary();\n\n\t\t\treturn uninstalledFontFamily;\n\t\t} catch ( error ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t`There was an error uninstalling the font family:`,\n\t\t\t\terror\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tconst deactivateFontFamily = ( font ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialCustomFonts = fontFamilies?.[ font.source ] ?? [];\n\t\tconst newCustomFonts = initialCustomFonts.filter(\n\t\t\t( f ) => f.slug !== font.slug\n\t\t);\n\t\tconst activeFonts = {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newCustomFonts,\n\t\t};\n\t\tsetFontFamilies( activeFonts );\n\n\t\tif ( font.fontFace ) {\n\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\tunloadFontFaceInBrowser( face, 'all' );\n\t\t\t} );\n\t\t}\n\t\treturn activeFonts;\n\t};\n\n\tconst activateCustomFontFamilies = ( fontsToAdd ) => {\n\t\tconst fontsToActivate = cleanFontsForSave( fontsToAdd );\n\n\t\tconst activeFonts = {\n\t\t\t...fontFamilies,\n\t\t\t// Merge the existing custom fonts with the new fonts.\n\t\t\tcustom: mergeFontFamilies( fontFamilies?.custom, fontsToActivate ),\n\t\t};\n\n\t\t// Activate the fonts by set the new custom fonts array.\n\t\tsetFontFamilies( activeFonts );\n\n\t\tloadFontsInBrowser( fontsToActivate );\n\n\t\treturn activeFonts;\n\t};\n\n\t// Removes the id from the families and faces to avoid saving that to global styles post content.\n\tconst cleanFontsForSave = ( fonts ) => {\n\t\treturn fonts.map( ( { id: _familyDbId, fontFace, ...font } ) => ( {\n\t\t\t...font,\n\t\t\t...( fontFace && fontFace.length > 0\n\t\t\t\t? {\n\t\t\t\t\t\tfontFace: fontFace.map(\n\t\t\t\t\t\t\t( { id: _faceDbId, ...face } ) => face\n\t\t\t\t\t\t),\n\t\t\t\t }\n\t\t\t\t: {} ),\n\t\t} ) );\n\t};\n\n\tconst loadFontsInBrowser = ( fonts ) => {\n\t\t// Add custom fonts to the browser.\n\t\tfonts.forEach( ( font ) => {\n\t\t\tif ( font.fontFace ) {\n\t\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\t\t// Load font faces just in the iframe because they already are in the document.\n\t\t\t\t\tloadFontFaceInBrowser(\n\t\t\t\t\t\tface,\n\t\t\t\t\t\tgetDisplaySrcFromFontFace( face.src ),\n\t\t\t\t\t\t'all'\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst toggleActivateFont = ( font, face ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialFonts = fontFamilies?.[ font.source ] ?? [];\n\t\t// Toggles the received font family or font face\n\t\tconst newFonts = toggleFont( font, face, initialFonts );\n\t\t// Updates the font families activated in global settings:\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newFonts,\n\t\t} );\n\n\t\tconst isFaceActivated = isFontActivated(\n\t\t\tfont.slug,\n\t\t\tface?.fontStyle,\n\t\t\tface?.fontWeight,\n\t\t\tfont.source\n\t\t);\n\n\t\tif ( isFaceActivated ) {\n\t\t\tloadFontFaceInBrowser(\n\t\t\t\tface,\n\t\t\t\tgetDisplaySrcFromFontFace( face?.src ),\n\t\t\t\t'all'\n\t\t\t);\n\t\t} else {\n\t\t\tunloadFontFaceInBrowser( face, 'all' );\n\t\t}\n\t};\n\n\tconst loadFontFaceAsset = async ( fontFace ) => {\n\t\t// If the font doesn't have a src, don't load it.\n\t\tif ( ! fontFace.src ) {\n\t\t\treturn;\n\t\t}\n\t\t// Get the src of the font.\n\t\tconst src = getDisplaySrcFromFontFace( fontFace.src );\n\t\t// If the font is already loaded, don't load it again.\n\t\tif ( ! src || loadedFontUrls.has( src ) ) {\n\t\t\treturn;\n\t\t}\n\t\t// Load the font in the browser.\n\t\tloadFontFaceInBrowser( fontFace, src, 'document' );\n\t\t// Add the font to the loaded fonts list.\n\t\tloadedFontUrls.add( src );\n\t};\n\n\t// Font Collections\n\tconst [ collections, setFontCollections ] = useState( [] );\n\tconst getFontCollections = async () => {\n\t\tconst response = await fetchFontCollections();\n\t\tsetFontCollections( response );\n\t};\n\tconst getFontCollection = async ( slug ) => {\n\t\ttry {\n\t\t\tconst hasData = !! collections.find(\n\t\t\t\t( collection ) => collection.slug === slug\n\t\t\t)?.font_families;\n\t\t\tif ( hasData ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst response = await fetchFontCollection( slug );\n\t\t\tconst updatedCollections = collections.map( ( collection ) =>\n\t\t\t\tcollection.slug === slug\n\t\t\t\t\t? { ...collection, ...response }\n\t\t\t\t\t: collection\n\t\t\t);\n\t\t\tsetFontCollections( updatedCollections );\n\t\t} catch ( e ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( e );\n\t\t\tthrow e;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tgetFontCollections();\n\t}, [] );\n\n\treturn (\n\t\t<FontLibraryContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tlibraryFontSelected,\n\t\t\t\thandleSetLibraryFontSelected,\n\t\t\t\tfontFamilies,\n\t\t\t\tbaseCustomFonts,\n\t\t\t\tisFontActivated,\n\t\t\t\tgetFontFacesActivated,\n\t\t\t\tloadFontFaceAsset,\n\t\t\t\tinstallFonts,\n\t\t\t\tuninstallFontFamily,\n\t\t\t\ttoggleActivateFont,\n\t\t\t\tgetAvailableFontsOutline,\n\t\t\t\tmodalTabOpen,\n\t\t\t\tsetModalTabOpen,\n\t\t\t\trefreshLibrary,\n\t\t\t\tnotice,\n\t\t\t\tsetNotice,\n\t\t\t\tsaveFontFamilies,\n\t\t\t\tisResolvingLibrary,\n\t\t\t\tisInstalling,\n\t\t\t\tcollections,\n\t\t\t\tgetFontCollection,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</FontLibraryContext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G,CAAI6H,UAAU,IACvDA,UAAU,CAACvF,IAAI,KAAKA,IAAI,GACrB;QAAE,GAAGuF,UAAU;QAAE,GAAGrD;MAAS,CAAC,GAC9BqD,UACJ,CAAC;MACDL,kBAAkB,CAAEQ,kBAAmB,CAAC;IACzC,CAAC,CAAC,OAAQC,CAAC,EAAG;MACb;MACAnC,OAAO,CAACD,KAAK,CAAEoC,CAAE,CAAC;MAClB,MAAMA,CAAC;IACR;EACD,CAAC;EAED,IAAAhG,kBAAS,EAAE,MAAM;IAChBwF,kBAAkB,CAAC,CAAC;EACrB,CAAC,EAAE,EAAG,CAAC;EAEP,oBACC,IAAA5J,WAAA,CAAAqK,GAAA,EAACjK,kBAAkB,CAACkK,QAAQ;IAC3BC,KAAK,EAAG;MACPlH,mBAAmB;MACnBgB,4BAA4B;MAC5BzB,YAAY;MACZuB,eAAe;MACfmB,eAAe;MACfI,qBAAqB;MACrB6D,iBAAiB;MACjB5D,YAAY;MACZgC,mBAAmB;MACnBsB,kBAAkB;MAClBrE,wBAAwB;MACxBzB,YAAY;MACZC,eAAe;MACf3B,cAAc;MACdF,MAAM;MACNC,SAAS;MACTsB,gBAAgB;MAChBf,kBAAkB;MAClBb,YAAY;MACZwI,WAAW;MACXI;IACD,CAAG;IAAAtJ,QAAA,EAEDA;EAAQ,CACkB,CAAC;AAEhC;AAAC,IAAAgK,QAAA,GAAAnK,OAAA,CAAAoK,OAAA,GAEclK,mBAAmB","ignoreList":[]}
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _components = require("@wordpress/components");
11
10
  var _fontDemo = _interopRequireDefault(require("./font-demo"));
12
11
  var _icons = require("@wordpress/icons");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
13
  /**
14
14
  * WordPress dependencies
15
15
  */
@@ -29,7 +29,7 @@ function FontCard({
29
29
  cursor: !!onClick ? 'pointer' : 'default'
30
30
  };
31
31
  const navigator = (0, _components.__experimentalUseNavigator)();
32
- return (0, _react.createElement)(_components.Button, {
32
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
33
33
  onClick: () => {
34
34
  onClick();
35
35
  if (navigatorPath) {
@@ -37,20 +37,28 @@ function FontCard({
37
37
  }
38
38
  },
39
39
  style: style,
40
- className: "font-library-modal__font-card"
41
- }, (0, _react.createElement)(_components.Flex, {
42
- justify: "space-between",
43
- wrap: false
44
- }, (0, _react.createElement)(_fontDemo.default, {
45
- font: font
46
- }), (0, _react.createElement)(_components.Flex, {
47
- justify: "flex-end"
48
- }, (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_components.__experimentalText, {
49
- className: "font-library-modal__font-card__count"
50
- }, variantsText || (0, _i18n.sprintf)( /* translators: %d: Number of font variants. */
51
- (0, _i18n._n)('%d variant', '%d variants', variantsCount), variantsCount))), (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_components.Icon, {
52
- icon: _icons.chevronRight
53
- })))));
40
+ className: "font-library-modal__font-card",
41
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Flex, {
42
+ justify: "space-between",
43
+ wrap: false,
44
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_fontDemo.default, {
45
+ font: font
46
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Flex, {
47
+ justify: "flex-end",
48
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
49
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
50
+ className: "font-library-modal__font-card__count",
51
+ children: variantsText || (0, _i18n.sprintf)( /* translators: %d: Number of font variants. */
52
+ (0, _i18n._n)('%d variant', '%d variants', variantsCount), variantsCount)
53
+ })
54
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
56
+ icon: _icons.chevronRight
57
+ })
58
+ })]
59
+ })]
60
+ })
61
+ });
54
62
  }
55
63
  var _default = exports.default = FontCard;
56
64
  //# sourceMappingURL=font-card.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_fontDemo","_interopRequireDefault","_icons","FontCard","font","onClick","variantsText","navigatorPath","variantsCount","fontFace","length","style","cursor","navigator","useNavigator","_react","createElement","Button","goTo","className","Flex","justify","wrap","default","FlexItem","__experimentalText","sprintf","_n","Icon","icon","chevronRight","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/font-card.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalText as Text,\n\tButton,\n\tFlex,\n\tFlexItem,\n\tIcon,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FontDemo from './font-demo';\nimport { chevronRight } from '@wordpress/icons';\n\nfunction FontCard( { font, onClick, variantsText, navigatorPath } ) {\n\tconst variantsCount = font.fontFace?.length || 1;\n\n\tconst style = {\n\t\tcursor: !! onClick ? 'pointer' : 'default',\n\t};\n\n\tconst navigator = useNavigator();\n\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () => {\n\t\t\t\tonClick();\n\t\t\t\tif ( navigatorPath ) {\n\t\t\t\t\tnavigator.goTo( navigatorPath );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tstyle={ style }\n\t\t\tclassName=\"font-library-modal__font-card\"\n\t\t>\n\t\t\t<Flex justify=\"space-between\" wrap={ false }>\n\t\t\t\t<FontDemo font={ font } />\n\t\t\t\t<Flex justify=\"flex-end\">\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Text className=\"font-library-modal__font-card__count\">\n\t\t\t\t\t\t\t{ variantsText ||\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d: Number of font variants. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'%d variant',\n\t\t\t\t\t\t\t\t\t\t'%d variants',\n\t\t\t\t\t\t\t\t\t\tvariantsCount\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tvariantsCount\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Icon icon={ chevronRight } />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nexport default FontCard;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAYA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAjBA;AACA;AACA;;AAWA;AACA;AACA;;AAIA,SAASK,QAAQA,CAAE;EAAEC,IAAI;EAAEC,OAAO;EAAEC,YAAY;EAAEC;AAAc,CAAC,EAAG;EACnE,MAAMC,aAAa,GAAGJ,IAAI,CAACK,QAAQ,EAAEC,MAAM,IAAI,CAAC;EAEhD,MAAMC,KAAK,GAAG;IACbC,MAAM,EAAE,CAAC,CAAEP,OAAO,GAAG,SAAS,GAAG;EAClC,CAAC;EAED,MAAMQ,SAAS,GAAG,IAAAC,sCAAY,EAAC,CAAC;EAEhC,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAkB,MAAM;IACNZ,OAAO,EAAGA,CAAA,KAAM;MACfA,OAAO,CAAC,CAAC;MACT,IAAKE,aAAa,EAAG;QACpBM,SAAS,CAACK,IAAI,CAAEX,aAAc,CAAC;MAChC;IACD,CAAG;IACHI,KAAK,EAAGA,KAAO;IACfQ,SAAS,EAAC;EAA+B,GAEzC,IAAAJ,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAqB,IAAI;IAACC,OAAO,EAAC,eAAe;IAACC,IAAI,EAAG;EAAO,GAC3C,IAAAP,MAAA,CAAAC,aAAA,EAAChB,SAAA,CAAAuB,OAAQ;IAACnB,IAAI,EAAGA;EAAM,CAAE,CAAC,EAC1B,IAAAW,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAqB,IAAI;IAACC,OAAO,EAAC;EAAU,GACvB,IAAAN,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAyB,QAAQ,QACR,IAAAT,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAA0B,kBAAI;IAACN,SAAS,EAAC;EAAsC,GACnDb,YAAY,IACb,IAAAoB,aAAO,GACN;EACA,IAAAC,QAAE,EACD,YAAY,EACZ,aAAa,EACbnB,aACD,CAAC,EACDA,aACD,CACI,CACG,CAAC,EACX,IAAAO,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAyB,QAAQ,QACR,IAAAT,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAA6B,IAAI;IAACC,IAAI,EAAGC;EAAc,CAAE,CACpB,CACL,CACD,CACC,CAAC;AAEX;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAEcpB,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_fontDemo","_interopRequireDefault","_icons","_jsxRuntime","FontCard","font","onClick","variantsText","navigatorPath","variantsCount","fontFace","length","style","cursor","navigator","useNavigator","jsx","Button","goTo","className","children","jsxs","Flex","justify","wrap","default","FlexItem","__experimentalText","sprintf","_n","Icon","icon","chevronRight","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/font-card.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalText as Text,\n\tButton,\n\tFlex,\n\tFlexItem,\n\tIcon,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FontDemo from './font-demo';\nimport { chevronRight } from '@wordpress/icons';\n\nfunction FontCard( { font, onClick, variantsText, navigatorPath } ) {\n\tconst variantsCount = font.fontFace?.length || 1;\n\n\tconst style = {\n\t\tcursor: !! onClick ? 'pointer' : 'default',\n\t};\n\n\tconst navigator = useNavigator();\n\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () => {\n\t\t\t\tonClick();\n\t\t\t\tif ( navigatorPath ) {\n\t\t\t\t\tnavigator.goTo( navigatorPath );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tstyle={ style }\n\t\t\tclassName=\"font-library-modal__font-card\"\n\t\t>\n\t\t\t<Flex justify=\"space-between\" wrap={ false }>\n\t\t\t\t<FontDemo font={ font } />\n\t\t\t\t<Flex justify=\"flex-end\">\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Text className=\"font-library-modal__font-card__count\">\n\t\t\t\t\t\t\t{ variantsText ||\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d: Number of font variants. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'%d variant',\n\t\t\t\t\t\t\t\t\t\t'%d variants',\n\t\t\t\t\t\t\t\t\t\tvariantsCount\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tvariantsCount\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Icon icon={ chevronRight } />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nexport default FontCard;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAYA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAj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