@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 2.59 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/separator/deprecated.js"],
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\tcolor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcustomColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { color, customColor } = attributes;\n\n\t\t// the hr support changing color using border-color, since border-color\n\t\t// is not yet supported in the color palette, we use background-color\n\t\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t\t// the dots styles uses text for the dots, to change those dots color is\n\t\t// using color, not backgroundColor\n\t\tconst colorClass = getColorClassName( 'color', color );\n\n\t\tconst className = clsx( {\n\t\t\t'has-text-color has-background': color || customColor,\n\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t[ colorClass ]: colorClass,\n\t\t} );\n\n\t\tconst style = {\n\t\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\t\tcolor: colorClass ? undefined : customColor,\n\t\t};\n\n\t\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n\t},\n\tmigrate( attributes ) {\n\t\tconst { color, customColor, ...restAttributes } = attributes;\n\t\treturn {\n\t\t\t...restAttributes,\n\t\t\tbackgroundColor: color ? color : undefined,\n\t\t\topacity: 'css',\n\t\t\tstyle: customColor\n\t\t\t\t? { color: { background: customColor } }\n\t\t\t\t: undefined,\n\t\t\ttagName: 'hr',\n\t\t};\n\t},\n};\n\nexport default [ v1 ];\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,0BAAiD;AAgCxC;AA9BT,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,OAAO;AAAA,MACN,MAAM;AAAA,IACP;AAAA,IACA,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA,KAAM,EAAE,WAAW,GAAI;AACtB,UAAM,EAAE,OAAO,YAAY,IAAI;AAI/B,UAAM,sBAAkB,uCAAmB,oBAAoB,KAAM;AAGrE,UAAM,iBAAa,uCAAmB,SAAS,KAAM;AAErD,UAAM,gBAAY,YAAAA,SAAM;AAAA,MACvB,iCAAiC,SAAS;AAAA,MAC1C,CAAE,eAAgB,GAAG;AAAA,MACrB,CAAE,UAAW,GAAG;AAAA,IACjB,CAAE;AAEF,UAAM,QAAQ;AAAA,MACb,iBAAiB,kBAAkB,SAAY;AAAA,MAC/C,OAAO,aAAa,SAAY;AAAA,IACjC;AAEA,WAAO,4CAAC,QAAK,GAAG,kCAAc,KAAM,EAAE,WAAW,MAAM,CAAE,GAAI;AAAA,EAC9D;AAAA,EACA,QAAS,YAAa;AACrB,UAAM,EAAE,OAAO,aAAa,GAAG,eAAe,IAAI;AAClD,WAAO;AAAA,MACN,GAAG;AAAA,MACH,iBAAiB,QAAQ,QAAQ;AAAA,MACjC,SAAS;AAAA,MACT,OAAO,cACJ,EAAE,OAAO,EAAE,YAAY,YAAY,EAAE,IACrC;AAAA,MACH,SAAS;AAAA,IACV;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ,CAAE,EAAG;",
"names": ["clsx"]
}