@wordpress/edit-site 5.2.0 → 5.3.1

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 (409) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
  3. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/add-custom-template-modal.js +0 -1
  5. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  6. package/build/components/add-new-template/new-template-part.js +9 -32
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +5 -4
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/add-new-template/utils.js +1 -9
  11. package/build/components/add-new-template/utils.js.map +1 -1
  12. package/build/components/app/index.js +2 -7
  13. package/build/components/app/index.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +13 -2
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/index.js +16 -14
  17. package/build/components/block-editor/index.js.map +1 -1
  18. package/build/components/block-editor/inserter-media-categories.js +237 -0
  19. package/build/components/block-editor/inserter-media-categories.js.map +1 -0
  20. package/build/components/canvas-spinner/index.js +20 -0
  21. package/build/components/canvas-spinner/index.js.map +1 -0
  22. package/build/components/create-template-part-modal/index.js +4 -2
  23. package/build/components/create-template-part-modal/index.js.map +1 -1
  24. package/build/components/editor/index.js +9 -5
  25. package/build/components/editor/index.js.map +1 -1
  26. package/build/components/error-boundary/index.js +2 -12
  27. package/build/components/error-boundary/index.js.map +1 -1
  28. package/build/components/error-boundary/warning.js +5 -28
  29. package/build/components/error-boundary/warning.js.map +1 -1
  30. package/build/components/global-styles/block-preview-panel.js +2 -2
  31. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  32. package/build/components/global-styles/border-panel.js +17 -9
  33. package/build/components/global-styles/border-panel.js.map +1 -1
  34. package/build/components/global-styles/color-palette-panel.js +13 -7
  35. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  36. package/build/components/global-styles/context-menu.js +39 -4
  37. package/build/components/global-styles/context-menu.js.map +1 -1
  38. package/build/components/global-styles/custom-css.js +65 -14
  39. package/build/components/global-styles/custom-css.js.map +1 -1
  40. package/build/components/global-styles/dimensions-panel.js +49 -31
  41. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  42. package/build/components/global-styles/global-styles-provider.js +13 -3
  43. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  44. package/build/components/global-styles/gradients-palette-panel.js +17 -11
  45. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  46. package/build/components/global-styles/hooks.js +21 -142
  47. package/build/components/global-styles/hooks.js.map +1 -1
  48. package/build/components/global-styles/index.js +0 -28
  49. package/build/components/global-styles/index.js.map +1 -1
  50. package/build/components/global-styles/palette.js +11 -4
  51. package/build/components/global-styles/palette.js.map +1 -1
  52. package/build/components/global-styles/preview.js +18 -15
  53. package/build/components/global-styles/preview.js.map +1 -1
  54. package/build/components/global-styles/screen-background-color.js +27 -13
  55. package/build/components/global-styles/screen-background-color.js.map +1 -1
  56. package/build/components/global-styles/screen-border.js +10 -4
  57. package/build/components/global-styles/screen-border.js.map +1 -1
  58. package/build/components/global-styles/screen-button-color.js +16 -9
  59. package/build/components/global-styles/screen-button-color.js.map +1 -1
  60. package/build/components/global-styles/screen-colors.js +43 -34
  61. package/build/components/global-styles/screen-colors.js.map +1 -1
  62. package/build/components/global-styles/screen-css.js +20 -8
  63. package/build/components/global-styles/screen-css.js.map +1 -1
  64. package/build/components/global-styles/screen-heading-color.js +23 -16
  65. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  66. package/build/components/global-styles/screen-layout.js +3 -3
  67. package/build/components/global-styles/screen-layout.js.map +1 -1
  68. package/build/components/global-styles/screen-link-color.js +18 -11
  69. package/build/components/global-styles/screen-link-color.js.map +1 -1
  70. package/build/components/global-styles/screen-root.js +25 -9
  71. package/build/components/global-styles/screen-root.js.map +1 -1
  72. package/build/components/global-styles/screen-style-variations.js +8 -4
  73. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  74. package/build/components/global-styles/screen-text-color.js +14 -7
  75. package/build/components/global-styles/screen-text-color.js.map +1 -1
  76. package/build/components/global-styles/screen-typography.js +18 -12
  77. package/build/components/global-styles/screen-typography.js.map +1 -1
  78. package/build/components/global-styles/shadow-panel.js +196 -0
  79. package/build/components/global-styles/shadow-panel.js.map +1 -0
  80. package/build/components/global-styles/typography-panel.js +43 -29
  81. package/build/components/global-styles/typography-panel.js.map +1 -1
  82. package/build/components/global-styles/typography-preview.js +19 -9
  83. package/build/components/global-styles/typography-preview.js.map +1 -1
  84. package/build/components/global-styles/ui.js +104 -34
  85. package/build/components/global-styles/ui.js.map +1 -1
  86. package/build/components/global-styles/utils.js +5 -334
  87. package/build/components/global-styles/utils.js.map +1 -1
  88. package/build/components/global-styles-renderer/index.js +7 -5
  89. package/build/components/global-styles-renderer/index.js.map +1 -1
  90. package/build/components/header-edit-mode/document-actions/index.js +2 -2
  91. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  92. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  93. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  94. package/build/components/layout/index.js +11 -11
  95. package/build/components/layout/index.js.map +1 -1
  96. package/build/components/list/actions/rename-menu-item.js +8 -11
  97. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  98. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +9 -6
  99. package/build/components/navigation-inspector/index.js.map +1 -0
  100. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +14 -14
  101. package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
  102. package/build/components/sidebar/index.js +3 -1
  103. package/build/components/sidebar/index.js.map +1 -1
  104. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
  105. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  106. package/build/components/sidebar-edit-mode/index.js +1 -14
  107. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen/index.js +3 -2
  109. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  110. package/build/components/sidebar-navigation-screen-main/index.js +23 -1
  111. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +52 -0
  113. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  114. package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
  115. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  116. package/build/components/site-hub/index.js +11 -10
  117. package/build/components/site-hub/index.js.map +1 -1
  118. package/build/components/site-icon/index.js +1 -1
  119. package/build/components/site-icon/index.js.map +1 -1
  120. package/build/components/style-book/index.js +7 -4
  121. package/build/components/style-book/index.js.map +1 -1
  122. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +6 -4
  123. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  124. package/build/components/template-part-converter/convert-to-template-part.js +5 -9
  125. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  126. package/build/experiments.js +19 -0
  127. package/build/experiments.js.map +1 -0
  128. package/build/hooks/push-changes-to-global-styles/index.js +65 -6
  129. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  130. package/build/index.js +53 -60
  131. package/build/index.js.map +1 -1
  132. package/build/store/actions.js +1 -27
  133. package/build/store/actions.js.map +1 -1
  134. package/build/store/index.js +8 -0
  135. package/build/store/index.js.map +1 -1
  136. package/build/store/private-actions.js +40 -0
  137. package/build/store/private-actions.js.map +1 -0
  138. package/build/store/private-selectors.js +18 -0
  139. package/build/store/private-selectors.js.map +1 -0
  140. package/build/store/selectors.js +7 -40
  141. package/build/store/selectors.js.map +1 -1
  142. package/build/store/utils.js +77 -0
  143. package/build/store/utils.js.map +1 -0
  144. package/build/utils/template-part-create.js +71 -0
  145. package/build/utils/template-part-create.js.map +1 -0
  146. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
  147. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  148. package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
  149. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  150. package/build-module/components/add-new-template/new-template-part.js +8 -31
  151. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  152. package/build-module/components/add-new-template/new-template.js +4 -4
  153. package/build-module/components/add-new-template/new-template.js.map +1 -1
  154. package/build-module/components/add-new-template/utils.js +0 -5
  155. package/build-module/components/add-new-template/utils.js.map +1 -1
  156. package/build-module/components/app/index.js +2 -7
  157. package/build-module/components/app/index.js.map +1 -1
  158. package/build-module/components/block-editor/editor-canvas.js +13 -3
  159. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  160. package/build-module/components/block-editor/index.js +17 -15
  161. package/build-module/components/block-editor/index.js.map +1 -1
  162. package/build-module/components/block-editor/inserter-media-categories.js +225 -0
  163. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
  164. package/build-module/components/canvas-spinner/index.js +12 -0
  165. package/build-module/components/canvas-spinner/index.js.map +1 -0
  166. package/build-module/components/create-template-part-modal/index.js +5 -3
  167. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  168. package/build-module/components/editor/index.js +7 -5
  169. package/build-module/components/editor/index.js.map +1 -1
  170. package/build-module/components/error-boundary/index.js +2 -12
  171. package/build-module/components/error-boundary/index.js.map +1 -1
  172. package/build-module/components/error-boundary/warning.js +5 -28
  173. package/build-module/components/error-boundary/warning.js.map +1 -1
  174. package/build-module/components/global-styles/block-preview-panel.js +2 -2
  175. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  176. package/build-module/components/global-styles/border-panel.js +17 -11
  177. package/build-module/components/global-styles/border-panel.js.map +1 -1
  178. package/build-module/components/global-styles/color-palette-panel.js +11 -7
  179. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  180. package/build-module/components/global-styles/context-menu.js +40 -8
  181. package/build-module/components/global-styles/context-menu.js.map +1 -1
  182. package/build-module/components/global-styles/custom-css.js +61 -15
  183. package/build-module/components/global-styles/custom-css.js.map +1 -1
  184. package/build-module/components/global-styles/dimensions-panel.js +49 -32
  185. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  186. package/build-module/components/global-styles/global-styles-provider.js +7 -2
  187. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  188. package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
  189. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  190. package/build-module/components/global-styles/hooks.js +23 -134
  191. package/build-module/components/global-styles/hooks.js.map +1 -1
  192. package/build-module/components/global-styles/index.js +0 -2
  193. package/build-module/components/global-styles/index.js.map +1 -1
  194. package/build-module/components/global-styles/palette.js +10 -5
  195. package/build-module/components/global-styles/palette.js.map +1 -1
  196. package/build-module/components/global-styles/preview.js +18 -14
  197. package/build-module/components/global-styles/preview.js.map +1 -1
  198. package/build-module/components/global-styles/screen-background-color.js +26 -15
  199. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  200. package/build-module/components/global-styles/screen-border.js +10 -5
  201. package/build-module/components/global-styles/screen-border.js.map +1 -1
  202. package/build-module/components/global-styles/screen-button-color.js +16 -11
  203. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  204. package/build-module/components/global-styles/screen-colors.js +43 -37
  205. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  206. package/build-module/components/global-styles/screen-css.js +21 -9
  207. package/build-module/components/global-styles/screen-css.js.map +1 -1
  208. package/build-module/components/global-styles/screen-heading-color.js +23 -18
  209. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  210. package/build-module/components/global-styles/screen-layout.js +4 -4
  211. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  212. package/build-module/components/global-styles/screen-link-color.js +18 -13
  213. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  214. package/build-module/components/global-styles/screen-root.js +23 -9
  215. package/build-module/components/global-styles/screen-root.js.map +1 -1
  216. package/build-module/components/global-styles/screen-style-variations.js +5 -2
  217. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  218. package/build-module/components/global-styles/screen-text-color.js +14 -9
  219. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  220. package/build-module/components/global-styles/screen-typography.js +16 -12
  221. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  222. package/build-module/components/global-styles/shadow-panel.js +177 -0
  223. package/build-module/components/global-styles/shadow-panel.js.map +1 -0
  224. package/build-module/components/global-styles/typography-panel.js +43 -31
  225. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  226. package/build-module/components/global-styles/typography-preview.js +17 -9
  227. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  228. package/build-module/components/global-styles/ui.js +98 -35
  229. package/build-module/components/global-styles/ui.js.map +1 -1
  230. package/build-module/components/global-styles/utils.js +4 -319
  231. package/build-module/components/global-styles/utils.js.map +1 -1
  232. package/build-module/components/global-styles-renderer/index.js +5 -5
  233. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  234. package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
  235. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  236. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  237. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  238. package/build-module/components/layout/index.js +10 -11
  239. package/build-module/components/layout/index.js.map +1 -1
  240. package/build-module/components/list/actions/rename-menu-item.js +9 -12
  241. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  242. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +9 -6
  243. package/build-module/components/navigation-inspector/index.js.map +1 -0
  244. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +14 -15
  245. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
  246. package/build-module/components/sidebar/index.js +2 -1
  247. package/build-module/components/sidebar/index.js.map +1 -1
  248. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
  249. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  250. package/build-module/components/sidebar-edit-mode/index.js +1 -13
  251. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-screen/index.js +3 -2
  253. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  254. package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
  255. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +40 -0
  257. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  258. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
  259. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  260. package/build-module/components/site-hub/index.js +10 -10
  261. package/build-module/components/site-hub/index.js.map +1 -1
  262. package/build-module/components/site-icon/index.js +1 -1
  263. package/build-module/components/site-icon/index.js.map +1 -1
  264. package/build-module/components/style-book/index.js +8 -5
  265. package/build-module/components/style-book/index.js.map +1 -1
  266. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -4
  267. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  268. package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
  269. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  270. package/build-module/experiments.js +9 -0
  271. package/build-module/experiments.js.map +1 -0
  272. package/build-module/hooks/push-changes-to-global-styles/index.js +62 -3
  273. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  274. package/build-module/index.js +52 -60
  275. package/build-module/index.js.map +1 -1
  276. package/build-module/store/actions.js +0 -23
  277. package/build-module/store/actions.js.map +1 -1
  278. package/build-module/store/index.js +5 -0
  279. package/build-module/store/index.js.map +1 -1
  280. package/build-module/store/private-actions.js +29 -0
  281. package/build-module/store/private-actions.js.map +1 -0
  282. package/build-module/store/private-selectors.js +11 -0
  283. package/build-module/store/private-selectors.js.map +1 -0
  284. package/build-module/store/selectors.js +6 -37
  285. package/build-module/store/selectors.js.map +1 -1
  286. package/build-module/store/utils.js +66 -0
  287. package/build-module/store/utils.js.map +1 -0
  288. package/build-module/utils/template-part-create.js +53 -0
  289. package/build-module/utils/template-part-create.js.map +1 -0
  290. package/build-style/style-rtl.css +314 -216
  291. package/build-style/style.css +314 -216
  292. package/package.json +32 -30
  293. package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
  294. package/src/components/add-new-template/add-custom-template-modal.js +0 -1
  295. package/src/components/add-new-template/new-template-part.js +14 -34
  296. package/src/components/add-new-template/new-template.js +5 -3
  297. package/src/components/add-new-template/style.scss +0 -4
  298. package/src/components/add-new-template/utils.js +0 -14
  299. package/src/components/app/index.js +2 -2
  300. package/src/components/block-editor/editor-canvas.js +12 -2
  301. package/src/components/block-editor/index.js +16 -28
  302. package/src/components/block-editor/inserter-media-categories.js +247 -0
  303. package/src/components/block-editor/style.scss +20 -7
  304. package/src/components/canvas-spinner/index.js +12 -0
  305. package/src/components/canvas-spinner/style.scss +7 -0
  306. package/src/components/create-template-part-modal/index.js +75 -67
  307. package/src/components/create-template-part-modal/style.scss +0 -10
  308. package/src/components/editor/index.js +8 -5
  309. package/src/components/error-boundary/index.js +2 -10
  310. package/src/components/error-boundary/warning.js +6 -35
  311. package/src/components/global-styles/README.md +1 -75
  312. package/src/components/global-styles/block-preview-panel.js +2 -2
  313. package/src/components/global-styles/border-panel.js +19 -17
  314. package/src/components/global-styles/color-palette-panel.js +10 -7
  315. package/src/components/global-styles/context-menu.js +114 -44
  316. package/src/components/global-styles/custom-css.js +76 -19
  317. package/src/components/global-styles/dimensions-panel.js +46 -36
  318. package/src/components/global-styles/global-styles-provider.js +6 -2
  319. package/src/components/global-styles/gradients-palette-panel.js +17 -11
  320. package/src/components/global-styles/hooks.js +31 -155
  321. package/src/components/global-styles/index.js +0 -2
  322. package/src/components/global-styles/palette.js +9 -5
  323. package/src/components/global-styles/preview.js +19 -13
  324. package/src/components/global-styles/screen-background-color.js +37 -21
  325. package/src/components/global-styles/screen-border.js +10 -5
  326. package/src/components/global-styles/screen-button-color.js +21 -19
  327. package/src/components/global-styles/screen-colors.js +48 -65
  328. package/src/components/global-styles/screen-css.js +30 -14
  329. package/src/components/global-styles/screen-heading-color.js +32 -27
  330. package/src/components/global-styles/screen-layout.js +4 -7
  331. package/src/components/global-styles/screen-link-color.js +26 -26
  332. package/src/components/global-styles/screen-root.js +24 -9
  333. package/src/components/global-styles/screen-style-variations.js +7 -2
  334. package/src/components/global-styles/screen-text-color.js +15 -19
  335. package/src/components/global-styles/screen-typography.js +27 -12
  336. package/src/components/global-styles/shadow-panel.js +174 -0
  337. package/src/components/global-styles/style.scss +85 -1
  338. package/src/components/global-styles/typography-panel.js +60 -48
  339. package/src/components/global-styles/typography-preview.js +28 -9
  340. package/src/components/global-styles/ui.js +97 -53
  341. package/src/components/global-styles/utils.js +4 -371
  342. package/src/components/global-styles-renderer/index.js +3 -4
  343. package/src/components/header-edit-mode/document-actions/index.js +1 -1
  344. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  345. package/src/components/layout/index.js +12 -4
  346. package/src/components/layout/style.scss +4 -5
  347. package/src/components/list/actions/rename-menu-item.js +14 -23
  348. package/src/components/list/style.scss +0 -4
  349. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +2 -2
  350. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
  351. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +0 -17
  352. package/src/components/sidebar/index.js +2 -0
  353. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
  354. package/src/components/sidebar-edit-mode/index.js +0 -11
  355. package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
  356. package/src/components/sidebar-navigation-item/style.scss +28 -3
  357. package/src/components/sidebar-navigation-screen/index.js +4 -3
  358. package/src/components/sidebar-navigation-screen/style.scss +2 -0
  359. package/src/components/sidebar-navigation-screen-main/index.js +23 -1
  360. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +45 -0
  361. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
  362. package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
  363. package/src/components/site-hub/index.js +8 -10
  364. package/src/components/site-hub/style.scss +7 -1
  365. package/src/components/site-icon/index.js +1 -1
  366. package/src/components/site-icon/style.scss +2 -2
  367. package/src/components/style-book/index.js +10 -5
  368. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +4 -3
  369. package/src/components/template-part-converter/convert-to-template-part.js +12 -10
  370. package/src/experiments.js +10 -0
  371. package/src/hooks/push-changes-to-global-styles/index.js +63 -5
  372. package/src/index.js +51 -59
  373. package/src/store/actions.js +0 -24
  374. package/src/store/index.js +5 -0
  375. package/src/store/private-actions.js +29 -0
  376. package/src/store/private-selectors.js +10 -0
  377. package/src/store/selectors.js +6 -37
  378. package/src/store/test/utils.js +181 -0
  379. package/src/store/utils.js +69 -0
  380. package/src/style.scss +4 -2
  381. package/src/utils/template-part-create.js +62 -0
  382. package/src/utils/test/template-part-create.js +63 -0
  383. package/build/components/global-styles/context.js +0 -22
  384. package/build/components/global-styles/context.js.map +0 -1
  385. package/build/components/global-styles/typography-utils.js +0 -92
  386. package/build/components/global-styles/typography-utils.js.map +0 -1
  387. package/build/components/global-styles/use-global-styles-output.js +0 -943
  388. package/build/components/global-styles/use-global-styles-output.js.map +0 -1
  389. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
  390. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  391. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  392. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  393. package/build-module/components/global-styles/context.js +0 -12
  394. package/build-module/components/global-styles/context.js.map +0 -1
  395. package/build-module/components/global-styles/typography-utils.js +0 -84
  396. package/build-module/components/global-styles/typography-utils.js.map +0 -1
  397. package/build-module/components/global-styles/use-global-styles-output.js +0 -901
  398. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
  399. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
  400. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  401. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  402. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  403. package/src/components/global-styles/context.js +0 -15
  404. package/src/components/global-styles/test/typography-utils.js +0 -393
  405. package/src/components/global-styles/test/use-global-styles-output.js +0 -814
  406. package/src/components/global-styles/test/utils.js +0 -206
  407. package/src/components/global-styles/typography-utils.js +0 -87
  408. package/src/components/global-styles/use-global-styles-output.js +0 -1059
  409. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.default = exports.GlobalStylesMenuSlot = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
