UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 3.1 kB
{"version":3,"file":"Pre.mjs","names":["Pre: FC<PreProps>","Highlighter","PreSingleLine: FC<SnippetProps>","Snippet","PreMermaid: FC<MermaidProps>","Mermaid"],"sources":["../../../src/mdx/mdxComponents/Pre.tsx"],"sourcesContent":["'use client';\n\nimport { createStaticStyles, cx } from 'antd-style';\nimport type { FC } from 'react';\n\nimport Highlighter, { type HighlighterProps } from '@/Highlighter';\nimport { FALLBACK_LANG } from '@/Highlighter/const';\nimport Mermaid, { type MermaidProps } from '@/Mermaid';\nimport Snippet, { type SnippetProps } from '@/Snippet';\n\nconst styles = createStaticStyles(({ css }) => ({\n container: css`\n overflow: hidden;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color) inset;\n `,\n}));\n\nexport type PreProps = HighlighterProps;\n\nexport const Pre: FC<PreProps> = ({\n fullFeatured,\n fileName,\n allowChangeLanguage,\n language = FALLBACK_LANG,\n children,\n className,\n style,\n variant = 'filled',\n icon,\n theme,\n ...rest\n}) => {\n return (\n <Highlighter\n allowChangeLanguage={allowChangeLanguage}\n className={cx(styles.container, className)}\n fileName={fileName}\n fullFeatured={fullFeatured}\n icon={icon}\n language={language}\n style={style}\n theme={theme}\n variant={variant}\n {...rest}\n >\n {children}\n </Highlighter>\n );\n};\n\nexport const PreSingleLine: FC<SnippetProps> = ({\n language = FALLBACK_LANG,\n children,\n className,\n style,\n variant = 'filled',\n ...rest\n}) => {\n return (\n <Snippet\n className={cx(styles.container, className)}\n data-code-type=\"highlighter\"\n language={language}\n style={style}\n variant={variant}\n {...rest}\n >\n {children}\n </Snippet>\n );\n};\n\nexport const PreMermaid: FC<MermaidProps> = ({\n animated,\n fullFeatured,\n children,\n className,\n style,\n variant = 'filled',\n theme,\n ...rest\n}) => {\n return (\n <Mermaid\n animated={animated}\n className={cx(styles.container, className)}\n fullFeatured={fullFeatured}\n style={style}\n theme={theme}\n variant={variant}\n {...rest}\n >\n {children}\n </Mermaid>\n );\n};\n\nPre.displayName = 'MdxPre';\n\nexport default Pre;\n"],"mappings":";;;;;;;;;;AAUA,MAAM,SAAS,oBAAoB,EAAE,kBAAW,EAC9C,WAAW,KAAG;;;;;KAMf,EAAE;AAIH,MAAaA,OAAqB,EAChC,cACA,UACA,qBACA,WAAW,eACX,UACA,WACA,OACA,UAAU,UACV,MACA,OACA,GAAG,WACC;AACJ,QACE,oBAACC;EACsB;EACrB,WAAW,GAAG,OAAO,WAAW,UAAU;EAChC;EACI;EACR;EACI;EACH;EACA;EACE;EACT,GAAI;EAEH;GACW;;AAIlB,MAAaC,iBAAmC,EAC9C,WAAW,eACX,UACA,WACA,OACA,UAAU,UACV,GAAG,WACC;AACJ,QACE,oBAACC;EACC,WAAW,GAAG,OAAO,WAAW,UAAU;EAC1C,kBAAe;EACL;EACH;EACE;EACT,GAAI;EAEH;GACO;;AAId,MAAaC,cAAgC,EAC3C,UACA,cACA,UACA,WACA,OACA,UAAU,UACV,OACA,GAAG,WACC;AACJ,QACE,oBAACC;EACW;EACV,WAAW,GAAG,OAAO,WAAW,UAAU;EAC5B;EACP;EACA;EACE;EACT,GAAI;EAEH;GACO;;AAId,IAAI,cAAc;AAElB,kBAAe"}