@ai-react-markdown/mantine 1.1.0 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -5
- package/dist/index.cjs +226 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +29 -51
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +2 -13
- package/dist/index.d.ts +2 -13
- package/dist/index.js +224 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/hooks/useMantineAIMarkdownRenderState.ts","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/defs.tsx","../src/components/customized/PreCode.tsx","../src/components/customized/MermaidCode/index.tsx","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["/**\n * Main Mantine integration component for AI markdown rendering.\n *\n * Wraps the core {@link AIMarkdown} component with Mantine-specific defaults:\n * - {@link MantineAIMarkdownTypography} as the typography wrapper\n * - {@link MantineAIMDefaultExtraStyles} as the extra styles wrapper\n * - {@link MantineAIMPreCode} as the default `<pre>` component (with syntax\n * highlighting via Mantine's CodeHighlight and mermaid diagram support)\n * - Automatic color scheme detection via Mantine's `useComputedColorScheme`\n *\n * @module MantineAIMarkdown\n */\n\nimport { memo, useMemo } from 'react';\nimport AIMarkdown from '@ai-react-markdown/core';\nimport { type AIMarkdownProps, type AIMarkdownCustomComponents, useStableValue } from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata, defaultMantineAIMarkdownRenderConfig } from './defs';\nimport MantineAIMPreCode from './components/customized/PreCode';\nimport { useComputedColorScheme } from '@mantine/core';\n\n/**\n * Props for the {@link MantineAIMarkdown} component.\n *\n * Extends {@link AIMarkdownProps} with Mantine-specific config and metadata generics.\n * All core props (`content`, `streaming`, `fontSize`, `config`, etc.) are inherited.\n *\n * @typeParam TConfig - Render configuration type, defaults to {@link MantineAIMarkdownRenderConfig}.\n * @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TConfig, TRenderData> {}\n\n/**\n * Default custom component overrides applied by the Mantine integration.\n *\n * Overrides the `<pre>` element to extract code blocks and render them via\n * {@link MantineAIMPreCode}, which provides syntax highlighting, expand/collapse,\n * and mermaid diagram support. Falls back to a plain `<pre>` when the child\n * is not a recognized code element.\n */\nconst DefaultCustomComponents: AIMarkdownCustomComponents = {\n pre: ({ node, ...usefulProps }) => {\n const code = node?.children[0] as\n | { type: string; tagName?: string; position?: { start?: { offset?: number } }; properties?: Record<string, unknown>; children: { value?: string }[] }\n | undefined;\n if (!code || code.type !== 'element' || code.tagName !== 'code' || !code.position) {\n return <pre {...usefulProps} />;\n }\n const key = `pre-code-${node?.position?.start?.offset || 0}`;\n const detectedLanguage = (code.properties?.className as string[])\n ?.find((className: string) => className.startsWith('language-'))\n ?.substring('language-'.length);\n const codeText = code.children\n .map((child: { value?: string }) => child.value ?? '')\n .join('\\n');\n return <MantineAIMPreCode key={key} codeText={codeText} existLanguage={detectedLanguage} />;\n },\n};\n\n/**\n * Inner (non-memoized) implementation of the Mantine AI markdown component.\n *\n * Merges caller-provided `customComponents` with the Mantine defaults (the caller's\n * overrides take precedence). Automatically resolves the color scheme from Mantine's\n * `useComputedColorScheme` when no explicit `colorScheme` prop is provided.\n *\n * @typeParam TConfig - Render configuration type.\n * @typeParam TRenderData - Metadata type.\n */\nconst MantineAIMarkdownComponent = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n defaultConfig = defaultMantineAIMarkdownRenderConfig as TConfig,\n customComponents,\n colorScheme,\n ...props\n}: MantineAIMarkdownProps<TConfig, TRenderData>) => {\n const stableCustomComponents = useStableValue(customComponents);\n\n const usedComponents = useMemo(() => {\n return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;\n }, [stableCustomComponents]);\n\n const computedColorScheme = useComputedColorScheme('light');\n\n return (\n <AIMarkdown<MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n defaultConfig={defaultConfig}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n );\n};\n\n/**\n * Mantine-integrated AI markdown renderer.\n *\n * A memoized wrapper around the core `<AIMarkdown>` component that provides\n * Mantine-themed typography, code highlighting (via `@mantine/code-highlight`),\n * mermaid diagram rendering, and automatic color scheme detection.\n *\n * This is the default export of `@ai-react-markdown/mantine`.\n *\n * @example\n * ```tsx\n * import MantineAIMarkdown from '@ai-react-markdown/mantine';\n *\n * function Chat({ content }: { content: string }) {\n * return <MantineAIMarkdown content={content} />;\n * }\n * ```\n */\nexport const MantineAIMarkdown = memo(MantineAIMarkdownComponent);\n\nMantineAIMarkdown.displayName = 'MantineAIMarkdown';\n\nexport default MantineAIMarkdown as typeof MantineAIMarkdownComponent;\n","import { memo } from 'react';\nimport { Typography } from '@mantine/core';\nimport type { AIMarkdownTypographyProps } from '@ai-react-markdown/core';\n\n/**\n * Mantine-themed typography wrapper for AI markdown content.\n *\n * Replaces the core default typography component with Mantine's `<Typography>`\n * element, applying the configured `fontSize` at full width. This ensures all\n * rendered markdown inherits Mantine's font family, line height, and theming.\n *\n * Used as the default `Typography` prop in {@link MantineAIMarkdown}.\n * Can be replaced by passing a custom `Typography` component.\n *\n * @param props - Standard {@link AIMarkdownTypographyProps} from the core package.\n */\nconst MantineAIMarkdownTypography = memo(({ children, fontSize }: AIMarkdownTypographyProps) => (\n <Typography w=\"100%\" fz={fontSize}>\n {children}\n </Typography>\n));\n\nMantineAIMarkdownTypography.displayName = 'MantineAIMarkdownTypography';\n\nexport default MantineAIMarkdownTypography;\n","import { useAIMarkdownRenderState } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownRenderConfig } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownRenderState} hook.\n *\n * Returns the current {@link AIMarkdownRenderState} defaulting to\n * {@link MantineAIMarkdownRenderConfig}. Accepts an optional generic parameter\n * for further extension, giving consumers direct access to Mantine-specific\n * config fields (`forceSameFontSize`, `codeBlock`, etc.) without manual annotation.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n * Throws if called outside the provider boundary.\n *\n * @typeParam TConfig - Config type (defaults to {@link MantineAIMarkdownRenderConfig}).\n * @returns The current render state typed with `TConfig`.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();\n * const isExpanded = config.codeBlock.defaultExpanded;\n * // ...\n * }\n * ```\n */\nexport const useMantineAIMarkdownRenderState = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n>() => {\n return useAIMarkdownRenderState<TConfig>();\n};\n","import { AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Default extra styles wrapper for the Mantine integration.\n *\n * Wraps markdown content in a `<div>` with the `aim-mantine-extra-styles` CSS class,\n * which provides Mantine-compatible typography overrides including:\n * - Relative `em`-based Mantine spacing and font-size CSS custom properties\n * - Heading, list, paragraph, blockquote, and code styling\n * - Definition list layout\n *\n * When {@link MantineAIMarkdownRenderConfig.forceSameFontSize} is enabled, the\n * `same-font-size` class is appended, overriding all heading levels to render\n * at the same size as body text.\n *\n * Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}.\n */\nconst MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent = ({ children }) => {\n const renderState = useMantineAIMarkdownRenderState();\n return (\n <div className={`aim-mantine-extra-styles${renderState.config.forceSameFontSize ? ' same-font-size' : ''}`}>\n {children}\n </div>\n );\n};\n\nexport default MantineAIMDefaultExtraStyles;\n","/**\n * Mantine-specific type definitions and default configuration.\n *\n * Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}\n * with Mantine-themed options such as uniform heading sizes and code block behavior.\n *\n * @module defs\n */\n\nimport { AIMarkdownRenderConfig, AIMarkdownMetadata, defaultAIMarkdownRenderConfig } from '@ai-react-markdown/core';\n\n/**\n * Extended render configuration for the Mantine integration.\n *\n * Inherits all core config fields (extra syntax, display optimizations) and adds\n * Mantine-specific options for typography sizing and code block behavior.\n */\nexport interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {\n /**\n * When `true`, all heading levels (h1-h6) are rendered at the same font size\n * as body text. Useful in compact UI contexts like chat bubbles.\n *\n * @default false\n */\n forceSameFontSize: boolean;\n\n /** Code block rendering options. */\n codeBlock: {\n /**\n * Whether code blocks start in their expanded state.\n * When `false`, long code blocks are collapsed with an expand button.\n *\n * @default true\n */\n defaultExpanded: boolean;\n\n /**\n * When `true`, uses `highlight.js` auto-detection to determine the language\n * of code blocks that lack an explicit language annotation.\n *\n * @default false\n */\n autoDetectUnknownLanguage: boolean;\n };\n}\n\n/**\n * Default Mantine render configuration.\n *\n * Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.\n * Frozen to prevent accidental mutation.\n */\nexport const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig = Object.freeze({\n ...defaultAIMarkdownRenderConfig,\n forceSameFontSize: false,\n codeBlock: Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\n }),\n});\n\n/**\n * Metadata type for the Mantine integration.\n *\n * Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point\n * so that consumers can augment metadata in Mantine-specific wrappers without\n * needing to reference the core type directly.\n */\nexport interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {}\n","'use client';\n\nimport { HTMLAttributes, memo, useMemo } from 'react';\nimport { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { deepParseJson } from 'deep-parse-json';\nimport hljs from 'highlight.js';\nimport { useMantineAIMarkdownRenderState } from '../../hooks/useMantineAIMarkdownRenderState';\nimport MantineAIMMermaidCode from './MermaidCode';\n\n/**\n * Code languages that receive specialized rendering instead of standard\n * syntax-highlighted code blocks. Adding a new member here automatically\n * marks that language as \"special\" — you only need to add the corresponding\n * rendering branch in the component's return.\n */\nenum SpecialCodeLanguage {\n /** Rendered as interactive diagrams via {@link MantineAIMMermaidCode} */\n Mermaid = 'mermaid',\n}\n\n/** O(1) lookup set, derived from {@link SpecialCodeLanguage}. */\nconst SPECIAL_LANGUAGES = new Set<string>(Object.values(SpecialCodeLanguage));\n\n/**\n * Mantine code block renderer for `<pre>` elements.\n *\n * Replaces the default `<pre>` rendering with Mantine's {@link CodeHighlight} or\n * {@link CodeHighlightTabs} components, providing syntax highlighting, expand/collapse\n * behavior, and file-name tabs.\n *\n * Behavior:\n * - If the code block has an explicit language annotation, uses that language.\n * - If no language is specified and `config.codeBlock.autoDetectUnknownLanguage` is\n * enabled, uses `highlight.js` auto-detection.\n * - Mermaid code blocks (`language-mermaid`) are rendered as interactive diagrams\n * via {@link MantineAIMMermaidCode}.\n * - JSON code blocks are deep-parsed and pretty-printed before display.\n * - Unrecognized languages render as plaintext with an \"unknown\" label using\n * {@link CodeHighlight} (no tabs).\n * - Recognized languages render with {@link CodeHighlightTabs} showing the\n * language name as the tab label.\n *\n * @param props.codeText - The raw text content of the code block.\n * @param props.existLanguage - Language identifier extracted from the `language-*` CSS class, if present.\n */\nconst MantineAIMPreCode = memo(\n (\n props: HTMLAttributes<HTMLPreElement> & {\n codeText: string;\n existLanguage?: string;\n }\n ) => {\n const renderState = useMantineAIMarkdownRenderState();\n\n const codeLanguage = useMemo(() => {\n if (props.existLanguage) return props.existLanguage;\n if (renderState.config.codeBlock.autoDetectUnknownLanguage) {\n return hljs.highlightAuto(props.codeText).language || '';\n }\n return '';\n }, [props.existLanguage, props.codeText, renderState.config.codeBlock.autoDetectUnknownLanguage]);\n\n const [usedCodeLanguage, usedFileName] = useMemo(() => {\n if (!codeLanguage) return ['plaintext', 'unknown'];\n if (!hljs.getLanguage(codeLanguage)) {\n return ['plaintext', codeLanguage];\n }\n return [codeLanguage, codeLanguage];\n }, [codeLanguage]);\n\n const isSpecialCodeBlock = SPECIAL_LANGUAGES.has(codeLanguage);\n\n const normalCodeBlockContent = useMemo(() => {\n if (isSpecialCodeBlock) return null;\n let usedCodeStr = props.codeText;\n if (usedCodeStr && usedCodeLanguage.toLowerCase() === 'json') {\n const deepParsedResult = deepParseJson(usedCodeStr);\n usedCodeStr =\n typeof deepParsedResult === 'string' ? deepParsedResult : JSON.stringify(deepParsedResult, null, 2);\n }\n return usedFileName === 'unknown' ? (\n <CodeHighlight\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [\n isSpecialCodeBlock,\n props.codeText,\n usedCodeLanguage,\n usedFileName,\n renderState.fontSize,\n renderState.config.codeBlock.defaultExpanded,\n ]);\n\n const specialCodeBlockContent = useMemo(() => {\n switch (codeLanguage) {\n case SpecialCodeLanguage.Mermaid:\n return <MantineAIMMermaidCode code={props.codeText} />;\n default:\n return null;\n }\n }, [codeLanguage, props.codeText]);\n\n return isSpecialCodeBlock ? specialCodeBlockContent : normalCodeBlockContent;\n }\n);\n\nMantineAIMPreCode.displayName = 'MantineAIMPreCode';\n\nexport default MantineAIMPreCode;\n","'use client';\n\nimport React, { memo, useMemo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport debounce from 'lodash-es/debounce';\nimport mermaid from 'mermaid';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Generate a unique ID for mermaid SVG rendering.\n * Combines a timestamp with a random suffix to avoid collisions when\n * multiple mermaid diagrams render concurrently.\n *\n * @returns A unique string in the format `mermaid-{timestamp}-{random}`.\n */\nconst generateMermaidUUID = () => {\n return `mermaid-${new Date().getTime()}-${Math.random().toString(36).slice(2, 10)}`;\n};\n\n/**\n * Open the rendered mermaid SVG in a new browser window.\n *\n * Clones the SVG element, applies a background color matching the current\n * color scheme, serializes it to an object URL, and opens it in a new tab.\n * The object URL is revoked after a short delay to free memory.\n *\n * @param svgElement - The rendered SVG element to view, or `null`/`undefined` to no-op.\n * @param isDark - Whether the current color scheme is dark (used for background color).\n */\nconst handleViewSVGInNewWindow = (svgElement: SVGElement | null | undefined, isDark: boolean) => {\n if (!svgElement) return;\n const targetSvg = svgElement.cloneNode(true) as SVGElement;\n targetSvg.style.backgroundColor = isDark ? '#242424' : 'white';\n const text = new XMLSerializer().serializeToString(targetSvg);\n const blob = new Blob([text], { type: 'image/svg+xml' });\n const url = URL.createObjectURL(blob);\n const win = window.open(url);\n if (win) {\n setTimeout(() => URL.revokeObjectURL(url), 5000);\n }\n};\n\n/**\n * Interactive mermaid diagram renderer.\n *\n * Parses and renders mermaid diagram source code into an inline SVG visualization.\n * Automatically adapts to the current Mantine color scheme (light/dark) by\n * re-initializing mermaid with the appropriate theme.\n *\n * Features:\n * - Live SVG rendering with automatic dark/light theme switching\n * - Fallback to raw source code display on parse/render errors\n * - Toggle between rendered diagram and raw mermaid source\n * - Click on the rendered diagram to open the SVG in a new browser window\n * - Copy button for the raw mermaid source code\n * - Chart type label extracted from mermaid's parse result\n * - Debounced error state to avoid flickering during rapid re-renders\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const renderState = useMantineAIMarkdownRenderState();\n const isDark = renderState.colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n const [renderError, setRenderError] = useState(false);\n const [chartType, setChartType] = useState('unknown');\n\n const debouncedUpdateRenderError = useMemo(\n () =>\n debounce((error: boolean) => {\n setRenderError(error);\n }, 200),\n []\n );\n\n useEffect(() => {\n return () => {\n debouncedUpdateRenderError.cancel();\n };\n }, [debouncedUpdateRenderError]);\n\n useEffect(() => {\n if (props.code && ref.current) {\n const renderMermaid = async () => {\n try {\n debouncedUpdateRenderError(false);\n if (ref.current) {\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'loose',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n });\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n const { svg, bindFunctions, diagramType } = await mermaid.render(\n generateMermaidUUID(),\n props.code,\n ref.current\n );\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n setChartType(diagramType);\n }\n } catch {\n debouncedUpdateRenderError(true);\n }\n };\n\n renderMermaid();\n }\n }, [props.code, isDark, showOriginalCode, debouncedUpdateRenderError]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, [isDark]);\n\n return (\n <>\n {(showOriginalCode || renderError) && (\n <CodeHighlightTabs\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={[\n {\n fileName: renderError ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n renderError\n ? []\n : [\n <CodeHighlightControl\n tooltipLabel=\"Render Mermaid\"\n key=\"gpt\"\n onClick={() => {\n setShowOriginalCode(false);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[gravity-ui--logo-mermaid] relative bottom-[1px] text-[16px]\"></span>\n </Flex>\n </CodeHighlightControl>,\n ]\n }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showOriginalCode || renderError\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{chartType}</div>\n <Flex align=\"center\" justify=\"flex-end\" gap={0}>\n <Tooltip label=\"Show Mermaid Code\">\n <ActionIcon\n size={28}\n className=\"action-icon\"\n variant=\"transparent\"\n onClick={() => {\n setShowOriginalCode(true);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[entypo--code] relative bottom-[0.25px] text-[16px]\"></span>\n </Flex>\n </ActionIcon>\n </Tooltip>\n <CopyButton value={props.code}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon variant=\"transparent\" size={28} className=\"action-icon\" onClick={copy}>\n {copied ? (\n <span className=\"icon-origin-[lucide--check] text-[18px]\"></span>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n width=\"18px\"\n height=\"18px\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\"></path>\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\"></path>\n </svg>\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Flex>\n </div>\n <pre\n ref={ref}\n style={{ cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' }}\n onClick={() => viewSvgInNewWindow()}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","import { useAIMarkdownMetadata } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownMetadata } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownMetadata} hook.\n *\n * Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}.\n * Accepts an optional generic parameter for further extension.\n *\n * Metadata lives in a separate React context from the render state, meaning\n * metadata updates do not trigger re-renders in components that only consume\n * render state.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n *\n * @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}).\n * @returns The current metadata, or `undefined` if none was provided.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const metadata = useMantineAIMarkdownMetadata();\n * // Access Mantine-specific metadata fields\n * }\n * ```\n */\nexport const useMantineAIMarkdownMetadata = <\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>() => {\n return useAIMarkdownMetadata<TMetadata>();\n};\n"],"mappings":";AAaA,SAAS,QAAAA,OAAM,WAAAC,gBAAe;AAC9B,OAAO,gBAAgB;AACvB,SAAgE,sBAAsB;;;ACftF,SA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1C;","names":["memo","useMemo","jsx","memo","useMemo","CodeHighlightTabs","memo","jsx","memo","jsx","SpecialCodeLanguage","memo","useMemo","CodeHighlightTabs","jsx","Typography","useMemo","memo"]}
|
|
1
|
+
{"version":3,"sources":["../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/defs.tsx","../src/components/customized/PreCode.tsx","../src/hooks/useMantineAIMarkdownRenderState.ts","../src/components/customized/MermaidCode/index.tsx","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/now.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/debounce.js","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["/**\n * Main Mantine integration component for AI markdown rendering.\n *\n * Wraps the core {@link AIMarkdown} component with Mantine-specific defaults:\n * - {@link MantineAIMarkdownTypography} as the typography wrapper\n * - {@link MantineAIMDefaultExtraStyles} as the extra styles wrapper\n * - {@link MantineAIMPreCode} as the default `<pre>` component (with syntax\n * highlighting via Mantine's CodeHighlight and mermaid diagram support)\n * - Automatic color scheme detection via Mantine's `useComputedColorScheme`\n *\n * @module MantineAIMarkdown\n */\n\nimport { memo, useMemo } from 'react';\nimport AIMarkdown from '@ai-react-markdown/core';\nimport { type AIMarkdownProps, type AIMarkdownCustomComponents, useStableValue } from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata, defaultMantineAIMarkdownRenderConfig } from './defs';\nimport MantineAIMPreCode from './components/customized/PreCode';\nimport { useComputedColorScheme } from '@mantine/core';\n\n/**\n * Props for the {@link MantineAIMarkdown} component.\n *\n * Extends {@link AIMarkdownProps} with Mantine-specific config and metadata generics.\n * All core props (`content`, `streaming`, `fontSize`, `config`, etc.) are inherited.\n *\n * @typeParam TConfig - Render configuration type, defaults to {@link MantineAIMarkdownRenderConfig}.\n * @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TConfig, TRenderData> {}\n\n/**\n * Default custom component overrides applied by the Mantine integration.\n *\n * Overrides the `<pre>` element to extract code blocks and render them via\n * {@link MantineAIMPreCode}, which provides syntax highlighting, expand/collapse,\n * and mermaid diagram support. Falls back to a plain `<pre>` when the child\n * is not a recognized code element.\n */\nconst DefaultCustomComponents: AIMarkdownCustomComponents = {\n pre: ({ node, ...usefulProps }) => {\n const code = node?.children[0] as\n | {\n type: string;\n tagName?: string;\n position?: { start?: { offset?: number } };\n properties?: Record<string, unknown>;\n children: { value?: string }[];\n }\n | undefined;\n if (!code || code.type !== 'element' || code.tagName !== 'code' || !code.position) {\n return <pre {...usefulProps} />;\n }\n const key = `pre-code-${node?.position?.start?.offset || 0}`;\n const detectedLanguage = (code.properties?.className as string[])\n ?.find((className: string) => className.startsWith('language-'))\n ?.substring('language-'.length);\n const codeText = code.children.map((child: { value?: string }) => child.value ?? '').join('\\n');\n return <MantineAIMPreCode key={key} codeText={codeText} existLanguage={detectedLanguage} />;\n },\n};\n\n/**\n * Inner (non-memoized) implementation of the Mantine AI markdown component.\n *\n * Merges caller-provided `customComponents` with the Mantine defaults (the caller's\n * overrides take precedence). Automatically resolves the color scheme from Mantine's\n * `useComputedColorScheme` when no explicit `colorScheme` prop is provided.\n *\n * @typeParam TConfig - Render configuration type.\n * @typeParam TRenderData - Metadata type.\n */\nconst MantineAIMarkdownComponent = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n defaultConfig = defaultMantineAIMarkdownRenderConfig as TConfig,\n customComponents,\n colorScheme,\n ...props\n}: MantineAIMarkdownProps<TConfig, TRenderData>) => {\n const stableCustomComponents = useStableValue(customComponents);\n\n const usedComponents = useMemo(() => {\n return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;\n }, [stableCustomComponents]);\n\n const computedColorScheme = useComputedColorScheme('light');\n\n return (\n <AIMarkdown<MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n defaultConfig={defaultConfig}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n );\n};\n\n/**\n * Mantine-integrated AI markdown renderer.\n *\n * A memoized wrapper around the core `<AIMarkdown>` component that provides\n * Mantine-themed typography, code highlighting (via `@mantine/code-highlight`),\n * mermaid diagram rendering, and automatic color scheme detection.\n *\n * This is the default export of `@ai-react-markdown/mantine`.\n *\n * @example\n * ```tsx\n * import MantineAIMarkdown from '@ai-react-markdown/mantine';\n *\n * function Chat({ content }: { content: string }) {\n * return <MantineAIMarkdown content={content} />;\n * }\n * ```\n */\nexport const MantineAIMarkdown = memo(MantineAIMarkdownComponent);\n\nMantineAIMarkdown.displayName = 'MantineAIMarkdown';\n\nexport default MantineAIMarkdown as typeof MantineAIMarkdownComponent;\n","import { memo } from 'react';\nimport { Typography } from '@mantine/core';\nimport type { AIMarkdownTypographyProps } from '@ai-react-markdown/core';\n\n/**\n * Mantine-themed typography wrapper for AI markdown content.\n *\n * Replaces the core default typography component with Mantine's `<Typography>`\n * element, applying the configured `fontSize` at full width. This ensures all\n * rendered markdown inherits Mantine's font family, line height, and theming.\n *\n * Used as the default `Typography` prop in {@link MantineAIMarkdown}.\n * Can be replaced by passing a custom `Typography` component.\n *\n * @param props - Standard {@link AIMarkdownTypographyProps} from the core package.\n */\nconst MantineAIMarkdownTypography = memo(({ children, fontSize, style }: AIMarkdownTypographyProps) => (\n <Typography w=\"100%\" fz={fontSize} style={style}>\n {children}\n </Typography>\n));\n\nMantineAIMarkdownTypography.displayName = 'MantineAIMarkdownTypography';\n\nexport default MantineAIMarkdownTypography;\n","import React from 'react';\nimport { AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';\nimport './styles.scss';\n\n/**\n * Default extra styles wrapper for the Mantine integration.\n *\n * Wraps markdown content in a `<div>` with the `aim-mantine-extra-styles` CSS class,\n * which provides Mantine-compatible typography overrides including:\n * - Relative `em`-based Mantine spacing and font-size CSS custom properties\n * - Heading, list, paragraph, blockquote, and code styling\n * - Definition list layout\n *\n * Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}.\n */\nconst MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent = ({ children }) => {\n return <div className=\"aim-mantine-extra-styles\">{children}</div>;\n};\n\nexport default MantineAIMDefaultExtraStyles;\n","/**\n * Mantine-specific type definitions and default configuration.\n *\n * Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}\n * with Mantine-themed options such as uniform heading sizes and code block behavior.\n *\n * @module defs\n */\n\nimport { AIMarkdownRenderConfig, AIMarkdownMetadata, defaultAIMarkdownRenderConfig } from '@ai-react-markdown/core';\n\n/**\n * Extended render configuration for the Mantine integration.\n *\n * Inherits all core config fields (extra syntax, display optimizations) and adds\n * Mantine-specific options for typography sizing and code block behavior.\n */\nexport interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {\n /** Code block rendering options. */\n codeBlock: {\n /**\n * Whether code blocks start in their expanded state.\n * When `false`, long code blocks are collapsed with an expand button.\n *\n * @default true\n */\n defaultExpanded: boolean;\n\n /**\n * When `true`, uses `highlight.js` auto-detection to determine the language\n * of code blocks that lack an explicit language annotation.\n *\n * @default false\n */\n autoDetectUnknownLanguage: boolean;\n };\n}\n\n/**\n * Default Mantine render configuration.\n *\n * Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.\n * Frozen to prevent accidental mutation.\n */\nexport const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig = Object.freeze({\n ...defaultAIMarkdownRenderConfig,\n codeBlock: Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\n }),\n});\n\n/**\n * Metadata type for the Mantine integration.\n *\n * Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point\n * so that consumers can augment metadata in Mantine-specific wrappers without\n * needing to reference the core type directly.\n */\nexport interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {}\n","'use client';\n\nimport { HTMLAttributes, memo, useMemo } from 'react';\nimport { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { deepParseJson } from 'deep-parse-json';\nimport hljs from 'highlight.js';\nimport { useMantineAIMarkdownRenderState } from '../../hooks/useMantineAIMarkdownRenderState';\nimport MantineAIMMermaidCode from './MermaidCode';\n\n/**\n * Code languages that receive specialized rendering instead of standard\n * syntax-highlighted code blocks. Adding a new member here automatically\n * marks that language as \"special\" — you only need to add the corresponding\n * rendering branch in the component's return.\n */\nenum SpecialCodeLanguage {\n /** Rendered as interactive diagrams via {@link MantineAIMMermaidCode} */\n Mermaid = 'mermaid',\n}\n\n/** O(1) lookup set, derived from {@link SpecialCodeLanguage}. */\nconst SPECIAL_LANGUAGES = new Set<string>(Object.values(SpecialCodeLanguage));\n\n/**\n * Mantine code block renderer for `<pre>` elements.\n *\n * Replaces the default `<pre>` rendering with Mantine's {@link CodeHighlight} or\n * {@link CodeHighlightTabs} components, providing syntax highlighting, expand/collapse\n * behavior, and file-name tabs.\n *\n * Behavior:\n * - If the code block has an explicit language annotation, uses that language.\n * - If no language is specified and `config.codeBlock.autoDetectUnknownLanguage` is\n * enabled, uses `highlight.js` auto-detection.\n * - Mermaid code blocks (`language-mermaid`) are rendered as interactive diagrams\n * via {@link MantineAIMMermaidCode}.\n * - JSON code blocks are deep-parsed and pretty-printed before display.\n * - Unrecognized languages render as plaintext with an \"unknown\" label using\n * {@link CodeHighlight} (no tabs).\n * - Recognized languages render with {@link CodeHighlightTabs} showing the\n * language name as the tab label.\n *\n * @param props.codeText - The raw text content of the code block.\n * @param props.existLanguage - Language identifier extracted from the `language-*` CSS class, if present.\n */\nconst MantineAIMPreCode = memo(\n (\n props: HTMLAttributes<HTMLPreElement> & {\n codeText: string;\n existLanguage?: string;\n }\n ) => {\n const renderState = useMantineAIMarkdownRenderState();\n\n const codeLanguage = useMemo(() => {\n if (props.existLanguage) return props.existLanguage;\n if (renderState.config.codeBlock.autoDetectUnknownLanguage) {\n return hljs.highlightAuto(props.codeText).language || '';\n }\n return '';\n }, [props.existLanguage, props.codeText, renderState.config.codeBlock.autoDetectUnknownLanguage]);\n\n const [usedCodeLanguage, usedFileName] = useMemo(() => {\n if (!codeLanguage) return ['plaintext', 'unknown'];\n if (!hljs.getLanguage(codeLanguage)) {\n return ['plaintext', codeLanguage];\n }\n return [codeLanguage, codeLanguage];\n }, [codeLanguage]);\n\n const isSpecialCodeBlock = SPECIAL_LANGUAGES.has(codeLanguage);\n\n const normalCodeBlockContent = useMemo(() => {\n if (isSpecialCodeBlock) return null;\n let usedCodeStr = props.codeText;\n if (usedCodeStr && usedCodeLanguage.toLowerCase() === 'json') {\n const deepParsedResult = deepParseJson(usedCodeStr);\n usedCodeStr =\n typeof deepParsedResult === 'string' ? deepParsedResult : JSON.stringify(deepParsedResult, null, 2);\n }\n return usedFileName === 'unknown' ? (\n <CodeHighlight\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [\n isSpecialCodeBlock,\n props.codeText,\n usedCodeLanguage,\n usedFileName,\n renderState.fontSize,\n renderState.config.codeBlock.defaultExpanded,\n ]);\n\n const specialCodeBlockContent = useMemo(() => {\n switch (codeLanguage) {\n case SpecialCodeLanguage.Mermaid:\n return <MantineAIMMermaidCode code={props.codeText} />;\n default:\n return null;\n }\n }, [codeLanguage, props.codeText]);\n\n return isSpecialCodeBlock ? specialCodeBlockContent : normalCodeBlockContent;\n }\n);\n\nMantineAIMPreCode.displayName = 'MantineAIMPreCode';\n\nexport default MantineAIMPreCode;\n","import { useAIMarkdownRenderState } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownRenderConfig } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownRenderState} hook.\n *\n * Returns the current {@link AIMarkdownRenderState} defaulting to\n * {@link MantineAIMarkdownRenderConfig}. Accepts an optional generic parameter\n * for further extension, giving consumers direct access to Mantine-specific\n * config fields (`codeBlock`, etc.) without manual annotation.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n * Throws if called outside the provider boundary.\n *\n * @typeParam TConfig - Config type (defaults to {@link MantineAIMarkdownRenderConfig}).\n * @returns The current render state typed with `TConfig`.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();\n * const isExpanded = config.codeBlock.defaultExpanded;\n * // ...\n * }\n * ```\n */\nexport const useMantineAIMarkdownRenderState = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n>() => {\n return useAIMarkdownRenderState<TConfig>();\n};\n","'use client';\n\nimport React, { memo, useMemo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport debounce from 'lodash-es/debounce';\nimport mermaid from 'mermaid';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Generate a unique ID for mermaid SVG rendering.\n * Combines a timestamp with a random suffix to avoid collisions when\n * multiple mermaid diagrams render concurrently.\n *\n * @returns A unique string in the format `mermaid-{timestamp}-{random}`.\n */\nconst generateMermaidUUID = () => {\n return `mermaid-${new Date().getTime()}-${Math.random().toString(36).slice(2, 10)}`;\n};\n\n/**\n * Open the rendered mermaid SVG in a new browser window.\n *\n * Clones the SVG element, applies a background color matching the current\n * color scheme, serializes it to an object URL, and opens it in a new tab.\n * The object URL is revoked after a short delay to free memory.\n *\n * @param svgElement - The rendered SVG element to view, or `null`/`undefined` to no-op.\n * @param isDark - Whether the current color scheme is dark (used for background color).\n */\nconst handleViewSVGInNewWindow = (svgElement: SVGElement | null | undefined, isDark: boolean) => {\n if (!svgElement) return;\n const targetSvg = svgElement.cloneNode(true) as SVGElement;\n targetSvg.style.backgroundColor = isDark ? '#242424' : 'white';\n const text = new XMLSerializer().serializeToString(targetSvg);\n const blob = new Blob([text], { type: 'image/svg+xml' });\n const url = URL.createObjectURL(blob);\n const win = window.open(url);\n if (win) {\n setTimeout(() => URL.revokeObjectURL(url), 5000);\n }\n};\n\n/**\n * Interactive mermaid diagram renderer.\n *\n * Parses and renders mermaid diagram source code into an inline SVG visualization.\n * Automatically adapts to the current Mantine color scheme (light/dark) by\n * re-initializing mermaid with the appropriate theme.\n *\n * Features:\n * - Live SVG rendering with automatic dark/light theme switching\n * - Fallback to raw source code display on parse/render errors\n * - Toggle between rendered diagram and raw mermaid source\n * - Click on the rendered diagram to open the SVG in a new browser window\n * - Copy button for the raw mermaid source code\n * - Chart type label extracted from mermaid's parse result\n * - Debounced error state to avoid flickering during rapid re-renders\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const renderState = useMantineAIMarkdownRenderState();\n const isDark = renderState.colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n const [renderError, setRenderError] = useState(false);\n const [chartType, setChartType] = useState('unknown');\n\n const debouncedUpdateRenderError = useMemo(\n () =>\n debounce((error: boolean) => {\n setRenderError(error);\n }, 200),\n []\n );\n\n useEffect(() => {\n return () => {\n debouncedUpdateRenderError.cancel();\n };\n }, [debouncedUpdateRenderError]);\n\n useEffect(() => {\n if (props.code && ref.current) {\n const renderMermaid = async () => {\n try {\n debouncedUpdateRenderError(false);\n if (ref.current) {\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'loose',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n });\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n const { svg, bindFunctions, diagramType } = await mermaid.render(\n generateMermaidUUID(),\n props.code,\n ref.current\n );\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n setChartType(diagramType);\n }\n } catch {\n debouncedUpdateRenderError(true);\n }\n };\n\n renderMermaid();\n }\n }, [props.code, isDark, showOriginalCode, debouncedUpdateRenderError]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, [isDark]);\n\n return (\n <>\n {(showOriginalCode || renderError) && (\n <CodeHighlightTabs\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={[\n {\n fileName: renderError ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n renderError\n ? []\n : [\n <CodeHighlightControl\n tooltipLabel=\"Render Mermaid\"\n key=\"gpt\"\n onClick={() => {\n setShowOriginalCode(false);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[gravity-ui--logo-mermaid] relative bottom-[1px] text-[16px]\"></span>\n </Flex>\n </CodeHighlightControl>,\n ]\n }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showOriginalCode || renderError\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{chartType}</div>\n <Flex align=\"center\" justify=\"flex-end\" gap={0}>\n <Tooltip label=\"Show Mermaid Code\">\n <ActionIcon\n size={28}\n className=\"action-icon\"\n variant=\"transparent\"\n onClick={() => {\n setShowOriginalCode(true);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[entypo--code] relative bottom-[0.25px] text-[16px]\"></span>\n </Flex>\n </ActionIcon>\n </Tooltip>\n <CopyButton value={props.code}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon variant=\"transparent\" size={28} className=\"action-icon\" onClick={copy}>\n {copied ? (\n <span className=\"icon-origin-[lucide--check] text-[18px]\"></span>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n width=\"18px\"\n height=\"18px\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\"></path>\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\"></path>\n </svg>\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Flex>\n </div>\n <pre\n ref={ref}\n style={{ cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' }}\n onClick={() => viewSvgInNewWindow()}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nexport default now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import isObject from './isObject.js';\nimport now from './now.js';\nimport toNumber from './toNumber.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nexport default debounce;\n","import { useAIMarkdownMetadata } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownMetadata } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownMetadata} hook.\n *\n * Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}.\n * Accepts an optional generic parameter for further extension.\n *\n * Metadata lives in a separate React context from the render state, meaning\n * metadata updates do not trigger re-renders in components that only consume\n * render state.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n *\n * @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}).\n * @returns The current metadata, or `undefined` if none was provided.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const metadata = useMantineAIMarkdownMetadata();\n * // Access Mantine-specific metadata fields\n * }\n * ```\n */\nexport const useMantineAIMarkdownMetadata = <\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>() => {\n return useAIMarkdownMetadata<TMetadata>();\n};\n"],"mappings":";AAaA,SAAS,QAAAA,OAAM,WAAAC,gBAAe;AAC9B,OAAO,gBAAgB;AACvB,SAAgE,sBAAsB;;;ACftF,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAgBzB;AADF,IAAM,8BAA8B,KAAK,CAAC,EAAE,UAAU,UAAU,MAAM,MACpE,oBAAC,cAAW,GAAE,QAAO,IAAI,UAAU,OAChC,UACH,CACD;AAED,4BAA4B,cAAc;AAE1C,IAAO,4BAAQ;;;ACRN,gBAAAC,YAAA;AADT,IAAM,+BAA+D,CAAC,EAAE,SAAS,MAAM;AACrF,SAAO,gBAAAA,KAAC,SAAI,WAAU,4BAA4B,UAAS;AAC7D;AAEA,IAAO,6BAAQ;;;ACVf,SAAqD,qCAAqC;AAmCnF,IAAM,uCAAsE,OAAO,OAAO;AAAA,EAC/F,GAAG;AAAA,EACH,WAAW,OAAO,OAAO;AAAA,IACvB,iBAAiB;AAAA,IACjB,2BAA2B;AAAA,EAC7B,CAAC;AACH,CAAC;;;AChDD,SAAyB,QAAAC,OAAM,WAAAC,gBAAe;AAC9C,SAAS,eAAe,qBAAAC,0BAAyB;AACjD,SAAS,qBAAqB;AAC9B,OAAO,UAAU;;;ACLjB,SAAS,gCAAgC;AA0BlC,IAAM,kCAAkC,MAExC;AACL,SAAO,yBAAkC;AAC3C;;;AC5BA,SAAgB,QAAAC,OAAM,SAAS,WAAW,QAAQ,UAAU,mBAAmB;AAC/E,SAAS,sBAAsB,yBAAyB;AACxD,SAAS,YAAY,YAAY,MAAM,eAAe;;;ACqBtD,SAAS,SAAS,OAAO;AACvB,MAAI,O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B;AA0B/B,IAAM,+BAA+B,MAErC;AACL,SAAO,sBAAiC;AAC1C;","names":["memo","useMemo","jsx","memo","useMemo","CodeHighlightTabs","memo","objectProto","nativeObjectToString","symToStringTag","jsx","memo","jsx","SpecialCodeLanguage","memo","useMemo","CodeHighlightTabs","jsx","Typography","useMemo","memo"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-react-markdown/mantine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@ai-react-markdown/core": "^1.
|
|
28
|
+
"@ai-react-markdown/core": "^1.2.5",
|
|
29
29
|
"@mantine/code-highlight": "^8.3.17",
|
|
30
30
|
"@mantine/core": "^8.3.17",
|
|
31
31
|
"highlight.js": "^11.11.1",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"@mantine/code-highlight": "^8.3.17",
|
|
37
37
|
"@mantine/core": "^8.3.17",
|
|
38
38
|
"@types/lodash-es": "^4.17.12",
|
|
39
|
+
"lodash-es": "^4.17.23",
|
|
39
40
|
"@types/node": "^25.5.0",
|
|
40
41
|
"autoprefixer": "^10.4.27",
|
|
41
42
|
"esbuild-sass-plugin": "^3.7.0",
|
|
42
43
|
"highlight.js": "^11.11.1",
|
|
43
44
|
"postcss": "^8.5.8",
|
|
44
45
|
"tsup": "^8.4.0",
|
|
45
|
-
"@ai-react-markdown/core": "1.
|
|
46
|
+
"@ai-react-markdown/core": "1.2.5"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"deep-parse-json": "^2.0.0",
|
|
49
|
-
"lodash-es": "^4.17.23",
|
|
50
50
|
"mermaid": "^11.13.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|