@ai-react-markdown/mantine 2.11.0 → 2.12.0

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
@@ -69,7 +69,7 @@ yarn add @ai-react-markdown/mantine @ai-react-markdown/core
69
69
  {
70
70
  "react": ">=19",
71
71
  "react-dom": ">=19",
72
- "@ai-react-markdown/core": "^2.11.0",
72
+ "@ai-react-markdown/core": "^2.12.0",
73
73
  "@mantine/core": "^9.0.0",
74
74
  "@mantine/code-highlight": "^9.0.0",
75
75
  "highlight.js": "^11.11.2"
@@ -150,10 +150,12 @@ The Mantine package adds one behavior group on top of core's flat props: the `co
150
150
 
151
151
  ### `codeBlock` (`Partial<MantineCodeBlockOptions>`)
152
152
 
153
- | Field | Type | Default | Description |
154
- | --------------------------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
155
- | `defaultExpanded` | `boolean` | `true` | Whether code blocks start in their expanded state. When `false`, long blocks are collapsed with an expand button. |
156
- | `autoDetectUnknownLanguage` | `boolean` | `false` | When `true`, uses `highlight.js`'s `highlightAuto` to determine the language of code blocks lacking an explicit annotation. |
153
+ | Field | Type | Default | Description |
154
+ | --------------------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
155
+ | `defaultExpanded` | `boolean` | `true` | Whether code blocks start in their expanded state. When `false`, long blocks are collapsed with an expand button. |
156
+ | `autoDetectUnknownLanguage` | `boolean` | `false` | When `true`, uses `highlight.js`'s `highlightAuto` to determine the language of code blocks lacking an explicit annotation. |
157
+ | `formatJson` | `boolean` | `true` | Format JSON while preserving number tokens, key order and duplicate keys. Set `false` to display source text. |
158
+ | `expandNestedJson` | `boolean` | `true` | When JSON formatting is enabled, expand string values containing JSON objects or arrays. Set `false` for whitespace formatting only. |
157
159
 
158
160
  ### Example: Collapsed Code Blocks
159
161
 
@@ -237,13 +239,15 @@ Activated by importing `@ai-react-markdown/mantine/styles.css` in your app entry
237
239
 
238
240
  The Mantine package installs a default `<pre>` renderer (`MantineAIMPreCode`) that powers all code-block features. Behavior by code-block flavor:
239
241
 
240
- | Code-block flavor | Rendered as | Notes |
241
- | ------------------------------------------ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
242
- | Annotated, known language (e.g. ` ```ts `) | `<CodeHighlightTabs>` | Tab label = language name (lower-cased) |
243
- | Annotated, unknown language identifier | `<CodeHighlightTabs>` | Tab label = the identifier (lower-cased); Mantine's highlight adapter degrades an unknown language to plaintext |
244
- | No language annotation | `<CodeHighlight>` plaintext | Label = `"unknown"`. With `codeBlock.autoDetectUnknownLanguage: true`, `hljs.highlightAuto` guesses early, re-checks as the block grows, and settles at end of stream — label/highlighting upgrade in place |
245
- | ` ```mermaid ` (any case) | Interactive Mermaid diagram | See [Mermaid Diagrams](#mermaid-diagrams); the language match is case-insensitive |
246
- | ` ```json ` (any case) | Pretty-printed JSON | As soon as the block looks complete (ends in `}`/`]` with balanced brackets outside strings), parsed, string values holding a nested JSON object/array expanded (primitive-looking strings such as `"true"` stay strings), then re-serialized with 2-space indent before rendering |
242
+ | Code-block flavor | Rendered as | Notes |
243
+ | ------------------------------------------ | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
244
+ | Annotated, known language (e.g. ` ```ts `) | `<CodeHighlightTabs>` | Tab label = language name (lower-cased) |
245
+ | Annotated, unknown language identifier | `<CodeHighlightTabs>` | Tab label = the identifier (lower-cased); Mantine's highlight adapter degrades an unknown language to plaintext |
246
+ | No language annotation | `<CodeHighlight>` plaintext | Label = `"unknown"`. With `codeBlock.autoDetectUnknownLanguage: true`, `hljs.highlightAuto` guesses early, re-checks as the block grows, and settles at end of stream — label/highlighting upgrade in place |
247
+ | ` ```mermaid ` (any case) | Interactive Mermaid diagram | See [Mermaid Diagrams](#mermaid-diagrams); the language match is case-insensitive |
248
+ | ` ```json ` (any case) | Pretty-printed JSON | As soon as the block looks complete (ends in `}`/`]` with balanced brackets outside strings), parsed, string values holding a nested JSON object/array expanded (primitive-looking strings such as `"true"` stay strings), then formatted with 2-space indent while retaining exact numeric tokens; both formatting and nested expansion can be disabled |
249
+
250
+ The copy control copies the original code text, including its trailing newline, independently of JSON display formatting. Raw HTML `<pre>` structures with nested elements, sibling text, or additional attributes retain their original rendering instead of entering the code highlighter.
247
251
 
