@wordpress/edit-site 5.2.0 → 5.3.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 (374) 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 +5 -29
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/utils.js +1 -9
  9. package/build/components/add-new-template/utils.js.map +1 -1
  10. package/build/components/app/index.js +2 -7
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/index.js +13 -11
  13. package/build/components/block-editor/index.js.map +1 -1
  14. package/build/components/block-editor/inserter-media-categories.js +237 -0
  15. package/build/components/block-editor/inserter-media-categories.js.map +1 -0
  16. package/build/components/canvas-spinner/index.js +20 -0
  17. package/build/components/canvas-spinner/index.js.map +1 -0
  18. package/build/components/create-template-part-modal/index.js +4 -2
  19. package/build/components/create-template-part-modal/index.js.map +1 -1
  20. package/build/components/editor/index.js +4 -2
  21. package/build/components/editor/index.js.map +1 -1
  22. package/build/components/error-boundary/index.js +2 -12
  23. package/build/components/error-boundary/index.js.map +1 -1
  24. package/build/components/error-boundary/warning.js +5 -28
  25. package/build/components/error-boundary/warning.js.map +1 -1
  26. package/build/components/global-styles/block-preview-panel.js +2 -2
  27. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  28. package/build/components/global-styles/border-panel.js +17 -9
  29. package/build/components/global-styles/border-panel.js.map +1 -1
  30. package/build/components/global-styles/color-palette-panel.js +13 -7
  31. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  32. package/build/components/global-styles/context-menu.js +39 -4
  33. package/build/components/global-styles/context-menu.js.map +1 -1
  34. package/build/components/global-styles/custom-css.js +65 -14
  35. package/build/components/global-styles/custom-css.js.map +1 -1
  36. package/build/components/global-styles/dimensions-panel.js +49 -31
  37. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  38. package/build/components/global-styles/global-styles-provider.js +13 -3
  39. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  40. package/build/components/global-styles/gradients-palette-panel.js +17 -11
  41. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  42. package/build/components/global-styles/hooks.js +21 -142
  43. package/build/components/global-styles/hooks.js.map +1 -1
  44. package/build/components/global-styles/index.js +0 -28
  45. package/build/components/global-styles/index.js.map +1 -1
  46. package/build/components/global-styles/palette.js +11 -4
  47. package/build/components/global-styles/palette.js.map +1 -1
  48. package/build/components/global-styles/preview.js +18 -15
  49. package/build/components/global-styles/preview.js.map +1 -1
  50. package/build/components/global-styles/screen-background-color.js +27 -13
  51. package/build/components/global-styles/screen-background-color.js.map +1 -1
  52. package/build/components/global-styles/screen-border.js +10 -4
  53. package/build/components/global-styles/screen-border.js.map +1 -1
  54. package/build/components/global-styles/screen-button-color.js +16 -9
  55. package/build/components/global-styles/screen-button-color.js.map +1 -1
  56. package/build/components/global-styles/screen-colors.js +43 -34
  57. package/build/components/global-styles/screen-colors.js.map +1 -1
  58. package/build/components/global-styles/screen-css.js +20 -8
  59. package/build/components/global-styles/screen-css.js.map +1 -1
  60. package/build/components/global-styles/screen-heading-color.js +23 -16
  61. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  62. package/build/components/global-styles/screen-layout.js +3 -3
  63. package/build/components/global-styles/screen-layout.js.map +1 -1
  64. package/build/components/global-styles/screen-link-color.js +18 -11
  65. package/build/components/global-styles/screen-link-color.js.map +1 -1
  66. package/build/components/global-styles/screen-root.js +25 -9
  67. package/build/components/global-styles/screen-root.js.map +1 -1
  68. package/build/components/global-styles/screen-style-variations.js +8 -4
  69. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  70. package/build/components/global-styles/screen-text-color.js +14 -7
  71. package/build/components/global-styles/screen-text-color.js.map +1 -1
  72. package/build/components/global-styles/screen-typography.js +18 -12
  73. package/build/components/global-styles/screen-typography.js.map +1 -1
  74. package/build/components/global-styles/shadow-panel.js +196 -0
  75. package/build/components/global-styles/shadow-panel.js.map +1 -0
  76. package/build/components/global-styles/typography-panel.js +43 -29
  77. package/build/components/global-styles/typography-panel.js.map +1 -1
  78. package/build/components/global-styles/typography-preview.js +19 -9
  79. package/build/components/global-styles/typography-preview.js.map +1 -1
  80. package/build/components/global-styles/ui.js +85 -34
  81. package/build/components/global-styles/ui.js.map +1 -1
  82. package/build/components/global-styles/utils.js +5 -334
  83. package/build/components/global-styles/utils.js.map +1 -1
  84. package/build/components/global-styles-renderer/index.js +7 -5
  85. package/build/components/global-styles-renderer/index.js.map +1 -1
  86. package/build/components/header-edit-mode/document-actions/index.js +2 -2
  87. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  88. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  89. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  90. package/build/components/layout/index.js +6 -8
  91. package/build/components/layout/index.js.map +1 -1
  92. package/build/components/list/actions/rename-menu-item.js +8 -11
  93. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  94. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -2
  95. package/build/components/navigation-inspector/index.js.map +1 -0
  96. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -15
  97. package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
  98. package/build/components/sidebar/index.js +3 -1
  99. package/build/components/sidebar/index.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
  101. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  102. package/build/components/sidebar-edit-mode/index.js +1 -14
  103. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen/index.js +3 -2
  105. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  106. package/build/components/sidebar-navigation-screen-main/index.js +23 -1
  107. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +35 -0
  109. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  110. package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
  111. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  112. package/build/components/site-hub/index.js +2 -2
  113. package/build/components/site-hub/index.js.map +1 -1
  114. package/build/components/site-icon/index.js +1 -1
  115. package/build/components/site-icon/index.js.map +1 -1
  116. package/build/components/style-book/index.js +7 -4
  117. package/build/components/style-book/index.js.map +1 -1
  118. package/build/components/template-part-converter/convert-to-template-part.js +5 -9
  119. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  120. package/build/experiments.js +19 -0
  121. package/build/experiments.js.map +1 -0
  122. package/build/hooks/push-changes-to-global-styles/index.js +65 -6
  123. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  124. package/build/index.js +53 -60
  125. package/build/index.js.map +1 -1
  126. package/build/store/selectors.js +7 -27
  127. package/build/store/selectors.js.map +1 -1
  128. package/build/store/utils.js +77 -0
  129. package/build/store/utils.js.map +1 -0
  130. package/build/utils/template-part-create.js +71 -0
  131. package/build/utils/template-part-create.js.map +1 -0
  132. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
  133. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  134. package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
  135. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  136. package/build-module/components/add-new-template/new-template-part.js +4 -27
  137. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  138. package/build-module/components/add-new-template/utils.js +0 -5
  139. package/build-module/components/add-new-template/utils.js.map +1 -1
  140. package/build-module/components/app/index.js +2 -7
  141. package/build-module/components/app/index.js.map +1 -1
  142. package/build-module/components/block-editor/index.js +14 -12
  143. package/build-module/components/block-editor/index.js.map +1 -1
  144. package/build-module/components/block-editor/inserter-media-categories.js +225 -0
  145. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
  146. package/build-module/components/canvas-spinner/index.js +12 -0
  147. package/build-module/components/canvas-spinner/index.js.map +1 -0
  148. package/build-module/components/create-template-part-modal/index.js +5 -3
  149. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  150. package/build-module/components/editor/index.js +3 -2
  151. package/build-module/components/editor/index.js.map +1 -1
  152. package/build-module/components/error-boundary/index.js +2 -12
  153. package/build-module/components/error-boundary/index.js.map +1 -1
  154. package/build-module/components/error-boundary/warning.js +5 -28
  155. package/build-module/components/error-boundary/warning.js.map +1 -1
  156. package/build-module/components/global-styles/block-preview-panel.js +2 -2
  157. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  158. package/build-module/components/global-styles/border-panel.js +17 -11
  159. package/build-module/components/global-styles/border-panel.js.map +1 -1
  160. package/build-module/components/global-styles/color-palette-panel.js +11 -7
  161. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  162. package/build-module/components/global-styles/context-menu.js +40 -8
  163. package/build-module/components/global-styles/context-menu.js.map +1 -1
  164. package/build-module/components/global-styles/custom-css.js +61 -15
  165. package/build-module/components/global-styles/custom-css.js.map +1 -1
  166. package/build-module/components/global-styles/dimensions-panel.js +49 -32
  167. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  168. package/build-module/components/global-styles/global-styles-provider.js +7 -2
  169. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  170. package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
  171. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  172. package/build-module/components/global-styles/hooks.js +23 -134
  173. package/build-module/components/global-styles/hooks.js.map +1 -1
  174. package/build-module/components/global-styles/index.js +0 -2
  175. package/build-module/components/global-styles/index.js.map +1 -1
  176. package/build-module/components/global-styles/palette.js +10 -5
  177. package/build-module/components/global-styles/palette.js.map +1 -1
  178. package/build-module/components/global-styles/preview.js +18 -14
  179. package/build-module/components/global-styles/preview.js.map +1 -1
  180. package/build-module/components/global-styles/screen-background-color.js +26 -15
  181. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  182. package/build-module/components/global-styles/screen-border.js +10 -5
  183. package/build-module/components/global-styles/screen-border.js.map +1 -1
  184. package/build-module/components/global-styles/screen-button-color.js +16 -11
  185. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  186. package/build-module/components/global-styles/screen-colors.js +43 -37
  187. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  188. package/build-module/components/global-styles/screen-css.js +21 -9
  189. package/build-module/components/global-styles/screen-css.js.map +1 -1
  190. package/build-module/components/global-styles/screen-heading-color.js +23 -18
  191. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  192. package/build-module/components/global-styles/screen-layout.js +4 -4
  193. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  194. package/build-module/components/global-styles/screen-link-color.js +18 -13
  195. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  196. package/build-module/components/global-styles/screen-root.js +23 -9
  197. package/build-module/components/global-styles/screen-root.js.map +1 -1
  198. package/build-module/components/global-styles/screen-style-variations.js +5 -2
  199. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  200. package/build-module/components/global-styles/screen-text-color.js +14 -9
  201. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  202. package/build-module/components/global-styles/screen-typography.js +16 -12
  203. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  204. package/build-module/components/global-styles/shadow-panel.js +177 -0
  205. package/build-module/components/global-styles/shadow-panel.js.map +1 -0
  206. package/build-module/components/global-styles/typography-panel.js +43 -31
  207. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  208. package/build-module/components/global-styles/typography-preview.js +17 -9
  209. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  210. package/build-module/components/global-styles/ui.js +80 -35
  211. package/build-module/components/global-styles/ui.js.map +1 -1
  212. package/build-module/components/global-styles/utils.js +4 -319
  213. package/build-module/components/global-styles/utils.js.map +1 -1
  214. package/build-module/components/global-styles-renderer/index.js +5 -5
  215. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  216. package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
  217. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  218. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  219. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  220. package/build-module/components/layout/index.js +6 -8
  221. package/build-module/components/layout/index.js.map +1 -1
  222. package/build-module/components/list/actions/rename-menu-item.js +9 -12
  223. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  224. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -2
  225. package/build-module/components/navigation-inspector/index.js.map +1 -0
  226. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -16
  227. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
  228. package/build-module/components/sidebar/index.js +2 -1
  229. package/build-module/components/sidebar/index.js.map +1 -1
  230. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
  231. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  232. package/build-module/components/sidebar-edit-mode/index.js +1 -13
  233. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  234. package/build-module/components/sidebar-navigation-screen/index.js +3 -2
  235. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  236. package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
  237. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  238. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +23 -0
  239. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  240. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
  241. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  242. package/build-module/components/site-hub/index.js +2 -2
  243. package/build-module/components/site-hub/index.js.map +1 -1
  244. package/build-module/components/site-icon/index.js +1 -1
  245. package/build-module/components/site-icon/index.js.map +1 -1
  246. package/build-module/components/style-book/index.js +8 -5
  247. package/build-module/components/style-book/index.js.map +1 -1
  248. package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
  249. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  250. package/build-module/experiments.js +9 -0
  251. package/build-module/experiments.js.map +1 -0
  252. package/build-module/hooks/push-changes-to-global-styles/index.js +62 -3
  253. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  254. package/build-module/index.js +52 -60
  255. package/build-module/index.js.map +1 -1
  256. package/build-module/store/selectors.js +6 -26
  257. package/build-module/store/selectors.js.map +1 -1
  258. package/build-module/store/utils.js +66 -0
  259. package/build-module/store/utils.js.map +1 -0
  260. package/build-module/utils/template-part-create.js +53 -0
  261. package/build-module/utils/template-part-create.js.map +1 -0
  262. package/build-style/style-rtl.css +314 -216
  263. package/build-style/style.css +314 -216
  264. package/package.json +32 -30
  265. package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
  266. package/src/components/add-new-template/add-custom-template-modal.js +0 -1
  267. package/src/components/add-new-template/new-template-part.js +11 -32
  268. package/src/components/add-new-template/style.scss +0 -4
  269. package/src/components/add-new-template/utils.js +0 -14
  270. package/src/components/app/index.js +2 -2
  271. package/src/components/block-editor/index.js +12 -25
  272. package/src/components/block-editor/inserter-media-categories.js +247 -0
  273. package/src/components/block-editor/style.scss +19 -7
  274. package/src/components/canvas-spinner/index.js +12 -0
  275. package/src/components/canvas-spinner/style.scss +7 -0
  276. package/src/components/create-template-part-modal/index.js +75 -67
  277. package/src/components/create-template-part-modal/style.scss +0 -10
  278. package/src/components/editor/index.js +4 -2
  279. package/src/components/error-boundary/index.js +2 -10
  280. package/src/components/error-boundary/warning.js +6 -35
  281. package/src/components/global-styles/README.md +1 -75
  282. package/src/components/global-styles/block-preview-panel.js +2 -2
  283. package/src/components/global-styles/border-panel.js +19 -17
  284. package/src/components/global-styles/color-palette-panel.js +10 -7
  285. package/src/components/global-styles/context-menu.js +114 -44
  286. package/src/components/global-styles/custom-css.js +76 -19
  287. package/src/components/global-styles/dimensions-panel.js +46 -36
  288. package/src/components/global-styles/global-styles-provider.js +6 -2
  289. package/src/components/global-styles/gradients-palette-panel.js +17 -11
  290. package/src/components/global-styles/hooks.js +31 -155
  291. package/src/components/global-styles/index.js +0 -2
  292. package/src/components/global-styles/palette.js +9 -5
  293. package/src/components/global-styles/preview.js +19 -13
  294. package/src/components/global-styles/screen-background-color.js +37 -21
  295. package/src/components/global-styles/screen-border.js +10 -5
  296. package/src/components/global-styles/screen-button-color.js +21 -19
  297. package/src/components/global-styles/screen-colors.js +48 -65
  298. package/src/components/global-styles/screen-css.js +30 -14
  299. package/src/components/global-styles/screen-heading-color.js +32 -27
  300. package/src/components/global-styles/screen-layout.js +4 -7
  301. package/src/components/global-styles/screen-link-color.js +26 -26
  302. package/src/components/global-styles/screen-root.js +24 -9
  303. package/src/components/global-styles/screen-style-variations.js +7 -2
  304. package/src/components/global-styles/screen-text-color.js +15 -19
  305. package/src/components/global-styles/screen-typography.js +27 -12
  306. package/src/components/global-styles/shadow-panel.js +174 -0
  307. package/src/components/global-styles/style.scss +85 -1
  308. package/src/components/global-styles/typography-panel.js +60 -48
  309. package/src/components/global-styles/typography-preview.js +28 -9
  310. package/src/components/global-styles/ui.js +78 -53
  311. package/src/components/global-styles/utils.js +4 -371
  312. package/src/components/global-styles-renderer/index.js +3 -4
  313. package/src/components/header-edit-mode/document-actions/index.js +1 -1
  314. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  315. package/src/components/layout/index.js +9 -2
  316. package/src/components/layout/style.scss +4 -5
  317. package/src/components/list/actions/rename-menu-item.js +14 -23
  318. package/src/components/list/style.scss +0 -4
  319. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -4
  320. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
  321. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +0 -17
  322. package/src/components/sidebar/index.js +2 -0
  323. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
  324. package/src/components/sidebar-edit-mode/index.js +0 -11
  325. package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
  326. package/src/components/sidebar-navigation-item/style.scss +28 -3
  327. package/src/components/sidebar-navigation-screen/index.js +4 -3
  328. package/src/components/sidebar-navigation-screen/style.scss +2 -0
  329. package/src/components/sidebar-navigation-screen-main/index.js +23 -1
  330. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +25 -0
  331. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
  332. package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
  333. package/src/components/site-hub/index.js +1 -1
  334. package/src/components/site-hub/style.scss +7 -1
  335. package/src/components/site-icon/index.js +1 -1
  336. package/src/components/site-icon/style.scss +2 -2
  337. package/src/components/style-book/index.js +10 -5
  338. package/src/components/template-part-converter/convert-to-template-part.js +12 -10
  339. package/src/experiments.js +10 -0
  340. package/src/hooks/push-changes-to-global-styles/index.js +63 -5
  341. package/src/index.js +51 -59
  342. package/src/store/selectors.js +6 -26
  343. package/src/store/test/utils.js +181 -0
  344. package/src/store/utils.js +69 -0
  345. package/src/style.scss +4 -2
  346. package/src/utils/template-part-create.js +62 -0
  347. package/src/utils/test/template-part-create.js +63 -0
  348. package/build/components/global-styles/context.js +0 -22
  349. package/build/components/global-styles/context.js.map +0 -1
  350. package/build/components/global-styles/typography-utils.js +0 -92
  351. package/build/components/global-styles/typography-utils.js.map +0 -1
  352. package/build/components/global-styles/use-global-styles-output.js +0 -943
  353. package/build/components/global-styles/use-global-styles-output.js.map +0 -1
  354. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
  355. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  356. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  357. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  358. package/build-module/components/global-styles/context.js +0 -12
  359. package/build-module/components/global-styles/context.js.map +0 -1
  360. package/build-module/components/global-styles/typography-utils.js +0 -84
  361. package/build-module/components/global-styles/typography-utils.js.map +0 -1
  362. package/build-module/components/global-styles/use-global-styles-output.js +0 -901
  363. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
  364. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
  365. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  366. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  367. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  368. package/src/components/global-styles/context.js +0 -15
  369. package/src/components/global-styles/test/typography-utils.js +0 -393
  370. package/src/components/global-styles/test/use-global-styles-output.js +0 -814
  371. package/src/components/global-styles/test/utils.js +0 -206
  372. package/src/components/global-styles/typography-utils.js +0 -87
  373. package/src/components/global-styles/use-global-styles-output.js +0 -1059
  374. 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,14 @@ 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
