@epam/ai-dial-chat-shared 1.3.0-dev.13 → 1.3.0-dev.130
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/components/ConfirmationDialog/ConfirmationDialog.d.ts +41 -0
- package/components/ConfirmationDialog/ConfirmationDialog.d.ts.map +1 -0
- package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.d.ts +33 -0
- package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.d.ts.map +1 -0
- package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.module.scss.js +5 -4
- package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.d.ts +33 -0
- package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.d.ts.map +1 -0
- package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.js +2 -2
- package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.module.scss.js +3 -2
- package/components/ConfirmationView/ConfirmationFooter.d.ts +41 -0
- package/components/ConfirmationView/ConfirmationFooter.d.ts.map +1 -0
- package/components/ConfirmationView/ConfirmationFooter.js +1 -1
- package/components/ConfirmationView/ConfirmationView.d.ts +57 -0
- package/components/ConfirmationView/ConfirmationView.d.ts.map +1 -0
- package/components/ConfirmationView/ConfirmationView.js +16 -15
- package/components/ConfirmationView/ConfirmationView.module.scss.js +6 -5
- package/components/CopyButton/CopyButton.d.ts +19 -0
- package/components/CopyButton/CopyButton.d.ts.map +1 -0
- package/components/DeleteConfirmationDialog/DeleteConfirmationDialog.d.ts +41 -0
- package/components/DeleteConfirmationDialog/DeleteConfirmationDialog.d.ts.map +1 -0
- package/components/DeleteConfirmationDialog/DeleteConfirmationDialog.js +34 -0
- package/components/DeleteConfirmationView/DeleteConfirmationView.d.ts +49 -0
- package/components/DeleteConfirmationView/DeleteConfirmationView.d.ts.map +1 -0
- package/components/DeleteConfirmationView/DeleteConfirmationView.js +37 -0
- package/components/DeleteConfirmationView/DeleteConfirmationView.module.scss.js +7 -0
- package/components/DeploymentIcon/DeploymentIcon.d.ts +36 -0
- package/components/DeploymentIcon/DeploymentIcon.d.ts.map +1 -0
- package/components/DeploymentIcon/DeploymentIcon.module.scss.js +3 -2
- package/components/EntityHeader/EntityHeader.d.ts +38 -0
- package/components/EntityHeader/EntityHeader.d.ts.map +1 -0
- package/components/EntityHeader/EntityHeader.js +1 -1
- package/components/EntityTypeLabel/EntityTypeLabel.d.ts +18 -0
- package/components/EntityTypeLabel/EntityTypeLabel.d.ts.map +1 -0
- package/components/FeaturedChip/FeaturedChip.d.ts +16 -0
- package/components/FeaturedChip/FeaturedChip.d.ts.map +1 -0
- package/components/InitialsAvatar/InitialsAvatar.d.ts +15 -0
- package/components/InitialsAvatar/InitialsAvatar.d.ts.map +1 -0
- package/components/ItemHeader/ItemHeader.d.ts +40 -0
- package/components/ItemHeader/ItemHeader.d.ts.map +1 -0
- package/components/ItemHeader/ItemHeader.js +4 -1
- package/components/ItemHeader/ItemHeader.module.scss.js +5 -4
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.d.ts +55 -0
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.d.ts.map +1 -0
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +27 -27
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.module.scss.js +9 -8
- package/components/MarkdownRenderer/CodeBlock/syntax-theme.d.ts +7 -0
- package/components/MarkdownRenderer/CodeBlock/syntax-theme.d.ts.map +1 -0
- package/components/MarkdownRenderer/MDMessageViewer.d.ts +66 -0
- package/components/MarkdownRenderer/MDMessageViewer.d.ts.map +1 -0
- package/components/MarkdownRenderer/MDMessageViewer.js +14 -12
- package/components/MarkdownRenderer/MarkdownRenderer.d.ts +139 -0
- package/components/MarkdownRenderer/MarkdownRenderer.d.ts.map +1 -0
- package/components/MarkdownRenderer/MarkdownRenderer.js +140 -133
- package/components/MarkdownRenderer/MarkdownRenderer.module.scss.js +9 -8
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.d.ts +18 -0
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.d.ts.map +1 -0
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.js +1 -1
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.module.scss.js +5 -4
- package/components/MarkdownRenderer/PlainTextRenderer.d.ts +39 -0
- package/components/MarkdownRenderer/PlainTextRenderer.d.ts.map +1 -0
- package/components/MarkdownRenderer/PlainTextRenderer.js +1 -1
- package/components/MarkdownRenderer/Table/MarkdownTable.d.ts +47 -0
- package/components/MarkdownRenderer/Table/MarkdownTable.d.ts.map +1 -0
- package/components/MarkdownRenderer/Table/MarkdownTable.js +35 -31
- package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +14 -13
- package/components/MarkdownRenderer/Table/TableHeader.d.ts +22 -0
- package/components/MarkdownRenderer/Table/TableHeader.d.ts.map +1 -0
- package/components/MarkdownRenderer/Table/TableHeader.module.scss.js +3 -2
- package/components/MarkdownRenderer/Table/table-serialization.d.ts +16 -0
- package/components/MarkdownRenderer/Table/table-serialization.d.ts.map +1 -0
- package/components/MarkdownRenderer/Table/useMarkdownTableActions/useMarkdownTableActions.d.ts +27 -0
- package/components/MarkdownRenderer/Table/useMarkdownTableActions/useMarkdownTableActions.d.ts.map +1 -0
- package/components/MarkdownRenderer/TaskCheckbox/MarkdownTaskCheckbox.d.ts +9 -0
- package/components/MarkdownRenderer/TaskCheckbox/MarkdownTaskCheckbox.d.ts.map +1 -0
- package/components/MarkdownRenderer/ThinkingShimmer.d.ts +17 -0
- package/components/MarkdownRenderer/ThinkingShimmer.d.ts.map +1 -0
- package/components/MarkdownRenderer/markdown-class-names.d.ts +10 -0
- package/components/MarkdownRenderer/markdown-class-names.d.ts.map +1 -0
- package/components/MarkdownRenderer/markdown-whitespace.d.ts +15 -0
- package/components/MarkdownRenderer/markdown-whitespace.d.ts.map +1 -0
- package/components/MarkdownRenderer/markdown-whitespace.js +14 -0
- package/components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.d.ts +25 -0
- package/components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.d.ts.map +1 -0
- package/components/PanelEmptyState/PanelEmptyState.d.ts +22 -0
- package/components/PanelEmptyState/PanelEmptyState.d.ts.map +1 -0
- package/components/PanelEmptyState/PanelEmptyState.js +12 -9
- package/components/PanelEmptyState/PanelEmptyState.module.scss.js +3 -2
- package/components/ResourceSummary/ResourceSummary.d.ts +49 -0
- package/components/ResourceSummary/ResourceSummary.d.ts.map +1 -0
- package/components/ResourceSummary/ResourceSummary.module.scss.js +5 -4
- package/components/TextRefinementField/TextRefinementField.d.ts +33 -0
- package/components/TextRefinementField/TextRefinementField.d.ts.map +1 -0
- package/components/TextRefinementField/TextRefinementField.js +27 -17
- package/constants/breakpoint.d.ts +9 -0
- package/constants/breakpoint.d.ts.map +1 -0
- package/constants/breakpoint.js +1 -1
- package/constants/dial.d.ts +5 -0
- package/constants/dial.d.ts.map +1 -0
- package/constants/entity-colors.d.ts +6 -0
- package/constants/entity-colors.d.ts.map +1 -0
- package/constants/icon.d.ts +14 -0
- package/constants/icon.d.ts.map +1 -0
- package/constants/markdown-editor.d.ts +2 -0
- package/constants/markdown-editor.d.ts.map +1 -0
- package/constants/mime-types.d.ts +27 -0
- package/constants/mime-types.d.ts.map +1 -0
- package/constants/public-class-names.d.ts +13 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/constants/resizable-fields.d.ts +5 -0
- package/constants/resizable-fields.d.ts.map +1 -0
- package/constants/select-list.d.ts +4 -0
- package/constants/select-list.d.ts.map +1 -0
- package/constants/tag-input.d.ts +2 -0
- package/constants/tag-input.d.ts.map +1 -0
- package/entry-points/file-manager.d.ts +5 -0
- package/entry-points/file-manager.d.ts.map +1 -0
- package/entry-points/markdown.d.ts +19 -0
- package/entry-points/markdown.d.ts.map +1 -0
- package/file-manager/DialFileManagerShell/DialFileManagerShell.d.ts +65 -0
- package/file-manager/DialFileManagerShell/DialFileManagerShell.d.ts.map +1 -0
- package/file-manager/DialFileManagerShell/DialFileManagerShell.js +296 -255
- package/file-manager/DialFileManagerShell/DialFileManagerShell.module.scss.js +4 -0
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.d.ts +89 -0
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.d.ts.map +1 -0
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +3 -6
- package/file-manager/OperationLoaderModal/OperationLoaderModal.d.ts +17 -0
- package/file-manager/OperationLoaderModal/OperationLoaderModal.d.ts.map +1 -0
- package/file-manager/OperationLoaderModal/OperationLoaderModal.js +1 -1
- package/file-manager/attach-result.d.ts +9 -0
- package/file-manager/attach-result.d.ts.map +1 -0
- package/file-manager/file-manager-controller.d.ts +129 -0
- package/file-manager/file-manager-controller.d.ts.map +1 -0
- package/file-manager/file-manager-variant.d.ts +21 -0
- package/file-manager/file-manager-variant.d.ts.map +1 -0
- package/file-manager/file-upload-validation.d.ts +8 -0
- package/file-manager/file-upload-validation.d.ts.map +1 -0
- package/file-manager/index.d.ts +11 -0
- package/file-manager/index.d.ts.map +1 -0
- package/file-manager/labels.d.ts +175 -0
- package/file-manager/labels.d.ts.map +1 -0
- package/file-manager/path.d.ts +12 -0
- package/file-manager/path.d.ts.map +1 -0
- package/file-manager/shell-styles.d.ts +11 -0
- package/file-manager/shell-styles.d.ts.map +1 -0
- package/file-manager/upload-batch.d.ts +75 -0
- package/file-manager/upload-batch.d.ts.map +1 -0
- package/file-manager/upload-batch.js +6 -2
- package/file-manager/upload-queue.d.ts +45 -0
- package/file-manager/upload-queue.d.ts.map +1 -0
- package/file-manager/upload-queue.js +45 -13
- package/file-manager/useGridEditingScroll/useGridEditingScroll.d.ts +27 -0
- package/file-manager/useGridEditingScroll/useGridEditingScroll.d.ts.map +1 -0
- package/file-manager.d.ts +2 -506
- package/file-manager.js +4 -4
- package/hooks/useAvailableHeightCap.d.ts +30 -0
- package/hooks/useAvailableHeightCap.d.ts.map +1 -0
- package/hooks/useAvailableHeightCap.js +1 -1
- package/hooks/useCodeCopy.d.ts +6 -0
- package/hooks/useCodeCopy.d.ts.map +1 -0
- package/hooks/useCollapsedText.d.ts +27 -0
- package/hooks/useCollapsedText.d.ts.map +1 -0
- package/hooks/useHorizontalOverflow.d.ts +21 -0
- package/hooks/useHorizontalOverflow.d.ts.map +1 -0
- package/hooks/useIsMobile.d.ts +3 -0
- package/hooks/useIsMobile.d.ts.map +1 -0
- package/hooks/useIsMobile.js +1 -1
- package/hooks/useStreamedMarkdownContent.d.ts +3 -0
- package/hooks/useStreamedMarkdownContent.d.ts.map +1 -0
- package/hooks/useTextRefinement.d.ts +44 -0
- package/hooks/useTextRefinement.d.ts.map +1 -0
- package/hooks/useUnsavedChangesGuard.d.ts +14 -0
- package/hooks/useUnsavedChangesGuard.d.ts.map +1 -0
- package/hooks/useUnsavedChangesGuard.js +1 -5
- package/index.css +3 -2
- package/index.d.ts +79 -3072
- package/index.d.ts.map +1 -0
- package/index.js +68 -64
- package/markdown.d.ts +2 -465
- package/markdown.js +3 -2
- package/models/annotation.d.ts +143 -0
- package/models/annotation.d.ts.map +1 -0
- package/models/application-visualizer.d.ts +67 -0
- package/models/application-visualizer.d.ts.map +1 -0
- package/models/auth.d.ts +26 -0
- package/models/auth.d.ts.map +1 -0
- package/models/chat.d.ts +407 -0
- package/models/chat.d.ts.map +1 -0
- package/models/conversation-classification.d.ts +9 -0
- package/models/conversation-classification.d.ts.map +1 -0
- package/models/conversation-transfer.d.ts +96 -0
- package/models/conversation-transfer.d.ts.map +1 -0
- package/models/custom-visualizer.d.ts +61 -0
- package/models/custom-visualizer.d.ts.map +1 -0
- package/models/deployment-configuration.d.ts +55 -0
- package/models/deployment-configuration.d.ts.map +1 -0
- package/models/deployment-features.d.ts +17 -0
- package/models/deployment-features.d.ts.map +1 -0
- package/models/deployment.d.ts +31 -0
- package/models/deployment.d.ts.map +1 -0
- package/models/dial-model.d.ts +19 -0
- package/models/dial-model.d.ts.map +1 -0
- package/models/entity.d.ts +15 -0
- package/models/entity.d.ts.map +1 -0
- package/models/import-export.d.ts +23 -0
- package/models/import-export.d.ts.map +1 -0
- package/models/inline-segment.d.ts +11 -0
- package/models/inline-segment.d.ts.map +1 -0
- package/models/locale.d.ts +19 -0
- package/models/locale.d.ts.map +1 -0
- package/models/text-refinement.d.ts +18 -0
- package/models/text-refinement.d.ts.map +1 -0
- package/models/theme.d.ts +36 -0
- package/models/theme.d.ts.map +1 -0
- package/models/tool-menu-item.d.ts +13 -0
- package/models/tool-menu-item.d.ts.map +1 -0
- package/package.json +3 -3
- package/types/attachment.d.ts +25 -0
- package/types/attachment.d.ts.map +1 -0
- package/types/code-editor.d.ts +8 -0
- package/types/code-editor.d.ts.map +1 -0
- package/types/entity-type.d.ts +10 -0
- package/types/entity-type.d.ts.map +1 -0
- package/types/file-manager-node.d.ts +17 -0
- package/types/file-manager-node.d.ts.map +1 -0
- package/types/mime-type.d.ts +59 -0
- package/types/mime-type.d.ts.map +1 -0
- package/utils/annotation.d.ts +29 -0
- package/utils/annotation.d.ts.map +1 -0
- package/utils/avatar-color.d.ts +10 -0
- package/utils/avatar-color.d.ts.map +1 -0
- package/utils/base64-json.d.ts +14 -0
- package/utils/base64-json.d.ts.map +1 -0
- package/utils/base64-json.js +4 -0
- package/utils/build-css-vars.d.ts +4 -0
- package/utils/build-css-vars.d.ts.map +1 -0
- package/utils/copy-to-clipboard.d.ts +18 -0
- package/utils/copy-to-clipboard.d.ts.map +1 -0
- package/utils/entity-field-limits.d.ts +11 -0
- package/utils/entity-field-limits.d.ts.map +1 -0
- package/utils/entity-type.d.ts +5 -0
- package/utils/entity-type.d.ts.map +1 -0
- package/utils/file-download.d.ts +21 -0
- package/utils/file-download.d.ts.map +1 -0
- package/utils/format-file-size.d.ts +3 -0
- package/utils/format-file-size.d.ts.map +1 -0
- package/utils/format-last-used.d.ts +3 -0
- package/utils/format-last-used.d.ts.map +1 -0
- package/utils/format-price.d.ts +7 -0
- package/utils/format-price.d.ts.map +1 -0
- package/utils/format-price.js +10 -10
- package/utils/generate-uuid.d.ts +3 -0
- package/utils/generate-uuid.d.ts.map +1 -0
- package/utils/initials.d.ts +3 -0
- package/utils/initials.d.ts.map +1 -0
- package/utils/inline-segments.d.ts +38 -0
- package/utils/inline-segments.d.ts.map +1 -0
- package/utils/inline-segments.js +53 -0
- package/utils/is-audio-transcription-supported.d.ts +3 -0
- package/utils/is-audio-transcription-supported.d.ts.map +1 -0
- package/utils/is-skill-selection-unsupported.d.ts +3 -0
- package/utils/is-skill-selection-unsupported.d.ts.map +1 -0
- package/utils/latex.d.ts +22 -0
- package/utils/latex.d.ts.map +1 -0
- package/utils/latex.js +47 -41
- package/utils/markdown-html.d.ts +14 -0
- package/utils/markdown-html.d.ts.map +1 -0
- package/utils/markdown-html.js +11 -0
- package/utils/merge-class.d.ts +4 -0
- package/utils/merge-class.d.ts.map +1 -0
- package/utils/message-attachment-to-display.d.ts +22 -0
- package/utils/message-attachment-to-display.d.ts.map +1 -0
- package/utils/message-attachment-to-display.js +1 -1
- package/utils/message.d.ts +4 -0
- package/utils/message.d.ts.map +1 -0
- package/utils/mime-type.d.ts +22 -0
- package/utils/mime-type.d.ts.map +1 -0
- package/utils/mime-type.js +1 -1
- package/utils/prompt-variables.d.ts +62 -0
- package/utils/prompt-variables.d.ts.map +1 -0
- package/utils/prompt-variables.js +5 -9
- package/utils/string-utils.d.ts +11 -0
- package/utils/string-utils.d.ts.map +1 -0
- package/utils/syntax-highlighting.d.ts +8 -0
- package/utils/syntax-highlighting.d.ts.map +1 -0
- package/utils/syntax-highlighting.js +8 -8
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Components, Options } from 'react-markdown';
|
|
3
|
+
import { CodeBlockTheme } from '../../types/code-editor';
|
|
4
|
+
import { MarkdownTableActionLabels, MarkdownTableClassNames } from './Table/MarkdownTable';
|
|
5
|
+
/** Per-element className overrides passed to {@link MarkdownRenderer}. */
|
|
6
|
+
export interface MarkdownRendererClassNames extends MarkdownTableClassNames {
|
|
7
|
+
/** Class on `<h1>`. */
|
|
8
|
+
h1?: string;
|
|
9
|
+
/** Class on `<h2>`. */
|
|
10
|
+
h2?: string;
|
|
11
|
+
/** Class on `<h3>`. */
|
|
12
|
+
h3?: string;
|
|
13
|
+
/** Class on `<h4>`. */
|
|
14
|
+
h4?: string;
|
|
15
|
+
/** Class on `<h5>`. */
|
|
16
|
+
h5?: string;
|
|
17
|
+
/** Class on `<h6>`. */
|
|
18
|
+
h6?: string;
|
|
19
|
+
/** Classes on `<p>` elements. */
|
|
20
|
+
p?: string;
|
|
21
|
+
/** Extra classes on `<ul>` (base: `list-disc ps-[2em]`). */
|
|
22
|
+
ul?: string;
|
|
23
|
+
/** Extra classes on `<ol>` (base: `list-decimal ps-[2em]`). */
|
|
24
|
+
ol?: string;
|
|
25
|
+
/** Typography class for `<strong>`. Defaults to `'dial-body-paragraph-semi-text'` — the semibold step matching the default `p` class. */
|
|
26
|
+
strong?: string;
|
|
27
|
+
/** Typography class for `<em>`. Defaults to `'italic'`. */
|
|
28
|
+
em?: string;
|
|
29
|
+
/** Extra classes on the {@link MarkdownCodeBlock} outer container. */
|
|
30
|
+
codeBlockContainer?: string;
|
|
31
|
+
/** Extra classes on the {@link MarkdownCodeBlock} header bar. */
|
|
32
|
+
codeBlockHeader?: string;
|
|
33
|
+
/** Typography class for the `<code>` element inside a code block. Defaults to `'dial-code-text'`. */
|
|
34
|
+
codeFont?: string;
|
|
35
|
+
/** Extra classes on inline `<code>` (base: `rounded px-1 py-0.5`). */
|
|
36
|
+
codeInline?: string;
|
|
37
|
+
/** Typography class for inline `<code>`. Defaults to `'dial-code-text'`. */
|
|
38
|
+
codeInlineFont?: string;
|
|
39
|
+
/** Extra classes on `<blockquote>` (base uses a logical start border and padding). */
|
|
40
|
+
blockquote?: string;
|
|
41
|
+
/** Extra classes on `<a>` (base uses the accent text color and an offset underline). */
|
|
42
|
+
link?: string;
|
|
43
|
+
/** Extra classes on `<hr>` separators. */
|
|
44
|
+
hr?: string;
|
|
45
|
+
/** Extra classes on deleted text rendered by GFM. */
|
|
46
|
+
del?: string;
|
|
47
|
+
/** Extra classes on `<th>` and `<td>` (base includes borders, spacing, and text wrapping). */
|
|
48
|
+
tableCell?: string;
|
|
49
|
+
/** Extra classes on `<td>` only (applied before `tableCell`, e.g. a body-cell background). */
|
|
50
|
+
tableBodyCell?: string;
|
|
51
|
+
/** Extra classes on `<th>` only (applied alongside `tableCell`). */
|
|
52
|
+
tableHeader?: string;
|
|
53
|
+
/** Typography class for `<th>` cells. Defaults to `'dial-tiny-lead-semi-text'`. Text color is set separately via `colors.tableHeaderText`. */
|
|
54
|
+
tableHeaderFont?: string;
|
|
55
|
+
/** Extra classes on the scrollable wrapper around block (display) LaTeX formulas. */
|
|
56
|
+
mathBlock?: string;
|
|
57
|
+
}
|
|
58
|
+
/** Props for {@link MarkdownRenderer}. */
|
|
59
|
+
export interface MarkdownRendererProps {
|
|
60
|
+
/** Raw markdown string to render. */
|
|
61
|
+
content: string;
|
|
62
|
+
/** Classes applied to the renderer root. */
|
|
63
|
+
containerClassName?: string;
|
|
64
|
+
/** When true, appended content is revealed gradually for smoother streaming updates. */
|
|
65
|
+
isStreaming?: boolean;
|
|
66
|
+
/** Reveal speed used while `isStreaming` is true. Defaults to 120 characters per second. */
|
|
67
|
+
streamCharactersPerSecond?: number;
|
|
68
|
+
/** Per-element styling classes. Merged with structural base classes inside the component. Defaults to no overrides (`{}`). */
|
|
69
|
+
classNames?: MarkdownRendererClassNames;
|
|
70
|
+
/**
|
|
71
|
+
* Full component overrides merged on top of the built-in map.
|
|
72
|
+
* Use for elements not covered by `classNames`.
|
|
73
|
+
*/
|
|
74
|
+
components?: Components;
|
|
75
|
+
/**
|
|
76
|
+
* Rewrites `href` and `src` values before they are rendered. The result is
|
|
77
|
+
* still passed through react-markdown's protocol allowlist. Hosts use this
|
|
78
|
+
* to map DIAL file ids (`files/{bucket}/{path}`) to download URLs. Defaults
|
|
79
|
+
* to no extra rewrite.
|
|
80
|
+
*/
|
|
81
|
+
urlTransform?: (url: string) => string;
|
|
82
|
+
/** Extra rehype plugins, applied after the built-in KaTeX pass. Defaults to none. */
|
|
83
|
+
rehypePlugins?: NonNullable<Options['rehypePlugins']>;
|
|
84
|
+
/** When `false`, raw HTML in `content` renders as literal text instead of being parsed into elements. Defaults to `true`. */
|
|
85
|
+
isRawHtmlEnabled?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Label shown with a shimmer animation while `isStreaming` is true and no content has arrived yet.
|
|
88
|
+
* Defaults to `'Thinking'`. Pass a translated string from the consuming app.
|
|
89
|
+
*/
|
|
90
|
+
thinkingLabel?: string;
|
|
91
|
+
/** Accessible label for the copy button in code blocks. Defaults to `'Copy code'`. */
|
|
92
|
+
codeBlockCopyLabel?: string;
|
|
93
|
+
/** Accessible label for the copy button after copying. Defaults to `'Copied!'`. */
|
|
94
|
+
codeBlockCopiedLabel?: string;
|
|
95
|
+
/** Accessible label for the download button in code blocks. Defaults to `'Download code'`. */
|
|
96
|
+
codeBlockDownloadLabel?: string;
|
|
97
|
+
/** Syntax highlight color theme for code blocks and tables. Defaults to `'dark'`. */
|
|
98
|
+
codeBlockTheme?: CodeBlockTheme;
|
|
99
|
+
/** Color overrides applied as CSS custom properties. */
|
|
100
|
+
colors?: MarkdownRendererColors;
|
|
101
|
+
/** Localized labels for Markdown table actions. Supplying them enables the action bar. */
|
|
102
|
+
tableActionLabels?: MarkdownTableActionLabels;
|
|
103
|
+
/** Filename used when downloading a Markdown table as CSV. Defaults to `'table.csv'`. */
|
|
104
|
+
tableDownloadFilename?: string;
|
|
105
|
+
tableOnOpenInCanvas?: (markdown: string) => void;
|
|
106
|
+
/** Accessible label for a table's horizontally scrollable region. Defaults to `'Scrollable table'`. */
|
|
107
|
+
tableScrollRegionAriaLabel?: string;
|
|
108
|
+
/** Accessible label for a block formula's horizontally scrollable region. Defaults to `'Scrollable formula'`. */
|
|
109
|
+
mathScrollRegionAriaLabel?: string;
|
|
110
|
+
}
|
|
111
|
+
/** CSS custom-property overrides for the `MarkdownRenderer` component. */
|
|
112
|
+
export interface MarkdownRendererColors {
|
|
113
|
+
/** Primary color of the "thinking" shimmer gradient. */
|
|
114
|
+
thinkingPrimary?: string;
|
|
115
|
+
/** Secondary color of the "thinking" shimmer gradient. */
|
|
116
|
+
thinkingSecondary?: string;
|
|
117
|
+
/** Border color for `<hr>` separators and table cell borders. */
|
|
118
|
+
border?: string;
|
|
119
|
+
/** Border color for the `<blockquote>` start border. Defaults to `--stroke-primary`. */
|
|
120
|
+
blockquoteBorder?: string;
|
|
121
|
+
/** Text color for `<blockquote>` content. Defaults to `--text-secondary`. */
|
|
122
|
+
blockquoteText?: string;
|
|
123
|
+
/** Text color for `<a>` links. Defaults to `--text-accent`. */
|
|
124
|
+
linkText?: string;
|
|
125
|
+
/** Focus-visible outline color for `<a>` links. Defaults to `--stroke-focus`. */
|
|
126
|
+
linkFocus?: string;
|
|
127
|
+
/** Text color for `<th>` table header cells. Defaults to `--text-secondary`. */
|
|
128
|
+
tableHeaderText?: string;
|
|
129
|
+
/** Text color for `<h6>` headings. Defaults to `--text-secondary`. */
|
|
130
|
+
headingSixText?: string;
|
|
131
|
+
/** Background color for inline `<code>` spans. Defaults to `--bg-layer-raised`. */
|
|
132
|
+
inlineCodeBackground?: string;
|
|
133
|
+
/** Text color for inline `<code>` spans. Defaults to `--text-primary`. */
|
|
134
|
+
inlineCodeText?: string;
|
|
135
|
+
}
|
|
136
|
+
export declare const defaultMarkdownComponents: Components;
|
|
137
|
+
/** Markdown renderer with GFM support. Styling is driven by `classNames`; structural overrides via `components`. */
|
|
138
|
+
export declare const MarkdownRenderer: FC<MarkdownRendererProps>;
|
|
139
|
+
//# sourceMappingURL=MarkdownRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownRenderer/MarkdownRenderer.tsx"],"names":[],"mappings":"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"}
|
|
@@ -2,27 +2,29 @@ import { mergeClasses as e } from "../../utils/merge-class.js";
|
|
|
2
2
|
import { buildCssVars as t } from "../../utils/build-css-vars.js";
|
|
3
3
|
import { useStreamedMarkdownContent as n } from "../../hooks/useStreamedMarkdownContent.js";
|
|
4
4
|
import { preprocessLaTeX as r } from "../../utils/latex.js";
|
|
5
|
-
import {
|
|
6
|
-
import a from "./
|
|
7
|
-
import {
|
|
8
|
-
import s from "./
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import d from "
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import T from "
|
|
5
|
+
import { rehypeRawAsText as i } from "../../utils/markdown-html.js";
|
|
6
|
+
import { MarkdownCodeBlock as a } from "./CodeBlock/CodeBlock.js";
|
|
7
|
+
import { rehypePreserveSpaces as o } from "./markdown-whitespace.js";
|
|
8
|
+
import s from "./MarkdownRenderer.module.scss.js";
|
|
9
|
+
import { MarkdownMathBlock as c } from "./Math/MarkdownMathBlock.js";
|
|
10
|
+
import l from "./Table/MarkdownTable.module.scss.js";
|
|
11
|
+
import { MarkdownTable as u } from "./Table/MarkdownTable.js";
|
|
12
|
+
import { MarkdownTaskCheckbox as d } from "./TaskCheckbox/MarkdownTaskCheckbox.js";
|
|
13
|
+
import { ThinkingShimmer as f } from "./ThinkingShimmer.js";
|
|
14
|
+
import p from "remark-gfm";
|
|
15
|
+
import { memo as m, useEffect as h, useMemo as g, useState as _ } from "react";
|
|
16
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
17
|
+
import x, { defaultUrlTransform as S } from "react-markdown";
|
|
18
|
+
import C from "rehype-raw";
|
|
19
|
+
import w, { defaultSchema as T } from "rehype-sanitize";
|
|
20
|
+
import E from "remark-breaks";
|
|
21
|
+
import D from "remark-math";
|
|
20
22
|
//#region src/components/MarkdownRenderer/MarkdownRenderer.tsx
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
[
|
|
25
|
-
],
|
|
23
|
+
var O = [
|
|
24
|
+
p,
|
|
25
|
+
E,
|
|
26
|
+
[D, { singleDollarTextMath: !1 }]
|
|
27
|
+
], k = /* @__PURE__ */ "math.maction.annotation.annotation-xml.menclose.merror.mfenced.mfrac.mi.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.semantics.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover".split("."), A = {
|
|
26
28
|
math: ["display", "xmlns"],
|
|
27
29
|
annotation: ["encoding"],
|
|
28
30
|
mfrac: ["linethickness"],
|
|
@@ -51,231 +53,236 @@ var E = [
|
|
|
51
53
|
"width"
|
|
52
54
|
],
|
|
53
55
|
mtd: ["width"]
|
|
54
|
-
},
|
|
55
|
-
...
|
|
56
|
+
}, j = [C], M = [i], N = [w, {
|
|
57
|
+
...T,
|
|
56
58
|
tagNames: [
|
|
57
|
-
...
|
|
58
|
-
...
|
|
59
|
+
...T.tagNames ?? [],
|
|
60
|
+
...k,
|
|
59
61
|
"cit"
|
|
60
62
|
],
|
|
61
63
|
attributes: {
|
|
62
|
-
...
|
|
63
|
-
...
|
|
64
|
-
code: [...
|
|
64
|
+
...T.attributes,
|
|
65
|
+
...A,
|
|
66
|
+
code: [...T.attributes?.code ?? [], ["className"]],
|
|
65
67
|
cit: ["dataId"],
|
|
66
|
-
span: [...
|
|
68
|
+
span: [...T.attributes?.span ?? [], [
|
|
67
69
|
"className",
|
|
68
70
|
"katex",
|
|
69
71
|
"katex-error"
|
|
70
72
|
]]
|
|
71
73
|
}
|
|
72
|
-
}],
|
|
73
|
-
li: ({ children: e }) => /* @__PURE__ */
|
|
74
|
+
}], P = [], F = /\$\$|\\\(|\\\[/, I = (e) => F.test(e), L = {}, R = (e) => e == null ? S : (t) => S(e(t)), z = {
|
|
75
|
+
li: ({ children: e }) => /* @__PURE__ */ y("li", {
|
|
74
76
|
className: "mb-1.5 last:mb-0",
|
|
75
77
|
children: e
|
|
76
78
|
}),
|
|
77
|
-
cit: ({ children: e, ...t }) => /* @__PURE__ */ v
|
|
79
|
+
cit: ({ children: e, ...t }) => /* @__PURE__ */ b(v, { children: [
|
|
78
80
|
t["data-id"] == null ? "<cit>" : `<cit data-id="${t["data-id"]}">`,
|
|
79
81
|
e,
|
|
80
82
|
"</cit>"
|
|
81
83
|
] })
|
|
82
|
-
},
|
|
84
|
+
}, B = (e) => {
|
|
83
85
|
let t = e?.properties?.className;
|
|
84
86
|
return !Array.isArray(t) || !t.includes("katex") ? !1 : (e?.children ?? []).some((e) => e.type === "element" && e.tagName === "math" && e.properties?.display === "block");
|
|
85
|
-
},
|
|
87
|
+
}, V = {
|
|
86
88
|
left: "text-start",
|
|
87
89
|
center: "text-center",
|
|
88
90
|
right: "text-end"
|
|
89
|
-
},
|
|
91
|
+
}, H = (e) => {
|
|
90
92
|
let t = e?.properties?.align;
|
|
91
|
-
return typeof t == "string" ?
|
|
92
|
-
},
|
|
93
|
-
h1: ({ children: e }) => /* @__PURE__ */
|
|
93
|
+
return typeof t == "string" ? V[t] : void 0;
|
|
94
|
+
}, U = (e) => e ? e.type === "text" ? e.value ?? "" : (e.children ?? []).map(U).join("") : "", W = (t, { isStreaming: n, codeBlockCopyLabel: r, codeBlockCopiedLabel: i, codeBlockDownloadLabel: o, codeBlockTheme: f, tableActionLabels: p, tableDownloadFilename: m, tableOnOpenInCanvas: h, tableScrollRegionAriaLabel: g, mathScrollRegionAriaLabel: _ }) => ({
|
|
95
|
+
h1: ({ children: e }) => /* @__PURE__ */ y("h1", {
|
|
94
96
|
className: t.h1,
|
|
95
97
|
children: e
|
|
96
98
|
}),
|
|
97
|
-
h2: ({ children: e }) => /* @__PURE__ */
|
|
99
|
+
h2: ({ children: e }) => /* @__PURE__ */ y("h2", {
|
|
98
100
|
className: t.h2,
|
|
99
101
|
children: e
|
|
100
102
|
}),
|
|
101
|
-
h3: ({ children: e }) => /* @__PURE__ */
|
|
103
|
+
h3: ({ children: e }) => /* @__PURE__ */ y("h3", {
|
|
102
104
|
className: t.h3,
|
|
103
105
|
children: e
|
|
104
106
|
}),
|
|
105
|
-
h4: ({ children: e }) => /* @__PURE__ */
|
|
107
|
+
h4: ({ children: e }) => /* @__PURE__ */ y("h4", {
|
|
106
108
|
className: t.h4,
|
|
107
109
|
children: e
|
|
108
110
|
}),
|
|
109
|
-
h5: ({ children: e }) => /* @__PURE__ */
|
|
111
|
+
h5: ({ children: e }) => /* @__PURE__ */ y("h5", {
|
|
110
112
|
className: t.h5,
|
|
111
113
|
children: e
|
|
112
114
|
}),
|
|
113
|
-
h6: ({ children: n }) => /* @__PURE__ */
|
|
114
|
-
className: e(
|
|
115
|
+
h6: ({ children: n }) => /* @__PURE__ */ y("h6", {
|
|
116
|
+
className: e(s.h6, t.h6),
|
|
115
117
|
children: n
|
|
116
118
|
}),
|
|
117
|
-
p: ({ children: n }) => /* @__PURE__ */
|
|
119
|
+
p: ({ children: n }) => /* @__PURE__ */ y("p", {
|
|
118
120
|
className: e("break-words", t.p),
|
|
119
121
|
children: n
|
|
120
122
|
}),
|
|
121
|
-
ul: ({ children: n }) => /* @__PURE__ */
|
|
123
|
+
ul: ({ children: n }) => /* @__PURE__ */ y("ul", {
|
|
122
124
|
className: e("list-disc ps-[2em]", t.ul),
|
|
123
125
|
children: n
|
|
124
126
|
}),
|
|
125
|
-
ol: ({ children: n }) => /* @__PURE__ */
|
|
127
|
+
ol: ({ children: n }) => /* @__PURE__ */ y("ol", {
|
|
126
128
|
className: e("list-decimal ps-[2em]", t.ol),
|
|
127
129
|
children: n
|
|
128
130
|
}),
|
|
129
|
-
strong: ({ children: e }) => /* @__PURE__ */
|
|
131
|
+
strong: ({ children: e }) => /* @__PURE__ */ y("strong", {
|
|
130
132
|
className: t.strong ?? "dial-body-paragraph-semi-text",
|
|
131
133
|
children: e
|
|
132
134
|
}),
|
|
133
|
-
em: ({ children: e }) => /* @__PURE__ */
|
|
135
|
+
em: ({ children: e }) => /* @__PURE__ */ y("em", {
|
|
134
136
|
className: t.em ?? "italic",
|
|
135
137
|
children: e
|
|
136
138
|
}),
|
|
137
|
-
pre: ({ children: e }) => /* @__PURE__ */
|
|
138
|
-
code: ({ children:
|
|
139
|
-
let
|
|
140
|
-
return
|
|
141
|
-
language:
|
|
142
|
-
value:
|
|
139
|
+
pre: ({ children: e }) => /* @__PURE__ */ y(v, { children: e }),
|
|
140
|
+
code: ({ children: c, className: l }) => {
|
|
141
|
+
let u = /language-(\w+)/.exec(l ?? "")?.[1] ?? "", d = String(c);
|
|
142
|
+
return u || d.includes("\n") ? /* @__PURE__ */ y(a, {
|
|
143
|
+
language: u,
|
|
144
|
+
value: d.replace(/\n$/, ""),
|
|
143
145
|
isStreaming: n,
|
|
144
146
|
theme: f,
|
|
145
147
|
copyLabel: r,
|
|
146
|
-
copiedLabel:
|
|
147
|
-
downloadLabel:
|
|
148
|
+
copiedLabel: i,
|
|
149
|
+
downloadLabel: o,
|
|
148
150
|
containerClassName: t.codeBlockContainer,
|
|
149
151
|
headerClassName: t.codeBlockHeader,
|
|
150
152
|
codeClassName: t.codeFont
|
|
151
|
-
}) : /* @__PURE__ */
|
|
152
|
-
className: e("rounded px-1 py-0.5",
|
|
153
|
-
children:
|
|
153
|
+
}) : /* @__PURE__ */ y("code", {
|
|
154
|
+
className: e("rounded px-1 py-0.5", s.codeInline, t.codeInlineFont ?? "dial-code-text", t.codeInline),
|
|
155
|
+
children: c
|
|
154
156
|
});
|
|
155
157
|
},
|
|
156
|
-
blockquote: ({ children: n }) => /* @__PURE__ */
|
|
157
|
-
className: e("border-s-2 py-1 ps-4",
|
|
158
|
+
blockquote: ({ children: n }) => /* @__PURE__ */ y("blockquote", {
|
|
159
|
+
className: e("border-s-2 py-1 ps-4", s.blockquote, t.blockquote),
|
|
158
160
|
children: n
|
|
159
161
|
}),
|
|
160
|
-
a: ({ href: n, children: r }) => /* @__PURE__ */
|
|
162
|
+
a: ({ href: n, children: r }) => /* @__PURE__ */ y("a", {
|
|
161
163
|
href: n,
|
|
162
164
|
target: "_blank",
|
|
163
165
|
rel: "noopener noreferrer",
|
|
164
|
-
className: e("decoration-current/60
|
|
166
|
+
className: e("break-words underline decoration-current/60 underline-offset-2 hover:decoration-current focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2", s.link, t.link),
|
|
165
167
|
children: r
|
|
166
168
|
}),
|
|
167
|
-
hr: () => /* @__PURE__ */
|
|
168
|
-
del: ({ children: n }) => /* @__PURE__ */
|
|
169
|
+
hr: () => /* @__PURE__ */ y("hr", { className: e("my-5 border-t", s.secondaryBorder, t.hr) }),
|
|
170
|
+
del: ({ children: n }) => /* @__PURE__ */ y("del", {
|
|
169
171
|
className: e("opacity-75", t.del),
|
|
170
172
|
children: n
|
|
171
173
|
}),
|
|
172
|
-
input: ({ type: e, checked: t }) => e === "checkbox" ? /* @__PURE__ */
|
|
173
|
-
span: ({ children: e, node: n, ...r }) =>
|
|
174
|
+
input: ({ type: e, checked: t }) => e === "checkbox" ? /* @__PURE__ */ y(d, { checked: t ?? !1 }) : null,
|
|
175
|
+
span: ({ children: e, node: n, ...r }) => B(n) ? /* @__PURE__ */ y(c, {
|
|
174
176
|
className: t.mathBlock,
|
|
175
|
-
scrollRegionAriaLabel:
|
|
177
|
+
scrollRegionAriaLabel: _,
|
|
176
178
|
children: e
|
|
177
|
-
}) : /* @__PURE__ */
|
|
179
|
+
}) : /* @__PURE__ */ y("span", {
|
|
178
180
|
...r,
|
|
179
181
|
children: e
|
|
180
182
|
}),
|
|
181
|
-
table: ({ children: e }) => /* @__PURE__ */
|
|
183
|
+
table: ({ children: e }) => /* @__PURE__ */ y(u, {
|
|
182
184
|
classNames: t,
|
|
183
185
|
actionLabels: p,
|
|
184
186
|
downloadFilename: m,
|
|
185
187
|
onOpenInCanvas: h,
|
|
186
188
|
isStreaming: n,
|
|
187
|
-
scrollRegionAriaLabel:
|
|
189
|
+
scrollRegionAriaLabel: g,
|
|
188
190
|
children: e
|
|
189
191
|
}),
|
|
190
192
|
tr: ({ children: t, node: n }) => {
|
|
191
|
-
let r = n?.children.filter((e) => e.type === "element") ?? [], i = r.some((e) => e.tagName === "th"), a = r.filter((e) =>
|
|
192
|
-
return /* @__PURE__ */
|
|
193
|
-
className: e(
|
|
193
|
+
let r = n?.children.filter((e) => e.type === "element") ?? [], i = r.some((e) => e.tagName === "th"), a = r.filter((e) => U(e).trim().length > 0).length, o = !i && r.length > 1 && a === 1;
|
|
194
|
+
return /* @__PURE__ */ y("tr", {
|
|
195
|
+
className: e(l.row, o && l.sectionRow),
|
|
194
196
|
children: t
|
|
195
197
|
});
|
|
196
198
|
},
|
|
197
|
-
th: ({ children: n, node: r }) => /* @__PURE__ */
|
|
199
|
+
th: ({ children: n, node: r }) => /* @__PURE__ */ y("th", {
|
|
198
200
|
scope: "col",
|
|
199
|
-
className: e("sticky top-0 z-[2] max-w-96
|
|
201
|
+
className: e("sticky top-0 z-[2] max-w-96 px-3 py-2.5 text-start break-words whitespace-normal", H(r), l.rowDivider, l.tableHeaderCell, t.tableHeaderFont ?? "dial-tiny-lead-semi-text", t.tableCell, t.tableHeader),
|
|
200
202
|
children: n
|
|
201
203
|
}),
|
|
202
|
-
td: ({ children: n, node: r }) => /* @__PURE__ */
|
|
203
|
-
className: e("max-w-96
|
|
204
|
+
td: ({ children: n, node: r }) => /* @__PURE__ */ y("td", {
|
|
205
|
+
className: e("max-w-96 px-3 py-[7px] align-top [overflow-wrap:anywhere] whitespace-normal", H(r), l.rowDivider, t.tableBodyCell, t.tableCell),
|
|
204
206
|
children: n
|
|
205
207
|
})
|
|
206
|
-
}),
|
|
207
|
-
let
|
|
208
|
-
|
|
209
|
-
if (!
|
|
208
|
+
}), G = m(({ content: i, containerClassName: a, isStreaming: s, streamCharactersPerSecond: c, classNames: l = L, components: u, urlTransform: d, rehypePlugins: p = P, isRawHtmlEnabled: m = !0, thinkingLabel: v = "Thinking", codeBlockCopyLabel: b, codeBlockCopiedLabel: S, codeBlockDownloadLabel: C, codeBlockTheme: w, colors: T, tableActionLabels: E, tableDownloadFilename: D, tableOnOpenInCanvas: k, tableScrollRegionAriaLabel: A, mathScrollRegionAriaLabel: F }) => {
|
|
209
|
+
let B = n(i, s, c), V = g(() => r(B), [B]), H = g(() => I(V), [V]), [U, G] = _(null);
|
|
210
|
+
h(() => {
|
|
211
|
+
if (!H || U) return;
|
|
210
212
|
let e = !1;
|
|
211
213
|
return (async () => {
|
|
212
214
|
let [t] = await Promise.all([import("rehype-katex"), import("katex/dist/katex.min.css")]);
|
|
213
|
-
e ||
|
|
215
|
+
e || G([t.default, {
|
|
214
216
|
output: "mathml",
|
|
215
217
|
strict: !1
|
|
216
218
|
}]);
|
|
217
219
|
})(), () => {
|
|
218
220
|
e = !0;
|
|
219
221
|
};
|
|
220
|
-
}, [
|
|
221
|
-
let
|
|
222
|
-
...
|
|
223
|
-
...
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
"--cm-
|
|
233
|
-
"--cm-
|
|
234
|
-
"--cm-
|
|
235
|
-
"--cm-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
222
|
+
}, [H, U]);
|
|
223
|
+
let K = g(() => [
|
|
224
|
+
...m ? j : M,
|
|
225
|
+
...U ? [U] : [],
|
|
226
|
+
N,
|
|
227
|
+
o,
|
|
228
|
+
...p
|
|
229
|
+
], [
|
|
230
|
+
m,
|
|
231
|
+
U,
|
|
232
|
+
p
|
|
233
|
+
]), q = t({
|
|
234
|
+
"--cm-markdown-border": T?.border,
|
|
235
|
+
"--cm-blockquote-border": T?.blockquoteBorder,
|
|
236
|
+
"--cm-blockquote-text": T?.blockquoteText,
|
|
237
|
+
"--cm-link-text": T?.linkText,
|
|
238
|
+
"--cm-link-focus": T?.linkFocus,
|
|
239
|
+
"--cm-table-header-text": T?.tableHeaderText,
|
|
240
|
+
"--cm-h6-text": T?.headingSixText,
|
|
241
|
+
"--cm-code-inline-bg": T?.inlineCodeBackground,
|
|
242
|
+
"--cm-code-inline-text": T?.inlineCodeText
|
|
243
|
+
}), J = g(() => R(d), [d]), Y = g(() => ({
|
|
244
|
+
...W(l, {
|
|
245
|
+
isStreaming: s,
|
|
246
|
+
codeBlockCopyLabel: b,
|
|
247
|
+
codeBlockCopiedLabel: S,
|
|
248
|
+
codeBlockDownloadLabel: C,
|
|
249
|
+
codeBlockTheme: w,
|
|
250
|
+
tableActionLabels: E,
|
|
251
|
+
tableDownloadFilename: D,
|
|
252
|
+
tableOnOpenInCanvas: k,
|
|
253
|
+
tableScrollRegionAriaLabel: A,
|
|
254
|
+
mathScrollRegionAriaLabel: F
|
|
248
255
|
}),
|
|
249
|
-
...
|
|
250
|
-
...
|
|
256
|
+
...z,
|
|
257
|
+
...u
|
|
251
258
|
}), [
|
|
259
|
+
l,
|
|
252
260
|
s,
|
|
253
|
-
a,
|
|
254
|
-
g,
|
|
255
|
-
v,
|
|
256
261
|
b,
|
|
257
|
-
|
|
262
|
+
S,
|
|
258
263
|
C,
|
|
259
264
|
w,
|
|
260
|
-
|
|
265
|
+
E,
|
|
261
266
|
D,
|
|
262
|
-
|
|
263
|
-
|
|
267
|
+
k,
|
|
268
|
+
A,
|
|
269
|
+
F,
|
|
270
|
+
u
|
|
264
271
|
]);
|
|
265
|
-
return
|
|
266
|
-
label:
|
|
267
|
-
colors:
|
|
268
|
-
}) : /* @__PURE__ */
|
|
269
|
-
style:
|
|
270
|
-
className:
|
|
271
|
-
children: /* @__PURE__ */
|
|
272
|
-
remarkPlugins:
|
|
273
|
-
rehypePlugins:
|
|
274
|
-
components:
|
|
275
|
-
urlTransform:
|
|
276
|
-
children:
|
|
272
|
+
return s && !B ? /* @__PURE__ */ y(f, {
|
|
273
|
+
label: v,
|
|
274
|
+
colors: T
|
|
275
|
+
}) : /* @__PURE__ */ y("div", {
|
|
276
|
+
style: q,
|
|
277
|
+
className: e("[overflow-wrap:anywhere]", a),
|
|
278
|
+
children: /* @__PURE__ */ y(x, {
|
|
279
|
+
remarkPlugins: O,
|
|
280
|
+
rehypePlugins: K,
|
|
281
|
+
components: Y,
|
|
282
|
+
urlTransform: J,
|
|
283
|
+
children: V
|
|
277
284
|
})
|
|
278
285
|
});
|
|
279
286
|
});
|
|
280
287
|
//#endregion
|
|
281
|
-
export {
|
|
288
|
+
export { G as MarkdownRenderer, z as defaultMarkdownComponents };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/components/MarkdownRenderer/MarkdownRenderer.module.scss
|
|
2
|
+
var e = "_thinking_1ql91_9", t = "_h6_1ql91_18", n = "_codeInline_1ql91_22", r = "_secondaryBorder_1ql91_27", i = "_blockquote_1ql91_31", a = "_link_1ql91_36", o = {
|
|
3
|
+
thinking: e,
|
|
3
4
|
"cm-shimmer": "_cm-shimmer_1ql91_1",
|
|
4
|
-
h6:
|
|
5
|
-
codeInline:
|
|
6
|
-
secondaryBorder:
|
|
7
|
-
blockquote:
|
|
8
|
-
link:
|
|
5
|
+
h6: t,
|
|
6
|
+
codeInline: n,
|
|
7
|
+
secondaryBorder: r,
|
|
8
|
+
blockquote: i,
|
|
9
|
+
link: a
|
|
9
10
|
};
|
|
10
11
|
//#endregion
|
|
11
|
-
export {
|
|
12
|
+
export { i as blockquote, n as codeInline, o as default, t as h6, a as link, r as secondaryBorder, e as thinking };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
/** Props for {@link MarkdownMathBlock}. */
|
|
3
|
+
export interface MarkdownMathBlockProps {
|
|
4
|
+
/** Rendered KaTeX output — the `<math display="block">` element and its subtree. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** Extra classes on the scroll container. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Accessible label for the horizontally scrollable region. Defaults to `'Scrollable formula'`. */
|
|
9
|
+
scrollRegionAriaLabel?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Wraps KaTeX display math in a horizontally scrollable region so a formula
|
|
13
|
+
* wider than the message column stays reachable instead of being clipped.
|
|
14
|
+
* The region only becomes a labelled, keyboard-focusable landmark while it
|
|
15
|
+
* actually overflows, so ordinary formulas add no tab stop or noise.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MarkdownMathBlock: FC<MarkdownMathBlockProps>;
|
|
18
|
+
//# sourceMappingURL=MarkdownMathBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownMathBlock.d.ts","sourceRoot":"","sources":["../../../../src/components/MarkdownRenderer/Math/MarkdownMathBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAQ,MAAM,OAAO,CAAC;AAMtD,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,oFAAoF;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mGAAmG;IACnG,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAqCxD,CAAC"}
|
|
@@ -9,7 +9,7 @@ var o = i(({ children: i, className: o, scrollRegionAriaLabel: s = "Scrollable f
|
|
|
9
9
|
let { scrollContainerRef: c, contentRef: l, hasContentBeyondStart: u, hasContentBeyondEnd: d, handleScroll: f } = n(), p = u || d;
|
|
10
10
|
return /* @__PURE__ */ a("div", {
|
|
11
11
|
ref: c,
|
|
12
|
-
className: e("w-full
|
|
12
|
+
className: e("w-full max-w-full min-w-0 overflow-x-auto overflow-y-hidden", r.scrollContainer, o, t.mathBlock),
|
|
13
13
|
onScroll: f,
|
|
14
14
|
role: p ? "region" : void 0,
|
|
15
15
|
"aria-label": p ? s : void 0,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/components/MarkdownRenderer/Math/MarkdownMathBlock.module.scss
|
|
2
|
+
var e = "_scrollContainer_n2oom_1", t = "_mathContent_n2oom_24", n = {
|
|
3
|
+
scrollContainer: e,
|
|
4
|
+
mathContent: t
|
|
4
5
|
};
|
|
5
6
|
//#endregion
|
|
6
|
-
export {
|
|
7
|
+
export { n as default, t as mathContent, e as scrollContainer };
|