@epam/ai-dial-chat-shared 1.2.0-dev.285 → 1.2.0-dev.288
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.
|
@@ -4,11 +4,11 @@ import { PlainTextRenderer as n } from "./PlainTextRenderer.js";
|
|
|
4
4
|
import { memo as r } from "react";
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/MarkdownRenderer/MDMessageViewer.tsx
|
|
7
|
-
var a = r(({ content: r, isPlainText: a, isStreaming: o, thinkingLabel: s, components: c, urlTransform: l, codeBlockCopyLabel: u, codeBlockCopiedLabel: d,
|
|
7
|
+
var a = r(({ content: r, isPlainText: a, isStreaming: o, thinkingLabel: s, components: c, urlTransform: l, codeBlockCopyLabel: u, codeBlockCopiedLabel: d, codeBlockDownloadLabel: f, codeBlockTheme: p, tableActionLabels: m, tableDownloadFilename: h, tableOnOpenInCanvas: g, tableScrollRegionAriaLabel: _, mathScrollRegionAriaLabel: v, classNames: y = t }) => a ? /* @__PURE__ */ i(n, {
|
|
8
8
|
content: r,
|
|
9
9
|
isStreaming: o,
|
|
10
10
|
thinkingLabel: s,
|
|
11
|
-
classNames:
|
|
11
|
+
classNames: y
|
|
12
12
|
}) : /* @__PURE__ */ i(e, {
|
|
13
13
|
content: r,
|
|
14
14
|
isStreaming: o,
|
|
@@ -17,12 +17,14 @@ var a = r(({ content: r, isPlainText: a, isStreaming: o, thinkingLabel: s, compo
|
|
|
17
17
|
urlTransform: l,
|
|
18
18
|
codeBlockCopyLabel: u,
|
|
19
19
|
codeBlockCopiedLabel: d,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
codeBlockDownloadLabel: f,
|
|
21
|
+
codeBlockTheme: p,
|
|
22
|
+
tableActionLabels: m,
|
|
23
|
+
tableDownloadFilename: h,
|
|
24
|
+
tableOnOpenInCanvas: g,
|
|
25
|
+
tableScrollRegionAriaLabel: _,
|
|
26
|
+
mathScrollRegionAriaLabel: v,
|
|
27
|
+
classNames: y
|
|
26
28
|
}));
|
|
27
29
|
//#endregion
|
|
28
30
|
export { a as MDMessageViewer };
|
|
@@ -89,7 +89,7 @@ var E = [
|
|
|
89
89
|
}, z = (e) => {
|
|
90
90
|
let t = e?.properties?.align;
|
|
91
91
|
return typeof t == "string" ? R[t] : void 0;
|
|
92
|
-
}, B = (e) => e ? e.type === "text" ? e.value ?? "" : (e.children ?? []).map(B).join("") : "", V = (t, { isStreaming: n, codeBlockCopyLabel: r, codeBlockCopiedLabel: u,
|
|
92
|
+
}, B = (e) => e ? e.type === "text" ? e.value ?? "" : (e.children ?? []).map(B).join("") : "", V = (t, { isStreaming: n, codeBlockCopyLabel: r, codeBlockCopiedLabel: u, codeBlockDownloadLabel: d, codeBlockTheme: f, tableActionLabels: p, tableDownloadFilename: m, tableOnOpenInCanvas: h, tableScrollRegionAriaLabel: v, mathScrollRegionAriaLabel: y }) => ({
|
|
93
93
|
h1: ({ children: e }) => /* @__PURE__ */ _("h1", {
|
|
94
94
|
className: t.h1,
|
|
95
95
|
children: e
|
|
@@ -141,9 +141,10 @@ var E = [
|
|
|
141
141
|
language: c,
|
|
142
142
|
value: l.replace(/\n$/, ""),
|
|
143
143
|
isStreaming: n,
|
|
144
|
-
theme:
|
|
144
|
+
theme: f,
|
|
145
145
|
copyLabel: r,
|
|
146
146
|
copiedLabel: u,
|
|
147
|
+
downloadLabel: d,
|
|
147
148
|
containerClassName: t.codeBlockContainer,
|
|
148
149
|
headerClassName: t.codeBlockHeader,
|
|
149
150
|
codeClassName: t.codeFont
|
|
@@ -171,7 +172,7 @@ var E = [
|
|
|
171
172
|
input: ({ type: e, checked: t }) => e === "checkbox" ? /* @__PURE__ */ _(l, { checked: t ?? !1 }) : null,
|
|
172
173
|
span: ({ children: e, node: n, ...r }) => L(n) ? /* @__PURE__ */ _(o, {
|
|
173
174
|
className: t.mathBlock,
|
|
174
|
-
scrollRegionAriaLabel:
|
|
175
|
+
scrollRegionAriaLabel: y,
|
|
175
176
|
children: e
|
|
176
177
|
}) : /* @__PURE__ */ _("span", {
|
|
177
178
|
...r,
|
|
@@ -179,11 +180,11 @@ var E = [
|
|
|
179
180
|
}),
|
|
180
181
|
table: ({ children: e }) => /* @__PURE__ */ _(c, {
|
|
181
182
|
classNames: t,
|
|
182
|
-
actionLabels:
|
|
183
|
-
downloadFilename:
|
|
184
|
-
onOpenInCanvas:
|
|
183
|
+
actionLabels: p,
|
|
184
|
+
downloadFilename: m,
|
|
185
|
+
onOpenInCanvas: h,
|
|
185
186
|
isStreaming: n,
|
|
186
|
-
scrollRegionAriaLabel:
|
|
187
|
+
scrollRegionAriaLabel: v,
|
|
187
188
|
children: e
|
|
188
189
|
}),
|
|
189
190
|
tr: ({ children: t, node: n }) => {
|
|
@@ -202,47 +203,48 @@ var E = [
|
|
|
202
203
|
className: e("max-w-96 whitespace-normal px-3 py-[7px] align-top [overflow-wrap:anywhere]", z(r), s.rowDivider, t.tableBodyCell, t.tableCell),
|
|
203
204
|
children: n
|
|
204
205
|
})
|
|
205
|
-
}), H = f(({ content: e, containerClassName: i, isStreaming: a, streamCharactersPerSecond: o, classNames: s = P, components: c, urlTransform: l, rehypePlugins: d = j, thinkingLabel: f = "Thinking", codeBlockCopyLabel: g, codeBlockCopiedLabel: v,
|
|
206
|
-
let
|
|
206
|
+
}), H = f(({ content: e, containerClassName: i, isStreaming: a, streamCharactersPerSecond: o, classNames: s = P, components: c, urlTransform: l, rehypePlugins: d = j, thinkingLabel: f = "Thinking", codeBlockCopyLabel: g, codeBlockCopiedLabel: v, codeBlockDownloadLabel: b, codeBlockTheme: x, colors: S, tableActionLabels: C, tableDownloadFilename: w, tableOnOpenInCanvas: T, tableScrollRegionAriaLabel: D, mathScrollRegionAriaLabel: O }) => {
|
|
207
|
+
let M = n(e, a, o), L = m(() => r(M), [M]), R = m(() => N(L), [L]), [z, B] = h(null);
|
|
207
208
|
p(() => {
|
|
208
|
-
if (!
|
|
209
|
+
if (!R || z) return;
|
|
209
210
|
let e = !1;
|
|
210
211
|
return (async () => {
|
|
211
212
|
let [t] = await Promise.all([import("rehype-katex"), import("katex/dist/katex.min.css")]);
|
|
212
|
-
e ||
|
|
213
|
+
e || B([t.default, {
|
|
213
214
|
output: "mathml",
|
|
214
215
|
strict: !1
|
|
215
216
|
}]);
|
|
216
217
|
})(), () => {
|
|
217
218
|
e = !0;
|
|
218
219
|
};
|
|
219
|
-
}, [
|
|
220
|
-
let
|
|
220
|
+
}, [R, z]);
|
|
221
|
+
let H = m(() => [
|
|
221
222
|
...k,
|
|
222
|
-
...
|
|
223
|
+
...z ? [z] : [],
|
|
223
224
|
A,
|
|
224
225
|
...d
|
|
225
|
-
], [
|
|
226
|
-
"--cm-markdown-border":
|
|
227
|
-
"--cm-blockquote-border":
|
|
228
|
-
"--cm-blockquote-text":
|
|
229
|
-
"--cm-link-text":
|
|
230
|
-
"--cm-link-focus":
|
|
231
|
-
"--cm-table-header-text":
|
|
232
|
-
"--cm-h6-text":
|
|
233
|
-
"--cm-code-inline-bg":
|
|
234
|
-
"--cm-code-inline-text":
|
|
235
|
-
}),
|
|
226
|
+
], [z, d]), U = t({
|
|
227
|
+
"--cm-markdown-border": S?.border,
|
|
228
|
+
"--cm-blockquote-border": S?.blockquoteBorder,
|
|
229
|
+
"--cm-blockquote-text": S?.blockquoteText,
|
|
230
|
+
"--cm-link-text": S?.linkText,
|
|
231
|
+
"--cm-link-focus": S?.linkFocus,
|
|
232
|
+
"--cm-table-header-text": S?.tableHeaderText,
|
|
233
|
+
"--cm-h6-text": S?.headingSixText,
|
|
234
|
+
"--cm-code-inline-bg": S?.inlineCodeBackground,
|
|
235
|
+
"--cm-code-inline-text": S?.inlineCodeText
|
|
236
|
+
}), W = m(() => F(l), [l]), G = m(() => ({
|
|
236
237
|
...V(s, {
|
|
237
238
|
isStreaming: a,
|
|
238
239
|
codeBlockCopyLabel: g,
|
|
239
240
|
codeBlockCopiedLabel: v,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
241
|
+
codeBlockDownloadLabel: b,
|
|
242
|
+
codeBlockTheme: x,
|
|
243
|
+
tableActionLabels: C,
|
|
244
|
+
tableDownloadFilename: w,
|
|
245
|
+
tableOnOpenInCanvas: T,
|
|
246
|
+
tableScrollRegionAriaLabel: D,
|
|
247
|
+
mathScrollRegionAriaLabel: O
|
|
246
248
|
}),
|
|
247
249
|
...I,
|
|
248
250
|
...c
|
|
@@ -252,25 +254,26 @@ var E = [
|
|
|
252
254
|
g,
|
|
253
255
|
v,
|
|
254
256
|
b,
|
|
255
|
-
|
|
257
|
+
x,
|
|
256
258
|
C,
|
|
257
259
|
w,
|
|
258
260
|
T,
|
|
259
261
|
D,
|
|
262
|
+
O,
|
|
260
263
|
c
|
|
261
264
|
]);
|
|
262
|
-
return a && !
|
|
265
|
+
return a && !M ? /* @__PURE__ */ _(u, {
|
|
263
266
|
label: f,
|
|
264
|
-
colors:
|
|
267
|
+
colors: S
|
|
265
268
|
}) : /* @__PURE__ */ _("div", {
|
|
266
|
-
style:
|
|
269
|
+
style: U,
|
|
267
270
|
className: i,
|
|
268
271
|
children: /* @__PURE__ */ _(y, {
|
|
269
272
|
remarkPlugins: E,
|
|
270
|
-
rehypePlugins:
|
|
271
|
-
components:
|
|
272
|
-
urlTransform:
|
|
273
|
-
children:
|
|
273
|
+
rehypePlugins: H,
|
|
274
|
+
components: G,
|
|
275
|
+
urlTransform: W,
|
|
276
|
+
children: L
|
|
274
277
|
})
|
|
275
278
|
});
|
|
276
279
|
});
|
package/index.d.ts
CHANGED
|
@@ -1849,6 +1849,8 @@ export declare interface MarkdownRendererProps {
|
|
|
1849
1849
|
codeBlockCopyLabel?: string;
|
|
1850
1850
|
/** Accessible label for the copy button after copying. Defaults to `'Copied!'`. */
|
|
1851
1851
|
codeBlockCopiedLabel?: string;
|
|
1852
|
+
/** Accessible label for the download button in code blocks. Defaults to `'Download code'`. */
|
|
1853
|
+
codeBlockDownloadLabel?: string;
|
|
1852
1854
|
/** Syntax highlight color theme for code blocks and tables. Defaults to `'dark'`. */
|
|
1853
1855
|
codeBlockTheme?: CodeBlockTheme;
|
|
1854
1856
|
/** Color overrides applied as CSS custom properties. */
|
|
@@ -1990,6 +1992,8 @@ declare interface MDMessageViewerProps {
|
|
|
1990
1992
|
codeBlockCopyLabel?: string;
|
|
1991
1993
|
/** Accessible label for the copy button after copying. Forwarded to {@link MarkdownRenderer}. */
|
|
1992
1994
|
codeBlockCopiedLabel?: string;
|
|
1995
|
+
/** Accessible label for the code-block download button. Forwarded to {@link MarkdownRenderer}. */
|
|
1996
|
+
codeBlockDownloadLabel?: string;
|
|
1993
1997
|
/** Syntax highlight color theme for code blocks. Forwarded to {@link MarkdownRenderer}. */
|
|
1994
1998
|
codeBlockTheme?: CodeBlockTheme;
|
|
1995
1999
|
/** Localized labels for Markdown table actions. Forwarded to {@link MarkdownRenderer}. */
|
|
@@ -1999,6 +2003,8 @@ declare interface MDMessageViewerProps {
|
|
|
1999
2003
|
tableOnOpenInCanvas?: (markdown: string) => void;
|
|
2000
2004
|
/** Accessible label for a table's scrollable region. Forwarded to {@link MarkdownRenderer}. */
|
|
2001
2005
|
tableScrollRegionAriaLabel?: string;
|
|
2006
|
+
/** Accessible label for a block formula's scrollable region. Forwarded to {@link MarkdownRenderer}. */
|
|
2007
|
+
mathScrollRegionAriaLabel?: string;
|
|
2002
2008
|
/**
|
|
2003
2009
|
* Per-element typography classes. Defaults to {@link DEFAULT_MARKDOWN_CLASS_NAMES};
|
|
2004
2010
|
* pass {@link COMPACT_MARKDOWN_CLASS_NAMES} for the smaller body scale. Give a
|
package/markdown.d.ts
CHANGED
|
@@ -219,6 +219,8 @@ export declare interface MarkdownRendererProps {
|
|
|
219
219
|
codeBlockCopyLabel?: string;
|
|
220
220
|
/** Accessible label for the copy button after copying. Defaults to `'Copied!'`. */
|
|
221
221
|
codeBlockCopiedLabel?: string;
|
|
222
|
+
/** Accessible label for the download button in code blocks. Defaults to `'Download code'`. */
|
|
223
|
+
codeBlockDownloadLabel?: string;
|
|
222
224
|
/** Syntax highlight color theme for code blocks and tables. Defaults to `'dark'`. */
|
|
223
225
|
codeBlockTheme?: CodeBlockTheme;
|
|
224
226
|
/** Color overrides applied as CSS custom properties. */
|
|
@@ -353,6 +355,8 @@ declare interface MDMessageViewerProps {
|
|
|
353
355
|
codeBlockCopyLabel?: string;
|
|
354
356
|
/** Accessible label for the copy button after copying. Forwarded to {@link MarkdownRenderer}. */
|
|
355
357
|
codeBlockCopiedLabel?: string;
|
|
358
|
+
/** Accessible label for the code-block download button. Forwarded to {@link MarkdownRenderer}. */
|
|
359
|
+
codeBlockDownloadLabel?: string;
|
|
356
360
|
/** Syntax highlight color theme for code blocks. Forwarded to {@link MarkdownRenderer}. */
|
|
357
361
|
codeBlockTheme?: CodeBlockTheme;
|
|
358
362
|
/** Localized labels for Markdown table actions. Forwarded to {@link MarkdownRenderer}. */
|
|
@@ -362,6 +366,8 @@ declare interface MDMessageViewerProps {
|
|
|
362
366
|
tableOnOpenInCanvas?: (markdown: string) => void;
|
|
363
367
|
/** Accessible label for a table's scrollable region. Forwarded to {@link MarkdownRenderer}. */
|
|
364
368
|
tableScrollRegionAriaLabel?: string;
|
|
369
|
+
/** Accessible label for a block formula's scrollable region. Forwarded to {@link MarkdownRenderer}. */
|
|
370
|
+
mathScrollRegionAriaLabel?: string;
|
|
365
371
|
/**
|
|
366
372
|
* Per-element typography classes. Defaults to {@link DEFAULT_MARKDOWN_CLASS_NAMES};
|
|
367
373
|
* pass {@link COMPACT_MARKDOWN_CLASS_NAMES} for the smaller body scale. Give a
|
package/package.json
CHANGED