@epam/ai-dial-chat-shared 1.3.0-dev.45 → 1.3.0-dev.49
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/MarkdownRenderer/MDMessageViewer.d.ts +6 -2
- package/components/MarkdownRenderer/MDMessageViewer.d.ts.map +1 -1
- package/components/MarkdownRenderer/MDMessageViewer.js +14 -12
- package/components/MarkdownRenderer/MarkdownRenderer.d.ts +2 -0
- package/components/MarkdownRenderer/MarkdownRenderer.d.ts.map +1 -1
- package/components/MarkdownRenderer/MarkdownRenderer.js +136 -131
- package/entry-points/markdown.d.ts +1 -0
- package/entry-points/markdown.d.ts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +12 -11
- package/markdown.js +3 -2
- package/models/inline-segment.d.ts +11 -0
- package/models/inline-segment.d.ts.map +1 -0
- package/package.json +2 -2
- 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/markdown-html.d.ts +14 -0
- package/utils/markdown-html.d.ts.map +1 -0
- package/utils/markdown-html.js +11 -0
|
@@ -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 { MarkdownRendererClassNames } from './MarkdownRenderer';
|
|
5
5
|
import { MarkdownTableActionLabels } from './Table/MarkdownTable';
|
|
@@ -32,6 +32,10 @@ interface MDMessageViewerProps {
|
|
|
32
32
|
* {@link MarkdownRenderer}. Defaults to no extra rewrite.
|
|
33
33
|
*/
|
|
34
34
|
urlTransform?: (url: string) => string;
|
|
35
|
+
/** Extra rehype plugins forwarded to {@link MarkdownRenderer}. Defaults to none. */
|
|
36
|
+
rehypePlugins?: NonNullable<Options['rehypePlugins']>;
|
|
37
|
+
/** When `false`, raw HTML renders as literal text. Forwarded to {@link MarkdownRenderer}; defaults to `true`. */
|
|
38
|
+
isRawHtmlEnabled?: boolean;
|
|
35
39
|
/** Accessible label for the copy button in code blocks. Forwarded to {@link MarkdownRenderer}. */
|
|
36
40
|
codeBlockCopyLabel?: string;
|
|
37
41
|
/** Accessible label for the copy button after copying. Forwarded to {@link MarkdownRenderer}. */
|
|
@@ -56,7 +60,7 @@ interface MDMessageViewerProps {
|
|
|
56
60
|
*/
|
|
57
61
|
classNames?: MarkdownRendererClassNames;
|
|
58
62
|
}
|
|
59
|
-
/** Renders
|
|
63
|
+
/** Renders message content as formatted markdown, or as escaped plain text when `isPlainText` is set. */
|
|
60
64
|
export declare const MDMessageViewer: FC<MDMessageViewerProps>;
|
|
61
65
|
export {};
|
|
62
66
|
//# sourceMappingURL=MDMessageViewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDMessageViewer.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownRenderer/MDMessageViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"MDMessageViewer.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownRenderer/MDMessageViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,+DAA+D;AAC/D,UAAU,oBAAoB;IAC5B,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,oFAAoF;IACpF,aAAa,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;IACtD,iHAAiH;IACjH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kGAAkG;IAClG,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iGAAiG;IACjG,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kGAAkG;IAClG,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,2FAA2F;IAC3F,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,0FAA0F;IAC1F,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C,qGAAqG;IACrG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,+FAA+F;IAC/F,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,uGAAuG;IACvG,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,0BAA0B,CAAC;CACzC;AAED,yGAAyG;AACzG,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAiDpD,CAAC"}
|
|
@@ -4,27 +4,29 @@ 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,
|
|
7
|
+
var a = r(({ content: r, isPlainText: a, isStreaming: o, thinkingLabel: s, components: c, urlTransform: l, rehypePlugins: u, isRawHtmlEnabled: d, codeBlockCopyLabel: f, codeBlockCopiedLabel: p, codeBlockDownloadLabel: m, codeBlockTheme: h, tableActionLabels: g, tableDownloadFilename: _, tableOnOpenInCanvas: v, tableScrollRegionAriaLabel: y, mathScrollRegionAriaLabel: b, classNames: x = t }) => a ? /* @__PURE__ */ i(n, {
|
|
8
8
|
content: r,
|
|
9
9
|
isStreaming: o,
|
|
10
10
|
thinkingLabel: s,
|
|
11
|
-
classNames:
|
|
11
|
+
classNames: x
|
|
12
12
|
}) : /* @__PURE__ */ i(e, {
|
|
13
13
|
content: r,
|
|
14
14
|
isStreaming: o,
|
|
15
15
|
thinkingLabel: s,
|
|
16
16
|
components: c,
|
|
17
17
|
urlTransform: l,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
rehypePlugins: u,
|
|
19
|
+
isRawHtmlEnabled: d,
|
|
20
|
+
codeBlockCopyLabel: f,
|
|
21
|
+
codeBlockCopiedLabel: p,
|
|
22
|
+
codeBlockDownloadLabel: m,
|
|
23
|
+
codeBlockTheme: h,
|
|
24
|
+
tableActionLabels: g,
|
|
25
|
+
tableDownloadFilename: _,
|
|
26
|
+
tableOnOpenInCanvas: v,
|
|
27
|
+
tableScrollRegionAriaLabel: y,
|
|
28
|
+
mathScrollRegionAriaLabel: b,
|
|
29
|
+
classNames: x
|
|
28
30
|
}));
|
|
29
31
|
//#endregion
|
|
30
32
|
export { a as MDMessageViewer };
|
|
@@ -81,6 +81,8 @@ export interface MarkdownRendererProps {
|
|
|
81
81
|
urlTransform?: (url: string) => string;
|
|
82
82
|
/** Extra rehype plugins, applied after the built-in KaTeX pass. Defaults to none. */
|
|
83
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;
|
|
84
86
|
/**
|
|
85
87
|
* Label shown with a shimmer animation while `isStreaming` is true and no content has arrived yet.
|
|
86
88
|
* 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,EAKL,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AACf,OAAsB,EAEpB,KAAK,UAAU,EACf,KAAK,OAAO,EAEb,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownRenderer/MarkdownRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AACf,OAAsB,EAEpB,KAAK,UAAU,EACf,KAAK,OAAO,EAEb,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AASzD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAK/B,0EAA0E;AAC1E,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE,uBAAuB;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uBAAuB;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uBAAuB;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uBA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jE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,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;AAmLD,eAAO,MAAM,yBAAyB,EAAE,UAGvC,CAAC;AA+QF,oHAAoH;AACpH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA2JtD,CAAC"}
|
|
@@ -2,28 +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 {
|
|
7
|
-
import o from "./
|
|
8
|
-
import
|
|
9
|
-
import c from "./
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import f from "
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import S from "
|
|
18
|
-
import C
|
|
19
|
-
import T from "
|
|
20
|
-
import E from "remark-
|
|
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";
|
|
21
22
|
//#region src/components/MarkdownRenderer/MarkdownRenderer.tsx
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[
|
|
26
|
-
],
|
|
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 = {
|
|
27
28
|
math: ["display", "xmlns"],
|
|
28
29
|
annotation: ["encoding"],
|
|
29
30
|
mfrac: ["linethickness"],
|
|
@@ -52,134 +53,134 @@ var D = [
|
|
|
52
53
|
"width"
|
|
53
54
|
],
|
|
54
55
|
mtd: ["width"]
|
|
55
|
-
},
|
|
56
|
-
...
|
|
56
|
+
}, j = [C], M = [i], N = [w, {
|
|
57
|
+
...T,
|
|
57
58
|
tagNames: [
|
|
58
|
-
...
|
|
59
|
-
...
|
|
59
|
+
...T.tagNames ?? [],
|
|
60
|
+
...k,
|
|
60
61
|
"cit"
|
|
61
62
|
],
|
|
62
63
|
attributes: {
|
|
63
|
-
...
|
|
64
|
-
...
|
|
65
|
-
code: [...
|
|
64
|
+
...T.attributes,
|
|
65
|
+
...A,
|
|
66
|
+
code: [...T.attributes?.code ?? [], ["className"]],
|
|
66
67
|
cit: ["dataId"],
|
|
67
|
-
span: [...
|
|
68
|
+
span: [...T.attributes?.span ?? [], [
|
|
68
69
|
"className",
|
|
69
70
|
"katex",
|
|
70
71
|
"katex-error"
|
|
71
72
|
]]
|
|
72
73
|
}
|
|
73
|
-
}],
|
|
74
|
-
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", {
|
|
75
76
|
className: "mb-1.5 last:mb-0",
|
|
76
77
|
children: e
|
|
77
78
|
}),
|
|
78
|
-
cit: ({ children: e, ...t }) => /* @__PURE__ */
|
|
79
|
+
cit: ({ children: e, ...t }) => /* @__PURE__ */ b(v, { children: [
|
|
79
80
|
t["data-id"] == null ? "<cit>" : `<cit data-id="${t["data-id"]}">`,
|
|
80
81
|
e,
|
|
81
82
|
"</cit>"
|
|
82
83
|
] })
|
|
83
|
-
},
|
|
84
|
+
}, B = (e) => {
|
|
84
85
|
let t = e?.properties?.className;
|
|
85
86
|
return !Array.isArray(t) || !t.includes("katex") ? !1 : (e?.children ?? []).some((e) => e.type === "element" && e.tagName === "math" && e.properties?.display === "block");
|
|
86
|
-
},
|
|
87
|
+
}, V = {
|
|
87
88
|
left: "text-start",
|
|
88
89
|
center: "text-center",
|
|
89
90
|
right: "text-end"
|
|
90
|
-
},
|
|
91
|
+
}, H = (e) => {
|
|
91
92
|
let t = e?.properties?.align;
|
|
92
|
-
return typeof t == "string" ?
|
|
93
|
-
},
|
|
94
|
-
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", {
|
|
95
96
|
className: t.h1,
|
|
96
97
|
children: e
|
|
97
98
|
}),
|
|
98
|
-
h2: ({ children: e }) => /* @__PURE__ */
|
|
99
|
+
h2: ({ children: e }) => /* @__PURE__ */ y("h2", {
|
|
99
100
|
className: t.h2,
|
|
100
101
|
children: e
|
|
101
102
|
}),
|
|
102
|
-
h3: ({ children: e }) => /* @__PURE__ */
|
|
103
|
+
h3: ({ children: e }) => /* @__PURE__ */ y("h3", {
|
|
103
104
|
className: t.h3,
|
|
104
105
|
children: e
|
|
105
106
|
}),
|
|
106
|
-
h4: ({ children: e }) => /* @__PURE__ */
|
|
107
|
+
h4: ({ children: e }) => /* @__PURE__ */ y("h4", {
|
|
107
108
|
className: t.h4,
|
|
108
109
|
children: e
|
|
109
110
|
}),
|
|
110
|
-
h5: ({ children: e }) => /* @__PURE__ */
|
|
111
|
+
h5: ({ children: e }) => /* @__PURE__ */ y("h5", {
|
|
111
112
|
className: t.h5,
|
|
112
113
|
children: e
|
|
113
114
|
}),
|
|
114
|
-
h6: ({ children: n }) => /* @__PURE__ */
|
|
115
|
-
className: e(
|
|
115
|
+
h6: ({ children: n }) => /* @__PURE__ */ y("h6", {
|
|
116
|
+
className: e(s.h6, t.h6),
|
|
116
117
|
children: n
|
|
117
118
|
}),
|
|
118
|
-
p: ({ children: n }) => /* @__PURE__ */
|
|
119
|
+
p: ({ children: n }) => /* @__PURE__ */ y("p", {
|
|
119
120
|
className: e("break-words", t.p),
|
|
120
121
|
children: n
|
|
121
122
|
}),
|
|
122
|
-
ul: ({ children: n }) => /* @__PURE__ */
|
|
123
|
+
ul: ({ children: n }) => /* @__PURE__ */ y("ul", {
|
|
123
124
|
className: e("list-disc ps-[2em]", t.ul),
|
|
124
125
|
children: n
|
|
125
126
|
}),
|
|
126
|
-
ol: ({ children: n }) => /* @__PURE__ */
|
|
127
|
+
ol: ({ children: n }) => /* @__PURE__ */ y("ol", {
|
|
127
128
|
className: e("list-decimal ps-[2em]", t.ol),
|
|
128
129
|
children: n
|
|
129
130
|
}),
|
|
130
|
-
strong: ({ children: e }) => /* @__PURE__ */
|
|
131
|
+
strong: ({ children: e }) => /* @__PURE__ */ y("strong", {
|
|
131
132
|
className: t.strong ?? "dial-body-paragraph-semi-text",
|
|
132
133
|
children: e
|
|
133
134
|
}),
|
|
134
|
-
em: ({ children: e }) => /* @__PURE__ */
|
|
135
|
+
em: ({ children: e }) => /* @__PURE__ */ y("em", {
|
|
135
136
|
className: t.em ?? "italic",
|
|
136
137
|
children: e
|
|
137
138
|
}),
|
|
138
|
-
pre: ({ children: e }) => /* @__PURE__ */ v
|
|
139
|
-
code: ({ children:
|
|
140
|
-
let
|
|
141
|
-
return
|
|
142
|
-
language:
|
|
143
|
-
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$/, ""),
|
|
144
145
|
isStreaming: n,
|
|
145
146
|
theme: f,
|
|
146
147
|
copyLabel: r,
|
|
147
|
-
copiedLabel:
|
|
148
|
-
downloadLabel:
|
|
148
|
+
copiedLabel: i,
|
|
149
|
+
downloadLabel: o,
|
|
149
150
|
containerClassName: t.codeBlockContainer,
|
|
150
151
|
headerClassName: t.codeBlockHeader,
|
|
151
152
|
codeClassName: t.codeFont
|
|
152
|
-
}) : /* @__PURE__ */
|
|
153
|
-
className: e("rounded px-1 py-0.5",
|
|
154
|
-
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
|
|
155
156
|
});
|
|
156
157
|
},
|
|
157
|
-
blockquote: ({ children: n }) => /* @__PURE__ */
|
|
158
|
-
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),
|
|
159
160
|
children: n
|
|
160
161
|
}),
|
|
161
|
-
a: ({ href: n, children: r }) => /* @__PURE__ */
|
|
162
|
+
a: ({ href: n, children: r }) => /* @__PURE__ */ y("a", {
|
|
162
163
|
href: n,
|
|
163
164
|
target: "_blank",
|
|
164
165
|
rel: "noopener noreferrer",
|
|
165
|
-
className: e("decoration-current/60 break-words underline underline-offset-2 hover:decoration-current focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2",
|
|
166
|
+
className: e("decoration-current/60 break-words underline underline-offset-2 hover:decoration-current focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2", s.link, t.link),
|
|
166
167
|
children: r
|
|
167
168
|
}),
|
|
168
|
-
hr: () => /* @__PURE__ */
|
|
169
|
-
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", {
|
|
170
171
|
className: e("opacity-75", t.del),
|
|
171
172
|
children: n
|
|
172
173
|
}),
|
|
173
|
-
input: ({ type: e, checked: t }) => e === "checkbox" ? /* @__PURE__ */
|
|
174
|
-
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, {
|
|
175
176
|
className: t.mathBlock,
|
|
176
|
-
scrollRegionAriaLabel:
|
|
177
|
+
scrollRegionAriaLabel: _,
|
|
177
178
|
children: e
|
|
178
|
-
}) : /* @__PURE__ */
|
|
179
|
+
}) : /* @__PURE__ */ y("span", {
|
|
179
180
|
...r,
|
|
180
181
|
children: e
|
|
181
182
|
}),
|
|
182
|
-
table: ({ children: e }) => /* @__PURE__ */
|
|
183
|
+
table: ({ children: e }) => /* @__PURE__ */ y(u, {
|
|
183
184
|
classNames: t,
|
|
184
185
|
actionLabels: p,
|
|
185
186
|
downloadFilename: m,
|
|
@@ -189,95 +190,99 @@ var D = [
|
|
|
189
190
|
children: e
|
|
190
191
|
}),
|
|
191
192
|
tr: ({ children: t, node: n }) => {
|
|
192
|
-
let r = n?.children.filter((e) => e.type === "element") ?? [], i = r.some((e) => e.tagName === "th"), a = r.filter((e) =>
|
|
193
|
-
return /* @__PURE__ */
|
|
194
|
-
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),
|
|
195
196
|
children: t
|
|
196
197
|
});
|
|
197
198
|
},
|
|
198
|
-
th: ({ children: n, node: r }) => /* @__PURE__ */
|
|
199
|
+
th: ({ children: n, node: r }) => /* @__PURE__ */ y("th", {
|
|
199
200
|
scope: "col",
|
|
200
|
-
className: e("sticky top-0 z-[2] max-w-96 whitespace-normal break-words px-3 py-2.5 text-start",
|
|
201
|
+
className: e("sticky top-0 z-[2] max-w-96 whitespace-normal break-words px-3 py-2.5 text-start", H(r), l.rowDivider, l.tableHeaderCell, t.tableHeaderFont ?? "dial-tiny-lead-semi-text", t.tableCell, t.tableHeader),
|
|
201
202
|
children: n
|
|
202
203
|
}),
|
|
203
|
-
td: ({ children: n, node: r }) => /* @__PURE__ */
|
|
204
|
-
className: e("max-w-96 whitespace-normal px-3 py-[7px] align-top [overflow-wrap:anywhere]",
|
|
204
|
+
td: ({ children: n, node: r }) => /* @__PURE__ */ y("td", {
|
|
205
|
+
className: e("max-w-96 whitespace-normal px-3 py-[7px] align-top [overflow-wrap:anywhere]", H(r), l.rowDivider, t.tableBodyCell, t.tableCell),
|
|
205
206
|
children: n
|
|
206
207
|
})
|
|
207
|
-
}),
|
|
208
|
-
let
|
|
209
|
-
|
|
210
|
-
if (!
|
|
208
|
+
}), G = m(({ content: e, containerClassName: i, isStreaming: a, streamCharactersPerSecond: s, classNames: c = L, components: l, urlTransform: u, rehypePlugins: d = P, isRawHtmlEnabled: p = !0, thinkingLabel: m = "Thinking", codeBlockCopyLabel: v, codeBlockCopiedLabel: b, codeBlockDownloadLabel: S, codeBlockTheme: C, colors: w, tableActionLabels: T, tableDownloadFilename: E, tableOnOpenInCanvas: D, tableScrollRegionAriaLabel: k, mathScrollRegionAriaLabel: A }) => {
|
|
209
|
+
let F = n(e, a, s), B = g(() => r(F), [F]), V = g(() => I(B), [B]), [H, U] = _(null);
|
|
210
|
+
h(() => {
|
|
211
|
+
if (!V || H) return;
|
|
211
212
|
let e = !1;
|
|
212
213
|
return (async () => {
|
|
213
214
|
let [t] = await Promise.all([import("rehype-katex"), import("katex/dist/katex.min.css")]);
|
|
214
|
-
e ||
|
|
215
|
+
e || U([t.default, {
|
|
215
216
|
output: "mathml",
|
|
216
217
|
strict: !1
|
|
217
218
|
}]);
|
|
218
219
|
})(), () => {
|
|
219
220
|
e = !0;
|
|
220
221
|
};
|
|
221
|
-
}, [
|
|
222
|
-
let
|
|
223
|
-
...
|
|
224
|
-
...
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
...
|
|
228
|
-
], [
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
"--cm-
|
|
234
|
-
"--cm-
|
|
235
|
-
"--cm-
|
|
236
|
-
"--cm-
|
|
237
|
-
"--cm-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
222
|
+
}, [V, H]);
|
|
223
|
+
let G = g(() => [
|
|
224
|
+
...p ? j : M,
|
|
225
|
+
...H ? [H] : [],
|
|
226
|
+
N,
|
|
227
|
+
o,
|
|
228
|
+
...d
|
|
229
|
+
], [
|
|
230
|
+
p,
|
|
231
|
+
H,
|
|
232
|
+
d
|
|
233
|
+
]), K = t({
|
|
234
|
+
"--cm-markdown-border": w?.border,
|
|
235
|
+
"--cm-blockquote-border": w?.blockquoteBorder,
|
|
236
|
+
"--cm-blockquote-text": w?.blockquoteText,
|
|
237
|
+
"--cm-link-text": w?.linkText,
|
|
238
|
+
"--cm-link-focus": w?.linkFocus,
|
|
239
|
+
"--cm-table-header-text": w?.tableHeaderText,
|
|
240
|
+
"--cm-h6-text": w?.headingSixText,
|
|
241
|
+
"--cm-code-inline-bg": w?.inlineCodeBackground,
|
|
242
|
+
"--cm-code-inline-text": w?.inlineCodeText
|
|
243
|
+
}), q = g(() => R(u), [u]), J = g(() => ({
|
|
244
|
+
...W(c, {
|
|
245
|
+
isStreaming: a,
|
|
246
|
+
codeBlockCopyLabel: v,
|
|
247
|
+
codeBlockCopiedLabel: b,
|
|
248
|
+
codeBlockDownloadLabel: S,
|
|
249
|
+
codeBlockTheme: C,
|
|
250
|
+
tableActionLabels: T,
|
|
251
|
+
tableDownloadFilename: E,
|
|
252
|
+
tableOnOpenInCanvas: D,
|
|
253
|
+
tableScrollRegionAriaLabel: k,
|
|
254
|
+
mathScrollRegionAriaLabel: A
|
|
250
255
|
}),
|
|
251
|
-
...
|
|
256
|
+
...z,
|
|
252
257
|
...l
|
|
253
258
|
}), [
|
|
254
259
|
c,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
x,
|
|
260
|
+
a,
|
|
261
|
+
v,
|
|
262
|
+
b,
|
|
259
263
|
S,
|
|
260
|
-
|
|
264
|
+
C,
|
|
261
265
|
T,
|
|
262
266
|
E,
|
|
263
|
-
|
|
267
|
+
D,
|
|
264
268
|
k,
|
|
269
|
+
A,
|
|
265
270
|
l
|
|
266
271
|
]);
|
|
267
|
-
return
|
|
268
|
-
label:
|
|
269
|
-
colors:
|
|
270
|
-
}) : /* @__PURE__ */
|
|
271
|
-
style:
|
|
272
|
+
return a && !F ? /* @__PURE__ */ y(f, {
|
|
273
|
+
label: m,
|
|
274
|
+
colors: w
|
|
275
|
+
}) : /* @__PURE__ */ y("div", {
|
|
276
|
+
style: K,
|
|
272
277
|
className: i,
|
|
273
|
-
children: /* @__PURE__ */
|
|
274
|
-
remarkPlugins:
|
|
275
|
-
rehypePlugins:
|
|
276
|
-
components:
|
|
277
|
-
urlTransform:
|
|
278
|
-
children:
|
|
278
|
+
children: /* @__PURE__ */ y(x, {
|
|
279
|
+
remarkPlugins: O,
|
|
280
|
+
rehypePlugins: G,
|
|
281
|
+
components: J,
|
|
282
|
+
urlTransform: q,
|
|
283
|
+
children: B
|
|
279
284
|
})
|
|
280
285
|
});
|
|
281
286
|
});
|
|
282
287
|
//#endregion
|
|
283
|
-
export {
|
|
288
|
+
export { G as MarkdownRenderer, z as defaultMarkdownComponents };
|
|
@@ -12,6 +12,7 @@ export * from '../components/MarkdownRenderer/CodeBlock/CodeBlock';
|
|
|
12
12
|
export { restrainedSyntaxTheme } from '../components/MarkdownRenderer/CodeBlock/syntax-theme';
|
|
13
13
|
export * from '../components/MarkdownRenderer/Table/MarkdownTable';
|
|
14
14
|
export * from '../components/MarkdownWithPlaceholders/MarkdownWithPlaceholders';
|
|
15
|
+
export * from '../utils/inline-segments';
|
|
15
16
|
export * from '../hooks/useCodeCopy';
|
|
16
17
|
export * from '../hooks/useCollapsedText';
|
|
17
18
|
export { CHAT_SHARED_CLASS } from '../constants/public-class-names';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/entry-points/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC;AACpE,cAAc,oDAAoD,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAC9F,cAAc,oDAAoD,CAAC;AACnE,cAAc,iEAAiE,CAAC;AAChF,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/entry-points/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC;AACpE,cAAc,oDAAoD,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAC9F,cAAc,oDAAoD,CAAC;AACnE,cAAc,iEAAiE,CAAC;AAChF,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './models/custom-visualizer';
|
|
|
15
15
|
export * from './models/application-visualizer';
|
|
16
16
|
export * from './models/entity';
|
|
17
17
|
export * from './models/locale';
|
|
18
|
+
export * from './models/inline-segment';
|
|
18
19
|
export * from './types/attachment';
|
|
19
20
|
export * from './types/entity-type';
|
|
20
21
|
export * from './types/mime-type';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uCAAuC,CAAC;AACtD,cAAc,mBAAmB,CAAC;AAClC,cAAc,0CAA0C,CAAC;AACzD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB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AAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oCAAoC,CAAC;AACnD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,oDAAoD,CAAC;AACnE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,iDAAiD,CAAC;AAChE,cAAc,sDAAsD,CAAC;AACrE,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAY/C,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC"}
|
package/index.js
CHANGED
|
@@ -64,14 +64,15 @@ import { COMPACT_MARKDOWN_CLASS_NAMES as gt, DEFAULT_MARKDOWN_CLASS_NAMES as _t
|
|
|
64
64
|
import { PlainTextRenderer as vt } from "./components/MarkdownRenderer/PlainTextRenderer.js";
|
|
65
65
|
import { MDMessageViewer as yt } from "./components/MarkdownRenderer/MDMessageViewer.js";
|
|
66
66
|
import { MarkdownWithPlaceholders as bt } from "./components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js";
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
|
|
67
|
+
import { buildInlineSegmentSource as xt, createInlineSegmentComponents as St, createRehypeInlineSegments as Ct } from "./utils/inline-segments.js";
|
|
68
|
+
import { useCollapsedText as wt } from "./hooks/useCollapsedText.js";
|
|
69
|
+
import { useAvailableHeightCap as Tt } from "./hooks/useAvailableHeightCap.js";
|
|
70
|
+
import { useIsMobile as Et } from "./hooks/useIsMobile.js";
|
|
71
|
+
import { useUnsavedChangesGuard as Dt } from "./hooks/useUnsavedChangesGuard.js";
|
|
72
|
+
import { DialFileManagerActionProfile as Ot, DialFileManagerVariant as kt } from "./file-manager/file-manager-variant.js";
|
|
73
|
+
import { getParentFolderPath as At, isHiddenPath as jt } from "./file-manager/path.js";
|
|
74
|
+
import { FileUploadStatus as Mt, isUploadInProgress as Nt } from "./file-manager/upload-batch.js";
|
|
75
|
+
import { useGridEditingScroll as Pt } from "./file-manager/useGridEditingScroll/useGridEditingScroll.js";
|
|
76
|
+
import { OperationLoaderModal as Ft } from "./file-manager/OperationLoaderModal/OperationLoaderModal.js";
|
|
77
|
+
import { isSkillSelectionUnsupported as It } from "./utils/is-skill-selection-unsupported.js";
|
|
78
|
+
export { p as AttachmentErrorReason, m as AttachmentType, ye as BASE_LG_ICON_PROPS, be as BASE_MD_ICON_PROPS, o as BackgroundGenerationStatus, at as CHAT_SHARED_CLASS, gt as COMPACT_MARKDOWN_CLASS_NAMES, h as CatalogEntityType, v as CodeBlockTheme, Ze as ConfirmationDialog, Xe as ConfirmationFooter, qe as ConfirmationIdentityCard, Je as ConfirmationIdentityRow, Ye as ConfirmationView, e as ConversationTransferErrorCode, t as ConversationTransferJobStatus, n as ConversationTransferSubjectKind, r as ConversationTransferUnitKind, i as ConversationTransferWarningCode, Le as CopyButton, Re as CopyIconButton, _t as DEFAULT_MARKDOWN_CLASS_NAMES, lt as DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME, Qe as DELETE_CONFIRMATION_MAX_LISTED_NAMES, je as DESKTOP_BREAKPOINT_PX, Me as DESKTOP_MEDIA_QUERY, et as DeleteConfirmationDialog, $e as DeleteConfirmationView, Ie as DeploymentIcon, Ot as DialFileManagerActionProfile, kt as DialFileManagerVariant, I as ENTITY_DESCRIPTION_MAX_LENGTH, L as ENTITY_INSTRUCTIONS_MAX_LENGTH, R as ENTITY_NAME_MAX_LENGTH, le as ENTITY_TYPE_BG_COLOR, ue as ENTITY_TYPE_COLOR, Ge as EntityHeader, Ue as EntityTypeLabel, We as FeaturedChip, g as FileExtension, Mt as FileUploadStatus, a as FilterTab, xe as HIDDEN_FILE, Fe as InitialsAvatar, He as ItemHeader, we as MARKDOWN_EDITOR_FILL_HEIGHT_CLASS_NAME, Te as MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME, Oe as MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME, ut as MARKDOWN_TABLE_CSV_MIME_TYPE, yt as MDMessageViewer, _ as MIMEType, y as MIME_TYPE_ALIASES, b as MIME_TYPE_AUDIO_PREFIX, x as MIME_TYPE_EXT_MAP, S as MIME_TYPE_WILDCARD, Ne as MOBILE_MAX_WIDTH_PX, Pe as MOBILE_MEDIA_QUERY, ct as MarkdownCodeBlock, mt as MarkdownRenderer, pt as MarkdownTable, dt as MarkdownTableCopyFormat, bt as MarkdownWithPlaceholders, s as MessageRating, c as MessageRole, Ft as OperationLoaderModal, j as PROHIBITED_CONVERSATION_NAME_CHARS_RE, de as PROMPT_PARAM_DEFAULT_SEPARATOR, fe as PROMPT_PARAM_PATTERN, pe as PROMPT_VARIABLE_CLASS_NAME, Se as PUBLIC_BUCKET, Ve as PanelEmptyState, vt as PlainTextRenderer, Ee as RESIZABLE_FIELD_MAX_HEIGHT_CSS_VARIABLE, De as RESIZABLE_TEXTAREA_CLASS_NAME, l as RequestStatus, Ke as ResourceSummary, f as ResponseFormat, ke as SELECT_LIST_MAX_HEIGHT_CLASS_NAME, Ae as SELECT_LIST_MAX_HEIGHT_PX, u as StageStatus, d as StatusEvent, Ce as TAG_INPUT_TAG_CLASS_NAME, tt as TableHeader, it as TextRefinementField, nt as TextRefinementState, te as base64ToBlob, H as buildCssVars, xt as buildInlineSegmentSource, me as buildPromptParamDefaults, q as copyMarkdownAsRichText, J as copyToClipboard, St as createInlineSegmentComponents, Ct as createRehypeInlineSegments, ht as defaultMarkdownComponents, ne as downloadTextFile, re as ensureDownloadFilename, z as exceedsMaxLength, ze as extractInitials, he as extractPromptParams, Q as formatCost, Z as formatFileSize, X as formatLastUsed, $ as formatPrice, ee as formatUnitPrice, ve as generateUUID, C as getAttachmentTypeFromMime, w as getBaseMimeType, ie as getFileExtensionForLanguage, At as getParentFolderPath, M as getUtf8ByteLength, B as hasControlCharacters, T as inferMimeTypeFromPath, O as isAnnotationSelector, K as isAudioTranscriptionSupported, jt as isHiddenPath, It as isSkillSelectionUnsupported, U as isStatusMessage, ce as isSyntaxHighlightingAllowed, Nt as isUploadInProgress, Y as markdownToRichTextHtml, V as mergeClasses, W as messageAttachmentToDisplayAttachment, G as messageAttachmentsToDisplayAttachments, E as normalizeMimeType, k as normalizePersistedHtmlTagAttachmentType, A as normalizeRawAnnotations, Be as pickAvatarColor, ge as rehypePromptVariables, _e as resolvePromptParams, st as restrainedSyntaxTheme, N as sanitizeConversationName, ft as serializeMarkdownTableRows, P as stripTrailingDots, D as stripUrlQueryAndFragment, ae as triggerAnchorDownload, oe as triggerBlobDownload, F as truncateToUtf8Bytes, se as tryBase64ToBytes, Tt as useAvailableHeightCap, ot as useCodeCopy, wt as useCollapsedText, Pt as useGridEditingScroll, Et as useIsMobile, rt as useTextRefinement, Dt as useUnsavedChangesGuard };
|
package/markdown.js
CHANGED
|
@@ -9,5 +9,6 @@ import { COMPACT_MARKDOWN_CLASS_NAMES as d, DEFAULT_MARKDOWN_CLASS_NAMES as f }
|
|
|
9
9
|
import { PlainTextRenderer as p } from "./components/MarkdownRenderer/PlainTextRenderer.js";
|
|
10
10
|
import { MDMessageViewer as m } from "./components/MarkdownRenderer/MDMessageViewer.js";
|
|
11
11
|
import { MarkdownWithPlaceholders as h } from "./components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js";
|
|
12
|
-
import {
|
|
13
|
-
|
|
12
|
+
import { buildInlineSegmentSource as g, createInlineSegmentComponents as _, createRehypeInlineSegments as v } from "./utils/inline-segments.js";
|
|
13
|
+
import { useCollapsedText as y } from "./hooks/useCollapsedText.js";
|
|
14
|
+
export { e as CHAT_SHARED_CLASS, d as COMPACT_MARKDOWN_CLASS_NAMES, f as DEFAULT_MARKDOWN_CLASS_NAMES, i as DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME, a as MARKDOWN_TABLE_CSV_MIME_TYPE, m as MDMessageViewer, r as MarkdownCodeBlock, l as MarkdownRenderer, c as MarkdownTable, o as MarkdownTableCopyFormat, h as MarkdownWithPlaceholders, p as PlainTextRenderer, g as buildInlineSegmentSource, _ as createInlineSegmentComponents, v as createRehypeInlineSegments, u as defaultMarkdownComponents, n as restrainedSyntaxTheme, s as serializeMarkdownTableRows, t as useCodeCopy, y as useCollapsedText };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** An element rendered inline within message text, paired with the source text it stands for. */
|
|
3
|
+
export interface InlineTextSegment {
|
|
4
|
+
/** Literal source text the element replaces, rendered instead of `node` where an element cannot appear (inside code or link text). */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Element rendered at the segment's position in the text. */
|
|
7
|
+
node: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/** One run of message text: a plain markdown string or an inline element segment. */
|
|
10
|
+
export type TextSegment = string | InlineTextSegment;
|
|
11
|
+
//# sourceMappingURL=inline-segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-segment.d.ts","sourceRoot":"","sources":["../../src/models/inline-segment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,iGAAiG;AACjG,MAAM,WAAW,iBAAiB;IAChC,sIAAsI;IACtI,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,qFAAqF;AACrF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,iBAAiB,CAAC"}
|
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.3.0-dev.
|
|
4
|
+
"version": "1.3.0-dev.49",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "^19.2.8",
|
|
35
|
-
"@epam/ai-dial-ui-kit": "^0.15.
|
|
35
|
+
"@epam/ai-dial-ui-kit": "^0.15.4",
|
|
36
36
|
"@epam/ai-dial-react-file-manager": "^0.3.5",
|
|
37
37
|
"ag-grid-community": "^35.3.0"
|
|
38
38
|
},
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Components } from 'react-markdown';
|
|
2
|
+
import { InlineTextSegment, TextSegment } from '../models/inline-segment';
|
|
3
|
+
/** Minimal hast shapes the inline-segment plugin reads and writes. */
|
|
4
|
+
interface HastNode {
|
|
5
|
+
type: string;
|
|
6
|
+
tagName?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
properties?: Record<string, unknown>;
|
|
9
|
+
children?: HastNode[];
|
|
10
|
+
}
|
|
11
|
+
/** Markdown source with inline segments replaced by placeholder tokens. */
|
|
12
|
+
export interface InlineSegmentSource {
|
|
13
|
+
/** Markdown source to render, with one token per inline segment. */
|
|
14
|
+
source: string;
|
|
15
|
+
/** Inline segments in token order; a token's number is its index here. */
|
|
16
|
+
inlineSegments: InlineTextSegment[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns the markdown source for `segments`, with every inline segment
|
|
20
|
+
* replaced by a placeholder token, or the plain concatenated text (and no
|
|
21
|
+
* inline segments) when a string run already contains a token character.
|
|
22
|
+
*/
|
|
23
|
+
export declare const buildInlineSegmentSource: (segments: TextSegment[]) => InlineSegmentSource;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a rehype plugin that turns each placeholder token from
|
|
26
|
+
* {@link buildInlineSegmentSource} into an inline-segment element, or into
|
|
27
|
+
* the segment's literal text inside code, preformatted and link elements and
|
|
28
|
+
* inside `href`/`src` values. Run it after sanitization, which would strip
|
|
29
|
+
* the element.
|
|
30
|
+
*/
|
|
31
|
+
export declare const createRehypeInlineSegments: (inlineSegments: InlineTextSegment[]) => () => (tree: HastNode) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the react-markdown component overrides that render each
|
|
34
|
+
* inline-segment element as its segment's `node`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const createInlineSegmentComponents: (inlineSegments: InlineTextSegment[]) => Components;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=inline-segments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-segments.d.ts","sourceRoot":"","sources":["../../src/utils/inline-segments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA6B/E,sEAAsE;AACtE,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,cAAc,EAAE,iBAAiB,EAAE,CAAC;CACrC;AAQD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,WAAW,EAAE,KACtB,mBAuBF,CAAC;AA+EF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACpC,gBAAgB,iBAAiB,EAAE,YAAY,MAAM,QAAQ,SAE7D,CAAC;AAQJ;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GACxC,gBAAgB,iBAAiB,EAAE,KAClC,UAWF,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/utils/inline-segments.ts
|
|
2
|
+
var e = "", t = "", n = RegExp(`${e}(\\d+)${t}`, "g"), r = RegExp(`${encodeURI(e)}(\\d+)${encodeURI(t)}`, "gi"), i = "dial-inline-segment", a = new Set([
|
|
3
|
+
"code",
|
|
4
|
+
"pre",
|
|
5
|
+
"a"
|
|
6
|
+
]), o = ["href", "src"], s = (e) => typeof e != "string", c = (n) => n.includes(e) || n.includes(t), l = (n) => {
|
|
7
|
+
if (n.some((e) => !s(e) && c(e))) return {
|
|
8
|
+
source: n.map((e) => s(e) ? e.text : e).join(""),
|
|
9
|
+
inlineSegments: []
|
|
10
|
+
};
|
|
11
|
+
let r = [];
|
|
12
|
+
return {
|
|
13
|
+
source: n.map((n) => s(n) ? (r.push(n), `${e}${r.length - 1}${t}`) : n).join(""),
|
|
14
|
+
inlineSegments: r
|
|
15
|
+
};
|
|
16
|
+
}, u = (e, t) => e.replace(n, (e, n) => t[Number(n)]?.text ?? e), d = (e) => {
|
|
17
|
+
let t = [], r = 0;
|
|
18
|
+
for (let a of e.matchAll(n)) a.index > r && t.push({
|
|
19
|
+
type: "text",
|
|
20
|
+
value: e.slice(r, a.index)
|
|
21
|
+
}), t.push({
|
|
22
|
+
type: "element",
|
|
23
|
+
tagName: i,
|
|
24
|
+
properties: { dataIndex: Number(a[1]) },
|
|
25
|
+
children: []
|
|
26
|
+
}), r = a.index + a[0].length;
|
|
27
|
+
return r < e.length && t.push({
|
|
28
|
+
type: "text",
|
|
29
|
+
value: e.slice(r)
|
|
30
|
+
}), t;
|
|
31
|
+
}, f = (e, t) => {
|
|
32
|
+
e.properties != null && o.forEach((n) => {
|
|
33
|
+
let i = e.properties?.[n];
|
|
34
|
+
typeof i == "string" && e.properties && (e.properties[n] = u(i, t).replace(r, (e, n) => {
|
|
35
|
+
let r = t[Number(n)]?.text;
|
|
36
|
+
return r == null ? e : encodeURI(r);
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
}, p = (e, t, n) => {
|
|
40
|
+
if (f(e, t), e.children == null) return;
|
|
41
|
+
let r = n || e.tagName != null && a.has(e.tagName);
|
|
42
|
+
e.children = e.children.flatMap((e) => e.type !== "text" || e.value == null ? (p(e, t, r), [e]) : r ? [{
|
|
43
|
+
...e,
|
|
44
|
+
value: u(e.value, t)
|
|
45
|
+
}] : d(e.value));
|
|
46
|
+
}, m = (e) => () => (t) => {
|
|
47
|
+
p(t, e, !1);
|
|
48
|
+
}, h = (e) => {
|
|
49
|
+
let t = ({ node: t }) => e[Number(t?.properties?.dataIndex)]?.node ?? null;
|
|
50
|
+
return { [i]: t };
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { l as buildInlineSegmentSource, h as createInlineSegmentComponents, m as createRehypeInlineSegments };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Minimal hast shape this plugin reads and writes. */
|
|
2
|
+
interface HastNode {
|
|
3
|
+
type: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
children?: HastNode[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Rehype plugin that turns every raw HTML node into a text node, so markup in
|
|
9
|
+
* the source renders as the literal characters the author typed instead of
|
|
10
|
+
* being dropped by sanitization.
|
|
11
|
+
*/
|
|
12
|
+
export declare const rehypeRawAsText: () => (tree: HastNode) => void;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=markdown-html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-html.d.ts","sourceRoot":"","sources":["../../src/utils/markdown-html.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAcD;;;;GAIG;AACH,eAAO,MAAM,eAAe,SAAU,MAAM,QAAQ,SAEnD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/markdown-html.ts
|
|
2
|
+
var e = (t) => {
|
|
3
|
+
t.children != null && (t.children = t.children.map((t) => t.type === "raw" ? {
|
|
4
|
+
type: "text",
|
|
5
|
+
value: t.value ?? ""
|
|
6
|
+
} : (e(t), t)));
|
|
7
|
+
}, t = () => (t) => {
|
|
8
|
+
e(t);
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as rehypeRawAsText };
|