@@ -17,6 +17,16 @@ var _blocks = require("@wordpress/blocks");
17
17
 
18
18
  var _data = require("@wordpress/data");
19
19
 
20
+ var _blockEditor = require("@wordpress/block-editor");
21
+
22
+ var _i18n = require("@wordpress/i18n");
23
+
24
+ var _preferences = require("@wordpress/preferences");
25
+
26
+ var _icons = require("@wordpress/icons");
27
+
28
+ var _coreData = require("@wordpress/core-data");
29
+
20
30
  var _screenRoot = _interopRequireDefault(require("./screen-root"));
21
31
 
22
32
  var _screenBlockList = _interopRequireDefault(require("./screen-block-list"));
@@ -53,6 +63,8 @@ var _styleBook = _interopRequireDefault(require("../style-book"));
53
63
 
54
64
  var _screenCss = _interopRequireDefault(require("./screen-css"));
55
65
 
66
+ var _experiments = require("../../experiments");
67
+
56
68
  /**
57
69
  * WordPress dependencies
58
70
  */
@@ -60,6 +72,61 @@ var _screenCss = _interopRequireDefault(require("./screen-css"));
60
72
  /**
61
73
  * Internal dependencies
62
74
  */
75
+ const SLOT_FILL_NAME = 'GlobalStylesMenu';
76
+ const {
77
+ Slot: GlobalStylesMenuSlot,
78
+ Fill: GlobalStylesMenuFill
79
+ } = (0, _components.createSlotFill)(SLOT_FILL_NAME);
80
+ exports.GlobalStylesMenuSlot = GlobalStylesMenuSlot;
81
+
82
+ function GlobalStylesActionMenu() {
83
+ const {
84
+ toggle
85
+ } = (0, _data.useDispatch)(_preferences.store);
86
+ const {
87
+ canEditCSS
88
+ } = (0, _data.useSelect)(select => {
89
+ var _globalStyles$_links$, _globalStyles$_links;
90
+
91
+ const {
92
+ getEntityRecord,
93
+ __experimentalGetCurrentGlobalStylesId
94
+ } = select(_coreData.store);
95
+
96
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
97
+
98
+ const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
99
+ return {
100
+ canEditCSS: (_globalStyles$_links$ = !!(globalStyles !== null && globalStyles !== void 0 && (_globalStyles$_links = globalStyles._links) !== null && _globalStyles$_links !== void 0 && _globalStyles$_links['wp:action-edit-css'])) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : false
101
+ };
102
+ }, []);
103
+ const {
104
+ useGlobalStylesReset
105
+ } = (0, _experiments.unlock)(_blockEditor.experiments);
106
+ const [canReset, onReset] = useGlobalStylesReset();
107
+ const {
108
+ goTo
109
+ } = (0, _components.__experimentalUseNavigator)();
110
+
111
+ const loadCustomCSS = () => goTo('/css');
112
+
113
+ return (0, _element.createElement)(GlobalStylesMenuFill, null, (0, _element.createElement)(_components.DropdownMenu, {
114
+ icon: _icons.moreVertical,
115
+ label: (0, _i18n.__)('More Styles actions'),
116
+ controls: [{
117
+ title: (0, _i18n.__)('Reset to defaults'),
118
+ onClick: onReset,
119
+ isDisabled: !canReset
120
+ }, {
121
+ title: (0, _i18n.__)('Welcome Guide'),
122
+ onClick: () => toggle('core/edit-site', 'welcomeGuideStyles')
123
+ }, ...(canEditCSS ? [{
124
+ title: (0, _i18n.__)('Additional CSS'),
125
+ onClick: loadCustomCSS
126
+ }] : [])]
127
+ }));
128
+ }
129
+
63
130
  function GlobalStylesNavigationScreen(_ref) {
64
131
  let {
65
132
  className,
@@ -88,43 +155,43 @@ function BlockStyleVariationsScreens(_ref2) {
88
155
  return blockStyleVariations.map(variation => (0, _element.createElement)(ContextScreens, {
89
156
  key: variation.name + name,
90
157
  name: name,
91
- parentMenu: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(variation.name)
158
+ parentMenu: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(variation.name),
159
+ variation: variation.name
92
160
  }));
93
161
  }
94
162
 
95
- function ContextScreens(_ref3) {
163
+ function BlockStylesNavigationScreens(_ref3) {
96
164
  let {
97
- name,
98
- parentMenu = ''
165
+ parentMenu,
166
+ blockStyles,
167
+ blockName
99
168
  } = _ref3;
100
- const hasVariationPath = parentMenu.search('variations');
101
- const variationPath = hasVariationPath !== -1 ? parentMenu.substring(hasVariationPath).replace('/', '.').concat('', '.') : '';
169
+ return blockStyles.map((style, index) => (0, _element.createElement)(GlobalStylesNavigationScreen, {
170
+ key: index,
171
+ path: parentMenu + '/variations/' + style.name
172
+ }, (0, _element.createElement)(_screenVariations.ScreenVariation, {
173
+ blockName: blockName,
174
+ style: style
175
+ })));
176
+ }
177
+
178
+ function ContextScreens(_ref4) {
179
+ let {
180
+ name,
181
+ parentMenu = '',
182
+ variation = ''
183
+ } = _ref4;
102
184
  const blockStyleVariations = (0, _data.useSelect)(select => {
103
185
  const {
104
186
  getBlockStyles
105
187
  } = select(_blocks.store);
106
188
  return getBlockStyles(name);
107
189
  }, [name]);
108
-
109
- const BlockStylesNavigationScreens = _ref4 => {
110
- let {
111
- blockStyles,
112
- blockName
113
- } = _ref4;
114
- return blockStyles.map((style, index) => (0, _element.createElement)(GlobalStylesNavigationScreen, {
115
- key: index,
116
- path: parentMenu + '/variations/' + style.name
117
- }, (0, _element.createElement)(_screenVariations.ScreenVariation, {
118
- blockName: blockName,
119
- style: style
120
- })));
121
- };
122
-
123
190
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(GlobalStylesNavigationScreen, {
124
191
  path: parentMenu + '/typography'
125
192
  }, (0, _element.createElement)(_screenTypography.default, {
126
193
  name: name,
127
- variationPath: variationPath
194
+ variation: variation
128
195
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
129
196
  path: parentMenu + '/typography/text'
130
197
  }, (0, _element.createElement)(_screenTypographyElement.default, {
@@ -149,7 +216,7 @@ function ContextScreens(_ref3) {
149
216
  path: parentMenu + '/colors'
150
217
  }, (0, _element.createElement)(_screenColors.default, {
151
218
  name: name,
152
- variationPath: variationPath
219
+ variation: variation
153
220
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
154
221
  path: parentMenu + '/colors/palette'
155
222
  }, (0, _element.createElement)(_screenColorPalette.default, {
@@ -158,38 +225,43 @@ function ContextScreens(_ref3) {
158
225
  path: parentMenu + '/colors/background'
159
226
  }, (0, _element.createElement)(_screenBackgroundColor.default, {
160
227
  name: name,
161
- variationPath: variationPath
228
+ variation: variation
162
229
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
163
230
  path: parentMenu + '/colors/text'
164
231
  }, (0, _element.createElement)(_screenTextColor.default, {
165
232
  name: name,
166
- variationPath: variationPath
233
+ variation: variation
167
234
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
168
235
  path: parentMenu + '/colors/link'
169
236
  }, (0, _element.createElement)(_screenLinkColor.default, {
170
237
  name: name,
171
- variationPath: variationPath
238
+ variation: variation
172
239
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
173
240
  path: parentMenu + '/colors/heading'
174
241
  }, (0, _element.createElement)(_screenHeadingColor.default, {
175
242
  name: name,
176
- variationPath: variationPath
243
+ variation: variation
177
244
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
178
245
  path: parentMenu + '/colors/button'
179
246
  }, (0, _element.createElement)(_screenButtonColor.default, {
180
247
  name: name,
181
- variationPath: variationPath
248
+ variation: variation
182
249
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
183
250
  path: parentMenu + '/border'
184
251
  }, (0, _element.createElement)(_screenBorder.default, {
185
252
  name: name,
186
- variationPath: variationPath
253
+ variation: variation
187
254
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
188
255
  path: parentMenu + '/layout'
189
256
  }, (0, _element.createElement)(_screenLayout.default, {
190
257
  name: name,
191
- variationPath: variationPath
258
+ variation: variation
259
+ })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
260
+ path: parentMenu + '/css'
261
+ }, (0, _element.createElement)(_screenCss.default, {
262
+ name: name
192
263
  })), !!(blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length) && (0, _element.createElement)(BlockStylesNavigationScreens, {
264
+ parentMenu: parentMenu,
193
265
  blockStyles: blockStyleVariations,
194
266
  blockName: name
195
267
  }));
@@ -254,9 +326,7 @@ function GlobalStylesUI(_ref6) {
254
326
  });
255
327
  }), isStyleBookOpened && (0, _element.createElement)(GlobalStylesStyleBook, {
256
328
  onClose: onCloseStyleBook
257
- }), (0, _element.createElement)(GlobalStylesNavigationScreen, {
258
- path: "/css"
259
- }, (0, _element.createElement)(_screenCss.default, null)));
329
+ }), (0, _element.createElement)(GlobalStylesActionMenu, null));
260
330
  }
261
331
 
262
332
  var _default = GlobalStylesUI;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["GlobalStylesNavigationScreen","className","props","filter","Boolean","join","BlockStyleVariationsScreens","name","blockStyleVariations","select","getBlockStyles","blocksStore","length","map","variation","encodeURIComponent","ContextScreens","parentMenu","hasVariationPath","search","variationPath","substring","replace","concat","BlockStylesNavigationScreens","blockStyles","blockName","style","index","GlobalStylesStyleBook","onClose","navigator","path","location","startsWith","depth","match","i","goBack","goTo","GlobalStylesUI","isStyleBookOpened","onCloseStyleBook","blocks","block"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhCA;AACA;AACA;;AAUA;AACA;AACA;AAoBA,SAASA,4BAAT,OAAiE;AAAA,MAA1B;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAA0B;AAChE,SACC,4BAAC,yCAAD;AACC,IAAA,SAAS,EAAG,CACX,mDADW,EAEXD,SAFW,EAIVE,MAJU,CAIFC,OAJE,EAKVC,IALU,CAKJ,GALI;AADb,KAOMH,KAPN,EADD;AAWA;;AAED,SAASI,2BAAT,QAAiD;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAChD,QAAMC,oBAAoB,GAAG,qBAC1BC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAqBD,MAAM,CAAEE,aAAF,CAAjC;AACA,WAAOD,cAAc,CAAEH,IAAF,CAArB;AACA,GAJ2B,EAK5B,CAAEA,IAAF,CAL4B,CAA7B;;AAOA,MAAK,EAAEC,oBAAF,aAAEA,oBAAF,eAAEA,oBAAoB,CAAEI,MAAxB,CAAL,EAAsC;AACrC,WAAO,IAAP;AACA;;AAED,SAAOJ,oBAAoB,CAACK,GAArB,CAA4BC,SAAF,IAChC,4BAAC,cAAD;AAC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;AAEC,IAAA,IAAI,EAAG,aAAaQ,kBAAkB,CAAE6B,KAAK,CAACrC,IAAR;AAFvC,KAIC,4BAAC,oBAAD;AAAa,IAAA,IAAI,EAAGqC,KAAK,CAACrC;AAA1B,IAJD,CADC,CAhBH,EAyBC,4BAAC,cAAD,OAzBD,EA2BGoC,MAAM,CAAC9B,GAAP,CAAc+B,KAAF,IACb,4BAAC,cAAD;AACC,IAAA,GAAG,EAAG,mBAAmBA,KAAK,CAACrC,IADhC;AAEC,IAAA,IAAI,EAAGqC,KAAK,CAACrC,IAFd;AAGC,IAAA,UAAU,EAAG,aAAaQ,kBAAkB,CAAE6B,KAAK,CAACrC,IAAR;AAH7C,IADC,CA3BH,EAmCGoC,MAAM,CAAC9B,GAAP,CAAY,CAAE+B,KAAF,EAAShB,KAAT,KAAoB;AACjC,WACC,4BAAC,2BAAD;AACC,MAAA,GAAG,EAAG,0BAA0BgB,KAAK,CAACrC,IAAhC,GAAuCqB,KAD9C;AAEC,MAAA,IAAI,EAAGgB,KAAK,CAACrC;AAFd,MADD;AAMA,GAPC,CAnCH,EA2CGkC,iBAAiB,IAClB,4BAAC,qBAAD;AAAuB,IAAA,OAAO,EAAGC;AAAjC,IA5CF,EA8CC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,kBAAD,OADD,CA9CD,CADD;AAoDA;;eAEcF,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackgroundColor from './screen-background-color';\nimport ScreenTextColor from './screen-text-color';\nimport ScreenLinkColor from './screen-link-color';\nimport ScreenHeadingColor from './screen-heading-color';\nimport ScreenButtonColor from './screen-button-color';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport { ScreenVariation } from './screen-variations';\nimport ScreenBorder from './screen-border';\nimport StyleBook from '../style-book';\nimport ScreenCSS from './screen-css';\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction BlockStyleVariationsScreens( { name } ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tif ( ! blockStyleVariations?.length ) {\n\t\treturn null;\n\t}\n\n\treturn blockStyleVariations.map( ( variation ) => (\n\t\t<ContextScreens\n\t\t\tkey={ variation.name + name }\n\t\t\tname={ name }\n\t\t\tparentMenu={\n\t\t\t\t'/blocks/' +\n\t\t\t\tencodeURIComponent( name ) +\n\t\t\t\t'/variations/' +\n\t\t\t\tencodeURIComponent( variation.name )\n\t\t\t}\n\t\t/>\n\t) );\n}\n\nfunction ContextScreens( { name, parentMenu = '' } ) {\n\tconst hasVariationPath = parentMenu.search( 'variations' );\n\tconst variationPath =\n\t\thasVariationPath !== -1\n\t\t\t? parentMenu\n\t\t\t\t\t.substring( hasVariationPath )\n\t\t\t\t\t.replace( '/', '.' )\n\t\t\t\t\t.concat( '', '.' )\n\t\t\t: '';\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\n\tconst BlockStylesNavigationScreens = ( { blockStyles, blockName } ) => {\n\t\treturn blockStyles.map( ( style, index ) => (\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tkey={ index }\n\t\t\t\tpath={ parentMenu + '/variations/' + style.name }\n\t\t\t>\n\t\t\t\t<ScreenVariation blockName={ blockName } style={ style } />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t) );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/text' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/link' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/heading' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"heading\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/button' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"button\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/background' }\n\t\t\t>\n\t\t\t\t<ScreenBackgroundColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/heading' }\n\t\t\t>\n\t\t\t\t<ScreenHeadingColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/button' }\n\t\t\t>\n\t\t\t\t<ScreenButtonColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>\n\t\t\t\t<ScreenBorder name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ !! blockStyleVariations?.length && (\n\t\t\t\t<BlockStylesNavigationScreens\n\t\t\t\t\tblockStyles={ blockStyleVariations }\n\t\t\t\t\tblockName={ name }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesStyleBook( { onClose } ) {\n\tconst navigator = useNavigator();\n\tconst { path } = navigator.location;\n\treturn (\n\t\t<StyleBook\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t// Clear navigator history by going back to the root.\n\t\t\t\tconst depth = path.match( /\\//g ).length;\n\t\t\t\tfor ( let i = 0; i < depth; i++ ) {\n\t\t\t\t\tnavigator.goBack();\n\t\t\t\t}\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tnavigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n\nfunction GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {\n\tconst blocks = getBlockTypes();\n\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/variations\">\n\t\t\t\t<ScreenStyleVariations />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t\tparentMenu={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t/>\n\t\t\t) ) }\n\n\t\t\t{ blocks.map( ( block, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockStyleVariationsScreens\n\t\t\t\t\t\tkey={ 'screens-block-styles-' + block.name + index }\n\t\t\t\t\t\tname={ block.name }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ isStyleBookOpened && (\n\t\t\t\t<GlobalStylesStyleBook onClose={ onCloseStyleBook } />\n\t\t\t) }\n\t\t\t<GlobalStylesNavigationScreen path=\"/css\">\n\t\t\t\t<ScreenCSS />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t</NavigatorProvider>\n\t);\n}\n\nexport default GlobalStylesUI;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["SLOT_FILL_NAME","Slot","GlobalStylesMenuSlot","Fill","GlobalStylesMenuFill","GlobalStylesActionMenu","toggle","preferencesStore","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","undefined","_links","useGlobalStylesReset","blockEditorExperiments","canReset","onReset","goTo","loadCustomCSS","moreVertical","title","onClick","isDisabled","GlobalStylesNavigationScreen","className","props","filter","Boolean","join","BlockStyleVariationsScreens","name","blockStyleVariations","getBlockStyles","blocksStore","length","map","variation","encodeURIComponent","BlockStylesNavigationScreens","parentMenu","blockStyles","blockName","style","index","ContextScreens","GlobalStylesStyleBook","onClose","navigator","path","location","startsWith","depth","match","i","goBack","GlobalStylesUI","isStyleBookOpened","onCloseStyleBook","blocks","block"],"mappings":";;;;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAgBA;AACA;AACA;AAqBA,MAAMA,cAAc,GAAG,kBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,oBAAR;AAA8BC,EAAAA,IAAI,EAAEC;AAApC,IACL,gCAAgBJ,cAAhB,CADD;;;AAGA,SAASK,sBAAT,GAAkC;AACjC,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBAAaC,MAAF,IAAc;AAAA;;AAC/C,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QACLF,MAAM,CAAEG,eAAF,CADP;;AAGA,UAAMC,cAAc,GAAGF,sCAAsC,EAA7D;;AACA,UAAMG,YAAY,GAAGD,cAAc,GAChCH,eAAe,CAAE,MAAF,EAAU,cAAV,EAA0BG,cAA1B,CADiB,GAEhCE,SAFH;AAIA,WAAO;AACNP,MAAAA,UAAU,2BACT,CAAC,EAAEM,YAAF,aAAEA,YAAF,uCAAEA,YAAY,CAAEE,MAAhB,iDAAE,qBAAwB,oBAAxB,CAAF,CADQ,yEAC4C;AAFhD,KAAP;AAIA,GAbsB,EAapB,EAboB,CAAvB;AAcA,QAAM;AAAEC,IAAAA;AAA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AAC;AAAnC,KACC,4BAAC,8BAAD,OADD,CARD,EAYC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,wBAAD,OADD,CAZD,EAgBGA,MAAM,CAACvB,GAAP,CAAcwB,KAAF,IACb,4BAAC,4BAAD;AACC,IAAA,GAAG,EAAG,gBAAgBA,KAAK,CAAC7B,IAD7B;AAEC,IAAA,IAAI,EAAG,aAAaO,kBAAkB,CAAEsB,KAAK,CAAC7B,IAAR;AAFvC,KAIC,4BAAC,oBAAD;AAAa,IAAA,IAAI,EAAG6B,KAAK,CAAC7B;AAA1B,IAJD,CADC,CAhBH,EAyBC,4BAAC,cAAD,OAzBD,EA2BG4B,MAAM,CAACvB,GAAP,CAAcwB,KAAF,IACb,4BAAC,cAAD;AACC,IAAA,GAAG,EAAG,mBAAmBA,KAAK,CAAC7B,IADhC;AAEC,IAAA,IAAI,EAAG6B,KAAK,CAAC7B,IAFd;AAGC,IAAA,UAAU,EAAG,aAAaO,kBAAkB,CAAEsB,KAAK,CAAC7B,IAAR;AAH7C,IADC,CA3BH,EAmCG4B,MAAM,CAACvB,GAAP,CAAY,CAAEwB,KAAF,EAAShB,KAAT,KAAoB;AACjC,WACC,4BAAC,2BAAD;AACC,MAAA,GAAG,EAAG,0BAA0BgB,KAAK,CAAC7B,IAAhC,GAAuCa,KAD9C;AAEC,MAAA,IAAI,EAAGgB,KAAK,CAAC7B;AAFd,MADD;AAMA,GAPC,CAnCH,EA2CG0B,iBAAiB,IAClB,4BAAC,qBAAD;AAAuB,IAAA,OAAO,EAAGC;AAAjC,IA5CF,EA+CC,4BAAC,sBAAD,OA/CD,CADD;AAmDA;;eAEcF,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n\tcreateSlotFill,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { experiments as blockEditorExperiments } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackgroundColor from './screen-background-color';\nimport ScreenTextColor from './screen-text-color';\nimport ScreenLinkColor from './screen-link-color';\nimport ScreenHeadingColor from './screen-heading-color';\nimport ScreenButtonColor from './screen-button-color';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport { ScreenVariation } from './screen-variations';\nimport ScreenBorder from './screen-border';\nimport StyleBook from '../style-book';\nimport ScreenCSS from './screen-css';\nimport { unlock } from '../../experiments';\n\nconst SLOT_FILL_NAME = 'GlobalStylesMenu';\nconst { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\nfunction GlobalStylesActionMenu() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\tconst { useGlobalStylesReset } = unlock( blockEditorExperiments );\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { goTo } = useNavigator();\n\tconst loadCustomCSS = () => goTo( '/css' );\n\treturn (\n\t\t<GlobalStylesMenuFill>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More Styles actions' ) }\n\t\t\t\tcontrols={ [\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\tonClick: onReset,\n\t\t\t\t\t\tisDisabled: ! canReset,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideStyles' ),\n\t\t\t\t\t},\n\t\t\t\t\t...( canEditCSS\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Additional CSS' ),\n\t\t\t\t\t\t\t\t\tonClick: loadCustomCSS,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: [] ),\n\t\t\t\t] }\n\t\t\t/>\n\t\t</GlobalStylesMenuFill>\n\t);\n}\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction BlockStyleVariationsScreens( { name } ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tif ( ! blockStyleVariations?.length ) {\n\t\treturn null;\n\t}\n\n\treturn blockStyleVariations.map( ( variation ) => (\n\t\t<ContextScreens\n\t\t\tkey={ variation.name + name }\n\t\t\tname={ name }\n\t\t\tparentMenu={\n\t\t\t\t'/blocks/' +\n\t\t\t\tencodeURIComponent( name ) +\n\t\t\t\t'/variations/' +\n\t\t\t\tencodeURIComponent( variation.name )\n\t\t\t}\n\t\t\tvariation={ variation.name }\n\t\t/>\n\t) );\n}\n\nfunction BlockStylesNavigationScreens( {\n\tparentMenu,\n\tblockStyles,\n\tblockName,\n} ) {\n\treturn blockStyles.map( ( style, index ) => (\n\t\t<GlobalStylesNavigationScreen\n\t\t\tkey={ index }\n\t\t\tpath={ parentMenu + '/variations/' + style.name }\n\t\t>\n\t\t\t<ScreenVariation blockName={ blockName } style={ style } />\n\t\t</GlobalStylesNavigationScreen>\n\t) );\n}\n\nfunction ContextScreens( { name, parentMenu = '', variation = '' } ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/text' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/link' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/heading' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"heading\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/button' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"button\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/background' }\n\t\t\t>\n\t\t\t\t<ScreenBackgroundColor name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/heading' }\n\t\t\t>\n\t\t\t\t<ScreenHeadingColor name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/button' }\n\t\t\t>\n\t\t\t\t<ScreenButtonColor name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>\n\t\t\t\t<ScreenBorder name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/css' }>\n\t\t\t\t<ScreenCSS name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ !! blockStyleVariations?.length && (\n\t\t\t\t<BlockStylesNavigationScreens\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\tblockStyles={ blockStyleVariations }\n\t\t\t\t\tblockName={ name }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesStyleBook( { onClose } ) {\n\tconst navigator = useNavigator();\n\tconst { path } = navigator.location;\n\treturn (\n\t\t<StyleBook\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t// Clear navigator history by going back to the root.\n\t\t\t\tconst depth = path.match( /\\//g ).length;\n\t\t\t\tfor ( let i = 0; i < depth; i++ ) {\n\t\t\t\t\tnavigator.goBack();\n\t\t\t\t}\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tnavigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n\nfunction GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {\n\tconst blocks = getBlockTypes();\n\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/variations\">\n\t\t\t\t<ScreenStyleVariations />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t\tparentMenu={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t/>\n\t\t\t) ) }\n\n\t\t\t{ blocks.map( ( block, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockStyleVariationsScreens\n\t\t\t\t\t\tkey={ 'screens-block-styles-' + block.name + index }\n\t\t\t\t\t\tname={ block.name }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ isStyleBookOpened && (\n\t\t\t\t<GlobalStylesStyleBook onClose={ onCloseStyleBook } />\n\t\t\t) }\n\n\t\t\t<GlobalStylesActionMenu />\n\t\t</NavigatorProvider>\n\t);\n}\nexport { GlobalStylesMenuSlot };\nexport default GlobalStylesUI;\n"]}
@@ -3,348 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = exports.STYLE_PATH_TO_CSS_VAR_INFIX = exports.ROOT_BLOCK_SUPPORTS = exports.ROOT_BLOCK_SELECTOR = exports.ROOT_BLOCK_NAME = exports.PRESET_METADATA = void 0;
7
- exports.getPresetVariableFromValue = getPresetVariableFromValue;
8
- exports.getValueFromVariable = getValueFromVariable;
9
- exports.getVariationClassNameFromPath = getVariationClassNameFromPath;
10
- exports.scopeSelector = scopeSelector;
11
-
12
- var _lodash = require("lodash");
13
-
14
- var _typographyUtils = require("./typography-utils");
15
-
16
- /**
17
- * External dependencies
18
- */
6
+ exports.getVariationClassName = getVariationClassName;
19
7
 
20
8
  /**
21
- * Internal dependencies
22
- */
23
-
24
- /* Supporting data. */
25
- const ROOT_BLOCK_NAME = 'root';
26
- exports.ROOT_BLOCK_NAME = ROOT_BLOCK_NAME;
27
- const ROOT_BLOCK_SELECTOR = 'body';
28
- exports.ROOT_BLOCK_SELECTOR = ROOT_BLOCK_SELECTOR;
29
- const ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'buttonColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding'];
30
- exports.ROOT_BLOCK_SUPPORTS = ROOT_BLOCK_SUPPORTS;
31
- const PRESET_METADATA = [{
32
- path: ['color', 'palette'],
33
- valueKey: 'color',
34
- cssVarInfix: 'color',
35
- classes: [{
36
- classSuffix: 'color',
37
- propertyName: 'color'
38
- }, {
39
- classSuffix: 'background-color',
40
- propertyName: 'background-color'
41
- }, {
42
- classSuffix: 'border-color',
43
- propertyName: 'border-color'
44
- }]
45
- }, {
46
- path: ['color', 'gradients'],
47
- valueKey: 'gradient',
48
- cssVarInfix: 'gradient',
49
- classes: [{
50
- classSuffix: 'gradient-background',
51
- propertyName: 'background'
52
- }]
53
- }, {
54
- path: ['color', 'duotone'],
55
- cssVarInfix: 'duotone',
56
- valueFunc: _ref => {
57
- let {
58
- slug
59
- } = _ref;
60
- return `url( '#wp-duotone-${slug}' )`;
61
- },
62
- classes: []
63
- }, {
64
- path: ['typography', 'fontSizes'],
65
- valueFunc: (preset, _ref2) => {
66
- let {
67
- typography: typographySettings
68
- } = _ref2;
69
- return (0, _typographyUtils.getTypographyFontSizeValue)(preset, typographySettings);
70
- },
71
- valueKey: 'size',
72
- cssVarInfix: 'font-size',
73
- classes: [{
74
- classSuffix: 'font-size',
75
- propertyName: 'font-size'
76
- }]
77
- }, {
78
- path: ['typography', 'fontFamilies'],
79
- valueKey: 'fontFamily',
80
- cssVarInfix: 'font-family',
81
- classes: [{
82
- classSuffix: 'font-family',
83
- propertyName: 'font-family'
84
- }]
85
- }, {
86
- path: ['spacing', 'spacingSizes'],
87
- valueKey: 'size',
88
- cssVarInfix: 'spacing',
89
- valueFunc: _ref3 => {
90
- let {
91
- size
92
- } = _ref3;
93
- return size;
94
- },
95
- classes: []
96
- }];
97
- exports.PRESET_METADATA = PRESET_METADATA;
98
- const STYLE_PATH_TO_CSS_VAR_INFIX = {
99
- 'color.background': 'color',
100
- 'color.text': 'color',
101
- 'elements.link.color.text': 'color',
102
- 'elements.link.:hover.color.text': 'color',
103
- 'elements.link.typography.fontFamily': 'font-family',
104
- 'elements.link.typography.fontSize': 'font-size',
105
- 'elements.button.color.text': 'color',
106
- 'elements.button.color.background': 'color',
107
- 'elements.button.typography.fontFamily': 'font-family',
108
- 'elements.button.typography.fontSize': 'font-size',
109
- 'elements.heading.color': 'color',
110
- 'elements.heading.color.background': 'color',
111
- 'elements.heading.typography.fontFamily': 'font-family',
112
- 'elements.heading.gradient': 'gradient',
113
- 'elements.heading.color.gradient': 'gradient',
114
- 'elements.h1.color': 'color',
115
- 'elements.h1.color.background': 'color',
116
- 'elements.h1.typography.fontFamily': 'font-family',
117
- 'elements.h1.color.gradient': 'gradient',
118
- 'elements.h2.color': 'color',
119
- 'elements.h2.color.background': 'color',
120
- 'elements.h2.typography.fontFamily': 'font-family',
121
- 'elements.h2.color.gradient': 'gradient',
122
- 'elements.h3.color': 'color',
123
- 'elements.h3.color.background': 'color',
124
- 'elements.h3.typography.fontFamily': 'font-family',
125
- 'elements.h3.color.gradient': 'gradient',
126
- 'elements.h4.color': 'color',
127
- 'elements.h4.color.background': 'color',
128
- 'elements.h4.typography.fontFamily': 'font-family',
129
- 'elements.h4.color.gradient': 'gradient',
130
- 'elements.h5.color': 'color',
131
- 'elements.h5.color.background': 'color',
132
- 'elements.h5.typography.fontFamily': 'font-family',
133
- 'elements.h5.color.gradient': 'gradient',
134
- 'elements.h6.color': 'color',
135
- 'elements.h6.color.background': 'color',
136
- 'elements.h6.typography.fontFamily': 'font-family',
137
- 'elements.h6.color.gradient': 'gradient',
138
- 'color.gradient': 'gradient',
139
- 'typography.fontSize': 'font-size',
140
- 'typography.fontFamily': 'font-family'
141
- }; // A static list of block attributes that store global style preset slugs.
142
-
143
- exports.STYLE_PATH_TO_CSS_VAR_INFIX = STYLE_PATH_TO_CSS_VAR_INFIX;
144
- const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
145
- 'color.background': 'backgroundColor',
146
- 'color.text': 'textColor',
147
- 'color.gradient': 'gradient',
148
- 'typography.fontSize': 'fontSize',
149
- 'typography.fontFamily': 'fontFamily'
150
- };
151
- exports.STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE;
152
-
153
- function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) {
154
- // Block presets take priority above root level presets.
155
- const orderedPresetsByOrigin = [(0, _lodash.get)(features, ['blocks', blockName, ...presetPath]), (0, _lodash.get)(features, presetPath)];
156
-
157
- for (const presetByOrigin of orderedPresetsByOrigin) {
158
- if (presetByOrigin) {
159
- // Preset origins ordered by priority.
160
- const origins = ['custom', 'theme', 'default'];
161
-
162
- for (const origin of origins) {
163
- const presets = presetByOrigin[origin];
164
-
165
- if (presets) {
166
- const presetObject = presets.find(preset => preset[presetProperty] === presetValueValue);
167
-
168
- if (presetObject) {
169
- if (presetProperty === 'slug') {
170
- return presetObject;
171
- } // If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.
172
-
173
-
174
- const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug);
175
-
176
- if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) {
177
- return presetObject;
178
- }
179
-
180
- return undefined;
181
- }
182
- }
183
- }
184
- }
185
- }
186
- }
187
-
188
- function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) {
189
- if (!presetPropertyValue) {
190
- return presetPropertyValue;
191
- }
192
-
193
- const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath];
194
- const metadata = PRESET_METADATA.find(data => data.cssVarInfix === cssVarInfix);
195
-
196
- if (!metadata) {
197
- // The property doesn't have preset data
198
- // so the value should be returned as it is.
199
- return presetPropertyValue;
200
- }
201
-
202
- const {
203
- valueKey,
204
- path
205
- } = metadata;
206
- const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue);
207
-
208
- if (!presetObject) {
209
- // Value wasn't found in the presets,
210
- // so it must be a custom value.
211
- return presetPropertyValue;
212
- }
213
-
214
- return `var:preset|${cssVarInfix}|${presetObject.slug}`;
215
- }
216
-
217
- function getValueFromPresetVariable(features, blockName, variable, _ref4) {
218
- let [presetType, slug] = _ref4;
219
- const metadata = PRESET_METADATA.find(data => data.cssVarInfix === presetType);
220
-
221
- if (!metadata) {
222
- return variable;
223
- }
224
-
225
- const presetObject = findInPresetsBy(features.settings, blockName, metadata.path, 'slug', slug);
226
-
227
- if (presetObject) {
228
- const {
229
- valueKey
230
- } = metadata;
231
- const result = presetObject[valueKey];
232
- return getValueFromVariable(features, blockName, result);
233
- }
234
-
235
- return variable;
236
- }
237
-
238
- function getValueFromCustomVariable(features, blockName, variable, path) {
239
- var _get;
240
-
241
- const result = (_get = (0, _lodash.get)(features.settings, ['blocks', blockName, 'custom', ...path])) !== null && _get !== void 0 ? _get : (0, _lodash.get)(features.settings, ['custom', ...path]);
242
-
243
- if (!result) {
244
- return variable;
245
- } // A variable may reference another variable so we need recursion until we find the value.
246
-
247
-
248
- return getValueFromVariable(features, blockName, result);
249
- }
250
- /**
251
- * Attempts to fetch the value of a theme.json CSS variable.
252
- *
253
- * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.
254
- * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.
255
- * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.
256
- * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.
257
- */
258
-
259
-
260
- function getValueFromVariable(features, blockName, variable) {
261
- if (!variable || typeof variable !== 'string') {
262
- var _variable, _variable2;
263
-
264
- if ((_variable = variable) !== null && _variable !== void 0 && _variable.ref && typeof ((_variable2 = variable) === null || _variable2 === void 0 ? void 0 : _variable2.ref) === 'string') {
265
- var _variable3;
266
-
267
- const refPath = variable.ref.split('.');
268
- variable = (0, _lodash.get)(features, refPath); // Presence of another ref indicates a reference to another dynamic value.
269
- // Pointing to another dynamic value is not supported.
270
-
271
- if (!variable || !!((_variable3 = variable) !== null && _variable3 !== void 0 && _variable3.ref)) {
272
- return variable;
273
- }
274
- } else {
275
- return variable;
276
- }
277
- }
278
-
279
- const USER_VALUE_PREFIX = 'var:';
280
- const THEME_VALUE_PREFIX = 'var(--wp--';
281
- const THEME_VALUE_SUFFIX = ')';
282
- let parsedVar;
283
-
284
- if (variable.startsWith(USER_VALUE_PREFIX)) {
285
- parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|');
286
- } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) {
287
- parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--');
288
- } else {
289
- // We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`
290
- return variable;
291
- }
292
-
293
- const [type, ...path] = parsedVar;
294
-
295
- if (type === 'preset') {
296
- return getValueFromPresetVariable(features, blockName, variable, path);
297
- }
298
-
299
- if (type === 'custom') {
300
- return getValueFromCustomVariable(features, blockName, variable, path);
301
- }
302
-
303
- return variable;
304
- }
305
- /**
306
- * Function that scopes a selector with another one. This works a bit like
307
- * SCSS nesting except the `&` operator isn't supported.
308
- *
309
- * @example
310
- * ```js
311
- * const scope = '.a, .b .c';
312
- * const selector = '> .x, .y';
313
- * const merged = scopeSelector( scope, selector );
314
- * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'
315
- * ```
316
9
  *
317
- * @param {string} scope Selector to scope to.
318
- * @param {string} selector Original selector.
319
- *
320
- * @return {string} Scoped selector.
321
- */
322
-
323
-
324
- function scopeSelector(scope, selector) {
325
- const scopes = scope.split(',');
326
- const selectors = selector.split(',');
327
- const selectorsScoped = [];
328
- scopes.forEach(outer => {
329
- selectors.forEach(inner => {
330
- selectorsScoped.push(`${outer.trim()} ${inner.trim()}`);
331
- });
332
- });
333
- return selectorsScoped.join(', ');
334
- }
335
- /**
336
- *
337
- * @param {string} path The variation path in the Global Styles tree.
10
+ * @param {string} variation The variation name.
338
11
  *
339
12
  * @return {string} The variation class name.
340
13
  */
341
-
342
-
343
- function getVariationClassNameFromPath(path) {
344
- if (!path) {
14
+ function getVariationClassName(variation) {
15
+ if (!variation) {
345
16
  return '';
346
17
  }
347
18
 
348
- return `is-style-${path.split('.')[1]}`;
19
+ return `is-style-${variation}`;
349
20
  }
350
21
  //# sourceMappingURL=utils.js.map