@epam/ai-dial-chat-shared 1.1.0-dev.162 → 1.1.0-dev.168
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { Components } from 'react-markdown';
|
|
2
|
+
import { Components, Options } from 'react-markdown';
|
|
3
3
|
import { CodeBlockTheme } from '../../types/code-editor';
|
|
4
4
|
import { MarkdownTableClassNames } from './Table/MarkdownTable';
|
|
5
5
|
/** Per-element className overrides passed to {@link MarkdownRenderer}. */
|
|
@@ -73,6 +73,8 @@ export interface MarkdownRendererProps {
|
|
|
73
73
|
* Use for elements not covered by `classNames`.
|
|
74
74
|
*/
|
|
75
75
|
components?: Components;
|
|
76
|
+
/** Extra rehype plugins, applied after the built-in KaTeX pass. Defaults to none. */
|
|
77
|
+
rehypePlugins?: NonNullable<Options['rehypePlugins']>;
|
|
76
78
|
/**
|
|
77
79
|
* Label shown with a shimmer animation while `isStreaming` is true and no content has arrived yet.
|
|
78
80
|
* Defaults to `'Thinking'`. Pass a translated string from the consuming app.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownRenderer/MarkdownRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAiB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAsB,EAAE,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownRenderer/MarkdownRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAiB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAsB,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM9E,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/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAwBD,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,EAAE,UAEvC,CAAC;AAkLF,oHAAoH;AACpH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAmFtD,CAAC"}
|
package/index.js
CHANGED
|
@@ -50380,10 +50380,10 @@ var $k = 2e3, eA = (e, t = $k) => {
|
|
|
50380
50380
|
], gA = [[xS, {
|
|
50381
50381
|
output: "mathml",
|
|
50382
50382
|
strict: !1
|
|
50383
|
-
}]], _A = {},
|
|
50383
|
+
}]], _A = [], vA = {}, yA = { li: ({ children: e }) => /* @__PURE__ */ y("li", {
|
|
50384
50384
|
className: "mb-1.5 last:mb-0",
|
|
50385
50385
|
children: e
|
|
50386
|
-
}) },
|
|
50386
|
+
}) }, bA = (e) => e ? e.type === "text" ? e.value ?? "" : (e.children ?? []).map(bA).join("") : "", xA = (e, t, n, r, i, a) => ({
|
|
50387
50387
|
h1: ({ children: t }) => /* @__PURE__ */ y("h1", {
|
|
50388
50388
|
className: e.h1,
|
|
50389
50389
|
children: t
|
|
@@ -50469,7 +50469,7 @@ var $k = 2e3, eA = (e, t = $k) => {
|
|
|
50469
50469
|
children: t
|
|
50470
50470
|
}),
|
|
50471
50471
|
tr: ({ children: e, node: t }) => {
|
|
50472
|
-
let n = t?.children.filter((e) => e.type === "element") ?? [], r = n.some((e) => e.tagName === "th"), i = n.filter((e) =>
|
|
50472
|
+
let n = t?.children.filter((e) => e.type === "element") ?? [], r = n.some((e) => e.tagName === "th"), i = n.filter((e) => bA(e).trim().length > 0).length, a = !r && n.length > 1 && i === 1;
|
|
50473
50473
|
return /* @__PURE__ */ y("tr", {
|
|
50474
50474
|
className: Ut(fA.row, a && fA.sectionRow),
|
|
50475
50475
|
children: e
|
|
@@ -50484,46 +50484,46 @@ var $k = 2e3, eA = (e, t = $k) => {
|
|
|
50484
50484
|
className: Ut("max-w-96 whitespace-normal break-words border-b px-3 py-2.5 align-top [overflow-wrap:anywhere]", fA.rowDivider, e.tableBodyCell, e.tableCell),
|
|
50485
50485
|
children: t
|
|
50486
50486
|
})
|
|
50487
|
-
}),
|
|
50488
|
-
let
|
|
50489
|
-
"--cm-thinking-inverted":
|
|
50490
|
-
"--cm-thinking-secondary":
|
|
50491
|
-
"--cm-markdown-border":
|
|
50492
|
-
"--cm-blockquote-border":
|
|
50493
|
-
"--cm-blockquote-text":
|
|
50494
|
-
"--cm-link-text":
|
|
50495
|
-
"--cm-link-focus":
|
|
50496
|
-
"--cm-table-header-text":
|
|
50497
|
-
"--cm-h6-text":
|
|
50498
|
-
"--cm-code-inline-bg":
|
|
50499
|
-
"--cm-code-inline-text":
|
|
50500
|
-
}),
|
|
50501
|
-
...
|
|
50502
|
-
...
|
|
50487
|
+
}), SA = u(({ content: e, isStreaming: t, streamCharactersPerSecond: n, classNames: r = vA, components: i, rehypePlugins: a = _A, thinkingLabel: o = "Thinking", codeBlockCopyLabel: s, codeBlockCopiedLabel: c, codeBlockTheme: l, colors: u, tableScrollRegionAriaLabel: d }) => {
|
|
50488
|
+
let f = ZS(e, t, n), p = h(() => sC(f), [f]), m = Wt({
|
|
50489
|
+
"--cm-thinking-inverted": u?.thinkingPrimary,
|
|
50490
|
+
"--cm-thinking-secondary": u?.thinkingSecondary,
|
|
50491
|
+
"--cm-markdown-border": u?.border,
|
|
50492
|
+
"--cm-blockquote-border": u?.blockquoteBorder,
|
|
50493
|
+
"--cm-blockquote-text": u?.blockquoteText,
|
|
50494
|
+
"--cm-link-text": u?.linkText,
|
|
50495
|
+
"--cm-link-focus": u?.linkFocus,
|
|
50496
|
+
"--cm-table-header-text": u?.tableHeaderText,
|
|
50497
|
+
"--cm-h6-text": u?.headingSixText,
|
|
50498
|
+
"--cm-code-inline-bg": u?.inlineCodeBackground,
|
|
50499
|
+
"--cm-code-inline-text": u?.inlineCodeText
|
|
50500
|
+
}), g = h(() => ({
|
|
50501
|
+
...xA(r, t, s, c, l, d),
|
|
50502
|
+
...yA,
|
|
50503
50503
|
...i
|
|
50504
50504
|
}), [
|
|
50505
50505
|
r,
|
|
50506
50506
|
t,
|
|
50507
|
-
o,
|
|
50508
50507
|
s,
|
|
50509
50508
|
c,
|
|
50510
|
-
|
|
50509
|
+
l,
|
|
50510
|
+
d,
|
|
50511
50511
|
i
|
|
50512
50512
|
]);
|
|
50513
|
-
return t && !
|
|
50513
|
+
return t && !f ? /* @__PURE__ */ y("span", {
|
|
50514
50514
|
className: lA.thinking,
|
|
50515
|
-
style:
|
|
50516
|
-
children:
|
|
50515
|
+
style: m,
|
|
50516
|
+
children: o
|
|
50517
50517
|
}) : /* @__PURE__ */ y("div", {
|
|
50518
|
-
style:
|
|
50518
|
+
style: m,
|
|
50519
50519
|
children: /* @__PURE__ */ y(uh, {
|
|
50520
50520
|
remarkPlugins: hA,
|
|
50521
|
-
rehypePlugins: gA,
|
|
50522
|
-
components:
|
|
50523
|
-
children:
|
|
50521
|
+
rehypePlugins: [...gA, ...a],
|
|
50522
|
+
components: g,
|
|
50523
|
+
children: p
|
|
50524
50524
|
})
|
|
50525
50525
|
});
|
|
50526
|
-
}),
|
|
50526
|
+
}), CA = {
|
|
50527
50527
|
h1: "dial-h1-text mb-3 mt-6 first:mt-0 [text-wrap:balance]",
|
|
50528
50528
|
h2: "dial-h2-text mb-2 mt-5 first:mt-0 [text-wrap:balance]",
|
|
50529
50529
|
h3: "dial-h3-text mb-2 mt-4 first:mt-0 [text-wrap:balance]",
|
|
@@ -50537,7 +50537,7 @@ var $k = 2e3, eA = (e, t = $k) => {
|
|
|
50537
50537
|
blockquote: "my-4",
|
|
50538
50538
|
link: "break-words [overflow-wrap:anywhere]",
|
|
50539
50539
|
tableWrapper: "my-4"
|
|
50540
|
-
},
|
|
50540
|
+
}, wA = u(({ content: e, isStreaming: t, thinkingLabel: n, components: r, codeBlockCopyLabel: i, codeBlockCopiedLabel: a, codeBlockTheme: o }) => /* @__PURE__ */ y(SA, {
|
|
50541
50541
|
content: e,
|
|
50542
50542
|
isStreaming: t,
|
|
50543
50543
|
thinkingLabel: n,
|
|
@@ -50545,23 +50545,23 @@ var $k = 2e3, eA = (e, t = $k) => {
|
|
|
50545
50545
|
codeBlockCopyLabel: i,
|
|
50546
50546
|
codeBlockCopiedLabel: a,
|
|
50547
50547
|
codeBlockTheme: o,
|
|
50548
|
-
classNames:
|
|
50549
|
-
})),
|
|
50550
|
-
let [e, t] = _(
|
|
50548
|
+
classNames: CA
|
|
50549
|
+
})), TA = "(max-width: 768px)", EA = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(TA).matches, DA = () => {
|
|
50550
|
+
let [e, t] = _(EA);
|
|
50551
50551
|
return f(() => {
|
|
50552
50552
|
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
50553
|
-
let e = window.matchMedia(
|
|
50553
|
+
let e = window.matchMedia(TA), n = () => t(e.matches);
|
|
50554
50554
|
return e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
50555
50555
|
}, []), e;
|
|
50556
|
-
},
|
|
50557
|
-
let n = Math.max(1, t), [r, i] = _(null), [a, o] = _(!0), [s, c] = _(!1), [l, u] = _(
|
|
50556
|
+
}, OA = 24, kA = 1, AA = ({ text: e, collapsedLineCount: t }) => {
|
|
50557
|
+
let n = Math.max(1, t), [r, i] = _(null), [a, o] = _(!0), [s, c] = _(!1), [l, u] = _(OA * n), [p, m] = _(0), h = d((e) => {
|
|
50558
50558
|
i(e);
|
|
50559
50559
|
}, []), g = d(() => {
|
|
50560
50560
|
if (!r) return;
|
|
50561
50561
|
let e = window.getComputedStyle(r), t = Number.parseFloat(e.fontSize), i = Number.isNaN(t) ? 16 : t, a = Number.parseFloat(e.lineHeight), o = i * 1.5;
|
|
50562
50562
|
e.lineHeight !== "normal" && !Number.isNaN(a) && (o = e.lineHeight.endsWith("px") ? a : a * i);
|
|
50563
50563
|
let s = o * n;
|
|
50564
|
-
u(s), m(r.scrollHeight), c(r.scrollHeight - s >
|
|
50564
|
+
u(s), m(r.scrollHeight), c(r.scrollHeight - s > kA);
|
|
50565
50565
|
}, [r, n]);
|
|
50566
50566
|
f(() => {
|
|
50567
50567
|
o(!0);
|
|
@@ -50588,4 +50588,4 @@ var $k = 2e3, eA = (e, t = $k) => {
|
|
|
50588
50588
|
};
|
|
50589
50589
|
};
|
|
50590
50590
|
//#endregion
|
|
50591
|
-
export { ce as AttachmentErrorReason, le as AttachmentType, om as BASE_LG_ICON_PROPS, am as BASE_MD_ICON_PROPS, fe as CodeBlockTheme, xm as CopyButton, bm as CopyIconButton,
|
|
50591
|
+
export { ce as AttachmentErrorReason, le as AttachmentType, om as BASE_LG_ICON_PROPS, am as BASE_MD_ICON_PROPS, fe as CodeBlockTheme, xm as CopyButton, bm as CopyIconButton, CA as DEFAULT_MARKDOWN_CLASS_NAMES, mm as DeploymentIcon, de as FileExtension, sm as HIDDEN_FILE, fm as InitialsAvatar, wA as MDMessageViewer, ue as MIMEType, en as MIME_TYPE_AUDIO_PREFIX, Qt as MIME_TYPE_EXT_MAP, $t as MIME_TYPE_WILDCARD, cA as MarkdownCodeBlock, SA as MarkdownRenderer, pA as MarkdownTable, ie as MessageRating, re as MessageRole, Cm as PanelEmptyState, se as RequestStatus, O as ResponseFormat, ae as StageStatus, oe as StatusEvent, rm as base64ToBlob, Wt as buildCssVars, Up as copyMarkdownAsRichText, Wp as copyToClipboard, yA as defaultMarkdownComponents, im as downloadTextFile, dm as extractInitials, Xp as formatFileSize, Kp as formatLastUsed, Qp as getFileExtensionForLanguage, he as getUtf8ByteLength, tn as isAudioTranscriptionSupported, Gt as isStatusMessage, Ut as mergeClasses, Xt as messageAttachmentToDisplayAttachment, Zt as messageAttachmentsToDisplayAttachments, lm as pickAvatarColor, oA as restrainedSyntaxTheme, em as triggerAnchorDownload, tm as triggerBlobDownload, ge as truncateToUtf8Bytes, nm as tryBase64ToBytes, eA as useCodeCopy, AA as useCollapsedText, DA as useIsMobile };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-chat-shared",
|
|
3
3
|
"description": "Shared domain models, utilities, and UI components for AI DIAL Chat libraries",
|
|
4
|
-
"version": "1.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.168",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|