@wordpress/global-styles-ui 1.1.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 (701) hide show
  1. package/LICENSE.md +788 -0
  2. package/README.md +48 -0
  3. package/build/background-panel.js +62 -0
  4. package/build/background-panel.js.map +7 -0
  5. package/build/block-preview-panel.js +90 -0
  6. package/build/block-preview-panel.js.map +7 -0
  7. package/build/color-indicator-wrapper.js +55 -0
  8. package/build/color-indicator-wrapper.js.map +7 -0
  9. package/build/color-palette-panel.js +123 -0
  10. package/build/color-palette-panel.js.map +7 -0
  11. package/build/color-preview.js +94 -0
  12. package/build/color-preview.js.map +7 -0
  13. package/build/color-variations.js +41 -0
  14. package/build/color-variations.js.map +7 -0
  15. package/build/confirm-reset-shadow-dialog.js +55 -0
  16. package/build/confirm-reset-shadow-dialog.js.map +7 -0
  17. package/build/context.js +37 -0
  18. package/build/context.js.map +7 -0
  19. package/build/dimensions-panel.js +89 -0
  20. package/build/dimensions-panel.js.map +7 -0
  21. package/build/font-families.js +114 -0
  22. package/build/font-families.js.map +7 -0
  23. package/build/font-family-item.js +48 -0
  24. package/build/font-family-item.js.map +7 -0
  25. package/build/font-library-modal/collection-font-variant.js +75 -0
  26. package/build/font-library-modal/collection-font-variant.js.map +7 -0
  27. package/build/font-library-modal/context.js +386 -0
  28. package/build/font-library-modal/context.js.map +7 -0
  29. package/build/font-library-modal/font-card.js +81 -0
  30. package/build/font-library-modal/font-card.js.map +7 -0
  31. package/build/font-library-modal/font-collection.js +510 -0
  32. package/build/font-library-modal/font-collection.js.map +7 -0
  33. package/build/font-library-modal/font-demo.js +111 -0
  34. package/build/font-library-modal/font-demo.js.map +7 -0
  35. package/build/font-library-modal/google-fonts-confirm-dialog.js +58 -0
  36. package/build/font-library-modal/google-fonts-confirm-dialog.js.map +7 -0
  37. package/build/font-library-modal/index.js +110 -0
  38. package/build/font-library-modal/index.js.map +7 -0
  39. package/build/font-library-modal/installed-fonts.js +453 -0
  40. package/build/font-library-modal/installed-fonts.js.map +7 -0
  41. package/build/font-library-modal/lib/inflate.js +2628 -0
  42. package/build/font-library-modal/lib/inflate.js.map +7 -0
  43. package/build/font-library-modal/lib/lib-font.browser.d.js +33 -0
  44. package/build/font-library-modal/lib/lib-font.browser.d.js.map +7 -0
  45. package/build/font-library-modal/lib/lib-font.browser.js +3788 -0
  46. package/build/font-library-modal/lib/lib-font.browser.js.map +7 -0
  47. package/build/font-library-modal/lib/unbrotli.js +3678 -0
  48. package/build/font-library-modal/lib/unbrotli.js.map +7 -0
  49. package/build/font-library-modal/library-font-details.js +63 -0
  50. package/build/font-library-modal/library-font-details.js.map +7 -0
  51. package/build/font-library-modal/library-font-variant.js +81 -0
  52. package/build/font-library-modal/library-font-variant.js.map +7 -0
  53. package/build/font-library-modal/resolvers.js +115 -0
  54. package/build/font-library-modal/resolvers.js.map +7 -0
  55. package/build/font-library-modal/types.js +17 -0
  56. package/build/font-library-modal/types.js.map +7 -0
  57. package/build/font-library-modal/upload-fonts.js +207 -0
  58. package/build/font-library-modal/upload-fonts.js.map +7 -0
  59. package/build/font-library-modal/utils/constants.js +49 -0
  60. package/build/font-library-modal/utils/constants.js.map +7 -0
  61. package/build/font-library-modal/utils/filter-fonts.js +39 -0
  62. package/build/font-library-modal/utils/filter-fonts.js.map +7 -0
  63. package/build/font-library-modal/utils/fonts-outline.js +51 -0
  64. package/build/font-library-modal/utils/fonts-outline.js.map +7 -0
  65. package/build/font-library-modal/utils/index.js +274 -0
  66. package/build/font-library-modal/utils/index.js.map +7 -0
  67. package/build/font-library-modal/utils/make-families-from-faces.js +45 -0
  68. package/build/font-library-modal/utils/make-families-from-faces.js.map +7 -0
  69. package/build/font-library-modal/utils/preview-styles.js +119 -0
  70. package/build/font-library-modal/utils/preview-styles.js.map +7 -0
  71. package/build/font-library-modal/utils/set-immutably.js +40 -0
  72. package/build/font-library-modal/utils/set-immutably.js.map +7 -0
  73. package/build/font-library-modal/utils/sort-font-faces.js +59 -0
  74. package/build/font-library-modal/utils/sort-font-faces.js.map +7 -0
  75. package/build/font-library-modal/utils/toggleFont.js +67 -0
  76. package/build/font-library-modal/utils/toggleFont.js.map +7 -0
  77. package/build/font-sizes/confirm-delete-font-size-dialog.js +60 -0
  78. package/build/font-sizes/confirm-delete-font-size-dialog.js.map +7 -0
  79. package/build/font-sizes/confirm-reset-font-sizes-dialog.js +55 -0
  80. package/build/font-sizes/confirm-reset-font-sizes-dialog.js.map +7 -0
  81. package/build/font-sizes/font-size-preview.js +50 -0
  82. package/build/font-sizes/font-size-preview.js.map +7 -0
  83. package/build/font-sizes/font-size.js +261 -0
  84. package/build/font-sizes/font-size.js.map +7 -0
  85. package/build/font-sizes/font-sizes-count.js +40 -0
  86. package/build/font-sizes/font-sizes-count.js.map +7 -0
  87. package/build/font-sizes/font-sizes.js +215 -0
  88. package/build/font-sizes/font-sizes.js.map +7 -0
  89. package/build/font-sizes/rename-font-size-dialog.js +96 -0
  90. package/build/font-sizes/rename-font-size-dialog.js.map +7 -0
  91. package/build/global-styles-ui.js +213 -0
  92. package/build/global-styles-ui.js.map +7 -0
  93. package/build/gradients-palette-panel.js +133 -0
  94. package/build/gradients-palette-panel.js.map +7 -0
  95. package/build/highlighted-colors.js +57 -0
  96. package/build/highlighted-colors.js.map +7 -0
  97. package/build/hooks.js +176 -0
  98. package/build/hooks.js.map +7 -0
  99. package/build/icon-with-current-color.js +56 -0
  100. package/build/icon-with-current-color.js.map +7 -0
  101. package/build/index.js +51 -0
  102. package/build/index.js.map +7 -0
  103. package/build/lock-unlock.js +35 -0
  104. package/build/lock-unlock.js.map +7 -0
  105. package/build/navigation-button.js +52 -0
  106. package/build/navigation-button.js.map +7 -0
  107. package/build/pagination/index.js +133 -0
  108. package/build/pagination/index.js.map +7 -0
  109. package/build/palette.js +93 -0
  110. package/build/palette.js.map +7 -0
  111. package/build/preset-colors.js +40 -0
  112. package/build/preset-colors.js.map +7 -0
  113. package/build/preview-colors.js +86 -0
  114. package/build/preview-colors.js.map +7 -0
  115. package/build/preview-hooks.js +60 -0
  116. package/build/preview-hooks.js.map +7 -0
  117. package/build/preview-styles.js +219 -0
  118. package/build/preview-styles.js.map +7 -0
  119. package/build/preview-typography.js +72 -0
  120. package/build/preview-typography.js.map +7 -0
  121. package/build/preview-wrapper.js +102 -0
  122. package/build/preview-wrapper.js.map +7 -0
  123. package/build/provider.js +54 -0
  124. package/build/provider.js.map +7 -0
  125. package/build/root-menu.js +72 -0
  126. package/build/root-menu.js.map +7 -0
  127. package/build/screen-background.js +58 -0
  128. package/build/screen-background.js.map +7 -0
  129. package/build/screen-block-list.js +160 -0
  130. package/build/screen-block-list.js.map +7 -0
  131. package/build/screen-block.js +316 -0
  132. package/build/screen-block.js.map +7 -0
  133. package/build/screen-color-palette.js +64 -0
  134. package/build/screen-color-palette.js.map +7 -0
  135. package/build/screen-colors.js +85 -0
  136. package/build/screen-colors.js.map +7 -0
  137. package/build/screen-css.js +68 -0
  138. package/build/screen-css.js.map +7 -0
  139. package/build/screen-header.js +61 -0
  140. package/build/screen-header.js.map +7 -0
  141. package/build/screen-layout.js +54 -0
  142. package/build/screen-layout.js.map +7 -0
  143. package/build/screen-revisions/index.js +147 -0
  144. package/build/screen-revisions/index.js.map +7 -0
  145. package/build/screen-revisions/revisions-buttons.js +198 -0
  146. package/build/screen-revisions/revisions-buttons.js.map +7 -0
  147. package/build/screen-revisions/types.js +17 -0
  148. package/build/screen-revisions/types.js.map +7 -0
  149. package/build/screen-revisions/use-global-styles-revisions.js +163 -0
  150. package/build/screen-revisions/use-global-styles-revisions.js.map +7 -0
  151. package/build/screen-root.js +134 -0
  152. package/build/screen-root.js.map +7 -0
  153. package/build/screen-shadows.js +49 -0
  154. package/build/screen-shadows.js.map +7 -0
  155. package/build/screen-style-variations.js +52 -0
  156. package/build/screen-style-variations.js.map +7 -0
  157. package/build/screen-typography-element.js +167 -0
  158. package/build/screen-typography-element.js.map +7 -0
  159. package/build/screen-typography.js +65 -0
  160. package/build/screen-typography.js.map +7 -0
  161. package/build/shadow-utils.js +125 -0
  162. package/build/shadow-utils.js.map +7 -0
  163. package/build/shadows-edit-panel.js +503 -0
  164. package/build/shadows-edit-panel.js.map +7 -0
  165. package/build/shadows-panel.js +203 -0
  166. package/build/shadows-panel.js.map +7 -0
  167. package/build/size-control/index.js +86 -0
  168. package/build/size-control/index.js.map +7 -0
  169. package/build/style-variations-container.js +130 -0
  170. package/build/style-variations-container.js.map +7 -0
  171. package/build/style-variations-content.js +52 -0
  172. package/build/style-variations-content.js.map +7 -0
  173. package/build/style-variations.js +41 -0
  174. package/build/style-variations.js.map +7 -0
  175. package/build/subtitle.js +33 -0
  176. package/build/subtitle.js.map +7 -0
  177. package/build/typography-elements.js +117 -0
  178. package/build/typography-elements.js.map +7 -0
  179. package/build/typography-example.js +79 -0
  180. package/build/typography-example.js.map +7 -0
  181. package/build/typography-panel.js +64 -0
  182. package/build/typography-panel.js.map +7 -0
  183. package/build/typography-preview.js +70 -0
  184. package/build/typography-preview.js.map +7 -0
  185. package/build/typography-variations.js +41 -0
  186. package/build/typography-variations.js.map +7 -0
  187. package/build/utils.js +210 -0
  188. package/build/utils.js.map +7 -0
  189. package/build/variations/variation.js +116 -0
  190. package/build/variations/variation.js.map +7 -0
  191. package/build/variations/variations-color.js +64 -0
  192. package/build/variations/variations-color.js.map +7 -0
  193. package/build/variations/variations-panel.js +69 -0
  194. package/build/variations/variations-panel.js.map +7 -0
  195. package/build/variations/variations-typography.js +80 -0
  196. package/build/variations/variations-typography.js.map +7 -0
  197. package/build/with-global-styles-provider.js +48 -0
  198. package/build/with-global-styles-provider.js.map +7 -0
  199. package/build-module/background-panel.js +38 -0
  200. package/build-module/background-panel.js.map +7 -0
  201. package/build-module/block-preview-panel.js +70 -0
  202. package/build-module/block-preview-panel.js.map +7 -0
  203. package/build-module/color-indicator-wrapper.js +25 -0
  204. package/build-module/color-indicator-wrapper.js.map +7 -0
  205. package/build-module/color-palette-panel.js +97 -0
  206. package/build-module/color-palette-panel.js.map +7 -0
  207. package/build-module/color-preview.js +70 -0
  208. package/build-module/color-preview.js.map +7 -0
  209. package/build-module/color-variations.js +7 -0
  210. package/build-module/color-variations.js.map +7 -0
  211. package/build-module/confirm-reset-shadow-dialog.js +35 -0
  212. package/build-module/confirm-reset-shadow-dialog.js.map +7 -0
  213. package/build-module/context.js +13 -0
  214. package/build-module/context.js.map +7 -0
  215. package/build-module/dimensions-panel.js +69 -0
  216. package/build-module/dimensions-panel.js.map +7 -0
  217. package/build-module/font-families.js +92 -0
  218. package/build-module/font-families.js.map +7 -0
  219. package/build-module/font-family-item.js +32 -0
  220. package/build-module/font-family-item.js.map +7 -0
  221. package/build-module/font-library-modal/collection-font-variant.js +45 -0
  222. package/build-module/font-library-modal/collection-font-variant.js.map +7 -0
  223. package/build-module/font-library-modal/context.js +382 -0
  224. package/build-module/font-library-modal/context.js.map +7 -0
  225. package/build-module/font-library-modal/font-card.js +57 -0
  226. package/build-module/font-library-modal/font-card.js.map +7 -0
  227. package/build-module/font-library-modal/font-collection.js +510 -0
  228. package/build-module/font-library-modal/font-collection.js.map +7 -0
  229. package/build-module/font-library-modal/font-demo.js +94 -0
  230. package/build-module/font-library-modal/font-demo.js.map +7 -0
  231. package/build-module/font-library-modal/google-fonts-confirm-dialog.js +45 -0
  232. package/build-module/font-library-modal/google-fonts-confirm-dialog.js.map +7 -0
  233. package/build-module/font-library-modal/index.js +83 -0
  234. package/build-module/font-library-modal/index.js.map +7 -0
  235. package/build-module/font-library-modal/installed-fonts.js +442 -0
  236. package/build-module/font-library-modal/installed-fonts.js.map +7 -0
  237. package/build-module/font-library-modal/lib/inflate.js +2636 -0
  238. package/build-module/font-library-modal/lib/inflate.js.map +7 -0
  239. package/build-module/font-library-modal/lib/lib-font.browser.d.js +9 -0
  240. package/build-module/font-library-modal/lib/lib-font.browser.d.js.map +7 -0
  241. package/build-module/font-library-modal/lib/lib-font.browser.js +3754 -0
  242. package/build-module/font-library-modal/lib/lib-font.browser.js.map +7 -0
  243. package/build-module/font-library-modal/lib/unbrotli.js +3686 -0
  244. package/build-module/font-library-modal/lib/unbrotli.js.map +7 -0
  245. package/build-module/font-library-modal/library-font-details.js +36 -0
  246. package/build-module/font-library-modal/library-font-details.js.map +7 -0
  247. package/build-module/font-library-modal/library-font-variant.js +51 -0
  248. package/build-module/font-library-modal/library-font-variant.js.map +7 -0
  249. package/build-module/font-library-modal/resolvers.js +76 -0
  250. package/build-module/font-library-modal/resolvers.js.map +7 -0
  251. package/build-module/font-library-modal/types.js +1 -0
  252. package/build-module/font-library-modal/types.js.map +7 -0
  253. package/build-module/font-library-modal/upload-fonts.js +187 -0
  254. package/build-module/font-library-modal/upload-fonts.js.map +7 -0
  255. package/build-module/font-library-modal/utils/constants.js +23 -0
  256. package/build-module/font-library-modal/utils/constants.js.map +7 -0
  257. package/build-module/font-library-modal/utils/filter-fonts.js +19 -0
  258. package/build-module/font-library-modal/utils/filter-fonts.js.map +7 -0
  259. package/build-module/font-library-modal/utils/fonts-outline.js +26 -0
  260. package/build-module/font-library-modal/utils/fonts-outline.js.map +7 -0
  261. package/build-module/font-library-modal/utils/index.js +238 -0
  262. package/build-module/font-library-modal/utils/index.js.map +7 -0
  263. package/build-module/font-library-modal/utils/make-families-from-faces.js +25 -0
  264. package/build-module/font-library-modal/utils/make-families-from-faces.js.map +7 -0
  265. package/build-module/font-library-modal/utils/preview-styles.js +92 -0
  266. package/build-module/font-library-modal/utils/preview-styles.js.map +7 -0
  267. package/build-module/font-library-modal/utils/set-immutably.js +16 -0
  268. package/build-module/font-library-modal/utils/set-immutably.js.map +7 -0
  269. package/build-module/font-library-modal/utils/sort-font-faces.js +35 -0
  270. package/build-module/font-library-modal/utils/sort-font-faces.js.map +7 -0
  271. package/build-module/font-library-modal/utils/toggleFont.js +43 -0
  272. package/build-module/font-library-modal/utils/toggleFont.js.map +7 -0
  273. package/build-module/font-sizes/confirm-delete-font-size-dialog.js +40 -0
  274. package/build-module/font-sizes/confirm-delete-font-size-dialog.js.map +7 -0
  275. package/build-module/font-sizes/confirm-reset-font-sizes-dialog.js +35 -0
  276. package/build-module/font-sizes/confirm-reset-font-sizes-dialog.js.map +7 -0
  277. package/build-module/font-sizes/font-size-preview.js +30 -0
  278. package/build-module/font-sizes/font-size-preview.js.map +7 -0
  279. package/build-module/font-sizes/font-size.js +241 -0
  280. package/build-module/font-sizes/font-size.js.map +7 -0
  281. package/build-module/font-sizes/font-sizes-count.js +25 -0
  282. package/build-module/font-sizes/font-sizes-count.js.map +7 -0
  283. package/build-module/font-sizes/font-sizes.js +200 -0
  284. package/build-module/font-sizes/font-sizes.js.map +7 -0
  285. package/build-module/font-sizes/rename-font-size-dialog.js +82 -0
  286. package/build-module/font-sizes/rename-font-size-dialog.js.map +7 -0
  287. package/build-module/global-styles-ui.js +182 -0
  288. package/build-module/global-styles-ui.js.map +7 -0
  289. package/build-module/gradients-palette-panel.js +118 -0
  290. package/build-module/gradients-palette-panel.js.map +7 -0
  291. package/build-module/highlighted-colors.js +37 -0
  292. package/build-module/highlighted-colors.js.map +7 -0
  293. package/build-module/hooks.js +144 -0
  294. package/build-module/hooks.js.map +7 -0
  295. package/build-module/icon-with-current-color.js +22 -0
  296. package/build-module/icon-with-current-color.js.map +7 -0
  297. package/build-module/index.js +13 -0
  298. package/build-module/index.js.map +7 -0
  299. package/build-module/lock-unlock.js +10 -0
  300. package/build-module/lock-unlock.js.map +7 -0
  301. package/build-module/navigation-button.js +32 -0
  302. package/build-module/navigation-button.js.map +7 -0
  303. package/build-module/pagination/index.js +107 -0
  304. package/build-module/pagination/index.js.map +7 -0
  305. package/build-module/palette.js +70 -0
  306. package/build-module/palette.js.map +7 -0
  307. package/build-module/preset-colors.js +20 -0
  308. package/build-module/preset-colors.js.map +7 -0
  309. package/build-module/preview-colors.js +59 -0
  310. package/build-module/preview-colors.js.map +7 -0
  311. package/build-module/preview-hooks.js +36 -0
  312. package/build-module/preview-hooks.js.map +7 -0
  313. package/build-module/preview-styles.js +193 -0
  314. package/build-module/preview-styles.js.map +7 -0
  315. package/build-module/preview-typography.js +42 -0
  316. package/build-module/preview-typography.js.map +7 -0
  317. package/build-module/preview-wrapper.js +86 -0
  318. package/build-module/preview-wrapper.js.map +7 -0
  319. package/build-module/provider.js +30 -0
  320. package/build-module/provider.js.map +7 -0
  321. package/build-module/root-menu.js +58 -0
  322. package/build-module/root-menu.js.map +7 -0
  323. package/build-module/screen-background.js +28 -0
  324. package/build-module/screen-background.js.map +7 -0
  325. package/build-module/screen-block-list.js +150 -0
  326. package/build-module/screen-block-list.js.map +7 -0
  327. package/build-module/screen-block.js +293 -0
  328. package/build-module/screen-block.js.map +7 -0
  329. package/build-module/screen-color-palette.js +34 -0
  330. package/build-module/screen-color-palette.js.map +7 -0
  331. package/build-module/screen-colors.js +55 -0
  332. package/build-module/screen-colors.js.map +7 -0
  333. package/build-module/screen-css.js +48 -0
  334. package/build-module/screen-css.js.map +7 -0
  335. package/build-module/screen-header.js +44 -0
  336. package/build-module/screen-header.js.map +7 -0
  337. package/build-module/screen-layout.js +24 -0
  338. package/build-module/screen-layout.js.map +7 -0
  339. package/build-module/screen-revisions/index.js +121 -0
  340. package/build-module/screen-revisions/index.js.map +7 -0
  341. package/build-module/screen-revisions/revisions-buttons.js +178 -0
  342. package/build-module/screen-revisions/revisions-buttons.js.map +7 -0
  343. package/build-module/screen-revisions/types.js +1 -0
  344. package/build-module/screen-revisions/types.js.map +7 -0
  345. package/build-module/screen-revisions/use-global-styles-revisions.js +145 -0
  346. package/build-module/screen-revisions/use-global-styles-revisions.js.map +7 -0
  347. package/build-module/screen-root.js +114 -0
  348. package/build-module/screen-root.js.map +7 -0
  349. package/build-module/screen-shadows.js +14 -0
  350. package/build-module/screen-shadows.js.map +7 -0
  351. package/build-module/screen-style-variations.js +32 -0
  352. package/build-module/screen-style-variations.js.map +7 -0
  353. package/build-module/screen-typography-element.js +141 -0
  354. package/build-module/screen-typography-element.js.map +7 -0
  355. package/build-module/screen-typography.js +35 -0
  356. package/build-module/screen-typography.js.map +7 -0
  357. package/build-module/shadow-utils.js +98 -0
  358. package/build-module/shadow-utils.js.map +7 -0
  359. package/build-module/shadows-edit-panel.js +502 -0
  360. package/build-module/shadows-edit-panel.js.map +7 -0
  361. package/build-module/shadows-panel.js +182 -0
  362. package/build-module/shadows-panel.js.map +7 -0
  363. package/build-module/size-control/index.js +72 -0
  364. package/build-module/size-control/index.js.map +7 -0
  365. package/build-module/style-variations-container.js +100 -0
  366. package/build-module/style-variations-container.js.map +7 -0
  367. package/build-module/style-variations-content.js +18 -0
  368. package/build-module/style-variations-content.js.map +7 -0
  369. package/build-module/style-variations.js +7 -0
  370. package/build-module/style-variations.js.map +7 -0
  371. package/build-module/subtitle.js +9 -0
  372. package/build-module/subtitle.js.map +7 -0
  373. package/build-module/typography-elements.js +102 -0
  374. package/build-module/typography-elements.js.map +7 -0
  375. package/build-module/typography-example.js +59 -0
  376. package/build-module/typography-example.js.map +7 -0
  377. package/build-module/typography-panel.js +44 -0
  378. package/build-module/typography-panel.js.map +7 -0
  379. package/build-module/typography-preview.js +50 -0
  380. package/build-module/typography-preview.js.map +7 -0
  381. package/build-module/typography-variations.js +7 -0
  382. package/build-module/typography-variations.js.map +7 -0
  383. package/build-module/utils.js +179 -0
  384. package/build-module/utils.js.map +7 -0
  385. package/build-module/variations/variation.js +86 -0
  386. package/build-module/variations/variation.js.map +7 -0
  387. package/build-module/variations/variations-color.js +37 -0
  388. package/build-module/variations/variations-color.js.map +7 -0
  389. package/build-module/variations/variations-panel.js +44 -0
  390. package/build-module/variations/variations-panel.js.map +7 -0
  391. package/build-module/variations/variations-typography.js +53 -0
  392. package/build-module/variations/variations-typography.js.map +7 -0
  393. package/build-module/with-global-styles-provider.js +24 -0
  394. package/build-module/with-global-styles-provider.js.map +7 -0
  395. package/build-style/style-rtl.css +717 -0
  396. package/build-style/style.css +718 -0
  397. package/build-types/background-panel.d.ts +10 -0
  398. package/build-types/background-panel.d.ts.map +1 -0
  399. package/build-types/block-preview-panel.d.ts +7 -0
  400. package/build-types/block-preview-panel.d.ts.map +1 -0
  401. package/build-types/color-indicator-wrapper.d.ts +7 -0
  402. package/build-types/color-indicator-wrapper.d.ts.map +1 -0
  403. package/build-types/color-palette-panel.d.ts +6 -0
  404. package/build-types/color-palette-panel.d.ts.map +1 -0
  405. package/build-types/color-preview.d.ts +2 -0
  406. package/build-types/color-preview.d.ts.map +1 -0
  407. package/build-types/color-variations.d.ts +27 -0
  408. package/build-types/color-variations.d.ts.map +1 -0
  409. package/build-types/confirm-reset-shadow-dialog.d.ts +10 -0
  410. package/build-types/confirm-reset-shadow-dialog.d.ts.map +1 -0
  411. package/build-types/context.d.ts +10 -0
  412. package/build-types/context.d.ts.map +1 -0
  413. package/build-types/dimensions-panel.d.ts +2 -0
  414. package/build-types/dimensions-panel.d.ts.map +1 -0
  415. package/build-types/font-families.d.ts +4 -0
  416. package/build-types/font-families.d.ts.map +1 -0
  417. package/build-types/font-family-item.d.ts +7 -0
  418. package/build-types/font-family-item.d.ts.map +1 -0
  419. package/build-types/font-library-modal/collection-font-variant.d.ts +4 -0
  420. package/build-types/font-library-modal/collection-font-variant.d.ts.map +1 -0
  421. package/build-types/font-library-modal/context.d.ts +7 -0
  422. package/build-types/font-library-modal/context.d.ts.map +1 -0
  423. package/build-types/font-library-modal/font-card.d.ts +9 -0
  424. package/build-types/font-library-modal/font-card.d.ts.map +1 -0
  425. package/build-types/font-library-modal/font-collection.d.ts +5 -0
  426. package/build-types/font-library-modal/font-collection.d.ts.map +1 -0
  427. package/build-types/font-library-modal/font-demo.d.ts +4 -0
  428. package/build-types/font-library-modal/font-demo.d.ts.map +1 -0
  429. package/build-types/font-library-modal/google-fonts-confirm-dialog.d.ts +3 -0
  430. package/build-types/font-library-modal/google-fonts-confirm-dialog.d.ts.map +1 -0
  431. package/build-types/font-library-modal/index.d.ts +6 -0
  432. package/build-types/font-library-modal/index.d.ts.map +1 -0
  433. package/build-types/font-library-modal/installed-fonts.d.ts +3 -0
  434. package/build-types/font-library-modal/installed-fonts.d.ts.map +1 -0
  435. package/build-types/font-library-modal/library-font-details.d.ts +6 -0
  436. package/build-types/font-library-modal/library-font-details.d.ts.map +1 -0
  437. package/build-types/font-library-modal/library-font-variant.d.ts +7 -0
  438. package/build-types/font-library-modal/library-font-variant.d.ts.map +1 -0
  439. package/build-types/font-library-modal/resolvers.d.ts +43 -0
  440. package/build-types/font-library-modal/resolvers.d.ts.map +1 -0
  441. package/build-types/font-library-modal/types.d.ts +133 -0
  442. package/build-types/font-library-modal/types.d.ts.map +1 -0
  443. package/build-types/font-library-modal/upload-fonts.d.ts +3 -0
  444. package/build-types/font-library-modal/upload-fonts.d.ts.map +1 -0
  445. package/build-types/font-library-modal/utils/constants.d.ts +4 -0
  446. package/build-types/font-library-modal/utils/constants.d.ts.map +1 -0
  447. package/build-types/font-library-modal/utils/filter-fonts.d.ts +25 -0
  448. package/build-types/font-library-modal/utils/filter-fonts.d.ts.map +1 -0
  449. package/build-types/font-library-modal/utils/fonts-outline.d.ts +7 -0
  450. package/build-types/font-library-modal/utils/fonts-outline.d.ts.map +1 -0
  451. package/build-types/font-library-modal/utils/index.d.ts +21 -0
  452. package/build-types/font-library-modal/utils/index.d.ts.map +1 -0
  453. package/build-types/font-library-modal/utils/make-families-from-faces.d.ts +6 -0
  454. package/build-types/font-library-modal/utils/make-families-from-faces.d.ts.map +1 -0
  455. package/build-types/font-library-modal/utils/preview-styles.d.ts +13 -0
  456. package/build-types/font-library-modal/utils/preview-styles.d.ts.map +1 -0
  457. package/build-types/font-library-modal/utils/set-immutably.d.ts +13 -0
  458. package/build-types/font-library-modal/utils/set-immutably.d.ts.map +1 -0
  459. package/build-types/font-library-modal/utils/sort-font-faces.d.ts +6 -0
  460. package/build-types/font-library-modal/utils/sort-font-faces.d.ts.map +1 -0
  461. package/build-types/font-library-modal/utils/toggleFont.d.ts +38 -0
  462. package/build-types/font-library-modal/utils/toggleFont.d.ts.map +1 -0
  463. package/build-types/font-sizes/confirm-delete-font-size-dialog.d.ts +10 -0
  464. package/build-types/font-sizes/confirm-delete-font-size-dialog.d.ts.map +1 -0
  465. package/build-types/font-sizes/confirm-reset-font-sizes-dialog.d.ts +10 -0
  466. package/build-types/font-sizes/confirm-reset-font-sizes-dialog.d.ts.map +1 -0
  467. package/build-types/font-sizes/font-size-preview.d.ts +7 -0
  468. package/build-types/font-sizes/font-size-preview.d.ts.map +1 -0
  469. package/build-types/font-sizes/font-size.d.ts +4 -0
  470. package/build-types/font-sizes/font-size.d.ts.map +1 -0
  471. package/build-types/font-sizes/font-sizes-count.d.ts +3 -0
  472. package/build-types/font-sizes/font-sizes-count.d.ts.map +1 -0
  473. package/build-types/font-sizes/font-sizes.d.ts +3 -0
  474. package/build-types/font-sizes/font-sizes.d.ts.map +1 -0
  475. package/build-types/font-sizes/rename-font-size-dialog.d.ts +9 -0
  476. package/build-types/font-sizes/rename-font-size-dialog.d.ts.map +1 -0
  477. package/build-types/global-styles-ui.d.ts +26 -0
  478. package/build-types/global-styles-ui.d.ts.map +1 -0
  479. package/build-types/gradients-palette-panel.d.ts +6 -0
  480. package/build-types/gradients-palette-panel.d.ts.map +1 -0
  481. package/build-types/highlighted-colors.d.ts +7 -0
  482. package/build-types/highlighted-colors.d.ts.map +1 -0
  483. package/build-types/hooks.d.ts +46 -0
  484. package/build-types/hooks.d.ts.map +1 -0
  485. package/build-types/icon-with-current-color.d.ts +9 -0
  486. package/build-types/icon-with-current-color.d.ts.map +1 -0
  487. package/build-types/index.d.ts +6 -0
  488. package/build-types/index.d.ts.map +1 -0
  489. package/build-types/lock-unlock.d.ts +2 -0
  490. package/build-types/lock-unlock.d.ts.map +1 -0
  491. package/build-types/navigation-button.d.ts +10 -0
  492. package/build-types/navigation-button.d.ts.map +1 -0
  493. package/build-types/pagination/index.d.ts +13 -0
  494. package/build-types/pagination/index.d.ts.map +1 -0
  495. package/build-types/palette.d.ts +6 -0
  496. package/build-types/palette.d.ts.map +1 -0
  497. package/build-types/preset-colors.d.ts +2 -0
  498. package/build-types/preset-colors.d.ts.map +1 -0
  499. package/build-types/preview-colors.d.ts +8 -0
  500. package/build-types/preview-colors.d.ts.map +1 -0
  501. package/build-types/preview-hooks.d.ts +9 -0
  502. package/build-types/preview-hooks.d.ts.map +1 -0
  503. package/build-types/preview-styles.d.ts +9 -0
  504. package/build-types/preview-styles.d.ts.map +1 -0
  505. package/build-types/preview-typography.d.ts +8 -0
  506. package/build-types/preview-typography.d.ts.map +1 -0
  507. package/build-types/preview-wrapper.d.ts +15 -0
  508. package/build-types/preview-wrapper.d.ts.map +1 -0
  509. package/build-types/provider.d.ts +15 -0
  510. package/build-types/provider.d.ts.map +1 -0
  511. package/build-types/root-menu.d.ts +3 -0
  512. package/build-types/root-menu.d.ts.map +1 -0
  513. package/build-types/screen-background.d.ts +3 -0
  514. package/build-types/screen-background.d.ts.map +1 -0
  515. package/build-types/screen-block-list.d.ts +4 -0
  516. package/build-types/screen-block-list.d.ts.map +1 -0
  517. package/build-types/screen-block.d.ts +7 -0
  518. package/build-types/screen-block.d.ts.map +1 -0
  519. package/build-types/screen-color-palette.d.ts +5 -0
  520. package/build-types/screen-color-palette.d.ts.map +1 -0
  521. package/build-types/screen-colors.d.ts +3 -0
  522. package/build-types/screen-colors.d.ts.map +1 -0
  523. package/build-types/screen-css.d.ts +3 -0
  524. package/build-types/screen-css.d.ts.map +1 -0
  525. package/build-types/screen-header.d.ts +8 -0
  526. package/build-types/screen-header.d.ts.map +1 -0
  527. package/build-types/screen-layout.d.ts +3 -0
  528. package/build-types/screen-layout.d.ts.map +1 -0
  529. package/build-types/screen-revisions/index.d.ts +6 -0
  530. package/build-types/screen-revisions/index.d.ts.map +1 -0
  531. package/build-types/screen-revisions/revisions-buttons.d.ts +23 -0
  532. package/build-types/screen-revisions/revisions-buttons.d.ts.map +1 -0
  533. package/build-types/screen-revisions/types.d.ts +17 -0
  534. package/build-types/screen-revisions/types.d.ts.map +1 -0
  535. package/build-types/screen-revisions/use-global-styles-revisions.d.ts +17 -0
  536. package/build-types/screen-revisions/use-global-styles-revisions.d.ts.map +1 -0
  537. package/build-types/screen-root.d.ts +3 -0
  538. package/build-types/screen-root.d.ts.map +1 -0
  539. package/build-types/screen-shadows.d.ts +3 -0
  540. package/build-types/screen-shadows.d.ts.map +1 -0
  541. package/build-types/screen-style-variations.d.ts +3 -0
  542. package/build-types/screen-style-variations.d.ts.map +1 -0
  543. package/build-types/screen-typography-element.d.ts +28 -0
  544. package/build-types/screen-typography-element.d.ts.map +1 -0
  545. package/build-types/screen-typography.d.ts +3 -0
  546. package/build-types/screen-typography.d.ts.map +1 -0
  547. package/build-types/shadow-utils.d.ts +126 -0
  548. package/build-types/shadow-utils.d.ts.map +1 -0
  549. package/build-types/shadows-edit-panel.d.ts +2 -0
  550. package/build-types/shadows-edit-panel.d.ts.map +1 -0
  551. package/build-types/shadows-panel.d.ts +3 -0
  552. package/build-types/shadows-panel.d.ts.map +1 -0
  553. package/build-types/size-control/index.d.ts +11 -0
  554. package/build-types/size-control/index.d.ts.map +1 -0
  555. package/build-types/stories/index.story.d.ts +6 -0
  556. package/build-types/stories/index.story.d.ts.map +1 -0
  557. package/build-types/style-variations-container.d.ts +6 -0
  558. package/build-types/style-variations-container.d.ts.map +1 -0
  559. package/build-types/style-variations-content.d.ts +2 -0
  560. package/build-types/style-variations-content.d.ts.map +1 -0
  561. package/build-types/style-variations.d.ts +25 -0
  562. package/build-types/style-variations.d.ts.map +1 -0
  563. package/build-types/subtitle.d.ts +7 -0
  564. package/build-types/subtitle.d.ts.map +1 -0
  565. package/build-types/test/shadow-utils.spec.d.ts +2 -0
  566. package/build-types/test/shadow-utils.spec.d.ts.map +1 -0
  567. package/build-types/test/utils.spec.d.ts +2 -0
  568. package/build-types/test/utils.spec.d.ts.map +1 -0
  569. package/build-types/typography-elements.d.ts +3 -0
  570. package/build-types/typography-elements.d.ts.map +1 -0
  571. package/build-types/typography-example.d.ts +7 -0
  572. package/build-types/typography-example.d.ts.map +1 -0
  573. package/build-types/typography-panel.d.ts +7 -0
  574. package/build-types/typography-panel.d.ts.map +1 -0
  575. package/build-types/typography-preview.d.ts +8 -0
  576. package/build-types/typography-preview.d.ts.map +1 -0
  577. package/build-types/typography-variations.d.ts +27 -0
  578. package/build-types/typography-variations.d.ts.map +1 -0
  579. package/build-types/utils.d.ts +63 -0
  580. package/build-types/utils.d.ts.map +1 -0
  581. package/build-types/variations/variation.d.ts +10 -0
  582. package/build-types/variations/variation.d.ts.map +1 -0
  583. package/build-types/variations/variations-color.d.ts +7 -0
  584. package/build-types/variations/variations-color.d.ts.map +1 -0
  585. package/build-types/variations/variations-panel.d.ts +13 -0
  586. package/build-types/variations/variations-panel.d.ts.map +1 -0
  587. package/build-types/variations/variations-typography.d.ts +7 -0
  588. package/build-types/variations/variations-typography.d.ts.map +1 -0
  589. package/build-types/with-global-styles-provider.d.ts +20 -0
  590. package/build-types/with-global-styles-provider.d.ts.map +1 -0
  591. package/package.json +67 -0
  592. package/src/README.md +99 -0
  593. package/src/background-panel.tsx +56 -0
  594. package/src/block-preview-panel.tsx +91 -0
  595. package/src/color-indicator-wrapper.tsx +34 -0
  596. package/src/color-palette-panel.tsx +111 -0
  597. package/src/color-preview.tsx +78 -0
  598. package/src/color-variations.tsx +35 -0
  599. package/src/confirm-reset-shadow-dialog.tsx +45 -0
  600. package/src/context.ts +21 -0
  601. package/src/dimensions-panel.tsx +85 -0
  602. package/src/font-families.tsx +127 -0
  603. package/src/font-family-item.tsx +52 -0
  604. package/src/font-library-modal/collection-font-variant.tsx +52 -0
  605. package/src/font-library-modal/context.tsx +591 -0
  606. package/src/font-library-modal/font-card.tsx +77 -0
  607. package/src/font-library-modal/font-collection.tsx +592 -0
  608. package/src/font-library-modal/font-demo.tsx +123 -0
  609. package/src/font-library-modal/google-fonts-confirm-dialog.tsx +57 -0
  610. package/src/font-library-modal/index.tsx +110 -0
  611. package/src/font-library-modal/installed-fonts.tsx +547 -0
  612. package/src/font-library-modal/lib/inflate.js +4112 -0
  613. package/src/font-library-modal/lib/lib-font.browser.d.ts +11 -0
  614. package/src/font-library-modal/lib/lib-font.browser.js +3861 -0
  615. package/src/font-library-modal/lib/unbrotli.js +2706 -0
  616. package/src/font-library-modal/library-font-details.tsx +46 -0
  617. package/src/font-library-modal/library-font-variant.tsx +67 -0
  618. package/src/font-library-modal/resolvers.tsx +100 -0
  619. package/src/font-library-modal/style.scss +222 -0
  620. package/src/font-library-modal/types.ts +176 -0
  621. package/src/font-library-modal/upload-fonts.tsx +269 -0
  622. package/src/font-library-modal/utils/constants.ts +23 -0
  623. package/src/font-library-modal/utils/filter-fonts.ts +47 -0
  624. package/src/font-library-modal/utils/fonts-outline.ts +33 -0
  625. package/src/font-library-modal/utils/index.ts +368 -0
  626. package/src/font-library-modal/utils/make-families-from-faces.ts +34 -0
  627. package/src/font-library-modal/utils/preview-styles.ts +167 -0
  628. package/src/font-library-modal/utils/set-immutably.ts +37 -0
  629. package/src/font-library-modal/utils/sort-font-faces.ts +46 -0
  630. package/src/font-library-modal/utils/toggleFont.ts +109 -0
  631. package/src/font-sizes/confirm-delete-font-size-dialog.tsx +51 -0
  632. package/src/font-sizes/confirm-reset-font-sizes-dialog.tsx +45 -0
  633. package/src/font-sizes/font-size-preview.tsx +47 -0
  634. package/src/font-sizes/font-size.tsx +289 -0
  635. package/src/font-sizes/font-sizes-count.tsx +37 -0
  636. package/src/font-sizes/font-sizes.tsx +265 -0
  637. package/src/font-sizes/rename-font-size-dialog.tsx +83 -0
  638. package/src/global-styles-ui.tsx +292 -0
  639. package/src/gradients-palette-panel.tsx +126 -0
  640. package/src/highlighted-colors.tsx +44 -0
  641. package/src/hooks.ts +251 -0
  642. package/src/icon-with-current-color.tsx +31 -0
  643. package/src/index.ts +7 -0
  644. package/src/lock-unlock.ts +10 -0
  645. package/src/navigation-button.tsx +53 -0
  646. package/src/pagination/index.tsx +107 -0
  647. package/src/pagination/style.scss +7 -0
  648. package/src/palette.tsx +101 -0
  649. package/src/preset-colors.tsx +18 -0
  650. package/src/preview-colors.tsx +68 -0
  651. package/src/preview-hooks.tsx +58 -0
  652. package/src/preview-styles.tsx +196 -0
  653. package/src/preview-typography.tsx +49 -0
  654. package/src/preview-wrapper.tsx +137 -0
  655. package/src/provider.tsx +54 -0
  656. package/src/root-menu.tsx +87 -0
  657. package/src/screen-background.tsx +37 -0
  658. package/src/screen-block-list.tsx +198 -0
  659. package/src/screen-block.tsx +370 -0
  660. package/src/screen-color-palette.tsx +47 -0
  661. package/src/screen-colors.tsx +67 -0
  662. package/src/screen-css.tsx +56 -0
  663. package/src/screen-header.tsx +56 -0
  664. package/src/screen-layout.tsx +34 -0
  665. package/src/screen-revisions/index.tsx +158 -0
  666. package/src/screen-revisions/revisions-buttons.tsx +259 -0
  667. package/src/screen-revisions/style.scss +194 -0
  668. package/src/screen-revisions/types.ts +18 -0
  669. package/src/screen-revisions/use-global-styles-revisions.tsx +204 -0
  670. package/src/screen-root.tsx +146 -0
  671. package/src/screen-shadows.tsx +13 -0
  672. package/src/screen-style-variations.tsx +36 -0
  673. package/src/screen-typography-element.tsx +127 -0
  674. package/src/screen-typography.tsx +41 -0
  675. package/src/shadow-utils.ts +167 -0
  676. package/src/shadows-edit-panel.tsx +559 -0
  677. package/src/shadows-panel.tsx +207 -0
  678. package/src/size-control/index.tsx +97 -0
  679. package/src/size-control/style.scss +7 -0
  680. package/src/stories/index.story.js +410 -0
  681. package/src/style-variations-container.tsx +153 -0
  682. package/src/style-variations-content.tsx +24 -0
  683. package/src/style-variations.tsx +33 -0
  684. package/src/style.scss +287 -0
  685. package/src/subtitle.tsx +17 -0
  686. package/src/test/shadow-utils.spec.js +251 -0
  687. package/src/test/utils.spec.js +59 -0
  688. package/src/typography-elements.tsx +113 -0
  689. package/src/typography-example.tsx +78 -0
  690. package/src/typography-panel.tsx +56 -0
  691. package/src/typography-preview.tsx +61 -0
  692. package/src/typography-variations.tsx +35 -0
  693. package/src/utils.ts +301 -0
  694. package/src/variations/style.scss +43 -0
  695. package/src/variations/variation.tsx +113 -0
  696. package/src/variations/variations-color.tsx +54 -0
  697. package/src/variations/variations-panel.tsx +79 -0
  698. package/src/variations/variations-typography.tsx +65 -0
  699. package/src/with-global-styles-provider.tsx +44 -0
  700. package/tsconfig.json +26 -0
  701. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var global_styles_ui_exports = {};
