@ai-react-markdown/mantine 1.7.0 → 2.0.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 +66 -46
- package/dist/index.cjs +89 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +76 -61
- package/dist/index.d.ts +76 -61
- package/dist/index.js +63 -49
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,48 +1,39 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { AIMarkdownMetadata, AIMarkdownRenderConfig, AIMarkdownProps, AIMarkdownTypographyProps, AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';
|
|
2
|
+
import { AIMarkdownMetadata, AIMarkdownProps, AIMarkdownTypographyProps, AIMarkdownExtraStylesComponent, AIMarkdownBehaviorProps } from '@ai-react-markdown/core';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
|
-
* Mantine-specific type definitions and
|
|
7
|
-
*
|
|
8
|
-
* Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}
|
|
9
|
-
* with Mantine-themed options such as uniform heading sizes and code block behavior.
|
|
5
|
+
* Mantine-specific type definitions and defaults: the `codeBlock` behavior
|
|
6
|
+
* group and the metadata extension point.
|
|
10
7
|
*
|
|
11
8
|
* @module defs
|
|
12
9
|
*/
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
|
-
*
|
|
12
|
+
* Code block rendering options (the mantine `codeBlock` behavior group).
|
|
16
13
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* v2 transport: passed as the flat `codeBlock` prop on `MantineAIMarkdown`
|
|
15
|
+
* (group value replaces atomically) and read through
|
|
16
|
+
* `useMantineCodeBlockOptions()`, which applies the defaults below inside
|
|
17
|
+
* the hook — the single place defaults live at read time.
|
|
19
18
|
*/
|
|
20
|
-
interface
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
36
|
-
autoDetectUnknownLanguage: boolean;
|
|
37
|
-
};
|
|
19
|
+
interface MantineCodeBlockOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Whether code blocks start in their expanded state.
|
|
22
|
+
* When `false`, long code blocks are collapsed with an expand button.
|
|
23
|
+
*
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
defaultExpanded: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* When `true`, uses `highlight.js` auto-detection to determine the language
|
|
29
|
+
* of code blocks that lack an explicit language annotation.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
autoDetectUnknownLanguage: boolean;
|
|
38
34
|
}
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
* Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.
|
|
43
|
-
* Frozen to prevent accidental mutation.
|
|
44
|
-
*/
|
|
45
|
-
declare const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig;
|
|
35
|
+
/** Shipped defaults for the `codeBlock` behavior group. */
|
|
36
|
+
declare const defaultMantineCodeBlockOptions: Readonly<MantineCodeBlockOptions>;
|
|
46
37
|
/**
|
|
47
38
|
* Metadata type for the Mantine integration.
|
|
48
39
|
*
|
|
@@ -56,13 +47,19 @@ interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {
|
|
|
56
47
|
/**
|
|
57
48
|
* Props for the {@link MantineAIMarkdown} component.
|
|
58
49
|
*
|
|
59
|
-
* Extends {@link AIMarkdownProps} with
|
|
60
|
-
* All core props (`content`, `streaming`, `fontSize`, `
|
|
50
|
+
* Extends {@link AIMarkdownProps} with the mantine behavior groups.
|
|
51
|
+
* All core props (`content`, `streaming`, `fontSize`, `enginePlugins`, etc.)
|
|
52
|
+
* are inherited.
|
|
61
53
|
*
|
|
62
|
-
* @typeParam
|
|
63
|
-
* @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.
|
|
54
|
+
* @typeParam TMetadata - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.
|
|
64
55
|
*/
|
|
65
|
-
interface MantineAIMarkdownProps<
|
|
56
|
+
interface MantineAIMarkdownProps<TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata> extends AIMarkdownProps<TMetadata> {
|
|
57
|
+
/**
|
|
58
|
+
* Code-block behavior group (Behaviors system). The group value replaces
|
|
59
|
+
* atomically; omitted fields resolve to the shipped defaults inside
|
|
60
|
+
* `useMantineCodeBlockOptions()`. `null` counts as absent.
|
|
61
|
+
*/
|
|
62
|
+
codeBlock?: Partial<MantineCodeBlockOptions>;
|
|
66
63
|
}
|
|
67
64
|
/**
|
|
68
65
|
* Inner (non-memoized) implementation of the Mantine AI markdown component.
|
|
@@ -71,10 +68,9 @@ interface MantineAIMarkdownProps<TConfig extends MantineAIMarkdownRenderConfig =
|
|
|
71
68
|
* overrides take precedence). Automatically resolves the color scheme from Mantine's
|
|
72
69
|
* `useComputedColorScheme` when no explicit `colorScheme` prop is provided.
|
|
73
70
|
*
|
|
74
|
-
* @typeParam
|
|
75
|
-
* @typeParam TRenderData - Metadata type.
|
|
71
|
+
* @typeParam TMetadata - Metadata type.
|
|
76
72
|
*/
|
|
77
|
-
declare const MantineAIMarkdownComponent: <
|
|
73
|
+
declare const MantineAIMarkdownComponent: <TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>({ Typography, ExtraStyles, customComponents, colorScheme, codeBlock, ...props }: MantineAIMarkdownProps<TMetadata>) => react.JSX.Element;
|
|
78
74
|
declare const _default: typeof MantineAIMarkdownComponent;
|
|
79
75
|
|
|
80
76
|
/**
|
|
@@ -105,29 +101,48 @@ declare const MantineAIMarkdownTypography: react.MemoExoticComponent<({ children
|
|
|
105
101
|
declare const MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent;
|
|
106
102
|
|
|
107
103
|
/**
|
|
108
|
-
*
|
|
104
|
+
* Narrow hook for the mantine `codeBlock` behavior group.
|
|
109
105
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
106
|
+
* This is THE single type-assertion site for the group (the pattern that
|
|
107
|
+
* retires the public caller-asserted `TConfig` generic): the opaque
|
|
108
|
+
* extension record from `useAIMarkdownBehaviors()` is narrowed here, and
|
|
109
|
+
* group defaults are applied here — read sites must consume this hook and
|
|
110
|
+
* never re-apply defaults with bare `??` (multiple read sites duplicating
|
|
111
|
+
* defaults will drift).
|
|
114
112
|
*
|
|
115
|
-
*
|
|
116
|
-
|
|
113
|
+
* @module hooks/useMantineCodeBlockOptions
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Read the resolved code-block options from the behaviors context.
|
|
117
118
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
119
|
+
* Group values replace atomically at the transport layer; defaults are
|
|
120
|
+
* filled in here, so a partial group (e.g. `codeBlock={{ defaultExpanded:
|
|
121
|
+
* false }}`) resolves the omitted fields to the shipped defaults.
|
|
120
122
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();
|
|
125
|
-
* const isExpanded = config.codeBlock.defaultExpanded;
|
|
126
|
-
* // ...
|
|
127
|
-
* }
|
|
128
|
-
* ```
|
|
123
|
+
* Must be called inside a `<MantineAIMarkdown>` (or any `<AIMarkdown>`
|
|
124
|
+
* wrapped in the mantine Provider stack) — throws outside, same contract
|
|
125
|
+
* as the core narrow hooks.
|
|
129
126
|
*/
|
|
130
|
-
declare
|
|
127
|
+
declare function useMantineCodeBlockOptions(): Required<MantineCodeBlockOptions>;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Widened `define*` factory for the mantine wrapper (EXECUTION-PLAN §4
|
|
131
|
+
* item 8): identity + mantine prop types + freeze, zero logic. Core
|
|
132
|
+
* factories accept core fields only — passing `codeBlock` to core's
|
|
133
|
+
* `defineBehaviors` is a TS error; this widened factory is the wrapper's
|
|
134
|
+
* one-line obligation.
|
|
135
|
+
*
|
|
136
|
+
* @module define
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
/** Behavior-system props packagable at integration time, mantine-widened. */
|
|
140
|
+
interface MantineBehaviorProps extends AIMarkdownBehaviorProps {
|
|
141
|
+
/** The mantine `codeBlock` behavior group (atomic replacement; defaults applied at read time). */
|
|
142
|
+
codeBlock?: Partial<MantineCodeBlockOptions>;
|
|
143
|
+
}
|
|
144
|
+
/** Freeze a mantine behaviors fragment. Identity + types + freeze; zero logic. */
|
|
145
|
+
declare function defineMantineBehaviors(values: MantineBehaviorProps): Readonly<MantineBehaviorProps>;
|
|
131
146
|
|
|
132
147
|
/**
|
|
133
148
|
* Typed wrapper around the core {@link useAIMarkdownMetadata} hook.
|
|
@@ -154,4 +169,4 @@ declare const useMantineAIMarkdownRenderState: <TConfig extends MantineAIMarkdow
|
|
|
154
169
|
*/
|
|
155
170
|
declare const useMantineAIMarkdownMetadata: <TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>() => TMetadata | undefined;
|
|
156
171
|
|
|
157
|
-
export { MantineAIMDefaultExtraStyles, type MantineAIMarkdownMetadata, type MantineAIMarkdownProps, type
|
|
172
|
+
export { MantineAIMDefaultExtraStyles, type MantineAIMarkdownMetadata, type MantineAIMarkdownProps, MantineAIMarkdownTypography, type MantineBehaviorProps, type MantineCodeBlockOptions, _default as default, defaultMantineCodeBlockOptions, defineMantineBehaviors, useMantineAIMarkdownMetadata, useMantineCodeBlockOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// src/MantineAIMarkdown.tsx
|
|
2
|
-
import { memo as memo4, useMemo as
|
|
2
|
+
import { memo as memo4, useMemo as useMemo3 } from "react";
|
|
3
3
|
import AIMarkdown from "@ai-react-markdown/core";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
AIMarkdownBehaviorsProvider,
|
|
6
|
+
AIMarkdownStabilityPolicy,
|
|
7
|
+
useStableRecord,
|
|
8
|
+
useStableValue
|
|
9
|
+
} from "@ai-react-markdown/core";
|
|
5
10
|
|
|
6
11
|
// src/components/typography/MantineTypography.tsx
|
|
7
12
|
import { memo } from "react";
|
|
@@ -18,33 +23,36 @@ var MantineAIMDefaultExtraStyles = ({ children }) => {
|
|
|
18
23
|
};
|
|
19
24
|
var DefaultExtraStyles_default = MantineAIMDefaultExtraStyles;
|
|
20
25
|
|
|
21
|
-
// src/defs.tsx
|
|
22
|
-
import { defaultAIMarkdownRenderConfig } from "@ai-react-markdown/core";
|
|
23
|
-
var defaultMantineAIMarkdownRenderConfig = Object.freeze({
|
|
24
|
-
...defaultAIMarkdownRenderConfig,
|
|
25
|
-
codeBlock: Object.freeze({
|
|
26
|
-
defaultExpanded: true,
|
|
27
|
-
autoDetectUnknownLanguage: false
|
|
28
|
-
})
|
|
29
|
-
});
|
|
30
|
-
|
|
31
26
|
// src/components/customized/PreCode.tsx
|
|
32
|
-
import { memo as memo3, useMemo } from "react";
|
|
27
|
+
import { memo as memo3, useMemo as useMemo2 } from "react";
|
|
33
28
|
import { CodeHighlight, CodeHighlightTabs as CodeHighlightTabs2 } from "@mantine/code-highlight";
|
|
34
29
|
import { deepParseJson } from "deep-parse-json";
|
|
35
30
|
import hljs from "highlight.js";
|
|
31
|
+
import { useAIMarkdownTheme as useAIMarkdownTheme2 } from "@ai-react-markdown/core";
|
|
36
32
|
|
|
37
|
-
// src/hooks/
|
|
38
|
-
import {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
// src/hooks/useMantineCodeBlockOptions.ts
|
|
34
|
+
import { useMemo } from "react";
|
|
35
|
+
import { useAIMarkdownBehaviors } from "@ai-react-markdown/core";
|
|
36
|
+
|
|
37
|
+
// src/defs.tsx
|
|
38
|
+
var defaultMantineCodeBlockOptions = Object.freeze({
|
|
39
|
+
defaultExpanded: true,
|
|
40
|
+
autoDetectUnknownLanguage: false
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// src/hooks/useMantineCodeBlockOptions.ts
|
|
44
|
+
function useMantineCodeBlockOptions() {
|
|
45
|
+
const behaviors = useAIMarkdownBehaviors();
|
|
46
|
+
const group = behaviors.codeBlock;
|
|
47
|
+
return useMemo(() => ({ ...defaultMantineCodeBlockOptions, ...group }), [group]);
|
|
48
|
+
}
|
|
42
49
|
|
|
43
50
|
// src/components/customized/MermaidCode/index.tsx
|
|
44
51
|
import { memo as memo2, useEffect, useRef, useState, useCallback } from "react";
|
|
45
52
|
import { CodeHighlightControl, CodeHighlightTabs } from "@mantine/code-highlight";
|
|
46
53
|
import { ActionIcon, CopyButton, Flex, Tooltip } from "@mantine/core";
|
|
47
54
|
import mermaid from "mermaid";
|
|
55
|
+
import { useAIMarkdownState, useAIMarkdownTheme } from "@ai-react-markdown/core";
|
|
48
56
|
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
49
57
|
var PRE_STYLE = { cursor: "pointer", overflow: "auto", width: "100%", padding: "0.5rem" };
|
|
50
58
|
var sameView = (a, b) => a.kind === "diagram" && b.kind === "diagram" ? a.chartType === b.chartType : a.kind === b.kind;
|
|
@@ -82,9 +90,10 @@ var handleViewSVGInNewWindow = (svgElement, isDark) => {
|
|
|
82
90
|
}
|
|
83
91
|
};
|
|
84
92
|
var MantineAIMMermaidCode = memo2((props) => {
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
93
|
+
const { colorScheme, fontSize } = useAIMarkdownTheme();
|
|
94
|
+
const { streaming } = useAIMarkdownState();
|
|
95
|
+
const { defaultExpanded } = useMantineCodeBlockOptions();
|
|
96
|
+
const isDark = colorScheme === "dark";
|
|
88
97
|
const ref = useRef(null);
|
|
89
98
|
const renderVersionRef = useRef(0);
|
|
90
99
|
const viewRef = useRef({ kind: "source" });
|
|
@@ -169,7 +178,7 @@ var MantineAIMMermaidCode = memo2((props) => {
|
|
|
169
178
|
CodeHighlightTabs,
|
|
170
179
|
{
|
|
171
180
|
mb: 15,
|
|
172
|
-
fz:
|
|
181
|
+
fz: fontSize,
|
|
173
182
|
w: "100%",
|
|
174
183
|
code: [
|
|
175
184
|
{
|
|
@@ -178,7 +187,7 @@ var MantineAIMMermaidCode = memo2((props) => {
|
|
|
178
187
|
language: "mermaid"
|
|
179
188
|
}
|
|
180
189
|
],
|
|
181
|
-
defaultExpanded
|
|
190
|
+
defaultExpanded,
|
|
182
191
|
maxCollapsedHeight: "320px",
|
|
183
192
|
styles: {
|
|
184
193
|
filesScrollarea: {
|
|
@@ -273,15 +282,16 @@ var SpecialCodeLanguage = /* @__PURE__ */ ((SpecialCodeLanguage2) => {
|
|
|
273
282
|
var SPECIAL_LANGUAGES = new Set(Object.values(SpecialCodeLanguage));
|
|
274
283
|
var MantineAIMPreCode = memo3(
|
|
275
284
|
(props) => {
|
|
276
|
-
const
|
|
277
|
-
const
|
|
285
|
+
const { fontSize } = useAIMarkdownTheme2();
|
|
286
|
+
const { autoDetectUnknownLanguage, defaultExpanded } = useMantineCodeBlockOptions();
|
|
287
|
+
const codeLanguage = useMemo2(() => {
|
|
278
288
|
if (props.existLanguage) return props.existLanguage;
|
|
279
|
-
if (
|
|
289
|
+
if (autoDetectUnknownLanguage) {
|
|
280
290
|
return hljs.highlightAuto(props.codeText).language || "";
|
|
281
291
|
}
|
|
282
292
|
return "";
|
|
283
|
-
}, [props.existLanguage, props.codeText,
|
|
284
|
-
const [usedCodeLanguage, usedFileName] =
|
|
293
|
+
}, [props.existLanguage, props.codeText, autoDetectUnknownLanguage]);
|
|
294
|
+
const [usedCodeLanguage, usedFileName] = useMemo2(() => {
|
|
285
295
|
if (!codeLanguage) return ["plaintext", "unknown"];
|
|
286
296
|
if (!hljs.getLanguage(codeLanguage)) {
|
|
287
297
|
return ["plaintext", codeLanguage];
|
|
@@ -289,7 +299,7 @@ var MantineAIMPreCode = memo3(
|
|
|
289
299
|
return [codeLanguage, codeLanguage];
|
|
290
300
|
}, [codeLanguage]);
|
|
291
301
|
const isSpecialCodeBlock = SPECIAL_LANGUAGES.has(codeLanguage);
|
|
292
|
-
const normalCodeBlockContent =
|
|
302
|
+
const normalCodeBlockContent = useMemo2(() => {
|
|
293
303
|
if (isSpecialCodeBlock) return null;
|
|
294
304
|
let usedCodeStr = props.codeText;
|
|
295
305
|
if (usedCodeStr && usedCodeLanguage.toLowerCase() === "json") {
|
|
@@ -300,19 +310,19 @@ var MantineAIMPreCode = memo3(
|
|
|
300
310
|
CodeHighlight,
|
|
301
311
|
{
|
|
302
312
|
mb: 15,
|
|
303
|
-
fz:
|
|
313
|
+
fz: fontSize,
|
|
304
314
|
w: "100%",
|
|
305
315
|
code: usedCodeStr,
|
|
306
316
|
withBorder: true,
|
|
307
317
|
withExpandButton: true,
|
|
308
|
-
defaultExpanded
|
|
318
|
+
defaultExpanded,
|
|
309
319
|
maxCollapsedHeight: "320px"
|
|
310
320
|
}
|
|
311
321
|
) : /* @__PURE__ */ jsx4(
|
|
312
322
|
CodeHighlightTabs2,
|
|
313
323
|
{
|
|
314
324
|
mb: 15,
|
|
315
|
-
fz:
|
|
325
|
+
fz: fontSize,
|
|
316
326
|
w: "100%",
|
|
317
327
|
code: [
|
|
318
328
|
{
|
|
@@ -323,19 +333,12 @@ var MantineAIMPreCode = memo3(
|
|
|
323
333
|
],
|
|
324
334
|
withBorder: true,
|
|
325
335
|
withExpandButton: true,
|
|
326
|
-
defaultExpanded
|
|
336
|
+
defaultExpanded,
|
|
327
337
|
maxCollapsedHeight: "320px"
|
|
328
338
|
}
|
|
329
339
|
);
|
|
330
|
-
}, [
|
|
331
|
-
|
|
332
|
-
props.codeText,
|
|
333
|
-
usedCodeLanguage,
|
|
334
|
-
usedFileName,
|
|
335
|
-
renderState.fontSize,
|
|
336
|
-
renderState.config.codeBlock.defaultExpanded
|
|
337
|
-
]);
|
|
338
|
-
const specialCodeBlockContent = useMemo(() => {
|
|
340
|
+
}, [isSpecialCodeBlock, props.codeText, usedCodeLanguage, usedFileName, fontSize, defaultExpanded]);
|
|
341
|
+
const specialCodeBlockContent = useMemo2(() => {
|
|
339
342
|
switch (codeLanguage) {
|
|
340
343
|
case "mermaid" /* Mermaid */:
|
|
341
344
|
return /* @__PURE__ */ jsx4(MermaidCode_default, { code: props.codeText });
|
|
@@ -352,6 +355,10 @@ var PreCode_default = MantineAIMPreCode;
|
|
|
352
355
|
// src/MantineAIMarkdown.tsx
|
|
353
356
|
import { useComputedColorScheme } from "@mantine/core";
|
|
354
357
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
358
|
+
var EMPTY_CODE_BLOCK = Object.freeze({});
|
|
359
|
+
var MANTINE_STABILITY_TABLE = {
|
|
360
|
+
codeBlock: AIMarkdownStabilityPolicy.DEEP_EQUAL
|
|
361
|
+
};
|
|
355
362
|
var DefaultCustomComponents = {
|
|
356
363
|
pre: ({ node, ...usefulProps }) => {
|
|
357
364
|
const code = node?.children[0];
|
|
@@ -367,32 +374,38 @@ var DefaultCustomComponents = {
|
|
|
367
374
|
var MantineAIMarkdownComponent = ({
|
|
368
375
|
Typography: Typography2 = MantineTypography_default,
|
|
369
376
|
ExtraStyles = DefaultExtraStyles_default,
|
|
370
|
-
defaultConfig = defaultMantineAIMarkdownRenderConfig,
|
|
371
377
|
customComponents,
|
|
372
378
|
colorScheme,
|
|
379
|
+
codeBlock,
|
|
373
380
|
...props
|
|
374
381
|
}) => {
|
|
375
382
|
const stableCustomComponents = useStableValue(customComponents);
|
|
376
|
-
const usedComponents =
|
|
383
|
+
const usedComponents = useMemo3(() => {
|
|
377
384
|
return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;
|
|
378
385
|
}, [stableCustomComponents]);
|
|
379
386
|
const computedColorScheme = useComputedColorScheme("light");
|
|
380
|
-
|
|
387
|
+
const stable = useStableRecord({ codeBlock }, MANTINE_STABILITY_TABLE);
|
|
388
|
+
const behaviorGroups = useMemo3(() => ({ codeBlock: stable.codeBlock ?? EMPTY_CODE_BLOCK }), [stable.codeBlock]);
|
|
389
|
+
return /* @__PURE__ */ jsx5(AIMarkdownBehaviorsProvider, { value: behaviorGroups, children: /* @__PURE__ */ jsx5(
|
|
381
390
|
AIMarkdown,
|
|
382
391
|
{
|
|
383
392
|
Typography: Typography2,
|
|
384
393
|
ExtraStyles,
|
|
385
|
-
defaultConfig,
|
|
386
394
|
customComponents: usedComponents,
|
|
387
395
|
colorScheme: colorScheme ?? computedColorScheme,
|
|
388
396
|
...props
|
|
389
397
|
}
|
|
390
|
-
);
|
|
398
|
+
) });
|
|
391
399
|
};
|
|
392
400
|
var MantineAIMarkdown = memo4(MantineAIMarkdownComponent);
|
|
393
401
|
MantineAIMarkdown.displayName = "MantineAIMarkdown";
|
|
394
402
|
var MantineAIMarkdown_default = MantineAIMarkdown;
|
|
395
403
|
|
|
404
|
+
// src/define.ts
|
|
405
|
+
function defineMantineBehaviors(values) {
|
|
406
|
+
return Object.freeze(values);
|
|
407
|
+
}
|
|
408
|
+
|
|
396
409
|
// src/hooks/useMantineAIMarkdownMetadata.ts
|
|
397
410
|
import { useAIMarkdownMetadata } from "@ai-react-markdown/core";
|
|
398
411
|
var useMantineAIMarkdownMetadata = () => {
|
|
@@ -402,8 +415,9 @@ export {
|
|
|
402
415
|
DefaultExtraStyles_default as MantineAIMDefaultExtraStyles,
|
|
403
416
|
MantineTypography_default as MantineAIMarkdownTypography,
|
|
404
417
|
MantineAIMarkdown_default as default,
|
|
405
|
-
|
|
418
|
+
defaultMantineCodeBlockOptions,
|
|
419
|
+
defineMantineBehaviors,
|
|
406
420
|
useMantineAIMarkdownMetadata,
|
|
407
|
-
|
|
421
|
+
useMantineCodeBlockOptions
|
|
408
422
|
};
|
|
409
423
|
//# sourceMappingURL=index.js.map
|