@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,150 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { store as blocksStore } from "@wordpress/blocks";
3
+ import { __, sprintf, _n } from "@wordpress/i18n";
4
+ import {
5
+ FlexItem,
6
+ SearchControl,
7
+ __experimentalHStack as HStack,
8
+ __experimentalText as Text
9
+ } from "@wordpress/components";
10
+ import { useSelect } from "@wordpress/data";
11
+ import {
12
+ useState,
13
+ useEffect,
14
+ useRef,
15
+ useDeferredValue,
16
+ memo
17
+ } from "@wordpress/element";
18
+ import {
19
+ BlockIcon,
20
+ privateApis as blockEditorPrivateApis
21
+ } from "@wordpress/block-editor";
22
+ import { useDebounce } from "@wordpress/compose";
23
+ import { speak } from "@wordpress/a11y";
24
+ import { useBlockVariations } from "./variations/variations-panel";
25
+ import { ScreenHeader } from "./screen-header";
26
+ import { NavigationButtonAsItem } from "./navigation-button";
27
+ import { useSetting } from "./hooks";
28
+ import { unlock } from "./lock-unlock";
29
+ const {
30
+ useHasDimensionsPanel,
31
+ useHasTypographyPanel,
32
+ useHasBorderPanel,
33
+ useSettingsForBlockElement,
34
+ useHasColorPanel
35
+ } = unlock(blockEditorPrivateApis);
36
+ function useSortedBlockTypes() {
37
+ const blockItems = useSelect(
38
+ (select) => select(blocksStore).getBlockTypes(),
39
+ []
40
+ );
41
+ const groupByType = (blocks, block) => {
42
+ const { core, noncore } = blocks;
43
+ const type = block.name.startsWith("core/") ? core : noncore;
44
+ type.push(block);
45
+ return blocks;
46
+ };
47
+ const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(
48
+ groupByType,
49
+ { core: [], noncore: [] }
50
+ );
51
+ return [...coreItems, ...nonCoreItems];
52
+ }
53
+ function useBlockHasGlobalStyles(blockName) {
54
+ const [rawSettings] = useSetting("", blockName);
55
+ const settings = useSettingsForBlockElement(rawSettings, blockName);
56
+ const hasTypographyPanel = useHasTypographyPanel(settings);
57
+ const hasColorPanel = useHasColorPanel(settings);
58
+ const hasBorderPanel = useHasBorderPanel(settings);
59
+ const hasDimensionsPanel = useHasDimensionsPanel(settings);
60
+ const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
61
+ const hasVariationsPanel = !!useBlockVariations(blockName)?.length;
62
+ const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel;
63
+ return hasGlobalStyles;
64
+ }
65
+ function BlockMenuItem({ block }) {
66
+ const hasBlockMenuItem = useBlockHasGlobalStyles(block.name);
67
+ if (!hasBlockMenuItem) {
68
+ return null;
69
+ }
70
+ return /* @__PURE__ */ jsx(
71
+ NavigationButtonAsItem,
72
+ {
73
+ path: "/blocks/" + encodeURIComponent(block.name),
74
+ children: /* @__PURE__ */ jsxs(HStack, { justify: "flex-start", children: [
75
+ /* @__PURE__ */ jsx(BlockIcon, { icon: block.icon }),
76
+ /* @__PURE__ */ jsx(FlexItem, { children: block.title })
77
+ ] })
78
+ }
79
+ );
80
+ }
81
+ function BlockList({ filterValue }) {
82
+ const sortedBlockTypes = useSortedBlockTypes();
83
+ const debouncedSpeak = useDebounce(speak, 500);
84
+ const { isMatchingSearchTerm } = useSelect(blocksStore);
85
+ const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(
86
+ (blockType) => isMatchingSearchTerm(blockType, filterValue)
87
+ );
88
+ const blockTypesListRef = useRef(null);
89
+ useEffect(() => {
90
+ if (!filterValue) {
91
+ return;
92
+ }
93
+ const count = blockTypesListRef.current?.childElementCount || 0;
94
+ const resultsFoundMessage = sprintf(
95
+ /* translators: %d: number of results. */
96
+ _n("%d result found.", "%d results found.", count),
97
+ count
98
+ );
99
+ debouncedSpeak(resultsFoundMessage, "polite");
100
+ }, [filterValue, debouncedSpeak]);
101
+ return /* @__PURE__ */ jsx(
102
+ "div",
103
+ {
104
+ ref: blockTypesListRef,
105
+ className: "global-styles-ui-block-types-item-list",
106
+ role: "list",
107
+ children: filteredBlockTypes.length === 0 ? /* @__PURE__ */ jsx(Text, { align: "center", as: "p", children: __("No blocks found.") }) : filteredBlockTypes.map((block) => /* @__PURE__ */ jsx(
108
+ BlockMenuItem,
109
+ {
110
+ block
111
+ },
112
+ "menu-itemblock-" + block.name
113
+ ))
114
+ }
115
+ );
116
+ }
117
+ const MemoizedBlockList = memo(BlockList);
118
+ function ScreenBlockList() {
119
+ const [filterValue, setFilterValue] = useState("");
120
+ const deferredFilterValue = useDeferredValue(filterValue);
121
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
122
+ /* @__PURE__ */ jsx(
123
+ ScreenHeader,
124
+ {
125
+ title: __("Blocks"),
126
+ description: __(
127
+ "Customize the appearance of specific blocks and for the whole site."
128
+ )
129
+ }
130
+ ),
131
+ /* @__PURE__ */ jsx(
132
+ SearchControl,
133
+ {
134
+ __nextHasNoMarginBottom: true,
135
+ className: "global-styles-ui-block-types-search",
136
+ onChange: setFilterValue,
137
+ value: filterValue,
138
+ label: __("Search"),
139
+ placeholder: __("Search")
140
+ }
141
+ ),
142
+ /* @__PURE__ */ jsx(MemoizedBlockList, { filterValue: deferredFilterValue })
143
+ ] });
144
+ }
145
+ var screen_block_list_default = ScreenBlockList;
146
+ export {
147
+ screen_block_list_default as default,
148
+ useBlockHasGlobalStyles
149
+ };
150
+ //# sourceMappingURL=screen-block-list.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/screen-block-list.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\n// @ts-expect-error: Not typed yet.\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseDeferredValue,\n\tmemo,\n} from '@wordpress/element';\nimport {\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n\t// @ts-expect-error: Not typed yet.\n} from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useBlockVariations } from './variations/variations-panel';\nimport { ScreenHeader } from './screen-header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { useSetting } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks: any, block: any ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nexport function useBlockHasGlobalStyles( blockName: string ) {\n\tconst [ rawSettings ] = useSetting( '', blockName );\n\tconst settings = useSettingsForBlockElement( rawSettings, blockName );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = !! useBlockVariations( blockName )?.length;\n\tconst hasGlobalStyles =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\treturn hasGlobalStyles;\n}\n\ninterface BlockMenuItemProps {\n\tblock: any;\n}\n\nfunction BlockMenuItem( { block }: BlockMenuItemProps ) {\n\tconst hasBlockMenuItem = useBlockHasGlobalStyles( block.name );\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\ninterface BlockListProps {\n\tfilterValue: string;\n}\n\nfunction BlockList( { filterValue }: BlockListProps ) {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\t// @ts-expect-error - useSelect supports single argument calls\n\tconst { isMatchingSearchTerm } = useSelect( blocksStore );\n\n\tconst filteredBlockTypes = ! filterValue\n\t\t? sortedBlockTypes\n\t\t: sortedBlockTypes.filter( ( blockType ) =>\n\t\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t );\n\n\tconst blockTypesListRef = useRef< HTMLDivElement >( null );\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current?.childElementCount || 0;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, 'polite' );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ blockTypesListRef }\n\t\t\tclassName=\"global-styles-ui-block-types-item-list\"\n\t\t\t// By default, BlockMenuItem has a role=listitem so this div must have a list role.\n\t\t\trole=\"list\"\n\t\t>\n\t\t\t{ filteredBlockTypes.length === 0 ? (\n\t\t\t\t<Text align=\"center\" as=\"p\">\n\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t</Text>\n\t\t\t) : (\n\t\t\t\tfilteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nconst MemoizedBlockList = memo( BlockList );\n\nfunction ScreenBlockList() {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst deferredFilterValue = useDeferredValue( filterValue );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"global-styles-ui-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t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AAAA,MACN,WAAU;AAAA,MAEV,MAAK;AAAA,MAEH,6BAAmB,WAAW,IAC/B,oBAAC,QAAK,OAAM,UAAS,IAAG,KACrB,aAAI,kBAAmB,GAC1B,IAEA,mBAAmB,IAAK,CAAE,UACzB;AAAA,QAAC;AAAA;AAAA,UACA;AAAA;AAAA,QACM,oBAAoB,MAAM;AAAA,MACjC,CACC;AAAA;AAAA,EAEJ;AAEF;AAEA,MAAM,oBAAoB,KAAM,SAAU;AAE1C,SAAS,kBAAkB;AAC1B,QAAM,CAAE,aAAa,cAAe,IAAI,SAAU,EAAG;AACrD,QAAM,sBAAsB,iBAAkB,WAAY;AAE1D,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,QAAS;AAAA,QACrB,aAAc;AAAA,UACb;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,yBAAuB;AAAA,QACvB,WAAU;AAAA,QACV,UAAW;AAAA,QACX,OAAQ;AAAA,QACR,OAAQ,GAAI,QAAS;AAAA,QACrB,aAAc,GAAI,QAAS;AAAA;AAAA,IAC5B;AAAA,IACA,oBAAC,qBAAkB,aAAc,qBAAsB;AAAA,KACxD;AAEF;AAEA,IAAO,4BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,293 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { getBlockType } from "@wordpress/blocks";
3
+ import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
4
+ import { useMemo } from "@wordpress/element";
5
+ import { useSelect } from "@wordpress/data";
6
+ import { store as coreStore } from "@wordpress/core-data";
7
+ import {
8
+ PanelBody,
9
+ __experimentalVStack as VStack,
10
+ __experimentalHasSplitBorders as hasSplitBorders
11
+ } from "@wordpress/components";
12
+ import { __, sprintf } from "@wordpress/i18n";
13
+ import { ScreenHeader } from "./screen-header";
14
+ import BlockPreviewPanel from "./block-preview-panel";
15
+ import { Subtitle } from "./subtitle";
16
+ import {
17
+ useBlockVariations,
18
+ VariationsPanel
19
+ } from "./variations/variations-panel";
20
+ import { useStyle, useSetting } from "./hooks";
21
+ import { unlock } from "./lock-unlock";
22
+ const BACKGROUND_BLOCK_DEFAULT_VALUES = {
23
+ backgroundSize: "cover",
24
+ backgroundPosition: "50% 50%"
25
+ // used only when backgroundSize is 'contain'.
26
+ };
27
+ function applyFallbackStyle(border) {
28
+ if (!border) {
29
+ return border;
30
+ }
31
+ const hasColorOrWidth = border.color || border.width;
32
+ if (!border.style && hasColorOrWidth) {
33
+ return { ...border, style: "solid" };
34
+ }
35
+ if (border.style && !hasColorOrWidth) {
36
+ return void 0;
37
+ }
38
+ return border;
39
+ }
40
+ function applyAllFallbackStyles(border) {
41
+ if (!border) {
42
+ return border;
43
+ }
44
+ if (hasSplitBorders(border)) {
45
+ return {
46
+ top: applyFallbackStyle(border.top),
47
+ right: applyFallbackStyle(border.right),
48
+ bottom: applyFallbackStyle(border.bottom),
49
+ left: applyFallbackStyle(border.left)
50
+ };
51
+ }
52
+ return applyFallbackStyle(border);
53
+ }
54
+ const {
55
+ useHasDimensionsPanel,
56
+ useHasTypographyPanel,
57
+ useHasBorderPanel,
58
+ useSettingsForBlockElement,
59
+ useHasColorPanel,
60
+ useHasFiltersPanel,
61
+ useHasImageSettingsPanel,
62
+ useHasBackgroundPanel,
63
+ BackgroundPanel: StylesBackgroundPanel,
64
+ BorderPanel: StylesBorderPanel,
65
+ ColorPanel: StylesColorPanel,
66
+ TypographyPanel: StylesTypographyPanel,
67
+ DimensionsPanel: StylesDimensionsPanel,
68
+ FiltersPanel: StylesFiltersPanel,
69
+ ImageSettingsPanel,
70
+ AdvancedPanel: StylesAdvancedPanel
71
+ } = unlock(blockEditorPrivateApis);
72
+ function ScreenBlock({ name, variation }) {
73
+ let prefixParts = [];
74
+ if (variation) {
75
+ prefixParts = ["variations", variation].concat(prefixParts);
76
+ }
77
+ const prefix = prefixParts.join(".");
78
+ const [style] = useStyle(prefix, name, "user", false);
79
+ const [inheritedStyle, setStyle] = useStyle(
80
+ prefix,
81
+ name,
82
+ "merged",
83
+ false
84
+ );
85
+ const [userSettings] = useSetting("", name, "user");
86
+ const [rawSettings, setSettings] = useSetting("", name);
87
+ const settingsForBlockElement = useSettingsForBlockElement(
88
+ rawSettings,
89
+ name
90
+ );
91
+ const blockType = getBlockType(name);
92
+ let disableBlockGap = false;
93
+ if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
94
+ (spacingType) => spacingType === "blockGap"
95
+ ))) {
96
+ disableBlockGap = true;
97
+ }
98
+ let disableAspectRatio = false;
99
+ if (settingsForBlockElement?.dimensions?.aspectRatio && name === "core/group") {
100
+ disableAspectRatio = true;
101
+ }
102
+ const settings = useMemo(() => {
103
+ const updatedSettings = structuredClone(settingsForBlockElement);
104
+ if (disableBlockGap) {
105
+ updatedSettings.spacing.blockGap = false;
106
+ }
107
+ if (disableAspectRatio) {
108
+ updatedSettings.dimensions.aspectRatio = false;
109
+ }
110
+ return updatedSettings;
111
+ }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]);
112
+ const blockVariations = useBlockVariations(name);
113
+ const hasBackgroundPanel = useHasBackgroundPanel(settings);
114
+ const hasTypographyPanel = useHasTypographyPanel(settings);
115
+ const hasColorPanel = useHasColorPanel(settings);
116
+ const hasBorderPanel = useHasBorderPanel(settings);
117
+ const hasDimensionsPanel = useHasDimensionsPanel(settings);
118
+ const hasFiltersPanel = useHasFiltersPanel(settings);
119
+ const hasImageSettingsPanel = useHasImageSettingsPanel(
120
+ name,
121
+ userSettings,
122
+ settings
123
+ );
124
+ const hasVariationsPanel = !!blockVariations?.length && !variation;
125
+ const { canEditCSS } = useSelect((select) => {
126
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(coreStore);
127
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
128
+ const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
129
+ return {
130
+ canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
131
+ };
132
+ }, []);
133
+ const currentBlockStyle = variation ? blockVariations.find((s) => s.name === variation) : null;
134
+ const inheritedStyleWithLayout = useMemo(() => {
135
+ return {
136
+ ...inheritedStyle,
137
+ layout: settings.layout
138
+ };
139
+ }, [inheritedStyle, settings.layout]);
140
+ const styleWithLayout = useMemo(() => {
141
+ return {
142
+ ...style,
143
+ layout: userSettings.layout
144
+ };
145
+ }, [style, userSettings.layout]);
146
+ const onChangeDimensions = (newStyle) => {
147
+ const updatedStyle = { ...newStyle };
148
+ delete updatedStyle.layout;
149
+ setStyle(updatedStyle);
150
+ if (newStyle.layout !== userSettings.layout) {
151
+ setSettings({
152
+ ...userSettings,
153
+ layout: newStyle.layout
154
+ });
155
+ }
156
+ };
157
+ const onChangeLightbox = (newSetting) => {
158
+ if (newSetting === void 0) {
159
+ setSettings({
160
+ ...rawSettings,
161
+ lightbox: void 0
162
+ });
163
+ } else {
164
+ setSettings({
165
+ ...rawSettings,
166
+ lightbox: {
167
+ ...rawSettings.lightbox,
168
+ ...newSetting
169
+ }
170
+ });
171
+ }
172
+ };
173
+ const onChangeBorders = (newStyle) => {
174
+ if (!newStyle?.border) {
175
+ setStyle(newStyle);
176
+ return;
177
+ }
178
+ const { radius, ...newBorder } = newStyle.border;
179
+ const border = applyAllFallbackStyles(newBorder);
180
+ const updatedBorder = !hasSplitBorders(border) ? {
181
+ top: border,
182
+ right: border,
183
+ bottom: border,
184
+ left: border
185
+ } : {
186
+ color: null,
187
+ style: null,
188
+ width: null,
189
+ ...border
190
+ };
191
+ setStyle({ ...newStyle, border: { ...updatedBorder, radius } });
192
+ };
193
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
194
+ /* @__PURE__ */ jsx(
195
+ ScreenHeader,
196
+ {
197
+ title: variation ? currentBlockStyle?.label : blockType?.title
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsx(BlockPreviewPanel, { name, variation }),
201
+ hasVariationsPanel && /* @__PURE__ */ jsx("div", { className: "global-styles-ui-screen-variations", children: /* @__PURE__ */ jsxs(VStack, { spacing: 3, children: [
202
+ /* @__PURE__ */ jsx(Subtitle, { children: __("Style Variations") }),
203
+ /* @__PURE__ */ jsx(VariationsPanel, { name })
204
+ ] }) }),
205
+ hasColorPanel && /* @__PURE__ */ jsx(
206
+ StylesColorPanel,
207
+ {
208
+ inheritedValue: inheritedStyle,
209
+ value: style,
210
+ onChange: setStyle,
211
+ settings
212
+ }
213
+ ),
214
+ hasBackgroundPanel && /* @__PURE__ */ jsx(
215
+ StylesBackgroundPanel,
216
+ {
217
+ inheritedValue: inheritedStyle,
218
+ value: style,
219
+ onChange: setStyle,
220
+ settings,
221
+ defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES
222
+ }
223
+ ),
224
+ hasTypographyPanel && /* @__PURE__ */ jsx(
225
+ StylesTypographyPanel,
226
+ {
227
+ inheritedValue: inheritedStyle,
228
+ value: style,
229
+ onChange: setStyle,
230
+ settings
231
+ }
232
+ ),
233
+ hasDimensionsPanel && /* @__PURE__ */ jsx(
234
+ StylesDimensionsPanel,
235
+ {
236
+ inheritedValue: inheritedStyleWithLayout,
237
+ value: styleWithLayout,
238
+ onChange: onChangeDimensions,
239
+ settings,
240
+ includeLayoutControls: true
241
+ }
242
+ ),
243
+ hasBorderPanel && /* @__PURE__ */ jsx(
244
+ StylesBorderPanel,
245
+ {
246
+ inheritedValue: inheritedStyle,
247
+ value: style,
248
+ onChange: onChangeBorders,
249
+ settings
250
+ }
251
+ ),
252
+ hasFiltersPanel && /* @__PURE__ */ jsx(
253
+ StylesFiltersPanel,
254
+ {
255
+ inheritedValue: inheritedStyleWithLayout,
256
+ value: styleWithLayout,
257
+ onChange: setStyle,
258
+ settings,
259
+ includeLayoutControls: true
260
+ }
261
+ ),
262
+ hasImageSettingsPanel && /* @__PURE__ */ jsx(
263
+ ImageSettingsPanel,
264
+ {
265
+ onChange: onChangeLightbox,
266
+ value: userSettings,
267
+ inheritedValue: settings
268
+ }
269
+ ),
270
+ canEditCSS && /* @__PURE__ */ jsxs(PanelBody, { title: __("Advanced"), initialOpen: false, children: [
271
+ /* @__PURE__ */ jsx("p", { children: sprintf(
272
+ // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
273
+ __(
274
+ "Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value."
275
+ ),
276
+ blockType?.title
277
+ ) }),
278
+ /* @__PURE__ */ jsx(
279
+ StylesAdvancedPanel,
280
+ {
281
+ value: style,
282
+ onChange: setStyle,
283
+ inheritedValue: inheritedStyle
284
+ }
285
+ )
286
+ ] })
287
+ ] });
288
+ }
289
+ var screen_block_default = ScreenBlock;
290
+ export {
291
+ screen_block_default as default
292
+ };
293
+ //# sourceMappingURL=screen-block.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/screen-block.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\n// @ts-expect-error: Not typed yet.\nimport { getBlockType } from '@wordpress/blocks';\n// @ts-expect-error: Not typed yet.\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport type { GlobalStylesConfig } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { ScreenHeader } from './screen-header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { Subtitle } from './subtitle';\nimport {\n\tuseBlockVariations,\n\tVariationsPanel,\n} from './variations/variations-panel';\nimport { useStyle, useSetting } from './hooks';\nimport { unlock } from './lock-unlock';\n\n// Initial control values.\nconst BACKGROUND_BLOCK_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\n\tbackgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.\n};\n\nfunction applyFallbackStyle( border: any ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border: any ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseHasBackgroundPanel,\n\tBackgroundPanel: StylesBackgroundPanel,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\ninterface ScreenBlockProps {\n\tname: string;\n\tvariation?: string;\n}\n\nfunction ScreenBlock( { name, variation }: ScreenBlockProps ) {\n\tlet prefixParts: string[] = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useStyle( prefix, name, 'user', false );\n\tconst [ inheritedStyle, setStyle ] = useStyle(\n\t\tprefix,\n\t\tname,\n\t\t'merged',\n\t\tfalse\n\t);\n\tconst [ userSettings ] = useSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useSetting( '', name );\n\tconst settingsForBlockElement = useSettingsForBlockElement(\n\t\trawSettings,\n\t\tname\n\t);\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tlet disableBlockGap = false;\n\tif (\n\t\tsettingsForBlockElement?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType: string ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tdisableBlockGap = true;\n\t}\n\n\t// Only allow `aspectRatio` support if the block is not the grouping block.\n\t// The grouping block allows the user to use Group, Row and Stack variations,\n\t// and it is highly likely that the user will not want to set an aspect ratio\n\t// for all three at once. Until there is the ability to set a different aspect\n\t// ratio for each variation, we disable the aspect ratio controls for the\n\t// grouping block in global styles.\n\tlet disableAspectRatio = false;\n\tif (\n\t\tsettingsForBlockElement?.dimensions?.aspectRatio &&\n\t\tname === 'core/group'\n\t) {\n\t\tdisableAspectRatio = true;\n\t}\n\n\tconst settings = useMemo( () => {\n\t\tconst updatedSettings = structuredClone( settingsForBlockElement );\n\t\tif ( disableBlockGap ) {\n\t\t\tupdatedSettings.spacing.blockGap = false;\n\t\t}\n\t\tif ( disableAspectRatio ) {\n\t\t\tupdatedSettings.dimensions.aspectRatio = false;\n\t\t}\n\t\treturn updatedSettings;\n\t}, [ settingsForBlockElement, disableBlockGap, disableAspectRatio ] );\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasBackgroundPanel = useHasBackgroundPanel( settings );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS: !! ( globalStyles as GlobalStylesConfig )?._links?.[\n\t\t\t\t'wp:action-edit-css'\n\t\t\t],\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s: any ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle: any ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting: any ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle: any ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={\n\t\t\t\t\tvariation ? currentBlockStyle?.label : blockType?.title\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"global-styles-ui-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBackgroundPanel && (\n\t\t\t\t<StylesBackgroundPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tdefaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],
5
+ "mappings": "AAiRE,mBACC,KAQE,YATH;AA7QF,SAAS,oBAAoB;AAE7B,SAAS,eAAe,8BAA8B;AACtD,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,EACxB,iCAA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;AAAA;AAAA,IACD;AAAA,IAEC,sBACD;AAAA,MAAC;AAAA;AAAA,QACA,gBAAiB;AAAA,QACjB,OAAQ;AAAA,QACR,UAAW;AAAA,QACX;AAAA,QACA,uBAAqB;AAAA;AAAA,IACtB;AAAA,IAEC,kBACD;AAAA,MAAC;AAAA;AAAA,QACA,gBAAiB;AAAA,QACjB,OAAQ;AAAA,QACR,UAAW;AAAA,QACX;AAAA;AAAA,IACD;AAAA,IAEC,mBACD;AAAA,MAAC;AAAA;AAAA,QACA,gBAAiB;AAAA,QACjB,OAAQ;AAAA,QACR,UAAW;AAAA,QACX;AAAA,QACA,uBAAqB;AAAA;AAAA,IACtB;AAAA,IAEC,yBACD;AAAA,MAAC;AAAA;AAAA,QACA,UAAW;AAAA,QACX,OAAQ;AAAA,QACR,gBAAiB;AAAA;AAAA,IAClB;AAAA,IAGC,cACD,qBAAC,aAAU,OAAQ,GAAI,UAAW,GAAI,aAAc,OACnD;AAAA,0BAAC,OACE;AAAA;AAAA,QAED;AAAA,UACC;AAAA,QACD;AAAA,QACA,WAAW;AAAA,MACZ,GACD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ;AAAA,UACR,UAAW;AAAA,UACX,gBAAiB;AAAA;AAAA,MAClB;AAAA,OACD;AAAA,KAEF;AAEF;AAEA,IAAO,uBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,34 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { __ } from "@wordpress/i18n";
3
+ import { privateApis as componentsPrivateApis } from "@wordpress/components";
4
+ import { ScreenHeader } from "./screen-header";
5
+ import ColorPalettePanel from "./color-palette-panel";
6
+ import GradientPalettePanel from "./gradients-palette-panel";
7
+ import { unlock } from "./lock-unlock";
8
+ const { Tabs } = unlock(componentsPrivateApis);
9
+ function ScreenColorPalette({ name }) {
10
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
11
+ /* @__PURE__ */ jsx(
12
+ ScreenHeader,
13
+ {
14
+ title: __("Edit palette"),
15
+ description: __(
16
+ "The combination of colors used across the site and in color pickers."
17
+ )
18
+ }
19
+ ),
20
+ /* @__PURE__ */ jsxs(Tabs, { children: [
21
+ /* @__PURE__ */ jsxs(Tabs.TabList, { children: [
22
+ /* @__PURE__ */ jsx(Tabs.Tab, { tabId: "color", children: __("Color") }),
23
+ /* @__PURE__ */ jsx(Tabs.Tab, { tabId: "gradient", children: __("Gradient") })
24
+ ] }),
25
+ /* @__PURE__ */ jsx(Tabs.TabPanel, { tabId: "color", focusable: false, children: /* @__PURE__ */ jsx(ColorPalettePanel, { name }) }),
26
+ /* @__PURE__ */ jsx(Tabs.TabPanel, { tabId: "gradient", focusable: false, children: /* @__PURE__ */ jsx(GradientPalettePanel, { name }) })
27
+ ] })
28
+ ] });
29
+ }
30
+ var screen_color_palette_default = ScreenColorPalette;
31
+ export {
32
+ screen_color_palette_default as default
33
+ };
34
+ //# sourceMappingURL=screen-color-palette.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/screen-color-palette.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n// @ts-ignore - WordPress private APIs\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { ScreenHeader } from './screen-header';\nimport ColorPalettePanel from './color-palette-panel';\nimport GradientPalettePanel from './gradients-palette-panel';\n\n/**\n * External dependencies\n */\nimport { unlock } from './lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction ScreenColorPalette( { name }: { name?: string } ) {\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Edit palette' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'The combination of colors used across the site and in color pickers.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<Tabs>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t<Tabs.Tab tabId=\"color\">{ __( 'Color' ) }</Tabs.Tab>\n\t\t\t\t\t<Tabs.Tab tabId=\"gradient\">{ __( 'Gradient' ) }</Tabs.Tab>\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t<Tabs.TabPanel tabId=\"color\" focusable={ false }>\n\t\t\t\t\t<ColorPalettePanel name={ name } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId=\"gradient\" focusable={ false }>\n\t\t\t\t\t<GradientPalettePanel name={ name } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs>\n\t\t</>\n\t);\n}\n\nexport default ScreenColorPalette;\n"],
5
+ "mappings": "AAuBE,mBACC,KAOC,YARF;AApBF,SAAS,UAAU;AAEnB,SAAS,eAAe,6BAA6B;AAKrD,SAAS,oBAAoB;AAC7B,OAAO,uBAAuB;AAC9B,OAAO,0BAA0B;AAKjC,SAAS,cAAc;AAEvB,MAAM,EAAE,KAAK,IAAI,OAAQ,qBAAsB;AAE/C,SAAS,mBAAoB,EAAE,KAAK,GAAuB;AAC1D,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,cAAe;AAAA,QAC3B,aAAc;AAAA,UACb;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACA,qBAAC,QACA;AAAA,2BAAC,KAAK,SAAL,EACA;AAAA,4BAAC,KAAK,KAAL,EAAS,OAAM,SAAU,aAAI,OAAQ,GAAG;AAAA,QACzC,oBAAC,KAAK,KAAL,EAAS,OAAM,YAAa,aAAI,UAAW,GAAG;AAAA,SAChD;AAAA,MACA,oBAAC,KAAK,UAAL,EAAc,OAAM,SAAQ,WAAY,OACxC,8BAAC,qBAAkB,MAAc,GAClC;AAAA,MACA,oBAAC,KAAK,UAAL,EAAc,OAAM,YAAW,WAAY,OAC3C,8BAAC,wBAAqB,MAAc,GACrC;AAAA,OACD;AAAA,KACD;AAEF;AAEA,IAAO,+BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,55 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { __ } from "@wordpress/i18n";
3
+ import { __experimentalVStack as VStack } from "@wordpress/components";
4
+ import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
5
+ import { ScreenHeader } from "./screen-header";
6
+ import Palette from "./palette";
7
+ import { useStyle, useSetting } from "./hooks";
8
+ import { unlock } from "./lock-unlock";
9
+ const { useSettingsForBlockElement, ColorPanel: StylesColorPanel } = unlock(
10
+ blockEditorPrivateApis
11
+ );
12
+ function ScreenColors() {
13
+ const [style, setStyle] = useStyle(
14
+ "",
15
+ void 0,
16
+ "user",
17
+ false
18
+ );
19
+ const [inheritedStyle] = useStyle(
20
+ "",
21
+ void 0,
22
+ "merged",
23
+ false
24
+ );
25
+ const [rawSettings] = useSetting("");
26
+ const settings = useSettingsForBlockElement(rawSettings);
27
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ /* @__PURE__ */ jsx(
29
+ ScreenHeader,
30
+ {
31
+ title: __("Colors"),
32
+ description: __(
33
+ "Palette colors and the application of those colors on site elements."
34
+ )
35
+ }
36
+ ),
37
+ /* @__PURE__ */ jsx("div", { className: "global-styles-ui-screen", children: /* @__PURE__ */ jsxs(VStack, { spacing: 7, children: [
38
+ /* @__PURE__ */ jsx(Palette, {}),
39
+ /* @__PURE__ */ jsx(
40
+ StylesColorPanel,
41
+ {
42
+ inheritedValue: inheritedStyle,
43
+ value: style,
44
+ onChange: setStyle,
45
+ settings
46
+ }
47
+ )
48
+ ] }) })
49
+ ] });
50
+ }
51
+ var screen_colors_default = ScreenColors;
52
+ export {
53
+ screen_colors_default as default
54
+ };
55
+ //# sourceMappingURL=screen-colors.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/screen-colors.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\n// @ts-expect-error: Not typed yet.\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport type {\n\tGlobalStylesStyles,\n\tGlobalStylesSettings,\n} from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { ScreenHeader } from './screen-header';\nimport Palette from './palette';\nimport { useStyle, useSetting } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst { useSettingsForBlockElement, ColorPanel: StylesColorPanel } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction ScreenColors() {\n\t// Get user styles for editing\n\tconst [ style, setStyle ] = useStyle< GlobalStylesStyles >(\n\t\t'',\n\t\tundefined,\n\t\t'user',\n\t\tfalse\n\t);\n\t// Get inherited styles for display\n\tconst [ inheritedStyle ] = useStyle< GlobalStylesStyles >(\n\t\t'',\n\t\tundefined,\n\t\t'merged',\n\t\tfalse\n\t);\n\t// Get settings for the color panel\n\tconst [ rawSettings ] = useSetting< GlobalStylesSettings >( '' );\n\tconst settings = useSettingsForBlockElement( rawSettings );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Colors' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Palette colors and the application of those colors on site elements.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<div className=\"global-styles-ui-screen\">\n\t\t\t\t<VStack spacing={ 7 }>\n\t\t\t\t\t<Palette />\n\t\t\t\t\t<StylesColorPanel\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenColors;\n"],
5
+ "mappings": "AA4CE,mBACC,KAOC,YARF;AAzCF,SAAS,UAAU;AACnB,SAAS,wBAAwB,cAAc;AAE/C,SAAS,eAAe,8BAA8B;AAStD,SAAS,oBAAoB;AAC7B,OAAO,aAAa;AACpB,SAAS,UAAU,kBAAkB;AACrC,SAAS,cAAc;AAEvB,MAAM,EAAE,4BAA4B,YAAY,iBAAiB,IAAI;AAAA,EACpE;AACD;AAEA,SAAS,eAAe;AAEvB,QAAM,CAAE,OAAO,QAAS,IAAI;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,CAAE,cAAe,IAAI;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,CAAE,WAAY,IAAI,WAAoC,EAAG;AAC/D,QAAM,WAAW,2BAA4B,WAAY;AAEzD,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,QAAS;AAAA,QACrB,aAAc;AAAA,UACb;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACA,oBAAC,SAAI,WAAU,2BACd,+BAAC,UAAO,SAAU,GACjB;AAAA,0BAAC,WAAQ;AAAA,MACT;AAAA,QAAC;AAAA;AAAA,UACA,gBAAiB;AAAA,UACjB,OAAQ;AAAA,UACR,UAAW;AAAA,UACX;AAAA;AAAA,MACD;AAAA,OACD,GACD;AAAA,KACD;AAEF;AAEA,IAAO,wBAAQ;",
6
+ "names": []
7
+ }