@wordpress/block-editor 12.12.0 → 12.12.2-next.f8d8eceb.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 (282) hide show
  1. package/CHANGELOG.md +12 -10
  2. package/README.md +35 -3
  3. package/build/components/block-alignment-control/use-available-alignments.js +30 -28
  4. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  5. package/build/components/block-list/block.native.js +4 -4
  6. package/build/components/block-list/block.native.js.map +1 -1
  7. package/build/components/block-list/layout.js +2 -3
  8. package/build/components/block-list/layout.js.map +1 -1
  9. package/build/components/border-radius-control/index.js +3 -2
  10. package/build/components/border-radius-control/index.js.map +1 -1
  11. package/build/components/color-palette/with-color-context.js +6 -6
  12. package/build/components/color-palette/with-color-context.js.map +1 -1
  13. package/build/components/colors/with-colors.js +2 -8
  14. package/build/components/colors/with-colors.js.map +1 -1
  15. package/build/components/colors-gradients/control.js +6 -7
  16. package/build/components/colors-gradients/control.js.map +1 -1
  17. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +5 -13
  18. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  19. package/build/components/font-family/index.js +2 -3
  20. package/build/components/font-family/index.js.map +1 -1
  21. package/build/components/font-sizes/font-size-picker.js +3 -5
  22. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  23. package/build/components/font-sizes/with-font-sizes.js +3 -4
  24. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  25. package/build/components/global-styles/filters-panel.js +7 -8
  26. package/build/components/global-styles/filters-panel.js.map +1 -1
  27. package/build/components/global-styles/image-settings-panel.js +2 -2
  28. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  29. package/build/components/global-styles/typography-panel.js +1 -1
  30. package/build/components/global-styles/typography-panel.js.map +1 -1
  31. package/build/components/gradients/use-gradient.js +2 -5
  32. package/build/components/gradients/use-gradient.js.map +1 -1
  33. package/build/components/height-control/index.js +3 -3
  34. package/build/components/height-control/index.js.map +1 -1
  35. package/build/components/index.js +9 -2
  36. package/build/components/index.js.map +1 -1
  37. package/build/components/index.native.js +9 -2
  38. package/build/components/index.native.js.map +1 -1
  39. package/build/components/inner-blocks/index.js +2 -2
  40. package/build/components/inner-blocks/index.js.map +1 -1
  41. package/build/components/letter-spacing-control/index.js +3 -3
  42. package/build/components/letter-spacing-control/index.js.map +1 -1
  43. package/build/components/link-control/search-item.js +11 -0
  44. package/build/components/link-control/search-item.js.map +1 -1
  45. package/build/components/link-control/search-results.js +2 -1
  46. package/build/components/link-control/search-results.js.map +1 -1
  47. package/build/components/link-control/use-search-handler.js +10 -5
  48. package/build/components/link-control/use-search-handler.js.map +1 -1
  49. package/build/components/rich-text/index.js +1 -1
  50. package/build/components/rich-text/index.js.map +1 -1
  51. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +6 -3
  52. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  53. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
  54. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  55. package/build/components/unit-control/index.js +3 -3
  56. package/build/components/unit-control/index.js.map +1 -1
  57. package/build/components/use-block-commands/index.js +6 -1
  58. package/build/components/use-block-commands/index.js.map +1 -1
  59. package/build/components/use-settings/index.js +212 -0
  60. package/build/components/use-settings/index.js.map +1 -0
  61. package/build/hooks/align.js +51 -35
  62. package/build/hooks/align.js.map +1 -1
  63. package/build/hooks/anchor.js +37 -32
  64. package/build/hooks/anchor.js.map +1 -1
  65. package/build/hooks/background.js +4 -4
  66. package/build/hooks/background.js.map +1 -1
  67. package/build/hooks/color.js +2 -4
  68. package/build/hooks/color.js.map +1 -1
  69. package/build/hooks/duotone.js +5 -7
  70. package/build/hooks/duotone.js.map +1 -1
  71. package/build/hooks/font-size.js +4 -4
  72. package/build/hooks/font-size.js.map +1 -1
  73. package/build/hooks/layout.js +10 -11
  74. package/build/hooks/layout.js.map +1 -1
  75. package/build/hooks/line-height.js +3 -3
  76. package/build/hooks/line-height.js.map +1 -1
  77. package/build/hooks/position.js +2 -3
  78. package/build/hooks/position.js.map +1 -1
  79. package/build/hooks/use-color-props.js +3 -11
  80. package/build/hooks/use-color-props.js.map +1 -1
  81. package/build/hooks/utils.js +1 -42
  82. package/build/hooks/utils.js.map +1 -1
  83. package/build/layouts/constrained.js +3 -3
  84. package/build/layouts/constrained.js.map +1 -1
  85. package/build/utils/object.js +4 -1
  86. package/build/utils/object.js.map +1 -1
  87. package/build/utils/transform-styles/index.js +19 -24
  88. package/build/utils/transform-styles/index.js.map +1 -1
  89. package/build-module/components/block-alignment-control/use-available-alignments.js +30 -28
  90. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  91. package/build-module/components/block-list/block.native.js +4 -4
  92. package/build-module/components/block-list/block.native.js.map +1 -1
  93. package/build-module/components/block-list/layout.js +2 -2
  94. package/build-module/components/block-list/layout.js.map +1 -1
  95. package/build-module/components/border-radius-control/index.js +3 -2
  96. package/build-module/components/border-radius-control/index.js.map +1 -1
  97. package/build-module/components/color-palette/with-color-context.js +6 -5
  98. package/build-module/components/color-palette/with-color-context.js.map +1 -1
  99. package/build-module/components/colors/with-colors.js +2 -7
  100. package/build-module/components/colors/with-colors.js.map +1 -1
  101. package/build-module/components/colors-gradients/control.js +6 -7
  102. package/build-module/components/colors-gradients/control.js.map +1 -1
  103. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +5 -12
  104. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  105. package/build-module/components/font-family/index.js +2 -2
  106. package/build-module/components/font-family/index.js.map +1 -1
  107. package/build-module/components/font-sizes/font-size-picker.js +3 -4
  108. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  109. package/build-module/components/font-sizes/with-font-sizes.js +3 -3
  110. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  111. package/build-module/components/global-styles/filters-panel.js +7 -8
  112. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  113. package/build-module/components/global-styles/image-settings-panel.js +2 -2
  114. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  115. package/build-module/components/global-styles/typography-panel.js +1 -1
  116. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  117. package/build-module/components/gradients/use-gradient.js +2 -4
  118. package/build-module/components/gradients/use-gradient.js.map +1 -1
  119. package/build-module/components/height-control/index.js +3 -2
  120. package/build-module/components/height-control/index.js.map +1 -1
  121. package/build-module/components/index.js +1 -1
  122. package/build-module/components/index.js.map +1 -1
  123. package/build-module/components/index.native.js +1 -1
  124. package/build-module/components/index.native.js.map +1 -1
  125. package/build-module/components/inner-blocks/index.js +2 -2
  126. package/build-module/components/inner-blocks/index.js.map +1 -1
  127. package/build-module/components/letter-spacing-control/index.js +3 -2
  128. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  129. package/build-module/components/link-control/search-item.js +12 -1
  130. package/build-module/components/link-control/search-item.js.map +1 -1
  131. package/build-module/components/link-control/search-results.js +2 -1
  132. package/build-module/components/link-control/search-results.js.map +1 -1
  133. package/build-module/components/link-control/use-search-handler.js +10 -5
  134. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  135. package/build-module/components/rich-text/index.js +1 -1
  136. package/build-module/components/rich-text/index.js.map +1 -1
  137. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +6 -2
  138. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  139. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -2
  140. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  141. package/build-module/components/unit-control/index.js +3 -2
  142. package/build-module/components/unit-control/index.js.map +1 -1
  143. package/build-module/components/use-block-commands/index.js +5 -1
  144. package/build-module/components/use-block-commands/index.js.map +1 -1
  145. package/build-module/components/use-settings/index.js +203 -0
  146. package/build-module/components/use-settings/index.js.map +1 -0
  147. package/build-module/hooks/align.js +51 -35
  148. package/build-module/hooks/align.js.map +1 -1
  149. package/build-module/hooks/anchor.js +37 -32
  150. package/build-module/hooks/anchor.js.map +1 -1
  151. package/build-module/hooks/background.js +4 -4
  152. package/build-module/hooks/background.js.map +1 -1
  153. package/build-module/hooks/color.js +2 -4
  154. package/build-module/hooks/color.js.map +1 -1
  155. package/build-module/hooks/duotone.js +6 -8
  156. package/build-module/hooks/duotone.js.map +1 -1
  157. package/build-module/hooks/font-size.js +4 -4
  158. package/build-module/hooks/font-size.js.map +1 -1
  159. package/build-module/hooks/layout.js +10 -11
  160. package/build-module/hooks/layout.js.map +1 -1
  161. package/build-module/hooks/line-height.js +3 -3
  162. package/build-module/hooks/line-height.js.map +1 -1
  163. package/build-module/hooks/position.js +2 -3
  164. package/build-module/hooks/position.js.map +1 -1
  165. package/build-module/hooks/use-color-props.js +3 -11
  166. package/build-module/hooks/use-color-props.js.map +1 -1
  167. package/build-module/hooks/utils.js +2 -43
  168. package/build-module/hooks/utils.js.map +1 -1
  169. package/build-module/layouts/constrained.js +3 -2
  170. package/build-module/layouts/constrained.js.map +1 -1
  171. package/build-module/utils/object.js +3 -1
  172. package/build-module/utils/object.js.map +1 -1
  173. package/build-module/utils/transform-styles/index.js +20 -24
  174. package/build-module/utils/transform-styles/index.js.map +1 -1
  175. package/build-style/style-rtl.css +13 -6
  176. package/build-style/style.css +13 -6
  177. package/package.json +36 -34
  178. package/src/components/block-alignment-control/use-available-alignments.js +49 -34
  179. package/src/components/block-list/block.native.js +4 -4
  180. package/src/components/block-list/layout.js +2 -2
  181. package/src/components/block-styles/style.scss +1 -1
  182. package/src/components/border-radius-control/index.js +3 -2
  183. package/src/components/color-palette/with-color-context.js +9 -9
  184. package/src/components/colors/with-colors.js +6 -7
  185. package/src/components/colors-gradients/control.js +10 -7
  186. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +29 -15
  187. package/src/components/font-family/index.js +2 -2
  188. package/src/components/font-sizes/font-size-picker.js +6 -4
  189. package/src/components/font-sizes/with-font-sizes.js +3 -5
  190. package/src/components/global-styles/filters-panel.js +9 -15
  191. package/src/components/global-styles/image-settings-panel.js +2 -2
  192. package/src/components/global-styles/typography-panel.js +1 -1
  193. package/src/components/gradients/use-gradient.js +10 -4
  194. package/src/components/height-control/index.js +3 -2
  195. package/src/components/index.js +1 -1
  196. package/src/components/index.native.js +1 -1
  197. package/src/components/inner-blocks/index.js +2 -2
  198. package/src/components/inserter/style.scss +9 -1
  199. package/src/components/letter-spacing-control/index.js +3 -2
  200. package/src/components/link-control/search-item.js +14 -0
  201. package/src/components/link-control/search-results.js +1 -0
  202. package/src/components/link-control/use-search-handler.js +22 -15
  203. package/src/components/rich-text/index.js +1 -1
  204. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +7 -5
  205. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -2
  206. package/src/components/unit-control/index.js +3 -8
  207. package/src/components/use-block-commands/index.js +2 -1
  208. package/src/components/{use-setting → use-settings}/README.md +9 -10
  209. package/src/components/use-settings/index.js +272 -0
  210. package/src/components/{use-setting → use-settings}/test/index.js +47 -5
  211. package/src/hooks/align.js +79 -54
  212. package/src/hooks/anchor.js +75 -65
  213. package/src/hooks/background.js +7 -9
  214. package/src/hooks/color.js +7 -4
  215. package/src/hooks/duotone.js +18 -14
  216. package/src/hooks/font-size.js +4 -4
  217. package/src/hooks/layout.js +11 -11
  218. package/src/hooks/line-height.js +3 -3
  219. package/src/hooks/position.js +5 -3
  220. package/src/hooks/use-color-props.js +21 -14
  221. package/src/hooks/utils.js +88 -43
  222. package/src/layouts/constrained.js +3 -8
  223. package/src/utils/object.js +4 -1
  224. package/src/utils/test/__snapshots__/transform-styles.js.snap +103 -0
  225. package/src/utils/test/transform-styles.js +217 -0
  226. package/src/utils/transform-styles/index.js +25 -25
  227. package/build/components/use-setting/index.js +0 -161
  228. package/build/components/use-setting/index.js.map +0 -1
  229. package/build/utils/transform-styles/ast/index.js +0 -21
  230. package/build/utils/transform-styles/ast/index.js.map +0 -1
  231. package/build/utils/transform-styles/ast/parse.js +0 -660
  232. package/build/utils/transform-styles/ast/parse.js.map +0 -1
  233. package/build/utils/transform-styles/ast/stringify/compiler.js +0 -52
  234. package/build/utils/transform-styles/ast/stringify/compiler.js.map +0 -1
  235. package/build/utils/transform-styles/ast/stringify/compress.js +0 -178
  236. package/build/utils/transform-styles/ast/stringify/compress.js.map +0 -1
  237. package/build/utils/transform-styles/ast/stringify/identity.js +0 -207
  238. package/build/utils/transform-styles/ast/stringify/identity.js.map +0 -1
  239. package/build/utils/transform-styles/ast/stringify/index.js +0 -36
  240. package/build/utils/transform-styles/ast/stringify/index.js.map +0 -1
  241. package/build/utils/transform-styles/transforms/url-rewrite.js +0 -130
  242. package/build/utils/transform-styles/transforms/url-rewrite.js.map +0 -1
  243. package/build/utils/transform-styles/transforms/wrap.js +0 -59
  244. package/build/utils/transform-styles/transforms/wrap.js.map +0 -1
  245. package/build/utils/transform-styles/traverse.js +0 -37
  246. package/build/utils/transform-styles/traverse.js.map +0 -1
  247. package/build-module/components/use-setting/index.js +0 -154
  248. package/build-module/components/use-setting/index.js.map +0 -1
  249. package/build-module/utils/transform-styles/ast/index.js +0 -6
  250. package/build-module/utils/transform-styles/ast/index.js.map +0 -1
  251. package/build-module/utils/transform-styles/ast/parse.js +0 -654
  252. package/build-module/utils/transform-styles/ast/parse.js.map +0 -1
  253. package/build-module/utils/transform-styles/ast/stringify/compiler.js +0 -49
  254. package/build-module/utils/transform-styles/ast/stringify/compiler.js.map +0 -1
  255. package/build-module/utils/transform-styles/ast/stringify/compress.js +0 -176
  256. package/build-module/utils/transform-styles/ast/stringify/compress.js.map +0 -1
  257. package/build-module/utils/transform-styles/ast/stringify/identity.js +0 -206
  258. package/build-module/utils/transform-styles/ast/stringify/identity.js.map +0 -1
  259. package/build-module/utils/transform-styles/ast/stringify/index.js +0 -29
  260. package/build-module/utils/transform-styles/ast/stringify/index.js.map +0 -1
  261. package/build-module/utils/transform-styles/transforms/url-rewrite.js +0 -123
  262. package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +0 -1
  263. package/build-module/utils/transform-styles/transforms/wrap.js +0 -52
  264. package/build-module/utils/transform-styles/transforms/wrap.js.map +0 -1
  265. package/build-module/utils/transform-styles/traverse.js +0 -28
  266. package/build-module/utils/transform-styles/traverse.js.map +0 -1
  267. package/src/components/use-setting/index.js +0 -218
  268. package/src/utils/transform-styles/ast/index.js +0 -5
  269. package/src/utils/transform-styles/ast/parse.js +0 -732
  270. package/src/utils/transform-styles/ast/stringify/compiler.js +0 -50
  271. package/src/utils/transform-styles/ast/stringify/compress.js +0 -238
  272. package/src/utils/transform-styles/ast/stringify/identity.js +0 -286
  273. package/src/utils/transform-styles/ast/stringify/index.js +0 -32
  274. package/src/utils/transform-styles/test/__snapshots__/traverse.js.snap +0 -7
  275. package/src/utils/transform-styles/test/traverse.js +0 -24
  276. package/src/utils/transform-styles/transforms/test/__snapshots__/url-rewrite.js.snap +0 -25
  277. package/src/utils/transform-styles/transforms/test/__snapshots__/wrap.js.snap +0 -64
  278. package/src/utils/transform-styles/transforms/test/url-rewrite.js +0 -39
  279. package/src/utils/transform-styles/transforms/test/wrap.js +0 -95
  280. package/src/utils/transform-styles/transforms/url-rewrite.js +0 -139
  281. package/src/utils/transform-styles/transforms/wrap.js +0 -56
  282. package/src/utils/transform-styles/traverse.js +0 -32
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_useSetting","_interopRequireDefault","_default","createHigherOrderComponent","WrappedComponent","props","colorsFeature","useSetting","disableCustomColorsFeature","colors","undefined","disableCustomColors","hasColorsToChoose","length","_react","createElement","exports","default"],"sources":["@wordpress/block-editor/src/components/color-palette/with-color-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../use-setting';\n\nexport default createHigherOrderComponent( ( WrappedComponent ) => {\n\treturn ( props ) => {\n\t\tconst colorsFeature = useSetting( 'color.palette' );\n\t\tconst disableCustomColorsFeature = ! useSetting( 'color.custom' );\n\t\tconst colors =\n\t\t\tprops.colors === undefined ? colorsFeature : props.colors;\n\t\tconst disableCustomColors =\n\t\t\tprops.disableCustomColors === undefined\n\t\t\t\t? disableCustomColorsFeature\n\t\t\t\t: props.disableCustomColors;\n\t\tconst hasColorsToChoose =\n\t\t\t( colors && colors.length > 0 ) || ! disableCustomColors;\n\t\treturn (\n\t\t\t<WrappedComponent\n\t\t\t\t{ ...{\n\t\t\t\t\t...props,\n\t\t\t\t\tcolors,\n\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\thasColorsToChoose,\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t};\n}, 'withColorContext' );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;AAGA;AACA;AACA;AAFA,IAAAG,QAAA,GAKe,IAAAC,mCAA0B,EAAIC,gBAAgB,IAAM;EAClE,OAASC,KAAK,IAAM;IACnB,MAAMC,aAAa,GAAG,IAAAC,mBAAU,EAAE,eAAgB,CAAC;IACnD,MAAMC,0BAA0B,GAAG,CAAE,IAAAD,mBAAU,EAAE,cAAe,CAAC;IACjE,MAAME,MAAM,GACXJ,KAAK,CAACI,MAAM,KAAKC,SAAS,GAAGJ,aAAa,GAAGD,KAAK,CAACI,MAAM;IAC1D,MAAME,mBAAmB,GACxBN,KAAK,CAACM,mBAAmB,KAAKD,SAAS,GACpCF,0BAA0B,GAC1BH,KAAK,CAACM,mBAAmB;IAC7B,MAAMC,iBAAiB,GACpBH,MAAM,IAAIA,MAAM,CAACI,MAAM,GAAG,CAAC,IAAM,CAAEF,mBAAmB;IACzD,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACX,gBAAgB;MAEf,GAAGC,KAAK;MACRI,MAAM;MACNE,mBAAmB;MACnBC;IAAiB,CAElB,CAAC;EAEJ,CAAC;AACF,CAAC,EAAE,kBAAmB,CAAC;AAAAI,OAAA,CAAAC,OAAA,GAAAf,QAAA"}
1
+ {"version":3,"names":["_compose","require","_useSettings","_default","createHigherOrderComponent","WrappedComponent","props","colorsFeature","enableCustomColors","useSettings","colors","disableCustomColors","hasColorsToChoose","length","_react","createElement","exports","default"],"sources":["@wordpress/block-editor/src/components/color-palette/with-color-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default createHigherOrderComponent( ( WrappedComponent ) => {\n\treturn ( props ) => {\n\t\tconst [ colorsFeature, enableCustomColors ] = useSettings(\n\t\t\t'color.palette',\n\t\t\t'color.custom'\n\t\t);\n\t\tconst {\n\t\t\tcolors = colorsFeature,\n\t\t\tdisableCustomColors = ! enableCustomColors,\n\t\t} = props;\n\t\tconst hasColorsToChoose =\n\t\t\t( colors && colors.length > 0 ) || ! disableCustomColors;\n\t\treturn (\n\t\t\t<WrappedComponent\n\t\t\t\t{ ...{\n\t\t\t\t\t...props,\n\t\t\t\t\tcolors,\n\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\thasColorsToChoose,\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t};\n}, 'withColorContext' );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AARA;AACA;AACA;AAGA;AACA;AACA;AAFA,IAAAE,QAAA,GAKe,IAAAC,mCAA0B,EAAIC,gBAAgB,IAAM;EAClE,OAASC,KAAK,IAAM;IACnB,MAAM,CAAEC,aAAa,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,wBAAW,EACxD,eAAe,EACf,cACD,CAAC;IACD,MAAM;MACLC,MAAM,GAAGH,aAAa;MACtBI,mBAAmB,GAAG,CAAEH;IACzB,CAAC,GAAGF,KAAK;IACT,MAAMM,iBAAiB,GACpBF,MAAM,IAAIA,MAAM,CAACG,MAAM,GAAG,CAAC,IAAM,CAAEF,mBAAmB;IACzD,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACV,gBAAgB;MAEf,GAAGC,KAAK;MACRI,MAAM;MACNC,mBAAmB;MACnBC;IAAiB,CAElB,CAAC;EAEJ,CAAC;AACF,CAAC,EAAE,kBAAmB,CAAC;AAAAI,OAAA,CAAAC,OAAA,GAAAd,QAAA"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -10,7 +9,7 @@ var _react = require("react");
10
9
  var _element = require("@wordpress/element");
11
10
  var _compose = require("@wordpress/compose");
12
11
  var _utils = require("./utils");
13
- var _useSetting = _interopRequireDefault(require("../use-setting"));
12
+ var _useSettings = require("../use-settings");
14
13
  var _object = require("../../utils/object");
15
14
  /**
16
15
  * WordPress dependencies
@@ -49,12 +48,7 @@ const withCustomColorPalette = colorsArray => (0, _compose.createHigherOrderComp
49
48
  * @return {Function} The higher order component.
50
49
  */
51
50
  const withEditorColorPalette = () => (0, _compose.createHigherOrderComponent)(WrappedComponent => props => {
52
- // Some color settings have a special handling for deprecated flags in `useSetting`,
53
- // so we can't unwrap them by doing const { ... } = useSetting('color')
54
- // until https://github.com/WordPress/gutenberg/issues/37094 is fixed.
55
- const userPalette = (0, _useSetting.default)('color.palette.custom');
56
- const themePalette = (0, _useSetting.default)('color.palette.theme');
57
- const defaultPalette = (0, _useSetting.default)('color.palette.default');
51
+ const [userPalette, themePalette, defaultPalette] = (0, _useSettings.useSettings)('color.palette.custom', 'color.palette.theme', 'color.palette.default');
58
52
  const allColors = (0, _element.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
59
53
  return (0, _react.createElement)(WrappedComponent, {
60
54
  ...props,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_compose","_utils","_useSetting","_interopRequireDefault","_object","upperFirst","firstLetter","rest","toUpperCase","join","withCustomColorPalette","colorsArray","createHigherOrderComponent","WrappedComponent","props","_react","createElement","colors","withEditorColorPalette","userPalette","useSetting","themePalette","defaultPalette","allColors","useMemo","createColorHOC","colorTypes","withColorPalette","colorMap","reduce","colorObject","colorType","kebabCase","compose","Component","constructor","setters","createSetters","colorUtils","getMostReadableColor","bind","state","colorValue","Object","keys","settersAccumulator","colorAttributeName","upperFirstColorAttributeName","customColorAttributeName","createSetColor","getColorObjectByColorValue","setAttributes","slug","undefined","getDerivedStateFromProps","attributes","previousState","entries","newState","colorContext","getColorObjectByAttributeValues","previousColorObject","previousColor","color","class","getColorClassName","render","createCustomColorsHOC","withColors"],"sources":["@wordpress/block-editor/src/components/colors/with-colors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, Component } from '@wordpress/element';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetMostReadableColor,\n} from './utils';\nimport useSetting from '../use-setting';\nimport { kebabCase } from '../../utils/object';\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param {string} str The string whose first letter the function will capitalize.\n *\n * @return {string} Capitalized string.\n */\nconst upperFirst = ( [ firstLetter, ...rest ] ) =>\n\tfirstLetter.toUpperCase() + rest.join( '' );\n\n/**\n * Higher order component factory for injecting the `colorsArray` argument as\n * the colors prop in the `withCustomColors` HOC.\n *\n * @param {Array} colorsArray An array of color objects.\n *\n * @return {Function} The higher order component.\n */\nconst withCustomColorPalette = ( colorsArray ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( props ) => (\n\t\t\t<WrappedComponent { ...props } colors={ colorsArray } />\n\t\t),\n\t\t'withCustomColorPalette'\n\t);\n\n/**\n * Higher order component factory for injecting the editor colors as the\n * `colors` prop in the `withColors` HOC.\n *\n * @return {Function} The higher order component.\n */\nconst withEditorColorPalette = () =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( props ) => {\n\t\t\t// Some color settings have a special handling for deprecated flags in `useSetting`,\n\t\t\t// so we can't unwrap them by doing const { ... } = useSetting('color')\n\t\t\t// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.\n\t\t\tconst userPalette = useSetting( 'color.palette.custom' );\n\t\t\tconst themePalette = useSetting( 'color.palette.theme' );\n\t\t\tconst defaultPalette = useSetting( 'color.palette.default' );\n\t\t\tconst allColors = useMemo(\n\t\t\t\t() => [\n\t\t\t\t\t...( userPalette || [] ),\n\t\t\t\t\t...( themePalette || [] ),\n\t\t\t\t\t...( defaultPalette || [] ),\n\t\t\t\t],\n\t\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t\t);\n\t\t\treturn <WrappedComponent { ...props } colors={ allColors } />;\n\t\t},\n\t\t'withEditorColorPalette'\n\t);\n\n/**\n * Helper function used with `createHigherOrderComponent` to create\n * higher order components for managing color logic.\n *\n * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor).\n * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent.\n *\n * @return {Component} The component that can be used as a HOC.\n */\nfunction createColorHOC( colorTypes, withColorPalette ) {\n\tconst colorMap = colorTypes.reduce( ( colorObject, colorType ) => {\n\t\treturn {\n\t\t\t...colorObject,\n\t\t\t...( typeof colorType === 'string'\n\t\t\t\t? { [ colorType ]: kebabCase( colorType ) }\n\t\t\t\t: colorType ),\n\t\t};\n\t}, {} );\n\n\treturn compose( [\n\t\twithColorPalette,\n\t\t( WrappedComponent ) => {\n\t\t\treturn class extends Component {\n\t\t\t\tconstructor( props ) {\n\t\t\t\t\tsuper( props );\n\n\t\t\t\t\tthis.setters = this.createSetters();\n\t\t\t\t\tthis.colorUtils = {\n\t\t\t\t\t\tgetMostReadableColor:\n\t\t\t\t\t\t\tthis.getMostReadableColor.bind( this ),\n\t\t\t\t\t};\n\n\t\t\t\t\tthis.state = {};\n\t\t\t\t}\n\n\t\t\t\tgetMostReadableColor( colorValue ) {\n\t\t\t\t\tconst { colors } = this.props;\n\t\t\t\t\treturn getMostReadableColor( colors, colorValue );\n\t\t\t\t}\n\n\t\t\t\tcreateSetters() {\n\t\t\t\t\treturn Object.keys( colorMap ).reduce(\n\t\t\t\t\t\t( settersAccumulator, colorAttributeName ) => {\n\t\t\t\t\t\t\tconst upperFirstColorAttributeName =\n\t\t\t\t\t\t\t\tupperFirst( colorAttributeName );\n\t\t\t\t\t\t\tconst customColorAttributeName = `custom${ upperFirstColorAttributeName }`;\n\t\t\t\t\t\t\tsettersAccumulator[\n\t\t\t\t\t\t\t\t`set${ upperFirstColorAttributeName }`\n\t\t\t\t\t\t\t] = this.createSetColor(\n\t\t\t\t\t\t\t\tcolorAttributeName,\n\t\t\t\t\t\t\t\tcustomColorAttributeName\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn settersAccumulator;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tcreateSetColor( colorAttributeName, customColorAttributeName ) {\n\t\t\t\t\treturn ( colorValue ) => {\n\t\t\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\t\t\tthis.props.colors,\n\t\t\t\t\t\t\tcolorValue\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.props.setAttributes( {\n\t\t\t\t\t\t\t[ colorAttributeName ]:\n\t\t\t\t\t\t\t\tcolorObject && colorObject.slug\n\t\t\t\t\t\t\t\t\t? colorObject.slug\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t[ customColorAttributeName ]:\n\t\t\t\t\t\t\t\tcolorObject && colorObject.slug\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: colorValue,\n\t\t\t\t\t\t} );\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tstatic getDerivedStateFromProps(\n\t\t\t\t\t{ attributes, colors },\n\t\t\t\t\tpreviousState\n\t\t\t\t) {\n\t\t\t\t\treturn Object.entries( colorMap ).reduce(\n\t\t\t\t\t\t( newState, [ colorAttributeName, colorContext ] ) => {\n\t\t\t\t\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\tcolors,\n\t\t\t\t\t\t\t\tattributes[ colorAttributeName ],\n\t\t\t\t\t\t\t\tattributes[\n\t\t\t\t\t\t\t\t\t`custom${ upperFirst(\n\t\t\t\t\t\t\t\t\t\tcolorAttributeName\n\t\t\t\t\t\t\t\t\t) }`\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tconst previousColorObject =\n\t\t\t\t\t\t\t\tpreviousState[ colorAttributeName ];\n\t\t\t\t\t\t\tconst previousColor = previousColorObject?.color;\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * The \"and previousColorObject\" condition checks that a previous color object was already computed.\n\t\t\t\t\t\t\t * At the start previousColorObject and colorValue are both equal to undefined\n\t\t\t\t\t\t\t * bus as previousColorObject does not exist we should compute the object.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpreviousColor === colorObject.color &&\n\t\t\t\t\t\t\t\tpreviousColorObject\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnewState[ colorAttributeName ] =\n\t\t\t\t\t\t\t\t\tpreviousColorObject;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tnewState[ colorAttributeName ] = {\n\t\t\t\t\t\t\t\t\t...colorObject,\n\t\t\t\t\t\t\t\t\tclass: getColorClassName(\n\t\t\t\t\t\t\t\t\t\tcolorContext,\n\t\t\t\t\t\t\t\t\t\tcolorObject.slug\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn newState;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\trender() {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t...this.props,\n\t\t\t\t\t\t\t\tcolors: undefined,\n\t\t\t\t\t\t\t\t...this.state,\n\t\t\t\t\t\t\t\t...this.setters,\n\t\t\t\t\t\t\t\tcolorUtils: this.colorUtils,\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}\n\t\t\t};\n\t\t},\n\t] );\n}\n\n/**\n * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic\n * for class generation color value, retrieval and color attribute setting.\n *\n * Use this higher-order component to work with a custom set of colors.\n *\n * @example\n *\n * ```jsx\n * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ];\n * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS );\n * // ...\n * export default compose(\n * withCustomColors( 'backgroundColor', 'borderColor' ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ).\n *\n * @return {Function} Higher-order component.\n */\nexport function createCustomColorsHOC( colorsArray ) {\n\treturn ( ...colorTypes ) => {\n\t\tconst withColorPalette = withCustomColorPalette( colorsArray );\n\t\treturn createHigherOrderComponent(\n\t\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t\t'withCustomColors'\n\t\t);\n\t};\n}\n\n/**\n * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting.\n *\n * For use with the default editor/theme color palette.\n *\n * @example\n *\n * ```jsx\n * export default compose(\n * withColors( 'backgroundColor', { textColor: 'color' } ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object,\n * it should contain the color attribute name as key and the color context as value.\n * If the argument is a string the value should be the color attribute name,\n * the color context is computed by applying a kebab case transform to the value.\n * Color context represents the context/place where the color is going to be used.\n * The class name of the color is generated using 'has' followed by the color name\n * and ending with the color context all in kebab case e.g: has-green-background-color.\n *\n * @return {Function} Higher-order component.\n */\nexport default function withColors( ...colorTypes ) {\n\tconst withColorPalette = withEditorColorPalette();\n\treturn createHigherOrderComponent(\n\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t'withColors'\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAMA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,UAAU,GAAGA,CAAE,CAAEC,WAAW,EAAE,GAAGC,IAAI,CAAE,KAC5CD,WAAW,CAACE,WAAW,CAAC,CAAC,GAAGD,IAAI,CAACE,IAAI,CAAE,EAAG,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAKC,WAAW,IAC3C,IAAAC,mCAA0B,EACvBC,gBAAgB,IAAQC,KAAK,IAC9B,IAAAC,MAAA,CAAAC,aAAA,EAACH,gBAAgB;EAAA,GAAMC,KAAK;EAAGG,MAAM,EAAGN;AAAa,CAAE,CACvD,EACD,wBACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,MAAMO,sBAAsB,GAAGA,CAAA,KAC9B,IAAAN,mCAA0B,EACvBC,gBAAgB,IAAQC,KAAK,IAAM;EACpC;EACA;EACA;EACA,MAAMK,WAAW,GAAG,IAAAC,mBAAU,EAAE,sBAAuB,CAAC;EACxD,MAAMC,YAAY,GA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C,gBAAiB,CAAC,EAC9C,kBACD,CAAC;EACF,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASyC,UAAUA,CAAE,GAAG1C,UAAU,EAAG;EACnD,MAAMC,gBAAgB,GAAGT,sBAAsB,CAAC,CAAC;EACjD,OAAO,IAAAN,mCAA0B,EAChCa,cAAc,CAAEC,UAAU,EAAEC,gBAAiB,CAAC,EAC9C,YACD,CAAC;AACF"}
1
+ {"version":3,"names":["_element","require","_compose","_utils","_useSettings","_object","upperFirst","firstLetter","rest","toUpperCase","join","withCustomColorPalette","colorsArray","createHigherOrderComponent","WrappedComponent","props","_react","createElement","colors","withEditorColorPalette","userPalette","themePalette","defaultPalette","useSettings","allColors","useMemo","createColorHOC","colorTypes","withColorPalette","colorMap","reduce","colorObject","colorType","kebabCase","compose","Component","constructor","setters","createSetters","colorUtils","getMostReadableColor","bind","state","colorValue","Object","keys","settersAccumulator","colorAttributeName","upperFirstColorAttributeName","customColorAttributeName","createSetColor","getColorObjectByColorValue","setAttributes","slug","undefined","getDerivedStateFromProps","attributes","previousState","entries","newState","colorContext","getColorObjectByAttributeValues","previousColorObject","previousColor","color","class","getColorClassName","render","createCustomColorsHOC","withColors"],"sources":["@wordpress/block-editor/src/components/colors/with-colors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, Component } from '@wordpress/element';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetMostReadableColor,\n} from './utils';\nimport { useSettings } from '../use-settings';\nimport { kebabCase } from '../../utils/object';\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param {string} str The string whose first letter the function will capitalize.\n *\n * @return {string} Capitalized string.\n */\nconst upperFirst = ( [ firstLetter, ...rest ] ) =>\n\tfirstLetter.toUpperCase() + rest.join( '' );\n\n/**\n * Higher order component factory for injecting the `colorsArray` argument as\n * the colors prop in the `withCustomColors` HOC.\n *\n * @param {Array} colorsArray An array of color objects.\n *\n * @return {Function} The higher order component.\n */\nconst withCustomColorPalette = ( colorsArray ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( props ) => (\n\t\t\t<WrappedComponent { ...props } colors={ colorsArray } />\n\t\t),\n\t\t'withCustomColorPalette'\n\t);\n\n/**\n * Higher order component factory for injecting the editor colors as the\n * `colors` prop in the `withColors` HOC.\n *\n * @return {Function} The higher order component.\n */\nconst withEditorColorPalette = () =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( props ) => {\n\t\t\tconst [ userPalette, themePalette, defaultPalette ] = useSettings(\n\t\t\t\t'color.palette.custom',\n\t\t\t\t'color.palette.theme',\n\t\t\t\t'color.palette.default'\n\t\t\t);\n\t\t\tconst allColors = useMemo(\n\t\t\t\t() => [\n\t\t\t\t\t...( userPalette || [] ),\n\t\t\t\t\t...( themePalette || [] ),\n\t\t\t\t\t...( defaultPalette || [] ),\n\t\t\t\t],\n\t\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t\t);\n\t\t\treturn <WrappedComponent { ...props } colors={ allColors } />;\n\t\t},\n\t\t'withEditorColorPalette'\n\t);\n\n/**\n * Helper function used with `createHigherOrderComponent` to create\n * higher order components for managing color logic.\n *\n * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor).\n * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent.\n *\n * @return {Component} The component that can be used as a HOC.\n */\nfunction createColorHOC( colorTypes, withColorPalette ) {\n\tconst colorMap = colorTypes.reduce( ( colorObject, colorType ) => {\n\t\treturn {\n\t\t\t...colorObject,\n\t\t\t...( typeof colorType === 'string'\n\t\t\t\t? { [ colorType ]: kebabCase( colorType ) }\n\t\t\t\t: colorType ),\n\t\t};\n\t}, {} );\n\n\treturn compose( [\n\t\twithColorPalette,\n\t\t( WrappedComponent ) => {\n\t\t\treturn class extends Component {\n\t\t\t\tconstructor( props ) {\n\t\t\t\t\tsuper( props );\n\n\t\t\t\t\tthis.setters = this.createSetters();\n\t\t\t\t\tthis.colorUtils = {\n\t\t\t\t\t\tgetMostReadableColor:\n\t\t\t\t\t\t\tthis.getMostReadableColor.bind( this ),\n\t\t\t\t\t};\n\n\t\t\t\t\tthis.state = {};\n\t\t\t\t}\n\n\t\t\t\tgetMostReadableColor( colorValue ) {\n\t\t\t\t\tconst { colors } = this.props;\n\t\t\t\t\treturn getMostReadableColor( colors, colorValue );\n\t\t\t\t}\n\n\t\t\t\tcreateSetters() {\n\t\t\t\t\treturn Object.keys( colorMap ).reduce(\n\t\t\t\t\t\t( settersAccumulator, colorAttributeName ) => {\n\t\t\t\t\t\t\tconst upperFirstColorAttributeName =\n\t\t\t\t\t\t\t\tupperFirst( colorAttributeName );\n\t\t\t\t\t\t\tconst customColorAttributeName = `custom${ upperFirstColorAttributeName }`;\n\t\t\t\t\t\t\tsettersAccumulator[\n\t\t\t\t\t\t\t\t`set${ upperFirstColorAttributeName }`\n\t\t\t\t\t\t\t] = this.createSetColor(\n\t\t\t\t\t\t\t\tcolorAttributeName,\n\t\t\t\t\t\t\t\tcustomColorAttributeName\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn settersAccumulator;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tcreateSetColor( colorAttributeName, customColorAttributeName ) {\n\t\t\t\t\treturn ( colorValue ) => {\n\t\t\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\t\t\tthis.props.colors,\n\t\t\t\t\t\t\tcolorValue\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.props.setAttributes( {\n\t\t\t\t\t\t\t[ colorAttributeName ]:\n\t\t\t\t\t\t\t\tcolorObject && colorObject.slug\n\t\t\t\t\t\t\t\t\t? colorObject.slug\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t[ customColorAttributeName ]:\n\t\t\t\t\t\t\t\tcolorObject && colorObject.slug\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: colorValue,\n\t\t\t\t\t\t} );\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tstatic getDerivedStateFromProps(\n\t\t\t\t\t{ attributes, colors },\n\t\t\t\t\tpreviousState\n\t\t\t\t) {\n\t\t\t\t\treturn Object.entries( colorMap ).reduce(\n\t\t\t\t\t\t( newState, [ colorAttributeName, colorContext ] ) => {\n\t\t\t\t\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\tcolors,\n\t\t\t\t\t\t\t\tattributes[ colorAttributeName ],\n\t\t\t\t\t\t\t\tattributes[\n\t\t\t\t\t\t\t\t\t`custom${ upperFirst(\n\t\t\t\t\t\t\t\t\t\tcolorAttributeName\n\t\t\t\t\t\t\t\t\t) }`\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tconst previousColorObject =\n\t\t\t\t\t\t\t\tpreviousState[ colorAttributeName ];\n\t\t\t\t\t\t\tconst previousColor = previousColorObject?.color;\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * The \"and previousColorObject\" condition checks that a previous color object was already computed.\n\t\t\t\t\t\t\t * At the start previousColorObject and colorValue are both equal to undefined\n\t\t\t\t\t\t\t * bus as previousColorObject does not exist we should compute the object.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpreviousColor === colorObject.color &&\n\t\t\t\t\t\t\t\tpreviousColorObject\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnewState[ colorAttributeName ] =\n\t\t\t\t\t\t\t\t\tpreviousColorObject;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tnewState[ colorAttributeName ] = {\n\t\t\t\t\t\t\t\t\t...colorObject,\n\t\t\t\t\t\t\t\t\tclass: getColorClassName(\n\t\t\t\t\t\t\t\t\t\tcolorContext,\n\t\t\t\t\t\t\t\t\t\tcolorObject.slug\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn newState;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\trender() {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t...this.props,\n\t\t\t\t\t\t\t\tcolors: undefined,\n\t\t\t\t\t\t\t\t...this.state,\n\t\t\t\t\t\t\t\t...this.setters,\n\t\t\t\t\t\t\t\tcolorUtils: this.colorUtils,\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}\n\t\t\t};\n\t\t},\n\t] );\n}\n\n/**\n * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic\n * for class generation color value, retrieval and color attribute setting.\n *\n * Use this higher-order component to work with a custom set of colors.\n *\n * @example\n *\n * ```jsx\n * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ];\n * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS );\n * // ...\n * export default compose(\n * withCustomColors( 'backgroundColor', 'borderColor' ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ).\n *\n * @return {Function} Higher-order component.\n */\nexport function createCustomColorsHOC( colorsArray ) {\n\treturn ( ...colorTypes ) => {\n\t\tconst withColorPalette = withCustomColorPalette( colorsArray );\n\t\treturn createHigherOrderComponent(\n\t\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t\t'withCustomColors'\n\t\t);\n\t};\n}\n\n/**\n * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting.\n *\n * For use with the default editor/theme color palette.\n *\n * @example\n *\n * ```jsx\n * export default compose(\n * withColors( 'backgroundColor', { textColor: 'color' } ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object,\n * it should contain the color attribute name as key and the color context as value.\n * If the argument is a string the value should be the color attribute name,\n * the color context is computed by applying a kebab case transform to the value.\n * Color context represents the context/place where the color is going to be used.\n * The class name of the color is generated using 'has' followed by the color name\n * and ending with the color context all in kebab case e.g: has-green-background-color.\n *\n * @return {Function} Higher-order component.\n */\nexport default function withColors( ...colorTypes ) {\n\tconst withColorPalette = withEditorColorPalette();\n\treturn createHigherOrderComponent(\n\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t'withColors'\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAMA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,UAAU,GAAGA,CAAE,CAAEC,WAAW,EAAE,GAAGC,IAAI,CAAE,KAC5CD,WAAW,CAACE,WAAW,CAAC,CAAC,GAAGD,IAAI,CAACE,IAAI,CAAE,EAAG,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAKC,WAAW,IAC3C,IAAAC,mCAA0B,EACvBC,gBAAgB,IAAQC,KAAK,IAC9B,IAAAC,MAAA,CAAAC,aAAA,EAACH,gBAAgB;EAAA,GAAMC,KAAK;EAAGG,MAAM,EAAGN;AAAa,CAAE,CACvD,EACD,wBACD,CAAC;;AAEF;AACA;AACA;AAC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AU,KAAM;IAC3B,MAAMC,gBAAgB,GAAGjB,sBAAsB,CAAEC,WAAY,CAAC;IAC9D,OAAO,IAAAC,mCAA0B,EAChCa,cAAc,CAAEC,UAAU,EAAEC,gBAAiB,CAAC,EAC9C,kBACD,CAAC;EACF,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASyC,UAAUA,CAAE,GAAG1C,UAAU,EAAG;EACnD,MAAMC,gBAAgB,GAAGT,sBAAsB,CAAC,CAAC;EACjD,OAAO,IAAAN,mCAA0B,EAChCa,cAAc,CAAEC,UAAU,EAAEC,gBAAiB,CAAC,EAC9C,YACD,CAAC;AACF"}
@@ -9,7 +9,7 @@ var _react = require("react");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _i18n = require("@wordpress/i18n");
11
11
  var _components = require("@wordpress/components");
12
- var _useSetting = _interopRequireDefault(require("../use-setting"));
12
+ var _useSettings = require("../use-settings");
13
13
  /**
14
14
  * External dependencies
15
15
  */
@@ -103,13 +103,12 @@ function ColorGradientControlInner({
103
103
  }, tab => renderPanelType(tab.value)), !canChooseAGradient && renderPanelType(TAB_COLOR.value), !canChooseAColor && renderPanelType(TAB_GRADIENT.value))));
104
104
  }
105
105
  function ColorGradientControlSelect(props) {
106
- const colorGradientSettings = {};
107
- colorGradientSettings.colors = (0, _useSetting.default)('color.palette');
108
- colorGradientSettings.gradients = (0, _useSetting.default)('color.gradients');
109
- colorGradientSettings.disableCustomColors = !(0, _useSetting.default)('color.custom');
110
- colorGradientSettings.disableCustomGradients = !(0, _useSetting.default)('color.customGradient');
106
+ const [colors, gradients, customColors, customGradients] = (0, _useSettings.useSettings)('color.palette', 'color.gradients', 'color.custom', 'color.customGradient');
111
107
  return (0, _react.createElement)(ColorGradientControlInner, {
112
- ...colorGradientSettings,
108
+ colors: colors,
109
+ gradients: gradients,
110
+ disableCustomColors: !customColors,
111
+ disableCustomGradients: !customGradients,
113
112
  ...props
114
113
  });
115
114
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_useSetting","colorsAndGradientKeys","TAB_COLOR","name","title","__","value","TAB_GRADIENT","TABS_SETTINGS","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalIsRenderedInSidebar","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","enableAlpha","headingLevel","canChooseAColor","length","canChooseAGradient","tabPanels","_react","createElement","ColorPalette","onChange","newColor","GradientPicker","__nextHasNoMargin","newGradient","renderPanelType","type","BaseControl","__nextHasNoMarginBottom","classnames","__experimentalVStack","spacing","VisualLabel","TabPanel","tabs","initialTabName","tab","ColorGradientControlSelect","props","colorGradientSettings","useSetting","ColorGradientControl","every","key","hasOwnProperty","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\tTabPanel,\n\tColorPalette,\n\tGradientPicker,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../use-setting';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst TAB_COLOR = {\n\tname: 'color',\n\ttitle: __( 'Solid' ),\n\tvalue: 'color',\n};\nconst TAB_GRADIENT = {\n\tname: 'gradient',\n\ttitle: __( 'Gradient' ),\n\tvalue: 'gradient',\n};\n\nconst TABS_SETTINGS = [ TAB_COLOR, TAB_GRADIENT ];\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n\theadingLevel,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange &&\n\t\t( ( colors && colors.length > 0 ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ( gradients && gradients.length > 0 ) || ! disableCustomGradients );\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\n\tconst tabPanels = {\n\t\t[ TAB_COLOR.value ]: (\n\t\t\t<ColorPalette\n\t\t\t\tvalue={ colorValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onColorChange\n\t\t\t\t}\n\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t\t[ TAB_GRADIENT.value ]: (\n\t\t\t<GradientPicker\n\t\t\t\t__nextHasNoMargin\n\t\t\t\tvalue={ gradientValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onGradientChange\n\t\t\t\t}\n\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t};\n\n\tconst renderPanelType = ( type ) => (\n\t\t<div className=\"block-editor-color-gradient-control__panel\">\n\t\t\t{ tabPanels[ type ] }\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset className=\"block-editor-color-gradient-control__fieldset\">\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<TabPanel\n\t\t\t\t\t\t\tclassName=\"block-editor-color-gradient-control__tabs\"\n\t\t\t\t\t\t\ttabs={ TABS_SETTINGS }\n\t\t\t\t\t\t\tinitialTabName={\n\t\t\t\t\t\t\t\tgradientValue\n\t\t\t\t\t\t\t\t\t? TAB_GRADIENT.value\n\t\t\t\t\t\t\t\t\t: !! canChooseAColor && TAB_COLOR.value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ( tab ) => renderPanelType( tab.value ) }\n\t\t\t\t\t\t</TabPanel>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canChooseAGradient &&\n\t\t\t\t\t\trenderPanelType( TAB_COLOR.value ) }\n\t\t\t\t\t{ ! canChooseAColor &&\n\t\t\t\t\t\trenderPanelType( TAB_GRADIENT.value ) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst colorGradientSettings = {};\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\tcolorGradientSettings.disableCustomColors = ! useSetting( 'color.custom' );\n\tcolorGradientSettings.disableCustomGradients = ! useSetting(\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAWA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAGA,MAAMI,qBAAqB,GAAG,CAC7B,QAAQ,EACR,qBAAqB,EACrB,WAAW,EACX,wBAAwB,CACxB;AAED,MAAMC,SAAS,GAAG;EACjBC,IAAI,EAAE,OAAO;EACbC,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EACpBC,KAAK,EAAE;AACR,CAAC;AACD,MAAMC,YAAY,GAAG;EACpBJ,IAAI,EAAE,UAAU;EAChBC,KAAK,EAAE,IAAAC,QAAE,EAAE,UAAW,CAAC;EACvBC,KAAK,EAAE;AACR,CAAC;AAED,MAAME,aAAa,GAAG,CAAEN,SAAS,EAAEK,YAAY,CAAE;AAEjD,SAASE,yBAAyBA,CAAE;EACnCC,MAAM;EACNC,SAAS;EACTC,mBAAmB;EACnBC,sBAAsB;EAC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AAG,CAAC,CAAC;EAChCA,qBAAqB,CAACzC,MAAM,GAAG,IAAA0C,mBAAU,EAAE,eAAgB,CAAC;EAC5DD,qBAAqB,CAACxC,SAAS,GAAG,IAAAyC,mBAAU,EAAE,iBAAkB,CAAC;EACjED,qBAAqB,CAACvC,mBAAmB,GAAG,CAAE,IAAAwC,mBAAU,EAAE,cAAe,CAAC;EAC1ED,qBAAqB,CAACtC,sBAAsB,GAAG,CAAE,IAAAuC,mBAAU,EAC1D,sBACD,CAAC;EAED,OACC,IAAAvB,MAAA,CAAAC,aAAA,EAACrB,yBAAyB;IAClB,GAAG0C,qBAAqB;IAAE,GAAGD;EAAK,CACzC,CAAC;AAEJ;AAEA,SAASG,oBAAoBA,CAAEH,KAAK,EAAG;EACtC,IACCjD,qBAAqB,CAACqD,KAAK,CAAIC,GAAG,IAAML,KAAK,CAACM,cAAc,CAAED,GAAI,CAAE,CAAC,EACpE;IACD,OAAO,IAAA1B,MAAA,CAAAC,aAAA,EAACrB,yBAAyB;MAAA,GAAMyC;IAAK,CAAI,CAAC;EAClD;EACA,OAAO,IAAArB,MAAA,CAAAC,aAAA,EAACmB,0BAA0B;IAAA,GAAMC;EAAK,CAAI,CAAC;AACnD;AAAC,IAAAO,QAAA,GAEcJ,oBAAoB;AAAAK,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_useSettings","colorsAndGradientKeys","TAB_COLOR","name","title","__","value","TAB_GRADIENT","TABS_SETTINGS","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalIsRenderedInSidebar","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","enableAlpha","headingLevel","canChooseAColor","length","canChooseAGradient","tabPanels","_react","createElement","ColorPalette","onChange","newColor","GradientPicker","__nextHasNoMargin","newGradient","renderPanelType","type","BaseControl","__nextHasNoMarginBottom","classnames","__experimentalVStack","spacing","VisualLabel","TabPanel","tabs","initialTabName","tab","ColorGradientControlSelect","props","customColors","customGradients","useSettings","ColorGradientControl","every","key","hasOwnProperty","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\tTabPanel,\n\tColorPalette,\n\tGradientPicker,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst TAB_COLOR = {\n\tname: 'color',\n\ttitle: __( 'Solid' ),\n\tvalue: 'color',\n};\nconst TAB_GRADIENT = {\n\tname: 'gradient',\n\ttitle: __( 'Gradient' ),\n\tvalue: 'gradient',\n};\n\nconst TABS_SETTINGS = [ TAB_COLOR, TAB_GRADIENT ];\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n\theadingLevel,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange &&\n\t\t( ( colors && colors.length > 0 ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ( gradients && gradients.length > 0 ) || ! disableCustomGradients );\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\n\tconst tabPanels = {\n\t\t[ TAB_COLOR.value ]: (\n\t\t\t<ColorPalette\n\t\t\t\tvalue={ colorValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onColorChange\n\t\t\t\t}\n\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t\t[ TAB_GRADIENT.value ]: (\n\t\t\t<GradientPicker\n\t\t\t\t__nextHasNoMargin\n\t\t\t\tvalue={ gradientValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onGradientChange\n\t\t\t\t}\n\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t};\n\n\tconst renderPanelType = ( type ) => (\n\t\t<div className=\"block-editor-color-gradient-control__panel\">\n\t\t\t{ tabPanels[ type ] }\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset className=\"block-editor-color-gradient-control__fieldset\">\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<TabPanel\n\t\t\t\t\t\t\tclassName=\"block-editor-color-gradient-control__tabs\"\n\t\t\t\t\t\t\ttabs={ TABS_SETTINGS }\n\t\t\t\t\t\t\tinitialTabName={\n\t\t\t\t\t\t\t\tgradientValue\n\t\t\t\t\t\t\t\t\t? TAB_GRADIENT.value\n\t\t\t\t\t\t\t\t\t: !! canChooseAColor && TAB_COLOR.value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ( tab ) => renderPanelType( tab.value ) }\n\t\t\t\t\t\t</TabPanel>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canChooseAGradient &&\n\t\t\t\t\t\trenderPanelType( TAB_COLOR.value ) }\n\t\t\t\t\t{ ! canChooseAColor &&\n\t\t\t\t\t\trenderPanelType( TAB_GRADIENT.value ) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst [ colors, gradients, customColors, customGradients ] = useSettings(\n\t\t'color.palette',\n\t\t'color.gradients',\n\t\t'color.custom',\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\tcolors={ colors }\n\t\t\tgradients={ gradients }\n\t\t\tdisableCustomColors={ ! customColors }\n\t\t\tdisableCustomGradients={ ! customGradients }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default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AC,aAAA,EAACrB,yBAAyB;MAAA,GAAMyC;IAAK,CAAI,CAAC;EAClD;EACA,OAAO,IAAArB,MAAA,CAAAC,aAAA,EAACmB,0BAA0B;IAAA,GAAMC;EAAK,CAAI,CAAC;AACnD;AAAC,IAAAQ,QAAA,GAEcJ,oBAAoB;AAAAK,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = useMultipleOriginColorsAndGradients;
8
7
  var _element = require("@wordpress/element");
9
8
  var _i18n = require("@wordpress/i18n");
10
- var _useSetting = _interopRequireDefault(require("../use-setting"));
9
+ var _useSettings = require("../use-settings");
11
10
  /**
12
11
  * WordPress dependencies
13
12
  */
@@ -25,14 +24,11 @@ var _useSetting = _interopRequireDefault(require("../use-setting"));
25
24
  * @return {Object} Color and gradient related settings.
26
25
  */
27
26
  function useMultipleOriginColorsAndGradients() {
27
+ const [enableCustomColors, customColors, themeColors, defaultColors, shouldDisplayDefaultColors, enableCustomGradients, customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients] = (0, _useSettings.useSettings)('color.custom', 'color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.customGradient', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients');
28
28
  const colorGradientSettings = {
29
- disableCustomColors: !(0, _useSetting.default)('color.custom'),
30
- disableCustomGradients: !(0, _useSetting.default)('color.customGradient')
29
+ disableCustomColors: !enableCustomColors,
30
+ disableCustomGradients: !enableCustomGradients
31
31
  };
32
- const customColors = (0, _useSetting.default)('color.palette.custom');
33
- const themeColors = (0, _useSetting.default)('color.palette.theme');
34
- const defaultColors = (0, _useSetting.default)('color.palette.default');
35
- const shouldDisplayDefaultColors = (0, _useSetting.default)('color.defaultPalette');
36
32
  colorGradientSettings.colors = (0, _element.useMemo)(() => {
37
33
  const result = [];
38
34
  if (themeColors && themeColors.length) {
@@ -54,11 +50,7 @@ function useMultipleOriginColorsAndGradients() {
54
50
  });
55
51
  }
56
52
  return result;
57
- }, [defaultColors, themeColors, customColors, shouldDisplayDefaultColors]);
58
- const customGradients = (0, _useSetting.default)('color.gradients.custom');
59
- const themeGradients = (0, _useSetting.default)('color.gradients.theme');
60
- const defaultGradients = (0, _useSetting.default)('color.gradients.default');
61
- const shouldDisplayDefaultGradients = (0, _useSetting.default)('color.defaultGradients');
53
+ }, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]);
62
54
  colorGradientSettings.gradients = (0, _element.useMemo)(() => {
63
55
  const result = [];
64
56
  if (themeGradients && themeGradients.length) {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_i18n","_useSetting","_interopRequireDefault","useMultipleOriginColorsAndGradients","colorGradientSettings","disableCustomColors","useSetting","disableCustomGradients","customColors","themeColors","defaultColors","shouldDisplayDefaultColors","colors","useMemo","result","length","push","name","_x","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients","gradients","hasColorsOrGradients"],"sources":["@wordpress/block-editor/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../use-setting';\n\n/**\n * Retrieves color and gradient related settings.\n *\n * The arrays for colors and gradients are made up of color palettes from each\n * origin i.e. \"Core\", \"Theme\", and \"User\".\n *\n * @return {Object} Color and gradient related settings.\n */\nexport default function useMultipleOriginColorsAndGradients() {\n\tconst colorGradientSettings = {\n\t\tdisableCustomColors: ! useSetting( 'color.custom' ),\n\t\tdisableCustomGradients: ! useSetting( 'color.customGradient' ),\n\t};\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst shouldDisplayDefaultColors = useSetting( 'color.defaultPalette' );\n\n\tcolorGradientSettings.colors = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tdefaultColors,\n\t\tthemeColors,\n\t\tcustomColors,\n\t\tshouldDisplayDefaultColors,\n\t] );\n\n\tconst customGradients = useSetting( 'color.gradients.custom' );\n\tconst themeGradients = useSetting( 'color.gradients.theme' );\n\tconst defaultGradients = useSetting( 'color.gradients.default' );\n\tconst shouldDisplayDefaultGradients = useSetting(\n\t\t'color.defaultGradients'\n\t);\n\tcolorGradientSettings.gradients = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t\tshouldDisplayDefaultGradients,\n\t] );\n\n\tcolorGradientSettings.hasColorsOrGradients =\n\t\t!! colorGradientSettings.colors.length ||\n\t\t!! colorGradientSettings.gradients.length;\n\n\treturn colorGradientSettings;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASI,mCAAmCA,CAAA,EAAG;EAC7D,MAAMC,qBAAqB,GAAG;IAC7BC,mBAAmB,EAAE,CAAE,IAAAC,mBAAU,EAAE,cAAe,CAAC;IACnDC,sBAAsB,EAAE,CAAE,IAAAD,mBAAU,EAAE,sBAAuB;EAC9D,CAAC;EACD,MAAME,YAAY,GAAG,IAAAF,mBAAU,EAAE,sBAAuB,CAAC;EACzD,MAAMG,WAAW,GAAG,IAAAH,mBAAU,EAAE,qBAAsB,CAAC;EACvD,MAAMI,aAAa,GAAG,IAAAJ,mBAAU,EAAE,uBAAwB,CAAC;EAC3D,MAAMK,0BAA0B,GAAG,IAAAL,mBAAU,EAAE,sBAAuB,CAAC;EAEvEF,qBAAqB,CAACQ,MAAM,GAAG,IAAAC,gB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IACJ;IACA,IACCE,6BAA6B,IAC7BD,gBAAgB,IAChBA,gBAAgB,CAACN,MAAM,EACtB;MACDD,MAAM,CAACE,IAAI,CAAE;QACZC,IAAI,EAAE,IAAAC,QAAE,EACP,SAAS,EACT,8CACD,CAAC;QACDK,SAAS,EAAEF;MACZ,CAAE,CAAC;IACJ;IACA,IAAKF,eAAe,IAAIA,eAAe,CAACJ,MAAM,EAAG;MAChDD,MAAM,CAACE,IAAI,CAAE;QACZC,IAAI,EAAE,IAAAC,QAAE,EACP,QAAQ,EACR,gDACD,CAAC;QACDK,SAAS,EAAEJ;MACZ,CAAE,CAAC;IACJ;IACA,OAAOL,MAAM;EACd,CAAC,EAAE,CACFK,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,6BAA6B,CAC5B,CAAC;EAEHlB,qBAAqB,CAACoB,oBAAoB,GACzC,CAAC,CAAEpB,qBAAqB,CAACQ,MAAM,CAACG,MAAM,IACtC,CAAC,CAAEX,qBAAqB,CAACmB,SAAS,CAACR,MAAM;EAE1C,OAAOX,qBAAqB;AAC7B"}
1
+ {"version":3,"names":["_element","require","_i18n","_useSettings","useMultipleOriginColorsAndGradients","enableCustomColors","customColors","themeColors","defaultColors","shouldDisplayDefaultColors","enableCustomGradients","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients","useSettings","colorGradientSettings","disableCustomColors","disableCustomGradients","colors","useMemo","result","length","push","name","_x","gradients","hasColorsOrGradients"],"sources":["@wordpress/block-editor/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\n/**\n * Retrieves color and gradient related settings.\n *\n * The arrays for colors and gradients are made up of color palettes from each\n * origin i.e. \"Core\", \"Theme\", and \"User\".\n *\n * @return {Object} Color and gradient related settings.\n */\nexport default function useMultipleOriginColorsAndGradients() {\n\tconst [\n\t\tenableCustomColors,\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tshouldDisplayDefaultColors,\n\t\tenableCustomGradients,\n\t\tcustomGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t\tshouldDisplayDefaultGradients,\n\t] = useSettings(\n\t\t'color.custom',\n\t\t'color.palette.custom',\n\t\t'color.palette.theme',\n\t\t'color.palette.default',\n\t\t'color.defaultPalette',\n\t\t'color.customGradient',\n\t\t'color.gradients.custom',\n\t\t'color.gradients.theme',\n\t\t'color.gradients.default',\n\t\t'color.defaultGradients'\n\t);\n\n\tconst colorGradientSettings = {\n\t\tdisableCustomColors: ! enableCustomColors,\n\t\tdisableCustomGradients: ! enableCustomGradients,\n\t};\n\n\tcolorGradientSettings.colors = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tshouldDisplayDefaultColors,\n\t] );\n\n\tcolorGradientSettings.gradients = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t\tshouldDisplayDefaultGradients,\n\t] );\n\n\tcolorGradientSettings.hasColorsOrGradients =\n\t\t!! colorGradientSettings.colors.length ||\n\t\t!! colorGradientSettings.gradients.length;\n\n\treturn colorGradientSettings;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,mCAAmCA,CAAA,EAAG;EAC7D,MAAM,CACLC,kBAAkB,EAClBC,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,0BAA0B,EAC1BC,qBAAqB,EACrBC,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,6BAA6B,CAC7B,GAAG,IAAAC,wBAAW,EACd,cAAc,EACd,sBAAsB,E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MACZ,CAAE,CAAC;IACJ;IACA,IACCE,6BAA6B,IAC7BD,gBAAgB,IAChBA,gBAAgB,CAACS,MAAM,EACtB;MACDD,MAAM,CAACE,IAAI,CAAE;QACZC,IAAI,EAAE,IAAAC,QAAE,EACP,SAAS,EACT,8CACD,CAAC;QACDC,SAAS,EAAEb;MACZ,CAAE,CAAC;IACJ;IACA,IAAKF,eAAe,IAAIA,eAAe,CAACW,MAAM,EAAG;MAChDD,MAAM,CAACE,IAAI,CAAE;QACZC,IAAI,EAAE,IAAAC,QAAE,EACP,QAAQ,EACR,gDACD,CAAC;QACDC,SAAS,EAAEf;MACZ,CAAE,CAAC;IACJ;IACA,OAAOU,MAAM;EACd,CAAC,EAAE,CACFV,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,6BAA6B,CAC5B,CAAC;EAEHE,qBAAqB,CAACW,oBAAoB,GACzC,CAAC,CAAEX,qBAAqB,CAACG,MAAM,CAACG,MAAM,IACtC,CAAC,CAAEN,qBAAqB,CAACU,SAAS,CAACJ,MAAM;EAE1C,OAAON,qBAAqB;AAC7B"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -8,7 +7,7 @@ exports.default = FontFamilyControl;
8
7
  var _react = require("react");
9
8
  var _components = require("@wordpress/components");
10
9
  var _i18n = require("@wordpress/i18n");
11
- var _useSetting = _interopRequireDefault(require("../use-setting"));
10
+ var _useSettings = require("../use-settings");
12
11
  /**
13
12
  * WordPress dependencies
14
13
  */
@@ -23,7 +22,7 @@ function FontFamilyControl({
23
22
  fontFamilies,
24
23
  ...props
25
24
  }) {
26
- const blockLevelFontFamilies = (0, _useSetting.default)('typography.fontFamilies');
25
+ const [blockLevelFontFamilies] = (0, _useSettings.useSettings)('typography.fontFamilies');
27
26
  if (!fontFamilies) {
28
27
  fontFamilies = blockLevelFontFamilies;
29
28
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_useSetting","_interopRequireDefault","FontFamilyControl","value","onChange","fontFamilies","props","blockLevelFontFamilies","useSetting","length","options","label","__","map","fontFamily","name","_react","createElement","SelectControl","labelPosition"],"sources":["@wordpress/block-editor/src/components/font-family/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../use-setting';\n\nexport default function FontFamilyControl( {\n\tvalue = '',\n\tonChange,\n\tfontFamilies,\n\t...props\n} ) {\n\tconst blockLevelFontFamilies = useSetting( 'typography.fontFamilies' );\n\tif ( ! fontFamilies ) {\n\t\tfontFamilies = blockLevelFontFamilies;\n\t}\n\n\tif ( ! fontFamilies || fontFamilies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst options = [\n\t\t{ value: '', label: __( 'Default' ) },\n\t\t...fontFamilies.map( ( { fontFamily, name } ) => {\n\t\t\treturn {\n\t\t\t\tvalue: fontFamily,\n\t\t\t\tlabel: name || fontFamily,\n\t\t\t};\n\t\t} ),\n\t];\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Font' ) }\n\t\t\toptions={ options }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASI,iBAAiBA,CAAE;EAC1CC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,sBAAsB,GAAG,IAAAC,mBAAU,EAAE,yBAA0B,CAAC;EACtE,IAAK,CAAEH,YAAY,EAAG;IACrBA,YAAY,GAAGE,sBAAsB;EACtC;EAEA,IAAK,CAAEF,YAAY,IAAIA,YAAY,CAACI,MAAM,KAAK,CAAC,EAAG;IAClD,OAAO,IAAI;EACZ;EAEA,MAAMC,OAAO,GAAG,CACf;IAAEP,KAAK,EAAE,EAAE;IAAEQ,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU;EAAE,CAAC,EACrC,GAAGP,YAAY,CAACQ,GAAG,CAAE,CAAE;IAAEC,UAAU;IAAEC;EAAK,CAAC,KAAM;IAChD,OAAO;MACNZ,KAAK,EAAEW,UAAU;MACjBH,KAAK,EAAEI,IAAI,IAAID;IAChB,CAAC;EACF,CAAE,CAAC,CACH;EACD,OACC,IAAAE,MAAA,CAAAC,aAAA,EAACpB,WAAA,CAAAqB,aAAa;IACbP,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBF,OAAO,EAAGA,OAAS;IACnBP,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,QAAU;IACrBe,aAAa,EAAC,KAAK;IAAA,GACdb;EAAK,CACV,CAAC;AAEJ"}
1
+ {"version":3,"names":["_components","require","_i18n","_useSettings","FontFamilyControl","value","onChange","fontFamilies","props","blockLevelFontFamilies","useSettings","length","options","label","__","map","fontFamily","name","_react","createElement","SelectControl","labelPosition"],"sources":["@wordpress/block-editor/src/components/font-family/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default function FontFamilyControl( {\n\tvalue = '',\n\tonChange,\n\tfontFamilies,\n\t...props\n} ) {\n\tconst [ blockLevelFontFamilies ] = useSettings( 'typography.fontFamilies' );\n\tif ( ! fontFamilies ) {\n\t\tfontFamilies = blockLevelFontFamilies;\n\t}\n\n\tif ( ! fontFamilies || fontFamilies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst options = [\n\t\t{ value: '', label: __( 'Default' ) },\n\t\t...fontFamilies.map( ( { fontFamily, name } ) => {\n\t\t\treturn {\n\t\t\t\tvalue: fontFamily,\n\t\t\t\tlabel: name || fontFamily,\n\t\t\t};\n\t\t} ),\n\t];\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Font' ) }\n\t\t\toptions={ options }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASG,iBAAiBA,CAAE;EAC1CC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM,CAAEC,sBAAsB,CAAE,GAAG,IAAAC,wBAAW,EAAE,yBAA0B,CAAC;EAC3E,IAAK,CAAEH,YAAY,EAAG;IACrBA,YAAY,GAAGE,sBAAsB;EACtC;EAEA,IAAK,CAAEF,YAAY,IAAIA,YAAY,CAACI,MAAM,KAAK,CAAC,EAAG;IAClD,OAAO,IAAI;EACZ;EAEA,MAAMC,OAAO,GAAG,CACf;IAAEP,KAAK,EAAE,EAAE;IAAEQ,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU;EAAE,CAAC,EACrC,GAAGP,YAAY,CAACQ,GAAG,CAAE,CAAE;IAAEC,UAAU;IAAEC;EAAK,CAAC,KAAM;IAChD,OAAO;MACNZ,KAAK,EAAEW,UAAU;MACjBH,KAAK,EAAEI,IAAI,IAAID;IAChB,CAAC;EACF,CAAE,CAAC,CACH;EACD,OACC,IAAAE,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAoB,aAAa;IACbP,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBF,OAAO,EAAGA,OAAS;IACnBP,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,QAAU;IACrBe,aAAa,EAAC,KAAK;IAAA,GACdb;EAAK,CACV,CAAC;AAEJ"}
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = void 0;
8
7
  var _react = require("react");
9
8
  var _components = require("@wordpress/components");
10
- var _useSetting = _interopRequireDefault(require("../use-setting"));
9
+ var _useSettings = require("../use-settings");
11
10
  /**
12
11
  * WordPress dependencies
13
12
  */
@@ -17,12 +16,11 @@ var _useSetting = _interopRequireDefault(require("../use-setting"));
17
16
  */
18
17
 
19
18
  function FontSizePicker(props) {
20
- const fontSizes = (0, _useSetting.default)('typography.fontSizes');
21
- const disableCustomFontSizes = !(0, _useSetting.default)('typography.customFontSize');
19
+ const [fontSizes, customFontSize] = (0, _useSettings.useSettings)('typography.fontSizes', 'typography.customFontSize');
22
20
  return (0, _react.createElement)(_components.FontSizePicker, {
23
21
  ...props,
24
22
  fontSizes: fontSizes,
25
- disableCustomFontSizes: disableCustomFontSizes
23
+ disableCustomFontSizes: !customFontSize
26
24
  });
27
25
  }
28
26
 
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_useSetting","_interopRequireDefault","FontSizePicker","props","fontSizes","useSetting","disableCustomFontSizes","_react","createElement","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/font-sizes/font-size-picker.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FontSizePicker as BaseFontSizePicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../use-setting';\n\nfunction FontSizePicker( props ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst disableCustomFontSizes = ! useSetting( 'typography.customFontSize' );\n\n\treturn (\n\t\t<BaseFontSizePicker\n\t\t\t{ ...props }\n\t\t\tfontSizes={ fontSizes }\n\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t/>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/font-sizes/README.md\n */\nexport default FontSizePicker;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,SAASG,cAAcA,CAAEC,KAAK,EAAG;EAChC,MAAMC,SAAS,GAAG,IAAAC,mBAAU,EAAE,sBAAuB,CAAC;EACtD,MAAMC,sBAAsB,GAAG,CAAE,IAAAD,mBAAU,EAAE,2BAA4B,CAAC;EAE1E,OACC,IAAAE,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAI,cAAkB;IAAA,GACbC,KAAK;IACVC,SAAS,EAAGA,SAAW;IACvBE,sBAAsB,EAAGA;EAAwB,CACjD,CAAC;AAEJ;;AAEA;AACA;AACA;AAFA,IAAAG,QAAA,GAGeP,cAAc;AAAAQ,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_components","require","_useSettings","FontSizePicker","props","fontSizes","customFontSize","useSettings","_react","createElement","disableCustomFontSizes","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/font-sizes/font-size-picker.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FontSizePicker as BaseFontSizePicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nfunction FontSizePicker( props ) {\n\tconst [ fontSizes, customFontSize ] = useSettings(\n\t\t'typography.fontSizes',\n\t\t'typography.customFontSize'\n\t);\n\n\treturn (\n\t\t<BaseFontSizePicker\n\t\t\t{ ...props }\n\t\t\tfontSizes={ fontSizes }\n\t\t\tdisableCustomFontSizes={ ! customFontSize }\n\t\t/>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/font-sizes/README.md\n */\nexport default FontSizePicker;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,SAASE,cAAcA,CAAEC,KAAK,EAAG;EAChC,MAAM,CAAEC,SAAS,EAAEC,cAAc,CAAE,GAAG,IAAAC,wBAAW,EAChD,sBAAsB,EACtB,2BACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAG,cAAkB;IAAA,GACbC,KAAK;IACVC,SAAS,EAAGA,SAAW;IACvBK,sBAAsB,EAAG,CAAEJ;EAAgB,CAC3C,CAAC;AAEJ;;AAEA;AACA;AACA;AAFA,IAAAK,QAAA,GAGeR,cAAc;AAAAS,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -9,7 +8,7 @@ var _react = require("react");
9
8
  var _compose = require("@wordpress/compose");
10
9
  var _element = require("@wordpress/element");
11
10
  var _utils = require("./utils");
12
- var _useSetting = _interopRequireDefault(require("../use-setting"));
11
+ var _useSettings = require("../use-settings");
13
12
  /**
14
13
  * WordPress dependencies
15
14
  */
@@ -50,10 +49,10 @@ var _default = (...fontSizeNames) => {
50
49
  return fontSizeAttributeNamesAccumulator;
51
50
  }, {});
52
51
  return (0, _compose.createHigherOrderComponent)((0, _compose.compose)([(0, _compose.createHigherOrderComponent)(WrappedComponent => props => {
53
- const fontSizes = (0, _useSetting.default)('typography.fontSizes') || DEFAULT_FONT_SIZES;
52
+ const [fontSizes] = (0, _useSettings.useSettings)('typography.fontSizes');
54
53
  return (0, _react.createElement)(WrappedComponent, {
55
54
  ...props,
56
- fontSizes: fontSizes
55
+ fontSizes: fontSizes || DEFAULT_FONT_SIZES
57
56
  });
58
57
  }, 'withFontSizes'), WrappedComponent => {
59
58
  return class extends _element.Component {
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_element","_utils","_useSetting","_interopRequireDefault","DEFAULT_FONT_SIZES","upperFirst","firstLetter","rest","toUpperCase","join","_default","fontSizeNames","fontSizeAttributeNames","reduce","fontSizeAttributeNamesAccumulator","fontSizeAttributeName","createHigherOrderComponent","compose","WrappedComponent","props","fontSizes","useSetting","_react","createElement","Component","constructor","setters","createSetters","state","Object","entries","settersAccumulator","customFontSizeAttributeName","upperFirstFontSizeAttributeName","createSetFontSize","fontSizeValue","fontSizeObject","find","size","Number","setAttributes","slug","undefined","getDerivedStateFromProps","attributes","previousState","didAttributesChange","values","some","newState","filter","key","value","newStateAccumulator","fontSizeAttributeValue","getFontSize","class","getFontSizeClass","render","exports","default"],"sources":["@wordpress/block-editor/src/components/font-sizes/with-font-sizes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, compose } from '@wordpress/compose';\nimport { Component } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getFontSize, getFontSizeClass } from './utils';\nimport useSetting from '../use-setting';\n\nconst DEFAULT_FONT_SIZES = [];\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param {string} str The string whose first letter the function will capitalize.\n *\n * @return {string} Capitalized string.\n */\nconst upperFirst = ( [ firstLetter, ...rest ] ) =>\n\tfirstLetter.toUpperCase() + rest.join( '' );\n\n/**\n * Higher-order component, which handles font size logic for class generation,\n * font size value retrieval, and font size change handling.\n *\n * @param {...(Object|string)} fontSizeNames The arguments should all be strings.\n * Each string contains the font size\n * attribute name e.g: 'fontSize'.\n *\n * @return {Function} Higher-order component.\n */\nexport default ( ...fontSizeNames ) => {\n\t/*\n\t * Computes an object whose key is the font size attribute name as passed in the array,\n\t * and the value is the custom font size attribute name.\n\t * Custom font size is automatically compted by appending custom followed by the font size attribute name in with the first letter capitalized.\n\t */\n\tconst fontSizeAttributeNames = fontSizeNames.reduce(\n\t\t( fontSizeAttributeNamesAccumulator, fontSizeAttributeName ) => {\n\t\t\tfontSizeAttributeNamesAccumulator[\n\t\t\t\tfontSizeAttributeName\n\t\t\t] = `custom${ upperFirst( fontSizeAttributeName ) }`;\n\t\t\treturn fontSizeAttributeNamesAccumulator;\n\t\t},\n\t\t{}\n\t);\n\n\treturn createHigherOrderComponent(\n\t\tcompose( [\n\t\t\tcreateHigherOrderComponent(\n\t\t\t\t( WrappedComponent ) => ( props ) => {\n\t\t\t\t\tconst fontSizes =\n\t\t\t\t\t\tuseSetting( 'typography.fontSizes' ) ||\n\t\t\t\t\t\tDEFAULT_FONT_SIZES;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t'withFontSizes'\n\t\t\t),\n\t\t\t( WrappedComponent ) => {\n\t\t\t\treturn class extends Component {\n\t\t\t\t\tconstructor( props ) {\n\t\t\t\t\t\tsuper( props );\n\n\t\t\t\t\t\tthis.setters = this.createSetters();\n\n\t\t\t\t\t\tthis.state = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSetters() {\n\t\t\t\t\t\treturn Object.entries( fontSizeAttributeNames ).reduce(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tsettersAccumulator,\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst upperFirstFontSizeAttributeName =\n\t\t\t\t\t\t\t\t\tupperFirst( fontSizeAttributeName );\n\t\t\t\t\t\t\t\tsettersAccumulator[\n\t\t\t\t\t\t\t\t\t`set${ upperFirstFontSizeAttributeName }`\n\t\t\t\t\t\t\t\t] = this.createSetFontSize(\n\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn settersAccumulator;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSetFontSize(\n\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn ( fontSizeValue ) => {\n\t\t\t\t\t\t\tconst fontSizeObject = this.props.fontSizes?.find(\n\t\t\t\t\t\t\t\t( { size } ) => size === Number( fontSizeValue )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthis.props.setAttributes( {\n\t\t\t\t\t\t\t\t[ fontSizeAttributeName ]:\n\t\t\t\t\t\t\t\t\tfontSizeObject && fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t? fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t[ customFontSizeAttributeName ]:\n\t\t\t\t\t\t\t\t\tfontSizeObject && fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: fontSizeValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tstatic getDerivedStateFromProps(\n\t\t\t\t\t\t{ attributes, fontSizes },\n\t\t\t\t\t\tpreviousState\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst didAttributesChange = (\n\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\tfontSizeAttributeName\n\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\tif ( previousState[ fontSizeAttributeName ] ) {\n\t\t\t\t\t\t\t\t// If new font size is name compare with the previous slug.\n\t\t\t\t\t\t\t\tif ( attributes[ fontSizeAttributeName ] ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\tattributes[ fontSizeAttributeName ] !==\n\t\t\t\t\t\t\t\t\t\tpreviousState[ fontSizeAttributeName ]\n\t\t\t\t\t\t\t\t\t\t\t.slug\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// If font size is not named, update when the font size value changes.\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpreviousState[ fontSizeAttributeName ]\n\t\t\t\t\t\t\t\t\t\t.size !==\n\t\t\t\t\t\t\t\t\tattributes[ customFontSizeAttributeName ]\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// In this case we need to build the font size object.\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! Object.values( fontSizeAttributeNames ).some(\n\t\t\t\t\t\t\t\tdidAttributesChange\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newState = Object.entries(\n\t\t\t\t\t\t\tfontSizeAttributeNames\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( [ key, value ] ) =>\n\t\t\t\t\t\t\t\tdidAttributesChange( value, key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.reduce(\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\tnewStateAccumulator,\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\tconst fontSizeAttributeValue =\n\t\t\t\t\t\t\t\t\t\tattributes[ fontSizeAttributeName ];\n\t\t\t\t\t\t\t\t\tconst fontSizeObject = getFontSize(\n\t\t\t\t\t\t\t\t\t\tfontSizes,\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeValue,\n\t\t\t\t\t\t\t\t\t\tattributes[\n\t\t\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tnewStateAccumulator[\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeName\n\t\t\t\t\t\t\t\t\t] = {\n\t\t\t\t\t\t\t\t\t\t...fontSizeObject,\n\t\t\t\t\t\t\t\t\t\tclass: getFontSizeClass(\n\t\t\t\t\t\t\t\t\t\t\tfontSizeAttributeValue\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn newStateAccumulator;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...previousState,\n\t\t\t\t\t\t\t...newState,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\trender() {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\t...this.props,\n\t\t\t\t\t\t\t\t\tfontSizes: undefined,\n\t\t\t\t\t\t\t\t\t...this.state,\n\t\t\t\t\t\t\t\t\t...this.setters,\n\t\t\t\t\t\t\t\t} }\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};\n\t\t\t},\n\t\t] ),\n\t\t'withFontSizes'\n\t);\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,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AAAAiC,OAAA,CAAAC,OAAA,GAAAlD,QAAA"}
1
+ {"version":3,"names":["_compose","require","_element","_utils","_useSettings","DEFAULT_FONT_SIZES","upperFirst","firstLetter","rest","toUpperCase","join","_default","fontSizeNames","fontSizeAttributeNames","reduce","fontSizeAttributeNamesAccumulator","fontSizeAttributeName","createHigherOrderComponent","compose","WrappedComponent","props","fontSizes","useSettings","_react","createElement","Component","constructor","setters","createSetters","state","Object","entries","settersAccumulator","customFontSizeAttributeName","upperFirstFontSizeAttributeName","createSetFontSize","fontSizeValue","fontSizeObject","find","size","Number","setAttributes","slug","undefined","getDerivedStateFromProps","attributes","previousState","didAttributesChange","values","some","newState","filter","key","value","newStateAccumulator","fontSizeAttributeValue","getFontSize","class","getFontSizeClass","render","exports","default"],"sources":["@wordpress/block-editor/src/components/font-sizes/with-font-sizes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, compose } from '@wordpress/compose';\nimport { Component } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getFontSize, getFontSizeClass } from './utils';\nimport { useSettings } from '../use-settings';\n\nconst DEFAULT_FONT_SIZES = [];\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param {string} str The string whose first letter the function will capitalize.\n *\n * @return {string} Capitalized string.\n */\nconst upperFirst = ( [ firstLetter, ...rest ] ) =>\n\tfirstLetter.toUpperCase() + rest.join( '' );\n\n/**\n * Higher-order component, which handles font size logic for class generation,\n * font size value retrieval, and font size change handling.\n *\n * @param {...(Object|string)} fontSizeNames The arguments should all be strings.\n * Each string contains the font size\n * attribute name e.g: 'fontSize'.\n *\n * @return {Function} Higher-order component.\n */\nexport default ( ...fontSizeNames ) => {\n\t/*\n\t * Computes an object whose key is the font size attribute name as passed in the array,\n\t * and the value is the custom font size attribute name.\n\t * Custom font size is automatically compted by appending custom followed by the font size attribute name in with the first letter capitalized.\n\t */\n\tconst fontSizeAttributeNames = fontSizeNames.reduce(\n\t\t( fontSizeAttributeNamesAccumulator, fontSizeAttributeName ) => {\n\t\t\tfontSizeAttributeNamesAccumulator[\n\t\t\t\tfontSizeAttributeName\n\t\t\t] = `custom${ upperFirst( fontSizeAttributeName ) }`;\n\t\t\treturn fontSizeAttributeNamesAccumulator;\n\t\t},\n\t\t{}\n\t);\n\n\treturn createHigherOrderComponent(\n\t\tcompose( [\n\t\t\tcreateHigherOrderComponent(\n\t\t\t\t( WrappedComponent ) => ( props ) => {\n\t\t\t\t\tconst [ fontSizes ] = useSettings( 'typography.fontSizes' );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\tfontSizes={ fontSizes || DEFAULT_FONT_SIZES }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t'withFontSizes'\n\t\t\t),\n\t\t\t( WrappedComponent ) => {\n\t\t\t\treturn class extends Component {\n\t\t\t\t\tconstructor( props ) {\n\t\t\t\t\t\tsuper( props );\n\n\t\t\t\t\t\tthis.setters = this.createSetters();\n\n\t\t\t\t\t\tthis.state = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSetters() {\n\t\t\t\t\t\treturn Object.entries( fontSizeAttributeNames ).reduce(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tsettersAccumulator,\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst upperFirstFontSizeAttributeName =\n\t\t\t\t\t\t\t\t\tupperFirst( fontSizeAttributeName );\n\t\t\t\t\t\t\t\tsettersAccumulator[\n\t\t\t\t\t\t\t\t\t`set${ upperFirstFontSizeAttributeName }`\n\t\t\t\t\t\t\t\t] = this.createSetFontSize(\n\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn settersAccumulator;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSetFontSize(\n\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn ( fontSizeValue ) => {\n\t\t\t\t\t\t\tconst fontSizeObject = this.props.fontSizes?.find(\n\t\t\t\t\t\t\t\t( { size } ) => size === Number( fontSizeValue )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthis.props.setAttributes( {\n\t\t\t\t\t\t\t\t[ fontSizeAttributeName ]:\n\t\t\t\t\t\t\t\t\tfontSizeObject && fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t? fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t[ customFontSizeAttributeName ]:\n\t\t\t\t\t\t\t\t\tfontSizeObject && fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: fontSizeValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tstatic getDerivedStateFromProps(\n\t\t\t\t\t\t{ attributes, fontSizes },\n\t\t\t\t\t\tpreviousState\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst didAttributesChange = (\n\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\tfontSizeAttributeName\n\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\tif ( previousState[ fontSizeAttributeName ] ) {\n\t\t\t\t\t\t\t\t// If new font size is name compare with the previous slug.\n\t\t\t\t\t\t\t\tif ( attributes[ fontSizeAttributeName ] ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\tattributes[ fontSizeAttributeName ] !==\n\t\t\t\t\t\t\t\t\t\tpreviousState[ fontSizeAttributeName ]\n\t\t\t\t\t\t\t\t\t\t\t.slug\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// If font size is not named, update when the font size value changes.\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpreviousState[ fontSizeAttributeName ]\n\t\t\t\t\t\t\t\t\t\t.size !==\n\t\t\t\t\t\t\t\t\tattributes[ customFontSizeAttributeName ]\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// In this case we need to build the font size object.\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! Object.values( fontSizeAttributeNames ).some(\n\t\t\t\t\t\t\t\tdidAttributesChange\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newState = Object.entries(\n\t\t\t\t\t\t\tfontSizeAttributeNames\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( [ key, value ] ) =>\n\t\t\t\t\t\t\t\tdidAttributesChange( value, key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.reduce(\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\tnewStateAccumulator,\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\tconst fontSizeAttributeValue =\n\t\t\t\t\t\t\t\t\t\tattributes[ fontSizeAttributeName ];\n\t\t\t\t\t\t\t\t\tconst fontSizeObject = getFontSize(\n\t\t\t\t\t\t\t\t\t\tfontSizes,\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeValue,\n\t\t\t\t\t\t\t\t\t\tattributes[\n\t\t\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tnewStateAccumulator[\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeName\n\t\t\t\t\t\t\t\t\t] = {\n\t\t\t\t\t\t\t\t\t\t...fontSizeObject,\n\t\t\t\t\t\t\t\t\t\tclass: getFontSizeClass(\n\t\t\t\t\t\t\t\t\t\t\tfontSizeAttributeValue\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn newStateAccumulator;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...previousState,\n\t\t\t\t\t\t\t...newState,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\trender() {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\t...this.props,\n\t\t\t\t\t\t\t\t\tfontSizes: undefined,\n\t\t\t\t\t\t\t\t\t...this.state,\n\t\t\t\t\t\t\t\t\t...this.setters,\n\t\t\t\t\t\t\t\t} }\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};\n\t\t\t},\n\t\t] ),\n\t\t'withFontSizes'\n\t);\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAMI,kBAAkB,GAAG,E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ACA,OAAO,IAAI;QACZ,CAAC;QAED,IACC,CAAEH,MAAM,CAACkB,MAAM,CAAEnC,sBAAuB,CAAC,CAACoC,IAAI,CAC7CF,mBACD,CAAC,EACA;UACD,OAAO,IAAI;QACZ;QAEA,MAAMG,QAAQ,GAAGpB,MAAM,CAACC,OAAO,CAC9BlB,sBACD,CAAC,CACCsC,MAAM,CAAE,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KACxBN,mBAAmB,CAAEM,KAAK,EAAED,GAAI,CACjC,CAAC,CACAtC,MAAM,CACN,CACCwC,mBAAmB,EACnB,CACCtC,qBAAqB,EACrBiB,2BAA2B,CAC3B,KACG;UACJ,MAAMsB,sBAAsB,GAC3BV,UAAU,CAAE7B,qBAAqB,CAAE;UACpC,MAAMqB,cAAc,GAAG,IAAAmB,kBAAW,EACjCnC,SAAS,EACTkC,sBAAsB,EACtBV,UAAU,CACTZ,2BAA2B,CAE7B,CAAC;UACDqB,mBAAmB,CAClBtC,qBAAqB,CACrB,GAAG;YACH,GAAGqB,cAAc;YACjBoB,KAAK,EAAE,IAAAC,uBAAgB,EACtBH,sBACD;UACD,CAAC;UACD,OAAOD,mBAAmB;QAC3B,CAAC,EACD,CAAC,CACF,CAAC;QAEF,OAAO;UACN,GAAGR,aAAa;UAChB,GAAGI;QACJ,CAAC;MACF;MAEAS,MAAMA,CAAA,EAAG;QACR,OACC,IAAApC,MAAA,CAAAC,aAAA,EAACL,gBAAgB;UAEf,GAAG,IAAI,CAACC,KAAK;UACbC,SAAS,EAAEsB,SAAS;UACpB,GAAG,IAAI,CAACd,KAAK;UACb,GAAG,IAAI,CAACF;QAAO,CAEhB,CAAC;MAEJ;IACD,CAAC;EACF,CAAC,CACA,CAAC,EACH,eACD,CAAC;AACF,CAAC;AAAAiC,OAAA,CAAAC,OAAA,GAAAlD,QAAA"}
@@ -37,11 +37,10 @@ function useMultiOriginColorPresets(settings, {
37
37
  return (0, _element.useMemo)(() => [...userPresets, ...themePresets, ...(disableDefault ? EMPTY_ARRAY : defaultPresets)], [disableDefault, userPresets, themePresets, defaultPresets]);
38
38
  }
39
39
  function useHasFiltersPanel(settings) {
40
- const hasDuotone = useHasDuotoneControl(settings);
41
- return hasDuotone;
40
+ return useHasDuotoneControl(settings);
42
41
  }
43
42
  function useHasDuotoneControl(settings) {
44
- return settings.color.customDuotone || settings.color.defaultDuotone;
43
+ return settings.color.customDuotone || settings.color.defaultDuotone || settings.color.duotone.length > 0;
45
44
  }
46
45
  function FiltersToolsPanel({
47
46
  resetAllFilter,
@@ -122,8 +121,6 @@ function FiltersPanel({
122
121
  };
123
122
  const hasDuotone = () => !!value?.filter?.duotone;
124
123
  const resetDuotone = () => setDuotone(undefined);
125
- const disableCustomColors = !settings?.color?.custom;
126
- const disableCustomDuotone = !settings?.color?.customDuotone || colorPalette?.length === 0 && disableCustomColors;
127
124
  const resetAllFilter = (0, _element.useCallback)(previousValue => {
128
125
  return {
129
126
  ...previousValue,
@@ -172,9 +169,11 @@ function FiltersPanel({
172
169
  paddingSize: "medium"
173
170
  }, (0, _react.createElement)(_components.__experimentalVStack, null, (0, _react.createElement)("p", null, (0, _i18n.__)('Create a two-tone color effect without losing your original image.')), (0, _react.createElement)(_components.DuotonePicker, {
174
171
  colorPalette: colorPalette,
175
- duotonePalette: duotonePalette,
176
- disableCustomColors: disableCustomColors,
177
- disableCustomDuotone: disableCustomDuotone,
172
+ duotonePalette: duotonePalette
173
+ // TODO: Re-enable both when custom colors are supported for block-level styles.
174
+ ,
175
+ disableCustomColors: true,
176
+ disableCustomDuotone: true,
178
177
  value: duotone,
179
178
  onChange: setDuotone
180
179
  })))
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_element","_utils","_object","EMPTY_ARRAY","useMultiOriginColorPresets","settings","presetSetting","defaultSetting","disableDefault","color","userPresets","custom","themePresets","theme","defaultPresets","default","useMemo","useHasFiltersPanel","hasDuotone","useHasDuotoneControl","customDuotone","defaultDuotone","FiltersToolsPanel","resetAllFilter","onChange","value","panelId","children","resetAll","updatedValue","_react","createElement","__experimentalToolsPanel","label","_x","DEFAULT_CONTROLS","duotone","popoverProps","placement","offset","shift","className","headerTitle","__","LabeledColorIndicator","indicator","__experimentalHStack","justify","__experimentalZStack","isLayered","Flex","expanded","ColorIndicator","DuotoneSwatch","values","FlexItem","title","FiltersPanel","as","Wrapper","inheritedValue","defaultControls","decodeValue","rawValue","getValueFromVariable","hasDuotoneEnabled","duotonePalette","colorPalette","filter","setDuotone","newValue","duotonePreset","find","colors","settedValue","slug","setImmutably","resetDuotone","undefined","disableCustomColors","disableCustomDuotone","length","useCallback","previousValue","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","Dropdown","renderToggle","onToggle","isOpen","toggleProps","onClick","classnames","__experimentalItemGroup","isBordered","isSeparated","Button","renderContent","__experimentalDropdownContentWrapper","paddingSize","__experimentalVStack","DuotonePicker"],"sources":["@wordpress/block-editor/src/components/global-styles/filters-panel.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalZStack as ZStack,\n\t__experimentalVStack as VStack,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n\tColorIndicator,\n\tDuotonePicker,\n\tDuotoneSwatch,\n\tDropdown,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nconst EMPTY_ARRAY = [];\nfunction useMultiOriginColorPresets(\n\tsettings,\n\t{ presetSetting, defaultSetting }\n) {\n\tconst disableDefault = ! settings?.color?.[ defaultSetting ];\n\tconst userPresets =\n\t\tsettings?.color?.[ presetSetting ]?.custom || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tsettings?.color?.[ presetSetting ]?.theme || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tsettings?.color?.[ presetSetting ]?.default || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function useHasFiltersPanel( settings ) {\n\tconst hasDuotone = useHasDuotoneControl( settings );\n\n\treturn hasDuotone;\n}\n\nfunction useHasDuotoneControl( settings ) {\n\treturn settings.color.customDuotone || settings.color.defaultDuotone;\n}\n\nfunction FiltersToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ _x( 'Filters', 'Name for applying graphical effects' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tduotone: true,\n};\n\nconst popoverProps = {\n\tplacement: 'left-start',\n\toffset: 36,\n\tshift: true,\n\tclassName: 'block-editor-duotone-control__popover',\n\theaderTitle: __( 'Duotone' ),\n};\n\nconst LabeledColorIndicator = ( { indicator, label } ) => (\n\t<HStack justify=\"flex-start\">\n\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t<Flex expanded={ false }>\n\t\t\t\t{ indicator === 'unset' || ! indicator ? (\n\t\t\t\t\t<ColorIndicator className=\"block-editor-duotone-control__unset-indicator\" />\n\t\t\t\t) : (\n\t\t\t\t\t<DuotoneSwatch values={ indicator } />\n\t\t\t\t) }\n\t\t\t</Flex>\n\t\t</ZStack>\n\t\t<FlexItem title={ label }>{ label }</FlexItem>\n\t</HStack>\n);\n\nexport default function FiltersPanel( {\n\tas: Wrapper = FiltersToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\n\t// Duotone\n\tconst hasDuotoneEnabled = useHasDuotoneControl( settings );\n\tconst duotonePalette = useMultiOriginColorPresets( settings, {\n\t\tpresetSetting: 'duotone',\n\t\tdefaultSetting: 'defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginColorPresets( settings, {\n\t\tpresetSetting: 'palette',\n\t\tdefaultSetting: 'defaultPalette',\n\t} );\n\tconst duotone = decodeValue( inheritedValue?.filter?.duotone );\n\tconst setDuotone = ( newValue ) => {\n\t\tconst duotonePreset = duotonePalette.find( ( { colors } ) => {\n\t\t\treturn colors === newValue;\n\t\t} );\n\t\tconst settedValue = duotonePreset\n\t\t\t? `var:preset|duotone|${ duotonePreset.slug }`\n\t\t\t: newValue;\n\t\tonChange( setImmutably( value, [ 'filter', 'duotone' ], settedValue ) );\n\t};\n\tconst hasDuotone = () => !! value?.filter?.duotone;\n\tconst resetDuotone = () => setDuotone( undefined );\n\n\tconst disableCustomColors = ! settings?.color?.custom;\n\tconst disableCustomDuotone =\n\t\t! settings?.color?.customDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tfilter: {\n\t\t\t\t...previousValue.filter,\n\t\t\t\tduotone: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ hasDuotoneEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Duotone' ) }\n\t\t\t\t\thasValue={ hasDuotone }\n\t\t\t\t\tonDeselect={ resetDuotone }\n\t\t\t\t\tisShownByDefault={ defaultControls.duotone }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\tclassName=\"block-editor-global-styles-filters-panel__dropdown\"\n\t\t\t\t\t\trenderToggle={ ( { onToggle, isOpen } ) => {\n\t\t\t\t\t\t\tconst toggleProps = {\n\t\t\t\t\t\t\t\tonClick: onToggle,\n\t\t\t\t\t\t\t\tclassName: classnames( { 'is-open': isOpen } ),\n\t\t\t\t\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t\t\t\t<Button { ...toggleProps }>\n\t\t\t\t\t\t\t\t\t\t<LabeledColorIndicator\n\t\t\t\t\t\t\t\t\t\t\tindicator={ duotone }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Duotone' ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Create a two-tone color effect without losing your original image.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<DuotonePicker\n\t\t\t\t\t\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\t\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\t\t\t\t\t\tdisableCustomColors={\n\t\t\t\t\t\t\t\t\t\t\tdisableCustomColors\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdisableCustomDuotone={\n\t\t\t\t\t\t\t\t\t\t\tdisableCustomDuotone\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tvalue={ duotone }\n\t\t\t\t\t\t\t\t\t\tonChange={ setDuotone }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAgBA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;;AAIA,MAAMM,WAAW,GAAG,EAAE;AACtB,SAASC,0BAA0BA,CAClCC,QAAQ,EACR;EAAEC,aAAa;EAAEC;AAAe,CAAC,EAChC;EACD,MAAMC,cAAc,GAAG,CAAEH,QAAQ,EAAEI,KAAK,GAAIF,cAAc,CAAE;EAC5D,MAAMG,WAAW,GAChBL,QAAQ,EAAEI,KAAK,GAAIH,aAAa,CAAE,EAAEK,MAAM,IAAIR,WAAW;EAC1D,MAAMS,YAAY,GACjBP,QAAQ,EAAEI,KAAK,GAAIH,aAAa,CAAE,EAAEO,KAAK,IAAIV,WAAW;EACzD,MAAMW,cAAc,GACnBT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EACH,oEACD,CACE,CAAC,EACJ,IAAAb,MAAA,CAAAC,aAAA,EAACjC,WAAA,CAAAyG,aAAa;MACbpC,YAAY,EAAGA,YAAc;MAC7BD,cAAc,EAAGA,cAAgB;MACjCa,mBAAmB,EAClBA,mBACA;MACDC,oBAAoB,EACnBA,oBACA;MACDvD,KAAK,EAAGW,OAAS;MACjBZ,QAAQ,EAAG6C;IAAY,CACvB,CACM,CACe;EACtB,CACH,CACc,CAET,CAAC;AAEZ"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_element","_utils","_object","EMPTY_ARRAY","useMultiOriginColorPresets","settings","presetSetting","defaultSetting","disableDefault","color","userPresets","custom","themePresets","theme","defaultPresets","default","useMemo","useHasFiltersPanel","useHasDuotoneControl","customDuotone","defaultDuotone","duotone","length","FiltersToolsPanel","resetAllFilter","onChange","value","panelId","children","resetAll","updatedValue","_react","createElement","__experimentalToolsPanel","label","_x","DEFAULT_CONTROLS","popoverProps","placement","offset","shift","className","headerTitle","__","LabeledColorIndicator","indicator","__experimentalHStack","justify","__experimentalZStack","isLayered","Flex","expanded","ColorIndicator","DuotoneSwatch","values","FlexItem","title","FiltersPanel","as","Wrapper","inheritedValue","defaultControls","decodeValue","rawValue","getValueFromVariable","hasDuotoneEnabled","duotonePalette","colorPalette","filter","setDuotone","newValue","duotonePreset","find","colors","settedValue","slug","setImmutably","hasDuotone","resetDuotone","undefined","useCallback","previousValue","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","Dropdown","renderToggle","onToggle","isOpen","toggleProps","onClick","classnames","__experimentalItemGroup","isBordered","isSeparated","Button","renderContent","__experimentalDropdownContentWrapper","paddingSize","__experimentalVStack","DuotonePicker","disableCustomColors","disableCustomDuotone"],"sources":["@wordpress/block-editor/src/components/global-styles/filters-panel.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalZStack as ZStack,\n\t__experimentalVStack as VStack,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n\tColorIndicator,\n\tDuotonePicker,\n\tDuotoneSwatch,\n\tDropdown,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nconst EMPTY_ARRAY = [];\nfunction useMultiOriginColorPresets(\n\tsettings,\n\t{ presetSetting, defaultSetting }\n) {\n\tconst disableDefault = ! settings?.color?.[ defaultSetting ];\n\tconst userPresets =\n\t\tsettings?.color?.[ presetSetting ]?.custom || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tsettings?.color?.[ presetSetting ]?.theme || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tsettings?.color?.[ presetSetting ]?.default || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function useHasFiltersPanel( settings ) {\n\treturn useHasDuotoneControl( settings );\n}\n\nfunction useHasDuotoneControl( settings ) {\n\treturn (\n\t\tsettings.color.customDuotone ||\n\t\tsettings.color.defaultDuotone ||\n\t\tsettings.color.duotone.length > 0\n\t);\n}\n\nfunction FiltersToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ _x( 'Filters', 'Name for applying graphical effects' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tduotone: true,\n};\n\nconst popoverProps = {\n\tplacement: 'left-start',\n\toffset: 36,\n\tshift: true,\n\tclassName: 'block-editor-duotone-control__popover',\n\theaderTitle: __( 'Duotone' ),\n};\n\nconst LabeledColorIndicator = ( { indicator, label } ) => (\n\t<HStack justify=\"flex-start\">\n\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t<Flex expanded={ false }>\n\t\t\t\t{ indicator === 'unset' || ! indicator ? (\n\t\t\t\t\t<ColorIndicator className=\"block-editor-duotone-control__unset-indicator\" />\n\t\t\t\t) : (\n\t\t\t\t\t<DuotoneSwatch values={ indicator } />\n\t\t\t\t) }\n\t\t\t</Flex>\n\t\t</ZStack>\n\t\t<FlexItem title={ label }>{ label }</FlexItem>\n\t</HStack>\n);\n\nexport default function FiltersPanel( {\n\tas: Wrapper = FiltersToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\n\t// Duotone\n\tconst hasDuotoneEnabled = useHasDuotoneControl( settings );\n\tconst duotonePalette = useMultiOriginColorPresets( settings, {\n\t\tpresetSetting: 'duotone',\n\t\tdefaultSetting: 'defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginColorPresets( settings, {\n\t\tpresetSetting: 'palette',\n\t\tdefaultSetting: 'defaultPalette',\n\t} );\n\tconst duotone = decodeValue( inheritedValue?.filter?.duotone );\n\tconst setDuotone = ( newValue ) => {\n\t\tconst duotonePreset = duotonePalette.find( ( { colors } ) => {\n\t\t\treturn colors === newValue;\n\t\t} );\n\t\tconst settedValue = duotonePreset\n\t\t\t? `var:preset|duotone|${ duotonePreset.slug }`\n\t\t\t: newValue;\n\t\tonChange( setImmutably( value, [ 'filter', 'duotone' ], settedValue ) );\n\t};\n\tconst hasDuotone = () => !! value?.filter?.duotone;\n\tconst resetDuotone = () => setDuotone( undefined );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tfilter: {\n\t\t\t\t...previousValue.filter,\n\t\t\t\tduotone: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ hasDuotoneEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Duotone' ) }\n\t\t\t\t\thasValue={ hasDuotone }\n\t\t\t\t\tonDeselect={ resetDuotone }\n\t\t\t\t\tisShownByDefault={ defaultControls.duotone }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\tclassName=\"block-editor-global-styles-filters-panel__dropdown\"\n\t\t\t\t\t\trenderToggle={ ( { onToggle, isOpen } ) => {\n\t\t\t\t\t\t\tconst toggleProps = {\n\t\t\t\t\t\t\t\tonClick: onToggle,\n\t\t\t\t\t\t\t\tclassName: classnames( { 'is-open': isOpen } ),\n\t\t\t\t\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t\t\t\t<Button { ...toggleProps }>\n\t\t\t\t\t\t\t\t\t\t<LabeledColorIndicator\n\t\t\t\t\t\t\t\t\t\t\tindicator={ duotone }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Duotone' ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Create a two-tone color effect without losing your original image.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<DuotonePicker\n\t\t\t\t\t\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\t\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\t\t\t\t\t\t// TODO: Re-enable both when custom colors are supported for block-level styles.\n\t\t\t\t\t\t\t\t\t\tdisableCustomColors\n\t\t\t\t\t\t\t\t\t\tdisableCustomDuotone\n\t\t\t\t\t\t\t\t\t\tvalue={ duotone }\n\t\t\t\t\t\t\t\t\t\tonChange={ setDuotone }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAgBA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;;AAIA,MAAMM,WAAW,GAAG,EAAE;AACtB,SAASC,0BAA0BA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,aAAA,EAAClC,WAAA,CAAAoG,oCAAsB;MAACC,WAAW,EAAC;IAAQ,GAC3C,IAAApE,MAAA,CAAAC,aAAA,EAAClC,WAAA,CAAAsG,oBAAM,QACN,IAAArE,MAAA,CAAAC,aAAA,aACG,IAAAW,QAAE,EACH,oEACD,CACE,CAAC,EACJ,IAAAZ,MAAA,CAAAC,aAAA,EAAClC,WAAA,CAAAuG,aAAa;MACblC,YAAY,EAAGA,YAAc;MAC7BD,cAAc,EAAGA;MACjB;MAAA;MACAoC,mBAAmB;MACnBC,oBAAoB;MACpB7E,KAAK,EAAGL,OAAS;MACjBI,QAAQ,EAAG4C;IAAY,CACvB,CACM,CACe;EACtB,CACH,CACc,CAET,CAAC;AAEZ"}
@@ -48,12 +48,12 @@ function ImageSettingsPanel({
48
48
  // Global Styles.
49
49
  , {
50
50
  hasValue: () => !!value?.lightbox,
51
- label: (0, _i18n.__)('Expand on Click'),
51
+ label: (0, _i18n.__)('Expand on click'),
52
52
  onDeselect: resetLightbox,
53
53
  isShownByDefault: true,
54
54
  panelId: panelId
55
55
  }, (0, _react.createElement)(_components.ToggleControl, {
56
- label: (0, _i18n.__)('Expand on Click'),
56
+ label: (0, _i18n.__)('Expand on click'),
57
57
  checked: lightboxChecked,
58
58
  onChange: onChangeLightbox
59
59
  }))));