@ai-react-markdown/mantine 2.3.1 → 2.3.2

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/README.md CHANGED
@@ -38,7 +38,7 @@ yarn add @ai-react-markdown/mantine @ai-react-markdown/core
38
38
  {
39
39
  "react": ">=19",
40
40
  "react-dom": ">=19",
41
- "@ai-react-markdown/core": "^2.3.1",
41
+ "@ai-react-markdown/core": "^2.3.2",
42
42
  "@mantine/core": "^9.0.0",
43
43
  "@mantine/code-highlight": "^9.0.0",
44
44
  "highlight.js": "^11.11.1"
package/dist/index.cjs CHANGED
@@ -274,34 +274,61 @@ var MantineAIMMermaidCode = (0, import_react3.memo)((props) => {
274
274
  size: 28,
275
275
  className: "action-icon",
276
276
  variant: "transparent",
277
+ "aria-label": "Show Mermaid code",
277
278
  onClick: () => {
278
279
  setShowOriginalCode(true);
279
280
  },
280
281
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Flex, { align: "center", justify: "center", w: 18, h: 18, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "icon-[entypo--code] relative bottom-[0.25px] text-[16px]" }) })
281
282
  }
282
283
  ) }),
283
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.CopyButton, { value: props.code, children: ({ copied, copy }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Tooltip, { label: copied ? "Copied" : "Copy", withArrow: true, position: "right", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ActionIcon, { variant: "transparent", size: 28, className: "action-icon", onClick: copy, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "icon-origin-[lucide--check] text-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
284
- "svg",
284
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.CopyButton, { value: props.code, children: ({ copied, copy }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Tooltip, { label: copied ? "Copied" : "Copy", withArrow: true, position: "right", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
285
+ import_core3.ActionIcon,
285
286
  {
286
- xmlns: "http://www.w3.org/2000/svg",
287
- viewBox: "0 0 24 24",
288
- strokeWidth: "2",
289
- stroke: "currentColor",
290
- fill: "none",
291
- strokeLinecap: "round",
292
- strokeLinejoin: "round",
293
- width: "18px",
294
- height: "18px",
295
- children: [
296
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
297
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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" }),
298
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" })
299
- ]
287
+ variant: "transparent",
288
+ size: 28,
289
+ className: "action-icon",
290
+ "aria-label": copied ? "Mermaid code copied" : "Copy Mermaid code",
291
+ onClick: copy,
292
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "icon-origin-[lucide--check] text-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
293
+ "svg",
294
+ {
295
+ xmlns: "http://www.w3.org/2000/svg",
296
+ viewBox: "0 0 24 24",
297
+ strokeWidth: "2",
298
+ stroke: "currentColor",
299
+ fill: "none",
300
+ strokeLinecap: "round",
301
+ strokeLinejoin: "round",
302
+ width: "18px",
303
+ height: "18px",
304
+ children: [
305
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
306
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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" }),
307
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" })
308
+ ]
309
+ }
310
+ )
300
311
  }
301
- ) }) }) })
312
+ ) }) })
302
313
  ] })
303
314
  ] }),
304
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("pre", { ref, style: PRE_STYLE, onClick: viewSvgInNewWindow })
315
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
316
+ "pre",
317
+ {
318
+ ref,
319
+ style: PRE_STYLE,
320
+ role: "button",
321
+ tabIndex: 0,
322
+ "aria-label": "Open Mermaid diagram in a new window",
323
+ onClick: viewSvgInNewWindow,
324
+ onKeyDown: (event) => {
325
+ if (event.key === "Enter" || event.key === " ") {
326
+ event.preventDefault();
327
+ viewSvgInNewWindow();
328
+ }
329
+ }
330
+ }
331
+ )
305
332
  ]
306
333
  }