248
252
  All non-special blocks render with `withBorder` and `withExpandButton`, collapsing to `maxCollapsedHeight="320px"` until expanded.
249
253
 
package/dist/index.cjs CHANGED
@@ -43,8 +43,8 @@ module.exports = __toCommonJS(index_exports);
43
43
 
44
44
  // src/MantineAIMarkdown.tsx
45
45
  var import_react5 = require("react");
46
- var import_core6 = __toESM(require("@ai-react-markdown/core"), 1);
47
- var import_core7 = require("@ai-react-markdown/core");
46
+ var import_core7 = __toESM(require("@ai-react-markdown/core"), 1);
47
+ var import_core8 = require("@ai-react-markdown/core");
48
48
 
49
49
  // src/components/typography/MantineTypography.tsx
50
50
  var import_react = require("react");
@@ -73,7 +73,9 @@ var import_core2 = require("@ai-react-markdown/core");
73
73
  // src/defs.tsx
74
74
  var defaultMantineCodeBlockOptions = Object.freeze({
75
75
  defaultExpanded: true,
76
- autoDetectUnknownLanguage: false
76
+ autoDetectUnknownLanguage: false,
77
+ formatJson: true,
78
+ expandNestedJson: true
77
79
  });
78
80
 
79
81
  // src/hooks/useMantineCodeBlockOptions.ts
@@ -90,6 +92,43 @@ function useMantineCodeBlockOptions() {
90
92
  }, [group]);
91
93
  }
92
94
 
95
+ // src/components/customized/MermaidCode/renderQueue.ts
96
+ function createRenderQueue() {
97
+ const pending = /* @__PURE__ */ new Map();
98
+ let running = false;
99
+ async function drain() {
100
+ if (running) return;
101
+ running = true;
102
+ try {
103
+ while (pending.size) {
104
+ const [owner, job] = pending.entries().next().value;
105
+ pending.delete(owner);
106
+ try {
107
+ await job.run();
108
+ job.resolve();
109
+ } catch (error) {
110
+ job.reject(error);
111
+ }
112
+ }
113
+ } finally {
114
+ running = false;
115
+ }
116
+ }
117
+ return {
118
+ enqueue(owner, run) {
119
+ pending.get(owner)?.resolve();
120
+ const promise = new Promise((resolve, reject) => pending.set(owner, { run, resolve, reject }));
121
+ void drain();
122
+ return promise;
123
+ },
124
+ cancel(owner) {
125
+ pending.get(owner)?.resolve();
126
+ pending.delete(owner);
127
+ }
128
+ };
129
+ }
130
+ var mermaidRenderQueue = createRenderQueue();
131
+
93
132
  // src/components/customized/MermaidCode/index.tsx
94
133
  var import_react3 = require("react");
95
134
  var import_code_highlight = require("@mantine/code-highlight");
