UNPKG

@wordpress/block-editor

Version:
8 lines (7 loc) 1.21 kB
{ "version": 3, "sources": ["../../src/hooks/use-spacing-props.js"], "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\n\n// This utility is intended to assist where the serialization of the spacing\n// block support is being skipped for a block but the spacing related CSS\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 spacing support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Spacing block support derived CSS classes & styles.\n */\nexport function getSpacingClassesAndStyles( attributes ) {\n\tconst { style } = attributes;\n\n\t// Collect inline styles for spacing.\n\tconst spacingStyles = style?.spacing || {};\n\tconst styleProp = getInlineStyles( { spacing: spacingStyles } );\n\n\treturn {\n\t\tstyle: styleProp,\n\t};\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAgC;AAczB,SAAS,2BAA4B,YAAa;AACxD,QAAM,EAAE,MAAM,IAAI;AAGlB,QAAM,gBAAgB,OAAO,WAAW,CAAC;AACzC,QAAM,gBAAY,8BAAiB,EAAE,SAAS,cAAc,CAAE;AAE9D,SAAO;AAAA,IACN,OAAO;AAAA,EACR;AACD;", "names": [] }