@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 2.01 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/separator/save.js"],
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity, tagName: Tag } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\treturn <Tag { ...useBlockProps.save( { className, style: styles } ) } />;\n}\n"],
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA,0CAA0C;AAAA,OACpC;AA2BC;AAzBO,SAAR,cAAgC,EAAE,WAAW,GAAI;AACvD,QAAM,EAAE,iBAAiB,OAAO,SAAS,SAAS,IAAI,IAAI;AAC1D,QAAM,cAAc,OAAO,OAAO;AAClC,QAAM,aAAa,yBAA0B,UAAW;AAMxD,QAAM,aAAa,kBAAmB,SAAS,eAAgB;AAE/D,QAAM,YAAY;AAAA,IACjB;AAAA,MACC,kBAAkB,mBAAmB;AAAA,MACrC,CAAE,UAAW,GAAG;AAAA,MAChB,mBAAmB,YAAY;AAAA,MAC/B,6BAA6B,YAAY;AAAA,IAC1C;AAAA,IACA,WAAW;AAAA,EACZ;AAEA,QAAM,SAAS;AAAA,IACd,iBAAiB,YAAY,OAAO;AAAA,IACpC,OAAO,aAAa,SAAY;AAAA,EACjC;AACA,SAAO,oBAAC,OAAM,GAAG,cAAc,KAAM,EAAE,WAAW,OAAO,OAAO,CAAE,GAAI;AACvE;",
"names": []
}