@@ -211,14 +250,7 @@ var MantineAIMMermaidCode = (0, import_react3.memo)((props) => {
211
250
  if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {
212
251
  return;
213
252
  }
214
- let rendered = await mermaid.render(generateMermaidUUID(), props.code);
215
- if (initializedTheme !== (isDark ? "dark" : "light")) {
216
- if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {
217
- return;
218
- }
219
- ensureMermaidInitialized(mermaid, isDark);
220
- rendered = await mermaid.render(generateMermaidUUID(), props.code);
221
- }
253
+ const rendered = await mermaid.render(generateMermaidUUID(), props.code);
222
254
  const { svg, bindFunctions, diagramType } = rendered;
223
255
  if (!ref.current || cancelled || renderVersion !== renderVersionRef.current) {
224
256
  return;
@@ -246,9 +278,11 @@ var MantineAIMMermaidCode = (0, import_react3.memo)((props) => {
246
278
  applyView({ kind: "error" });
247
279
  }
248
280
  };
249
- void renderMermaid();
281
+ const owner = renderVersionRef;
282
+ void mermaidRenderQueue.enqueue(owner, renderMermaid);
250
283
  return () => {
251
284
  cancelled = true;
285
+ mermaidRenderQueue.cancel(owner);
252
286
  if (retryTimer !== void 0) clearTimeout(retryTimer);
253
287
  };
254
288
  }, [props.code, isDark, showOriginalCode, streaming, loadAttempt]);
@@ -398,6 +432,95 @@ var MantineAIMMermaidCode = (0, import_react3.memo)((props) => {
398
432
  MantineAIMMermaidCode.displayName = "MantineAIMMermaidCode";
399
433
  var MermaidCode_default = MantineAIMMermaidCode;
400
434
 
435
+ // src/components/customized/PreCode.tsx
436
+ var import_core6 = require("@mantine/core");
437
+
438
+ // src/components/customized/formatJson.ts
439
+ function prettyPrintJson(text, expandNested = true) {
440
+ try {
441
+ return format(text, expandNested, 0);
442
+ } catch {
443
+ return text;
444
+ }
445
+ }
446
+ function format(text, expandNested, baseIndent) {
447
+ JSON.parse(text);
448
+ const tokens = text.match(/"(?:\\[\s\S]|[^"\\])*"|-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null|[{}[\],:]/g) ?? [];
449
+ const out = [];
450
+ let indent = baseIndent;
451
+ const newline = () => out.push("\n", " ".repeat(indent));
452
+ for (let i = 0; i < tokens.length; i++) {
453
+ const token = tokens[i];
454
+ if (token === "{" || token === "[") {
455
+ out.push(token);
456
+ if (tokens[i + 1] !== (token === "{" ? "}" : "]")) {
457
+ indent++;
458
+ newline();
459
+ }
460
+ } else if (token === "}" || token === "]") {
461
+ if (tokens[i - 1] !== (token === "}" ? "{" : "[")) {
462
+ indent--;
463
+ newline();
464
+ }
465
+ out.push(token);
466
+ } else if (token === ",") {
467
+ out.push(",");
468
+ newline();
469
+ } else if (token === ":") {
470
+ out.push(": ");
471
+ } else if (token.startsWith('"')) {
472
+ const value = JSON.parse(token);
473
+ const trimmed = value.trim();
474
+ if (expandNested && tokens[i + 1] !== ":" && /^[{[]/.test(trimmed) && indent < 100) {
475
+ try {
476
+ out.push(format(trimmed, true, indent));
477
+ continue;
478
+ } catch {
479
+ }
480
+ }
481
+ out.push(JSON.stringify(value));
482
+ } else {
483
+ out.push(token);
484
+ }
485
+ }
486
+ return out.join("");
487
+ }
488
+
489
+ // src/components/customized/jsonCompleteness.ts
490
+ function createJsonCompletenessScanner() {
491
+ let previous = "";
492
+ let depth = 0;
493
+ let quoted = false;
494
+ let escaped = false;
495
+ let invalid = false;
496
+ let last = "";
497
+ return (text) => {
498
+ let from = previous.length;
499
+ if (!text.startsWith(previous)) {
500
+ from = 0;
501
+ depth = 0;
502
+ quoted = escaped = invalid = false;
503
+ last = "";
504
+ }
505
+ previous = text;
506
+ for (let i = from; i < text.length; i++) {
507
+ const c = text[i];
508
+ if (!/\s/.test(c)) last = c;
509
+ if (quoted) {
510
+ if (escaped) escaped = false;
511
+ else if (c === "\\") escaped = true;
512
+ else if (c === '"') quoted = false;
513
+ } else if (c === '"') quoted = true;
514
+ else if (c === "{" || c === "[") depth++;
515
+ else if (c === "}" || c === "]") {
516
+ depth--;
517
+ if (depth < 0) invalid = true;
518
+ }
519
+ }
520
+ return !invalid && !quoted && depth === 0 && (last === "}" || last === "]");
521
+ };
522
+ }
523
+
401
524
  // src/components/customized/PreCode.tsx
402
525
  var import_jsx_runtime4 = require("react/jsx-runtime");
403
526
  var hljsAutoPromise = null;
@@ -420,9 +543,15 @@ function useAutoDetectedLanguage(codeText, enabled, streaming) {
420
543
  );
421
544
  const [loadAttempt, setLoadAttempt] = (0, import_react4.useState)(0);
422
545
  const loadFailuresRef = (0, import_react4.useRef)(0);
546
+ const previousTextRef = (0, import_react4.useRef)(codeText);
423
547
  (0, import_react4.useEffect)(() => {
424
- if (!enabled) return;
425
- const prior = detected !== null && codeText.length < detected.atLength ? null : detected;
548
+ const appended = codeText.startsWith(previousTextRef.current);
549
+ previousTextRef.current = codeText;
550
+ if (!enabled) {
551
+ if (detected) setDetected(null);
552
+ return;
553
+ }
554
+ const prior = !appended || detected !== null && codeText.length < detected.atLength ? null : detected;
426
555
  if (prior !== detected) setDetected(null);
427
556
  if (codeText.length < AUTODETECT_MIN_CHARS) return;
428
557
  const due = prior === null || // Not streaming: the verdict must be for THIS text (end-of-stream, or a
@@ -461,54 +590,31 @@ function preloadMantineCodeAssets() {
461
590
  () => void 0
462
591
  );
463
592
  }
464
- function prettyPrintJson(text) {
465
- let parsed;
466
- try {
467
- parsed = JSON.parse(text);
468
- } catch {
469
- return text;
470
- }
471
- return JSON.stringify(expandNestedJson(parsed), null, 2);
472
- }
473
- function expandNestedJson(value) {
474
- if (typeof value === "string") {
475
- const t = value.trim();
476
- if (t.length > 1 && (t[0] === "{" || t[0] === "[")) {
477
- try {
478
- const inner = JSON.parse(t);
479
- if (inner !== null && typeof inner === "object") return expandNestedJson(inner);
480
- } catch {
481
- }
482
- }
483
- return value;
484
- }
485
- if (Array.isArray(value)) return value.map(expandNestedJson);
486
- if (value !== null && typeof value === "object") {
487
- const out = /* @__PURE__ */ Object.create(null);
488
- for (const [k, v] of Object.entries(value)) out[k] = expandNestedJson(v);
489
- return out;
490
- }
491
- return value;
492
- }
493
- function jsonLooksComplete(text) {
494
- if (!/[}\]]\s*$/.test(text)) return false;
495
- let depth = 0;
496
- let inString = false;
497
- for (let i = 0; i < text.length; i++) {
498
- const c = text.charCodeAt(i);
499
- if (inString) {
500
- if (c === 92) i += 1;
501
- else if (c === 34) inString = false;
502
- } else if (c === 34) {
503
- inString = true;
504
- } else if (c === 123 || c === 91) {
505
- depth += 1;
506
- } else if (c === 125 || c === 93) {
507
- depth -= 1;
508
- if (depth < 0) return false;
593
+ function RawCodeCopy({ code }) {
594
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core6.CopyButton, { value: code, children: ({ copied, copy }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
595
+ import_code_highlight2.CodeHighlightControl,
596
+ {
597
+ tooltipLabel: copied ? "Copied" : "Copy",
598
+ "aria-label": copied ? "Copied" : "Copy code",
599
+ onClick: copy,
600
+ children: copied ? "\u2713" : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
601
+ "svg",
602
+ {
603
+ width: "16",
604
+ height: "16",
605
+ viewBox: "0 0 24 24",
606
+ fill: "none",
607
+ stroke: "currentColor",
608
+ strokeWidth: "1.5",
609
+ "aria-hidden": "true",
610
+ children: [
611
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "8", y: "8", width: "12", height: "12", rx: "2" }),
612
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M16 8V4H4v12h4" })
613
+ ]
614
+ }
615
+ )
509
616
  }
510
- }
511
- return depth === 0 && !inString;
617
+ ) });
512
618
  }
513
619
  var SpecialCodeLanguage = /* @__PURE__ */ ((SpecialCodeLanguage2) => {
514
620
  SpecialCodeLanguage2["Mermaid"] = "mermaid";
@@ -519,7 +625,7 @@ var MantineAIMPreCode = (0, import_react4.memo)(
519
625
  (props) => {
520
626
  const { fontSize } = (0, import_core5.useAIMarkdownTheme)();
521
627
  const { streaming } = (0, import_core5.useAIMarkdownState)();
522
- const { autoDetectUnknownLanguage, defaultExpanded } = useMantineCodeBlockOptions();
628
+ const { autoDetectUnknownLanguage, defaultExpanded, formatJson, expandNestedJson } = useMantineCodeBlockOptions();
523
629
  const detectedLanguage = useAutoDetectedLanguage(
524
630
  props.codeText,
525
631
  autoDetectUnknownLanguage && !props.existLanguage,
@@ -531,11 +637,16 @@ var MantineAIMPreCode = (0, import_react4.memo)(
531
637
  [codeLanguage]
532
638
  );
533
639
  const isSpecialCodeBlock = SPECIAL_LANGUAGES.has(codeLanguage);
640
+ const [scanJson] = (0, import_react4.useState)(createJsonCompletenessScanner);
641
+ const jsonComplete = (0, import_react4.useMemo)(
642
+ () => usedCodeLanguage === "json" && formatJson && streaming ? scanJson(props.codeText) : false,
643
+ [usedCodeLanguage, formatJson, streaming, scanJson, props.codeText]
644
+ );
534
645
  const normalCodeBlockContent = (0, import_react4.useMemo)(() => {
535
646
  if (isSpecialCodeBlock) return null;
536
647
  let usedCodeStr = props.codeText;
537
- if (usedCodeStr && usedCodeLanguage === "json" && (!streaming || jsonLooksComplete(usedCodeStr))) {
538
- usedCodeStr = prettyPrintJson(usedCodeStr);
648
+ if (formatJson && usedCodeStr && usedCodeLanguage === "json" && (!streaming || jsonComplete)) {
649
+ usedCodeStr = prettyPrintJson(usedCodeStr, expandNestedJson);
539
650
  }
540
651
  return usedFileName === "unknown" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
541
652
  import_code_highlight2.CodeHighlight,
@@ -547,7 +658,9 @@ var MantineAIMPreCode = (0, import_react4.memo)(
547
658
  withBorder: true,
548
659
  withExpandButton: true,
549
660
  defaultExpanded,
550
- maxCollapsedHeight: "320px"
661
+ maxCollapsedHeight: "320px",
662
+ withCopyButton: false,
663
+ controls: [/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RawCodeCopy, { code: props.codeText }, "copy")]
551
664
  }
552
665
  ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
553
666
  import_code_highlight2.CodeHighlightTabs,
@@ -565,10 +678,23 @@ var MantineAIMPreCode = (0, import_react4.memo)(
565
678
  withBorder: true,
566
679
  withExpandButton: true,
567
680
  defaultExpanded,
568
- maxCollapsedHeight: "320px"
681
+ maxCollapsedHeight: "320px",
682
+ withCopyButton: false,
683
+ controls: [/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RawCodeCopy, { code: props.codeText }, "copy")]
569
684
  }
570
685
  );
571
- }, [isSpecialCodeBlock, props.codeText, usedCodeLanguage, usedFileName, fontSize, defaultExpanded, streaming]);
686
+ }, [
687
+ isSpecialCodeBlock,
688
+ props.codeText,
689
+ usedCodeLanguage,
690
+ usedFileName,
691
+ fontSize,
692
+ defaultExpanded,
693
+ streaming,
694
+ formatJson,
695
+ expandNestedJson,
696
+ jsonComplete
697
+ ]);
572
698
  const specialCodeBlockContent = (0, import_react4.useMemo)(() => {
573
699
  switch (codeLanguage) {
574
700
  case "mermaid" /* Mermaid */:
@@ -584,22 +710,23 @@ MantineAIMPreCode.displayName = "MantineAIMPreCode";
584
710
  var PreCode_default = MantineAIMPreCode;
585
711
 
586
712
  // src/MantineAIMarkdown.tsx
587
- var import_core8 = require("@mantine/core");
713
+ var import_core9 = require("@mantine/core");
588
714
  var import_jsx_runtime5 = require("react/jsx-runtime");
589
715
  var NO_GROUPS = Object.freeze({});
590
716
  var MANTINE_STABILITY_TABLE = {
591
- codeBlock: import_core7.AIMarkdownStabilityPolicy.DEEP_EQUAL
717
+ codeBlock: import_core8.AIMarkdownStabilityPolicy.DEEP_EQUAL
592
718
  };
593
719
  var DefaultCustomComponents = {
594
720
  pre: ({ node, ...usefulProps }) => {
595
721
  const code = node?.children[0];
596
- if (!code || code.type !== "element" || code.tagName !== "code" || !code.position) {
722
+ if (!code || code.type !== "element" || code.tagName !== "code" || !code.position || node?.children.length !== 1 || code.children.some((child) => !("value" in child) || typeof child.value !== "string") || Object.keys(code.properties ?? {}).some((key2) => key2 !== "className") || Object.keys(node.properties ?? {}).length > 0) {
597
723
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pre", { ...usefulProps });
598
724
  }
599
725
  const key = `pre-code-${node?.position?.start?.offset || 0}`;
600
726
  const classNames = code.properties?.className;
601
727
  const classList = Array.isArray(classNames) ? classNames.filter((c) => typeof c === "string") : typeof classNames === "string" ? classNames.split(/\s+/) : [];
602
728
  const detectedLanguage = classList.find((className) => className.startsWith("language-"))?.substring("language-".length);
729
+ if (classList.some((className) => !className.startsWith("language-"))) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pre", { ...usefulProps });
603
730
  const codeText = code.children.map((child) => child.value ?? "").join("");
604
731
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PreCode_default, { codeText, existLanguage: detectedLanguage }, key);
605
732
  }
@@ -612,18 +739,18 @@ var MantineAIMarkdownComponent = ({
612
739
  codeBlock,
613
740
  ...props
614
741
  }) => {
615
- const stableCustomComponents = (0, import_core7.useStableValue)(customComponents);
742
+ const stableCustomComponents = (0, import_core8.useStableValue)(customComponents);
616
743
  const usedComponents = (0, import_react5.useMemo)(() => {
617
744
  return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;
618
745
  }, [stableCustomComponents]);
619
- const computedColorScheme = (0, import_core8.useComputedColorScheme)("light");
620
- const stable = (0, import_core7.useStableRecord)({ codeBlock }, MANTINE_STABILITY_TABLE);
746
+ const computedColorScheme = (0, import_core9.useComputedColorScheme)("light");
747
+ const stable = (0, import_core8.useStableRecord)({ codeBlock }, MANTINE_STABILITY_TABLE);
621
748
  const behaviorGroups = (0, import_react5.useMemo)(
622
749
  () => stable.codeBlock != null ? { codeBlock: stable.codeBlock } : NO_GROUPS,
623
750
  [stable.codeBlock]
624
751
  );
625
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core7.AIMarkdownBehaviorsProvider, { value: behaviorGroups, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
626
- import_core6.default,
752
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core8.AIMarkdownBehaviorsProvider, { value: behaviorGroups, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
753
+ import_core7.default,
627
754
  {
628
755
  Typography: Typography2,
629
756
  ExtraStyles,
@@ -643,9 +770,9 @@ function defineMantineBehaviors(values) {
643
770
  }
644
771
 
645
772
  // src/hooks/useMantineAIMarkdownMetadata.ts
646
- var import_core9 = require("@ai-react-markdown/core");
773
+ var import_core10 = require("@ai-react-markdown/core");
647
774
  var useMantineAIMarkdownMetadata = () => {
648
- return (0, import_core9.useAIMarkdownMetadata)();
775
+ return (0, import_core10.useAIMarkdownMetadata)();
649
776
  };
650
777
  // Annotate the CommonJS export names for ESM import in node:
651
778
  0 && (module.exports = {