UNPKG

@antv/t8

Version:

T8 is a text visualization solution for unstructured data within the AntV technology stack, and it is a declarative JSON Schema syntax that can be used to describe the content of data interpretation reports.

40 lines (37 loc) 2.56 kB
import { __assign } from 'tslib'; import { createStyledComponent } from './utils/styledFactory.js'; var getHeadingStyle = function (theme, level) { var baseStyle = { fontFamily: theme.fontFamily, color: theme.colorHeadingBase, }; var fontSize = theme.fontSize; var lineHeight = theme.lineHeight; switch (level) { case 1: return __assign(__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h1 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h1 * lineHeight, "px"), margin: '26px 0 10px 0' }); case 2: return __assign(__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h2 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h2 * lineHeight, "px"), margin: '21px 0 5px 0' }); case 3: return __assign(__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h3 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h3 * lineHeight, "px"), margin: '16px 0 5px 0' }); case 4: return __assign(__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h4 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h4 * lineHeight, "px"), margin: '10px 0 5px 0' }); case 5: return __assign(__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h5 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h5 * lineHeight, "px"), margin: '8px 0 5px 0' }); case 6: return __assign(__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h6 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h6 * lineHeight, "px"), minHeight: "".concat(theme.lineHeightMultiples.h6, "px"), letterSpacing: '0.008em', margin: '5px 0 5px 0' }); default: return baseStyle; } }; var Headline = createStyledComponent({ element: 'h1', factoryStyles: function (theme) { return (__assign(__assign({}, getHeadingStyle(theme, 1)), { borderBottom: "1px solid ".concat(theme.borderColor) })); }, }); var Heading = Object.fromEntries([1, 2, 3, 4, 5, 6].map(function (level) { return [ "H".concat(level), createStyledComponent({ element: 'h' + level, factoryStyles: function (theme) { return getHeadingStyle(theme, level); } }), ]; })); var H1 = Heading.H1, H2 = Heading.H2, H3 = Heading.H3, H4 = Heading.H4, H5 = Heading.H5, H6 = Heading.H6; export { H1, H2, H3, H4, H5, H6, Headline }; //# sourceMappingURL=heading.js.map