@ai-react-markdown/mantine 1.0.2 → 1.0.6
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 +291 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +149 -2
- package/dist/index.d.ts +149 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# @ai-react-markdown/mantine
|
|
2
|
+
|
|
3
|
+
Mantine UI integration for `@ai-react-markdown/core`. Provides a drop-in `<MantineAIMarkdown>` component that renders AI-generated markdown with Mantine-themed typography, syntax-highlighted code blocks, mermaid diagram support, and automatic color scheme detection.
|
|
4
|
+
|
|
5
|
+
## What It Adds on Top of Core
|
|
6
|
+
|
|
7
|
+
- **Mantine typography** -- uses Mantine's `<Typography>` component for consistent theming
|
|
8
|
+
- **Code highlighting** -- renders code blocks with `@mantine/code-highlight` (powered by highlight.js), including tabbed views with language labels, expand/collapse, and optional auto-detection for unlabeled blocks
|
|
9
|
+
- **Mermaid diagrams** -- `mermaid` code blocks are rendered as interactive SVG diagrams with dark/light theme support, toggle to source view, copy, and open-in-new-window
|
|
10
|
+
- **Same font size mode** -- `forceSameFontSize` config flattens all heading levels to body text size, useful in compact layouts like chat bubbles
|
|
11
|
+
- **Automatic color scheme** -- detects Mantine's computed color scheme (`useComputedColorScheme`) and passes it to the core renderer automatically
|
|
12
|
+
- **Mantine-scoped CSS** -- extra styles wrapper overrides Mantine spacing/font-size custom properties to use relative `em` units, ensuring consistent scaling at any base font size
|
|
13
|
+
|
|
14
|
+
All core features (GFM, LaTeX math, CJK support, streaming, metadata context, content preprocessors, custom components) are inherited from `@ai-react-markdown/core`.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# npm
|
|
20
|
+
npm install @ai-react-markdown/mantine @ai-react-markdown/core
|
|
21
|
+
|
|
22
|
+
# pnpm
|
|
23
|
+
pnpm add @ai-react-markdown/mantine @ai-react-markdown/core
|
|
24
|
+
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add @ai-react-markdown/mantine @ai-react-markdown/core
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Peer Dependencies
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"react": ">=19",
|
|
34
|
+
"react-dom": ">=19",
|
|
35
|
+
"@ai-react-markdown/core": "^1.0.2",
|
|
36
|
+
"@mantine/core": "^8.3.17",
|
|
37
|
+
"@mantine/code-highlight": "^8.3.17",
|
|
38
|
+
"highlight.js": "^11.11.1"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### CSS Dependencies
|
|
43
|
+
|
|
44
|
+
Import the required stylesheets in your application entry point:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
// Mantine core styles (required)
|
|
48
|
+
import '@mantine/core/styles.css';
|
|
49
|
+
|
|
50
|
+
// Mantine code highlight styles (required for code blocks)
|
|
51
|
+
import '@mantine/code-highlight/styles.css';
|
|
52
|
+
|
|
53
|
+
// Mantine AI Markdown styles (required for extra styles and mermaid)
|
|
54
|
+
import '@ai-react-markdown/mantine/styles.css';
|
|
55
|
+
|
|
56
|
+
// KaTeX styles (required for LaTeX math rendering)
|
|
57
|
+
import 'katex/dist/katex.min.css';
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { MantineProvider } from '@mantine/core';
|
|
64
|
+
import { CodeHighlightAdapterProvider, createHighlightJsAdapter } from '@mantine/code-highlight';
|
|
65
|
+
import hljs from 'highlight.js';
|
|
66
|
+
import MantineAIMarkdown from '@ai-react-markdown/mantine';
|
|
67
|
+
|
|
68
|
+
const highlightJsAdapter = createHighlightJsAdapter(hljs);
|
|
69
|
+
|
|
70
|
+
function App() {
|
|
71
|
+
return (
|
|
72
|
+
<MantineProvider>
|
|
73
|
+
<CodeHighlightAdapterProvider adapter={highlightJsAdapter}>
|
|
74
|
+
<MantineAIMarkdown content="Hello **world**! Math: $E = mc^2$" />
|
|
75
|
+
</CodeHighlightAdapterProvider>
|
|
76
|
+
</MantineProvider>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Streaming Example
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
function StreamingChat({ content, isStreaming }: { content: string; isStreaming: boolean }) {
|
|
85
|
+
return <MantineAIMarkdown content={content} streaming={isStreaming} />;
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Props API Reference
|
|
90
|
+
|
|
91
|
+
### `MantineAIMarkdownProps<TConfig, TRenderData>`
|
|
92
|
+
|
|
93
|
+
Extends `AIMarkdownProps` from the core package. All core props are supported; listed below are the inherited props with Mantine-specific default overrides:
|
|
94
|
+
|
|
95
|
+
| Prop | Type | Default | Description |
|
|
96
|
+
| ---- | ---- | ------- | ----------- |
|
|
97
|
+
| `content` | `string` | **(required)** | Raw markdown content to render. |
|
|
98
|
+
| `streaming` | `boolean` | `false` | Whether content is actively being streamed. |
|
|
99
|
+
| `fontSize` | `number \| string` | `'0.875rem'` | Base font size. Numbers are treated as pixels. |
|
|
100
|
+
| `variant` | `AIMarkdownVariant` | `'default'` | Typography variant name. |
|
|
101
|
+
| `colorScheme` | `AIMarkdownColorScheme` | Auto-detected | Color scheme. Defaults to Mantine's computed color scheme. |
|
|
102
|
+
| `config` | `PartialDeep<TConfig>` | `undefined` | Partial render config, deep-merged with defaults. |
|
|
103
|
+
| `defaultConfig` | `TConfig` | `defaultMantineAIMarkdownRenderConfig` | Base config. |
|
|
104
|
+
| `metadata` | `TRenderData` | `undefined` | Arbitrary data for custom components via dedicated context. |
|
|
105
|
+
| `contentPreprocessors` | `AIMDContentPreprocessor[]` | `[]` | Additional preprocessors after the built-in LaTeX preprocessor. |
|
|
106
|
+
| `customComponents` | `AIMarkdownCustomComponents` | Mantine defaults | Component overrides, merged with Mantine's built-in `<pre>` handler. |
|
|
107
|
+
| `Typography` | `AIMarkdownTypographyComponent` | `MantineAIMarkdownTypography` | Typography wrapper. |
|
|
108
|
+
| `ExtraStyles` | `AIMarkdownExtraStylesComponent` | `MantineAIMDefaultExtraStyles` | Extra style wrapper. |
|
|
109
|
+
|
|
110
|
+
## Mantine-Specific Configuration
|
|
111
|
+
|
|
112
|
+
The Mantine package extends the core `AIMarkdownRenderConfig` with additional options:
|
|
113
|
+
|
|
114
|
+
### `MantineAIMarkdownRenderConfig`
|
|
115
|
+
|
|
116
|
+
Inherits all core config fields plus:
|
|
117
|
+
|
|
118
|
+
| Field | Type | Default | Description |
|
|
119
|
+
| ----- | ---- | ------- | ----------- |
|
|
120
|
+
| `forceSameFontSize` | `boolean` | `false` | Render all headings at the same size as body text. |
|
|
121
|
+
| `codeBlock.defaultExpanded` | `boolean` | `true` | Whether code blocks start expanded. |
|
|
122
|
+
| `codeBlock.autoDetectUnknownLanguage` | `boolean` | `false` | Use highlight.js to auto-detect language for unlabeled code blocks. |
|
|
123
|
+
|
|
124
|
+
### Example: Compact Chat Mode
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
<MantineAIMarkdown
|
|
128
|
+
content={markdown}
|
|
129
|
+
config={{
|
|
130
|
+
forceSameFontSize: true,
|
|
131
|
+
codeBlock: { defaultExpanded: false },
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Hooks
|
|
137
|
+
|
|
138
|
+
### `useMantineAIMarkdownRenderState<TConfig>()`
|
|
139
|
+
|
|
140
|
+
Typed wrapper around the core `useAIMarkdownRenderState` hook, defaulting to `MantineAIMarkdownRenderConfig`. Accepts an optional generic parameter for further extension.
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { useMantineAIMarkdownRenderState } from '@ai-react-markdown/mantine';
|
|
144
|
+
|
|
145
|
+
function MyCodeBlock() {
|
|
146
|
+
const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();
|
|
147
|
+
const isExpanded = config.codeBlock.defaultExpanded;
|
|
148
|
+
const isSameSize = config.forceSameFontSize;
|
|
149
|
+
// ...
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### `useMantineAIMarkdownMetadata<TMetadata>()`
|
|
154
|
+
|
|
155
|
+
Typed wrapper around the core `useAIMarkdownMetadata` hook, defaulting to `MantineAIMarkdownMetadata`. Accepts an optional generic parameter for further extension. Metadata lives in a separate React context from render state, so metadata updates do not cause re-renders in components that only consume render state.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
import { useMantineAIMarkdownMetadata } from '@ai-react-markdown/mantine';
|
|
159
|
+
|
|
160
|
+
function MyComponent() {
|
|
161
|
+
const metadata = useMantineAIMarkdownMetadata();
|
|
162
|
+
// Access metadata fields
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Code Highlighting Setup
|
|
167
|
+
|
|
168
|
+
Code highlighting requires a `CodeHighlightAdapterProvider` wrapping your component tree. This is a Mantine requirement -- the adapter bridges highlight.js into Mantine's code highlight components.
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
import { CodeHighlightAdapterProvider, createHighlightJsAdapter } from '@mantine/code-highlight';
|
|
172
|
+
import hljs from 'highlight.js';
|
|
173
|
+
|
|
174
|
+
const highlightJsAdapter = createHighlightJsAdapter(hljs);
|
|
175
|
+
|
|
176
|
+
function App() {
|
|
177
|
+
return (
|
|
178
|
+
<CodeHighlightAdapterProvider adapter={highlightJsAdapter}>
|
|
179
|
+
{/* MantineAIMarkdown components can be rendered anywhere below */}
|
|
180
|
+
</CodeHighlightAdapterProvider>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Language Auto-Detection
|
|
186
|
+
|
|
187
|
+
By default, code blocks without an explicit language annotation render as plaintext. Enable auto-detection via config:
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<MantineAIMarkdown
|
|
191
|
+
content={markdown}
|
|
192
|
+
config={{ codeBlock: { autoDetectUnknownLanguage: true } }}
|
|
193
|
+
/>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
This uses `highlight.js`'s `highlightAuto` to guess the language. Results may vary for short or ambiguous snippets.
|
|
197
|
+
|
|
198
|
+
## Mermaid Diagram Support
|
|
199
|
+
|
|
200
|
+
Fenced code blocks with the `mermaid` language identifier are automatically rendered as interactive SVG diagrams:
|
|
201
|
+
|
|
202
|
+
````markdown
|
|
203
|
+
```mermaid
|
|
204
|
+
graph TD
|
|
205
|
+
A[Start] --> B{Decision}
|
|
206
|
+
B -->|Yes| C[OK]
|
|
207
|
+
B -->|No| D[Cancel]
|
|
208
|
+
```
|
|
209
|
+
````
|
|
210
|
+
|
|
211
|
+
Features:
|
|
212
|
+
- Automatic dark/light theme switching based on Mantine's color scheme
|
|
213
|
+
- Toggle between rendered diagram and raw source code
|
|
214
|
+
- Copy button for the mermaid source
|
|
215
|
+
- Click the rendered diagram to open the SVG in a new window
|
|
216
|
+
- Chart type label displayed in the header
|
|
217
|
+
- Graceful fallback to source code display on parse errors
|
|
218
|
+
|
|
219
|
+
The `mermaid` library is a direct dependency of this package -- no additional installation is needed.
|
|
220
|
+
|
|
221
|
+
## Color Scheme Integration
|
|
222
|
+
|
|
223
|
+
`MantineAIMarkdown` automatically detects Mantine's computed color scheme using `useComputedColorScheme('light')`. You can override this by passing an explicit `colorScheme` prop:
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
// Automatic (default) -- follows Mantine's color scheme
|
|
227
|
+
<MantineAIMarkdown content={markdown} />
|
|
228
|
+
|
|
229
|
+
// Explicit override
|
|
230
|
+
<MantineAIMarkdown content={markdown} colorScheme="dark" />
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The color scheme is passed to:
|
|
234
|
+
- The core `<AIMarkdown>` component for typography theming
|
|
235
|
+
- Mermaid diagram rendering (dark/base theme selection)
|
|
236
|
+
- The extra styles wrapper for color-aware CSS
|
|
237
|
+
|
|
238
|
+
## Custom Components
|
|
239
|
+
|
|
240
|
+
Custom component overrides are merged with the Mantine defaults. Your overrides take precedence:
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
import MantineAIMarkdown from '@ai-react-markdown/mantine';
|
|
244
|
+
import type { AIMarkdownCustomComponents } from '@ai-react-markdown/core';
|
|
245
|
+
|
|
246
|
+
const customComponents: AIMarkdownCustomComponents = {
|
|
247
|
+
a: ({ href, children }) => (
|
|
248
|
+
<a href={href} target="_blank" rel="noopener noreferrer">
|
|
249
|
+
{children}
|
|
250
|
+
</a>
|
|
251
|
+
),
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
<MantineAIMarkdown content={markdown} customComponents={customComponents} />;
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
To override the default `<pre>` handler (and lose built-in code highlighting and mermaid support), include `pre` in your custom components.
|
|
258
|
+
|
|
259
|
+
## Exported API
|
|
260
|
+
|
|
261
|
+
### Default Export
|
|
262
|
+
|
|
263
|
+
- `MantineAIMarkdown` -- the main component (memoized)
|
|
264
|
+
|
|
265
|
+
### Components
|
|
266
|
+
|
|
267
|
+
- `MantineAIMarkdownTypography` -- Mantine-themed typography wrapper
|
|
268
|
+
- `MantineAIMDefaultExtraStyles` -- default extra styles wrapper with Mantine CSS scoping
|
|
269
|
+
|
|
270
|
+
### Types
|
|
271
|
+
|
|
272
|
+
- `MantineAIMarkdownProps`
|
|
273
|
+
- `MantineAIMarkdownRenderConfig`
|
|
274
|
+
- `MantineAIMarkdownMetadata`
|
|
275
|
+
|
|
276
|
+
### Constants
|
|
277
|
+
|
|
278
|
+
- `defaultMantineAIMarkdownRenderConfig` -- default Mantine render config (frozen)
|
|
279
|
+
|
|
280
|
+
### Hooks
|
|
281
|
+
|
|
282
|
+
- `useMantineAIMarkdownRenderState<TConfig>()` -- typed render state access
|
|
283
|
+
- `useMantineAIMarkdownMetadata<TMetadata>()` -- typed metadata access
|
|
284
|
+
|
|
285
|
+
## Core Package
|
|
286
|
+
|
|
287
|
+
For base features, configuration options, content preprocessors, TypeScript generics, and architecture details, see the [`@ai-react-markdown/core` README](../core/README.md).
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
MIT
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.tsx","../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/hooks/useMantineAIMarkdownRenderState.ts","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/defs.tsx","../src/components/customized/PreCode.tsx","../src/components/customized/MermaidCode/index.tsx","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["// Mantine-specific components\nexport type { MantineAIMarkdownProps } from './MantineAIMarkdown';\nexport { default } from './MantineAIMarkdown';\nexport { default as MantineAIMarkdownTypography } from './components/typography/MantineTypography';\nexport { default as MantineAIMDefaultExtraStyles } from './components/extra-styles/DefaultExtraStyles';\n\n// Mantine-specific types, config, and hooks\nexport type { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata } from './defs';\nexport { defaultMantineAIMarkdownRenderConfig } from './defs';\nexport { useMantineAIMarkdownRenderState } from './hooks/useMantineAIMarkdownRenderState';\nexport { useMantineAIMarkdownMetadata } from './hooks/useMantineAIMarkdownMetadata';\n","import { memo, useMemo } from 'react';\nimport AIMarkdown from '@ai-react-markdown/core';\nimport { type AIMarkdownProps, type AIMarkdownCustomComponents, useStableValue } from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata, defaultMantineAIMarkdownRenderConfig } from './defs';\nimport MantineAIMPreCode from './components/customized/PreCode';\nimport { useComputedColorScheme } from '@mantine/core';\n\nexport interface MantineAIMarkdownProps<\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TConfig, TRenderData> {}\n\nconst DefaultCustomComponents: AIMarkdownCustomComponents = {\n pre: memo(({ node, ...usefulProps }) => {\n const code = node?.children[0];\n const memoizedPreCode = useMemo(() => {\n if (!code || code.type !== 'element' || code.tagName !== 'code' || !code.position) {\n return null;\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' in child ? child.value : '')).join('\\n');\n return <MantineAIMPreCode key={key} codeText={codeText} existLanguage={detectedLanguage} />;\n }, [code, node?.position?.start?.offset]);\n return memoizedPreCode ?? <pre {...usefulProps} />;\n }),\n};\n\nconst MantineAIMarkdownComponent = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n defaultConfig = defaultMantineAIMarkdownRenderConfig as TConfig,\n customComponents,\n colorScheme,\n ...props\n}: MantineAIMarkdownProps<TConfig, TRenderData>) => {\n const stableCustomComponents = useStableValue(customComponents);\n\n const usedComponents = useMemo(() => {\n return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;\n }, [stableCustomComponents]);\n\n const computedColorScheme = useComputedColorScheme('light');\n\n return (\n <AIMarkdown<MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n defaultConfig={defaultConfig}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n );\n};\n\nexport const MantineAIMarkdown = memo(MantineAIMarkdownComponent);\n\nMantineAIMarkdown.displayName = 'MantineAIMarkdown';\n\nexport default MantineAIMarkdown;\n","import { memo } from 'react';\nimport { Typography } from '@mantine/core';\nimport type { AIMarkdownTypographyProps } from '@ai-react-markdown/core';\n\nconst MantineAIMarkdownTypography = memo(({ children, fontSize }: AIMarkdownTypographyProps) => (\n <Typography w=\"100%\" fz={fontSize}>\n {children}\n </Typography>\n));\n\nMantineAIMarkdownTypography.displayName = 'MantineAIMarkdownTypography';\n\nexport default MantineAIMarkdownTypography;\n","import { useAIMarkdownRenderState } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownRenderConfig } from '../defs';\n\nexport const useMantineAIMarkdownRenderState = () => {\n return useAIMarkdownRenderState<MantineAIMarkdownRenderConfig>();\n};\n","import { AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\nconst MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent = ({ children }) => {\n const renderState = useMantineAIMarkdownRenderState();\n return (\n <div className={`aim-mantine-extra-styles${renderState.config.forceSameFontSize ? ' same-font-size' : ''}`}>\n {children}\n </div>\n );\n};\n\nexport default MantineAIMDefaultExtraStyles;\n","import { AIMarkdownRenderConfig, AIMarkdownMetadata, defaultAIMarkdownRenderConfig } from '@ai-react-markdown/core';\n\nexport interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {\n forceSameFontSize: boolean;\n codeBlock: {\n defaultExpanded: boolean;\n autoDetectUnknownLanguage: boolean;\n };\n}\n\nexport const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig = Object.freeze({\n ...defaultAIMarkdownRenderConfig,\n forceSameFontSize: false,\n codeBlock: Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\n }),\n});\n\nexport interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {}\n","'use client';\n\nimport { HTMLAttributes, memo, useEffect, useMemo, useState } from 'react';\nimport { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { deepParseJson } from 'deep-parse-json';\nimport hljs from 'highlight.js';\nimport { useMantineAIMarkdownRenderState } from '../../hooks/useMantineAIMarkdownRenderState';\nimport MantineAIMMermaidCode from './MermaidCode';\n\nconst MantineAIMPreCode = memo(\n (\n props: HTMLAttributes<HTMLPreElement> & {\n codeText: string;\n existLanguage?: string;\n }\n ) => {\n const renderState = useMantineAIMarkdownRenderState();\n\n const [codeLanguage, setCodeLanguage] = useState(props.existLanguage || '');\n\n useEffect(() => {\n if (props.existLanguage) {\n setCodeLanguage(props.existLanguage);\n } else if (renderState.config.codeBlock.autoDetectUnknownLanguage) {\n const result = hljs.highlightAuto(props.codeText);\n setCodeLanguage(result.language || '');\n } else {\n setCodeLanguage('');\n }\n }, [props.existLanguage, props.codeText, renderState.config.codeBlock.autoDetectUnknownLanguage]);\n\n const [usedCodeLanguage, usedFileName] = useMemo(() => {\n if (!codeLanguage) return ['plaintext', 'unknown'];\n if (!hljs.getLanguage(codeLanguage)) {\n return ['plaintext', codeLanguage];\n }\n return [codeLanguage, codeLanguage];\n }, [codeLanguage]);\n\n const isMermaidCodeBlock = codeLanguage === 'mermaid';\n const isSpecialCodeBlock = isMermaidCodeBlock;\n\n const normalCodeBlockContent = useMemo(() => {\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 w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [props.codeText, usedCodeLanguage, usedFileName]);\n\n return (\n <>\n {isMermaidCodeBlock && <MantineAIMMermaidCode code={props.codeText} />}\n {!isSpecialCodeBlock && normalCodeBlockContent}\n </>\n );\n }\n);\n\nMantineAIMPreCode.displayName = 'MantineAIMPreCode';\n\nexport default MantineAIMPreCode;\n","'use client';\n\nimport React, { memo, useMemo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport debounce from 'lodash-es/debounce';\nimport mermaid from 'mermaid';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\nconst generateMermaidUUID = () => {\n return `mermaid-${new Date().getTime()}-${Math.random().toString(36).slice(2, 10)}`;\n};\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\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const renderState = useMantineAIMarkdownRenderState();\n const isDark = renderState.colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n const [renderError, setRenderError] = useState(false);\n const [chartType, setChartType] = useState('unkown');\n\n const debouncedUpdateRenderError = useMemo(\n () =>\n debounce((error: boolean) => {\n setRenderError(error);\n }, 200),\n []\n );\n\n useEffect(() => {\n if (props.code && ref.current) {\n const renderMermaid = async () => {\n try {\n debouncedUpdateRenderError(false);\n if (ref.current) {\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'loose',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n });\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n const { svg, bindFunctions, diagramType } = await mermaid.render(\n generateMermaidUUID(),\n props.code,\n ref.current\n );\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n setChartType(diagramType);\n }\n } catch {\n debouncedUpdateRenderError(true);\n }\n };\n\n renderMermaid();\n }\n }, [props.code, isDark, showOriginalCode]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, []);\n\n return (\n <>\n {(showOriginalCode || renderError) && (\n <CodeHighlightTabs\n mb={15}\n w=\"100%\"\n code={[\n {\n fileName: renderError ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n renderError\n ? []\n : [\n <CodeHighlightControl\n tooltipLabel=\"Render Mermaid\"\n key=\"gpt\"\n onClick={() => {\n setShowOriginalCode(false);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[gravity-ui--logo-mermaid] relative bottom-[1px] text-[16px]\"></span>\n </Flex>\n </CodeHighlightControl>,\n ]\n }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showOriginalCode || renderError\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{chartType}</div>\n <Flex align=\"center\" justify=\"flex-end\" gap={0}>\n <Tooltip label=\"Show Mermaid Code\">\n <ActionIcon\n size={28}\n className=\"action-icon\"\n variant=\"transparent\"\n onClick={() => {\n setShowOriginalCode(true);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[entypo--code] relative bottom-[0.25px] text-[16px]\"></span>\n </Flex>\n </ActionIcon>\n </Tooltip>\n <CopyButton value={props.code}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon variant=\"transparent\" size={28} className=\"action-icon\" onClick={copy}>\n {copied ? (\n <span className=\"icon-origin-[lucide--check] text-[18px]\"></span>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n width=\"18px\"\n height=\"18px\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\"></path>\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\"></path>\n </svg>\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Flex>\n </div>\n <pre\n ref={ref}\n style={{ cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' }}\n onClick={() => viewSvgInNewWindow()}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","import { useAIMarkdownMetadata } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownMetadata } from '../defs';\n\nexport const useMantineAIMarkdownMetadata = () => {\n return useAIMarkdownMetadata<MantineAIMarkdownM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,IAAI;AAC9F,aAAO,6CAAC,mBAA4B,UAAoB,eAAe,oBAAxC,GAA0D;AAAA,IAC3F,GAAG,CAAC,MAAM,MAAM,UAAU,OAAO,MAAM,CAAC;AACxC,WAAO,mBAAmB,6CAAC,SAAK,GAAG,aAAa;AAAA,EAClD,CAAC;AACH;AAEA,IAAM,6BAA6B,CAGjC;AAAA,EACA,YAAAC,cAAa;AAAA,EACb,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoD;AAClD,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;AAE1D,SACE;AAAA,IAAC,aAAAC;AAAA,IAAA;AAAA,MACC,YAAYD;AAAA,MACZ;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN;AAEJ;AAEO,IAAM,wBAAoB,oBAAK,0BAA0B;AAEhE,kBAAkB,cAAc;AAEhC,IAAO,4BAAQ;;;AOnEf,IAAAE,eAAsC;AAG/B,IAAM,+BAA+B,MAAM;AAChD,aAAO,oCAAiD;AAC1D;","names":["import_react","import_core","import_core","import_jsx_runtime","import_core","import_react","import_code_highlight","import_react","import_core","import_jsx_runtime","debounce","mermaid","import_jsx_runtime","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/hooks/useMantineAIMarkdownRenderState.ts","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/defs.tsx","../src/components/customized/PreCode.tsx","../src/components/customized/MermaidCode/index.tsx","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["/**\n * 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 { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata } from './defs';\n\n/** Default Mantine render configuration (frozen). */\nexport { defaultMantineAIMarkdownRenderConfig } from './defs';\n\n/** Typed hook for accessing render state with Mantine-specific config fields. */\nexport { useMantineAIMarkdownRenderState } from './hooks/useMantineAIMarkdownRenderState';\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 { type AIMarkdownProps, type AIMarkdownCustomComponents, useStableValue } from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata, defaultMantineAIMarkdownRenderConfig } from './defs';\nimport MantineAIMPreCode from './components/customized/PreCode';\nimport { useComputedColorScheme } from '@mantine/core';\n\n/**\n * Props for the {@link MantineAIMarkdown} component.\n *\n * Extends {@link AIMarkdownProps} with Mantine-specific config and metadata generics.\n * All core props (`content`, `streaming`, `fontSize`, `config`, etc.) are inherited.\n *\n * @typeParam TConfig - Render configuration type, defaults to {@link MantineAIMarkdownRenderConfig}.\n * @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TConfig, TRenderData> {}\n\n/**\n * Default custom component overrides applied by the Mantine integration.\n *\n * Overrides the `<pre>` element to extract code blocks and render them via\n * {@link MantineAIMPreCode}, which provides syntax highlighting, expand/collapse,\n * and mermaid diagram support. Falls back to a plain `<pre>` when the child\n * is not a recognized code element.\n */\nconst DefaultCustomComponents: AIMarkdownCustomComponents = {\n pre: memo(({ node, ...usefulProps }) => {\n const code = node?.children[0];\n const memoizedPreCode = useMemo(() => {\n if (!code || code.type !== 'element' || code.tagName !== 'code' || !code.position) {\n return null;\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' in child ? child.value : '')).join('\\n');\n return <MantineAIMPreCode key={key} codeText={codeText} existLanguage={detectedLanguage} />;\n }, [code, node?.position?.start?.offset]);\n return memoizedPreCode ?? <pre {...usefulProps} />;\n }),\n};\n\n/**\n * Inner (non-memoized) implementation of the Mantine AI markdown component.\n *\n * Merges caller-provided `customComponents` with the Mantine defaults (the caller's\n * overrides take precedence). Automatically resolves the color scheme from Mantine's\n * `useComputedColorScheme` when no explicit `colorScheme` prop is provided.\n *\n * @typeParam TConfig - Render configuration type.\n * @typeParam TRenderData - Metadata type.\n */\nconst MantineAIMarkdownComponent = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n defaultConfig = defaultMantineAIMarkdownRenderConfig as TConfig,\n customComponents,\n colorScheme,\n ...props\n}: MantineAIMarkdownProps<TConfig, TRenderData>) => {\n const stableCustomComponents = useStableValue(customComponents);\n\n const usedComponents = useMemo(() => {\n return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;\n }, [stableCustomComponents]);\n\n const computedColorScheme = useComputedColorScheme('light');\n\n return (\n <AIMarkdown<MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n defaultConfig={defaultConfig}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n );\n};\n\n/**\n * Mantine-integrated AI markdown renderer.\n *\n * A memoized wrapper around the core `<AIMarkdown>` component that provides\n * Mantine-themed typography, code highlighting (via `@mantine/code-highlight`),\n * mermaid diagram rendering, and automatic color scheme detection.\n *\n * This is the default export of `@ai-react-markdown/mantine`.\n *\n * @example\n * ```tsx\n * import MantineAIMarkdown from '@ai-react-markdown/mantine';\n *\n * function Chat({ content }: { content: string }) {\n * return <MantineAIMarkdown content={content} />;\n * }\n * ```\n */\nexport const MantineAIMarkdown = memo(MantineAIMarkdownComponent);\n\nMantineAIMarkdown.displayName = 'MantineAIMarkdown';\n\nexport default MantineAIMarkdown;\n","import { memo } from 'react';\nimport { Typography } from '@mantine/core';\nimport type { AIMarkdownTypographyProps } from '@ai-react-markdown/core';\n\n/**\n * Mantine-themed typography wrapper for AI markdown content.\n *\n * Replaces the core default typography component with Mantine's `<Typography>`\n * element, applying the configured `fontSize` at full width. This ensures all\n * rendered markdown inherits Mantine's font family, line height, and theming.\n *\n * Used as the default `Typography` prop in {@link MantineAIMarkdown}.\n * Can be replaced by passing a custom `Typography` component.\n *\n * @param props - Standard {@link AIMarkdownTypographyProps} from the core package.\n */\nconst MantineAIMarkdownTypography = memo(({ children, fontSize }: AIMarkdownTypographyProps) => (\n <Typography w=\"100%\" fz={fontSize}>\n {children}\n </Typography>\n));\n\nMantineAIMarkdownTypography.displayName = 'MantineAIMarkdownTypography';\n\nexport default MantineAIMarkdownTypography;\n","import { useAIMarkdownRenderState } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownRenderConfig } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownRenderState} hook.\n *\n * Returns the current {@link AIMarkdownRenderState} defaulting to\n * {@link MantineAIMarkdownRenderConfig}. Accepts an optional generic parameter\n * for further extension, giving consumers direct access to Mantine-specific\n * config fields (`forceSameFontSize`, `codeBlock`, etc.) without manual annotation.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n * Throws if called outside the provider boundary.\n *\n * @typeParam TConfig - Config type (defaults to {@link MantineAIMarkdownRenderConfig}).\n * @returns The current render state typed with `TConfig`.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();\n * const isExpanded = config.codeBlock.defaultExpanded;\n * // ...\n * }\n * ```\n */\nexport const useMantineAIMarkdownRenderState = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n>() => {\n return useAIMarkdownRenderState<TConfig>();\n};\n","import { AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Default extra styles wrapper for the Mantine integration.\n *\n * Wraps markdown content in a `<div>` with the `aim-mantine-extra-styles` CSS class,\n * which provides Mantine-compatible typography overrides including:\n * - Relative `em`-based Mantine spacing and font-size CSS custom properties\n * - Heading, list, paragraph, blockquote, and code styling\n * - Definition list layout\n *\n * When {@link MantineAIMarkdownRenderConfig.forceSameFontSize} is enabled, the\n * `same-font-size` class is appended, overriding all heading levels to render\n * at the same size as body text.\n *\n * Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}.\n */\nconst MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent = ({ children }) => {\n const renderState = useMantineAIMarkdownRenderState();\n return (\n <div className={`aim-mantine-extra-styles${renderState.config.forceSameFontSize ? ' same-font-size' : ''}`}>\n {children}\n </div>\n );\n};\n\nexport default MantineAIMDefaultExtraStyles;\n","/**\n * Mantine-specific type definitions and default configuration.\n *\n * Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}\n * with Mantine-themed options such as uniform heading sizes and code block behavior.\n *\n * @module defs\n */\n\nimport { AIMarkdownRenderConfig, AIMarkdownMetadata, defaultAIMarkdownRenderConfig } from '@ai-react-markdown/core';\n\n/**\n * Extended render configuration for the Mantine integration.\n *\n * Inherits all core config fields (extra syntax, display optimizations) and adds\n * Mantine-specific options for typography sizing and code block behavior.\n */\nexport interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {\n /**\n * When `true`, all heading levels (h1-h6) are rendered at the same font size\n * as body text. Useful in compact UI contexts like chat bubbles.\n *\n * @default false\n */\n forceSameFontSize: boolean;\n\n /** Code block rendering options. */\n codeBlock: {\n /**\n * Whether code blocks start in their expanded state.\n * When `false`, long code blocks are collapsed with an expand button.\n *\n * @default true\n */\n defaultExpanded: boolean;\n\n /**\n * When `true`, uses `highlight.js` auto-detection to determine the language\n * of code blocks that lack an explicit language annotation.\n *\n * @default false\n */\n autoDetectUnknownLanguage: boolean;\n };\n}\n\n/**\n * Default Mantine render configuration.\n *\n * Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.\n * Frozen to prevent accidental mutation.\n */\nexport const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig = Object.freeze({\n ...defaultAIMarkdownRenderConfig,\n forceSameFontSize: false,\n codeBlock: Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\n }),\n});\n\n/**\n * Metadata type for the Mantine integration.\n *\n * Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point\n * so that consumers can augment metadata in Mantine-specific wrappers without\n * needing to reference the core type directly.\n */\nexport interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {}\n","'use client';\n\nimport { HTMLAttributes, memo, useEffect, useMemo, useState } from 'react';\nimport { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { deepParseJson } from 'deep-parse-json';\nimport hljs from 'highlight.js';\nimport { useMantineAIMarkdownRenderState } from '../../hooks/useMantineAIMarkdownRenderState';\nimport MantineAIMMermaidCode from './MermaidCode';\n\n/**\n * Mantine code block renderer for `<pre>` elements.\n *\n * Replaces the default `<pre>` rendering with Mantine's {@link CodeHighlight} or\n * {@link CodeHighlightTabs} components, providing syntax highlighting, expand/collapse\n * behavior, and file-name tabs.\n *\n * Behavior:\n * - If the code block has an explicit language annotation, uses that language.\n * - If no language is specified and `config.codeBlock.autoDetectUnknownLanguage` is\n * enabled, uses `highlight.js` auto-detection.\n * - Mermaid code blocks (`language-mermaid`) are rendered as interactive diagrams\n * via {@link MantineAIMMermaidCode}.\n * - JSON code blocks are deep-parsed and pretty-printed before display.\n * - Unrecognized languages render as plaintext with an \"unknown\" label using\n * {@link CodeHighlight} (no tabs).\n * - Recognized languages render with {@link CodeHighlightTabs} showing the\n * language name as the tab label.\n *\n * @param props.codeText - The raw text content of the code block.\n * @param props.existLanguage - Language identifier extracted from the `language-*` CSS class, if present.\n */\nconst MantineAIMPreCode = memo(\n (\n props: HTMLAttributes<HTMLPreElement> & {\n codeText: string;\n existLanguage?: string;\n }\n ) => {\n const renderState = useMantineAIMarkdownRenderState();\n\n const [codeLanguage, setCodeLanguage] = useState(props.existLanguage || '');\n\n useEffect(() => {\n if (props.existLanguage) {\n setCodeLanguage(props.existLanguage);\n } else if (renderState.config.codeBlock.autoDetectUnknownLanguage) {\n const result = hljs.highlightAuto(props.codeText);\n setCodeLanguage(result.language || '');\n } else {\n setCodeLanguage('');\n }\n }, [props.existLanguage, props.codeText, renderState.config.codeBlock.autoDetectUnknownLanguage]);\n\n const [usedCodeLanguage, usedFileName] = useMemo(() => {\n if (!codeLanguage) return ['plaintext', 'unknown'];\n if (!hljs.getLanguage(codeLanguage)) {\n return ['plaintext', codeLanguage];\n }\n return [codeLanguage, codeLanguage];\n }, [codeLanguage]);\n\n const isMermaidCodeBlock = codeLanguage === 'mermaid';\n const isSpecialCodeBlock = isMermaidCodeBlock;\n\n const normalCodeBlockContent = useMemo(() => {\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 w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [props.codeText, usedCodeLanguage, usedFileName]);\n\n return (\n <>\n {isMermaidCodeBlock && <MantineAIMMermaidCode code={props.codeText} />}\n {!isSpecialCodeBlock && normalCodeBlockContent}\n </>\n );\n }\n);\n\nMantineAIMPreCode.displayName = 'MantineAIMPreCode';\n\nexport default MantineAIMPreCode;\n","'use client';\n\nimport React, { memo, useMemo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport debounce from 'lodash-es/debounce';\nimport mermaid from 'mermaid';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Generate a unique ID for mermaid SVG rendering.\n * Combines a timestamp with a random suffix to avoid collisions when\n * multiple mermaid diagrams render concurrently.\n *\n * @returns A unique string in the format `mermaid-{timestamp}-{random}`.\n */\nconst generateMermaidUUID = () => {\n return `mermaid-${new Date().getTime()}-${Math.random().toString(36).slice(2, 10)}`;\n};\n\n/**\n * Open the rendered mermaid SVG in a new browser window.\n *\n * Clones the SVG element, applies a background color matching the current\n * color scheme, serializes it to an object URL, and opens it in a new tab.\n * The object URL is revoked after a short delay to free memory.\n *\n * @param svgElement - The rendered SVG element to view, or `null`/`undefined` to no-op.\n * @param isDark - Whether the current color scheme is dark (used for background color).\n */\nconst handleViewSVGInNewWindow = (svgElement: SVGElement | null | undefined, isDark: boolean) => {\n if (!svgElement) return;\n const targetSvg = svgElement.cloneNode(true) as SVGElement;\n targetSvg.style.backgroundColor = isDark ? '#242424' : 'white';\n const text = new XMLSerializer().serializeToString(targetSvg);\n const blob = new Blob([text], { type: 'image/svg+xml' });\n const url = URL.createObjectURL(blob);\n const win = window.open(url);\n if (win) {\n setTimeout(() => URL.revokeObjectURL(url), 5000);\n }\n};\n\n/**\n * Interactive mermaid diagram renderer.\n *\n * Parses and renders mermaid diagram source code into an inline SVG visualization.\n * Automatically adapts to the current Mantine color scheme (light/dark) by\n * re-initializing mermaid with the appropriate theme.\n *\n * Features:\n * - Live SVG rendering with automatic dark/light theme switching\n * - Fallback to raw source code display on parse/render errors\n * - Toggle between rendered diagram and raw mermaid source\n * - Click on the rendered diagram to open the SVG in a new browser window\n * - Copy button for the raw mermaid source code\n * - Chart type label extracted from mermaid's parse result\n * - Debounced error state to avoid flickering during rapid re-renders\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const renderState = useMantineAIMarkdownRenderState();\n const isDark = renderState.colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n const [renderError, setRenderError] = useState(false);\n const [chartType, setChartType] = useState('unkown');\n\n const debouncedUpdateRenderError = useMemo(\n () =>\n debounce((error: boolean) => {\n setRenderError(error);\n }, 200),\n []\n );\n\n useEffect(() => {\n if (props.code && ref.current) {\n const renderMermaid = async () => {\n try {\n debouncedUpdateRenderError(false);\n if (ref.current) {\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'loose',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n });\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n const { svg, bindFunctions, diagramType } = await mermaid.render(\n generateMermaidUUID(),\n props.code,\n ref.current\n );\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n setChartType(diagramType);\n }\n } catch {\n debouncedUpdateRenderError(true);\n }\n };\n\n renderMermaid();\n }\n }, [props.code, isDark, showOriginalCode]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, []);\n\n return (\n <>\n {(showOriginalCode || renderError) && (\n <CodeHighlightTabs\n mb={15}\n w=\"100%\"\n code={[\n {\n fileName: renderError ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n renderError\n ? []\n : [\n <CodeHighlightControl\n tooltipLabel=\"Render Mermaid\"\n key=\"gpt\"\n onClick={() => {\n setShowOriginalCode(false);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[gravity-ui--logo-mermaid] relative bottom-[1px] text-[16px]\"></span>\n </Flex>\n </CodeHighlightControl>,\n ]\n }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showOriginalCode || renderError\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{chartType}</div>\n <Flex align=\"center\" justify=\"flex-end\" gap={0}>\n <Tooltip label=\"Show Mermaid Code\">\n <ActionIcon\n size={28}\n className=\"action-icon\"\n variant=\"transparent\"\n onClick={() => {\n setShowOriginalCode(true);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[entypo--code] relative bottom-[0.25px] text-[16px]\"></span>\n </Flex>\n </ActionIcon>\n </Tooltip>\n <CopyButton value={props.code}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon variant=\"transparent\" size={28} className=\"action-icon\" onClick={copy}>\n {copied ? (\n <span className=\"icon-origin-[lucide--check] text-[18px]\"></span>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n width=\"18px\"\n height=\"18px\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\"></path>\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\"></path>\n </svg>\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Flex>\n </div>\n <pre\n ref={ref}\n style={{ cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' }}\n onClick={() => viewSvgInNewWindow()}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","import { useAIMarkdownMetadata } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownMetadata } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownMetadata} hook.\n *\n * Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}.\n * Accepts an optional generic parameter for further extension.\n *\n * Metadata lives in a separate React context from the render state, meaning\n * metadata updates do not trigger re-renders in components that only consume\n * render state.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n *\n * @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}).\n * @returns The current metadata, or `undefined` if none was provided.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const metadata = useMantineAIMarkdownMetadata();\n * // Access Mantine-specific metadata fields\n * }\n * ```\n */\nexport const useMantineAIMarkdownMetadata = <\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>() => {\n return useAIMarkdownMetadata<TMetadata>();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,IAAAA,gBAA8B;AAC9B,IAAAC,eAAuB;AACvB,IAAAA,eAAsF;;;ACftF,mBAAqB;AACrB,kBAA2B;AAgBzB;AADF,IAAM,kCAA8B,mBAAK,CAAC,EAAE,UAAU,SAAS,MAC7D,4CAAC,0BAAW,GAAE,QAAO,IAAI,UACtB,UACH,CACD;AAED,4BAA4B,cAAc;AAE1C,IAAO,4BAAQ;;;ACxBf,IAAAC,eAAyC;AA0BlC,IAAM,kCA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M;AACnC,WAAO,yBAAyB,EAAE,GAAG,yBAAyB,GAAG,uBAAuB,IAAI;AAAA,EAC9F,GAAG,CAAC,sBAAsB,CAAC;AAE3B,QAAM,0BAAsB,qCAAuB,OAAO;AAE1D,SACE;AAAA,IAAC,aAAAC;AAAA,IAAA;AAAA,MACC,YAAYD;AAAA,MACZ;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN;AAEJ;AAoBO,IAAM,wBAAoB,oBAAK,0BAA0B;AAEhE,kBAAkB,cAAc;AAEhC,IAAO,4BAAQ;;;AO7Hf,IAAAE,eAAsC;AA0B/B,IAAM,+BAA+B,MAErC;AACL,aAAO,oCAAiC;AAC1C;","names":["import_react","import_core","import_core","import_jsx_runtime","import_core","import_react","import_code_highlight","import_react","import_core","import_jsx_runtime","debounce","mermaid","import_jsx_runtime","hljs","import_core","import_jsx_runtime","Typography","AIMarkdown","import_core"]}
|
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/extra-styles/DefaultExtraStyles/styles.scss","../src/components/extra-styles/DefaultExtraStyles/%3Cinput css Ir_vd7%3E","../src/components/customized/MermaidCode/styles.scss","../src/components/customized/MermaidCode/%3Cinput css kcKckr%3E"],"sourcesContent":[".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 --mantine-spacing-xs: calc(0.625em * var(--mantine-scale));\n --mantine-spacing-sm: calc(0.75em * var(--mantine-scale));\n --mantine-spacing-md: calc(1em * var(--mantine-scale));\n --mantine-spacing-lg: calc(1.25em * var(--mantine-scale));\n --mantine-spacing-xl: calc(2em * var(--mantine-scale));\n --mantine-font-size-xs: calc(0.75em * var(--mantine-scale));\n --mantine-font-size-sm: calc(0.875em * var(--mantine-scale));\n --mantine-font-size-md: calc(1em * var(--mantine-scale));\n --mantine-font-size-lg: calc(1.125em * var(--mantine-scale));\n --mantine-font-size-xl: calc(1.25em * var(--mantine-scale));\n\n :first-child {\n margin-top: 0;\n }\n\n :last-child {\n margin-bottom: 0;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n --mantine-h1-font-size: 2.125em;\n --mantine-h2-font-size: 1.625em;\n --mantine-h3-font-size: 1.375em;\n --mantine-h4-font-size: 1.125em;\n --mantine-h5-font-size: 1em;\n --mantine-h6-font-size: 0.875em;\n margin-top: 0;\n }\n\n &.same-font-size h1,\n &.same-font-size h2,\n &.same-font-size h3,\n &.same-font-size h4,\n &.same-font-size h5,\n &.same-font-size h6 {\n --mantine-h1-font-size: 1em;\n --mantine-h2-font-size: 1em;\n --mantine-h3-font-size: 1em;\n --mantine-h4-font-size: 1em;\n --mantine-h5-font-size: 1em;\n --mantine-h6-font-size: 1em;\n }\n\n ul,\n ol {\n list-style-position: outside;\n\n margin-bottom: 0.55em;\n padding-inline-start: 1.5em;\n\n li {\n margin-bottom: 0.275em;\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 --mantine-scale: 0.875;\n margin-bottom: 0.5em;\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n\n blockquote {\n border-inline-start-width: 0.25rem;\n border-inline-start-color: var(--mantine-color-text);\n }\n\n pre {\n font-size: var(--mantine-font-size-md);\n }\n\n code {\n font-size: var(--mantine-font-size-md);\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: 0.5em;\n }\n dt {\n width: 30%;\n font-weight: bold;\n text-align: right;\n }\n dd {\n width: 60%;\n padding-left: 1em;\n margin-left: 0px;\n }\n dd + dd {\n width: 100%;\n padding-left: calc(30% + 1em);\n }\n dt + dt {\n padding-right: 60%;\n }\n dt + dt + dd {\n margin-top: -1.625em;\n padding-left: calc(30% + 1em);\n }\n}\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 --mantine-spacing-xs: calc(0.625em * var(--mantine-scale));\n --mantine-spacing-sm: calc(0.75em * var(--mantine-scale));\n --mantine-spacing-md: calc(1em * var(--mantine-scale));\n --mantine-spacing-lg: calc(1.25em * var(--mantine-scale));\n --mantine-spacing-xl: calc(2em * var(--mantine-scale));\n --mantine-font-size-xs: calc(0.75em * var(--mantine-scale));\n --mantine-font-size-sm: calc(0.875em * var(--mantine-scale));\n --mantine-font-size-md: calc(1em * var(--mantine-scale));\n --mantine-font-size-lg: calc(1.125em * var(--mantine-scale));\n --mantine-font-size-xl: calc(1.25em * var(--mantine-scale));\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 h1,\n.aim-mantine-extra-styles h2,\n.aim-mantine-extra-styles h3,\n.aim-mantine-extra-styles h4,\n.aim-mantine-extra-styles h5,\n.aim-mantine-extra-styles h6 {\n --mantine-h1-font-size: 2.125em;\n --mantine-h2-font-size: 1.625em;\n --mantine-h3-font-size: 1.375em;\n --mantine-h4-font-size: 1.125em;\n --mantine-h5-font-size: 1em;\n --mantine-h6-font-size: 0.875em;\n margin-top: 0;\n}\n.aim-mantine-extra-styles.same-font-size h1, .aim-mantine-extra-styles.same-font-size h2, .aim-mantine-extra-styles.same-font-size h3, .aim-mantine-extra-styles.same-font-size h4, .aim-mantine-extra-styles.same-font-size h5, .aim-mantine-extra-styles.same-font-size h6 {\n --mantine-h1-font-size: 1em;\n --mantine-h2-font-size: 1em;\n --mantine-h3-font-size: 1em;\n --mantine-h4-font-size: 1em;\n --mantine-h5-font-size: 1em;\n --mantine-h6-font-size: 1em;\n}\n.aim-mantine-extra-styles ul,\n.aim-mantine-extra-styles ol {\n list-style-position: outside;\n margin-bottom: 0.55em;\n padding-inline-start: 1.5em;\n}\n.aim-mantine-extra-styles ul li,\n.aim-mantine-extra-styles ol li {\n margin-bottom: 0.275em;\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 --mantine-scale: 0.875;\n margin-bottom: 0.5em;\n}\n.aim-mantine-extra-styles p:last-child {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles blockquote {\n border-inline-start-width: 0.25rem;\n border-inline-start-color: var(--mantine-color-text);\n}\n.aim-mantine-extra-styles pre {\n font-size: var(--mantine-font-size-md);\n}\n.aim-mantine-extra-styles code {\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: 0.5em;\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: 1em;\n margin-left: 0px;\n}\n.aim-mantine-extra-styles dd + dd {\n width: 100%;\n padding-left: calc(30% + 1em);\n}\n.aim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ZS13cmFwO1xuICAgIHdvcmQtd3JhcDogYnJlYWstd29yZDtcbiAgICBvdmVyZmxvdy13cmFwOiBicmVhay13b3JkO1xuICAgIHdvcmQtYnJlYWs6IGJyZWFrLXdvcmQ7XG4gIH1cblxuICBkbCB7XG4gICAgZGlzcGxheTogZmxleDtcbiAgICBmbGV4LXdyYXA6IHdyYXA7XG4gICAgd2lkdGg6IDEwMCU7XG4gICAgbWF4LXdpZHRoOiA2NzBweDtcbiAgfVxuICBkbCA+ICoge1xuICAgIHBhZGRpbmctdG9wOiAwLjVlbTtcbiAgfVxuICBkdCB7XG4gICAgd2lkdGg6IDMwJTtcbiAgICBmb250LXdlaWdodDogYm9sZDtcbiAgICB0ZXh0LWFsaWduOiByaWdodDtcbiAgfVxuICBkZCB7XG4gICAgd2lkdGg6IDYwJTtcbiAgICBwYWRkaW5nLWxlZnQ6IDFlbTtcbiAgICBtYXJnaW4tbGVmdDogMHB4O1xuICB9XG4gIGRkICsgZGQge1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIHBhZGRpbmctbGVmdDogY2FsYygzMCUgKyAxZW0pO1xuICB9XG4gIGR0ICsgZHQge1xuICAgIHBhZGRpbmctcmlnaHQ6IDYwJTtcbiAgfVxuICBkdCArIGR0ICsgZGQge1xuICAgIG1hcmdpbi10b3A6IC0xLjYyNWVtO1xuICAgIHBhZGRpbmctbGVmdDogY2FsYygzMCUgKyAxZW0pO1xuICB9XG59XG4iXX0= */",".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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7O0FBRUE7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7QUFHRjtFQUNFO0VBQ0E7O0FBRUE7RUFDRTtFQUNBOztBQUtOO0VBQ0U7RUFDQTtFQUNBO0VBQ0E7RUFDQTs7O0FBSUo7RUFDRTtFQUNBOztBQUdFO0VBQ0U7RUFDQTtFQUNBOztBQUdGO0VBQ0UiLCJzb3VyY2VzQ29udGVudCI6WyIuYWltLW1hbnRpbmUtbWVybWFpZC1jb2RlIHtcbiAgd2lkdGg6IDEwMCU7XG4gIG1hcmdpbi1ib3R0b206IDE1cHg7XG4gIGJhY2tncm91bmQ6IHZhcigtLW1hbnRpbmUtY29sb3ItZ3JheS0wKTtcbiAgYm9yZGVyOiAxcHggc29saWQgdmFyKC0tbWFudGluZS1jb2xvci1ncmF5LTIpO1xuICBwYWRkaW5nOiBjYWxjKDAuNzVyZW0gKiB2YXIoLS1tYW50aW5lLXNjYWxlKSkgY2FsYygwLjYyNXJlbSAqIHZhcigtLW1hbnRpbmUtc2NhbGUpKTtcbiAgZGlzcGxheTogZmxleDtc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;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/styles.scss","../src/components/extra-styles/DefaultExtraStyles/%3Cinput css Bj91En%3E","../src/components/customized/MermaidCode/styles.scss","../src/components/customized/MermaidCode/%3Cinput css O7Low9%3E"],"sourcesContent":[".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 --mantine-spacing-xs: calc(0.625em * var(--mantine-scale));\n --mantine-spacing-sm: calc(0.75em * var(--mantine-scale));\n --mantine-spacing-md: calc(1em * var(--mantine-scale));\n --mantine-spacing-lg: calc(1.25em * var(--mantine-scale));\n --mantine-spacing-xl: calc(2em * var(--mantine-scale));\n --mantine-font-size-xs: calc(0.75em * var(--mantine-scale));\n --mantine-font-size-sm: calc(0.875em * var(--mantine-scale));\n --mantine-font-size-md: calc(1em * var(--mantine-scale));\n --mantine-font-size-lg: calc(1.125em * var(--mantine-scale));\n --mantine-font-size-xl: calc(1.25em * var(--mantine-scale));\n\n :first-child {\n margin-top: 0;\n }\n\n :last-child {\n margin-bottom: 0;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n --mantine-h1-font-size: 2.125em;\n --mantine-h2-font-size: 1.625em;\n --mantine-h3-font-size: 1.375em;\n --mantine-h4-font-size: 1.125em;\n --mantine-h5-font-size: 1em;\n --mantine-h6-font-size: 0.875em;\n margin-top: 0;\n }\n\n &.same-font-size h1,\n &.same-font-size h2,\n &.same-font-size h3,\n &.same-font-size h4,\n &.same-font-size h5,\n &.same-font-size h6 {\n --mantine-h1-font-size: 1em;\n --mantine-h2-font-size: 1em;\n --mantine-h3-font-size: 1em;\n --mantine-h4-font-size: 1em;\n --mantine-h5-font-size: 1em;\n --mantine-h6-font-size: 1em;\n }\n\n ul,\n ol {\n list-style-position: outside;\n\n margin-bottom: 0.55em;\n padding-inline-start: 1.5em;\n\n li {\n margin-bottom: 0.275em;\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 --mantine-scale: 0.875;\n margin-bottom: 0.5em;\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n\n blockquote {\n border-inline-start-width: 0.25rem;\n border-inline-start-color: var(--mantine-color-text);\n }\n\n pre {\n font-size: var(--mantine-font-size-md);\n }\n\n code {\n font-size: var(--mantine-font-size-md);\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: 0.5em;\n }\n dt {\n width: 30%;\n font-weight: bold;\n text-align: right;\n }\n dd {\n width: 60%;\n padding-left: 1em;\n margin-left: 0px;\n }\n dd + dd {\n width: 100%;\n padding-left: calc(30% + 1em);\n }\n dt + dt {\n padding-right: 60%;\n }\n dt + dt + dd {\n margin-top: -1.625em;\n padding-left: calc(30% + 1em);\n }\n}\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 --mantine-spacing-xs: calc(0.625em * var(--mantine-scale));\n --mantine-spacing-sm: calc(0.75em * var(--mantine-scale));\n --mantine-spacing-md: calc(1em * var(--mantine-scale));\n --mantine-spacing-lg: calc(1.25em * var(--mantine-scale));\n --mantine-spacing-xl: calc(2em * var(--mantine-scale));\n --mantine-font-size-xs: calc(0.75em * var(--mantine-scale));\n --mantine-font-size-sm: calc(0.875em * var(--mantine-scale));\n --mantine-font-size-md: calc(1em * var(--mantine-scale));\n --mantine-font-size-lg: calc(1.125em * var(--mantine-scale));\n --mantine-font-size-xl: calc(1.25em * var(--mantine-scale));\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 h1,\n.aim-mantine-extra-styles h2,\n.aim-mantine-extra-styles h3,\n.aim-mantine-extra-styles h4,\n.aim-mantine-extra-styles h5,\n.aim-mantine-extra-styles h6 {\n --mantine-h1-font-size: 2.125em;\n --mantine-h2-font-size: 1.625em;\n --mantine-h3-font-size: 1.375em;\n --mantine-h4-font-size: 1.125em;\n --mantine-h5-font-size: 1em;\n --mantine-h6-font-size: 0.875em;\n margin-top: 0;\n}\n.aim-mantine-extra-styles.same-font-size h1, .aim-mantine-extra-styles.same-font-size h2, .aim-mantine-extra-styles.same-font-size h3, .aim-mantine-extra-styles.same-font-size h4, .aim-mantine-extra-styles.same-font-size h5, .aim-mantine-extra-styles.same-font-size h6 {\n --mantine-h1-font-size: 1em;\n --mantine-h2-font-size: 1em;\n --mantine-h3-font-size: 1em;\n --mantine-h4-font-size: 1em;\n --mantine-h5-font-size: 1em;\n --mantine-h6-font-size: 1em;\n}\n.aim-mantine-extra-styles ul,\n.aim-mantine-extra-styles ol {\n list-style-position: outside;\n margin-bottom: 0.55em;\n padding-inline-start: 1.5em;\n}\n.aim-mantine-extra-styles ul li,\n.aim-mantine-extra-styles ol li {\n margin-bottom: 0.275em;\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 --mantine-scale: 0.875;\n margin-bottom: 0.5em;\n}\n.aim-mantine-extra-styles p:last-child {\n margin-bottom: 0;\n}\n.aim-mantine-extra-styles blockquote {\n border-inline-start-width: 0.25rem;\n border-inline-start-color: var(--mantine-color-text);\n}\n.aim-mantine-extra-styles pre {\n font-size: var(--mantine-font-size-md);\n}\n.aim-mantine-extra-styles code {\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: 0.5em;\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: 1em;\n margin-left: 0px;\n}\n.aim-mantine-extra-styles dd + dd {\n width: 100%;\n padding-left: calc(30% + 1em);\n}\n.aim-mantine-extra-styles dt + dt {\n padding-right: 60%;\n}\n.aim-mantine-extra-styles dt + dt + dd {\n margin-top: -1.625em;\n padding-left: calc(30% + 1em);\n}\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0VBQ0U7RUFDQTtFQUNBO0VBQ0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NzBweDtcbiAgfVxuICBkbCA+ICoge1xuICAgIHBhZGRpbmctdG9wOiAwLjVlbTtcbiAgfVxuICBkdCB7XG4gICAgd2lkdGg6IDMwJTtcbiAgICBmb250LXdlaWdodDogYm9sZDtcbiAgICB0ZXh0LWFsaWduOiByaWdodDtcbiAgfVxuICBkZCB7XG4gICAgd2lkdGg6IDYwJTtcbiAgICBwYWRkaW5nLWxlZnQ6IDFlbTtcbiAgICBtYXJnaW4tbGVmdDogMHB4O1xuICB9XG4gIGRkICsgZGQge1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIHBhZGRpbmctbGVmdDogY2FsYygzMCUgKyAxZW0pO1xuICB9XG4gIGR0ICsgZHQge1xuICAgIHBhZGRpbmctcmlnaHQ6IDYwJTtcbiAgfVxuICBkdCArIGR0ICsgZGQge1xuICAgIG1hcmdpbi10b3A6IC0xLjYyNWVtO1xuICAgIHBhZGRpbmctbGVmdDogY2FsYygzMCUgKyAxZW0pO1xuICB9XG59XG4iXX0= */",".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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LN;ADQI,CA7DJ,wBA6DI,CAXJ,KAWI,CAjDF,aAiDE,CA/BA;AAgCE,SAAA,IAAA;ACNN;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -3,27 +3,174 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
import * as _ai_react_markdown_core from '@ai-react-markdown/core';
|
|
4
4
|
import { AIMarkdownMetadata, AIMarkdownRenderConfig, AIMarkdownProps, AIMarkdownTypographyProps, AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Mantine-specific type definitions and default configuration.
|
|
8
|
+
*
|
|
9
|
+
* Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}
|
|
10
|
+
* with Mantine-themed options such as uniform heading sizes and code block behavior.
|
|
11
|
+
*
|
|
12
|
+
* @module defs
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Extended render configuration for the Mantine integration.
|
|
17
|
+
*
|
|
18
|
+
* Inherits all core config fields (extra syntax, display optimizations) and adds
|
|
19
|
+
* Mantine-specific options for typography sizing and code block behavior.
|
|
20
|
+
*/
|
|
6
21
|
interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {
|
|
22
|
+
/**
|
|
23
|
+
* When `true`, all heading levels (h1-h6) are rendered at the same font size
|
|
24
|
+
* as body text. Useful in compact UI contexts like chat bubbles.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
7
28
|
forceSameFontSize: boolean;
|
|
29
|
+
/** Code block rendering options. */
|
|
8
30
|
codeBlock: {
|
|
31
|
+
/**
|
|
32
|
+
* Whether code blocks start in their expanded state.
|
|
33
|
+
* When `false`, long code blocks are collapsed with an expand button.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
9
37
|
defaultExpanded: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* When `true`, uses `highlight.js` auto-detection to determine the language
|
|
40
|
+
* of code blocks that lack an explicit language annotation.
|
|
41
|
+
*
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
10
44
|
autoDetectUnknownLanguage: boolean;
|
|
11
45
|
};
|
|
12
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Default Mantine render configuration.
|
|
49
|
+
*
|
|
50
|
+
* Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.
|
|
51
|
+
* Frozen to prevent accidental mutation.
|
|
52
|
+
*/
|
|
13
53
|
declare const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Metadata type for the Mantine integration.
|
|
56
|
+
*
|
|
57
|
+
* Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point
|
|
58
|
+
* so that consumers can augment metadata in Mantine-specific wrappers without
|
|
59
|
+
* needing to reference the core type directly.
|
|
60
|
+
*/
|
|
14
61
|
interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {
|
|
15
62
|
}
|
|
16
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Props for the {@link MantineAIMarkdown} component.
|
|
66
|
+
*
|
|
67
|
+
* Extends {@link AIMarkdownProps} with Mantine-specific config and metadata generics.
|
|
68
|
+
* All core props (`content`, `streaming`, `fontSize`, `config`, etc.) are inherited.
|
|
69
|
+
*
|
|
70
|
+
* @typeParam TConfig - Render configuration type, defaults to {@link MantineAIMarkdownRenderConfig}.
|
|
71
|
+
* @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.
|
|
72
|
+
*/
|
|
17
73
|
interface MantineAIMarkdownProps<TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig, TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata> extends AIMarkdownProps<TConfig, TRenderData> {
|
|
18
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Mantine-integrated AI markdown renderer.
|
|
77
|
+
*
|
|
78
|
+
* A memoized wrapper around the core `<AIMarkdown>` component that provides
|
|
79
|
+
* Mantine-themed typography, code highlighting (via `@mantine/code-highlight`),
|
|
80
|
+
* mermaid diagram rendering, and automatic color scheme detection.
|
|
81
|
+
*
|
|
82
|
+
* This is the default export of `@ai-react-markdown/mantine`.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* import MantineAIMarkdown from '@ai-react-markdown/mantine';
|
|
87
|
+
*
|
|
88
|
+
* function Chat({ content }: { content: string }) {
|
|
89
|
+
* return <MantineAIMarkdown content={content} />;
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
19
93
|
declare const MantineAIMarkdown: react.MemoExoticComponent<(<TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig, TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>({ Typography, ExtraStyles, defaultConfig, customComponents, colorScheme, ...props }: MantineAIMarkdownProps<TConfig, TRenderData>) => react_jsx_runtime.JSX.Element)>;
|
|
20
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Mantine-themed typography wrapper for AI markdown content.
|
|
97
|
+
*
|
|
98
|
+
* Replaces the core default typography component with Mantine's `<Typography>`
|
|
99
|
+
* element, applying the configured `fontSize` at full width. This ensures all
|
|
100
|
+
* rendered markdown inherits Mantine's font family, line height, and theming.
|
|
101
|
+
*
|
|
102
|
+
* Used as the default `Typography` prop in {@link MantineAIMarkdown}.
|
|
103
|
+
* Can be replaced by passing a custom `Typography` component.
|
|
104
|
+
*
|
|
105
|
+
* @param props - Standard {@link AIMarkdownTypographyProps} from the core package.
|
|
106
|
+
*/
|
|
21
107
|
declare const MantineAIMarkdownTypography: react.MemoExoticComponent<({ children, fontSize }: AIMarkdownTypographyProps) => react_jsx_runtime.JSX.Element>;
|
|
22
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Default extra styles wrapper for the Mantine integration.
|
|
111
|
+
*
|
|
112
|
+
* Wraps markdown content in a `<div>` with the `aim-mantine-extra-styles` CSS class,
|
|
113
|
+
* which provides Mantine-compatible typography overrides including:
|
|
114
|
+
* - Relative `em`-based Mantine spacing and font-size CSS custom properties
|
|
115
|
+
* - Heading, list, paragraph, blockquote, and code styling
|
|
116
|
+
* - Definition list layout
|
|
117
|
+
*
|
|
118
|
+
* When {@link MantineAIMarkdownRenderConfig.forceSameFontSize} is enabled, the
|
|
119
|
+
* `same-font-size` class is appended, overriding all heading levels to render
|
|
120
|
+
* at the same size as body text.
|
|
121
|
+
*
|
|
122
|
+
* Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}.
|
|
123
|
+
*/
|
|
23
124
|
declare const MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent;
|
|
24
125
|
|
|
25
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Typed wrapper around the core {@link useAIMarkdownRenderState} hook.
|
|
128
|
+
*
|
|
129
|
+
* Returns the current {@link AIMarkdownRenderState} defaulting to
|
|
130
|
+
* {@link MantineAIMarkdownRenderConfig}. Accepts an optional generic parameter
|
|
131
|
+
* for further extension, giving consumers direct access to Mantine-specific
|
|
132
|
+
* config fields (`forceSameFontSize`, `codeBlock`, etc.) without manual annotation.
|
|
133
|
+
*
|
|
134
|
+
* Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.
|
|
135
|
+
* Throws if called outside the provider boundary.
|
|
136
|
+
*
|
|
137
|
+
* @typeParam TConfig - Config type (defaults to {@link MantineAIMarkdownRenderConfig}).
|
|
138
|
+
* @returns The current render state typed with `TConfig`.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* function MyComponent() {
|
|
143
|
+
* const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();
|
|
144
|
+
* const isExpanded = config.codeBlock.defaultExpanded;
|
|
145
|
+
* // ...
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
declare const useMantineAIMarkdownRenderState: <TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig>() => _ai_react_markdown_core.AIMarkdownRenderState<TConfig>;
|
|
26
150
|
|
|
27
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Typed wrapper around the core {@link useAIMarkdownMetadata} hook.
|
|
153
|
+
*
|
|
154
|
+
* Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}.
|
|
155
|
+
* Accepts an optional generic parameter for further extension.
|
|
156
|
+
*
|
|
157
|
+
* Metadata lives in a separate React context from the render state, meaning
|
|
158
|
+
* metadata updates do not trigger re-renders in components that only consume
|
|
159
|
+
* render state.
|
|
160
|
+
*
|
|
161
|
+
* Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.
|
|
162
|
+
*
|
|
163
|
+
* @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}).
|
|
164
|
+
* @returns The current metadata, or `undefined` if none was provided.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* function MyComponent() {
|
|
169
|
+
* const metadata = useMantineAIMarkdownMetadata();
|
|
170
|
+
* // Access Mantine-specific metadata fields
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare const useMantineAIMarkdownMetadata: <TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>() => TMetadata | undefined;
|
|
28
175
|
|
|
29
176
|
export { MantineAIMDefaultExtraStyles, type MantineAIMarkdownMetadata, type MantineAIMarkdownProps, type MantineAIMarkdownRenderConfig, MantineAIMarkdownTypography, MantineAIMarkdown as default, defaultMantineAIMarkdownRenderConfig, useMantineAIMarkdownMetadata, useMantineAIMarkdownRenderState };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,27 +3,174 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
import * as _ai_react_markdown_core from '@ai-react-markdown/core';
|
|
4
4
|
import { AIMarkdownMetadata, AIMarkdownRenderConfig, AIMarkdownProps, AIMarkdownTypographyProps, AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Mantine-specific type definitions and default configuration.
|
|
8
|
+
*
|
|
9
|
+
* Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}
|
|
10
|
+
* with Mantine-themed options such as uniform heading sizes and code block behavior.
|
|
11
|
+
*
|
|
12
|
+
* @module defs
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Extended render configuration for the Mantine integration.
|
|
17
|
+
*
|
|
18
|
+
* Inherits all core config fields (extra syntax, display optimizations) and adds
|
|
19
|
+
* Mantine-specific options for typography sizing and code block behavior.
|
|
20
|
+
*/
|
|
6
21
|
interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {
|
|
22
|
+
/**
|
|
23
|
+
* When `true`, all heading levels (h1-h6) are rendered at the same font size
|
|
24
|
+
* as body text. Useful in compact UI contexts like chat bubbles.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
7
28
|
forceSameFontSize: boolean;
|
|
29
|
+
/** Code block rendering options. */
|
|
8
30
|
codeBlock: {
|
|
31
|
+
/**
|
|
32
|
+
* Whether code blocks start in their expanded state.
|
|
33
|
+
* When `false`, long code blocks are collapsed with an expand button.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
9
37
|
defaultExpanded: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* When `true`, uses `highlight.js` auto-detection to determine the language
|
|
40
|
+
* of code blocks that lack an explicit language annotation.
|
|
41
|
+
*
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
10
44
|
autoDetectUnknownLanguage: boolean;
|
|
11
45
|
};
|
|
12
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Default Mantine render configuration.
|
|
49
|
+
*
|
|
50
|
+
* Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.
|
|
51
|
+
* Frozen to prevent accidental mutation.
|
|
52
|
+
*/
|
|
13
53
|
declare const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Metadata type for the Mantine integration.
|
|
56
|
+
*
|
|
57
|
+
* Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point
|
|
58
|
+
* so that consumers can augment metadata in Mantine-specific wrappers without
|
|
59
|
+
* needing to reference the core type directly.
|
|
60
|
+
*/
|
|
14
61
|
interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {
|
|
15
62
|
}
|
|
16
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Props for the {@link MantineAIMarkdown} component.
|
|
66
|
+
*
|
|
67
|
+
* Extends {@link AIMarkdownProps} with Mantine-specific config and metadata generics.
|
|
68
|
+
* All core props (`content`, `streaming`, `fontSize`, `config`, etc.) are inherited.
|
|
69
|
+
*
|
|
70
|
+
* @typeParam TConfig - Render configuration type, defaults to {@link MantineAIMarkdownRenderConfig}.
|
|
71
|
+
* @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.
|
|
72
|
+
*/
|
|
17
73
|
interface MantineAIMarkdownProps<TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig, TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata> extends AIMarkdownProps<TConfig, TRenderData> {
|
|
18
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Mantine-integrated AI markdown renderer.
|
|
77
|
+
*
|
|
78
|
+
* A memoized wrapper around the core `<AIMarkdown>` component that provides
|
|
79
|
+
* Mantine-themed typography, code highlighting (via `@mantine/code-highlight`),
|
|
80
|
+
* mermaid diagram rendering, and automatic color scheme detection.
|
|
81
|
+
*
|
|
82
|
+
* This is the default export of `@ai-react-markdown/mantine`.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* import MantineAIMarkdown from '@ai-react-markdown/mantine';
|
|
87
|
+
*
|
|
88
|
+
* function Chat({ content }: { content: string }) {
|
|
89
|
+
* return <MantineAIMarkdown content={content} />;
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
19
93
|
declare const MantineAIMarkdown: react.MemoExoticComponent<(<TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig, TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>({ Typography, ExtraStyles, defaultConfig, customComponents, colorScheme, ...props }: MantineAIMarkdownProps<TConfig, TRenderData>) => react_jsx_runtime.JSX.Element)>;
|
|
20
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Mantine-themed typography wrapper for AI markdown content.
|
|
97
|
+
*
|
|
98
|
+
* Replaces the core default typography component with Mantine's `<Typography>`
|
|
99
|
+
* element, applying the configured `fontSize` at full width. This ensures all
|
|
100
|
+
* rendered markdown inherits Mantine's font family, line height, and theming.
|
|
101
|
+
*
|
|
102
|
+
* Used as the default `Typography` prop in {@link MantineAIMarkdown}.
|
|
103
|
+
* Can be replaced by passing a custom `Typography` component.
|
|
104
|
+
*
|
|
105
|
+
* @param props - Standard {@link AIMarkdownTypographyProps} from the core package.
|
|
106
|
+
*/
|
|
21
107
|
declare const MantineAIMarkdownTypography: react.MemoExoticComponent<({ children, fontSize }: AIMarkdownTypographyProps) => react_jsx_runtime.JSX.Element>;
|
|
22
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Default extra styles wrapper for the Mantine integration.
|
|
111
|
+
*
|
|
112
|
+
* Wraps markdown content in a `<div>` with the `aim-mantine-extra-styles` CSS class,
|
|
113
|
+
* which provides Mantine-compatible typography overrides including:
|
|
114
|
+
* - Relative `em`-based Mantine spacing and font-size CSS custom properties
|
|
115
|
+
* - Heading, list, paragraph, blockquote, and code styling
|
|
116
|
+
* - Definition list layout
|
|
117
|
+
*
|
|
118
|
+
* When {@link MantineAIMarkdownRenderConfig.forceSameFontSize} is enabled, the
|
|
119
|
+
* `same-font-size` class is appended, overriding all heading levels to render
|
|
120
|
+
* at the same size as body text.
|
|
121
|
+
*
|
|
122
|
+
* Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}.
|
|
123
|
+
*/
|
|
23
124
|
declare const MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent;
|
|
24
125
|
|
|
25
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Typed wrapper around the core {@link useAIMarkdownRenderState} hook.
|
|
128
|
+
*
|
|
129
|
+
* Returns the current {@link AIMarkdownRenderState} defaulting to
|
|
130
|
+
* {@link MantineAIMarkdownRenderConfig}. Accepts an optional generic parameter
|
|
131
|
+
* for further extension, giving consumers direct access to Mantine-specific
|
|
132
|
+
* config fields (`forceSameFontSize`, `codeBlock`, etc.) without manual annotation.
|
|
133
|
+
*
|
|
134
|
+
* Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.
|
|
135
|
+
* Throws if called outside the provider boundary.
|
|
136
|
+
*
|
|
137
|
+
* @typeParam TConfig - Config type (defaults to {@link MantineAIMarkdownRenderConfig}).
|
|
138
|
+
* @returns The current render state typed with `TConfig`.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* function MyComponent() {
|
|
143
|
+
* const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();
|
|
144
|
+
* const isExpanded = config.codeBlock.defaultExpanded;
|
|
145
|
+
* // ...
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
declare const useMantineAIMarkdownRenderState: <TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig>() => _ai_react_markdown_core.AIMarkdownRenderState<TConfig>;
|
|
26
150
|
|
|
27
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Typed wrapper around the core {@link useAIMarkdownMetadata} hook.
|
|
153
|
+
*
|
|
154
|
+
* Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}.
|
|
155
|
+
* Accepts an optional generic parameter for further extension.
|
|
156
|
+
*
|
|
157
|
+
* Metadata lives in a separate React context from the render state, meaning
|
|
158
|
+
* metadata updates do not trigger re-renders in components that only consume
|
|
159
|
+
* render state.
|
|
160
|
+
*
|
|
161
|
+
* Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.
|
|
162
|
+
*
|
|
163
|
+
* @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}).
|
|
164
|
+
* @returns The current metadata, or `undefined` if none was provided.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* function MyComponent() {
|
|
169
|
+
* const metadata = useMantineAIMarkdownMetadata();
|
|
170
|
+
* // Access Mantine-specific metadata fields
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare const useMantineAIMarkdownMetadata: <TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata>() => TMetadata | undefined;
|
|
28
175
|
|
|
29
176
|
export { MantineAIMDefaultExtraStyles, type MantineAIMarkdownMetadata, type MantineAIMarkdownProps, type MantineAIMarkdownRenderConfig, MantineAIMarkdownTypography, MantineAIMarkdown as default, defaultMantineAIMarkdownRenderConfig, useMantineAIMarkdownMetadata, useMantineAIMarkdownRenderState };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/hooks/useMantineAIMarkdownRenderState.ts","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/defs.tsx","../src/components/customized/PreCode.tsx","../src/components/customized/MermaidCode/index.tsx","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["import { memo, useMemo } from 'react';\nimport AIMarkdown from '@ai-react-markdown/core';\nimport { type AIMarkdownProps, type AIMarkdownCustomComponents, useStableValue } from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata, defaultMantineAIMarkdownRenderConfig } from './defs';\nimport MantineAIMPreCode from './components/customized/PreCode';\nimport { useComputedColorScheme } from '@mantine/core';\n\nexport interface MantineAIMarkdownProps<\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TConfig, TRenderData> {}\n\nconst DefaultCustomComponents: AIMarkdownCustomComponents = {\n pre: memo(({ node, ...usefulProps }) => {\n const code = node?.children[0];\n const memoizedPreCode = useMemo(() => {\n if (!code || code.type !== 'element' || code.tagName !== 'code' || !code.position) {\n return null;\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' in child ? child.value : '')).join('\\n');\n return <MantineAIMPreCode key={key} codeText={codeText} existLanguage={detectedLanguage} />;\n }, [code, node?.position?.start?.offset]);\n return memoizedPreCode ?? <pre {...usefulProps} />;\n }),\n};\n\nconst MantineAIMarkdownComponent = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n defaultConfig = defaultMantineAIMarkdownRenderConfig as TConfig,\n customComponents,\n colorScheme,\n ...props\n}: MantineAIMarkdownProps<TConfig, TRenderData>) => {\n const stableCustomComponents = useStableValue(customComponents);\n\n const usedComponents = useMemo(() => {\n return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;\n }, [stableCustomComponents]);\n\n const computedColorScheme = useComputedColorScheme('light');\n\n return (\n <AIMarkdown<MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n defaultConfig={defaultConfig}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n );\n};\n\nexport const MantineAIMarkdown = memo(MantineAIMarkdownComponent);\n\nMantineAIMarkdown.displayName = 'MantineAIMarkdown';\n\nexport default MantineAIMarkdown;\n","import { memo } from 'react';\nimport { Typography } from '@mantine/core';\nimport type { AIMarkdownTypographyProps } from '@ai-react-markdown/core';\n\nconst MantineAIMarkdownTypography = memo(({ children, fontSize }: AIMarkdownTypographyProps) => (\n <Typography w=\"100%\" fz={fontSize}>\n {children}\n </Typography>\n));\n\nMantineAIMarkdownTypography.displayName = 'MantineAIMarkdownTypography';\n\nexport default MantineAIMarkdownTypography;\n","import { useAIMarkdownRenderState } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownRenderConfig } from '../defs';\n\nexport const useMantineAIMarkdownRenderState = () => {\n return useAIMarkdownRenderState<MantineAIMarkdownRenderConfig>();\n};\n","import { AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\nconst MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent = ({ children }) => {\n const renderState = useMantineAIMarkdownRenderState();\n return (\n <div className={`aim-mantine-extra-styles${renderState.config.forceSameFontSize ? ' same-font-size' : ''}`}>\n {children}\n </div>\n );\n};\n\nexport default MantineAIMDefaultExtraStyles;\n","import { AIMarkdownRenderConfig, AIMarkdownMetadata, defaultAIMarkdownRenderConfig } from '@ai-react-markdown/core';\n\nexport interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {\n forceSameFontSize: boolean;\n codeBlock: {\n defaultExpanded: boolean;\n autoDetectUnknownLanguage: boolean;\n };\n}\n\nexport const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig = Object.freeze({\n ...defaultAIMarkdownRenderConfig,\n forceSameFontSize: false,\n codeBlock: Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\n }),\n});\n\nexport interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {}\n","'use client';\n\nimport { HTMLAttributes, memo, useEffect, useMemo, useState } from 'react';\nimport { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { deepParseJson } from 'deep-parse-json';\nimport hljs from 'highlight.js';\nimport { useMantineAIMarkdownRenderState } from '../../hooks/useMantineAIMarkdownRenderState';\nimport MantineAIMMermaidCode from './MermaidCode';\n\nconst MantineAIMPreCode = memo(\n (\n props: HTMLAttributes<HTMLPreElement> & {\n codeText: string;\n existLanguage?: string;\n }\n ) => {\n const renderState = useMantineAIMarkdownRenderState();\n\n const [codeLanguage, setCodeLanguage] = useState(props.existLanguage || '');\n\n useEffect(() => {\n if (props.existLanguage) {\n setCodeLanguage(props.existLanguage);\n } else if (renderState.config.codeBlock.autoDetectUnknownLanguage) {\n const result = hljs.highlightAuto(props.codeText);\n setCodeLanguage(result.language || '');\n } else {\n setCodeLanguage('');\n }\n }, [props.existLanguage, props.codeText, renderState.config.codeBlock.autoDetectUnknownLanguage]);\n\n const [usedCodeLanguage, usedFileName] = useMemo(() => {\n if (!codeLanguage) return ['plaintext', 'unknown'];\n if (!hljs.getLanguage(codeLanguage)) {\n return ['plaintext', codeLanguage];\n }\n return [codeLanguage, codeLanguage];\n }, [codeLanguage]);\n\n const isMermaidCodeBlock = codeLanguage === 'mermaid';\n const isSpecialCodeBlock = isMermaidCodeBlock;\n\n const normalCodeBlockContent = useMemo(() => {\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 w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [props.codeText, usedCodeLanguage, usedFileName]);\n\n return (\n <>\n {isMermaidCodeBlock && <MantineAIMMermaidCode code={props.codeText} />}\n {!isSpecialCodeBlock && normalCodeBlockContent}\n </>\n );\n }\n);\n\nMantineAIMPreCode.displayName = 'MantineAIMPreCode';\n\nexport default MantineAIMPreCode;\n","'use client';\n\nimport React, { memo, useMemo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport debounce from 'lodash-es/debounce';\nimport mermaid from 'mermaid';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\nconst generateMermaidUUID = () => {\n return `mermaid-${new Date().getTime()}-${Math.random().toString(36).slice(2, 10)}`;\n};\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\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const renderState = useMantineAIMarkdownRenderState();\n const isDark = renderState.colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n const [renderError, setRenderError] = useState(false);\n const [chartType, setChartType] = useState('unkown');\n\n const debouncedUpdateRenderError = useMemo(\n () =>\n debounce((error: boolean) => {\n setRenderError(error);\n }, 200),\n []\n );\n\n useEffect(() => {\n if (props.code && ref.current) {\n const renderMermaid = async () => {\n try {\n debouncedUpdateRenderError(false);\n if (ref.current) {\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'loose',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n });\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n const { svg, bindFunctions, diagramType } = await mermaid.render(\n generateMermaidUUID(),\n props.code,\n ref.current\n );\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n setChartType(diagramType);\n }\n } catch {\n debouncedUpdateRenderError(true);\n }\n };\n\n renderMermaid();\n }\n }, [props.code, isDark, showOriginalCode]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, []);\n\n return (\n <>\n {(showOriginalCode || renderError) && (\n <CodeHighlightTabs\n mb={15}\n w=\"100%\"\n code={[\n {\n fileName: renderError ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n renderError\n ? []\n : [\n <CodeHighlightControl\n tooltipLabel=\"Render Mermaid\"\n key=\"gpt\"\n onClick={() => {\n setShowOriginalCode(false);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[gravity-ui--logo-mermaid] relative bottom-[1px] text-[16px]\"></span>\n </Flex>\n </CodeHighlightControl>,\n ]\n }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showOriginalCode || renderError\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{chartType}</div>\n <Flex align=\"center\" justify=\"flex-end\" gap={0}>\n <Tooltip label=\"Show Mermaid Code\">\n <ActionIcon\n size={28}\n className=\"action-icon\"\n variant=\"transparent\"\n onClick={() => {\n setShowOriginalCode(true);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[entypo--code] relative bottom-[0.25px] text-[16px]\"></span>\n </Flex>\n </ActionIcon>\n </Tooltip>\n <CopyButton value={props.code}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon variant=\"transparent\" size={28} className=\"action-icon\" onClick={copy}>\n {copied ? (\n <span className=\"icon-origin-[lucide--check] text-[18px]\"></span>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n width=\"18px\"\n height=\"18px\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\"></path>\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\"></path>\n </svg>\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Flex>\n </div>\n <pre\n ref={ref}\n style={{ cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' }}\n onClick={() => viewSvgInNewWindow()}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","import { useAIMarkdownMetadata } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownMetadata } from '../defs';\n\nexport const useMantineAIMarkdownMetadata = () => {\n return useAIMarkdownMetadata<MantineAIMarkdownMetadata>();\n};\n"],"mappings":";AAAA,SAAS,QAAAA,OAAM,WAAAC,gBAAe;AAC9B,OAAO,gBAAgB;AACvB,SAAgE,sBAAsB;;;ACFtF,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAIzB;AADF,IAAM,8BAA8B,KAAK,CAAC,EAAE,UAAU,SAAS,MAC7D,oBAAC,cAAW,GAAE,QAAO,IAAI,UACtB,UACH,CACD;AAED,4BAA4B,cAAc;AAE1C,IAAO,4BAAQ;;;ACZf,SAAS,gCAAgC;AAGlC,IAAM,kCAAkC,MAAM;AACnD,SAAO,yBAAwD;AACjE;;;ACEI,gBAAAC,YAAA;AAHJ,IAAM,+BAA+D,CAAC,EAAE,SAAS,MAAM;AACrF,QAAM,cAAc,gCAAgC;AACpD,SACE,gBAAAA,KAAC,SAAI,WAAW,2BAA2B,YAAY,OAAO,oBAAoB,oBAAoB,EAAE,IACrG,UACH;AAEJ;AAEA,IAAO,6BAAQ;;;ACbf,SAAqD,qCAAqC;AAUnF,IAAM,uCAAsE,OAAO,OAAO;AAAA,EAC/F,GAAG;AAAA,EACH,mBAAmB;AAAA,EACnB,WAAW,OAAO,OAAO;AAAA,IACvB,iBAAiB;AAAA,IACjB,2BAA2B;AAAA,EAC7B,CAAC;AACH,CAAC;;;ACfD,SAAyB,QAAAC,OAAM,aAAAC,YAAW,WAAAC,UAAS,YAAAC,iBAAgB;AACnE,SAAS,eAAe,qBAAAC,0BAAyB;AACjD,SAAS,qBAAqB;AAC9B,OAAO,UAAU;;;ACHjB,SAAgB,QAAAC,OAAM,SAAS,WAAW,QAAQ,UAAU,mBAAmB;AAC/E,SAAS,sBAAsB,yBAAyB;AACxD,SAAS,YAAY,YAAY,MAAM,eAAe;AACtD,OAAO,cAAc;AACrB,O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G/B,IAAM,+BAA+B,MAAM;AAChD,SAAO,sBAAiD;AAC1D;","names":["memo","useMemo","jsx","memo","useEffect","useMemo","useState","CodeHighlightTabs","memo","jsx","memo","Fragment","jsx","jsxs","memo","useState","useEffect","useMemo","CodeHighlightTabs","jsx","memo","useMemo","Typography"]}
|
|
1
|
+
{"version":3,"sources":["../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/hooks/useMantineAIMarkdownRenderState.ts","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/defs.tsx","../src/components/customized/PreCode.tsx","../src/components/customized/MermaidCode/index.tsx","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["/**\n * Main Mantine integration component for AI markdown rendering.\n *\n * Wraps the core {@link AIMarkdown} component with Mantine-specific defaults:\n * - {@link MantineAIMarkdownTypography} as the typography wrapper\n * - {@link MantineAIMDefaultExtraStyles} as the extra styles wrapper\n * - {@link MantineAIMPreCode} as the default `<pre>` component (with syntax\n * highlighting via Mantine's CodeHighlight and mermaid diagram support)\n * - Automatic color scheme detection via Mantine's `useComputedColorScheme`\n *\n * @module MantineAIMarkdown\n */\n\nimport { memo, useMemo } from 'react';\nimport AIMarkdown from '@ai-react-markdown/core';\nimport { type AIMarkdownProps, type AIMarkdownCustomComponents, useStableValue } from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata, defaultMantineAIMarkdownRenderConfig } from './defs';\nimport MantineAIMPreCode from './components/customized/PreCode';\nimport { useComputedColorScheme } from '@mantine/core';\n\n/**\n * Props for the {@link MantineAIMarkdown} component.\n *\n * Extends {@link AIMarkdownProps} with Mantine-specific config and metadata generics.\n * All core props (`content`, `streaming`, `fontSize`, `config`, etc.) are inherited.\n *\n * @typeParam TConfig - Render configuration type, defaults to {@link MantineAIMarkdownRenderConfig}.\n * @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TConfig, TRenderData> {}\n\n/**\n * Default custom component overrides applied by the Mantine integration.\n *\n * Overrides the `<pre>` element to extract code blocks and render them via\n * {@link MantineAIMPreCode}, which provides syntax highlighting, expand/collapse,\n * and mermaid diagram support. Falls back to a plain `<pre>` when the child\n * is not a recognized code element.\n */\nconst DefaultCustomComponents: AIMarkdownCustomComponents = {\n pre: memo(({ node, ...usefulProps }) => {\n const code = node?.children[0];\n const memoizedPreCode = useMemo(() => {\n if (!code || code.type !== 'element' || code.tagName !== 'code' || !code.position) {\n return null;\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' in child ? child.value : '')).join('\\n');\n return <MantineAIMPreCode key={key} codeText={codeText} existLanguage={detectedLanguage} />;\n }, [code, node?.position?.start?.offset]);\n return memoizedPreCode ?? <pre {...usefulProps} />;\n }),\n};\n\n/**\n * Inner (non-memoized) implementation of the Mantine AI markdown component.\n *\n * Merges caller-provided `customComponents` with the Mantine defaults (the caller's\n * overrides take precedence). Automatically resolves the color scheme from Mantine's\n * `useComputedColorScheme` when no explicit `colorScheme` prop is provided.\n *\n * @typeParam TConfig - Render configuration type.\n * @typeParam TRenderData - Metadata type.\n */\nconst MantineAIMarkdownComponent = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n defaultConfig = defaultMantineAIMarkdownRenderConfig as TConfig,\n customComponents,\n colorScheme,\n ...props\n}: MantineAIMarkdownProps<TConfig, TRenderData>) => {\n const stableCustomComponents = useStableValue(customComponents);\n\n const usedComponents = useMemo(() => {\n return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;\n }, [stableCustomComponents]);\n\n const computedColorScheme = useComputedColorScheme('light');\n\n return (\n <AIMarkdown<MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n defaultConfig={defaultConfig}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n );\n};\n\n/**\n * Mantine-integrated AI markdown renderer.\n *\n * A memoized wrapper around the core `<AIMarkdown>` component that provides\n * Mantine-themed typography, code highlighting (via `@mantine/code-highlight`),\n * mermaid diagram rendering, and automatic color scheme detection.\n *\n * This is the default export of `@ai-react-markdown/mantine`.\n *\n * @example\n * ```tsx\n * import MantineAIMarkdown from '@ai-react-markdown/mantine';\n *\n * function Chat({ content }: { content: string }) {\n * return <MantineAIMarkdown content={content} />;\n * }\n * ```\n */\nexport const MantineAIMarkdown = memo(MantineAIMarkdownComponent);\n\nMantineAIMarkdown.displayName = 'MantineAIMarkdown';\n\nexport default MantineAIMarkdown;\n","import { memo } from 'react';\nimport { Typography } from '@mantine/core';\nimport type { AIMarkdownTypographyProps } from '@ai-react-markdown/core';\n\n/**\n * Mantine-themed typography wrapper for AI markdown content.\n *\n * Replaces the core default typography component with Mantine's `<Typography>`\n * element, applying the configured `fontSize` at full width. This ensures all\n * rendered markdown inherits Mantine's font family, line height, and theming.\n *\n * Used as the default `Typography` prop in {@link MantineAIMarkdown}.\n * Can be replaced by passing a custom `Typography` component.\n *\n * @param props - Standard {@link AIMarkdownTypographyProps} from the core package.\n */\nconst MantineAIMarkdownTypography = memo(({ children, fontSize }: AIMarkdownTypographyProps) => (\n <Typography w=\"100%\" fz={fontSize}>\n {children}\n </Typography>\n));\n\nMantineAIMarkdownTypography.displayName = 'MantineAIMarkdownTypography';\n\nexport default MantineAIMarkdownTypography;\n","import { useAIMarkdownRenderState } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownRenderConfig } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownRenderState} hook.\n *\n * Returns the current {@link AIMarkdownRenderState} defaulting to\n * {@link MantineAIMarkdownRenderConfig}. Accepts an optional generic parameter\n * for further extension, giving consumers direct access to Mantine-specific\n * config fields (`forceSameFontSize`, `codeBlock`, etc.) without manual annotation.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n * Throws if called outside the provider boundary.\n *\n * @typeParam TConfig - Config type (defaults to {@link MantineAIMarkdownRenderConfig}).\n * @returns The current render state typed with `TConfig`.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();\n * const isExpanded = config.codeBlock.defaultExpanded;\n * // ...\n * }\n * ```\n */\nexport const useMantineAIMarkdownRenderState = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n>() => {\n return useAIMarkdownRenderState<TConfig>();\n};\n","import { AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Default extra styles wrapper for the Mantine integration.\n *\n * Wraps markdown content in a `<div>` with the `aim-mantine-extra-styles` CSS class,\n * which provides Mantine-compatible typography overrides including:\n * - Relative `em`-based Mantine spacing and font-size CSS custom properties\n * - Heading, list, paragraph, blockquote, and code styling\n * - Definition list layout\n *\n * When {@link MantineAIMarkdownRenderConfig.forceSameFontSize} is enabled, the\n * `same-font-size` class is appended, overriding all heading levels to render\n * at the same size as body text.\n *\n * Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}.\n */\nconst MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent = ({ children }) => {\n const renderState = useMantineAIMarkdownRenderState();\n return (\n <div className={`aim-mantine-extra-styles${renderState.config.forceSameFontSize ? ' same-font-size' : ''}`}>\n {children}\n </div>\n );\n};\n\nexport default MantineAIMDefaultExtraStyles;\n","/**\n * Mantine-specific type definitions and default configuration.\n *\n * Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}\n * with Mantine-themed options such as uniform heading sizes and code block behavior.\n *\n * @module defs\n */\n\nimport { AIMarkdownRenderConfig, AIMarkdownMetadata, defaultAIMarkdownRenderConfig } from '@ai-react-markdown/core';\n\n/**\n * Extended render configuration for the Mantine integration.\n *\n * Inherits all core config fields (extra syntax, display optimizations) and adds\n * Mantine-specific options for typography sizing and code block behavior.\n */\nexport interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {\n /**\n * When `true`, all heading levels (h1-h6) are rendered at the same font size\n * as body text. Useful in compact UI contexts like chat bubbles.\n *\n * @default false\n */\n forceSameFontSize: boolean;\n\n /** Code block rendering options. */\n codeBlock: {\n /**\n * Whether code blocks start in their expanded state.\n * When `false`, long code blocks are collapsed with an expand button.\n *\n * @default true\n */\n defaultExpanded: boolean;\n\n /**\n * When `true`, uses `highlight.js` auto-detection to determine the language\n * of code blocks that lack an explicit language annotation.\n *\n * @default false\n */\n autoDetectUnknownLanguage: boolean;\n };\n}\n\n/**\n * Default Mantine render configuration.\n *\n * Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.\n * Frozen to prevent accidental mutation.\n */\nexport const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig = Object.freeze({\n ...defaultAIMarkdownRenderConfig,\n forceSameFontSize: false,\n codeBlock: Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\n }),\n});\n\n/**\n * Metadata type for the Mantine integration.\n *\n * Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point\n * so that consumers can augment metadata in Mantine-specific wrappers without\n * needing to reference the core type directly.\n */\nexport interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {}\n","'use client';\n\nimport { HTMLAttributes, memo, useEffect, useMemo, useState } from 'react';\nimport { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { deepParseJson } from 'deep-parse-json';\nimport hljs from 'highlight.js';\nimport { useMantineAIMarkdownRenderState } from '../../hooks/useMantineAIMarkdownRenderState';\nimport MantineAIMMermaidCode from './MermaidCode';\n\n/**\n * Mantine code block renderer for `<pre>` elements.\n *\n * Replaces the default `<pre>` rendering with Mantine's {@link CodeHighlight} or\n * {@link CodeHighlightTabs} components, providing syntax highlighting, expand/collapse\n * behavior, and file-name tabs.\n *\n * Behavior:\n * - If the code block has an explicit language annotation, uses that language.\n * - If no language is specified and `config.codeBlock.autoDetectUnknownLanguage` is\n * enabled, uses `highlight.js` auto-detection.\n * - Mermaid code blocks (`language-mermaid`) are rendered as interactive diagrams\n * via {@link MantineAIMMermaidCode}.\n * - JSON code blocks are deep-parsed and pretty-printed before display.\n * - Unrecognized languages render as plaintext with an \"unknown\" label using\n * {@link CodeHighlight} (no tabs).\n * - Recognized languages render with {@link CodeHighlightTabs} showing the\n * language name as the tab label.\n *\n * @param props.codeText - The raw text content of the code block.\n * @param props.existLanguage - Language identifier extracted from the `language-*` CSS class, if present.\n */\nconst MantineAIMPreCode = memo(\n (\n props: HTMLAttributes<HTMLPreElement> & {\n codeText: string;\n existLanguage?: string;\n }\n ) => {\n const renderState = useMantineAIMarkdownRenderState();\n\n const [codeLanguage, setCodeLanguage] = useState(props.existLanguage || '');\n\n useEffect(() => {\n if (props.existLanguage) {\n setCodeLanguage(props.existLanguage);\n } else if (renderState.config.codeBlock.autoDetectUnknownLanguage) {\n const result = hljs.highlightAuto(props.codeText);\n setCodeLanguage(result.language || '');\n } else {\n setCodeLanguage('');\n }\n }, [props.existLanguage, props.codeText, renderState.config.codeBlock.autoDetectUnknownLanguage]);\n\n const [usedCodeLanguage, usedFileName] = useMemo(() => {\n if (!codeLanguage) return ['plaintext', 'unknown'];\n if (!hljs.getLanguage(codeLanguage)) {\n return ['plaintext', codeLanguage];\n }\n return [codeLanguage, codeLanguage];\n }, [codeLanguage]);\n\n const isMermaidCodeBlock = codeLanguage === 'mermaid';\n const isSpecialCodeBlock = isMermaidCodeBlock;\n\n const normalCodeBlockContent = useMemo(() => {\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 w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [props.codeText, usedCodeLanguage, usedFileName]);\n\n return (\n <>\n {isMermaidCodeBlock && <MantineAIMMermaidCode code={props.codeText} />}\n {!isSpecialCodeBlock && normalCodeBlockContent}\n </>\n );\n }\n);\n\nMantineAIMPreCode.displayName = 'MantineAIMPreCode';\n\nexport default MantineAIMPreCode;\n","'use client';\n\nimport React, { memo, useMemo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport debounce from 'lodash-es/debounce';\nimport mermaid from 'mermaid';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Generate a unique ID for mermaid SVG rendering.\n * Combines a timestamp with a random suffix to avoid collisions when\n * multiple mermaid diagrams render concurrently.\n *\n * @returns A unique string in the format `mermaid-{timestamp}-{random}`.\n */\nconst generateMermaidUUID = () => {\n return `mermaid-${new Date().getTime()}-${Math.random().toString(36).slice(2, 10)}`;\n};\n\n/**\n * Open the rendered mermaid SVG in a new browser window.\n *\n * Clones the SVG element, applies a background color matching the current\n * color scheme, serializes it to an object URL, and opens it in a new tab.\n * The object URL is revoked after a short delay to free memory.\n *\n * @param svgElement - The rendered SVG element to view, or `null`/`undefined` to no-op.\n * @param isDark - Whether the current color scheme is dark (used for background color).\n */\nconst handleViewSVGInNewWindow = (svgElement: SVGElement | null | undefined, isDark: boolean) => {\n if (!svgElement) return;\n const targetSvg = svgElement.cloneNode(true) as SVGElement;\n targetSvg.style.backgroundColor = isDark ? '#242424' : 'white';\n const text = new XMLSerializer().serializeToString(targetSvg);\n const blob = new Blob([text], { type: 'image/svg+xml' });\n const url = URL.createObjectURL(blob);\n const win = window.open(url);\n if (win) {\n setTimeout(() => URL.revokeObjectURL(url), 5000);\n }\n};\n\n/**\n * Interactive mermaid diagram renderer.\n *\n * Parses and renders mermaid diagram source code into an inline SVG visualization.\n * Automatically adapts to the current Mantine color scheme (light/dark) by\n * re-initializing mermaid with the appropriate theme.\n *\n * Features:\n * - Live SVG rendering with automatic dark/light theme switching\n * - Fallback to raw source code display on parse/render errors\n * - Toggle between rendered diagram and raw mermaid source\n * - Click on the rendered diagram to open the SVG in a new browser window\n * - Copy button for the raw mermaid source code\n * - Chart type label extracted from mermaid's parse result\n * - Debounced error state to avoid flickering during rapid re-renders\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const renderState = useMantineAIMarkdownRenderState();\n const isDark = renderState.colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n const [renderError, setRenderError] = useState(false);\n const [chartType, setChartType] = useState('unkown');\n\n const debouncedUpdateRenderError = useMemo(\n () =>\n debounce((error: boolean) => {\n setRenderError(error);\n }, 200),\n []\n );\n\n useEffect(() => {\n if (props.code && ref.current) {\n const renderMermaid = async () => {\n try {\n debouncedUpdateRenderError(false);\n if (ref.current) {\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'loose',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n });\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n const { svg, bindFunctions, diagramType } = await mermaid.render(\n generateMermaidUUID(),\n props.code,\n ref.current\n );\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n setChartType(diagramType);\n }\n } catch {\n debouncedUpdateRenderError(true);\n }\n };\n\n renderMermaid();\n }\n }, [props.code, isDark, showOriginalCode]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, []);\n\n return (\n <>\n {(showOriginalCode || renderError) && (\n <CodeHighlightTabs\n mb={15}\n w=\"100%\"\n code={[\n {\n fileName: renderError ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n renderError\n ? []\n : [\n <CodeHighlightControl\n tooltipLabel=\"Render Mermaid\"\n key=\"gpt\"\n onClick={() => {\n setShowOriginalCode(false);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[gravity-ui--logo-mermaid] relative bottom-[1px] text-[16px]\"></span>\n </Flex>\n </CodeHighlightControl>,\n ]\n }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showOriginalCode || renderError\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{chartType}</div>\n <Flex align=\"center\" justify=\"flex-end\" gap={0}>\n <Tooltip label=\"Show Mermaid Code\">\n <ActionIcon\n size={28}\n className=\"action-icon\"\n variant=\"transparent\"\n onClick={() => {\n setShowOriginalCode(true);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[entypo--code] relative bottom-[0.25px] text-[16px]\"></span>\n </Flex>\n </ActionIcon>\n </Tooltip>\n <CopyButton value={props.code}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon variant=\"transparent\" size={28} className=\"action-icon\" onClick={copy}>\n {copied ? (\n <span className=\"icon-origin-[lucide--check] text-[18px]\"></span>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n width=\"18px\"\n height=\"18px\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\"></path>\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\"></path>\n </svg>\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Flex>\n </div>\n <pre\n ref={ref}\n style={{ cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' }}\n onClick={() => viewSvgInNewWindow()}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","import { useAIMarkdownMetadata } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownMetadata } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownMetadata} hook.\n *\n * Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}.\n * Accepts an optional generic parameter for further extension.\n *\n * Metadata lives in a separate React context from the render state, meaning\n * metadata updates do not trigger re-renders in components that only consume\n * render state.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n *\n * @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}).\n * @returns The current metadata, or `undefined` if none was provided.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const metadata = useMantineAIMarkdownMetadata();\n * // Access Mantine-specific metadata fields\n * }\n * ```\n */\nexport const useMantineAIMarkdownMetadata = <\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>() => {\n return useAIMarkdownMetadata<TMetadata>();\n};\n"],"mappings":";AAaA,SAAS,QAAAA,OAAM,WAAAC,gBAAe;AAC9B,OAAO,gBAAgB;AACvB,SAAgE,sBAAsB;;;ACftF,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAgBzB;AADF,IAAM,8BAA8B,KAAK,CAAC,EAAE,UAAU,SAAS,MAC7D,oBAAC,cAAW,GAAE,QAAO,IAAI,UACtB,UACH,CACD;AAED,4BAA4B,cAAc;AAE1C,IAAO,4BAAQ;;;ACxBf,SAAS,gCAAgC;AA0BlC,IAAM,kCAAkC,MAExC;AACL,SAAO,yBAAkC;AAC3C;;;ACRI,gBAAAC,YAAA;AAHJ,IAAM,+BAA+D,CAAC,EAAE,SAAS,MAAM;AACrF,QAAM,cAAc,gCAAgC;AACpD,SACE,gBAAAA,KAAC,SAAI,WAAW,2BAA2B,YAAY,OAAO,oBAAoB,oBAAoB,EAAE,IACrG,UACH;AAEJ;AAEA,IAAO,6BAAQ;;;ACnBf,SAAqD,qCAAqC;AA2CnF,IAAM,uCAAsE,OAAO,OAAO;AAAA,EAC/F,GAAG;AAAA,EACH,mBAAmB;AAAA,EACnB,WAAW,OAAO,OAAO;AAAA,IACvB,iBAAiB;AAAA,IACjB,2BAA2B;AAAA,EAC7B,CAAC;AACH,CAAC;;;ACzDD,SAAyB,QAAAC,OAAM,aA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AE1D,SACE,gBAAAF;AAAA,IAAC;AAAA;AAAA,MACC,YAAYG;AAAA,MACZ;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN;AAEJ;AAoBO,IAAM,oBAAoBF,MAAK,0BAA0B;AAEhE,kBAAkB,cAAc;AAEhC,IAAO,4BAAQ;;;AO7Hf,SAAS,6BAA6B;AA0B/B,IAAM,+BAA+B,MAErC;AACL,SAAO,sBAAiC;AAC1C;","names":["memo","useMemo","jsx","memo","useEffect","useMemo","useState","CodeHighlightTabs","memo","jsx","memo","Fragment","jsx","jsxs","memo","useState","useEffect","useMemo","CodeHighlightTabs","jsx","memo","useMemo","Typography"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-react-markdown/mantine",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@ai-react-markdown/core": "^1.0.
|
|
28
|
+
"@ai-react-markdown/core": "^1.0.6",
|
|
29
29
|
"@mantine/code-highlight": "^8.3.17",
|
|
30
30
|
"@mantine/core": "^8.3.17",
|
|
31
31
|
"highlight.js": "^11.11.1",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"highlight.js": "^11.11.1",
|
|
43
43
|
"postcss": "^8.5.8",
|
|
44
44
|
"tsup": "^8.4.0",
|
|
45
|
-
"@ai-react-markdown/core": "1.0.
|
|
45
|
+
"@ai-react-markdown/core": "1.0.6"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"deep-parse-json": "^2.0.0",
|