UNPKG

@antv/t8

Version:

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

48 lines (44 loc) 2.76 kB
'use strict'; var tslib = require('tslib'); var styledFactory = require('./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 tslib.__assign(tslib.__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h1 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h1 * lineHeight, "px"), margin: '26px 0 10px 0' }); case 2: return tslib.__assign(tslib.__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h2 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h2 * lineHeight, "px"), margin: '21px 0 5px 0' }); case 3: return tslib.__assign(tslib.__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h3 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h3 * lineHeight, "px"), margin: '16px 0 5px 0' }); case 4: return tslib.__assign(tslib.__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h4 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h4 * lineHeight, "px"), margin: '10px 0 5px 0' }); case 5: return tslib.__assign(tslib.__assign({}, baseStyle), { fontSize: "".concat(theme.fontSizeMultiples.h5 * fontSize, "px"), lineHeight: "".concat(theme.lineHeightMultiples.h5 * lineHeight, "px"), margin: '8px 0 5px 0' }); case 6: return tslib.__assign(tslib.__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 = styledFactory.createStyledComponent({ element: 'h1', factoryStyles: function (theme) { return (tslib.__assign(tslib.__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), styledFactory.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; exports.H1 = H1; exports.H2 = H2; exports.H3 = H3; exports.H4 = H4; exports.H5 = H5; exports.H6 = H6; exports.Headline = Headline; //# sourceMappingURL=heading.js.map