30
+ __export(global_styles_ui_exports, {
31
+ GlobalStylesUI: () => GlobalStylesUI
32
+ });
33
+ module.exports = __toCommonJS(global_styles_ui_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_components = require("@wordpress/components");
36
+ var import_blocks = require("@wordpress/blocks");
37
+ var import_data = require("@wordpress/data");
38
+ var import_block_editor = require("@wordpress/block-editor");
39
+ var import_element = require("@wordpress/element");
40
+ var import_compose = require("@wordpress/compose");
41
+ var import_global_styles_engine = require("@wordpress/global-styles-engine");
42
+ var import_provider = require("./provider");
43
+ var import_screen_root = __toESM(require("./screen-root"));
44
+ var import_screen_block_list = __toESM(require("./screen-block-list"));
45
+ var import_screen_block = __toESM(require("./screen-block"));
46
+ var import_screen_typography = __toESM(require("./screen-typography"));
47
+ var import_screen_typography_element = __toESM(require("./screen-typography-element"));
48
+ var import_screen_colors = __toESM(require("./screen-colors"));
49
+ var import_screen_color_palette = __toESM(require("./screen-color-palette"));
50
+ var import_screen_background = __toESM(require("./screen-background"));
51
+ var import_screen_shadows = require("./screen-shadows");
52
+ var import_screen_layout = __toESM(require("./screen-layout"));
53
+ var import_screen_style_variations = __toESM(require("./screen-style-variations"));
54
+ var import_screen_css = __toESM(require("./screen-css"));
55
+ var import_screen_revisions = __toESM(require("./screen-revisions"));
56
+ var import_font_sizes = __toESM(require("./font-sizes/font-sizes"));
57
+ var import_font_size = __toESM(require("./font-sizes/font-size"));
58
+ function BlockStylesNavigationScreens({
59
+ parentMenu,
60
+ blockStyles,
61
+ blockName
62
+ }) {
63
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: blockStyles.map((style, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
64
+ import_components.Navigator.Screen,
65
+ {
66
+ path: parentMenu + "/variations/" + style.name,
67
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_block.default, { name: blockName, variation: style.name })
68
+ },
69
+ index
70
+ )) });
71
+ }
72
+ function ContextScreens({ name, parentMenu = "" }) {
73
+ const blockStyleVariations = (0, import_data.useSelect)(
74
+ (select) => {
75
+ if (!name) {
76
+ return [];
77
+ }
78
+ const { getBlockStyles } = select(import_blocks.store);
79
+ return getBlockStyles(name);
80
+ },
81
+ [name]
82
+ );
83
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: parentMenu + "/colors/palette", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_color_palette.default, { name }) }),
85
+ !!blockStyleVariations?.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
86
+ BlockStylesNavigationScreens,
87
+ {
88
+ parentMenu,
89
+ blockStyles: blockStyleVariations,
90
+ blockName: name || ""
91
+ }
92
+ )
93
+ ] });
94
+ }
95
+ function GlobalStylesUI({
96
+ value,
97
+ baseValue,
98
+ onChange,
99
+ path,
100
+ onPathChange,
101
+ fontLibraryEnabled = false,
102
+ serverCSS,
103
+ serverSettings
104
+ }) {
105
+ const blocks = (0, import_blocks.getBlockTypes)();
106
+ const mergedValue = (0, import_element.useMemo)(() => {
107
+ return (0, import_global_styles_engine.mergeGlobalStyles)(baseValue, value);
108
+ }, [baseValue, value]);
109
+ const [globalStylesCSS, globalSettings] = (0, import_global_styles_engine.generateGlobalStyles)(mergedValue);
110
+ const styles = (0, import_element.useMemo)(
111
+ () => [...serverCSS ?? [], ...globalStylesCSS ?? []],
112
+ [serverCSS, globalStylesCSS]
113
+ );
114
+ const settings = (0, import_element.useMemo)(() => {
115
+ return {
116
+ ...serverSettings,
117
+ __experimentalFeatures: globalSettings,
118
+ styles
119
+ };
120
+ }, [globalSettings, serverSettings, styles]);
121
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
+ import_provider.GlobalStylesProvider,
123
+ {
124
+ value,
125
+ baseValue,
126
+ onChange,
127
+ fontLibraryEnabled,
128
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockEditorProvider, { settings, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
129
+ import_components.Navigator,
130
+ {
131
+ className: "global-styles-ui-sidebar__navigator-provider",
132
+ initialPath: path || "/",
133
+ children: [
134
+ (path || onPathChange) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
135
+ PathSynchronizer,
136
+ {
137
+ path,
138
+ onPathChange
139
+ }
140
+ ),
141
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_root.default, {}) }),
142
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/colors", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_colors.default, {}) }),
143
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/typography", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_typography.default, {}) }),
144
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_font_sizes.default, {}) }),
145
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/typography/font-sizes/:origin/:slug", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_font_size.default, {}) }),
146
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/layout", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_layout.default, {}) }),
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/colors/palette", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_color_palette.default, {}) }),
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/variations", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_style_variations.default, {}) }),
149
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/css", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_css.default, {}) }),
150
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/revisions/:revisionId?", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_revisions.default, {}) }),
151
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/shadows", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_shadows.ScreenShadows, {}) }),
152
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/shadows/edit/:category/:slug", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_shadows.ScreenShadowsEdit, {}) }),
153
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/background", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_background.default, {}) }),
154
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/typography/text", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_typography_element.default, { element: "text" }) }),
155
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/typography/link", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_typography_element.default, { element: "link" }) }),
156
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/typography/heading", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_typography_element.default, { element: "heading" }) }),
157
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/typography/caption", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_typography_element.default, { element: "caption" }) }),
158
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/typography/button", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_typography_element.default, { element: "button" }) }),
159
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/blocks", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_block_list.default, {}) }),
160
+ blocks.map((block) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
161
+ import_components.Navigator.Screen,
162
+ {
163
+ path: "/blocks/" + encodeURIComponent(block.name),
164
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_screen_block.default, { name: block.name })
165
+ },
166
+ "menu-block-" + block.name
167
+ )),
168
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContextScreens, {}),
169
+ blocks.map((block) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
170
+ ContextScreens,
171
+ {
172
+ name: block.name,
173
+ parentMenu: "/blocks/" + encodeURIComponent(block.name)
174
+ },
175
+ "screens-block-" + block.name
176
+ ))
177
+ ]
178
+ }
179
+ ) })
180
+ }
181
+ );
182
+ }
183
+ function PathSynchronizer({
184
+ path,
185
+ onPathChange
186
+ }) {
187
+ const navigator = (0, import_components.useNavigator)();
188
+ const { path: childPath } = navigator.location;
189
+ const previousParentPath = (0, import_compose.usePrevious)(path);
190
+ const previousChildPath = (0, import_compose.usePrevious)(childPath);
191
+ (0, import_element.useEffect)(() => {
192
+ if (path && path !== childPath) {
193
+ if (path !== previousParentPath) {
194
+ navigator.goTo(path);
195
+ } else if (childPath !== previousChildPath && onPathChange) {
196
+ onPathChange(childPath ?? "/");
197
+ }
198
+ }
199
+ }, [
200
+ onPathChange,
201
+ path,
202
+ previousChildPath,
203
+ previousParentPath,
204
+ childPath,
205
+ navigator
206
+ ]);
207
+ return null;
208
+ }
209
+ // Annotate the CommonJS export names for ESM import in node:
210
+ 0 && (module.exports = {
211
+ GlobalStylesUI
212
+ });
213
+ //# sourceMappingURL=global-styles-ui.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/global-styles-ui.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Navigator, useNavigator } from '@wordpress/components';\n// @ts-expect-error: Not typed yet.\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n// @ts-expect-error: Not typed yet.\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tgenerateGlobalStyles,\n\tmergeGlobalStyles,\n} from '@wordpress/global-styles-engine';\nimport type {\n\tGlobalStylesConfig,\n\tBlockType,\n} from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { GlobalStylesProvider } from './provider';\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 ScreenBackground from './screen-background';\nimport { ScreenShadows, ScreenShadowsEdit } from './screen-shadows';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport ScreenCSS from './screen-css';\nimport ScreenRevisions from './screen-revisions';\nimport FontSizes from './font-sizes/font-sizes';\nimport FontSize from './font-sizes/font-size';\ninterface BlockStylesNavigationScreensProps {\n\tparentMenu: string;\n\tblockStyles: any[];\n\tblockName: string;\n}\n\nfunction BlockStylesNavigationScreens( {\n\tparentMenu,\n\tblockStyles,\n\tblockName,\n}: BlockStylesNavigationScreensProps ) {\n\treturn (\n\t\t<>\n\t\t\t{ blockStyles.map( ( style, index ) => (\n\t\t\t\t<Navigator.Screen\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tpath={ parentMenu + '/variations/' + style.name }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ blockName } variation={ style.name } />\n\t\t\t\t</Navigator.Screen>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\ninterface ContextScreensProps {\n\tname?: string;\n\tparentMenu?: string;\n}\n\nfunction ContextScreens( { name, parentMenu = '' }: ContextScreensProps ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! name ) {\n\t\t\t\treturn [];\n\t\t\t}\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<Navigator.Screen path={ parentMenu + '/colors/palette' }>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</Navigator.Screen>\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\ninterface GlobalStylesUIProps {\n\t/** User global styles object (what gets edited) */\n\tvalue: GlobalStylesConfig;\n\t/** Base global styles object (theme default) */\n\tbaseValue: GlobalStylesConfig;\n\t/** Callback when global styles change */\n\tonChange: ( newValue: GlobalStylesConfig ) => void;\n\t/** Current navigation path (optional) */\n\tpath?: string;\n\t/** Callback when navigation path changes (optional) */\n\tonPathChange?: ( path: string ) => void;\n\t/** Whether font library is enabled (optional) */\n\tfontLibraryEnabled?: boolean;\n\t/** Server CSS styles for BlockEditorProvider (optional) */\n\tserverCSS?: { isGlobalStyles?: boolean }[];\n\t/** Server settings for BlockEditorProvider (optional) */\n\tserverSettings?: { __unstableResolvedAssets: Record< string, unknown > };\n}\n\nexport function GlobalStylesUI( {\n\tvalue,\n\tbaseValue,\n\tonChange,\n\tpath,\n\tonPathChange,\n\tfontLibraryEnabled = false,\n\tserverCSS,\n\tserverSettings,\n}: GlobalStylesUIProps ) {\n\tconst blocks = getBlockTypes();\n\n\t// Compute merged value for CSS generation\n\tconst mergedValue = useMemo( () => {\n\t\treturn mergeGlobalStyles( baseValue, value );\n\t}, [ baseValue, value ] );\n\n\tconst [ globalStylesCSS, globalSettings ] =\n\t\tgenerateGlobalStyles( mergedValue );\n\tconst styles = useMemo(\n\t\t() => [ ...( serverCSS ?? [] ), ...( globalStylesCSS ?? [] ) ],\n\t\t[ serverCSS, globalStylesCSS ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\treturn {\n\t\t\t...serverSettings,\n\t\t\t__experimentalFeatures: globalSettings,\n\t\t\tstyles,\n\t\t};\n\t}, [ globalSettings, serverSettings, styles ] );\n\n\treturn (\n\t\t<GlobalStylesProvider\n\t\t\tvalue={ value }\n\t\t\tbaseValue={ baseValue }\n\t\t\tonChange={ onChange }\n\t\t\tfontLibraryEnabled={ fontLibraryEnabled }\n\t\t>\n\t\t\t<BlockEditorProvider settings={ settings }>\n\t\t\t\t<Navigator\n\t\t\t\t\tclassName=\"global-styles-ui-sidebar__navigator-provider\"\n\t\t\t\t\tinitialPath={ path || '/' }\n\t\t\t\t>\n\t\t\t\t\t{ ( path || onPathChange ) && (\n\t\t\t\t\t\t<PathSynchronizer\n\t\t\t\t\t\t\tpath={ path }\n\t\t\t\t\t\t\tonPathChange={ onPathChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<Navigator.Screen path=\"/\">\n\t\t\t\t\t\t<ScreenRoot />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/colors\">\n\t\t\t\t\t\t<ScreenColors />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography\">\n\t\t\t\t\t\t<ScreenTypography />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/font-sizes\">\n\t\t\t\t\t\t<FontSizes />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/font-sizes/:origin/:slug\">\n\t\t\t\t\t\t<FontSize />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/layout\">\n\t\t\t\t\t\t<ScreenLayout />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/colors/palette\">\n\t\t\t\t\t\t<ScreenColorPalette />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/variations\">\n\t\t\t\t\t\t<ScreenStyleVariations />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/css\">\n\t\t\t\t\t\t<ScreenCSS />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/revisions/:revisionId?\">\n\t\t\t\t\t\t<ScreenRevisions />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/shadows\">\n\t\t\t\t\t\t<ScreenShadows />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/shadows/edit/:category/:slug\">\n\t\t\t\t\t\t<ScreenShadowsEdit />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/background\">\n\t\t\t\t\t\t<ScreenBackground />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/text\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"text\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/link\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"link\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/heading\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"heading\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/caption\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"caption\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/button\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"button\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/blocks\">\n\t\t\t\t\t\t<ScreenBlockList />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t{ blocks.map( ( block: BlockType ) => (\n\t\t\t\t\t\t<Navigator.Screen\n\t\t\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\t\t\tpath={\n\t\t\t\t\t\t\t\t'/blocks/' + encodeURIComponent( block.name )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t) ) }\n\n\t\t\t\t\t<ContextScreens />\n\n\t\t\t\t\t{ blocks.map( ( block: BlockType ) => (\n\t\t\t\t\t\t<ContextScreens\n\t\t\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\t\t\tname={ block.name }\n\t\t\t\t\t\t\tparentMenu={\n\t\t\t\t\t\t\t\t'/blocks/' + encodeURIComponent( block.name )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</Navigator>\n\t\t\t</BlockEditorProvider>\n\t\t</GlobalStylesProvider>\n\t);\n}\n\n/*\n * Component that handles path synchronization between external path prop and Navigator's internal path.\n */\nfunction PathSynchronizer( {\n\tpath,\n\tonPathChange,\n}: {\n\tpath?: string;\n\tonPathChange?: ( path: string ) => void;\n} ) {\n\tconst navigator = useNavigator();\n\tconst { path: childPath } = navigator.location;\n\tconst previousParentPath = usePrevious( path );\n\tconst previousChildPath = usePrevious( childPath );\n\n\tuseEffect( () => {\n\t\t// Only sync when parent and child paths are out of sync\n\t\tif ( path && path !== childPath ) {\n\t\t\t// If parent path changed, update the Navigator\n\t\t\tif ( path !== previousParentPath ) {\n\t\t\t\tnavigator.goTo( path );\n\t\t\t}\n\t\t\t// If child path changed, notify parent via onPathChange\n\t\t\telse if ( childPath !== previousChildPath && onPathChange ) {\n\t\t\t\tonPathChange( childPath ?? '/' );\n\t\t\t}\n\t\t}\n\t}, [\n\t\tonPathChange,\n\t\tpath,\n\t\tpreviousChildPath,\n\t\tpreviousParentPath,\n\t\tchildPath,\n\t\tnavigator,\n\t] );\n\n\t// This component only handles synchronization logic. It doesn't render anything.\n\t// We use it to run the effect inside the Navigator context.\n\treturn null;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmDE;AAhDF,wBAAwC;AAExC,oBAAoD;AACpD,kBAA0B;AAE1B,0BAAoC;AACpC,qBAAmC;AACnC,qBAA4B;AAC5B,kCAGO;AASP,sBAAqC;AACrC,yBAAuB;AACvB,+BAA4B;AAC5B,0BAAwB;AACxB,+BAA6B;AAC7B,uCAAoC;AACpC,2BAAyB;AACzB,kCAA+B;AAC/B,+BAA6B;AAC7B,4BAAiD;AACjD,2BAAyB;AACzB,qCAAkC;AAClC,wBAAsB;AACtB,8BAA4B;AAC5B,wBAAsB;AACtB,uBAAqB;AAOrB,SAAS,6BAA8B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AACD,GAAuC;AACtC,SACC,2EACG,sBAAY,IAAK,CAAE,OAAO,UAC3B;AAAA,IAAC,4BAAU;AAAA,IAAV;AAAA,MAEA,MAAO,aAAa,iBAAiB,MAAM;AAAA,MAE3C,sDAAC,oBAAAA,SAAA,EAAY,MAAO,WAAY,WAAY,MAAM,MAAO;AAAA;AAAA,IAHnD;AAAA,EAIP,CACC,GACH;AAEF;AAOA,SAAS,eAAgB,EAAE,MAAM,aAAa,GAAG,GAAyB;AACzE,QAAM,2BAAuB;AAAA,IAC5B,CAAE,WAAY;AACb,UAAK,CAAE,MAAO;AACb,eAAO,CAAC;AAAA,MACT;AACA,YAAM,EAAE,eAAe,IAAI,OAAQ,cAAAC,KAAY;AAC/C,aAAO,eAAgB,IAAK;AAAA,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ACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAIF,SAAO;AACR;",
6
+ "names": ["ScreenBlock", "blocksStore", "ScreenColorPalette", "ScreenRoot", "ScreenColors", "ScreenTypography", "FontSizes", "FontSize", "ScreenLayout", "ScreenStyleVariations", "ScreenCSS", "ScreenRevisions", "ScreenBackground", "ScreenTypographyElement", "ScreenBlockList"]
7
+ }
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var gradients_palette_panel_exports = {};
20
+ __export(gradients_palette_panel_exports, {
21
+ default: () => GradientPalettePanel
22
+ });
23
+ module.exports = __toCommonJS(gradients_palette_panel_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_compose = require("@wordpress/compose");
26
+ var import_components = require("@wordpress/components");
27
+ var import_i18n = require("@wordpress/i18n");
28
+ var import_subtitle = require("./subtitle");
29
+ var import_hooks = require("./hooks");
30
+ const mobilePopoverProps = { placement: "bottom-start", offset: 8 };
31
+ const noop = () => {
32
+ };
33
+ function GradientPalettePanel({
34
+ name
35
+ }) {
36
+ const [themeGradients, setThemeGradients] = (0, import_hooks.useSetting)(
37
+ "color.gradients.theme",
38
+ name
39
+ );
40
+ const [baseThemeGradients] = (0, import_hooks.useSetting)(
41
+ "color.gradients.theme",
42
+ name,
43
+ "base"
44
+ );
45
+ const [defaultGradients, setDefaultGradients] = (0, import_hooks.useSetting)(
46
+ "color.gradients.default",
47
+ name
48
+ );
49
+ const [baseDefaultGradients] = (0, import_hooks.useSetting)(
50
+ "color.gradients.default",
51
+ name,
52
+ "base"
53
+ );
54
+ const [customGradients, setCustomGradients] = (0, import_hooks.useSetting)(
55
+ "color.gradients.custom",
56
+ name
57
+ );
58
+ const [defaultPaletteEnabled] = (0, import_hooks.useSetting)(
59
+ "color.defaultGradients",
60
+ name
61
+ );
62
+ const [customDuotone] = (0, import_hooks.useSetting)("color.duotone.custom") || [];
63
+ const [defaultDuotone] = (0, import_hooks.useSetting)("color.duotone.default") || [];
64
+ const [themeDuotone] = (0, import_hooks.useSetting)("color.duotone.theme") || [];
65
+ const [defaultDuotoneEnabled] = (0, import_hooks.useSetting)("color.defaultDuotone");
66
+ const duotonePalette = [
67
+ ...customDuotone || [],
68
+ ...themeDuotone || [],
69
+ ...defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : []
70
+ ];
71
+ const isMobileViewport = (0, import_compose.useViewportMatch)("small", "<");
72
+ const popoverProps = isMobileViewport ? mobilePopoverProps : void 0;
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
74
+ import_components.__experimentalVStack,
75
+ {
76
+ className: "global-styles-ui-gradient-palette-panel",
77
+ spacing: 8,
78
+ children: [
79
+ !!themeGradients && !!themeGradients.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
+ import_components.__experimentalPaletteEdit,
81
+ {
82
+ canReset: themeGradients !== baseThemeGradients,
83
+ canOnlyChangeValues: true,
84
+ gradients: themeGradients,
85
+ onChange: setThemeGradients,
86
+ paletteLabel: (0, import_i18n.__)("Theme"),
87
+ paletteLabelHeadingLevel: 3,
88
+ popoverProps
89
+ }
90
+ ),
91
+ !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
+ import_components.__experimentalPaletteEdit,
93
+ {
94
+ canReset: defaultGradients !== baseDefaultGradients,
95
+ canOnlyChangeValues: true,
96
+ gradients: defaultGradients,
97
+ onChange: setDefaultGradients,
98
+ paletteLabel: (0, import_i18n.__)("Default"),
99
+ paletteLabelHeadingLevel: 3,
100
+ popoverProps
101
+ }
102
+ ),
103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
+ import_components.__experimentalPaletteEdit,
105
+ {
106
+ gradients: customGradients,
107
+ onChange: setCustomGradients,
108
+ paletteLabel: (0, import_i18n.__)("Custom"),
109
+ paletteLabelHeadingLevel: 3,
110
+ slugPrefix: "custom-",
111
+ popoverProps
112
+ }
113
+ ),
114
+ !!duotonePalette && !!duotonePalette.length && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
115
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_subtitle.Subtitle, { level: 3, children: (0, import_i18n.__)("Duotone") }),
116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalSpacer, { margin: 3 }),
117
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
+ import_components.DuotonePicker,
119
+ {
120
+ duotonePalette,
121
+ disableCustomDuotone: true,
122
+ disableCustomColors: true,
123
+ clearable: false,
124
+ onChange: noop,
125
+ colorPalette: []
126
+ }
127
+ )
128
+ ] })
129
+ ]
130
+ }
131
+ );
132
+ }
133
+ //# sourceMappingURL=gradients-palette-panel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/gradients-palette-panel.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalPaletteEdit as PaletteEdit,\n\t__experimentalSpacer as Spacer,\n\tDuotonePicker,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport type { Gradient } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { Subtitle } from './subtitle';\nimport { useSetting } from './hooks';\n\nconst mobilePopoverProps = { placement: 'bottom-start' as const, offset: 8 };\n\nconst noop = () => {};\n\ninterface GradientPalettePanelProps {\n\tname?: string;\n}\n\nexport default function GradientPalettePanel( {\n\tname,\n}: GradientPalettePanelProps ) {\n\tconst [ themeGradients, setThemeGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.theme',\n\t\tname\n\t);\n\tconst [ baseThemeGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.theme',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ defaultGradients, setDefaultGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.default',\n\t\tname\n\t);\n\tconst [ baseDefaultGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.default',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ customGradients, setCustomGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.custom',\n\t\tname\n\t);\n\n\tconst [ defaultPaletteEnabled ] = useSetting< boolean >(\n\t\t'color.defaultGradients',\n\t\tname\n\t);\n\n\tconst [ customDuotone ] = useSetting( 'color.duotone.custom' ) || [];\n\tconst [ defaultDuotone ] = useSetting( 'color.duotone.default' ) || [];\n\tconst [ themeDuotone ] = useSetting( 'color.duotone.theme' ) || [];\n\tconst [ defaultDuotoneEnabled ] = useSetting( 'color.defaultDuotone' );\n\n\tconst duotonePalette = [\n\t\t...( customDuotone || [] ),\n\t\t...( themeDuotone || [] ),\n\t\t...( defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [] ),\n\t];\n\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst popoverProps = isMobileViewport ? mobilePopoverProps : undefined;\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"global-styles-ui-gradient-palette-panel\"\n\t\t\tspacing={ 8 }\n\t\t>\n\t\t\t{ !! themeGradients && !! themeGradients.length && (\n\t\t\t\t<PaletteEdit\n\t\t\t\t\tcanReset={ themeGradients !== baseThemeGradients }\n\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\tgradients={ themeGradients }\n\t\t\t\t\tonChange={ setThemeGradients }\n\t\t\t\t\tpaletteLabel={ __( 'Theme' ) }\n\t\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! defaultGradients &&\n\t\t\t\t!! defaultGradients.length &&\n\t\t\t\t!! defaultPaletteEnabled && (\n\t\t\t\t\t<PaletteEdit\n\t\t\t\t\t\tcanReset={ defaultGradients !== baseDefaultGradients }\n\t\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\t\tgradients={ defaultGradients }\n\t\t\t\t\t\tonChange={ setDefaultGradients }\n\t\t\t\t\t\tpaletteLabel={ __( 'Default' ) }\n\t\t\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t<PaletteEdit\n\t\t\t\tgradients={ customGradients }\n\t\t\t\tonChange={ setCustomGradients }\n\t\t\t\tpaletteLabel={ __( 'Custom' ) }\n\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\tslugPrefix=\"custom-\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t/>\n\t\t\t{ !! duotonePalette && !! duotonePalette.length && (\n\t\t\t\t<div>\n\t\t\t\t\t<Subtitle level={ 3 }>{ __( 'Duotone' ) }</Subtitle>\n\t\t\t\t\t<Spacer margin={ 3 } />\n\t\t\t\t\t<DuotonePicker\n\t\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\t\tdisableCustomDuotone\n\t\t\t\t\t\tdisableCustomColors\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\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teEdit", "Spacer"]
7
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var highlighted_colors_exports = {};
20
+ __export(highlighted_colors_exports, {
21
+ default: () => HighlightedColors
22
+ });
23
+ module.exports = __toCommonJS(highlighted_colors_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_components = require("@wordpress/components");
26
+ var import_preview_hooks = require("./preview-hooks");
27
+ function HighlightedColors({
28
+ normalizedColorSwatchSize,
29
+ ratio
30
+ }) {
31
+ const { highlightedColors } = (0, import_preview_hooks.useStylesPreviewColors)();
32
+ const scaledSwatchSize = normalizedColorSwatchSize * ratio;
33
+ return highlightedColors.map(({ slug, color }, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
34
+ import_components.__unstableMotion.div,
35
+ {
36
+ style: {
37
+ height: scaledSwatchSize,
38
+ width: scaledSwatchSize,
39
+ background: color,
40
+ borderRadius: scaledSwatchSize / 2
41
+ },
42
+ animate: {
43
+ scale: 1,
44
+ opacity: 1
45
+ },
46
+ initial: {
47
+ scale: 0.1,
48
+ opacity: 0
49
+ },
50
+ transition: {
51
+ delay: index === 1 ? 0.2 : 0.1
52
+ }
53
+ },
54
+ `${slug}-${index}`
55
+ ));
56
+ }
57
+ //# sourceMappingURL=highlighted-colors.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/highlighted-colors.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useStylesPreviewColors } from './preview-hooks';\n\ninterface HighlightedColorsProps {\n\tnormalizedColorSwatchSize: number;\n\tratio: number;\n}\n\nexport default function HighlightedColors( {\n\tnormalizedColorSwatchSize,\n\tratio,\n}: HighlightedColorsProps ) {\n\tconst { highlightedColors } = useStylesPreviewColors();\n\tconst scaledSwatchSize = normalizedColorSwatchSize * ratio;\n\treturn highlightedColors.map( ( { slug, color }, index ) => (\n\t\t<motion.div\n\t\t\tkey={ `${ slug }-${ index }` }\n\t\t\tstyle={ {\n\t\t\t\theight: scaledSwatchSize,\n\t\t\t\twidth: scaledSwatchSize,\n\t\t\t\tbackground: color,\n\t\t\t\tborderRadius: scaledSwatchSize / 2,\n\t\t\t} }\n\t\t\tanimate={ {\n\t\t\t\tscale: 1,\n\t\t\t\topacity: 1,\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tscale: 0.1,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\ttransition={ {\n\t\t\t\tdelay: index === 1 ? 0.2 : 0.1,\n\t\t\t} }\n\t\t/>\n\t) );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBE;AAnBF,wBAA2C;AAK3C,2BAAuC;AAOxB,SAAR,kBAAoC;AAAA,EAC1C;AAAA,EACA;AACD,GAA4B;AAC3B,QAAM,EAAE,kBAAkB,QAAI,6CAAuB;AACrD,QAAM,mBAAmB,4BAA4B;AACrD,SAAO,kBAAkB,IAAK,CAAE,EAAE,MAAM,MAAM,GAAG,UAChD;AAAA,IAAC,kBAAAA,iBAAO;AAAA,IAAP;AAAA,MAEA,OAAQ;AAAA,QACP,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,YAAY;AAAA,QACZ,cAAc,mBAAmB;AAAA,MAClC;AAAA,MACA,SAAU;AAAA,QACT,OAAO;AAAA,QACP,SAAS;AAAA,MACV;AAAA,MACA,SAAU;AAAA,QACT,OAAO;AAAA,QACP,SAAS;AAAA,MACV;AAAA,MACA,YAAa;AAAA,QACZ,OAAO,UAAU,IAAI,MAAM;AAAA,MAC5B;AAAA;AAAA,IAjBM,GAAI,IAAK,IAAK,KAAM;AAAA,EAkB3B,CACC;AACH;",
6
+ "names": ["motion"]
7
+ }
package/build/hooks.js ADDED
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var hooks_exports = {};
30
+ __export(hooks_exports, {
31
+ useColorRandomizer: () => useColorRandomizer,
32
+ useColorVariations: () => useColorVariations,
33
+ useCurrentMergeThemeStyleVariationsWithUserConfig: () => useCurrentMergeThemeStyleVariationsWithUserConfig,
34
+ useSetting: () => useSetting,
35
+ useStyle: () => useStyle
36
+ });
37
+ module.exports = __toCommonJS(hooks_exports);
38
+ var import_colord = require("colord");
39
+ var import_a11y = __toESM(require("colord/plugins/a11y"));
40
+ var import_element = require("@wordpress/element");
41
+ var import_data = require("@wordpress/data");
42
+ var import_core_data = require("@wordpress/core-data");
43
+ var import_i18n = require("@wordpress/i18n");
44
+ var import_global_styles_engine = require("@wordpress/global-styles-engine");
45
+ var import_context = require("./context");
46
+ var import_utils = require("./utils");
47
+ (0, import_colord.extend)([import_a11y.default]);
48
+ function useStyle(path, blockName, readFrom = "merged", shouldDecodeEncode = true) {
49
+ const { user, base, merged, onChange } = (0, import_element.useContext)(import_context.GlobalStylesContext);
50
+ let sourceValue = merged;
51
+ if (readFrom === "base") {
52
+ sourceValue = base;
53
+ } else if (readFrom === "user") {
54
+ sourceValue = user;
55
+ }
56
+ const styleValue = (0, import_element.useMemo)(
57
+ () => (0, import_global_styles_engine.getStyle)(sourceValue, path, blockName, shouldDecodeEncode),
58
+ [sourceValue, path, blockName, shouldDecodeEncode]
59
+ );
60
+ const setStyleValue = (0, import_element.useCallback)(
61
+ (newValue) => {
62
+ const newGlobalStyles = (0, import_global_styles_engine.setStyle)(
63
+ user,
64
+ path,
65
+ newValue,
66
+ blockName
67
+ );
68
+ onChange(newGlobalStyles);
69
+ },
70
+ [user, onChange, path, blockName]
71
+ );
72
+ return [styleValue, setStyleValue];
73
+ }
74
+ function useSetting(path, blockName, readFrom = "merged") {
75
+ const { user, base, merged, onChange } = (0, import_element.useContext)(import_context.GlobalStylesContext);
76
+ let sourceValue = merged;
77
+ if (readFrom === "base") {
78
+ sourceValue = base;
79
+ } else if (readFrom === "user") {
80
+ sourceValue = user;
81
+ }
82
+ const settingValue = (0, import_element.useMemo)(
83
+ () => (0, import_global_styles_engine.getSetting)(sourceValue, path, blockName),
84
+ [sourceValue, path, blockName]
85
+ );
86
+ const setSettingValue = (0, import_element.useCallback)(
87
+ (newValue) => {
88
+ const newGlobalStyles = (0, import_global_styles_engine.setSetting)(
89
+ user,
90
+ path,
91
+ newValue,
92
+ blockName
93
+ );
94
+ onChange(newGlobalStyles);
95
+ },
96
+ [user, onChange, path, blockName]
97
+ );
98
+ return [settingValue, setSettingValue];
99
+ }
100
+ const EMPTY_ARRAY = [];
101
+ function hasThemeVariation({
102
+ title,
103
+ settings,
104
+ styles
105
+ }) {
106
+ return title === (0, import_i18n.__)("Default") || Object.keys(settings || {}).length > 0 || Object.keys(styles || {}).length > 0;
107
+ }
108
+ function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
109
+ const { variationsFromTheme } = (0, import_data.useSelect)((select) => {
110
+ const _variationsFromTheme = select(
111
+ import_core_data.store
112
+ ).__experimentalGetCurrentThemeGlobalStylesVariations?.();
113
+ return {
114
+ variationsFromTheme: _variationsFromTheme || EMPTY_ARRAY
115
+ };
116
+ }, []);
117
+ const { user: userVariation } = (0, import_element.useContext)(import_context.GlobalStylesContext);
118
+ return (0, import_element.useMemo)(() => {
119
+ const clonedUserVariation = structuredClone(userVariation);
120
+ const userVariationWithoutProperties = (0, import_utils.removePropertiesFromObject)(
121
+ clonedUserVariation,
122
+ properties
123
+ );
124
+ userVariationWithoutProperties.title = (0, import_i18n.__)("Default");
125
+ const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => {
126
+ return (0, import_utils.isVariationWithProperties)(variation, properties);
127
+ }).map((variation) => {
128
+ return (0, import_global_styles_engine.mergeGlobalStyles)(
129
+ userVariationWithoutProperties,
130
+ variation
131
+ );
132
+ });
133
+ const variationsByProperties = [
134
+ userVariationWithoutProperties,
135
+ ...variationsWithPropertiesAndBase
136
+ ];
137
+ return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
138
+ }, [properties, userVariation, variationsFromTheme]);
139
+ }
140
+ const propertiesToFilter = ["color"];
141
+ function useColorVariations() {
142
+ return useCurrentMergeThemeStyleVariationsWithUserConfig(
143
+ propertiesToFilter
144
+ );
145
+ }
146
+ function useColorRandomizer(blockName) {
147
+ const [themeColors, setThemeColors] = useSetting(
148
+ "color.palette.theme",
149
+ blockName
150
+ );
151
+ const randomizeColors = (0, import_element.useCallback)(() => {
152
+ if (!themeColors || !themeColors.length) {
153
+ return;
154
+ }
155
+ const randomRotationValue = Math.floor(Math.random() * 225);
156
+ const newColors = themeColors.map((colorObject) => {
157
+ const { color } = colorObject;
158
+ const newColor = (0, import_colord.colord)(color).rotate(randomRotationValue).toHex();
159
+ return {
160
+ ...colorObject,
161
+ color: newColor
162
+ };
163
+ });
164
+ setThemeColors(newColors);
165
+ }, [themeColors, setThemeColors]);
166
+ return window.__experimentalEnableColorRandomizer ? [randomizeColors] : [];
167
+ }
168
+ // Annotate the CommonJS export names for ESM import in node:
169
+ 0 && (module.exports = {
170
+ useColorRandomizer,
171
+ useColorVariations,
172
+ useCurrentMergeThemeStyleVariationsWithUserConfig,
173
+ useSetting,
174
+ useStyle
175
+ });
176
+ //# sourceMappingURL=hooks.js.map