UNPKG

@twind/preset-typography

Version:

A twind preset that provides a set of `prose` classes you can use to add beautiful typographic defaults to any vanilla HTML you don't control, like HTML rendered from Markdown, or pulled from a CMS.

1 lines 33.1 kB
{"version":3,"file":"preset-typography.dev.cjs","sources":["../src/index.ts"],"sourcesContent":["import { DEV } from 'distilt/env'\nimport {\n CSSNested,\n Preset,\n CustomProperties,\n CSSObject,\n Context,\n BaseTheme,\n ColorValue,\n RuleResolver,\n AutocompleteProvider,\n withAutocomplete,\n} from '@twind/core'\nimport { toColorValue } from '@twind/core'\n\ndeclare module '@twind/core' {\n export interface CustomProperties {\n '--tw-prose-body'?: string\n '--tw-prose-lead'?: string\n '--tw-prose-headings'?: string\n '--tw-prose-links'?: string\n '--tw-prose-bold'?: string\n '--tw-prose-counters'?: string\n '--tw-prose-bullets'?: string\n '--tw-prose-hr'?: string\n '--tw-prose-quote-borders'?: string\n '--tw-prose-captions'?: string\n '--tw-prose-code'?: string\n '--tw-prose-pre-code'?: string\n '--tw-prose-pre-bg'?: string\n '--tw-prose-th-borders'?: string\n '--tw-prose-td-borders'?: string\n }\n}\n\nexport type FontSizeValue =\n | string\n | [size: string, lineHeight: string]\n | [size: string, options: { lineHeight?: string; letterSpacing?: string }]\n\nexport interface TypographyTheme extends BaseTheme {\n fontSize: Record<string, FontSizeValue>\n}\n\nexport interface TypographyOptions {\n /**\n * The class name to use the typographic utilities.\n * To undo the styles to the elements, use it like\n * `not-${className}` which is by default `not-prose`.\n *\n * Note: `not` utility is only available in class.\n *\n * @defaultValue `prose`\n */\n className?: string\n\n /**\n * Default color to use.\n *\n * @defaultValue 'gray'\n */\n defaultColor?: string\n\n colors?: {\n /**\n * @defaultValue '700'\n */\n body?: string\n /**\n * @defaultValue '900'\n */\n headings?: string\n /**\n * @defaultValue '600'\n */\n lead?: string\n /**\n * @defaultValue '900'\n */\n links?: string\n /**\n * @defaultValue '900'\n */\n bold?: string\n /**\n * @defaultValue '500'\n */\n counters?: string\n /**\n * @defaultValue '300'\n */\n bullets?: string\n /**\n * @defaultValue '200'\n */\n hr?: string\n /**\n * @defaultValue '900'\n */\n quotes?: string\n /**\n * @defaultValue '200'\n */\n 'quote-borders'?: string\n /**\n * @defaultValue '500'\n */\n captions?: string\n /**\n * @defaultValue '900'\n */\n code?: string\n /**\n * @defaultValue '200'\n */\n 'pre-code'?: string\n /**\n * @defaultValue '800'\n */\n 'pre-bg'?: string\n /**\n * @defaultValue '300'\n */\n 'th-borders'?: string\n /**\n * @defaultValue '200'\n */\n 'td-borders'?: string\n // invert colors (dark mode)\n dark?:\n | null\n | undefined\n | {\n /**\n * @defaultValue '300'\n */\n body?: string\n /**\n * @defaultValue '#fff'\n */\n headings?: string\n /**\n * @defaultValue '400'\n */\n lead?: string\n /**\n * @defaultValue '#fff'\n */\n links?: string\n /**\n * @defaultValue '#fff'\n */\n bold?: string\n /**\n * @defaultValue '400'\n */\n counters?: string\n /**\n * @defaultValue '600'\n */\n bullets?: string\n /**\n * @defaultValue '700'\n */\n hr?: string\n /**\n * @defaultValue '100'\n */\n quotes?: string\n /**\n * @defaultValue '700'\n */\n 'quote-borders'?: string\n /**\n * @defaultValue '400'\n */\n captions?: string\n /**\n * @defaultValue '#fff'\n */\n code?: string\n /**\n * @defaultValue '300'\n */\n 'pre-code'?: string\n /**\n * @defaultValue 'rgb(0 0 0 / 50%)'\n */\n 'pre-bg'?: string\n /**\n * @defaultValue '600'\n */\n 'th-borders'?: string\n /**\n * @defaultValue '700'\n */\n 'td-borders'?: string\n }\n }\n\n /**\n * Extend or override CSS selectors with CSS declaration block.\n *\n * @defaultValue undefined\n */\n extend?: CSSNested\n}\n\n// indirection wrapper to remove autocomplete functions from production bundles\nfunction withAutocomplete$(\n resolver: RuleResolver<TypographyTheme>,\n autocomplete: AutocompleteProvider<TypographyTheme> | false,\n): RuleResolver<TypographyTheme> {\n if (DEV) {\n return withAutocomplete(resolver, autocomplete)\n }\n\n return resolver\n}\n\n/**\n * Twind Preset for Typography\n *\n * ```js\n * // twind.config.js\n * import { defineConfig } from '@twind/core'\n * import presetTypography from '@twind/preset-typography'\n *\n * export default defineConfig({\n * presets: [\n * presetTypography(),\n * ],\n * })\n * ```\n *\n * @returns typography preset\n */\nexport default function presetTypography({\n className = 'prose',\n defaultColor = 'gray',\n extend = {},\n colors = {},\n}: TypographyOptions = {}): Preset<TypographyTheme> {\n colors = {\n body: '700',\n headings: '900',\n lead: '600',\n links: '900',\n bold: '900',\n counters: '500',\n bullets: '300',\n hr: '200',\n quotes: '900',\n 'quote-borders': '200',\n captions: '500',\n code: '900',\n 'pre-code': '200',\n 'pre-bg': '800',\n 'th-borders': '300',\n 'td-borders': '200',\n ...colors,\n // invert colors (dark mode)\n dark:\n colors.dark === null\n ? null\n : {\n body: '300',\n headings: '#fff',\n lead: '400',\n links: '#fff',\n bold: '#fff',\n counters: '400',\n bullets: '600',\n hr: '700',\n quotes: '100',\n 'quote-borders': '700',\n captions: '400',\n code: '#fff',\n 'pre-code': '300',\n 'pre-bg': 'rgb(0 0 0 / 50%)',\n 'th-borders': '600',\n 'td-borders': '700',\n ...colors.dark,\n },\n }\n return {\n // for element modifiers: prose-img:rounded-xl, prose-headings\n // & :is()\n // & :is(:where(code):not(:where([class~=\"not-prose\"] *)))\n\n variants: [\n ['headings', 'h1,h2,h3,h4,h5,h6,th'],\n ['h1'],\n ['h2'],\n ['h3'],\n ['h4'],\n ['h5'],\n ['h6'],\n ['p'],\n ['a'],\n ['blockquote'],\n ['figure'],\n ['figcaption'],\n ['strong'],\n ['em'],\n ['code'],\n ['pre'],\n ['ol'],\n ['ul'],\n ['li'],\n ['table'],\n ['thead'],\n ['tr'],\n ['th'],\n ['td'],\n ['img'],\n ['video'],\n ['hr'],\n ['lead', '.lead'],\n ].map(([name, selector = name]) => [\n `${className}-${name}`,\n (_, context) =>\n adjustSelector(\n className,\n selector[0] == '.' ? '.' + context.e(context.h(selector.slice(1))) : selector,\n context,\n (selector) => `& :is(${selector.trim()})`,\n ),\n ]),\n\n rules: [\n // marker classes lead and not-prose\n [`(lead|not-${className})`, ({ 1: $1 }, { h }) => [{ c: h($1) }]],\n\n [\n `${className}-invert`,\n {\n '@layer base': {\n '--tw-prose-body': 'var(--tw-prose-invert-body)',\n '--tw-prose-headings': 'var(--tw-prose-invert-headings)',\n '--tw-prose-lead': 'var(--tw-prose-invert-lead)',\n '--tw-prose-links': 'var(--tw-prose-invert-links)',\n '--tw-prose-bold': 'var(--tw-prose-invert-bold)',\n '--tw-prose-counters': 'var(--tw-prose-invert-counters)',\n '--tw-prose-bullets': 'var(--tw-prose-invert-bullets)',\n '--tw-prose-hr': 'var(--tw-prose-invert-hr)',\n '--tw-prose-quotes': 'var(--tw-prose-invert-quotes)',\n '--tw-prose-quote-borders': 'var(--tw-prose-invert-quote-borders)',\n '--tw-prose-captions': 'var(--tw-prose-invert-captions)',\n '--tw-prose-code': 'var(--tw-prose-invert-code)',\n '--tw-prose-pre-code': 'var(--tw-prose-invert-pre-code)',\n '--tw-prose-pre-bg': 'var(--tw-prose-invert-pre-bg)',\n '--tw-prose-th-borders': 'var(--tw-prose-invert-th-borders)',\n '--tw-prose-td-borders': 'var(--tw-prose-invert-td-borders)',\n },\n },\n ],\n\n // for type scale: prose-xl\n [\n className + '-',\n withAutocomplete$(({ $$ }, context) => {\n const css = getFontSize(context.theme('fontSize', $$))\n return css && { '@layer components': css }\n }, DEV && ((_, { theme }) => Object.keys(theme('fontSize')))),\n ],\n\n // for colors: prose-sky\n [\n className + '-',\n withAutocomplete$(\n ({ $$ }, context) => getColors($$, context),\n DEV &&\n ((_, { theme }) =>\n Object.keys(theme('colors')).filter(\n (key) => key && key != 'DEFAULT' && !/[.-]/.test(key),\n )),\n ),\n ],\n\n // prose\n [\n className,\n (_, context) =>\n ({\n // layer defaults\n ...getColors(defaultColor, context),\n '@layer base': [\n adjustSelectors(className, context, {\n a: {\n color: 'var(--tw-prose-links)',\n textDecorationLine: 'underline',\n fontWeight: '500',\n },\n strong: {\n color: 'var(--tw-prose-bold)',\n fontWeight: '600',\n },\n 'a strong,blockquote strong,thead th strong': {\n color: 'inherit',\n },\n ul: {\n listStyleType: 'disc',\n },\n ol: {\n listStyleType: 'decimal',\n },\n 'ol[type=\"A\"]': {\n listStyleType: 'upper-alpha',\n },\n 'ol[type=\"a\"]': {\n listStyleType: 'lower-alpha',\n },\n 'ol[type=\"A\" s]': {\n listStyleType: 'upper-alpha',\n },\n 'ol[type=\"a\" s]': {\n listStyleType: 'lower-alpha',\n },\n 'ol[type=\"I\"]': {\n listStyleType: 'upper-roman',\n },\n 'ol[type=\"i\"]': {\n listStyleType: 'lower-roman',\n },\n 'ol[type=\"I\" s]': {\n listStyleType: 'upper-roman',\n },\n 'ol[type=\"i\" s]': {\n listStyleType: 'lower-roman',\n },\n 'ol[type=\"1\"]': {\n listStyleType: 'decimal',\n },\n 'ol,ul': {\n marginTop: em(20, 16),\n marginBottom: em(20, 16),\n paddingLeft: em(26, 16),\n },\n li: {\n marginTop: em(8, 16),\n marginBottom: em(8, 16),\n },\n 'ol>li,ul>li': {\n paddingLeft: em(6, 16),\n },\n '>ul>li p': {\n marginTop: em(12, 16),\n marginBottom: em(12, 16),\n },\n '>ul>li>*:first-child,>ol>li>*:last-child': {\n marginTop: em(20, 16),\n },\n '>ul>li>*:last-child,>ol>li>*:last-child': {\n marginBottom: em(20, 16),\n },\n 'ol>li::marker': {\n fontWeight: '400',\n color: 'var(--tw-prose-counters)',\n },\n 'ul>li::marker': {\n color: 'var(--tw-prose-bullets)',\n },\n 'ul ul,ul ol,ol ul,ol ol': {\n marginTop: em(12, 16),\n marginBottom: em(12, 16),\n },\n hr: {\n borderColor: 'var(--tw-prose-hr)',\n borderTopWidth: '1',\n marginTop: em(48, 16),\n marginBottom: em(48, 16),\n },\n blockquote: {\n marginTop: em(32, 20),\n marginBottom: em(32, 20),\n paddingLeft: em(20, 20),\n fontWeight: '500',\n fontStyle: 'italic',\n color: 'var(--tw-prose-quotes)',\n borderLeftWidth: '0.25rem',\n borderLeftColor: 'var(--tw-prose-quote-borders)',\n quotes: '\"\\\\201C\"\"\\\\201D\"\"\\\\2018\"\"\\\\2019\"',\n },\n 'blockquote p:first-of-type::before': {\n content: 'open-quote',\n },\n 'blockquote p:last-of-type::after': {\n content: 'close-quote',\n },\n p: {\n marginTop: em(20, 16),\n marginBottom: em(20, 16),\n },\n h1: {\n color: 'var(--tw-prose-headings)',\n fontWeight: '800',\n fontSize: em(36, 16),\n marginTop: '0',\n marginBottom: em(32, 36),\n lineHeight: 1.15,\n },\n 'h1 strong': {\n fontWeight: '900',\n color: 'inherit',\n },\n h2: {\n color: 'var(--tw-prose-headings)',\n fontWeight: '700',\n fontSize: em(24, 16),\n marginTop: em(48, 24),\n marginBottom: em(24, 24),\n lineHeight: '1.35',\n },\n 'h2 strong': {\n fontWeight: '800',\n color: 'inherit',\n },\n h3: {\n color: 'var(--tw-prose-headings)',\n fontWeight: '600',\n fontSize: em(20, 16),\n marginTop: em(32, 20),\n marginBottom: em(12, 20),\n lineHeight: '1.6',\n },\n 'h3 strong': {\n fontWeight: '700',\n color: 'inherit',\n },\n h4: {\n color: 'var(--tw-prose-headings)',\n fontWeight: '600',\n marginTop: em(24, 16),\n marginBottom: em(8, 16),\n lineHeight: '1.5',\n },\n 'h4 strong': {\n fontWeight: '700',\n color: 'inherit',\n },\n 'hr+*,h2+*,h3+*,h4+*': {\n marginTop: '0',\n },\n 'img,video,figure': {\n marginTop: em(32, 16),\n marginBottom: em(32, 16),\n },\n 'figure>*': {\n marginTop: '0',\n marginBottom: '0',\n },\n figcaption: {\n color: 'var(--tw-prose-captions)',\n fontSize: em(14, 16),\n lineHeight: '1.4',\n marginTop: em(12, 14),\n },\n code: {\n color: 'var(--tw-prose-code)',\n fontWeight: '600',\n fontSize: em(14, 16),\n },\n 'code::before,code::after': {\n content: '\"`\"',\n },\n 'h2 code': {\n fontSize: em(21, 24),\n },\n 'h3 code': {\n fontSize: em(18, 20),\n },\n 'a code,h1 code,h2 code,h3 code,h4 code,blockquote code,thead th code': {\n color: 'inherit',\n },\n pre: {\n color: 'var(--tw-prose-pre-code)',\n backgroundColor: 'var(--tw-prose-pre-bg)',\n overflowX: 'auto',\n fontWeight: '400',\n fontSize: em(14, 16),\n lineHeight: '1.7',\n marginTop: em(24, 14),\n marginBottom: em(24, 14),\n borderRadius: '0.375rem',\n paddingTop: em(12, 14),\n paddingRight: em(16, 14),\n paddingBottom: em(12, 14),\n paddingLeft: em(16, 14),\n },\n 'pre code': {\n backgroundColor: 'transparent',\n borderWidth: '0',\n borderRadius: '0',\n padding: '0',\n fontWeight: 'inherit',\n color: 'inherit',\n fontSize: 'inherit',\n fontFamily: 'inherit',\n lineHeight: 'inherit',\n },\n 'pre code::before': {\n content: 'none',\n },\n 'pre code::after': {\n content: 'none',\n },\n table: {\n width: '100%',\n tableLayout: 'auto',\n textAlign: 'left',\n marginTop: em(32, 16),\n marginBottom: em(32, 16),\n fontSize: em(14, 16),\n lineHeight: '1.7',\n },\n thead: {\n borderBottomWidth: '1px',\n borderBottomColor: 'var(--tw-prose-th-borders)',\n },\n 'thead th': {\n color: 'var(--tw-prose-headings)',\n fontWeight: '600',\n verticalAlign: 'bottom',\n paddingRight: em(8, 14),\n paddingBottom: em(8, 14),\n paddingLeft: em(8, 14),\n },\n 'thead th:first-child': {\n paddingLeft: '0',\n },\n 'thead th:last-child': {\n paddingRight: '0',\n },\n 'tbody tr': {\n borderBottomWidth: '1px',\n borderBottomColor: 'var(--tw-prose-td-borders)',\n },\n 'tbody tr:last-child': {\n borderBottomWidth: '0',\n },\n 'tbody td,tfoot td': {\n verticalAlign: 'baseline',\n paddingTop: em(8, 14),\n paddingRight: em(8, 14),\n paddingBottom: em(8, 14),\n paddingLeft: em(8, 14),\n },\n 'tbody td:first-child,tfoot td:first-child': {\n paddingLeft: '0',\n },\n 'tbody td:last-child,tfoot td:last-child': {\n paddingRight: '0',\n },\n [`.${context.e(context.h('lead'))}`]: {\n color: 'var(--tw-prose-lead)',\n fontSize: em(20, 16),\n lineHeight: '1.6',\n marginTop: em(24, 20),\n marginBottom: em(24, 20),\n },\n '>:first-child': {\n marginTop: '0',\n },\n '>:last-child': {\n marginBottom: '0',\n },\n }),\n adjustSelectors(className, context, extend),\n ],\n '@layer components': {\n ...getFontSize(context.theme('fontSize', 'base')),\n color: 'var(--tw-prose-body)',\n maxWidth: 'theme(max-w.prose, 65ch)',\n },\n } as CSSObject),\n ],\n ],\n }\n\n function getColors<Theme extends BaseTheme>(\n colorName: string,\n context: Context<Theme>,\n ): CSSObject | undefined {\n const properties: CustomProperties = {}\n const darkProperties: CustomProperties = {}\n\n const set = (key: string, shade: string, target: CustomProperties) => {\n const color = context.theme(`colors.${colorName}.${shade}`, shade) as ColorValue\n\n target[('--tw-prose-' + key) as keyof CustomProperties] = toColorValue(color)\n\n // support auto dark colors\n const darkColor =\n target != darkProperties && context.d('colors', `${colorName}-${shade}`, color)\n\n if (darkColor) {\n darkProperties[('--tw-prose-' + key) as keyof CustomProperties] = toColorValue(darkColor)\n }\n }\n\n for (const key in colors) {\n const shade = colors[key as keyof typeof colors]\n\n if (key != 'dark' && shade) {\n set(key, shade as string, properties)\n }\n }\n\n for (const key in colors.dark || {}) {\n const shade = (colors.dark as Record<string, string>)[key]\n\n if (shade) {\n if (colors.dark) {\n // explicit dark colors - need to use `dark:prose-invert`\n set('invert-' + key, shade, properties)\n } else {\n // auto dark colors\n set(key, shade, darkProperties)\n }\n }\n }\n\n return Object.keys(properties).length\n ? ({\n '@layer defaults': {\n '&': properties,\n [context.v('dark') as string]: darkProperties,\n } as CSSNested,\n } as CSSObject)\n : undefined\n }\n}\n\nfunction adjustSelectors<Theme extends BaseTheme>(\n className: string,\n context: Context<Theme>,\n css: CSSNested,\n): CSSNested {\n const result: CSSNested = {}\n\n for (const selector in css) {\n result[\n adjustSelector(\n className,\n selector,\n context,\n (selector) => `.${context.e(context.h(className))}${selector}`,\n )\n ] = css[selector]\n }\n\n return result\n}\n\nfunction adjustSelector<Theme extends BaseTheme>(\n className: string,\n selector: string,\n { e, h }: Context<Theme>,\n replace: (selector: string) => string,\n): string {\n // pseudo elements can't be matched\n return selector.replace(\n // 1. if there no pseudo use whole selector\n // 2. if there are pseudo replace prefix\n /^[^>:]+$|(>)?((?:[^:,]+(?::[\\w-]+)?)|:[\\w-]+)(::[\\w-]+)?/g,\n (_, prefix = ' ', selector = _, pseudoElement = '') =>\n replace(\n `${prefix}:where(${selector}):not(:where(.${e(h('not-' + className))} *))${pseudoElement}`,\n ),\n )\n}\n\nfunction getFontSize(_: FontSizeValue | undefined): CSSObject | undefined {\n return _\n ? typeof _ == 'string'\n ? { fontSize: _ }\n : {\n fontSize: _[0],\n ...(typeof _[1] == 'string' ? { lineHeight: _[1] } : _[1]),\n }\n : undefined\n}\n\nfunction em(px: number, base: number) {\n return `${(px / base).toFixed(3).replace(/^0|\\.?0+$/g, '')}em`\n}\n"],"names":["withAutocomplete$","resolver","autocomplete","withAutocomplete","adjustSelectors","className","context","css","result","selector","adjustSelector","e","h","replace","_","prefix","pseudoElement","getFontSize","fontSize","lineHeight","undefined","em","px","base","toFixed","defaultColor","extend","colors","body","headings","lead","links","bold","counters","bullets","hr","quotes","captions","code","dark","variants","map","name","slice","trim","rules","$1","c","$$","theme","Object","keys","getColors","filter","key","test","a","color","textDecorationLine","fontWeight","strong","ul","listStyleType","ol","marginTop","marginBottom","paddingLeft","li","borderColor","borderTopWidth","blockquote","fontStyle","borderLeftWidth","borderLeftColor","content","p","h1","h2","h3","h4","figcaption","pre","backgroundColor","overflowX","borderRadius","paddingTop","paddingRight","paddingBottom","borderWidth","padding","fontFamily","table","width","tableLayout","textAlign","thead","borderBottomWidth","borderBottomColor","verticalAlign","maxWidth","colorName","properties","darkProperties","set","shade","target","toColorValue","darkColor","d","length","v"],"mappings":";;AA6CE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiFG,GAAA,4BAAA;AAOK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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