@wordpress/block-editor 8.0.4 → 8.0.8

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 (81) hide show
  1. package/build/components/block-preview/auto.js +1 -0
  2. package/build/components/block-preview/auto.js.map +1 -1
  3. package/build/components/block-tools/block-selection-button.js +7 -1
  4. package/build/components/block-tools/block-selection-button.js.map +1 -1
  5. package/build/components/colors/with-colors.js +9 -4
  6. package/build/components/colors/with-colors.js.map +1 -1
  7. package/build/components/colors-gradients/control.js +6 -2
  8. package/build/components/colors-gradients/control.js.map +1 -1
  9. package/build/components/colors-gradients/panel-color-gradient-settings.js +11 -70
  10. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  11. package/build/components/colors-gradients/use-common-single-multiple-selects.js +21 -0
  12. package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +1 -0
  13. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +98 -0
  14. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -0
  15. package/build/components/gradients/use-gradient.js +7 -6
  16. package/build/components/gradients/use-gradient.js.map +1 -1
  17. package/build/components/use-setting/index.js +1 -1
  18. package/build/components/use-setting/index.js.map +1 -1
  19. package/build/hooks/border-color.js +12 -12
  20. package/build/hooks/border-color.js.map +1 -1
  21. package/build/hooks/color-panel.js +2 -1
  22. package/build/hooks/color-panel.js.map +1 -1
  23. package/build/hooks/color.js +45 -23
  24. package/build/hooks/color.js.map +1 -1
  25. package/build/hooks/typography.js +3 -0
  26. package/build/hooks/typography.js.map +1 -1
  27. package/build/hooks/use-color-props.js +19 -6
  28. package/build/hooks/use-color-props.js.map +1 -1
  29. package/build/store/selectors.js +37 -43
  30. package/build/store/selectors.js.map +1 -1
  31. package/build-module/components/block-preview/auto.js +1 -0
  32. package/build-module/components/block-preview/auto.js.map +1 -1
  33. package/build-module/components/block-tools/block-selection-button.js +7 -1
  34. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  35. package/build-module/components/colors/with-colors.js +9 -4
  36. package/build-module/components/colors/with-colors.js.map +1 -1
  37. package/build-module/components/colors-gradients/control.js +6 -2
  38. package/build-module/components/colors-gradients/control.js.map +1 -1
  39. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +10 -72
  40. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  41. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +11 -0
  42. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +1 -0
  43. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +85 -0
  44. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -0
  45. package/build-module/components/gradients/use-gradient.js +7 -6
  46. package/build-module/components/gradients/use-gradient.js.map +1 -1
  47. package/build-module/components/use-setting/index.js +1 -1
  48. package/build-module/components/use-setting/index.js.map +1 -1
  49. package/build-module/hooks/border-color.js +11 -12
  50. package/build-module/hooks/border-color.js.map +1 -1
  51. package/build-module/hooks/color-panel.js +2 -1
  52. package/build-module/hooks/color-panel.js.map +1 -1
  53. package/build-module/hooks/color.js +46 -24
  54. package/build-module/hooks/color.js.map +1 -1
  55. package/build-module/hooks/typography.js +1 -2
  56. package/build-module/hooks/typography.js.map +1 -1
  57. package/build-module/hooks/use-color-props.js +16 -4
  58. package/build-module/hooks/use-color-props.js.map +1 -1
  59. package/build-module/store/selectors.js +37 -43
  60. package/build-module/store/selectors.js.map +1 -1
  61. package/build-style/style-rtl.css +8 -1
  62. package/build-style/style.css +8 -1
  63. package/package.json +3 -3
  64. package/src/components/block-preview/auto.js +3 -0
  65. package/src/components/block-preview/style.scss +5 -0
  66. package/src/components/block-tools/block-selection-button.js +5 -1
  67. package/src/components/colors/with-colors.js +16 -5
  68. package/src/components/colors-gradients/control.js +6 -0
  69. package/src/components/colors-gradients/panel-color-gradient-settings.js +8 -92
  70. package/src/components/colors-gradients/use-common-single-multiple-selects.js +11 -0
  71. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +107 -0
  72. package/src/components/gradients/use-gradient.js +18 -7
  73. package/src/components/link-control/style.scss +6 -2
  74. package/src/components/use-setting/index.js +1 -1
  75. package/src/hooks/border-color.js +15 -9
  76. package/src/hooks/color-panel.js +1 -0
  77. package/src/hooks/color.js +71 -31
  78. package/src/hooks/test/color.js +109 -0
  79. package/src/hooks/typography.js +1 -1
  80. package/src/hooks/use-color-props.js +30 -4
  81. package/src/store/selectors.js +14 -26
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/color.js"],"names":["classnames","isObject","setWith","clone","addFilter","getBlockSupport","__","useRef","useEffect","Platform","createHigherOrderComponent","getColorClassName","getColorObjectByColorValue","getColorObjectByAttributeValues","__experimentalGetGradientClass","getGradientValueBySlug","getGradientSlugByValue","cleanEmptyObject","ColorPanel","useSetting","COLOR_SUPPORT_KEY","EMPTY_ARRAY","hasColorSupport","blockType","colorSupport","link","gradient","background","text","shouldSkipSerialization","__experimentalSkipSerialization","hasLinkColorSupport","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","addAttributes","settings","attributes","backgroundColor","Object","assign","type","textColor","addSaveProps","props","hasGradient","style","backgroundClass","gradientClass","textClass","newClassName","className","color","elements","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","getLinkColorFromAttributeValue","colors","value","attributeParsed","exec","immutableSet","object","path","ColorEdit","name","blockName","solids","areCustomSolidsEnabled","areCustomGradientsEnabled","isLinkEnabled","isTextEnabled","isBackgroundEnabled","localAttributes","current","hasLinkColor","length","hasTextColor","hasBackgroundColor","hasGradientColor","gradientValue","onChangeColor","colorObject","attributeName","newStyle","slug","newNamedColor","newAttributes","setAttributes","onChangeGradient","onChangeLinkColor","newLinkColorValue","clientId","label","onColorChange","colorValue","onGradientChange","clearable","withColorPaletteStyles","BlockListBlock","extraStyles","wrapperProps"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,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AK,EAAE,EACN,GAAGwD,WADG;AAEN,iCAAG1D,KAAK,CAAC2D,YAAT,wDAAG,oBAAoBzD,KAAvB;AAFM;AAFO,GAAf;AAQA,SAAO,cAAC,cAAD,eAAqBF,KAArB;AAA6B,IAAA,YAAY,EAAG2D;AAA5C,KAAP;AACA,CA7B8D,CAAzD;AAgCPrG,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRiC,aAHQ,CAAT;AAMAjC,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGRyC,YAHQ,CAAT;AAMAzC,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRqD,YAHQ,CAAT;AAMArD,SAAS,CACR,uBADQ,EAER,sCAFQ,EAGRkG,sBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isObject, setWith, clone } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, Platform } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n\tgetGradientSlugByValue,\n} from '../components/gradients';\nimport { cleanEmptyObject } from './utils';\nimport ColorPanel from './color-panel';\nimport useSetting from '../components/use-setting';\n\nexport const COLOR_SUPPORT_KEY = 'color';\nconst EMPTY_ARRAY = [];\n\nconst hasColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\nconst shouldSkipSerialization = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport?.__experimentalSkipSerialization;\n};\n\nconst hasLinkColorSupport = ( blockType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn isObject( colorSupport ) && !! colorSupport.link;\n};\n\nconst hasGradientSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn isObject( colorSupport ) && !! colorSupport.gradients;\n};\n\nconst hasBackgroundColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\nconst hasTextColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * `backgroundColor` and `textColor` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasColorSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.backgroundColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\tif ( ! settings.attributes.textColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( hasGradientSupport( settings ) && ! settings.attributes.gradient ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tgradient: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject colors classnames.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( props, blockType, attributes ) {\n\tif (\n\t\t! hasColorSupport( blockType ) ||\n\t\tshouldSkipSerialization( blockType )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst hasGradient = hasGradientSupport( blockType );\n\n\t// I'd have prefered to avoid the \"style\" attribute usage here\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\tconst backgroundClass = getColorClassName(\n\t\t'background-color',\n\t\tbackgroundColor\n\t);\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst textClass = getColorClassName( 'color', textColor );\n\tconst newClassName = classnames(\n\t\tprops.className,\n\t\ttextClass,\n\t\tgradientClass,\n\t\t{\n\t\t\t// Don't apply the background class if there's a custom gradient\n\t\t\t[ backgroundClass ]:\n\t\t\t\t( ! hasGradient || ! style?.color?.gradient ) &&\n\t\t\t\t!! backgroundClass,\n\t\t\t'has-text-color': textColor || style?.color?.text,\n\t\t\t'has-background':\n\t\t\t\tbackgroundColor ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\t( hasGradient && ( gradient || style?.color?.gradient ) ),\n\t\t\t'has-link-color': style?.elements?.link?.color,\n\t\t}\n\t);\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extand the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif (\n\t\t! hasColorSupport( settings ) ||\n\t\tshouldSkipSerialization( settings )\n\t) {\n\t\treturn settings;\n\t}\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nconst getLinkColorFromAttributeValue = ( colors, value ) => {\n\tconst attributeParsed = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( attributeParsed && attributeParsed[ 1 ] ) {\n\t\treturn getColorObjectByAttributeValues( colors, attributeParsed[ 1 ] )\n\t\t\t.color;\n\t}\n\treturn value;\n};\n\nfunction immutableSet( object, path, value ) {\n\treturn setWith( object ? clone( object ) : {}, path, value, clone );\n}\n\n/**\n * Inspector control panel containing the color related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Color edit element.\n */\nexport function ColorEdit( props ) {\n\tconst { name: blockName, attributes } = props;\n\tconst solids = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\tconst gradients = useSetting( 'color.gradients' ) || EMPTY_ARRAY;\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\n\t// Shouldn't be needed but right now the ColorGradientsPanel\n\t// can trigger both onChangeColor and onChangeBackground\n\t// synchronously causing our two callbacks to override changes\n\t// from each other.\n\tconst localAttributes = useRef( attributes );\n\tuseEffect( () => {\n\t\tlocalAttributes.current = attributes;\n\t}, [ attributes ] );\n\n\tif ( ! hasColorSupport( blockName ) ) {\n\t\treturn null;\n\t}\n\n\tconst hasLinkColor =\n\t\thasLinkColorSupport( blockName ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasTextColor =\n\t\thasTextColorSupport( blockName ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasBackgroundColor =\n\t\thasBackgroundColorSupport( blockName ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\thasGradientSupport( blockName ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\n\tif (\n\t\t! hasLinkColor &&\n\t\t! hasTextColor &&\n\t\t! hasBackgroundColor &&\n\t\t! hasGradientColor\n\t) {\n\t\treturn null;\n\t}\n\n\tconst { style, textColor, backgroundColor, gradient } = attributes;\n\tlet gradientValue;\n\tif ( hasGradientColor && gradient ) {\n\t\tgradientValue = getGradientValueBySlug( gradients, gradient );\n\t} else if ( hasGradientColor ) {\n\t\tgradientValue = style?.color?.gradient;\n\t}\n\n\tconst onChangeColor = ( name ) => ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( solids, value );\n\t\tconst attributeName = name + 'Color';\n\t\tconst newStyle = {\n\t\t\t...localAttributes.current.style,\n\t\t\tcolor: {\n\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t[ name ]: colorObject?.slug ? undefined : value,\n\t\t\t},\n\t\t};\n\n\t\tconst newNamedColor = colorObject?.slug ? colorObject.slug : undefined;\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t[ attributeName ]: newNamedColor,\n\t\t};\n\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeGradient = ( value ) => {\n\t\tconst slug = getGradientSlugByValue( gradients, value );\n\t\tlet newAttributes;\n\t\tif ( slug ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: slug,\n\t\t\t};\n\t\t} else {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: value,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: undefined,\n\t\t\t};\n\t\t}\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeLinkColor = ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( solids, value );\n\t\tconst newLinkColorValue = colorObject?.slug\n\t\t\t? `var:preset|color|${ colorObject.slug }`\n\t\t\t: value;\n\n\t\tconst newStyle = cleanEmptyObject(\n\t\t\timmutableSet(\n\t\t\t\tstyle,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tnewLinkColorValue\n\t\t\t)\n\t\t);\n\t\tprops.setAttributes( { style: newStyle } );\n\t};\n\n\treturn (\n\t\t<ColorPanel\n\t\t\tenableContrastChecking={\n\t\t\t\t// Turn on contrast checker for web only since it's not supported on mobile yet.\n\t\t\t\tPlatform.OS === 'web' && ! gradient && ! style?.color?.gradient\n\t\t\t}\n\t\t\tclientId={ props.clientId }\n\t\t\tsettings={ [\n\t\t\t\t...( hasTextColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Text color' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeColor( 'text' ),\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tsolids,\n\t\t\t\t\t\t\t\t\ttextColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.text\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasBackgroundColor || hasGradientColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Background color' ),\n\t\t\t\t\t\t\t\tonColorChange: hasBackgroundColor\n\t\t\t\t\t\t\t\t\t? onChangeColor( 'background' )\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tsolids,\n\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.background\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tonGradientChange: hasGradientColor\n\t\t\t\t\t\t\t\t\t? onChangeGradient\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasLinkColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Link Color' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeLinkColor,\n\t\t\t\t\t\t\t\tcolorValue: getLinkColorFromAttributeValue(\n\t\t\t\t\t\t\t\t\tsolids,\n\t\t\t\t\t\t\t\t\tstyle?.elements?.link?.color?.text\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tclearable: !! style?.elements?.link?.color\n\t\t\t\t\t\t\t\t\t?.text,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t] }\n\t\t/>\n\t);\n}\n\n/**\n * This adds inline styles for color palette colors.\n * Ideally, this is not needed and themes should load their palettes on the editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withColorPaletteStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { backgroundColor, textColor } = attributes;\n\t\tconst colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\t\tif ( ! hasColorSupport( name ) || shouldSkipSerialization( name ) ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst extraStyles = {\n\t\t\tcolor: textColor\n\t\t\t\t? getColorObjectByAttributeValues( colors, textColor )?.color\n\t\t\t\t: undefined,\n\t\t\tbackgroundColor: backgroundColor\n\t\t\t\t? getColorObjectByAttributeValues( colors, backgroundColor )\n\t\t\t\t\t\t?.color\n\t\t\t\t: undefined,\n\t\t};\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\twrapperProps = {\n\t\t\t...props.wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...extraStyles,\n\t\t\t\t...props.wrapperProps?.style,\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/color/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/color/with-color-palette-styles',\n\twithColorPaletteStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/color.js"],"names":["classnames","isObject","setWith","clone","addFilter","getBlockSupport","__","useRef","useEffect","useMemo","Platform","createHigherOrderComponent","getColorClassName","getColorObjectByColorValue","getColorObjectByAttributeValues","__experimentalGetGradientClass","getGradientValueBySlug","getGradientSlugByValue","cleanEmptyObject","ColorPanel","useSetting","COLOR_SUPPORT_KEY","EMPTY_OBJECT","hasColorSupport","blockType","colorSupport","link","gradient","background","text","shouldSkipSerialization","__experimentalSkipSerialization","hasLinkColorSupport","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","addAttributes","settings","attributes","backgroundColor","Object","assign","type","textColor","addSaveProps","props","hasGradient","style","backgroundClass","gradientClass","textClass","newClassName","className","color","elements","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","getLinkColorFromAttributeValue","colors","value","attributeParsed","exec","immutableSet","object","path","ColorEdit","name","blockName","userPalette","themePalette","defaultPalette","allSolids","gradientsPerOrigin","areCustomSolidsEnabled","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","solidsEnabled","length","gradientsEnabled","theme","allGradients","custom","default","localAttributes","current","hasLinkColor","hasTextColor","hasBackgroundColor","hasGradientColor","gradientValue","onChangeColor","colorObject","attributeName","newStyle","slug","newNamedColor","newAttributes","setAttributes","onChangeGradient","onChangeLinkColor","newLinkColorValue","clientId","label","onColorChange","colorValue","onGradientChange","clearable","withColorPaletteStyles","BlockListBlock","extraStyles","wrapperProps"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,KAA5B,QAAyC,QAAzC;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,EAAqCC,QAArC,QAAqD,oBAArD;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SACCC,iBADD,EAECC,0BAFD,EAGCC,+BAHD,QAIO,sBAJP;AAKA,SACCC,8BADD,EAECC,sBAFD,EAGCC,sBAHD,QAIO,yBAJP;AAKA,SAASC,gBAAT,QAAiC,SAAjC;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AAEA,OAAO,MAAMC,iBAAiB,GAAG,OAA1B;AAEP,MAAMC,YAAY,GAAG,EAArB;;AAEA,MAAMC,eAAe,GAAKC,SAAF,IAAiB;AACxC,QAAMC,YAAY,GAAGpB,eAAe,CAAEmB,SAAF,EAAaH,iBAAb,CAApC;AACA,SACCI,YAAY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f,EAA6BC,cAA7B,CANqB,CAAtB;;AAQA,MAAK,CAAEnD,eAAe,CAAE+C,IAAF,CAAjB,IAA6BxC,uBAAuB,CAAEwC,IAAF,CAAzD,EAAoE;AACnE,WAAO,cAAC,cAAD,EAAqBvB,KAArB,CAAP;AACA;;AACD,QAAMoE,WAAW,GAAG,EAApB;;AAEA,MAAKtE,SAAL,EAAiB;AAAA;;AAChBsE,IAAAA,WAAW,CAAC5D,KAAZ,4BAAoBzC,+BAA+B,CAClDgD,MADkD,EAElDjB,SAFkD,CAAnD,0DAAoB,sBAGjBU,KAHH;AAIA;;AACD,MAAKd,eAAL,EAAuB;AAAA;;AACtB0E,IAAAA,WAAW,CAAC1E,eAAZ,6BAA8B3B,+BAA+B,CAC5DgD,MAD4D,EAE5DrB,eAF4D,CAA7D,2DAA8B,uBAG3Bc,KAHH;AAIA;;AAED,MAAI6D,YAAY,GAAGrE,KAAK,CAACqE,YAAzB;AACAA,EAAAA,YAAY,GAAG,EACd,GAAGrE,KAAK,CAACqE,YADK;AAEdnE,IAAAA,KAAK,EAAE,EACN,GAAGkE,WADG;AAEN,iCAAGpE,KAAK,CAACqE,YAAT,wDAAG,oBAAoBnE,KAAvB;AAFM;AAFO,GAAf;AAQA,SAAO,cAAC,cAAD,eAAqBF,KAArB;AAA6B,IAAA,YAAY,EAAGqE;AAA5C,KAAP;AACA,CA3C8D,CAAzD;AA8CPhH,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRkC,aAHQ,CAAT;AAMAlC,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGR0C,YAHQ,CAAT;AAMA1C,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRsD,YAHQ,CAAT;AAMAtD,SAAS,CACR,uBADQ,EAER,sCAFQ,EAGR6G,sBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isObject, setWith, clone } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useMemo, Platform } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n\tgetGradientSlugByValue,\n} from '../components/gradients';\nimport { cleanEmptyObject } from './utils';\nimport ColorPanel from './color-panel';\nimport useSetting from '../components/use-setting';\n\nexport const COLOR_SUPPORT_KEY = 'color';\n\nconst EMPTY_OBJECT = {};\n\nconst hasColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\nconst shouldSkipSerialization = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport?.__experimentalSkipSerialization;\n};\n\nconst hasLinkColorSupport = ( blockType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn isObject( colorSupport ) && !! colorSupport.link;\n};\n\nconst hasGradientSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn isObject( colorSupport ) && !! colorSupport.gradients;\n};\n\nconst hasBackgroundColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\nconst hasTextColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * `backgroundColor` and `textColor` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasColorSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.backgroundColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\tif ( ! settings.attributes.textColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( hasGradientSupport( settings ) && ! settings.attributes.gradient ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tgradient: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject colors classnames.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( props, blockType, attributes ) {\n\tif (\n\t\t! hasColorSupport( blockType ) ||\n\t\tshouldSkipSerialization( blockType )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst hasGradient = hasGradientSupport( blockType );\n\n\t// I'd have prefered to avoid the \"style\" attribute usage here\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\tconst backgroundClass = getColorClassName(\n\t\t'background-color',\n\t\tbackgroundColor\n\t);\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst textClass = getColorClassName( 'color', textColor );\n\tconst newClassName = classnames(\n\t\tprops.className,\n\t\ttextClass,\n\t\tgradientClass,\n\t\t{\n\t\t\t// Don't apply the background class if there's a custom gradient\n\t\t\t[ backgroundClass ]:\n\t\t\t\t( ! hasGradient || ! style?.color?.gradient ) &&\n\t\t\t\t!! backgroundClass,\n\t\t\t'has-text-color': textColor || style?.color?.text,\n\t\t\t'has-background':\n\t\t\t\tbackgroundColor ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\t( hasGradient && ( gradient || style?.color?.gradient ) ),\n\t\t\t'has-link-color': style?.elements?.link?.color,\n\t\t}\n\t);\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extand the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif (\n\t\t! hasColorSupport( settings ) ||\n\t\tshouldSkipSerialization( settings )\n\t) {\n\t\treturn settings;\n\t}\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nconst getLinkColorFromAttributeValue = ( colors, value ) => {\n\tconst attributeParsed = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( attributeParsed && attributeParsed[ 1 ] ) {\n\t\treturn getColorObjectByAttributeValues( colors, attributeParsed[ 1 ] )\n\t\t\t.color;\n\t}\n\treturn value;\n};\n\nfunction immutableSet( object, path, value ) {\n\treturn setWith( object ? clone( object ) : {}, path, value, clone );\n}\n\n/**\n * Inspector control panel containing the color related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Color edit element.\n */\nexport function ColorEdit( props ) {\n\tconst { name: blockName, attributes } = props;\n\t// Some color settings have a special handling for deprecated flags in `useSetting`,\n\t// so we can't unwrap them by doing const { ... } = useSetting('color')\n\t// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.\n\tconst userPalette = useSetting( 'color.palette.custom' );\n\tconst themePalette = useSetting( 'color.palette.theme' );\n\tconst defaultPalette = useSetting( 'color.palette.default' );\n\tconst allSolids = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tconst gradientsPerOrigin = useSetting( 'color.gradients' ) || EMPTY_OBJECT;\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst solidsEnabled =\n\t\tareCustomSolidsEnabled || ! themePalette || themePalette?.length > 0;\n\n\tconst gradientsEnabled =\n\t\tareCustomGradientsEnabled ||\n\t\t! gradientsPerOrigin?.theme ||\n\t\tgradientsPerOrigin?.theme?.length > 0;\n\n\tconst allGradients = useMemo(\n\t\t() => [\n\t\t\t...( gradientsPerOrigin?.custom || [] ),\n\t\t\t...( gradientsPerOrigin?.theme || [] ),\n\t\t\t...( gradientsPerOrigin?.default || [] ),\n\t\t],\n\t\t[ gradientsPerOrigin ]\n\t);\n\n\t// Shouldn't be needed but right now the ColorGradientsPanel\n\t// can trigger both onChangeColor and onChangeBackground\n\t// synchronously causing our two callbacks to override changes\n\t// from each other.\n\tconst localAttributes = useRef( attributes );\n\tuseEffect( () => {\n\t\tlocalAttributes.current = attributes;\n\t}, [ attributes ] );\n\n\tif ( ! hasColorSupport( blockName ) ) {\n\t\treturn null;\n\t}\n\n\tconst hasLinkColor =\n\t\thasLinkColorSupport( blockName ) && isLinkEnabled && solidsEnabled;\n\tconst hasTextColor =\n\t\thasTextColorSupport( blockName ) && isTextEnabled && solidsEnabled;\n\tconst hasBackgroundColor =\n\t\thasBackgroundColorSupport( blockName ) &&\n\t\tisBackgroundEnabled &&\n\t\tsolidsEnabled;\n\tconst hasGradientColor =\n\t\thasGradientSupport( blockName ) && gradientsEnabled;\n\n\tif (\n\t\t! hasLinkColor &&\n\t\t! hasTextColor &&\n\t\t! hasBackgroundColor &&\n\t\t! hasGradientColor\n\t) {\n\t\treturn null;\n\t}\n\n\tconst { style, textColor, backgroundColor, gradient } = attributes;\n\tlet gradientValue;\n\tif ( hasGradientColor && gradient ) {\n\t\tgradientValue = getGradientValueBySlug( allGradients, gradient );\n\t} else if ( hasGradientColor ) {\n\t\tgradientValue = style?.color?.gradient;\n\t}\n\n\tconst onChangeColor = ( name ) => ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst attributeName = name + 'Color';\n\t\tconst newStyle = {\n\t\t\t...localAttributes.current.style,\n\t\t\tcolor: {\n\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t[ name ]: colorObject?.slug ? undefined : value,\n\t\t\t},\n\t\t};\n\n\t\tconst newNamedColor = colorObject?.slug ? colorObject.slug : undefined;\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t[ attributeName ]: newNamedColor,\n\t\t};\n\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeGradient = ( value ) => {\n\t\tconst slug = getGradientSlugByValue( allGradients, value );\n\t\tlet newAttributes;\n\t\tif ( slug ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: slug,\n\t\t\t};\n\t\t} else {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: value,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: undefined,\n\t\t\t};\n\t\t}\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeLinkColor = ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst newLinkColorValue = colorObject?.slug\n\t\t\t? `var:preset|color|${ colorObject.slug }`\n\t\t\t: value;\n\n\t\tconst newStyle = cleanEmptyObject(\n\t\t\timmutableSet(\n\t\t\t\tstyle,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tnewLinkColorValue\n\t\t\t)\n\t\t);\n\t\tprops.setAttributes( { style: newStyle } );\n\t};\n\n\treturn (\n\t\t<ColorPanel\n\t\t\tenableContrastChecking={\n\t\t\t\t// Turn on contrast checker for web only since it's not supported on mobile yet.\n\t\t\t\tPlatform.OS === 'web' && ! gradient && ! style?.color?.gradient\n\t\t\t}\n\t\t\tclientId={ props.clientId }\n\t\t\tsettings={ [\n\t\t\t\t...( hasTextColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Text color' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeColor( 'text' ),\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\ttextColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.text\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasBackgroundColor || hasGradientColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Background color' ),\n\t\t\t\t\t\t\t\tonColorChange: hasBackgroundColor\n\t\t\t\t\t\t\t\t\t? onChangeColor( 'background' )\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.background\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tonGradientChange: hasGradientColor\n\t\t\t\t\t\t\t\t\t? onChangeGradient\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasLinkColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Link Color' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeLinkColor,\n\t\t\t\t\t\t\t\tcolorValue: getLinkColorFromAttributeValue(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tstyle?.elements?.link?.color?.text\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tclearable: !! style?.elements?.link?.color\n\t\t\t\t\t\t\t\t\t?.text,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t] }\n\t\t/>\n\t);\n}\n\n/**\n * This adds inline styles for color palette colors.\n * Ideally, this is not needed and themes should load their palettes on the editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withColorPaletteStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { backgroundColor, textColor } = attributes;\n\t\tconst userPalette = useSetting( 'color.palette.custom' ) || [];\n\t\tconst themePalette = useSetting( 'color.palette.theme' ) || [];\n\t\tconst defaultPalette = useSetting( 'color.palette.default' ) || [];\n\t\tconst colors = useMemo(\n\t\t\t() => [\n\t\t\t\t...( userPalette || [] ),\n\t\t\t\t...( themePalette || [] ),\n\t\t\t\t...( defaultPalette || [] ),\n\t\t\t],\n\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t);\n\t\tif ( ! hasColorSupport( name ) || shouldSkipSerialization( name ) ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\t\tconst extraStyles = {};\n\n\t\tif ( textColor ) {\n\t\t\textraStyles.color = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\ttextColor\n\t\t\t)?.color;\n\t\t}\n\t\tif ( backgroundColor ) {\n\t\t\textraStyles.backgroundColor = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\tbackgroundColor\n\t\t\t)?.color;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\twrapperProps = {\n\t\t\t...props.wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...extraStyles,\n\t\t\t\t...props.wrapperProps?.style,\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/color/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/color/with-color-palette-styles',\n\twithColorPaletteStyles\n);\n"]}
@@ -133,8 +133,7 @@ export function TypographyPanel(props) {
133
133
  panelId: clientId
134
134
  }, createElement(LetterSpacingEdit, props)));
135
135
  }
136
-
137
- const hasTypographySupport = blockName => {
136
+ export const hasTypographySupport = blockName => {
138
137
  return TYPOGRAPHY_SUPPORT_KEYS.some(key => hasBlockSupport(blockName, key));
139
138
  };
140
139
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","__experimentalToolsPanelItem","ToolsPanelItem","__","InspectorControls","getFontAppearanceLabel","LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","hasLineHeightValue","resetLineHeight","useIsLineHeightDisabled","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","FontAppearanceEdit","hasFontAppearanceValue","resetFontAppearance","useIsFontAppearanceDisabled","useIsFontStyleDisabled","useIsFontWeightDisabled","FONT_FAMILY_SUPPORT_KEY","FontFamilyEdit","hasFontFamilyValue","resetFontFamily","useIsFontFamilyDisabled","FONT_SIZE_SUPPORT_KEY","FontSizeEdit","hasFontSizeValue","resetFontSize","useIsFontSizeDisabled","TEXT_DECORATION_SUPPORT_KEY","TextDecorationEdit","hasTextDecorationValue","resetTextDecoration","useIsTextDecorationDisabled","TEXT_TRANSFORM_SUPPORT_KEY","TextTransformEdit","hasTextTransformValue","resetTextTransform","useIsTextTransformDisabled","LETTER_SPACING_SUPPORT_KEY","LetterSpacingEdit","hasLetterSpacingValue","resetLetterSpacing","useIsLetterSpacingDisabled","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","TypographyPanel","props","clientId","isFontFamilyDisabled","isFontSizeDisabled","isFontAppearanceDisabled","isLineHeightDisabled","isTextDecorationDisabled","isTextTransformDisabled","isLetterSpacingDisabled","hasFontStyles","hasFontWeights","isDisabled","useIsTypographyDisabled","isSupported","hasTypographySupport","name","defaultControls","createResetAllFilter","attribute","newAttributes","style","typography","undefined","fontFamily","fontSize","fontAppearance","fontStyle","fontWeight","lineHeight","textDecoration","textTransform","letterSpacing","blockName","some","key","configs","filter","Boolean","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,uBAA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QAAMmC,OAAO,GAAG,CACflE,2BAA2B,CAAE+B,KAAF,CADZ,EAEfnB,qBAAqB,CAAEmB,KAAF,CAFN,EAGfrC,uBAAuB,CAAEqC,KAAF,CAHR,EAIfxB,uBAAuB,CAAEwB,KAAF,CAJR,EAKfd,2BAA2B,CAAEc,KAAF,CALZ,EAMfT,0BAA0B,CAAES,KAAF,CANX,EAOfJ,0BAA0B,CAAEI,KAAF,CAPX,CAAhB;AAUA,SAAOmC,OAAO,CAACC,MAAR,CAAgBC,OAAhB,EAA0BC,MAA1B,KAAqCH,OAAO,CAACG,MAApD;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { getFontAppearanceLabel } from '../components/font-appearance-control';\n\nimport {\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tLineHeightEdit,\n\thasLineHeightValue,\n\tresetLineHeight,\n\tuseIsLineHeightDisabled,\n} from './line-height';\nimport {\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFontAppearanceEdit,\n\thasFontAppearanceValue,\n\tresetFontAppearance,\n\tuseIsFontAppearanceDisabled,\n\tuseIsFontStyleDisabled,\n\tuseIsFontWeightDisabled,\n} from './font-appearance';\nimport {\n\tFONT_FAMILY_SUPPORT_KEY,\n\tFontFamilyEdit,\n\thasFontFamilyValue,\n\tresetFontFamily,\n\tuseIsFontFamilyDisabled,\n} from './font-family';\nimport {\n\tFONT_SIZE_SUPPORT_KEY,\n\tFontSizeEdit,\n\thasFontSizeValue,\n\tresetFontSize,\n\tuseIsFontSizeDisabled,\n} from './font-size';\nimport {\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTextDecorationEdit,\n\thasTextDecorationValue,\n\tresetTextDecoration,\n\tuseIsTextDecorationDisabled,\n} from './text-decoration';\nimport {\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tTextTransformEdit,\n\thasTextTransformValue,\n\tresetTextTransform,\n\tuseIsTextTransformDisabled,\n} from './text-transform';\nimport {\n\tLETTER_SPACING_SUPPORT_KEY,\n\tLetterSpacingEdit,\n\thasLetterSpacingValue,\n\tresetLetterSpacing,\n\tuseIsLetterSpacingDisabled,\n} from './letter-spacing';\n\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nexport function TypographyPanel( props ) {\n\tconst { clientId } = props;\n\tconst isFontFamilyDisabled = useIsFontFamilyDisabled( props );\n\tconst isFontSizeDisabled = useIsFontSizeDisabled( props );\n\tconst isFontAppearanceDisabled = useIsFontAppearanceDisabled( props );\n\tconst isLineHeightDisabled = useIsLineHeightDisabled( props );\n\tconst isTextDecorationDisabled = useIsTextDecorationDisabled( props );\n\tconst isTextTransformDisabled = useIsTextTransformDisabled( props );\n\tconst isLetterSpacingDisabled = useIsLetterSpacingDisabled( props );\n\n\tconst hasFontStyles = ! useIsFontStyleDisabled( props );\n\tconst hasFontWeights = ! useIsFontWeightDisabled( props );\n\n\tconst isDisabled = useIsTypographyDisabled( props );\n\tconst isSupported = hasTypographySupport( props.name );\n\n\tif ( isDisabled || ! isSupported ) return null;\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = ( attribute ) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\ttypography: {\n\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t[ attribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"typography\">\n\t\t\t{ ! isFontFamilyDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontFamilyValue( props ) }\n\t\t\t\t\tlabel={ __( 'Font family' ) }\n\t\t\t\t\tonDeselect={ () => resetFontFamily( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontFamily }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontFamily: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontFamilyEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontSizeDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontSizeValue( props ) }\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\tonDeselect={ () => resetFontSize( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontSize }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontSize: undefined,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontSize: undefined,\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\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontSizeEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontAppearanceDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasFontAppearanceValue( props ) }\n\t\t\t\t\tlabel={ getFontAppearanceLabel(\n\t\t\t\t\t\thasFontStyles,\n\t\t\t\t\t\thasFontWeights\n\t\t\t\t\t) }\n\t\t\t\t\tonDeselect={ () => resetFontAppearance( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontAppearance }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontStyle: undefined,\n\t\t\t\t\t\t\t\tfontWeight: undefined,\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\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontAppearanceEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLineHeightDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLineHeightValue( props ) }\n\t\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\t\tonDeselect={ () => resetLineHeight( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.lineHeight }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'lineHeight' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LineHeightEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextDecorationDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasTextDecorationValue( props ) }\n\t\t\t\t\tlabel={ __( 'Decoration' ) }\n\t\t\t\t\tonDeselect={ () => resetTextDecoration( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textDecoration }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textDecoration' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextDecorationEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextTransformDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasTextTransformValue( props ) }\n\t\t\t\t\tlabel={ __( 'Letter case' ) }\n\t\t\t\t\tonDeselect={ () => resetTextTransform( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textTransform }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textTransform' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextTransformEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLetterSpacingDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLetterSpacingValue( props ) }\n\t\t\t\t\tlabel={ __( 'Letter-spacing' ) }\n\t\t\t\t\tonDeselect={ () => resetLetterSpacing( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.letterSpacing }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'letterSpacing' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LetterSpacingEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\nconst hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n\nfunction useIsTypographyDisabled( props = {} ) {\n\tconst configs = [\n\t\tuseIsFontAppearanceDisabled( props ),\n\t\tuseIsFontSizeDisabled( props ),\n\t\tuseIsLineHeightDisabled( props ),\n\t\tuseIsFontFamilyDisabled( props ),\n\t\tuseIsTextDecorationDisabled( props ),\n\t\tuseIsTextTransformDisabled( props ),\n\t\tuseIsLetterSpacingDisabled( props ),\n\t];\n\n\treturn configs.filter( Boolean ).length === configs.length;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","__experimentalToolsPanelItem","ToolsPanelItem","__","InspectorControls","getFontAppearanceLabel","LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","hasLineHeightValue","resetLineHeight","useIsLineHeightDisabled","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","FontAppearanceEdit","hasFontAppearanceValue","resetFontAppearance","useIsFontAppearanceDisabled","useIsFontStyleDisabled","useIsFontWeightDisabled","FONT_FAMILY_SUPPORT_KEY","FontFamilyEdit","hasFontFamilyValue","resetFontFamily","useIsFontFamilyDisabled","FONT_SIZE_SUPPORT_KEY","FontSizeEdit","hasFontSizeValue","resetFontSize","useIsFontSizeDisabled","TEXT_DECORATION_SUPPORT_KEY","TextDecorationEdit","hasTextDecorationValue","resetTextDecoration","useIsTextDecorationDisabled","TEXT_TRANSFORM_SUPPORT_KEY","TextTransformEdit","hasTextTransformValue","resetTextTransform","useIsTextTransformDisabled","LETTER_SPACING_SUPPORT_KEY","LetterSpacingEdit","hasLetterSpacingValue","resetLetterSpacing","useIsLetterSpacingDisabled","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","TypographyPanel","props","clientId","isFontFamilyDisabled","isFontSizeDisabled","isFontAppearanceDisabled","isLineHeightDisabled","isTextDecorationDisabled","isTextTransformDisabled","isLetterSpacingDisabled","hasFontStyles","hasFontWeights","isDisabled","useIsTypographyDisabled","isSupported","hasTypographySupport","name","defaultControls","createResetAllFilter","attribute","newAttributes","style","typography","undefined","fontFamily","fontSize","fontAppearance","fontStyle","fontWeight","lineHeight","textDecoration","textTransform","letterSpacing","blockName","some","key","configs","filter","Boolean","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,uBAA/D;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SAASC,sBAAT,QAAuC,uCAAvC;AAEA,SACCC,uBADD,EAECC,cAFD,EAGCC,kBAHD,EAICC,eAJD,EAKCC,uBALD,QAMO,eANP;AAOA,SACCC,sBADD,EAECC,uBAFD,EAGCC,kBAHD,EAICC,sBAJD,EAKCC,mBALD,EAMCC,2BAND,EAOCC,sBAPD,EAQCC,uBARD,QASO,mBATP;AAUA,SACCC,uBADD,EAECC,cAFD,EAGCC,kBAHD,EAICC,eAJD,EAKCC,uBALD,QAMO,eANP;AAOA,SACCC,qBADD,EAECC,YAFD,EAGCC,gBAHD,EAICC,aAJD,EAKCC,qBALD,QAMO,aANP;AAOA,SACCC,2BADD,EAECC,kBAFD,EAGCC,sBAHD,EAICC,mBAJD,EAKCC,2BALD,QAMO,mBANP;AAOA,SACCC,0BADD,EAECC,iBAFD,EAGCC,qBAHD,EAICC,kBAJD,EAKCC,0BALD,QAMO,kBANP;AAOA,SACCC,0BADD,EAECC,iBAFD,EAGCC,qBAHD,EAICC,kBAJD,EAKCC,0BALD,QAMO,kBANP;AAQA,OAAO,MAAMC,sBAAsB,GAAG,YAA/B;AACP,OAAO,MAAMC,uBAAuB,GAAG,CACtCvC,uBADsC,EAEtCkB,qBAFsC,EAGtCb,sBAHsC,EAItCC,uBAJsC,EAKtCO,uBALsC,EAMtCU,2BANsC,EAOtCK,0BAPsC,EAQtCK,0BARsC,CAAhC;A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C,iBAAD,EAAwBD,KAAxB,CATD,CAxGF,CADD;AAuHA;AAED,OAAO,MAAMc,oBAAoB,GAAKkB,SAAF,IAAiB;AACpD,SAAOlC,uBAAuB,CAACmC,IAAxB,CAAgCC,GAAF,IACpCjF,eAAe,CAAE+E,SAAF,EAAaE,GAAb,CADT,CAAP;AAGA,CAJM;;AAMP,SAAStB,uBAAT,GAA+C;AAAA,MAAbZ,KAAa,uEAAL,EAAK;AAC9C,QAAMmC,OAAO,GAAG,CACflE,2BAA2B,CAAE+B,KAAF,CADZ,EAEfnB,qBAAqB,CAAEmB,KAAF,CAFN,EAGfrC,uBAAuB,CAAEqC,KAAF,CAHR,EAIfxB,uBAAuB,CAAEwB,KAAF,CAJR,EAKfd,2BAA2B,CAAEc,KAAF,CALZ,EAMfT,0BAA0B,CAAES,KAAF,CANX,EAOfJ,0BAA0B,CAAEI,KAAF,CAPX,CAAhB;AAUA,SAAOmC,OAAO,CAACC,MAAR,CAAgBC,OAAhB,EAA0BC,MAA1B,KAAqCH,OAAO,CAACG,MAApD;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { getFontAppearanceLabel } from '../components/font-appearance-control';\n\nimport {\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tLineHeightEdit,\n\thasLineHeightValue,\n\tresetLineHeight,\n\tuseIsLineHeightDisabled,\n} from './line-height';\nimport {\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFontAppearanceEdit,\n\thasFontAppearanceValue,\n\tresetFontAppearance,\n\tuseIsFontAppearanceDisabled,\n\tuseIsFontStyleDisabled,\n\tuseIsFontWeightDisabled,\n} from './font-appearance';\nimport {\n\tFONT_FAMILY_SUPPORT_KEY,\n\tFontFamilyEdit,\n\thasFontFamilyValue,\n\tresetFontFamily,\n\tuseIsFontFamilyDisabled,\n} from './font-family';\nimport {\n\tFONT_SIZE_SUPPORT_KEY,\n\tFontSizeEdit,\n\thasFontSizeValue,\n\tresetFontSize,\n\tuseIsFontSizeDisabled,\n} from './font-size';\nimport {\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTextDecorationEdit,\n\thasTextDecorationValue,\n\tresetTextDecoration,\n\tuseIsTextDecorationDisabled,\n} from './text-decoration';\nimport {\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tTextTransformEdit,\n\thasTextTransformValue,\n\tresetTextTransform,\n\tuseIsTextTransformDisabled,\n} from './text-transform';\nimport {\n\tLETTER_SPACING_SUPPORT_KEY,\n\tLetterSpacingEdit,\n\thasLetterSpacingValue,\n\tresetLetterSpacing,\n\tuseIsLetterSpacingDisabled,\n} from './letter-spacing';\n\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nexport function TypographyPanel( props ) {\n\tconst { clientId } = props;\n\tconst isFontFamilyDisabled = useIsFontFamilyDisabled( props );\n\tconst isFontSizeDisabled = useIsFontSizeDisabled( props );\n\tconst isFontAppearanceDisabled = useIsFontAppearanceDisabled( props );\n\tconst isLineHeightDisabled = useIsLineHeightDisabled( props );\n\tconst isTextDecorationDisabled = useIsTextDecorationDisabled( props );\n\tconst isTextTransformDisabled = useIsTextTransformDisabled( props );\n\tconst isLetterSpacingDisabled = useIsLetterSpacingDisabled( props );\n\n\tconst hasFontStyles = ! useIsFontStyleDisabled( props );\n\tconst hasFontWeights = ! useIsFontWeightDisabled( props );\n\n\tconst isDisabled = useIsTypographyDisabled( props );\n\tconst isSupported = hasTypographySupport( props.name );\n\n\tif ( isDisabled || ! isSupported ) return null;\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = ( attribute ) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\ttypography: {\n\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t[ attribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"typography\">\n\t\t\t{ ! isFontFamilyDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontFamilyValue( props ) }\n\t\t\t\t\tlabel={ __( 'Font family' ) }\n\t\t\t\t\tonDeselect={ () => resetFontFamily( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontFamily }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontFamily: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontFamilyEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontSizeDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontSizeValue( props ) }\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\tonDeselect={ () => resetFontSize( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontSize }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontSize: undefined,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontSize: undefined,\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\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontSizeEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontAppearanceDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasFontAppearanceValue( props ) }\n\t\t\t\t\tlabel={ getFontAppearanceLabel(\n\t\t\t\t\t\thasFontStyles,\n\t\t\t\t\t\thasFontWeights\n\t\t\t\t\t) }\n\t\t\t\t\tonDeselect={ () => resetFontAppearance( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontAppearance }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontStyle: undefined,\n\t\t\t\t\t\t\t\tfontWeight: undefined,\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\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontAppearanceEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLineHeightDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLineHeightValue( props ) }\n\t\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\t\tonDeselect={ () => resetLineHeight( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.lineHeight }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'lineHeight' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LineHeightEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextDecorationDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasTextDecorationValue( props ) }\n\t\t\t\t\tlabel={ __( 'Decoration' ) }\n\t\t\t\t\tonDeselect={ () => resetTextDecoration( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textDecoration }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textDecoration' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextDecorationEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextTransformDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasTextTransformValue( props ) }\n\t\t\t\t\tlabel={ __( 'Letter case' ) }\n\t\t\t\t\tonDeselect={ () => resetTextTransform( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textTransform }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textTransform' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextTransformEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLetterSpacingDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLetterSpacingValue( props ) }\n\t\t\t\t\tlabel={ __( 'Letter-spacing' ) }\n\t\t\t\t\tonDeselect={ () => resetLetterSpacing( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.letterSpacing }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'letterSpacing' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LetterSpacingEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n\nfunction useIsTypographyDisabled( props = {} ) {\n\tconst configs = [\n\t\tuseIsFontAppearanceDisabled( props ),\n\t\tuseIsFontSizeDisabled( props ),\n\t\tuseIsLineHeightDisabled( props ),\n\t\tuseIsFontFamilyDisabled( props ),\n\t\tuseIsTextDecorationDisabled( props ),\n\t\tuseIsTextTransformDisabled( props ),\n\t\tuseIsLetterSpacingDisabled( props ),\n\t];\n\n\treturn configs.filter( Boolean ).length === configs.length;\n}\n"]}
@@ -2,6 +2,11 @@
2
2
  * External dependencies
3
3
  */
4
4
  import classnames from 'classnames';
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+
9
+ import { useMemo } from '@wordpress/element';
5
10
  /**
6
11
  * Internal dependencies
7
12
  */
@@ -16,7 +21,6 @@ import useSetting from '../components/use-setting'; // The code in this file has
16
21
  // block support is being skipped for a block but the color related CSS classes
17
22
  // & styles still need to be generated so they can be applied to inner elements.
18
23
 
19
- const EMPTY_ARRAY = [];
20
24
  /**
21
25
  * Provides the CSS class names and inline styles for a block's color support
22
26
  * attributes.
@@ -60,6 +64,7 @@ export function getColorClassesAndStyles(attributes) {
60
64
  style: styleProp
61
65
  };
62
66
  }
67
+ const EMPTY_OBJECT = {};
63
68
  /**
64
69
  * Determines the color related props for a block derived from its color block
65
70
  * support attributes.
@@ -77,9 +82,16 @@ export function useColorProps(attributes) {
77
82
  backgroundColor,
78
83
  textColor,
79
84
  gradient
80
- } = attributes;
81
- const colors = useSetting('color.palette') || EMPTY_ARRAY;
82
- const gradients = useSetting('color.gradients') || EMPTY_ARRAY;
85
+ } = attributes; // Some color settings have a special handling for deprecated flags in `useSetting`,
86
+ // so we can't unwrap them by doing const { ... } = useSetting('color')
87
+ // until https://github.com/WordPress/gutenberg/issues/37094 is fixed.
88
+
89
+ const userPalette = useSetting('color.palette.custom') || [];
90
+ const themePalette = useSetting('color.palette.theme') || [];
91
+ const defaultPalette = useSetting('color.palette.default') || [];
92
+ const gradientsPerOrigin = useSetting('color.gradients') || EMPTY_OBJECT;
93
+ const colors = useMemo(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
94
+ const gradients = useMemo(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]);
83
95
  const colorProps = getColorClassesAndStyles(attributes); // Force inline styles to apply colors when themes do not load their color
84
96
  // stylesheets in the editor.
85
97
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/use-color-props.js"],"names":["classnames","getInlineStyles","getColorClassName","getColorObjectByAttributeValues","__experimentalGetGradientClass","getGradientValueBySlug","useSetting","EMPTY_ARRAY","getColorClassesAndStyles","attributes","backgroundColor","textColor","gradient","style","backgroundClass","textClass","gradientClass","hasGradient","color","className","text","background","elements","link","colorStyles","styleProp","undefined","useColorProps","colors","gradients","colorProps","backgroundColorObject","textColorObject"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,SAAhC;AACA,SACCC,iBADD,EAECC,+BAFD,QAGO,sBAHP;AAIA,SACCC,8BADD,EAECC,sBAFD,QAGO,yBAHP;AAIA,OAAOC,UAAP,MAAuB,2BAA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ependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n} from '../components/gradients';\nimport useSetting from '../components/use-setting';\n\n// The code in this file has largely been lifted from the color block support\n// hook.\n//\n// This utility is intended to assist where the serialization of the colors\n// block support is being skipped for a block but the color related CSS classes\n// & styles still need to be generated so they can be applied to inner elements.\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Provides the CSS class names and inline styles for a block's color support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Color block support derived CSS classes & styles.\n */\nexport function getColorClassesAndStyles( attributes ) {\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\t// Collect color CSS classes.\n\tconst backgroundClass = getColorClassName(\n\t\t'background-color',\n\t\tbackgroundColor\n\t);\n\tconst textClass = getColorClassName( 'color', textColor );\n\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst hasGradient = gradientClass || style?.color?.gradient;\n\n\t// Determine color CSS class name list.\n\tconst className = classnames( textClass, gradientClass, {\n\t\t// Don't apply the background class if there's a gradient.\n\t\t[ backgroundClass ]: ! hasGradient && !! backgroundClass,\n\t\t'has-text-color': textColor || style?.color?.text,\n\t\t'has-background':\n\t\t\tbackgroundColor ||\n\t\t\tstyle?.color?.background ||\n\t\t\tgradient ||\n\t\t\tstyle?.color?.gradient,\n\t\t'has-link-color': style?.elements?.link?.color,\n\t} );\n\n\t// Collect inline styles for colors.\n\tconst colorStyles = style?.color || {};\n\tconst styleProp = getInlineStyles( { color: colorStyles } );\n\n\treturn {\n\t\tclassName: className || undefined,\n\t\tstyle: styleProp,\n\t};\n}\n\n/**\n * Determines the color related props for a block derived from its color block\n * support attributes.\n *\n * Inline styles are forced for named colors to ensure these selections are\n * reflected when themes do not load their color stylesheets in the editor.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} ClassName & style props from colors block support.\n */\nexport function useColorProps( attributes ) {\n\tconst { backgroundColor, textColor, gradient } = attributes;\n\n\tconst colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\tconst gradients = useSetting( 'color.gradients' ) || EMPTY_ARRAY;\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\t// Force inline styles to apply colors when themes do not load their color\n\t// stylesheets in the editor.\n\tif ( backgroundColor ) {\n\t\tconst backgroundColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\tbackgroundColor\n\t\t);\n\n\t\tcolorProps.style.backgroundColor = backgroundColorObject.color;\n\t}\n\n\tif ( gradient ) {\n\t\tcolorProps.style.background = getGradientValueBySlug(\n\t\t\tgradients,\n\t\t\tgradient\n\t\t);\n\t}\n\n\tif ( textColor ) {\n\t\tconst textColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\ttextColor\n\t\t);\n\n\t\tcolorProps.style.color = textColorObject.color;\n\t}\n\n\treturn colorProps;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/use-color-props.js"],"names":["classnames","useMemo","getInlineStyles","getColorClassName","getColorObjectByAttributeValues","__experimentalGetGradientClass","getGradientValueBySlug","useSetting","getColorClassesAndStyles","attributes","backgroundColor","textColor","gradient","style","backgroundClass","textClass","gradientClass","hasGradient","color","className","text","background","elements","link","colorStyles","styleProp","undefined","EMPTY_OBJECT","useColorProps","userPalette","themePalette","defaultPalette","gradientsPerOrigin","colors","gradients","custom","theme","default","colorProps","backgroundColorObject","textColorObject"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,SAAhC;AACA,SACCC,iBADD,EAECC,+BAFD,QAGO,sBAHP;AAIA,SACCC,8BADD,EAECC,sBAFD,QAGO,yBAH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AkB,CAAEI,KAApB,KAA6B,EAAlC,CAFK,EAGL,IAAK,CAAAJ,kBAAkB,SAAlB,IAAAA,kBAAkB,WAAlB,YAAAA,kBAAkB,CAAEK,OAApB,KAA+B,EAApC,CAHK,CADkB,EAMxB,CAAEL,kBAAF,CANwB,CAAzB;AASA,QAAMM,UAAU,GAAG9B,wBAAwB,CAAEC,UAAF,CAA3C,CA3B2C,CA6B3C;AACA;;AACA,MAAKC,eAAL,EAAuB;AACtB,UAAM6B,qBAAqB,GAAGnC,+BAA+B,CAC5D6B,MAD4D,EAE5DvB,eAF4D,CAA7D;AAKA4B,IAAAA,UAAU,CAACzB,KAAX,CAAiBH,eAAjB,GAAmC6B,qBAAqB,CAACrB,KAAzD;AACA;;AAED,MAAKN,QAAL,EAAgB;AACf0B,IAAAA,UAAU,CAACzB,KAAX,CAAiBQ,UAAjB,GAA8Bf,sBAAsB,CACnD4B,SADmD,EAEnDtB,QAFmD,CAApD;AAIA;;AAED,MAAKD,SAAL,EAAiB;AAChB,UAAM6B,eAAe,GAAGpC,+BAA+B,CACtD6B,MADsD,EAEtDtB,SAFsD,CAAvD;AAKA2B,IAAAA,UAAU,CAACzB,KAAX,CAAiBK,KAAjB,GAAyBsB,eAAe,CAACtB,KAAzC;AACA;;AAED,SAAOoB,UAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n} from '../components/gradients';\nimport useSetting from '../components/use-setting';\n\n// The code in this file has largely been lifted from the color block support\n// hook.\n//\n// This utility is intended to assist where the serialization of the colors\n// block support is being skipped for a block but the color related CSS classes\n// & styles still need to be generated so they can be applied to inner elements.\n\n/**\n * Provides the CSS class names and inline styles for a block's color support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Color block support derived CSS classes & styles.\n */\nexport function getColorClassesAndStyles( attributes ) {\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\t// Collect color CSS classes.\n\tconst backgroundClass = getColorClassName(\n\t\t'background-color',\n\t\tbackgroundColor\n\t);\n\tconst textClass = getColorClassName( 'color', textColor );\n\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst hasGradient = gradientClass || style?.color?.gradient;\n\n\t// Determine color CSS class name list.\n\tconst className = classnames( textClass, gradientClass, {\n\t\t// Don't apply the background class if there's a gradient.\n\t\t[ backgroundClass ]: ! hasGradient && !! backgroundClass,\n\t\t'has-text-color': textColor || style?.color?.text,\n\t\t'has-background':\n\t\t\tbackgroundColor ||\n\t\t\tstyle?.color?.background ||\n\t\t\tgradient ||\n\t\t\tstyle?.color?.gradient,\n\t\t'has-link-color': style?.elements?.link?.color,\n\t} );\n\n\t// Collect inline styles for colors.\n\tconst colorStyles = style?.color || {};\n\tconst styleProp = getInlineStyles( { color: colorStyles } );\n\n\treturn {\n\t\tclassName: className || undefined,\n\t\tstyle: styleProp,\n\t};\n}\n\nconst EMPTY_OBJECT = {};\n\n/**\n * Determines the color related props for a block derived from its color block\n * support attributes.\n *\n * Inline styles are forced for named colors to ensure these selections are\n * reflected when themes do not load their color stylesheets in the editor.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} ClassName & style props from colors block support.\n */\nexport function useColorProps( attributes ) {\n\tconst { backgroundColor, textColor, gradient } = attributes;\n\n\t// Some color settings have a special handling for deprecated flags in `useSetting`,\n\t// so we can't unwrap them by doing const { ... } = useSetting('color')\n\t// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.\n\tconst userPalette = useSetting( 'color.palette.custom' ) || [];\n\tconst themePalette = useSetting( 'color.palette.theme' ) || [];\n\tconst defaultPalette = useSetting( 'color.palette.default' ) || [];\n\tconst gradientsPerOrigin = useSetting( 'color.gradients' ) || EMPTY_OBJECT;\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tconst gradients = useMemo(\n\t\t() => [\n\t\t\t...( gradientsPerOrigin?.custom || [] ),\n\t\t\t...( gradientsPerOrigin?.theme || [] ),\n\t\t\t...( gradientsPerOrigin?.default || [] ),\n\t\t],\n\t\t[ gradientsPerOrigin ]\n\t);\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\t// Force inline styles to apply colors when themes do not load their color\n\t// stylesheets in the editor.\n\tif ( backgroundColor ) {\n\t\tconst backgroundColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\tbackgroundColor\n\t\t);\n\n\t\tcolorProps.style.backgroundColor = backgroundColorObject.color;\n\t}\n\n\tif ( gradient ) {\n\t\tcolorProps.style.background = getGradientValueBySlug(\n\t\t\tgradients,\n\t\t\tgradient\n\t\t);\n\t}\n\n\tif ( textColor ) {\n\t\tconst textColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\ttextColor\n\t\t);\n\n\t\tcolorProps.style.color = textColorObject.color;\n\t}\n\n\treturn colorProps;\n}\n"]}
@@ -1575,38 +1575,33 @@ export const getInserterItems = createSelector(function (state) {
1575
1575
  };
1576
1576
 
1577
1577
  const blockTypeInserterItems = getBlockTypes().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem);
1578
- const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : []; // Exclude any block type item that is to be replaced by a default
1579
- // variation.
1580
-
1581
- const visibleBlockTypeInserterItems = blockTypeInserterItems.filter(_ref4 => {
1582
- let {
1578
+ const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : [];
1579
+ const items = blockTypeInserterItems.reduce((accumulator, item) => {
1580
+ const {
1583
1581
  variations = []
1584
- } = _ref4;
1585
- return !variations.some(_ref5 => {
1582
+ } = item; // Exclude any block type item that is to be replaced by a default variation
1583
+
1584
+ if (!variations.some(_ref4 => {
1586
1585
  let {
1587
1586
  isDefault
1588
- } = _ref5;
1587
+ } = _ref4;
1589
1588
  return isDefault;
1590
- });
1591
- });
1592
- const blockVariations = []; // Show all available blocks with variations
1593
-
1594
- for (const item of blockTypeInserterItems) {
1595
- const {
1596
- variations = []
1597
- } = item;
1589
+ })) {
1590
+ accumulator.push(item);
1591
+ }
1598
1592
 
1599
1593
  if (variations.length) {
1600
1594
  const variationMapper = getItemFromVariation(state, item);
1601
- blockVariations.push(...variations.map(variationMapper));
1595
+ accumulator.push(...variations.map(variationMapper));
1602
1596
  }
1603
- } // Ensure core blocks are prioritized in the returned results,
1597
+
1598
+ return accumulator;
1599
+ }, []); // Ensure core blocks are prioritized in the returned results,
1604
1600
  // because third party blocks can be registered earlier than
1605
1601
  // the core blocks (usually by using the `init` action),
1606
1602
  // thus affecting the display order.
1607
1603
  // We don't sort reusable blocks as they are handled differently.
1608
1604
 
1609
-
1610
1605
  const groupByType = (blocks, block) => {
1611
1606
  const {
1612
1607
  core,
@@ -1617,15 +1612,14 @@ export const getInserterItems = createSelector(function (state) {
1617
1612
  return blocks;
1618
1613
  };
1619
1614
 
1620
- const items = visibleBlockTypeInserterItems.reduce(groupByType, {
1621
- core: [],
1622
- noncore: []
1623
- });
1624
- const variations = blockVariations.reduce(groupByType, {
1615
+ const {
1616
+ core: coreItems,
1617
+ noncore: nonCoreItems
1618
+ } = items.reduce(groupByType, {
1625
1619
  core: [],
1626
1620
  noncore: []
1627
1621
  });
1628
- const sortedBlockTypes = [...items.core, ...variations.core, ...items.noncore, ...variations.noncore];
1622
+ const sortedBlockTypes = [...coreItems, ...nonCoreItems];
1629
1623
  return [...sortedBlockTypes, ...reusableBlockInserterItems];
1630
1624
  }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), getBlockTypes()]);
1631
1625
  /**
@@ -1660,10 +1654,10 @@ export const getBlockTransformItems = createSelector(function (state, blocks) {
1660
1654
  buildScope: 'transform'
1661
1655
  });
1662
1656
  const blockTypeTransformItems = getBlockTypes().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem);
1663
- const itemsByName = mapKeys(blockTypeTransformItems, _ref6 => {
1657
+ const itemsByName = mapKeys(blockTypeTransformItems, _ref5 => {
1664
1658
  let {
1665
1659
  name
1666
- } = _ref6;
1660
+ } = _ref5;
1667
1661
  return name;
1668
1662
  });
1669
1663
  const possibleTransforms = getPossibleBlockTransformations(blocks).reduce((accumulator, block) => {
@@ -1773,10 +1767,10 @@ const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
1773
1767
 
1774
1768
  export const __experimentalGetParsedPattern = createSelector((state, patternName) => {
1775
1769
  const patterns = state.settings.__experimentalBlockPatterns;
1776
- const pattern = patterns.find(_ref7 => {
1770
+ const pattern = patterns.find(_ref6 => {
1777
1771
  let {
1778
1772
  name
1779
- } = _ref7;
1773
+ } = _ref6;
1780
1774
  return name === patternName;
1781
1775
  });
1782
1776
 
@@ -1793,21 +1787,21 @@ const getAllAllowedPatterns = createSelector(state => {
1793
1787
  const {
1794
1788
  allowedBlockTypes
1795
1789
  } = getSettings(state);
1796
- const parsedPatterns = patterns.filter(_ref8 => {
1790
+ const parsedPatterns = patterns.filter(_ref7 => {
1797
1791
  let {
1798
1792
  inserter = true
1799
- } = _ref8;
1793
+ } = _ref7;
1800
1794
  return !!inserter;
1801
- }).map(_ref9 => {
1795
+ }).map(_ref8 => {
1802
1796
  let {
1803
1797
  name
1804
- } = _ref9;
1798
+ } = _ref8;
1805
1799
  return __experimentalGetParsedPattern(state, name);
1806
1800
  });
1807
- const allowedPatterns = parsedPatterns.filter(_ref10 => {
1801
+ const allowedPatterns = parsedPatterns.filter(_ref9 => {
1808
1802
  let {
1809
1803
  blocks
1810
- } = _ref10;
1804
+ } = _ref9;
1811
1805
  return checkAllowListRecursive(blocks, allowedBlockTypes);
1812
1806
  });
1813
1807
  return allowedPatterns;
@@ -1824,14 +1818,14 @@ const getAllAllowedPatterns = createSelector(state => {
1824
1818
  export const __experimentalGetAllowedPatterns = createSelector(function (state) {
1825
1819
  let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1826
1820
  const availableParsedPatterns = getAllAllowedPatterns(state);
1827
- const patternsAllowed = filter(availableParsedPatterns, _ref11 => {
1821
+ const patternsAllowed = filter(availableParsedPatterns, _ref10 => {
1828
1822
  let {
1829
1823
  blocks
1830
- } = _ref11;
1831
- return blocks.every(_ref12 => {
1824
+ } = _ref10;
1825
+ return blocks.every(_ref11 => {
1832
1826
  let {
1833
1827
  name
1834
- } = _ref12;
1828
+ } = _ref11;
1835
1829
  return canInsertBlockType(state, name, rootClientId);
1836
1830
  });
1837
1831
  });
@@ -1893,21 +1887,21 @@ export const __experimentalGetPatternTransformItems = createSelector(function (s
1893
1887
  * to check for this case too.
1894
1888
  */
1895
1889
 
1896
- if (blocks.some(_ref13 => {
1890
+ if (blocks.some(_ref12 => {
1897
1891
  let {
1898
1892
  clientId,
1899
1893
  innerBlocks
1900
- } = _ref13;
1894
+ } = _ref12;
1901
1895
  return innerBlocks.length || areInnerBlocksControlled(state, clientId);
1902
1896
  })) {
1903
1897
  return EMPTY_ARRAY;
1904
1898
  } // Create a Set of the selected block names that is used in patterns filtering.
1905
1899
 
1906
1900
 
1907
- const selectedBlockNames = Array.from(new Set(blocks.map(_ref14 => {
1901
+ const selectedBlockNames = Array.from(new Set(blocks.map(_ref13 => {
1908
1902
  let {
1909
1903
  name
1910
- } = _ref14;
1904
+ } = _ref13;
1911
1905
  return name;
1912
1906
  })));
1913
1907
  /**