307
334
  )
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.tsx","../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/components/customized/PreCode.tsx","../src/hooks/useMantineCodeBlockOptions.ts","../src/defs.tsx","../src/components/customized/MermaidCode/index.tsx","../src/define.ts","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["/**\n * Public API surface for `@ai-react-markdown/mantine`.\n *\n * Re-exports the Mantine-integrated AI markdown component, its supporting\n * sub-components, extended types, default configuration, and typed hooks.\n *\n * @packageDocumentation\n */\n\n// --- Components ---\n\n/** Props for the main {@link MantineAIMarkdown} component. */\nexport type { MantineAIMarkdownProps } from './MantineAIMarkdown';\n\n/** Main component -- Mantine-integrated AI markdown renderer (default export). */\nexport { default } from './MantineAIMarkdown';\n\n/** Mantine-themed typography wrapper used by default inside {@link MantineAIMarkdown}. */\nexport { default as MantineAIMarkdownTypography } from './components/typography/MantineTypography';\n\n/** Default extra styles wrapper providing Mantine-compatible CSS scoping and overrides. */\nexport { default as MantineAIMDefaultExtraStyles } from './components/extra-styles/DefaultExtraStyles';\n\n// --- Types, config, and hooks ---\n\n/** Extended render configuration and metadata types for the Mantine integration. */\nexport type { MantineAIMarkdownMetadata, MantineCodeBlockOptions } from './defs';\n\n// ── v2 surface (props-api v2) ───────────────────────────────────────────────\n\n/** Shipped defaults of the `codeBlock` behavior group. */\nexport { defaultMantineCodeBlockOptions } from './defs';\n\n/** Narrow hook for the `codeBlock` behavior group — the single assertion site. */\nexport { useMantineCodeBlockOptions } from './hooks/useMantineCodeBlockOptions';\n\n/** Widened behaviors factory (core fields + mantine's `codeBlock` group). */\nexport { defineMantineBehaviors } from './define';\nexport type { MantineBehaviorProps } from './define';\n\n/** Typed hook for accessing metadata within the Mantine AI markdown tree. */\nexport { useMantineAIMarkdownMetadata } from './hooks/useMantineAIMarkdownMetadata';\n","/**\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 {\n type AIMarkdownProps,\n type AIMarkdownCustomComponents,\n type AIMarkdownBehaviorGroups,\n type AIMarkdownStabilityTable,\n AIMarkdownBehaviorsProvider,\n AIMarkdownStabilityPolicy,\n useStableRecord,\n useStableValue,\n} from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownMetadata, MantineCodeBlockOptions } 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 the mantine behavior groups.\n * All core props (`content`, `streaming`, `fontSize`, `enginePlugins`, etc.)\n * are inherited.\n *\n * @typeParam TMetadata - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TMetadata> {\n /**\n * Code-block behavior group (Behaviors system). The group value replaces\n * atomically; omitted fields resolve to the shipped defaults inside\n * `useMantineCodeBlockOptions()`. `null` counts as absent. When absent,\n * this wrapper contributes NO `codeBlock` group, so a group provided by\n * an outer app-level `AIMarkdownBehaviorsProvider` passes through; when\n * present, this prop wins over any outer group (inner-wins merge).\n */\n codeBlock?: Partial<MantineCodeBlockOptions>;\n}\n\n/**\n * Stable empty CONTRIBUTION for the absent-prop case. Deliberately carries\n * no `codeBlock` key at all: contributing `codeBlock: {}` would shadow a\n * group provided by an outer app-level `AIMarkdownBehaviorsProvider`\n * (inner-wins merge) even though this wrapper has nothing to say — the\n * documented app-level extension path would silently go dead.\n */\nconst NO_GROUPS: AIMarkdownBehaviorGroups = Object.freeze({});\n\n/**\n * Mantine's stability-firewall table — one row today: `codeBlock` is the\n * only object prop this wrapper TERMINATES (consumes in its own machinery).\n * Forwarded object props ride core's firewall untouched; the merged\n * `customComponents` derived below is caught by core's wall.\n */\nconst MANTINE_STABILITY_TABLE: AIMarkdownStabilityTable<{\n codeBlock: Partial<MantineCodeBlockOptions> | undefined;\n}> = {\n codeBlock: AIMarkdownStabilityPolicy.DEEP_EQUAL,\n};\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 TMetadata - Metadata type.\n */\nconst MantineAIMarkdownComponent = <TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n customComponents,\n colorScheme,\n codeBlock,\n ...props\n}: MantineAIMarkdownProps<TMetadata>) => {\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 // Mantine's stability firewall: `codeBlock` is terminated here (it feeds\n // the behaviors Provider below, not the core prop surface).\n const stable = useStableRecord({ codeBlock }, MANTINE_STABILITY_TABLE);\n\n // Contribute the group through the additive behaviors Provider — firewall\n // output used directly, record identity memoized so the context value\n // stays stable across unrelated re-renders. `null`/absent prop ≡ no\n // contribution (NOT an empty group): an outer app-level Provider's\n // `codeBlock` group then stays visible; when the prop IS present the\n // inner-wins merge gives this wrapper's value precedence. The narrow hook\n // fills the defaults for the no-group-anywhere case.\n const behaviorGroups = useMemo<AIMarkdownBehaviorGroups>(\n () => (stable.codeBlock != null ? { codeBlock: stable.codeBlock } : NO_GROUPS),\n [stable.codeBlock]\n );\n\n return (\n <AIMarkdownBehaviorsProvider value={behaviorGroups}>\n <AIMarkdown<MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n </AIMarkdownBehaviorsProvider>\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","'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 { useAIMarkdownTheme } from '@ai-react-markdown/core';\nimport { useMantineCodeBlockOptions } from '../../hooks/useMantineCodeBlockOptions';\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 the `codeBlock` group's\n * `autoDetectUnknownLanguage` option is enabled, uses `highlight.js`\n * 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 { fontSize } = useAIMarkdownTheme();\n const { autoDetectUnknownLanguage, defaultExpanded } = useMantineCodeBlockOptions();\n\n const codeLanguage = useMemo(() => {\n if (props.existLanguage) return props.existLanguage;\n if (autoDetectUnknownLanguage) {\n return hljs.highlightAuto(props.codeText).language || '';\n }\n return '';\n }, [props.existLanguage, props.codeText, 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={fontSize}\n w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n fz={fontSize}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [isSpecialCodeBlock, props.codeText, usedCodeLanguage, usedFileName, fontSize, defaultExpanded]);\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","/**\n * Narrow hook for the mantine `codeBlock` behavior group.\n *\n * This is THE single type-assertion site for the group (the pattern that\n * retires the public caller-asserted `TConfig` generic): the opaque\n * extension record from `useAIMarkdownBehaviors()` is narrowed here, and\n * group defaults are applied here — read sites must consume this hook and\n * never re-apply defaults with bare `??` (multiple read sites duplicating\n * defaults will drift).\n *\n * @module hooks/useMantineCodeBlockOptions\n */\n\nimport { useMemo } from 'react';\nimport { useAIMarkdownBehaviors } from '@ai-react-markdown/core';\nimport { defaultMantineCodeBlockOptions, type MantineCodeBlockOptions } from '../defs';\n\n/**\n * Read the resolved code-block options from the behaviors context.\n *\n * Group values replace atomically at the transport layer; defaults are\n * filled in here, so a partial group (e.g. `codeBlock={{ defaultExpanded:\n * false }}`) resolves the omitted fields to the shipped defaults.\n *\n * Must be called inside a `<MantineAIMarkdown>` (or any `<AIMarkdown>`\n * wrapped in the mantine Provider stack) — throws outside, same contract\n * as the core narrow hooks.\n */\nexport function useMantineCodeBlockOptions(): Required<MantineCodeBlockOptions> {\n const behaviors = useAIMarkdownBehaviors();\n // The single assertion: the `codeBlock` group key is owned by this\n // package, contributed by `MantineAIMarkdown` via its behaviors Provider.\n const group = behaviors.codeBlock as Partial<MantineCodeBlockOptions> | undefined;\n return useMemo(() => ({ ...defaultMantineCodeBlockOptions, ...group }), [group]);\n}\n","/**\n * Mantine-specific type definitions and defaults: the `codeBlock` behavior\n * group and the metadata extension point.\n *\n * @module defs\n */\n\nimport { AIMarkdownMetadata } from '@ai-react-markdown/core';\n\n/**\n * Code block rendering options (the mantine `codeBlock` behavior group).\n *\n * v2 transport: passed as the flat `codeBlock` prop on `MantineAIMarkdown`\n * (group value replaces atomically) and read through\n * `useMantineCodeBlockOptions()`, which applies the defaults below inside\n * the hook — the single place defaults live at read time.\n */\nexport interface MantineCodeBlockOptions {\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/** Shipped defaults for the `codeBlock` behavior group. */\nexport const defaultMantineCodeBlockOptions: Readonly<MantineCodeBlockOptions> = Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\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 React, { memo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport mermaid from 'mermaid';\nimport { useAIMarkdownState, useAIMarkdownTheme } from '@ai-react-markdown/core';\nimport { useMantineCodeBlockOptions } from '../../../hooks/useMantineCodeBlockOptions';\nimport './styles.scss';\n\n/** Static `<pre>` style for the mermaid container. */\nconst PRE_STYLE = { cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' } as const;\n\n/**\n * What the component currently shows. One value instead of separate\n * `hasRendered`/`renderError`/`chartType` fields whose combinations had to\n * be kept coherent by hand:\n * - `source`: warm-up / SSR fallback — raw code as a plain code block\n * (nothing rendered yet this generation).\n * - `diagram`: the last successful SVG is up.\n * - `error`: the error tab — only a post-stream corrective failure or a\n * never-rendered static failure can enter this state.\n *\n * The user's source toggle (`showOriginalCode`) is deliberately NOT a\n * phase: it overlays any view and flipping it back must restore the prior\n * one unchanged.\n */\ntype MermaidView = { kind: 'source' } | { kind: 'diagram'; chartType: string } | { kind: 'error' };\n\n/** Equality used to skip no-op view updates — repeat mid-stream successes\n * of the same chart type must not re-render the host per chunk. */\nconst sameView = (a: MermaidView, b: MermaidView): boolean =>\n a.kind === 'diagram' && b.kind === 'diagram' ? a.chartType === b.chartType : a.kind === b.kind;\n\n/** Theme mermaid.initialize was last called with. mermaid's config is a\n * module-level singleton, so re-asserting an unchanged theme before every\n * render attempt (each streamed chunk re-runs the effect) is pure waste —\n * but instances under providers with DIFFERENT schemes must each\n * re-assert before their own render, so the cache is module-level and\n * checked per attempt rather than hoisted into a per-instance effect. */\nlet initializedTheme: 'dark' | 'light' | null = null;\n\nconst ensureMermaidInitialized = (isDark: boolean) => {\n const theme = isDark ? 'dark' : 'light';\n if (initializedTheme === theme) return;\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'strict',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n // Without a svgContainingElement, a draw-phase throw (an error that\n // got past mermaid.parse) leaves mermaid's temp element orphaned in\n // document.body — its error path only cleans up when this flag is\n // set. We render our own error tab anyway, so mermaid's built-in\n // error diagram is dead weight here regardless.\n suppressErrorRendering: true,\n });\n initializedTheme = theme;\n};\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 * - Preserves the last successful render across transient parse failures\n *\n * ## Streaming contract\n *\n * While `streaming` is true (from render state), the code prop is usually a\n * truncated prefix of the final diagram, so parse failures are *expected*,\n * not exceptional:\n * - Before the first successful render, the raw source is shown as a plain\n * code block (never the error tab).\n * - After a success, the last good SVG stays up; each subsequent chunk is\n * re-attempted and the diagram refreshes only on the next success.\n * - When streaming ends (`streaming` is an effect dep), one corrective pass\n * runs on the final code: success refreshes the diagram, failure surfaces\n * the real error tab — even over a previously rendered mid-stream diagram,\n * because that diagram no longer matches the final source. The pending\n * corrective obligation is tracked by `needsCorrectiveRef` (armed on the\n * streaming→false edge, consumed by the next completed attempt), so ONLY\n * that one pass may clobber a rendered diagram; any later failure (e.g. a\n * transient throw on a theme-flip re-render) falls back to the static rule\n * below.\n * - A streaming→true edge marks a NEW generation (chat \"regenerate\" reuses\n * the same component instance when the block's source offset — and thus\n * its React key — is unchanged). All per-generation state is reset so the\n * warm-up shows the new source instead of the previous generation's stale\n * diagram or error tab.\n *\n * ## Static contract (`streaming` stays false)\n *\n * Without streaming edges, failures follow the original conservative rule:\n * the error tab shows only while nothing has rendered yet. Once a diagram is\n * up, later failures (theme-flip re-render, a not-yet-complete `code` update\n * from a consumer that didn't pass `streaming`) keep the last good diagram\n * instead of clobbering it with an error.\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const { colorScheme, fontSize } = useAIMarkdownTheme();\n const { streaming } = useAIMarkdownState();\n const { defaultExpanded } = useMantineCodeBlockOptions();\n const isDark = colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const renderVersionRef = useRef(0);\n /** Mirrors `view` for reads inside the async render closure — state reads\n * there can be stale when deps change mid-flight. */\n const viewRef = useRef<MermaidView>({ kind: 'source' });\n /** Previous `streaming` value, for edge detection in the effect. */\n const prevStreamingRef = useRef(false);\n /** Armed on the streaming→false edge: the next completed render attempt is\n * the end-of-stream corrective pass, whose failure must surface even over\n * a rendered diagram. Consumed (reset) by that attempt's success OR\n * surfaced failure, so later unrelated failures can't clobber the SVG. */\n const needsCorrectiveRef = useRef(false);\n /** Inputs of the render whose SVG currently sits in the host `<pre>`.\n * When the effect re-runs with the same (code, theme) pair — the\n * post-stream corrective flip on an already-final diagram, or returning\n * from the source view — the DOM already holds that exact render, so\n * the attempt (and its parse + temp-element render) is skipped. */\n const lastSuccessRef = useRef<{ code: string; isDark: boolean } | null>(null);\n const [view, setViewState] = useState<MermaidView>({ kind: 'source' });\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n\n useEffect(() => {\n // View updates funnel through here so the ref mirror can't desync from\n // the state, and no-op updates are dropped (repeat mid-stream successes\n // and idempotent edge resets must not re-render the host per chunk).\n const applyView = (next: MermaidView) => {\n viewRef.current = next;\n setViewState((prev) => (sameView(prev, next) ? prev : next));\n };\n\n // Streaming edge detection MUST run before any early return — the first\n // chunk of a new stream can arrive while the code is still empty.\n if (streaming && !prevStreamingRef.current) {\n // Rising edge = a new generation is starting on this same instance\n // (same block offset → same React key → no remount on regenerate).\n // Reset all per-generation state so warm-up shows the incoming source,\n // not the previous generation's stale diagram or error tab. Everything\n // here is idempotent — a StrictMode double-run is harmless.\n needsCorrectiveRef.current = false;\n lastSuccessRef.current = null;\n applyView({ kind: 'source' });\n if (ref.current) {\n ref.current.innerHTML = '';\n }\n } else if (!streaming && prevStreamingRef.current) {\n // Falling edge = the stream just ended; arm the corrective pass.\n needsCorrectiveRef.current = true;\n }\n prevStreamingRef.current = streaming;\n if (!props.code || !ref.current || showOriginalCode) {\n return;\n }\n\n // The SVG in the DOM already came from exactly this (code, theme) pair —\n // nothing to recompute. This also SATISFIES a pending corrective\n // obligation: the identical successful render IS the verdict on the\n // final source, so the obligation is consumed, not left armed for some\n // later unrelated failure to inherit.\n if (lastSuccessRef.current?.code === props.code && lastSuccessRef.current.isDark === isDark) {\n needsCorrectiveRef.current = false;\n return;\n }\n\n const renderVersion = ++renderVersionRef.current;\n let cancelled = false;\n\n const renderMermaid = async () => {\n try {\n ensureMermaidInitialized(isDark);\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n\n if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n\n // Deliberately NOT passing `ref.current` as mermaid's\n // svgContainingElement: before the first success the host container\n // is hidden with `display: none` (source fallback is showing), and\n // mermaid measures text via getBBox during render — inside a\n // display:none subtree layout never runs, every measurement is 0,\n // and the diagram comes out as a ~16px SVG. With the argument\n // omitted, mermaid renders in a temp element appended to\n // `document.body` (its default path, cleaned up internally), so\n // measurement works no matter what our container is doing. The SVG\n // string is written into our own <pre> below either way.\n const { svg, bindFunctions, diagramType } = await mermaid.render(generateMermaidUUID(), props.code);\n if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n needsCorrectiveRef.current = false;\n lastSuccessRef.current = { code: props.code, isDark };\n applyView({ kind: 'diagram', chartType: diagramType });\n } catch {\n if (cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n // Mid-stream failures are expected (truncated code) — keep the last\n // good diagram / source placeholder and wait for more bytes. The\n // corrective pass after streaming ends reports real errors.\n if (streaming) {\n return;\n }\n // End-of-stream corrective pass: the final source no longer renders,\n // so the error must surface even over a mid-stream diagram. Consume\n // the obligation so later unrelated failures don't inherit it.\n if (needsCorrectiveRef.current) {\n needsCorrectiveRef.current = false;\n applyView({ kind: 'error' });\n return;\n }\n // Static rule: never clobber a rendered diagram (theme-flip\n // re-renders, un-flagged code updates from static consumers).\n if (viewRef.current.kind === 'diagram') {\n return;\n }\n applyView({ kind: 'error' });\n }\n };\n\n void renderMermaid();\n\n return () => {\n cancelled = true;\n };\n // `streaming` in the deps is what drives the end-of-stream corrective\n // pass: the flip to false re-runs this effect on the (unchanged) final\n // code, so the last state reflects the full diagram source.\n }, [props.code, isDark, showOriginalCode, streaming]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, [isDark]);\n\n // Show the raw source instead of the diagram container when the user asked\n // for it, when the (post-stream) render failed, or before the first\n // successful render (SSR output and the streaming warm-up phase). The\n // diagram container below stays MOUNTED throughout — merely hidden — so\n // `ref` is always available for mermaid to render into; unmounting it would\n // make the effect's `!ref.current` guard bail forever.\n const showSourceFallback = showOriginalCode || view.kind !== 'diagram';\n\n return (\n <>\n {showSourceFallback && (\n <CodeHighlightTabs\n mb={15}\n fz={fontSize}\n w=\"100%\"\n code={[\n {\n fileName: view.kind === 'error' ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n // The \"Render Mermaid\" control only makes sense as the way back\n // from the user-toggled source view. In the error and warm-up\n // fallbacks `showOriginalCode` is already false, so the control\n // would be a no-op — hide it there. (No view-kind conjunct: the\n // toggle is only reachable from the visible diagram view, and\n // while the source view is open the effect early-returns, so\n // showOriginalCode && view.kind === 'error' is unreachable.)\n showOriginalCode\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 }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showSourceFallback\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{view.kind === 'diagram' ? view.chartType : 'unknown'}</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 ref={ref} style={PRE_STYLE} onClick={viewSvgInNewWindow} />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","/**\n * Widened `define*` factory for the mantine wrapper (EXECUTION-PLAN §4\n * item 8): identity + mantine prop types + freeze, zero logic. Core\n * factories accept core fields only — passing `codeBlock` to core's\n * `defineBehaviors` is a TS error; this widened factory is the wrapper's\n * one-line obligation.\n *\n * @module define\n */\n\nimport type { AIMarkdownBehaviorProps } from '@ai-react-markdown/core';\nimport type { MantineCodeBlockOptions } from './defs';\n\n/** Behavior-system props packagable at integration time, mantine-widened. */\nexport interface MantineBehaviorProps extends AIMarkdownBehaviorProps {\n /** The mantine `codeBlock` behavior group (atomic replacement; defaults applied at read time). */\n codeBlock?: Partial<MantineCodeBlockOptions>;\n}\n\n// NON-generic on purpose — see core's `define.ts`: a fresh literal is\n// excess-property checked against the concrete parameter type.\n\n/** Freeze a mantine behaviors fragment. Identity + types + freeze; zero logic. */\nexport function defineMantineBehaviors(values: MantineBehaviorProps): Readonly<MantineBehaviorProps> {\n return Object.freeze(values);\n}\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,IAAAA,gBAA8B;AAC9B,IAAAC,eAAuB;AACvB,IAAAA,eASO;;;ACxBP,mBAAqB;AACrB,kBAA2B;AAgBzB;AADF,IAAM,kCAA8B,mBAAK,CAAC,EAAE,UAAU,UAAU,MAAM,MACpE,4CAAC,0BAAW,GAAE,QAAO,IAAI,UAAU,OAChC,UACH,CACD;AAED,4BAA4B,cAAc;AAE1C,IAAO,4BAAQ;;;ACRN,IAAAC,sBAAA;AADT,IAAM,+BAA+D,CAAC,EAAE,SAAS,MAAM;AACrF,SAAO,6CAAC,SAAI,WAAU,4BAA4B,UAAS;AAC7D;AAEA,IAAO,6BAAQ;;;ACjBf,IAAAC,gBAA8C;AAC9C,IAAAC,yBAAiD;AACjD,6BAA8B;AAC9B,uBAAiB;AACjB,IAAAC,eAAmC;;;ACOnC,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AE,EAAE,KAAK,IAAI;AAC9F,WAAO,6CAAC,mBAA4B,UAAoB,eAAe,oBAAxC,GAA0D;AAAA,EAC3F;AACF;AAWA,IAAM,6BAA6B,CAA0E;AAAA,EAC3G,YAAAC,cAAa;AAAA,EACb,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyC;AACvC,QAAM,6BAAyB,6BAAe,gBAAgB;AAE9D,QAAM,qBAAiB,uBAAQ,MAAM;AACnC,WAAO,yBAAyB,EAAE,GAAG,yBAAyB,GAAG,uBAAuB,IAAI;AAAA,EAC9F,GAAG,CAAC,sBAAsB,CAAC;AAE3B,QAAM,0BAAsB,qCAAuB,OAAO;AAI1D,QAAM,aAAS,8BAAgB,EAAE,UAAU,GAAG,uBAAuB;AASrE,QAAM,qBAAiB;AAAA,IACrB,MAAO,OAAO,aAAa,OAAO,EAAE,WAAW,OAAO,UAAU,IAAI;AAAA,IACpE,CAAC,OAAO,SAAS;AAAA,EACnB;AAEA,SACE,6CAAC,4CAA4B,OAAO,gBAClC;AAAA,IAAC,aAAAC;AAAA,IAAA;AAAA,MACC,YAAYD;AAAA,MACZ;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN,GACF;AAEJ;AAoBO,IAAM,wBAAoB,oBAAK,0BAA0B;AAEhE,kBAAkB,cAAc;AAEhC,IAAO,4BAAQ;;;AO/JR,SAAS,uBAAuB,QAA8D;AACnG,SAAO,OAAO,OAAO,MAAM;AAC7B;;;ACzBA,IAAAE,eAAsC;AA0B/B,IAAM,+BAA+B,MAErC;AACL,aAAO,oCAAiC;AAC1C;","names":["import_react","import_core","import_jsx_runtime","import_react","import_code_highlight","import_core","import_react","import_core","import_react","import_core","import_jsx_runtime","mermaid","import_jsx_runtime","SpecialCodeLanguage","hljs","import_core","import_jsx_runtime","Typography","AIMarkdown","import_core"]}
1
+ {"version":3,"sources":["../src/index.tsx","../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/components/customized/PreCode.tsx","../src/hooks/useMantineCodeBlockOptions.ts","../src/defs.tsx","../src/components/customized/MermaidCode/index.tsx","../src/define.ts","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["/**\n * Public API surface for `@ai-react-markdown/mantine`.\n *\n * Re-exports the Mantine-integrated AI markdown component, its supporting\n * sub-components, extended types, default configuration, and typed hooks.\n *\n * @packageDocumentation\n */\n\n// --- Components ---\n\n/** Props for the main {@link MantineAIMarkdown} component. */\nexport type { MantineAIMarkdownProps } from './MantineAIMarkdown';\n\n/** Main component -- Mantine-integrated AI markdown renderer (default export). */\nexport { default } from './MantineAIMarkdown';\n\n/** Mantine-themed typography wrapper used by default inside {@link MantineAIMarkdown}. */\nexport { default as MantineAIMarkdownTypography } from './components/typography/MantineTypography';\n\n/** Default extra styles wrapper providing Mantine-compatible CSS scoping and overrides. */\nexport { default as MantineAIMDefaultExtraStyles } from './components/extra-styles/DefaultExtraStyles';\n\n// --- Types, config, and hooks ---\n\n/** Extended render configuration and metadata types for the Mantine integration. */\nexport type { MantineAIMarkdownMetadata, MantineCodeBlockOptions } from './defs';\n\n// ── v2 surface (props-api v2) ───────────────────────────────────────────────\n\n/** Shipped defaults of the `codeBlock` behavior group. */\nexport { defaultMantineCodeBlockOptions } from './defs';\n\n/** Narrow hook for the `codeBlock` behavior group — the single assertion site. */\nexport { useMantineCodeBlockOptions } from './hooks/useMantineCodeBlockOptions';\n\n/** Widened behaviors factory (core fields + mantine's `codeBlock` group). */\nexport { defineMantineBehaviors } from './define';\nexport type { MantineBehaviorProps } from './define';\n\n/** Typed hook for accessing metadata within the Mantine AI markdown tree. */\nexport { useMantineAIMarkdownMetadata } from './hooks/useMantineAIMarkdownMetadata';\n","/**\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 {\n type AIMarkdownProps,\n type AIMarkdownCustomComponents,\n type AIMarkdownBehaviorGroups,\n type AIMarkdownStabilityTable,\n AIMarkdownBehaviorsProvider,\n AIMarkdownStabilityPolicy,\n useStableRecord,\n useStableValue,\n} from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownMetadata, MantineCodeBlockOptions } 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 the mantine behavior groups.\n * All core props (`content`, `streaming`, `fontSize`, `enginePlugins`, etc.)\n * are inherited.\n *\n * @typeParam TMetadata - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TMetadata> {\n /**\n * Code-block behavior group (Behaviors system). The group value replaces\n * atomically; omitted fields resolve to the shipped defaults inside\n * `useMantineCodeBlockOptions()`. `null` counts as absent. When absent,\n * this wrapper contributes NO `codeBlock` group, so a group provided by\n * an outer app-level `AIMarkdownBehaviorsProvider` passes through; when\n * present, this prop wins over any outer group (inner-wins merge).\n */\n codeBlock?: Partial<MantineCodeBlockOptions>;\n}\n\n/**\n * Stable empty CONTRIBUTION for the absent-prop case. Deliberately carries\n * no `codeBlock` key at all: contributing `codeBlock: {}` would shadow a\n * group provided by an outer app-level `AIMarkdownBehaviorsProvider`\n * (inner-wins merge) even though this wrapper has nothing to say — the\n * documented app-level extension path would silently go dead.\n */\nconst NO_GROUPS: AIMarkdownBehaviorGroups = Object.freeze({});\n\n/**\n * Mantine's stability-firewall table — one row today: `codeBlock` is the\n * only object prop this wrapper TERMINATES (consumes in its own machinery).\n * Forwarded object props ride core's firewall untouched; the merged\n * `customComponents` derived below is caught by core's wall.\n */\nconst MANTINE_STABILITY_TABLE: AIMarkdownStabilityTable<{\n codeBlock: Partial<MantineCodeBlockOptions> | undefined;\n}> = {\n codeBlock: AIMarkdownStabilityPolicy.DEEP_EQUAL,\n};\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 TMetadata - Metadata type.\n */\nconst MantineAIMarkdownComponent = <TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n customComponents,\n colorScheme,\n codeBlock,\n ...props\n}: MantineAIMarkdownProps<TMetadata>) => {\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 // Mantine's stability firewall: `codeBlock` is terminated here (it feeds\n // the behaviors Provider below, not the core prop surface).\n const stable = useStableRecord({ codeBlock }, MANTINE_STABILITY_TABLE);\n\n // Contribute the group through the additive behaviors Provider — firewall\n // output used directly, record identity memoized so the context value\n // stays stable across unrelated re-renders. `null`/absent prop ≡ no\n // contribution (NOT an empty group): an outer app-level Provider's\n // `codeBlock` group then stays visible; when the prop IS present the\n // inner-wins merge gives this wrapper's value precedence. The narrow hook\n // fills the defaults for the no-group-anywhere case.\n const behaviorGroups = useMemo<AIMarkdownBehaviorGroups>(\n () => (stable.codeBlock != null ? { codeBlock: stable.codeBlock } : NO_GROUPS),\n [stable.codeBlock]\n );\n\n return (\n <AIMarkdownBehaviorsProvider value={behaviorGroups}>\n <AIMarkdown<MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n </AIMarkdownBehaviorsProvider>\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","'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 { useAIMarkdownTheme } from '@ai-react-markdown/core';\nimport { useMantineCodeBlockOptions } from '../../hooks/useMantineCodeBlockOptions';\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 the `codeBlock` group's\n * `autoDetectUnknownLanguage` option is enabled, uses `highlight.js`\n * 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 { fontSize } = useAIMarkdownTheme();\n const { autoDetectUnknownLanguage, defaultExpanded } = useMantineCodeBlockOptions();\n\n const codeLanguage = useMemo(() => {\n if (props.existLanguage) return props.existLanguage;\n if (autoDetectUnknownLanguage) {\n return hljs.highlightAuto(props.codeText).language || '';\n }\n return '';\n }, [props.existLanguage, props.codeText, 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={fontSize}\n w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n fz={fontSize}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [isSpecialCodeBlock, props.codeText, usedCodeLanguage, usedFileName, fontSize, defaultExpanded]);\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","/**\n * Narrow hook for the mantine `codeBlock` behavior group.\n *\n * This is THE single type-assertion site for the group (the pattern that\n * retires the public caller-asserted `TConfig` generic): the opaque\n * extension record from `useAIMarkdownBehaviors()` is narrowed here, and\n * group defaults are applied here — read sites must consume this hook and\n * never re-apply defaults with bare `??` (multiple read sites duplicating\n * defaults will drift).\n *\n * @module hooks/useMantineCodeBlockOptions\n */\n\nimport { useMemo } from 'react';\nimport { useAIMarkdownBehaviors } from '@ai-react-markdown/core';\nimport { defaultMantineCodeBlockOptions, type MantineCodeBlockOptions } from '../defs';\n\n/**\n * Read the resolved code-block options from the behaviors context.\n *\n * Group values replace atomically at the transport layer; defaults are\n * filled in here, so a partial group (e.g. `codeBlock={{ defaultExpanded:\n * false }}`) resolves the omitted fields to the shipped defaults.\n *\n * Must be called inside a `<MantineAIMarkdown>` (or any `<AIMarkdown>`\n * wrapped in the mantine Provider stack) — throws outside, same contract\n * as the core narrow hooks.\n */\nexport function useMantineCodeBlockOptions(): Required<MantineCodeBlockOptions> {\n const behaviors = useAIMarkdownBehaviors();\n // The single assertion: the `codeBlock` group key is owned by this\n // package, contributed by `MantineAIMarkdown` via its behaviors Provider.\n const group = behaviors.codeBlock as Partial<MantineCodeBlockOptions> | undefined;\n return useMemo(() => ({ ...defaultMantineCodeBlockOptions, ...group }), [group]);\n}\n","/**\n * Mantine-specific type definitions and defaults: the `codeBlock` behavior\n * group and the metadata extension point.\n *\n * @module defs\n */\n\nimport { AIMarkdownMetadata } from '@ai-react-markdown/core';\n\n/**\n * Code block rendering options (the mantine `codeBlock` behavior group).\n *\n * v2 transport: passed as the flat `codeBlock` prop on `MantineAIMarkdown`\n * (group value replaces atomically) and read through\n * `useMantineCodeBlockOptions()`, which applies the defaults below inside\n * the hook — the single place defaults live at read time.\n */\nexport interface MantineCodeBlockOptions {\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/** Shipped defaults for the `codeBlock` behavior group. */\nexport const defaultMantineCodeBlockOptions: Readonly<MantineCodeBlockOptions> = Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\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 React, { memo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport mermaid from 'mermaid';\nimport { useAIMarkdownState, useAIMarkdownTheme } from '@ai-react-markdown/core';\nimport { useMantineCodeBlockOptions } from '../../../hooks/useMantineCodeBlockOptions';\nimport './styles.scss';\n\n/** Static `<pre>` style for the mermaid container. */\nconst PRE_STYLE = { cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' } as const;\n\n/**\n * What the component currently shows. One value instead of separate\n * `hasRendered`/`renderError`/`chartType` fields whose combinations had to\n * be kept coherent by hand:\n * - `source`: warm-up / SSR fallback — raw code as a plain code block\n * (nothing rendered yet this generation).\n * - `diagram`: the last successful SVG is up.\n * - `error`: the error tab — only a post-stream corrective failure or a\n * never-rendered static failure can enter this state.\n *\n * The user's source toggle (`showOriginalCode`) is deliberately NOT a\n * phase: it overlays any view and flipping it back must restore the prior\n * one unchanged.\n */\ntype MermaidView = { kind: 'source' } | { kind: 'diagram'; chartType: string } | { kind: 'error' };\n\n/** Equality used to skip no-op view updates — repeat mid-stream successes\n * of the same chart type must not re-render the host per chunk. */\nconst sameView = (a: MermaidView, b: MermaidView): boolean =>\n a.kind === 'diagram' && b.kind === 'diagram' ? a.chartType === b.chartType : a.kind === b.kind;\n\n/** Theme mermaid.initialize was last called with. mermaid's config is a\n * module-level singleton, so re-asserting an unchanged theme before every\n * render attempt (each streamed chunk re-runs the effect) is pure waste —\n * but instances under providers with DIFFERENT schemes must each\n * re-assert before their own render, so the cache is module-level and\n * checked per attempt rather than hoisted into a per-instance effect. */\nlet initializedTheme: 'dark' | 'light' | null = null;\n\nconst ensureMermaidInitialized = (isDark: boolean) => {\n const theme = isDark ? 'dark' : 'light';\n if (initializedTheme === theme) return;\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'strict',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n // Without a svgContainingElement, a draw-phase throw (an error that\n // got past mermaid.parse) leaves mermaid's temp element orphaned in\n // document.body — its error path only cleans up when this flag is\n // set. We render our own error tab anyway, so mermaid's built-in\n // error diagram is dead weight here regardless.\n suppressErrorRendering: true,\n });\n initializedTheme = theme;\n};\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 * - Preserves the last successful render across transient parse failures\n *\n * ## Streaming contract\n *\n * While `streaming` is true (from render state), the code prop is usually a\n * truncated prefix of the final diagram, so parse failures are *expected*,\n * not exceptional:\n * - Before the first successful render, the raw source is shown as a plain\n * code block (never the error tab).\n * - After a success, the last good SVG stays up; each subsequent chunk is\n * re-attempted and the diagram refreshes only on the next success.\n * - When streaming ends (`streaming` is an effect dep), one corrective pass\n * runs on the final code: success refreshes the diagram, failure surfaces\n * the real error tab — even over a previously rendered mid-stream diagram,\n * because that diagram no longer matches the final source. The pending\n * corrective obligation is tracked by `needsCorrectiveRef` (armed on the\n * streaming→false edge, consumed by the next completed attempt), so ONLY\n * that one pass may clobber a rendered diagram; any later failure (e.g. a\n * transient throw on a theme-flip re-render) falls back to the static rule\n * below.\n * - A streaming→true edge marks a NEW generation (chat \"regenerate\" reuses\n * the same component instance when the block's source offset — and thus\n * its React key — is unchanged). All per-generation state is reset so the\n * warm-up shows the new source instead of the previous generation's stale\n * diagram or error tab.\n *\n * ## Static contract (`streaming` stays false)\n *\n * Without streaming edges, failures follow the original conservative rule:\n * the error tab shows only while nothing has rendered yet. Once a diagram is\n * up, later failures (theme-flip re-render, a not-yet-complete `code` update\n * from a consumer that didn't pass `streaming`) keep the last good diagram\n * instead of clobbering it with an error.\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const { colorScheme, fontSize } = useAIMarkdownTheme();\n const { streaming } = useAIMarkdownState();\n const { defaultExpanded } = useMantineCodeBlockOptions();\n const isDark = colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const renderVersionRef = useRef(0);\n /** Mirrors `view` for reads inside the async render closure — state reads\n * there can be stale when deps change mid-flight. */\n const viewRef = useRef<MermaidView>({ kind: 'source' });\n /** Previous `streaming` value, for edge detection in the effect. */\n const prevStreamingRef = useRef(false);\n /** Armed on the streaming→false edge: the next completed render attempt is\n * the end-of-stream corrective pass, whose failure must surface even over\n * a rendered diagram. Consumed (reset) by that attempt's success OR\n * surfaced failure, so later unrelated failures can't clobber the SVG. */\n const needsCorrectiveRef = useRef(false);\n /** Inputs of the render whose SVG currently sits in the host `<pre>`.\n * When the effect re-runs with the same (code, theme) pair — the\n * post-stream corrective flip on an already-final diagram, or returning\n * from the source view — the DOM already holds that exact render, so\n * the attempt (and its parse + temp-element render) is skipped. */\n const lastSuccessRef = useRef<{ code: string; isDark: boolean } | null>(null);\n const [view, setViewState] = useState<MermaidView>({ kind: 'source' });\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n\n useEffect(() => {\n // View updates funnel through here so the ref mirror can't desync from\n // the state, and no-op updates are dropped (repeat mid-stream successes\n // and idempotent edge resets must not re-render the host per chunk).\n const applyView = (next: MermaidView) => {\n viewRef.current = next;\n setViewState((prev) => (sameView(prev, next) ? prev : next));\n };\n\n // Streaming edge detection MUST run before any early return — the first\n // chunk of a new stream can arrive while the code is still empty.\n if (streaming && !prevStreamingRef.current) {\n // Rising edge = a new generation is starting on this same instance\n // (same block offset → same React key → no remount on regenerate).\n // Reset all per-generation state so warm-up shows the incoming source,\n // not the previous generation's stale diagram or error tab. Everything\n // here is idempotent — a StrictMode double-run is harmless.\n needsCorrectiveRef.current = false;\n lastSuccessRef.current = null;\n applyView({ kind: 'source' });\n if (ref.current) {\n ref.current.innerHTML = '';\n }\n } else if (!streaming && prevStreamingRef.current) {\n // Falling edge = the stream just ended; arm the corrective pass.\n needsCorrectiveRef.current = true;\n }\n prevStreamingRef.current = streaming;\n if (!props.code || !ref.current || showOriginalCode) {\n return;\n }\n\n // The SVG in the DOM already came from exactly this (code, theme) pair —\n // nothing to recompute. This also SATISFIES a pending corrective\n // obligation: the identical successful render IS the verdict on the\n // final source, so the obligation is consumed, not left armed for some\n // later unrelated failure to inherit.\n if (lastSuccessRef.current?.code === props.code && lastSuccessRef.current.isDark === isDark) {\n needsCorrectiveRef.current = false;\n return;\n }\n\n const renderVersion = ++renderVersionRef.current;\n let cancelled = false;\n\n const renderMermaid = async () => {\n try {\n ensureMermaidInitialized(isDark);\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n\n if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n\n // Deliberately NOT passing `ref.current` as mermaid's\n // svgContainingElement: before the first success the host container\n // is hidden with `display: none` (source fallback is showing), and\n // mermaid measures text via getBBox during render — inside a\n // display:none subtree layout never runs, every measurement is 0,\n // and the diagram comes out as a ~16px SVG. With the argument\n // omitted, mermaid renders in a temp element appended to\n // `document.body` (its default path, cleaned up internally), so\n // measurement works no matter what our container is doing. The SVG\n // string is written into our own <pre> below either way.\n const { svg, bindFunctions, diagramType } = await mermaid.render(generateMermaidUUID(), props.code);\n if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n needsCorrectiveRef.current = false;\n lastSuccessRef.current = { code: props.code, isDark };\n applyView({ kind: 'diagram', chartType: diagramType });\n } catch {\n if (cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n // Mid-stream failures are expected (truncated code) — keep the last\n // good diagram / source placeholder and wait for more bytes. The\n // corrective pass after streaming ends reports real errors.\n if (streaming) {\n return;\n }\n // End-of-stream corrective pass: the final source no longer renders,\n // so the error must surface even over a mid-stream diagram. Consume\n // the obligation so later unrelated failures don't inherit it.\n if (needsCorrectiveRef.current) {\n needsCorrectiveRef.current = false;\n applyView({ kind: 'error' });\n return;\n }\n // Static rule: never clobber a rendered diagram (theme-flip\n // re-renders, un-flagged code updates from static consumers).\n if (viewRef.current.kind === 'diagram') {\n return;\n }\n applyView({ kind: 'error' });\n }\n };\n\n void renderMermaid();\n\n return () => {\n cancelled = true;\n };\n // `streaming` in the deps is what drives the end-of-stream corrective\n // pass: the flip to false re-runs this effect on the (unchanged) final\n // code, so the last state reflects the full diagram source.\n }, [props.code, isDark, showOriginalCode, streaming]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, [isDark]);\n\n // Show the raw source instead of the diagram container when the user asked\n // for it, when the (post-stream) render failed, or before the first\n // successful render (SSR output and the streaming warm-up phase). The\n // diagram container below stays MOUNTED throughout — merely hidden — so\n // `ref` is always available for mermaid to render into; unmounting it would\n // make the effect's `!ref.current` guard bail forever.\n const showSourceFallback = showOriginalCode || view.kind !== 'diagram';\n\n return (\n <>\n {showSourceFallback && (\n <CodeHighlightTabs\n mb={15}\n fz={fontSize}\n w=\"100%\"\n code={[\n {\n fileName: view.kind === 'error' ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n // The \"Render Mermaid\" control only makes sense as the way back\n // from the user-toggled source view. In the error and warm-up\n // fallbacks `showOriginalCode` is already false, so the control\n // would be a no-op — hide it there. (No view-kind conjunct: the\n // toggle is only reachable from the visible diagram view, and\n // while the source view is open the effect early-returns, so\n // showOriginalCode && view.kind === 'error' is unreachable.)\n showOriginalCode\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 }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showSourceFallback\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{view.kind === 'diagram' ? view.chartType : 'unknown'}</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 aria-label=\"Show Mermaid code\"\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\n variant=\"transparent\"\n size={28}\n className=\"action-icon\"\n aria-label={copied ? 'Mermaid code copied' : 'Copy Mermaid code'}\n onClick={copy}\n >\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={PRE_STYLE}\n role=\"button\"\n tabIndex={0}\n aria-label=\"Open Mermaid diagram in a new window\"\n onClick={viewSvgInNewWindow}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n viewSvgInNewWindow();\n }\n }}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","/**\n * Widened `define*` factory for the mantine wrapper (EXECUTION-PLAN §4\n * item 8): identity + mantine prop types + freeze, zero logic. Core\n * factories accept core fields only — passing `codeBlock` to core's\n * `defineBehaviors` is a TS error; this widened factory is the wrapper's\n * one-line obligation.\n *\n * @module define\n */\n\nimport type { AIMarkdownBehaviorProps } from '@ai-react-markdown/core';\nimport type { MantineCodeBlockOptions } from './defs';\n\n/** Behavior-system props packagable at integration time, mantine-widened. */\nexport interface MantineBehaviorProps extends AIMarkdownBehaviorProps {\n /** The mantine `codeBlock` behavior group (atomic replacement; defaults applied at read time). */\n codeBlock?: Partial<MantineCodeBlockOptions>;\n}\n\n// NON-generic on purpose — see core's `define.ts`: a fresh literal is\n// excess-property checked against the concrete parameter type.\n\n/** Freeze a mantine behaviors fragment. Identity + types + freeze; zero logic. */\nexport function defineMantineBehaviors(values: MantineBehaviorProps): Readonly<MantineBehaviorProps> {\n return Object.freeze(values);\n}\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,IAAAA,gBAA8B;AAC9B,IAAAC,eAAuB;AACvB,IAAAA,eASO;;;ACxBP,mBAAqB;AACrB,kBAA2B;AAgBzB;AADF,IAAM,kCAA8B,mBAAK,CAAC,EAAE,UAAU,UAAU,MAAM,MACpE,4CAAC,0BAAW,GAAE,QAAO,IAAI,UAAU,OAChC,UACH,CACD;AAED,4BAA4B,cAAc;AAE1C,IAAO,4BAAQ;;;ACRN,IAAAC,sBAAA;AADT,IAAM,+BAA+D,CAAC,EAAE,SAAS,MAAM;AACrF,SAAO,6CAAC,SAAI,WAAU,4BAA4B,UAAS;AAC7D;AAEA,IAAO,6BAAQ;;;ACjBf,IAAAC,gBAA8C;AAC9C,IAAAC,yBAAiD;AACjD,6BAA8B;AAC9B,uBAAiB;AACjB,IAAAC,eAAmC;;;ACOnC,IAAAC,gBAAwB;AACxB,IAAAC,eAAuC;;;ACsBhC,IAAM,iCAAoE,OAAO,OAAO;AAAA,EAC7F,iBAAiB;AAAA,EACjB,2BAA2B;AAC7B,CAAC;;;ADXM,SAAS,6BAAgE;AAC9E,QAAM,gBAAY,qCAAuB;AAGzC,QAAM,QAAQ,UAAU;AACxB,aAAO,uBAAQ,OAAO,EAAE,GAAG,gCAAgC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC;AACjF;;;AEhCA,IAAAC,gBAAsE;AACtE,4BAAwD;AACxD,IAAAC,eAAsD;AACtD,qBAAoB;AACpB,IAAAA,eAAuD;AAoSnD,IAAAC,sBAAA;AA/RJ,IAAM,YAAY,EAAE,QAAQ,WAAW,UAAU,QAAQ,OAAO,QAAQ,SAAS,SAAS;A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Ac;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyC;AACvC,QAAM,6BAAyB,6BAAe,gBAAgB;AAE9D,QAAM,qBAAiB,uBAAQ,MAAM;AACnC,WAAO,yBAAyB,EAAE,GAAG,yBAAyB,GAAG,uBAAuB,IAAI;AAAA,EAC9F,GAAG,CAAC,sBAAsB,CAAC;AAE3B,QAAM,0BAAsB,qCAAuB,OAAO;AAI1D,QAAM,aAAS,8BAAgB,EAAE,UAAU,GAAG,uBAAuB;AASrE,QAAM,qBAAiB;AAAA,IACrB,MAAO,OAAO,aAAa,OAAO,EAAE,WAAW,OAAO,UAAU,IAAI;AAAA,IACpE,CAAC,OAAO,SAAS;AAAA,EACnB;AAEA,SACE,6CAAC,4CAA4B,OAAO,gBAClC;AAAA,IAAC,aAAAC;AAAA,IAAA;AAAA,MACC,YAAYD;AAAA,MACZ;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN,GACF;AAEJ;AAoBO,IAAM,wBAAoB,oBAAK,0BAA0B;AAEhE,kBAAkB,cAAc;AAEhC,IAAO,4BAAQ;;;AO/JR,SAAS,uBAAuB,QAA8D;AACnG,SAAO,OAAO,OAAO,MAAM;AAC7B;;;ACzBA,IAAAE,eAAsC;AA0B/B,IAAM,+BAA+B,MAErC;AACL,aAAO,oCAAiC;AAC1C;","names":["import_react","import_core","import_jsx_runtime","import_react","import_code_highlight","import_core","import_react","import_core","import_react","import_core","import_jsx_runtime","mermaid","import_jsx_runtime","SpecialCodeLanguage","hljs","import_core","import_jsx_runtime","Typography","AIMarkdown","import_core"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/extra-styles/DefaultExtraStyles/%3Cinput css 7XPNkQ%3E","../src/components/extra-styles/DefaultExtraStyles/styles.scss","../src/components/customized/MermaidCode/styles.scss","../src/components/customized/MermaidCode/%3Cinput css 7C-6LZ%3E"],"sourcesContent":["@charset \"UTF-8\";\n.aim-mantine-extra-styles {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-items: flex-start;\n align-items: flex-start;\n white-space: normal;\n word-wrap: break-word;\n overflow-wrap: break-word;\n word-break: break-word;\n text-rendering: optimizeLegibility;\n --aim-font-size-mantine-base: calc(var(--aim-font-size-root) * var(--mantine-scale));\n --mantine-spacing-xs: calc(var(--aim-font-size-mantine-base) * 0.75);\n --mantine-spacing-sm: calc(var(--aim-font-size-mantine-base) * 0.875);\n --mantine-spacing-md: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-spacing-lg: calc(var(--aim-font-size-mantine-base) * 1.125);\n --mantine-spacing-xl: calc(var(--aim-font-size-mantine-base) * 1.25);\n --mantine-font-size-xs: calc(var(--aim-font-size-mantine-base) * 0.75);\n --mantine-font-size-sm: calc(var(--aim-font-size-mantine-base) * 0.875);\n --mantine-font-size-md: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-font-size-lg: calc(var(--aim-font-size-mantine-base) * 1.25);\n --mantine-font-size-xl: calc(var(--aim-font-size-mantine-base) * 2);\n --mantine-h1-font-size: calc(var(--aim-font-size-mantine-base) * 2.125);\n --mantine-h2-font-size: calc(var(--aim-font-size-mantine-base) * 1.625);\n --mantine-h3-font-size: calc(var(--aim-font-size-mantine-base) * 1.375);\n --mantine-h4-font-size: calc(var(--aim-font-size-mantine-base) * 1.125);\n --mantine-h5-font-size: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-h6-font-size: calc(var(--aim-font-size-mantine-base) * 0.875);\n}\n.aim-mantine-extra-styles :first-child {\n margin-top: 0;\n}\n.aim-mantine-extra-styles :last-child {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles {\n /* Keep the real last block margin-free while the zero-height\n streaming-cursor wrapper sits after it (core ships the same rule in\n typography/variants/default.scss). Separate ruleset on purpose:\n `:nth-child(… of …)` is Baseline 2023 and a comma-joined list would be\n dropped whole on older engines, taking `:last-child` down with it. */\n}\n.aim-mantine-extra-styles :nth-last-child(1 of :not([data-aimd-streaming-cursor], [data-aimd-tail-kind])) {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles ul,\n.aim-mantine-extra-styles ol {\n list-style-position: outside;\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.55);\n padding-inline-start: calc(var(--aim-font-size-mantine-base) * 1.5);\n}\n.aim-mantine-extra-styles ul li,\n.aim-mantine-extra-styles ol li {\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.275);\n}\n.aim-mantine-extra-styles hr {\n width: 100%;\n height: 1px;\n background-color: var(--mantine-color-text);\n}\n.aim-mantine-extra-styles ul {\n list-style-type: disc;\n}\n.aim-mantine-extra-styles ul ul {\n list-style-type: circle;\n}\n.aim-mantine-extra-styles ul ul ul {\n list-style-type: square;\n}\n.aim-mantine-extra-styles ol {\n list-style-type: decimal;\n}\n.aim-mantine-extra-styles p {\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.5);\n}\n.aim-mantine-extra-styles p:last-child {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles p {\n /* Separate ruleset — see the note on the top-level rule above. */\n}\n.aim-mantine-extra-styles p:nth-last-child(1 of :not([data-aimd-streaming-cursor], [data-aimd-tail-kind])) {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles blockquote {\n font-size: var(--mantine-font-size-md);\n}\n.aim-mantine-extra-styles table caption {\n font-size: var(--mantine-font-size-md);\n}\n.aim-mantine-extra-styles table th {\n font-size: var(--mantine-font-size-md);\n}\n.aim-mantine-extra-styles pre code {\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n word-break: break-word;\n}\n.aim-mantine-extra-styles dl {\n display: flex;\n flex-wrap: wrap;\n width: 100%;\n max-width: 670px;\n}\n.aim-mantine-extra-styles dl > * {\n padding-top: calc(var(--aim-font-size-mantine-base) * 0.5);\n}\n.aim-mantine-extra-styles dt {\n width: 30%;\n font-weight: bold;\n text-align: right;\n}\n.aim-mantine-extra-styles dd {\n width: 60%;\n padding-left: calc(var(--aim-font-size-mantine-base) * 0.5);\n margin-left: 0px;\n}\n.aim-mantine-extra-styles dd + dd {\n width: 100%;\n padding-left: calc(30% + var(--aim-font-size-mantine-base));\n}\n.aim-mantine-extra-styles dt + dt {\n padding-right: 60%;\n}\n.aim-mantine-extra-styles dt + dt + dd {\n margin-top: calc(var(--aim-font-size-mantine-base) * -1.625);\n padding-left: calc(30% + var(--aim-font-size-mantine-base));\n}\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFFQTtFQUNBO0VBQ0E7RUFDQTtFQUVBO0VBRUE7RUFFQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBRUE7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUVBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFFQTtFQUNFOztBQUdGO0VBQ0U7O0FBeENKO0FBMkNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBS0E7RUFDRTs7QUFHRjtBQUFBO0VBRUU7RUFFQTtFQUNBOztBQUVBO0FBQUE7RUFDRTs7QUFJSjtFQUNFO0VBQ0E7RUFDQTs7QUFHRjtFQUNFOztBQUdGO0VBQ0U7O0FBR0Y7RUFDRTs7QUFHRjtFQUNFOztBQUdGO0VBQ0U7O0FBRUE7RUFDRTs7QUFKSjtBQU9FOztBQUNBO0VBQ0U7O0FBSUo7RUFDRTs7QUFJQTtFQUNFOztBQUVGO0VBQ0U7O0FBSUo7RUFDRTtFQUNBO0VBQ0E7RUFDQTs7QUFHRjtFQUNFO0VBQ0E7RUFDQTtFQUNBOztBQUVGO0VBQ0U7O0FBRUY7RUFDRTtFQUNBO0VBQ0E7O0FBRUY7RUFDRTtFQUNBO0VBQ0E7O0FB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ctbGVmdDogY2FsYygzMCUgKyB2YXIoLS1haW0tZm9udC1zaXplLW1hbnRpbmUtYmFzZSkpO1xuICB9XG59XG4iXX0= */",".aim-mantine-extra-styles {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-items: flex-start;\n align-items: flex-start;\n\n white-space: normal;\n word-wrap: break-word;\n overflow-wrap: break-word;\n word-break: break-word;\n\n text-rendering: optimizeLegibility;\n\n --aim-font-size-mantine-base: calc(var(--aim-font-size-root) * var(--mantine-scale));\n\n --mantine-spacing-xs: calc(var(--aim-font-size-mantine-base) * 0.75);\n --mantine-spacing-sm: calc(var(--aim-font-size-mantine-base) * 0.875);\n --mantine-spacing-md: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-spacing-lg: calc(var(--aim-font-size-mantine-base) * 1.125);\n --mantine-spacing-xl: calc(var(--aim-font-size-mantine-base) * 1.25);\n\n --mantine-font-size-xs: calc(var(--aim-font-size-mantine-base) * 0.75);\n --mantine-font-size-sm: calc(var(--aim-font-size-mantine-base) * 0.875);\n --mantine-font-size-md: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-font-size-lg: calc(var(--aim-font-size-mantine-base) * 1.25);\n --mantine-font-size-xl: calc(var(--aim-font-size-mantine-base) * 2);\n\n --mantine-h1-font-size: calc(var(--aim-font-size-mantine-base) * 2.125);\n --mantine-h2-font-size: calc(var(--aim-font-size-mantine-base) * 1.625);\n --mantine-h3-font-size: calc(var(--aim-font-size-mantine-base) * 1.375);\n --mantine-h4-font-size: calc(var(--aim-font-size-mantine-base) * 1.125);\n --mantine-h5-font-size: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-h6-font-size: calc(var(--aim-font-size-mantine-base) * 0.875);\n\n :first-child {\n margin-top: 0;\n }\n\n :last-child {\n margin-bottom: 0;\n }\n\n /* Keep the real last block margin-free while the zero-height\n streaming-cursor wrapper sits after it (core ships the same rule in\n typography/variants/default.scss). Separate ruleset on purpose:\n `:nth-child(… of …)` is Baseline 2023 and a comma-joined list would be\n dropped whole on older engines, taking `:last-child` down with it. */\n :nth-last-child(1 of :not([data-aimd-streaming-cursor], [data-aimd-tail-kind])) {\n margin-bottom: 0;\n }\n\n ul,\n ol {\n list-style-position: outside;\n\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.55);\n padding-inline-start: calc(var(--aim-font-size-mantine-base) * 1.5);\n\n li {\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.275);\n }\n }\n\n hr {\n width: 100%;\n height: 1px;\n background-color: var(--mantine-color-text);\n }\n\n ul {\n list-style-type: disc;\n }\n\n ul ul {\n list-style-type: circle;\n }\n\n ul ul ul {\n list-style-type: square;\n }\n\n ol {\n list-style-type: decimal;\n }\n\n p {\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.5);\n\n &:last-child {\n margin-bottom: 0;\n }\n\n /* Separate ruleset — see the note on the top-level rule above. */\n &:nth-last-child(1 of :not([data-aimd-streaming-cursor], [data-aimd-tail-kind])) {\n margin-bottom: 0;\n }\n }\n\n blockquote {\n font-size: var(--mantine-font-size-md);\n }\n\n table {\n caption {\n font-size: var(--mantine-font-size-md);\n }\n th {\n font-size: var(--mantine-font-size-md);\n }\n }\n\n pre code {\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n word-break: break-word;\n }\n\n dl {\n display: flex;\n flex-wrap: wrap;\n width: 100%;\n max-width: 670px;\n }\n dl > * {\n padding-top: calc(var(--aim-font-size-mantine-base) * 0.5);\n }\n dt {\n width: 30%;\n font-weight: bold;\n text-align: right;\n }\n dd {\n width: 60%;\n padding-left: calc(var(--aim-font-size-mantine-base) * 0.5);\n margin-left: 0px;\n }\n dd + dd {\n width: 100%;\n padding-left: calc(30% + var(--aim-font-size-mantine-base));\n }\n dt + dt {\n padding-right: 60%;\n }\n dt + dt + dd {\n margin-top: calc(var(--aim-font-size-mantine-base) * -1.625);\n padding-left: calc(30% + var(--aim-font-size-mantine-base));\n }\n}\n",".aim-mantine-mermaid-code {\n width: 100%;\n margin-bottom: 15px;\n background: var(--mantine-color-gray-0);\n border: 1px solid var(--mantine-color-gray-2);\n padding: calc(0.75rem * var(--mantine-scale)) calc(0.625rem * var(--mantine-scale));\n display: flex;\n flex-shrink: 0;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n\n .chart-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-shrink: 0;\n\n .chart-type-tag {\n padding: calc(0.2125rem * var(--mantine-scale)) calc(0.5625rem * var(--mantine-scale));\n color: black;\n border: 1px solid var(--mantine-color-gray-3);\n background: white;\n border-radius: var(--mantine-radius-default);\n font-size: var(--mantine-font-size-xs);\n font-weight: 700;\n }\n\n .action-icon {\n color: var(--mantine-color-text);\n opacity: 0.5;\n\n &:hover {\n color: var(--mantine-color-bright);\n opacity: 1;\n }\n }\n }\n\n & > pre {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n }\n}\n\n.aim-mantine-mermaid-code.dark {\n background: var(--mantine-color-dark-8);\n border-color: var(--mantine-color-dark-6);\n\n .chart-header {\n .chart-type-tag {\n color: var(--mantine-color-dark-0);\n border-color: var(--mantine-color-dark-6);\n background: var(--mantine-color-dark-8);\n }\n\n .action-icon {\n color: var(--mantine-color-text);\n }\n }\n}\n",".aim-mantine-mermaid-code {\n width: 100%;\n margin-bottom: 15px;\n background: var(--mantine-color-gray-0);\n border: 1px solid var(--mantine-color-gray-2);\n padding: calc(0.75rem * var(--mantine-scale)) calc(0.625rem * var(--mantine-scale));\n display: flex;\n flex-shrink: 0;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n}\n.aim-mantine-mermaid-code .chart-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-shrink: 0;\n}\n.aim-mantine-mermaid-code .chart-header .chart-type-tag {\n padding: calc(0.2125rem * var(--mantine-scale)) calc(0.5625rem * var(--mantine-scale));\n color: black;\n border: 1px solid var(--mantine-color-gray-3);\n background: white;\n border-radius: var(--mantine-radius-default);\n font-size: var(--mantine-font-size-xs);\n font-weight: 700;\n}\n.aim-mantine-mermaid-code .chart-header .action-icon {\n color: var(--mantine-color-text);\n opacity: 0.5;\n}\n.aim-mantine-mermaid-code .chart-header .action-icon:hover {\n color: var(--mantine-color-bright);\n opacity: 1;\n}\n.aim-mantine-mermaid-code > pre {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n}\n\n.aim-mantine-mermaid-code.dark {\n background: var(--mantine-color-dark-8);\n border-color: var(--mantine-color-dark-6);\n}\n.aim-mantine-mermaid-code.dark .chart-header .chart-type-tag {\n color: var(--mantine-color-dark-0);\n border-color: var(--mantine-color-dark-6);\n background: var(--mantine-color-dark-8);\n}\n.aim-mantine-mermaid-code.dark .chart-header .action-icon {\n color: var(--mantine-color-text);\n}\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFHRjtFQUNFO0VBQ0E7O0FBRUE7RUFDRTtFQUNBOztBQUtOO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7O0FBSUo7RUFDRTtFQUNBOztBQUdFO0VBQ0U7RUFDQTtFQUNBOztBQUdGO0VBQ0UiLCJzb3VyY2VzQ29udGVudCI6WyIuYWltLW1hbnRpbmUtbWVybWFpZC1jb2RlIHtcbiAgd2lkdGg6IDEwMCU7XG4gIG1hcmdpbi1ib3R0b206IDE1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A,IAAA;AACA,WAAA;AACA,eAAA;AACA,kBAAA;AACA,mBAAA;AACA,eAAA;ACCF;ADCE,CAZF,yBAYE,CAAA;AACE,SAAA;AACA,WAAA;AACA,kBAAA;AACA,mBAAA;AACA,eAAA;AACA,eAAA;ACCJ;ADCI,CApBJ,yBAoBI,CARF,aAQE,CAAA;AACE,WAAA,KAAA,UAAA,EAAA,IAAA,kBAAA,KAAA,UAAA,EAAA,IAAA;AACA,SAAA;AACA,UAAA,IAAA,MAAA,IAAA;AACA,cAAA;AACA,iBAAA,IAAA;AACA,aAAA,IAAA;AACA,eAAA;ACCN;ADEI,CA9BJ,yBA8BI,CAlBF,aAkBE,CAAA;AACE,SAAA,IAAA;AACA,WAAA;ACAN;ADEM,CAlCN,yBAkCM,CAtBJ,aAsBI,CAJF,WAIE;AACE,SAAA,IAAA;AACA,WAAA;ACAR;ADKE,CAzCF,yBAyCE,EAAA;AACE,eAAA;AACA,WAAA;AACA,kBAAA;AACA,mBAAA;AACA,eAAA;ACHJ;ADOA,CAlDA,wBAkDA,CAAA;AACE,cAAA,IAAA;AACA,gBAAA,IAAA;ACJF;ADOI,CAvDJ,wBAuDI,CALJ,KAKI,CA3CF,aA2CE,CAnCA;AAoCE,SAAA,IAAA;AACA,gBAAA,IAAA;AACA,cAAA,IAAA;ACLN;ADQI,CA7DJ,wBA6DI,CAXJ,KAWI,CAjDF,aAiDE,CA/BA;AAgCE,SAAA,IAAA;ACNN;","names":[]}
1
+ {"version":3,"sources":["../src/components/extra-styles/DefaultExtraStyles/%3Cinput css 4LozqI%3E","../src/components/extra-styles/DefaultExtraStyles/styles.scss","../src/components/customized/MermaidCode/styles.scss","../src/components/customized/MermaidCode/%3Cinput css jUV-Zr%3E"],"sourcesContent":["@charset \"UTF-8\";\n.aim-mantine-extra-styles {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-items: flex-start;\n align-items: flex-start;\n white-space: normal;\n word-wrap: break-word;\n overflow-wrap: break-word;\n word-break: break-word;\n text-rendering: optimizeLegibility;\n --aim-font-size-mantine-base: calc(var(--aim-font-size-root) * var(--mantine-scale));\n --mantine-spacing-xs: calc(var(--aim-font-size-mantine-base) * 0.75);\n --mantine-spacing-sm: calc(var(--aim-font-size-mantine-base) * 0.875);\n --mantine-spacing-md: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-spacing-lg: calc(var(--aim-font-size-mantine-base) * 1.125);\n --mantine-spacing-xl: calc(var(--aim-font-size-mantine-base) * 1.25);\n --mantine-font-size-xs: calc(var(--aim-font-size-mantine-base) * 0.75);\n --mantine-font-size-sm: calc(var(--aim-font-size-mantine-base) * 0.875);\n --mantine-font-size-md: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-font-size-lg: calc(var(--aim-font-size-mantine-base) * 1.25);\n --mantine-font-size-xl: calc(var(--aim-font-size-mantine-base) * 2);\n --mantine-h1-font-size: calc(var(--aim-font-size-mantine-base) * 2.125);\n --mantine-h2-font-size: calc(var(--aim-font-size-mantine-base) * 1.625);\n --mantine-h3-font-size: calc(var(--aim-font-size-mantine-base) * 1.375);\n --mantine-h4-font-size: calc(var(--aim-font-size-mantine-base) * 1.125);\n --mantine-h5-font-size: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-h6-font-size: calc(var(--aim-font-size-mantine-base) * 0.875);\n}\n.aim-mantine-extra-styles :first-child {\n margin-top: 0;\n}\n.aim-mantine-extra-styles :last-child {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles {\n /* Keep the real last block margin-free while the zero-height\n streaming-cursor wrapper sits after it (core ships the same rule in\n typography/variants/default.scss). Separate ruleset on purpose:\n `:nth-child(… of …)` is Baseline 2023 and a comma-joined list would be\n dropped whole on older engines, taking `:last-child` down with it. */\n}\n.aim-mantine-extra-styles :nth-last-child(1 of :not([data-aimd-streaming-cursor], [data-aimd-tail-kind])) {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles ul,\n.aim-mantine-extra-styles ol {\n list-style-position: outside;\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.55);\n padding-inline-start: calc(var(--aim-font-size-mantine-base) * 1.5);\n}\n.aim-mantine-extra-styles ul li,\n.aim-mantine-extra-styles ol li {\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.275);\n}\n.aim-mantine-extra-styles hr {\n width: 100%;\n height: 1px;\n background-color: var(--mantine-color-text);\n}\n.aim-mantine-extra-styles ul {\n list-style-type: disc;\n}\n.aim-mantine-extra-styles ul ul {\n list-style-type: circle;\n}\n.aim-mantine-extra-styles ul ul ul {\n list-style-type: square;\n}\n.aim-mantine-extra-styles ol {\n list-style-type: decimal;\n}\n.aim-mantine-extra-styles p {\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.5);\n}\n.aim-mantine-extra-styles p:last-child {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles p {\n /* Separate ruleset — see the note on the top-level rule above. */\n}\n.aim-mantine-extra-styles p:nth-last-child(1 of :not([data-aimd-streaming-cursor], [data-aimd-tail-kind])) {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles blockquote {\n font-size: var(--mantine-font-size-md);\n}\n.aim-mantine-extra-styles table caption {\n font-size: var(--mantine-font-size-md);\n}\n.aim-mantine-extra-styles table th {\n font-size: var(--mantine-font-size-md);\n}\n.aim-mantine-extra-styles pre code {\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n word-break: break-word;\n}\n.aim-mantine-extra-styles dl {\n display: flex;\n flex-wrap: wrap;\n width: 100%;\n max-width: 670px;\n}\n.aim-mantine-extra-styles dl > * {\n padding-top: calc(var(--aim-font-size-mantine-base) * 0.5);\n}\n.aim-mantine-extra-styles dt {\n width: 30%;\n font-weight: bold;\n text-align: right;\n}\n.aim-mantine-extra-styles dd {\n width: 60%;\n padding-left: calc(var(--aim-font-size-mantine-base) * 0.5);\n margin-left: 0px;\n}\n.aim-mantine-extra-styles dd + dd {\n width: 100%;\n padding-left: calc(30% + var(--aim-font-size-mantine-base));\n}\n.aim-mantine-extra-styles dt + dt {\n padding-right: 60%;\n}\n.aim-mantine-extra-styles dt + dt + dd {\n margin-top: calc(var(--aim-font-size-mantine-base) * -1.625);\n padding-left: calc(30% + var(--aim-font-size-mantine-base));\n}\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFFQTtFQUNBO0VBQ0E7RUFDQTtFQUVBO0VBRUE7RUFFQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBRUE7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUVBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFFQTtFQUNFOztBQUdGO0VBQ0U7O0FBeENKO0FBMkNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBS0E7RUFDRTs7QUFHRjtBQUFBO0VBRUU7RUFFQTtFQUNBOztBQUVBO0FBQUE7RUFDRTs7QUFJSjtFQUNFO0VBQ0E7RUFDQTs7QUFHRjtFQUNFOztBQUdGO0VBQ0U7O0FBR0Y7RUFDRTs7QUFHRjtFQUNFOztBQUdGO0VBQ0U7O0FBRUE7RUFDRTs7QUFKSjtBQU9FOztBQUNBO0VBQ0U7O0FBSUo7RUFDRTs7QUFJQTtFQUNFOztBQUVGO0VBQ0U7O0FBSUo7RUFDRTtFQUNBO0VBQ0E7RUFDQTs7QUFHRjtFQUNFO0VBQ0E7RUFDQTtFQUNBOztBQUVGO0VBQ0U7O0FBRUY7RUFDRTtFQUNBO0VBQ0E7O0FBRUY7RUFDRTtFQUNBO0VBQ0E7O0FBRUY7RUFDRTtFQUNBOztBQUVGO0VBQ0U7O0FBRUY7RUFDRTtFQUNBIiwic291cmNlc0NvbnRlbnQiOlsiLmFpbS1tYW50aW5lLWV4dHJhLXN0eWxlcyB7XG4gIHd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BwcmUtd3JhcDtcbiAgICB3b3JkLXdyYXA6IGJyZWFrLXdvcmQ7XG4gICAgb3ZlcmZsb3ctd3JhcDogYnJlYWstd29yZDtcbiAgICB3b3JkLWJyZWFrOiBicmVhay13b3JkO1xuICB9XG5cbiAgZGwge1xuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgZmxleC13cmFwOiB3cmFwO1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIG1heC13aWR0aDogNjcwcHg7XG4gIH1cbiAgZGwgPiAqIHtcbiAgICBwYWRkaW5nLXRvcDogY2FsYyh2YXIoLS1haW0tZm9udC1zaXplLW1hbnRpbmUtYmFzZSkgKiAwLjUpO1xuICB9XG4gIGR0IHtcbiAgICB3aWR0aDogMzAlO1xuICAgIGZvbnQtd2VpZ2h0OiBib2xkO1xuICAgIHRleHQtYWxpZ246IHJpZ2h0O1xuICB9XG4gIGRkIHtcbiAgICB3aWR0aDogNjAlO1xuICAgIHBhZGRpbmctbGVmdDogY2FsYyh2YXIoLS1haW0tZm9udC1zaXplLW1hbnRpbmUtYmFzZSkgKiAwLjUpO1xuICAgIG1hcmdpbi1sZWZ0OiAwcHg7XG4gIH1cbiAgZGQgKyBkZCB7XG4gICAgd2lkdGg6IDEwMCU7XG4gICAgcGFkZGluZy1sZWZ0OiBjYWxjKDMwJSArIHZhcigtLWFpbS1mb250LXNpemUtbWFudGluZS1iYXNlKSk7XG4gIH1cbiAgZHQgKyBkdCB7XG4gICAgcGFkZGluZy1yaWdodDogNjAlO1xuICB9XG4gIGR0ICsgZHQgKyBkZCB7XG4gICAgbWFyZ2luLXRvcDogY2FsYyh2YXIoLS1haW0tZm9udC1zaXplLW1hbnRpbmUtYmFzZSkgKiAtMS42MjUpO1xuICAgIHBhZGRpbmctbGVmdDogY2FsYygzMCUgKyB2YXIoLS1haW0tZm9udC1zaXplLW1hbnRpbmUtYmFzZSkpO1xuICB9XG59XG4iXX0= */",".aim-mantine-extra-styles {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-items: flex-start;\n align-items: flex-start;\n\n white-space: normal;\n word-wrap: break-word;\n overflow-wrap: break-word;\n word-break: break-word;\n\n text-rendering: optimizeLegibility;\n\n --aim-font-size-mantine-base: calc(var(--aim-font-size-root) * var(--mantine-scale));\n\n --mantine-spacing-xs: calc(var(--aim-font-size-mantine-base) * 0.75);\n --mantine-spacing-sm: calc(var(--aim-font-size-mantine-base) * 0.875);\n --mantine-spacing-md: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-spacing-lg: calc(var(--aim-font-size-mantine-base) * 1.125);\n --mantine-spacing-xl: calc(var(--aim-font-size-mantine-base) * 1.25);\n\n --mantine-font-size-xs: calc(var(--aim-font-size-mantine-base) * 0.75);\n --mantine-font-size-sm: calc(var(--aim-font-size-mantine-base) * 0.875);\n --mantine-font-size-md: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-font-size-lg: calc(var(--aim-font-size-mantine-base) * 1.25);\n --mantine-font-size-xl: calc(var(--aim-font-size-mantine-base) * 2);\n\n --mantine-h1-font-size: calc(var(--aim-font-size-mantine-base) * 2.125);\n --mantine-h2-font-size: calc(var(--aim-font-size-mantine-base) * 1.625);\n --mantine-h3-font-size: calc(var(--aim-font-size-mantine-base) * 1.375);\n --mantine-h4-font-size: calc(var(--aim-font-size-mantine-base) * 1.125);\n --mantine-h5-font-size: calc(var(--aim-font-size-mantine-base) * 1);\n --mantine-h6-font-size: calc(var(--aim-font-size-mantine-base) * 0.875);\n\n :first-child {\n margin-top: 0;\n }\n\n :last-child {\n margin-bottom: 0;\n }\n\n /* Keep the real last block margin-free while the zero-height\n streaming-cursor wrapper sits after it (core ships the same rule in\n typography/variants/default.scss). Separate ruleset on purpose:\n `:nth-child(… of …)` is Baseline 2023 and a comma-joined list would be\n dropped whole on older engines, taking `:last-child` down with it. */\n :nth-last-child(1 of :not([data-aimd-streaming-cursor], [data-aimd-tail-kind])) {\n margin-bottom: 0;\n }\n\n ul,\n ol {\n list-style-position: outside;\n\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.55);\n padding-inline-start: calc(var(--aim-font-size-mantine-base) * 1.5);\n\n li {\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.275);\n }\n }\n\n hr {\n width: 100%;\n height: 1px;\n background-color: var(--mantine-color-text);\n }\n\n ul {\n list-style-type: disc;\n }\n\n ul ul {\n list-style-type: circle;\n }\n\n ul ul ul {\n list-style-type: square;\n }\n\n ol {\n list-style-type: decimal;\n }\n\n p {\n margin-bottom: calc(var(--aim-font-size-mantine-base) * 0.5);\n\n &:last-child {\n margin-bottom: 0;\n }\n\n /* Separate ruleset — see the note on the top-level rule above. */\n &:nth-last-child(1 of :not([data-aimd-streaming-cursor], [data-aimd-tail-kind])) {\n margin-bottom: 0;\n }\n }\n\n blockquote {\n font-size: var(--mantine-font-size-md);\n }\n\n table {\n caption {\n font-size: var(--mantine-font-size-md);\n }\n th {\n font-size: var(--mantine-font-size-md);\n }\n }\n\n pre code {\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n word-break: break-word;\n }\n\n dl {\n display: flex;\n flex-wrap: wrap;\n width: 100%;\n max-width: 670px;\n }\n dl > * {\n padding-top: calc(var(--aim-font-size-mantine-base) * 0.5);\n }\n dt {\n width: 30%;\n font-weight: bold;\n text-align: right;\n }\n dd {\n width: 60%;\n padding-left: calc(var(--aim-font-size-mantine-base) * 0.5);\n margin-left: 0px;\n }\n dd + dd {\n width: 100%;\n padding-left: calc(30% + var(--aim-font-size-mantine-base));\n }\n dt + dt {\n padding-right: 60%;\n }\n dt + dt + dd {\n margin-top: calc(var(--aim-font-size-mantine-base) * -1.625);\n padding-left: calc(30% + var(--aim-font-size-mantine-base));\n }\n}\n",".aim-mantine-mermaid-code {\n width: 100%;\n margin-bottom: 15px;\n background: var(--mantine-color-gray-0);\n border: 1px solid var(--mantine-color-gray-2);\n padding: calc(0.75rem * var(--mantine-scale)) calc(0.625rem * var(--mantine-scale));\n display: flex;\n flex-shrink: 0;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n\n .chart-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-shrink: 0;\n\n .chart-type-tag {\n padding: calc(0.2125rem * var(--mantine-scale)) calc(0.5625rem * var(--mantine-scale));\n color: black;\n border: 1px solid var(--mantine-color-gray-3);\n background: white;\n border-radius: var(--mantine-radius-default);\n font-size: var(--mantine-font-size-xs);\n font-weight: 700;\n }\n\n .action-icon {\n color: var(--mantine-color-text);\n opacity: 0.5;\n\n &:hover {\n color: var(--mantine-color-bright);\n opacity: 1;\n }\n }\n }\n\n & > pre {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n }\n}\n\n.aim-mantine-mermaid-code.dark {\n background: var(--mantine-color-dark-8);\n border-color: var(--mantine-color-dark-6);\n\n .chart-header {\n .chart-type-tag {\n color: var(--mantine-color-dark-0);\n border-color: var(--mantine-color-dark-6);\n background: var(--mantine-color-dark-8);\n }\n\n .action-icon {\n color: var(--mantine-color-text);\n }\n }\n}\n",".aim-mantine-mermaid-code {\n width: 100%;\n margin-bottom: 15px;\n background: var(--mantine-color-gray-0);\n border: 1px solid var(--mantine-color-gray-2);\n padding: calc(0.75rem * var(--mantine-scale)) calc(0.625rem * var(--mantine-scale));\n display: flex;\n flex-shrink: 0;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n}\n.aim-mantine-mermaid-code .chart-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-shrink: 0;\n}\n.aim-mantine-mermaid-code .chart-header .chart-type-tag {\n padding: calc(0.2125rem * var(--mantine-scale)) calc(0.5625rem * var(--mantine-scale));\n color: black;\n border: 1px solid var(--mantine-color-gray-3);\n background: white;\n border-radius: var(--mantine-radius-default);\n font-size: var(--mantine-font-size-xs);\n font-weight: 700;\n}\n.aim-mantine-mermaid-code .chart-header .action-icon {\n color: var(--mantine-color-text);\n opacity: 0.5;\n}\n.aim-mantine-mermaid-code .chart-header .action-icon:hover {\n color: var(--mantine-color-bright);\n opacity: 1;\n}\n.aim-mantine-mermaid-code > pre {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n}\n\n.aim-mantine-mermaid-code.dark {\n background: var(--mantine-color-dark-8);\n border-color: var(--mantine-color-dark-6);\n}\n.aim-mantine-mermaid-code.dark .chart-header .chart-type-tag {\n color: var(--mantine-color-dark-0);\n border-color: var(--mantine-color-dark-6);\n background: var(--mantine-color-dark-8);\n}\n.aim-mantine-mermaid-code.dark .chart-header .action-icon {\n color: var(--mantine-color-text);\n}\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFHRjtFQUNFO0VBQ0E7O0FBRUE7RUFDRTtFQUNBOztBQUtOO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7O0FBSUo7RUFDRTtFQUNBOztBQUdFO0VBQ0U7RUFDQTtFQUNBOztBQUdGO0VBQ0UiLCJzb3VyY2VzQ29udGVudCI6WyIuYWltLW1hbnRpbmUtbWVybWFpZC1jb2RlIHtcbiAgd2lkdGg6IDEwMCU7XG4gIG1hcmdpbi1ib3R0b206IDE1cHg7XG4gIGJhY2tncm91bmQ6IHZhcigtLW1hbnRpbmUtY29sb3ItZ3JheS0wKTtcbiAgYm9yZGVyOiAxcHggc29saWQgdmFyKC0tbWFudGluZS1jb2xvci1ncmF5LTIp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ACA,eAAA;AACA,eAAA;ACCJ;ADCI,CApBJ,yBAoBI,CARF,aAQE,CAAA;AACE,WAAA,KAAA,UAAA,EAAA,IAAA,kBAAA,KAAA,UAAA,EAAA,IAAA;AACA,SAAA;AACA,UAAA,IAAA,MAAA,IAAA;AACA,cAAA;AACA,iBAAA,IAAA;AACA,aAAA,IAAA;AACA,eAAA;ACCN;ADEI,CA9BJ,yBA8BI,CAlBF,aAkBE,CAAA;AACE,SAAA,IAAA;AACA,WAAA;ACAN;ADEM,CAlCN,yBAkCM,CAtBJ,aAsBI,CAJF,WAIE;AACE,SAAA,IAAA;AACA,WAAA;ACAR;ADKE,CAzCF,yBAyCE,EAAA;AACE,eAAA;AACA,WAAA;AACA,kBAAA;AACA,mBAAA;AACA,eAAA;ACHJ;ADOA,CAlDA,wBAkDA,CAAA;AACE,cAAA,IAAA;AACA,gBAAA,IAAA;ACJF;ADOI,CAvDJ,wBAuDI,CALJ,KAKI,CA3CF,aA2CE,CAnCA;AAoCE,SAAA,IAAA;AACA,gBAAA,IAAA;AACA,cAAA,IAAA;ACLN;ADQI,CA7DJ,wBA6DI,CAXJ,KAWI,CAjDF,aAiDE,CA/BA;AAgCE,SAAA,IAAA;ACNN;","names":[]}
package/dist/index.js CHANGED
@@ -237,34 +237,61 @@ var MantineAIMMermaidCode = memo2((props) => {
237
237
  size: 28,
238
238
  className: "action-icon",
239
239
  variant: "transparent",
240
+ "aria-label": "Show Mermaid code",
240
241
  onClick: () => {
241
242
  setShowOriginalCode(true);
242
243
  },
243
244
  children: /* @__PURE__ */ jsx3(Flex, { align: "center", justify: "center", w: 18, h: 18, children: /* @__PURE__ */ jsx3("span", { className: "icon-[entypo--code] relative bottom-[0.25px] text-[16px]" }) })
244
245
  }
245
246
  ) }),
246
- /* @__PURE__ */ jsx3(CopyButton, { value: props.code, children: ({ copied, copy }) => /* @__PURE__ */ jsx3(Tooltip, { label: copied ? "Copied" : "Copy", withArrow: true, position: "right", children: /* @__PURE__ */ jsx3(ActionIcon, { variant: "transparent", size: 28, className: "action-icon", onClick: copy, children: copied ? /* @__PURE__ */ jsx3("span", { className: "icon-origin-[lucide--check] text-[18px]" }) : /* @__PURE__ */ jsxs(
247
- "svg",
247
+ /* @__PURE__ */ jsx3(CopyButton, { value: props.code, children: ({ copied, copy }) => /* @__PURE__ */ jsx3(Tooltip, { label: copied ? "Copied" : "Copy", withArrow: true, position: "right", children: /* @__PURE__ */ jsx3(
248
+ ActionIcon,
248
249
  {
249
- xmlns: "http://www.w3.org/2000/svg",
250
- viewBox: "0 0 24 24",
251
- strokeWidth: "2",
252
- stroke: "currentColor",
253
- fill: "none",
254
- strokeLinecap: "round",
255
- strokeLinejoin: "round",
256
- width: "18px",
257
- height: "18px",
258
- children: [
259
- /* @__PURE__ */ jsx3("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
260
- /* @__PURE__ */ jsx3("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" }),
261
- /* @__PURE__ */ jsx3("path", { d: "M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" })
262
- ]
250
+ variant: "transparent",
251
+ size: 28,
252
+ className: "action-icon",
253
+ "aria-label": copied ? "Mermaid code copied" : "Copy Mermaid code",
254
+ onClick: copy,
255
+ children: copied ? /* @__PURE__ */ jsx3("span", { className: "icon-origin-[lucide--check] text-[18px]" }) : /* @__PURE__ */ jsxs(
256
+ "svg",
257
+ {
258
+ xmlns: "http://www.w3.org/2000/svg",
259
+ viewBox: "0 0 24 24",
260
+ strokeWidth: "2",
261
+ stroke: "currentColor",
262
+ fill: "none",
263
+ strokeLinecap: "round",
264
+ strokeLinejoin: "round",
265
+ width: "18px",
266
+ height: "18px",
267
+ children: [
268
+ /* @__PURE__ */ jsx3("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
269
+ /* @__PURE__ */ jsx3("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" }),
270
+ /* @__PURE__ */ jsx3("path", { d: "M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" })
271
+ ]
272
+ }
273
+ )
263
274
  }
264
- ) }) }) })
275
+ ) }) })
265
276
  ] })