+
20
28
  var _screenRoot = _interopRequireDefault(require("./screen-root"));
21
29
 
22
30
  var _screenBlockList = _interopRequireDefault(require("./screen-block-list"));
@@ -53,6 +61,8 @@ var _styleBook = _interopRequireDefault(require("../style-book"));
53
61
 
54
62
  var _screenCss = _interopRequireDefault(require("./screen-css"));
55
63
 
64
+ var _experiments = require("../../experiments");
65
+
56
66
  /**
57
67
  * WordPress dependencies
58
68
  */
@@ -60,6 +70,44 @@ var _screenCss = _interopRequireDefault(require("./screen-css"));
60
70
  /**
61
71
  * Internal dependencies
62
72
  */
73
+ const SLOT_FILL_NAME = 'GlobalStylesMenu';
74
+ const {
75
+ Slot: GlobalStylesMenuSlot,
76
+ Fill: GlobalStylesMenuFill
77
+ } = (0, _components.createSlotFill)(SLOT_FILL_NAME);
78
+ exports.GlobalStylesMenuSlot = GlobalStylesMenuSlot;
79
+
80
+ function GlobalStylesActionMenu() {
81
+ const {
82
+ toggle
83
+ } = (0, _data.useDispatch)(_preferences.store);
84
+ const {
85
+ useGlobalStylesReset
86
+ } = (0, _experiments.unlock)(_blockEditor.experiments);
87
+ const [canReset, onReset] = useGlobalStylesReset();
88
+ const {
89
+ goTo
90
+ } = (0, _components.__experimentalUseNavigator)();
91
+
92
+ const loadCustomCSS = () => goTo('/css');
93
+
94
+ return (0, _element.createElement)(GlobalStylesMenuFill, null, (0, _element.createElement)(_components.DropdownMenu, {
95
+ icon: _icons.moreVertical,
96
+ label: (0, _i18n.__)('More Styles actions'),
97
+ controls: [{
98
+ title: (0, _i18n.__)('Reset to defaults'),
99
+ onClick: onReset,
100
+ isDisabled: !canReset
101
+ }, {
102
+ title: (0, _i18n.__)('Welcome Guide'),
103
+ onClick: () => toggle('core/edit-site', 'welcomeGuideStyles')
104
+ }, {
105
+ title: (0, _i18n.__)('Additional CSS'),
106
+ onClick: loadCustomCSS
107
+ }]
108
+ }));
109
+ }
110
+
63
111
  function GlobalStylesNavigationScreen(_ref) {
64
112
  let {
65
113
  className,
@@ -88,43 +136,43 @@ function BlockStyleVariationsScreens(_ref2) {
88
136
  return blockStyleVariations.map(variation => (0, _element.createElement)(ContextScreens, {
89
137
  key: variation.name + name,
90
138
  name: name,
91
- parentMenu: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(variation.name)
139
+ parentMenu: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(variation.name),
140
+ variation: variation.name
92
141
  }));
93
142
  }
94
143
 
95
- function ContextScreens(_ref3) {
144
+ function BlockStylesNavigationScreens(_ref3) {
96
145
  let {
97
- name,
98
- parentMenu = ''
146
+ parentMenu,
147
+ blockStyles,
148
+ blockName
99
149
  } = _ref3;
100
- const hasVariationPath = parentMenu.search('variations');
101
- const variationPath = hasVariationPath !== -1 ? parentMenu.substring(hasVariationPath).replace('/', '.').concat('', '.') : '';
150
+ return blockStyles.map((style, index) => (0, _element.createElement)(GlobalStylesNavigationScreen, {
151
+ key: index,
152
+ path: parentMenu + '/variations/' + style.name
153
+ }, (0, _element.createElement)(_screenVariations.ScreenVariation, {
154
+ blockName: blockName,
155
+ style: style
156
+ })));
157
+ }
158
+
159
+ function ContextScreens(_ref4) {
160
+ let {
161
+ name,
162
+ parentMenu = '',
163
+ variation = ''
164
+ } = _ref4;
102
165
  const blockStyleVariations = (0, _data.useSelect)(select => {
103
166
  const {
104
167
  getBlockStyles
105
168
  } = select(_blocks.store);
106
169
  return getBlockStyles(name);
107
170
  }, [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
171
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(GlobalStylesNavigationScreen, {
124
172
  path: parentMenu + '/typography'
125
173
  }, (0, _element.createElement)(_screenTypography.default, {
126
174
  name: name,
127
- variationPath: variationPath
175
+ variation: variation
128
176
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
129
177
  path: parentMenu + '/typography/text'
130
178
  }, (0, _element.createElement)(_screenTypographyElement.default, {
@@ -149,7 +197,7 @@ function ContextScreens(_ref3) {
149
197
  path: parentMenu + '/colors'
150
198
  }, (0, _element.createElement)(_screenColors.default, {
151
199
  name: name,
152
- variationPath: variationPath
200
+ variation: variation
153
201
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
154
202
  path: parentMenu + '/colors/palette'
155
203
  }, (0, _element.createElement)(_screenColorPalette.default, {
@@ -158,38 +206,43 @@ function ContextScreens(_ref3) {
158
206
  path: parentMenu + '/colors/background'
159
207
  }, (0, _element.createElement)(_screenBackgroundColor.default, {
160
208
  name: name,
161
- variationPath: variationPath
209
+ variation: variation
162
210
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
163
211
  path: parentMenu + '/colors/text'
164
212
  }, (0, _element.createElement)(_screenTextColor.default, {
165
213
  name: name,
166
- variationPath: variationPath
214
+ variation: variation
167
215
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
168
216
  path: parentMenu + '/colors/link'
169
217
  }, (0, _element.createElement)(_screenLinkColor.default, {
170
218
  name: name,
171
- variationPath: variationPath
219
+ variation: variation
172
220
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
173
221
  path: parentMenu + '/colors/heading'
174
222
  }, (0, _element.createElement)(_screenHeadingColor.default, {
175
223
  name: name,
176
- variationPath: variationPath
224
+ variation: variation
177
225
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
178
226
  path: parentMenu + '/colors/button'
179
227
  }, (0, _element.createElement)(_screenButtonColor.default, {
180
228
  name: name,
181
- variationPath: variationPath
229
+ variation: variation
182
230
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
183
231
  path: parentMenu + '/border'
184
232
  }, (0, _element.createElement)(_screenBorder.default, {
185
233
  name: name,
186
- variationPath: variationPath
234
+ variation: variation
187
235
  })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
188
236
  path: parentMenu + '/layout'
189
237
  }, (0, _element.createElement)(_screenLayout.default, {
190
238
  name: name,
191
- variationPath: variationPath
239
+ variation: variation
240
+ })), (0, _element.createElement)(GlobalStylesNavigationScreen, {
241
+ path: parentMenu + '/css'
242
+ }, (0, _element.createElement)(_screenCss.default, {
243
+ name: name
192
244
  })), !!(blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length) && (0, _element.createElement)(BlockStylesNavigationScreens, {
245
+ parentMenu: parentMenu,
193
246
  blockStyles: blockStyleVariations,
194
247
  blockName: name
195
248
  }));
@@ -254,9 +307,7 @@ function GlobalStylesUI(_ref6) {
254
307
  });
255
308
  }), isStyleBookOpened && (0, _element.createElement)(GlobalStylesStyleBook, {
256
309
  onClose: onCloseStyleBook
257
- }), (0, _element.createElement)(GlobalStylesNavigationScreen, {
258
- path: "/css"
259
- }, (0, _element.createElement)(_screenCss.default, null)));
310
+ }), (0, _element.createElement)(GlobalStylesActionMenu, null));
260
311
  }
261
312
 
262
313
  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;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rC,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","useGlobalStylesReset","blockEditorExperiments","canReset","onReset","goTo","loadCustomCSS","moreVertical","title","onClick","isDisabled","GlobalStylesNavigationScreen","className","props","filter","Boolean","join","BlockStyleVariationsScreens","name","blockStyleVariations","select","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;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtCA;AACA;AACA;;AAeA;AACA;AACA;AAqBA,MAA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;;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';\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 { 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{\n\t\t\t\t\t\ttitle: __( 'Additional CSS' ),\n\t\t\t\t\t\tonClick: loadCustomCSS,\n\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