266
277
  ] }),
267
- /* @__PURE__ */ jsx3("pre", { ref, style: PRE_STYLE, onClick: viewSvgInNewWindow })
278
+ /* @__PURE__ */ jsx3(
279
+ "pre",
280
+ {
281
+ ref,
282
+ style: PRE_STYLE,
283
+ role: "button",
284
+ tabIndex: 0,
285
+ "aria-label": "Open Mermaid diagram in a new window",
286
+ onClick: viewSvgInNewWindow,
287
+ onKeyDown: (event) => {
288
+ if (event.key === "Enter" || event.key === " ") {
289
+ event.preventDefault();
290
+ viewSvgInNewWindow();
291
+ }
292
+ }
293
+ }
294
+ )
268
295
  ]
269
296
  }
270
297
  )
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/components/customized/PreCode.tsx","../src/hooks/useMantineCodeBlockOptions.ts","../src/defs.tsx","../src/components/customized/MermaidCode/index.tsx","../src/define.ts","../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 {\n type AIMarkdownProps,\n type AIMarkdownCustomComponents,\n type AIMarkdownBehaviorGroups,\n type AIMarkdownStabilityTable,\n AIMarkdownBehaviorsProvider,\n AIMarkdownStabilityPolicy,\n useStableRecord,\n useStableValue,\n} from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownMetadata, MantineCodeBlockOptions } 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 the mantine behavior groups.\n * All core props (`content`, `streaming`, `fontSize`, `enginePlugins`, etc.)\n * are inherited.\n *\n * @typeParam TMetadata - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TMetadata> {\n /**\n * Code-block behavior group (Behaviors system). The group value replaces\n * atomically; omitted fields resolve to the shipped defaults inside\n * `useMantineCodeBlockOptions()`. `null` counts as absent. When absent,\n * this wrapper contributes NO `codeBlock` group, so a group provided by\n * an outer app-level `AIMarkdownBehaviorsProvider` passes through; when\n * present, this prop wins over any outer group (inner-wins merge).\n */\n codeBlock?: Partial<MantineCodeBlockOptions>;\n}\n\n/**\n * Stable empty CONTRIBUTION for the absent-prop case. Deliberately carries\n * no `codeBlock` key at all: contributing `codeBlock: {}` would shadow a\n * group provided by an outer app-level `AIMarkdownBehaviorsProvider`\n * (inner-wins merge) even though this wrapper has nothing to say — the\n * documented app-level extension path would silently go dead.\n */\nconst NO_GROUPS: AIMarkdownBehaviorGroups = Object.freeze({});\n\n/**\n * Mantine's stability-firewall table — one row today: `codeBlock` is the\n * only object prop this wrapper TERMINATES (consumes in its own machinery).\n * Forwarded object props ride core's firewall untouched; the merged\n * `customComponents` derived below is caught by core's wall.\n */\nconst MANTINE_STABILITY_TABLE: AIMarkdownStabilityTable<{\n codeBlock: Partial<MantineCodeBlockOptions> | undefined;\n}> = {\n codeBlock: AIMarkdownStabilityPolicy.DEEP_EQUAL,\n};\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 TMetadata - Metadata type.\n */\nconst MantineAIMarkdownComponent = <TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n customComponents,\n colorScheme,\n codeBlock,\n ...props\n}: MantineAIMarkdownProps<TMetadata>) => {\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 // Mantine's stability firewall: `codeBlock` is terminated here (it feeds\n // the behaviors Provider below, not the core prop surface).\n const stable = useStableRecord({ codeBlock }, MANTINE_STABILITY_TABLE);\n\n // Contribute the group through the additive behaviors Provider — firewall\n // output used directly, record identity memoized so the context value\n // stays stable across unrelated re-renders. `null`/absent prop ≡ no\n // contribution (NOT an empty group): an outer app-level Provider's\n // `codeBlock` group then stays visible; when the prop IS present the\n // inner-wins merge gives this wrapper's value precedence. The narrow hook\n // fills the defaults for the no-group-anywhere case.\n const behaviorGroups = useMemo<AIMarkdownBehaviorGroups>(\n () => (stable.codeBlock != null ? { codeBlock: stable.codeBlock } : NO_GROUPS),\n [stable.codeBlock]\n );\n\n return (\n <AIMarkdownBehaviorsProvider value={behaviorGroups}>\n <AIMarkdown<MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n </AIMarkdownBehaviorsProvider>\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","'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 { useAIMarkdownTheme } from '@ai-react-markdown/core';\nimport { useMantineCodeBlockOptions } from '../../hooks/useMantineCodeBlockOptions';\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 the `codeBlock` group's\n * `autoDetectUnknownLanguage` option is enabled, uses `highlight.js`\n * 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 { fontSize } = useAIMarkdownTheme();\n const { autoDetectUnknownLanguage, defaultExpanded } = useMantineCodeBlockOptions();\n\n const codeLanguage = useMemo(() => {\n if (props.existLanguage) return props.existLanguage;\n if (autoDetectUnknownLanguage) {\n return hljs.highlightAuto(props.codeText).language || '';\n }\n return '';\n }, [props.existLanguage, props.codeText, 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={fontSize}\n w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n fz={fontSize}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [isSpecialCodeBlock, props.codeText, usedCodeLanguage, usedFileName, fontSize, defaultExpanded]);\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","/**\n * Narrow hook for the mantine `codeBlock` behavior group.\n *\n * This is THE single type-assertion site for the group (the pattern that\n * retires the public caller-asserted `TConfig` generic): the opaque\n * extension record from `useAIMarkdownBehaviors()` is narrowed here, and\n * group defaults are applied here — read sites must consume this hook and\n * never re-apply defaults with bare `??` (multiple read sites duplicating\n * defaults will drift).\n *\n * @module hooks/useMantineCodeBlockOptions\n */\n\nimport { useMemo } from 'react';\nimport { useAIMarkdownBehaviors } from '@ai-react-markdown/core';\nimport { defaultMantineCodeBlockOptions, type MantineCodeBlockOptions } from '../defs';\n\n/**\n * Read the resolved code-block options from the behaviors context.\n *\n * Group values replace atomically at the transport layer; defaults are\n * filled in here, so a partial group (e.g. `codeBlock={{ defaultExpanded:\n * false }}`) resolves the omitted fields to the shipped defaults.\n *\n * Must be called inside a `<MantineAIMarkdown>` (or any `<AIMarkdown>`\n * wrapped in the mantine Provider stack) — throws outside, same contract\n * as the core narrow hooks.\n */\nexport function useMantineCodeBlockOptions(): Required<MantineCodeBlockOptions> {\n const behaviors = useAIMarkdownBehaviors();\n // The single assertion: the `codeBlock` group key is owned by this\n // package, contributed by `MantineAIMarkdown` via its behaviors Provider.\n const group = behaviors.codeBlock as Partial<MantineCodeBlockOptions> | undefined;\n return useMemo(() => ({ ...defaultMantineCodeBlockOptions, ...group }), [group]);\n}\n","/**\n * Mantine-specific type definitions and defaults: the `codeBlock` behavior\n * group and the metadata extension point.\n *\n * @module defs\n */\n\nimport { AIMarkdownMetadata } from '@ai-react-markdown/core';\n\n/**\n * Code block rendering options (the mantine `codeBlock` behavior group).\n *\n * v2 transport: passed as the flat `codeBlock` prop on `MantineAIMarkdown`\n * (group value replaces atomically) and read through\n * `useMantineCodeBlockOptions()`, which applies the defaults below inside\n * the hook — the single place defaults live at read time.\n */\nexport interface MantineCodeBlockOptions {\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/** Shipped defaults for the `codeBlock` behavior group. */\nexport const defaultMantineCodeBlockOptions: Readonly<MantineCodeBlockOptions> = Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\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 React, { memo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport mermaid from 'mermaid';\nimport { useAIMarkdownState, useAIMarkdownTheme } from '@ai-react-markdown/core';\nimport { useMantineCodeBlockOptions } from '../../../hooks/useMantineCodeBlockOptions';\nimport './styles.scss';\n\n/** Static `<pre>` style for the mermaid container. */\nconst PRE_STYLE = { cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' } as const;\n\n/**\n * What the component currently shows. One value instead of separate\n * `hasRendered`/`renderError`/`chartType` fields whose combinations had to\n * be kept coherent by hand:\n * - `source`: warm-up / SSR fallback — raw code as a plain code block\n * (nothing rendered yet this generation).\n * - `diagram`: the last successful SVG is up.\n * - `error`: the error tab — only a post-stream corrective failure or a\n * never-rendered static failure can enter this state.\n *\n * The user's source toggle (`showOriginalCode`) is deliberately NOT a\n * phase: it overlays any view and flipping it back must restore the prior\n * one unchanged.\n */\ntype MermaidView = { kind: 'source' } | { kind: 'diagram'; chartType: string } | { kind: 'error' };\n\n/** Equality used to skip no-op view updates — repeat mid-stream successes\n * of the same chart type must not re-render the host per chunk. */\nconst sameView = (a: MermaidView, b: MermaidView): boolean =>\n a.kind === 'diagram' && b.kind === 'diagram' ? a.chartType === b.chartType : a.kind === b.kind;\n\n/** Theme mermaid.initialize was last called with. mermaid's config is a\n * module-level singleton, so re-asserting an unchanged theme before every\n * render attempt (each streamed chunk re-runs the effect) is pure waste —\n * but instances under providers with DIFFERENT schemes must each\n * re-assert before their own render, so the cache is module-level and\n * checked per attempt rather than hoisted into a per-instance effect. */\nlet initializedTheme: 'dark' | 'light' | null = null;\n\nconst ensureMermaidInitialized = (isDark: boolean) => {\n const theme = isDark ? 'dark' : 'light';\n if (initializedTheme === theme) return;\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'strict',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n // Without a svgContainingElement, a draw-phase throw (an error that\n // got past mermaid.parse) leaves mermaid's temp element orphaned in\n // document.body — its error path only cleans up when this flag is\n // set. We render our own error tab anyway, so mermaid's built-in\n // error diagram is dead weight here regardless.\n suppressErrorRendering: true,\n });\n initializedTheme = theme;\n};\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 * - Preserves the last successful render across transient parse failures\n *\n * ## Streaming contract\n *\n * While `streaming` is true (from render state), the code prop is usually a\n * truncated prefix of the final diagram, so parse failures are *expected*,\n * not exceptional:\n * - Before the first successful render, the raw source is shown as a plain\n * code block (never the error tab).\n * - After a success, the last good SVG stays up; each subsequent chunk is\n * re-attempted and the diagram refreshes only on the next success.\n * - When streaming ends (`streaming` is an effect dep), one corrective pass\n * runs on the final code: success refreshes the diagram, failure surfaces\n * the real error tab — even over a previously rendered mid-stream diagram,\n * because that diagram no longer matches the final source. The pending\n * corrective obligation is tracked by `needsCorrectiveRef` (armed on the\n * streaming→false edge, consumed by the next completed attempt), so ONLY\n * that one pass may clobber a rendered diagram; any later failure (e.g. a\n * transient throw on a theme-flip re-render) falls back to the static rule\n * below.\n * - A streaming→true edge marks a NEW generation (chat \"regenerate\" reuses\n * the same component instance when the block's source offset — and thus\n * its React key — is unchanged). All per-generation state is reset so the\n * warm-up shows the new source instead of the previous generation's stale\n * diagram or error tab.\n *\n * ## Static contract (`streaming` stays false)\n *\n * Without streaming edges, failures follow the original conservative rule:\n * the error tab shows only while nothing has rendered yet. Once a diagram is\n * up, later failures (theme-flip re-render, a not-yet-complete `code` update\n * from a consumer that didn't pass `streaming`) keep the last good diagram\n * instead of clobbering it with an error.\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const { colorScheme, fontSize } = useAIMarkdownTheme();\n const { streaming } = useAIMarkdownState();\n const { defaultExpanded } = useMantineCodeBlockOptions();\n const isDark = colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const renderVersionRef = useRef(0);\n /** Mirrors `view` for reads inside the async render closure — state reads\n * there can be stale when deps change mid-flight. */\n const viewRef = useRef<MermaidView>({ kind: 'source' });\n /** Previous `streaming` value, for edge detection in the effect. */\n const prevStreamingRef = useRef(false);\n /** Armed on the streaming→false edge: the next completed render attempt is\n * the end-of-stream corrective pass, whose failure must surface even over\n * a rendered diagram. Consumed (reset) by that attempt's success OR\n * surfaced failure, so later unrelated failures can't clobber the SVG. */\n const needsCorrectiveRef = useRef(false);\n /** Inputs of the render whose SVG currently sits in the host `<pre>`.\n * When the effect re-runs with the same (code, theme) pair — the\n * post-stream corrective flip on an already-final diagram, or returning\n * from the source view — the DOM already holds that exact render, so\n * the attempt (and its parse + temp-element render) is skipped. */\n const lastSuccessRef = useRef<{ code: string; isDark: boolean } | null>(null);\n const [view, setViewState] = useState<MermaidView>({ kind: 'source' });\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n\n useEffect(() => {\n // View updates funnel through here so the ref mirror can't desync from\n // the state, and no-op updates are dropped (repeat mid-stream successes\n // and idempotent edge resets must not re-render the host per chunk).\n const applyView = (next: MermaidView) => {\n viewRef.current = next;\n setViewState((prev) => (sameView(prev, next) ? prev : next));\n };\n\n // Streaming edge detection MUST run before any early return — the first\n // chunk of a new stream can arrive while the code is still empty.\n if (streaming && !prevStreamingRef.current) {\n // Rising edge = a new generation is starting on this same instance\n // (same block offset → same React key → no remount on regenerate).\n // Reset all per-generation state so warm-up shows the incoming source,\n // not the previous generation's stale diagram or error tab. Everything\n // here is idempotent — a StrictMode double-run is harmless.\n needsCorrectiveRef.current = false;\n lastSuccessRef.current = null;\n applyView({ kind: 'source' });\n if (ref.current) {\n ref.current.innerHTML = '';\n }\n } else if (!streaming && prevStreamingRef.current) {\n // Falling edge = the stream just ended; arm the corrective pass.\n needsCorrectiveRef.current = true;\n }\n prevStreamingRef.current = streaming;\n if (!props.code || !ref.current || showOriginalCode) {\n return;\n }\n\n // The SVG in the DOM already came from exactly this (code, theme) pair —\n // nothing to recompute. This also SATISFIES a pending corrective\n // obligation: the identical successful render IS the verdict on the\n // final source, so the obligation is consumed, not left armed for some\n // later unrelated failure to inherit.\n if (lastSuccessRef.current?.code === props.code && lastSuccessRef.current.isDark === isDark) {\n needsCorrectiveRef.current = false;\n return;\n }\n\n const renderVersion = ++renderVersionRef.current;\n let cancelled = false;\n\n const renderMermaid = async () => {\n try {\n ensureMermaidInitialized(isDark);\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n\n if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n\n // Deliberately NOT passing `ref.current` as mermaid's\n // svgContainingElement: before the first success the host container\n // is hidden with `display: none` (source fallback is showing), and\n // mermaid measures text via getBBox during render — inside a\n // display:none subtree layout never runs, every measurement is 0,\n // and the diagram comes out as a ~16px SVG. With the argument\n // omitted, mermaid renders in a temp element appended to\n // `document.body` (its default path, cleaned up internally), so\n // measurement works no matter what our container is doing. The SVG\n // string is written into our own <pre> below either way.\n const { svg, bindFunctions, diagramType } = await mermaid.render(generateMermaidUUID(), props.code);\n if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n needsCorrectiveRef.current = false;\n lastSuccessRef.current = { code: props.code, isDark };\n applyView({ kind: 'diagram', chartType: diagramType });\n } catch {\n if (cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n // Mid-stream failures are expected (truncated code) — keep the last\n // good diagram / source placeholder and wait for more bytes. The\n // corrective pass after streaming ends reports real errors.\n if (streaming) {\n return;\n }\n // End-of-stream corrective pass: the final source no longer renders,\n // so the error must surface even over a mid-stream diagram. Consume\n // the obligation so later unrelated failures don't inherit it.\n if (needsCorrectiveRef.current) {\n needsCorrectiveRef.current = false;\n applyView({ kind: 'error' });\n return;\n }\n // Static rule: never clobber a rendered diagram (theme-flip\n // re-renders, un-flagged code updates from static consumers).\n if (viewRef.current.kind === 'diagram') {\n return;\n }\n applyView({ kind: 'error' });\n }\n };\n\n void renderMermaid();\n\n return () => {\n cancelled = true;\n };\n // `streaming` in the deps is what drives the end-of-stream corrective\n // pass: the flip to false re-runs this effect on the (unchanged) final\n // code, so the last state reflects the full diagram source.\n }, [props.code, isDark, showOriginalCode, streaming]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, [isDark]);\n\n // Show the raw source instead of the diagram container when the user asked\n // for it, when the (post-stream) render failed, or before the first\n // successful render (SSR output and the streaming warm-up phase). The\n // diagram container below stays MOUNTED throughout — merely hidden — so\n // `ref` is always available for mermaid to render into; unmounting it would\n // make the effect's `!ref.current` guard bail forever.\n const showSourceFallback = showOriginalCode || view.kind !== 'diagram';\n\n return (\n <>\n {showSourceFallback && (\n <CodeHighlightTabs\n mb={15}\n fz={fontSize}\n w=\"100%\"\n code={[\n {\n fileName: view.kind === 'error' ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n // The \"Render Mermaid\" control only makes sense as the way back\n // from the user-toggled source view. In the error and warm-up\n // fallbacks `showOriginalCode` is already false, so the control\n // would be a no-op — hide it there. (No view-kind conjunct: the\n // toggle is only reachable from the visible diagram view, and\n // while the source view is open the effect early-returns, so\n // showOriginalCode && view.kind === 'error' is unreachable.)\n showOriginalCode\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 }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showSourceFallback\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{view.kind === 'diagram' ? view.chartType : 'unknown'}</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 ref={ref} style={PRE_STYLE} onClick={viewSvgInNewWindow} />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","/**\n * Widened `define*` factory for the mantine wrapper (EXECUTION-PLAN §4\n * item 8): identity + mantine prop types + freeze, zero logic. Core\n * factories accept core fields only — passing `codeBlock` to core's\n * `defineBehaviors` is a TS error; this widened factory is the wrapper's\n * one-line obligation.\n *\n * @module define\n */\n\nimport type { AIMarkdownBehaviorProps } from '@ai-react-markdown/core';\nimport type { MantineCodeBlockOptions } from './defs';\n\n/** Behavior-system props packagable at integration time, mantine-widened. */\nexport interface MantineBehaviorProps extends AIMarkdownBehaviorProps {\n /** The mantine `codeBlock` behavior group (atomic replacement; defaults applied at read time). */\n codeBlock?: Partial<MantineCodeBlockOptions>;\n}\n\n// NON-generic on purpose — see core's `define.ts`: a fresh literal is\n// excess-property checked against the concrete parameter type.\n\n/** Freeze a mantine behaviors fragment. Identity + types + freeze; zero logic. */\nexport function defineMantineBehaviors(values: MantineBehaviorProps): Readonly<MantineBehaviorProps> {\n return Object.freeze(values);\n}\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;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACxBP,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;AAE1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YC;AAAA,MACZ;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN,GACF;AAEJ;AAoBO,IAAM,oBAAoBE,MAAK,0BAA0B;AAEhE,kBAAkB,cAAc;AAEhC,IAAO,4BAAQ;;;AO/JR,SAAS,uBAAuB,QAA8D;AACnG,SAAO,OAAO,OAAO,MAAM;AAC7B;;;ACzBA,SAAS,6BAA6B;AA0B/B,IAAM,+BAA+B,MAErC;AACL,SAAO,sBAAiC;AAC1C;","names":["memo","useMemo","jsx","memo","useMemo","CodeHighlightTabs","useAIMarkdownTheme","memo","jsx","memo","jsx","SpecialCodeLanguage","memo","useAIMarkdownTheme","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/components/customized/PreCode.tsx","../src/hooks/useMantineCodeBlockOptions.ts","../src/defs.tsx","../src/components/customized/MermaidCode/index.tsx","../src/define.ts","../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 {\n type AIMarkdownProps,\n type AIMarkdownCustomComponents,\n type AIMarkdownBehaviorGroups,\n type AIMarkdownStabilityTable,\n AIMarkdownBehaviorsProvider,\n AIMarkdownStabilityPolicy,\n useStableRecord,\n useStableValue,\n} from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownMetadata, MantineCodeBlockOptions } 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 the mantine behavior groups.\n * All core props (`content`, `streaming`, `fontSize`, `enginePlugins`, etc.)\n * are inherited.\n *\n * @typeParam TMetadata - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TMetadata> {\n /**\n * Code-block behavior group (Behaviors system). The group value replaces\n * atomically; omitted fields resolve to the shipped defaults inside\n * `useMantineCodeBlockOptions()`. `null` counts as absent. When absent,\n * this wrapper contributes NO `codeBlock` group, so a group provided by\n * an outer app-level `AIMarkdownBehaviorsProvider` passes through; when\n * present, this prop wins over any outer group (inner-wins merge).\n */\n codeBlock?: Partial<MantineCodeBlockOptions>;\n}\n\n/**\n * Stable empty CONTRIBUTION for the absent-prop case. Deliberately carries\n * no `codeBlock` key at all: contributing `codeBlock: {}` would shadow a\n * group provided by an outer app-level `AIMarkdownBehaviorsProvider`\n * (inner-wins merge) even though this wrapper has nothing to say — the\n * documented app-level extension path would silently go dead.\n */\nconst NO_GROUPS: AIMarkdownBehaviorGroups = Object.freeze({});\n\n/**\n * Mantine's stability-firewall table — one row today: `codeBlock` is the\n * only object prop this wrapper TERMINATES (consumes in its own machinery).\n * Forwarded object props ride core's firewall untouched; the merged\n * `customComponents` derived below is caught by core's wall.\n */\nconst MANTINE_STABILITY_TABLE: AIMarkdownStabilityTable<{\n codeBlock: Partial<MantineCodeBlockOptions> | undefined;\n}> = {\n codeBlock: AIMarkdownStabilityPolicy.DEEP_EQUAL,\n};\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 TMetadata - Metadata type.\n */\nconst MantineAIMarkdownComponent = <TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n customComponents,\n colorScheme,\n codeBlock,\n ...props\n}: MantineAIMarkdownProps<TMetadata>) => {\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 // Mantine's stability firewall: `codeBlock` is terminated here (it feeds\n // the behaviors Provider below, not the core prop surface).\n const stable = useStableRecord({ codeBlock }, MANTINE_STABILITY_TABLE);\n\n // Contribute the group through the additive behaviors Provider — firewall\n // output used directly, record identity memoized so the context value\n // stays stable across unrelated re-renders. `null`/absent prop ≡ no\n // contribution (NOT an empty group): an outer app-level Provider's\n // `codeBlock` group then stays visible; when the prop IS present the\n // inner-wins merge gives this wrapper's value precedence. The narrow hook\n // fills the defaults for the no-group-anywhere case.\n const behaviorGroups = useMemo<AIMarkdownBehaviorGroups>(\n () => (stable.codeBlock != null ? { codeBlock: stable.codeBlock } : NO_GROUPS),\n [stable.codeBlock]\n );\n\n return (\n <AIMarkdownBehaviorsProvider value={behaviorGroups}>\n <AIMarkdown<MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n </AIMarkdownBehaviorsProvider>\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","'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 { useAIMarkdownTheme } from '@ai-react-markdown/core';\nimport { useMantineCodeBlockOptions } from '../../hooks/useMantineCodeBlockOptions';\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 the `codeBlock` group's\n * `autoDetectUnknownLanguage` option is enabled, uses `highlight.js`\n * 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 { fontSize } = useAIMarkdownTheme();\n const { autoDetectUnknownLanguage, defaultExpanded } = useMantineCodeBlockOptions();\n\n const codeLanguage = useMemo(() => {\n if (props.existLanguage) return props.existLanguage;\n if (autoDetectUnknownLanguage) {\n return hljs.highlightAuto(props.codeText).language || '';\n }\n return '';\n }, [props.existLanguage, props.codeText, 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={fontSize}\n w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n fz={fontSize}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [isSpecialCodeBlock, props.codeText, usedCodeLanguage, usedFileName, fontSize, defaultExpanded]);\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","/**\n * Narrow hook for the mantine `codeBlock` behavior group.\n *\n * This is THE single type-assertion site for the group (the pattern that\n * retires the public caller-asserted `TConfig` generic): the opaque\n * extension record from `useAIMarkdownBehaviors()` is narrowed here, and\n * group defaults are applied here — read sites must consume this hook and\n * never re-apply defaults with bare `??` (multiple read sites duplicating\n * defaults will drift).\n *\n * @module hooks/useMantineCodeBlockOptions\n */\n\nimport { useMemo } from 'react';\nimport { useAIMarkdownBehaviors } from '@ai-react-markdown/core';\nimport { defaultMantineCodeBlockOptions, type MantineCodeBlockOptions } from '../defs';\n\n/**\n * Read the resolved code-block options from the behaviors context.\n *\n * Group values replace atomically at the transport layer; defaults are\n * filled in here, so a partial group (e.g. `codeBlock={{ defaultExpanded:\n * false }}`) resolves the omitted fields to the shipped defaults.\n *\n * Must be called inside a `<MantineAIMarkdown>` (or any `<AIMarkdown>`\n * wrapped in the mantine Provider stack) — throws outside, same contract\n * as the core narrow hooks.\n */\nexport function useMantineCodeBlockOptions(): Required<MantineCodeBlockOptions> {\n const behaviors = useAIMarkdownBehaviors();\n // The single assertion: the `codeBlock` group key is owned by this\n // package, contributed by `MantineAIMarkdown` via its behaviors Provider.\n const group = behaviors.codeBlock as Partial<MantineCodeBlockOptions> | undefined;\n return useMemo(() => ({ ...defaultMantineCodeBlockOptions, ...group }), [group]);\n}\n","/**\n * Mantine-specific type definitions and defaults: the `codeBlock` behavior\n * group and the metadata extension point.\n *\n * @module defs\n */\n\nimport { AIMarkdownMetadata } from '@ai-react-markdown/core';\n\n/**\n * Code block rendering options (the mantine `codeBlock` behavior group).\n *\n * v2 transport: passed as the flat `codeBlock` prop on `MantineAIMarkdown`\n * (group value replaces atomically) and read through\n * `useMantineCodeBlockOptions()`, which applies the defaults below inside\n * the hook — the single place defaults live at read time.\n */\nexport interface MantineCodeBlockOptions {\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/** Shipped defaults for the `codeBlock` behavior group. */\nexport const defaultMantineCodeBlockOptions: Readonly<MantineCodeBlockOptions> = Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\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 React, { memo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport mermaid from 'mermaid';\nimport { useAIMarkdownState, useAIMarkdownTheme } from '@ai-react-markdown/core';\nimport { useMantineCodeBlockOptions } from '../../../hooks/useMantineCodeBlockOptions';\nimport './styles.scss';\n\n/** Static `<pre>` style for the mermaid container. */\nconst PRE_STYLE = { cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' } as const;\n\n/**\n * What the component currently shows. One value instead of separate\n * `hasRendered`/`renderError`/`chartType` fields whose combinations had to\n * be kept coherent by hand:\n * - `source`: warm-up / SSR fallback — raw code as a plain code block\n * (nothing rendered yet this generation).\n * - `diagram`: the last successful SVG is up.\n * - `error`: the error tab — only a post-stream corrective failure or a\n * never-rendered static failure can enter this state.\n *\n * The user's source toggle (`showOriginalCode`) is deliberately NOT a\n * phase: it overlays any view and flipping it back must restore the prior\n * one unchanged.\n */\ntype MermaidView = { kind: 'source' } | { kind: 'diagram'; chartType: string } | { kind: 'error' };\n\n/** Equality used to skip no-op view updates — repeat mid-stream successes\n * of the same chart type must not re-render the host per chunk. */\nconst sameView = (a: MermaidView, b: MermaidView): boolean =>\n a.kind === 'diagram' && b.kind === 'diagram' ? a.chartType === b.chartType : a.kind === b.kind;\n\n/** Theme mermaid.initialize was last called with. mermaid's config is a\n * module-level singleton, so re-asserting an unchanged theme before every\n * render attempt (each streamed chunk re-runs the effect) is pure waste —\n * but instances under providers with DIFFERENT schemes must each\n * re-assert before their own render, so the cache is module-level and\n * checked per attempt rather than hoisted into a per-instance effect. */\nlet initializedTheme: 'dark' | 'light' | null = null;\n\nconst ensureMermaidInitialized = (isDark: boolean) => {\n const theme = isDark ? 'dark' : 'light';\n if (initializedTheme === theme) return;\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'strict',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n // Without a svgContainingElement, a draw-phase throw (an error that\n // got past mermaid.parse) leaves mermaid's temp element orphaned in\n // document.body — its error path only cleans up when this flag is\n // set. We render our own error tab anyway, so mermaid's built-in\n // error diagram is dead weight here regardless.\n suppressErrorRendering: true,\n });\n initializedTheme = theme;\n};\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 * - Preserves the last successful render across transient parse failures\n *\n * ## Streaming contract\n *\n * While `streaming` is true (from render state), the code prop is usually a\n * truncated prefix of the final diagram, so parse failures are *expected*,\n * not exceptional:\n * - Before the first successful render, the raw source is shown as a plain\n * code block (never the error tab).\n * - After a success, the last good SVG stays up; each subsequent chunk is\n * re-attempted and the diagram refreshes only on the next success.\n * - When streaming ends (`streaming` is an effect dep), one corrective pass\n * runs on the final code: success refreshes the diagram, failure surfaces\n * the real error tab — even over a previously rendered mid-stream diagram,\n * because that diagram no longer matches the final source. The pending\n * corrective obligation is tracked by `needsCorrectiveRef` (armed on the\n * streaming→false edge, consumed by the next completed attempt), so ONLY\n * that one pass may clobber a rendered diagram; any later failure (e.g. a\n * transient throw on a theme-flip re-render) falls back to the static rule\n * below.\n * - A streaming→true edge marks a NEW generation (chat \"regenerate\" reuses\n * the same component instance when the block's source offset — and thus\n * its React key — is unchanged). All per-generation state is reset so the\n * warm-up shows the new source instead of the previous generation's stale\n * diagram or error tab.\n *\n * ## Static contract (`streaming` stays false)\n *\n * Without streaming edges, failures follow the original conservative rule:\n * the error tab shows only while nothing has rendered yet. Once a diagram is\n * up, later failures (theme-flip re-render, a not-yet-complete `code` update\n * from a consumer that didn't pass `streaming`) keep the last good diagram\n * instead of clobbering it with an error.\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const { colorScheme, fontSize } = useAIMarkdownTheme();\n const { streaming } = useAIMarkdownState();\n const { defaultExpanded } = useMantineCodeBlockOptions();\n const isDark = colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const renderVersionRef = useRef(0);\n /** Mirrors `view` for reads inside the async render closure — state reads\n * there can be stale when deps change mid-flight. */\n const viewRef = useRef<MermaidView>({ kind: 'source' });\n /** Previous `streaming` value, for edge detection in the effect. */\n const prevStreamingRef = useRef(false);\n /** Armed on the streaming→false edge: the next completed render attempt is\n * the end-of-stream corrective pass, whose failure must surface even over\n * a rendered diagram. Consumed (reset) by that attempt's success OR\n * surfaced failure, so later unrelated failures can't clobber the SVG. */\n const needsCorrectiveRef = useRef(false);\n /** Inputs of the render whose SVG currently sits in the host `<pre>`.\n * When the effect re-runs with the same (code, theme) pair — the\n * post-stream corrective flip on an already-final diagram, or returning\n * from the source view — the DOM already holds that exact render, so\n * the attempt (and its parse + temp-element render) is skipped. */\n const lastSuccessRef = useRef<{ code: string; isDark: boolean } | null>(null);\n const [view, setViewState] = useState<MermaidView>({ kind: 'source' });\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n\n useEffect(() => {\n // View updates funnel through here so the ref mirror can't desync from\n // the state, and no-op updates are dropped (repeat mid-stream successes\n // and idempotent edge resets must not re-render the host per chunk).\n const applyView = (next: MermaidView) => {\n viewRef.current = next;\n setViewState((prev) => (sameView(prev, next) ? prev : next));\n };\n\n // Streaming edge detection MUST run before any early return — the first\n // chunk of a new stream can arrive while the code is still empty.\n if (streaming && !prevStreamingRef.current) {\n // Rising edge = a new generation is starting on this same instance\n // (same block offset → same React key → no remount on regenerate).\n // Reset all per-generation state so warm-up shows the incoming source,\n // not the previous generation's stale diagram or error tab. Everything\n // here is idempotent — a StrictMode double-run is harmless.\n needsCorrectiveRef.current = false;\n lastSuccessRef.current = null;\n applyView({ kind: 'source' });\n if (ref.current) {\n ref.current.innerHTML = '';\n }\n } else if (!streaming && prevStreamingRef.current) {\n // Falling edge = the stream just ended; arm the corrective pass.\n needsCorrectiveRef.current = true;\n }\n prevStreamingRef.current = streaming;\n if (!props.code || !ref.current || showOriginalCode) {\n return;\n }\n\n // The SVG in the DOM already came from exactly this (code, theme) pair —\n // nothing to recompute. This also SATISFIES a pending corrective\n // obligation: the identical successful render IS the verdict on the\n // final source, so the obligation is consumed, not left armed for some\n // later unrelated failure to inherit.\n if (lastSuccessRef.current?.code === props.code && lastSuccessRef.current.isDark === isDark) {\n needsCorrectiveRef.current = false;\n return;\n }\n\n const renderVersion = ++renderVersionRef.current;\n let cancelled = false;\n\n const renderMermaid = async () => {\n try {\n ensureMermaidInitialized(isDark);\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n\n if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n\n // Deliberately NOT passing `ref.current` as mermaid's\n // svgContainingElement: before the first success the host container\n // is hidden with `display: none` (source fallback is showing), and\n // mermaid measures text via getBBox during render — inside a\n // display:none subtree layout never runs, every measurement is 0,\n // and the diagram comes out as a ~16px SVG. With the argument\n // omitted, mermaid renders in a temp element appended to\n // `document.body` (its default path, cleaned up internally), so\n // measurement works no matter what our container is doing. The SVG\n // string is written into our own <pre> below either way.\n const { svg, bindFunctions, diagramType } = await mermaid.render(generateMermaidUUID(), props.code);\n if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n needsCorrectiveRef.current = false;\n lastSuccessRef.current = { code: props.code, isDark };\n applyView({ kind: 'diagram', chartType: diagramType });\n } catch {\n if (cancelled || renderVersion !== renderVersionRef.current) {\n return;\n }\n // Mid-stream failures are expected (truncated code) — keep the last\n // good diagram / source placeholder and wait for more bytes. The\n // corrective pass after streaming ends reports real errors.\n if (streaming) {\n return;\n }\n // End-of-stream corrective pass: the final source no longer renders,\n // so the error must surface even over a mid-stream diagram. Consume\n // the obligation so later unrelated failures don't inherit it.\n if (needsCorrectiveRef.current) {\n needsCorrectiveRef.current = false;\n applyView({ kind: 'error' });\n return;\n }\n // Static rule: never clobber a rendered diagram (theme-flip\n // re-renders, un-flagged code updates from static consumers).\n if (viewRef.current.kind === 'diagram') {\n return;\n }\n applyView({ kind: 'error' });\n }\n };\n\n void renderMermaid();\n\n return () => {\n cancelled = true;\n };\n // `streaming` in the deps is what drives the end-of-stream corrective\n // pass: the flip to false re-runs this effect on the (unchanged) final\n // code, so the last state reflects the full diagram source.\n }, [props.code, isDark, showOriginalCode, streaming]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, [isDark]);\n\n // Show the raw source instead of the diagram container when the user asked\n // for it, when the (post-stream) render failed, or before the first\n // successful render (SSR output and the streaming warm-up phase). The\n // diagram container below stays MOUNTED throughout — merely hidden — so\n // `ref` is always available for mermaid to render into; unmounting it would\n // make the effect's `!ref.current` guard bail forever.\n const showSourceFallback = showOriginalCode || view.kind !== 'diagram';\n\n return (\n <>\n {showSourceFallback && (\n <CodeHighlightTabs\n mb={15}\n fz={fontSize}\n w=\"100%\"\n code={[\n {\n fileName: view.kind === 'error' ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n // The \"Render Mermaid\" control only makes sense as the way back\n // from the user-toggled source view. In the error and warm-up\n // fallbacks `showOriginalCode` is already false, so the control\n // would be a no-op — hide it there. (No view-kind conjunct: the\n // toggle is only reachable from the visible diagram view, and\n // while the source view is open the effect early-returns, so\n // showOriginalCode && view.kind === 'error' is unreachable.)\n showOriginalCode\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 }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showSourceFallback\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{view.kind === 'diagram' ? view.chartType : 'unknown'}</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 aria-label=\"Show Mermaid code\"\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\n variant=\"transparent\"\n size={28}\n className=\"action-icon\"\n aria-label={copied ? 'Mermaid code copied' : 'Copy Mermaid code'}\n onClick={copy}\n >\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={PRE_STYLE}\n role=\"button\"\n tabIndex={0}\n aria-label=\"Open Mermaid diagram in a new window\"\n onClick={viewSvgInNewWindow}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n viewSvgInNewWindow();\n }\n }}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","/**\n * Widened `define*` factory for the mantine wrapper (EXECUTION-PLAN §4\n * item 8): identity + mantine prop types + freeze, zero logic. Core\n * factories accept core fields only — passing `codeBlock` to core's\n * `defineBehaviors` is a TS error; this widened factory is the wrapper's\n * one-line obligation.\n *\n * @module define\n */\n\nimport type { AIMarkdownBehaviorProps } from '@ai-react-markdown/core';\nimport type { MantineCodeBlockOptions } from './defs';\n\n/** Behavior-system props packagable at integration time, mantine-widened. */\nexport interface MantineBehaviorProps extends AIMarkdownBehaviorProps {\n /** The mantine `codeBlock` behavior group (atomic replacement; defaults applied at read time). */\n codeBlock?: Partial<MantineCodeBlockOptions>;\n}\n\n// NON-generic on purpose — see core's `define.ts`: a fresh literal is\n// excess-property checked against the concrete parameter type.\n\n/** Freeze a mantine behaviors fragment. Identity + types + freeze; zero logic. */\nexport function defineMantineBehaviors(values: MantineBehaviorProps): Readonly<MantineBehaviorProps> {\n return Object.freeze(values);\n}\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;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACxBP,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,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,EAC9F,GAAG,CAAC,sBAAsB,CAAC;AAE3B,QAAM,sBAAsB,uBAAuB,OAAO;AAI1D,QAAM,SAAS,gBAAgB,EAAE,UAAU,GAAG,uBAAuB;AASrE,QAAM,iBAAiBA;AAAA,IACrB,MAAO,OAAO,aAAa,OAAO,EAAE,WAAW,OAAO,UAAU,IAAI;AAAA,IACpE,CAAC,OAAO,SAAS;AAAA,EACnB;AAEA,SACE,gBAAAF,KAAC,+BAA4B,OAAO,gBAClC,0BAAAA;AAAA,IAAC;AAAA;AAAA,MACC,YAAYC;AAAA,MACZ;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN,GACF;AAEJ;AAoBO,IAAM,oBAAoBE,MAAK,0BAA0B;AAEhE,kBAAkB,cAAc;AAEhC,IAAO,4BAAQ;;;AO/JR,SAAS,uBAAuB,QAA8D;AACnG,SAAO,OAAO,OAAO,MAAM;AAC7B;;;ACzBA,SAAS,6BAA6B;AA0B/B,IAAM,+BAA+B,MAErC;AACL,SAAO,sBAAiC;AAC1C;","names":["memo","useMemo","jsx","memo","useMemo","CodeHighlightTabs","useAIMarkdownTheme","memo","jsx","memo","jsx","SpecialCodeLanguage","memo","useAIMarkdownTheme","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": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Mantine UI integration for ai-react-markdown — themed typography, syntax highlighting via @mantine/code-highlight, Mermaid diagrams, and automatic color scheme detection.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -51,7 +51,7 @@
51
51
  "./styles.css": "./dist/index.css"
52
52
  },
53
53
  "peerDependencies": {
54
- "@ai-react-markdown/core": "^2.3.1",
54
+ "@ai-react-markdown/core": "^2.3.2",
55
55
  "@mantine/code-highlight": "^9.0.0",
56
56
  "@mantine/core": "^9.0.0",
57
57
  "highlight.js": "^11.11.1",
@@ -74,7 +74,7 @@
74
74
  "lodash-es": "^4.18.0",
75
75
  "postcss": "^8.5.26",
76
76
  "tsup": "^8.5.1",
77
- "@ai-react-markdown/core": "2.3.1"
77
+ "@ai-react-markdown/core": "2.3.2"
78
78
  },
79
79
  "scripts": {
80
80
  "build": "tsup",