markdown-flow-ui 0.1.100-beta.38 → 0.1.100-beta.39
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/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js.map +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
- package/dist/_virtual/index.cjs10.js +1 -1
- package/dist/_virtual/index.cjs11.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.cjs8.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es10.js +3 -2
- package/dist/_virtual/index.es10.js.map +1 -1
- package/dist/_virtual/index.es11.js +2 -3
- package/dist/_virtual/index.es11.js.map +1 -1
- package/dist/_virtual/index.es5.js +4 -4
- package/dist/_virtual/index.es6.js +4 -4
- package/dist/_virtual/index.es8.js +2 -3
- package/dist/_virtual/index.es8.js.map +1 -1
- package/dist/_virtual/index.es9.js +3 -2
- package/dist/_virtual/index.es9.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.es.js +140 -211
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/package.json +1 -1
|
@@ -1,187 +1,162 @@
|
|
|
1
1
|
import { j as t } from "../../_virtual/jsx-runtime.es.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { sanitizeInvalidTagName as
|
|
7
|
-
import { stripSvgTextLineBreaks as
|
|
4
|
+
import D, { useMemo as B, useRef as W, useEffect as z } from "react";
|
|
5
|
+
import P from "../../_virtual/index.es.js";
|
|
6
|
+
import { sanitizeInvalidTagName as _ } from "./utils/sanitize-invalid-tag-name.es.js";
|
|
7
|
+
import { stripSvgTextLineBreaks as F } from "./utils/strip-svg-text-line-breaks.es.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { preserveCustomVariableProperties as
|
|
15
|
-
import { subsetLanguages as
|
|
16
|
-
import { parseMarkdownSegments as
|
|
17
|
-
import { normalizeInlineHtml as
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return G(() => {
|
|
31
|
-
const a = o.current;
|
|
10
|
+
import U from "./CodeBlock.es.js";
|
|
11
|
+
import q from "./plugins/CustomVariable.es.js";
|
|
12
|
+
import V from "./plugins/MermaidChart.es.js";
|
|
13
|
+
import G from "./useTypewriterStateMachine.es.js";
|
|
14
|
+
import { preserveCustomVariableProperties as K, restoreCustomVariableProperties as J } from "./utils/custom-variable-props.es.js";
|
|
15
|
+
import { subsetLanguages as Q, highlightLanguages as X } from "./utils/highlight-languages.es.js";
|
|
16
|
+
import { parseMarkdownSegments as Y, mermaidBlockIsComplete as Z } from "./utils/mermaid-parse.es.js";
|
|
17
|
+
import { normalizeInlineHtml as E } from "./utils/normalize-inline-html.es.js";
|
|
18
|
+
import { getInteractionDefaultValues as O, getInteractionDefaultSelectedValues as ee } from "../../lib/interaction-defaults.es.js";
|
|
19
|
+
import { Markdown as te } from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/react-markdown@10.1.0_@types_react@19.2.2_react@19.0.1/node_modules/react-markdown/lib/index.es.js";
|
|
20
|
+
import re from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.es.js";
|
|
21
|
+
import se from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-highlight@7.0.2/node_modules/rehype-highlight/lib/index.es.js";
|
|
22
|
+
import ne from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-katex@7.0.1/node_modules/rehype-katex/lib/index.es.js";
|
|
23
|
+
import oe from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.es.js";
|
|
24
|
+
import ie from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-math@6.0.0/node_modules/remark-math/lib/index.es.js";
|
|
25
|
+
import ae from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-breaks@4.0.0/node_modules/remark-breaks/lib/index.es.js";
|
|
26
|
+
const ce = ({ svg: n }) => {
|
|
27
|
+
const l = W(null);
|
|
28
|
+
return z(() => {
|
|
29
|
+
const a = l.current;
|
|
32
30
|
if (!a) return;
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
|
|
31
|
+
const c = a.shadowRoot ?? a.attachShadow({ mode: "open" }), N = "content-render-svg-style";
|
|
32
|
+
let i = c.getElementById(N);
|
|
33
|
+
i || (i = document.createElement("style"), i.id = N, i.textContent = `
|
|
36
34
|
svg { height: auto; display: inline-block; }
|
|
37
35
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
38
36
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
39
|
-
`,
|
|
40
|
-
(
|
|
41
|
-
).forEach((
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const [, ,
|
|
51
|
-
if (!
|
|
52
|
-
const
|
|
53
|
-
return
|
|
54
|
-
},
|
|
55
|
-
if (!
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
37
|
+
`, c.appendChild(i)), Array.from(c.childNodes).filter(
|
|
38
|
+
(r) => r !== i
|
|
39
|
+
).forEach((r) => c.removeChild(r));
|
|
40
|
+
const j = document.createElement("template"), T = F(n);
|
|
41
|
+
j.innerHTML = T, c.append(j.content.cloneNode(!0));
|
|
42
|
+
let x = !1, w = !1;
|
|
43
|
+
c.querySelectorAll("svg").forEach((r) => {
|
|
44
|
+
const k = r.getAttribute("viewBox");
|
|
45
|
+
if (!k) return;
|
|
46
|
+
const v = k.trim().split(/[\s,]+/).map((s) => Number(s));
|
|
47
|
+
if (v.length !== 4 || v.some(Number.isNaN)) return;
|
|
48
|
+
const [, , u, m] = v, h = r.getAttribute("width"), d = r.getAttribute("height"), y = (s) => {
|
|
49
|
+
if (!s) return !1;
|
|
50
|
+
const o = s.trim().toLowerCase();
|
|
51
|
+
return o === "auto" || o.endsWith("%");
|
|
52
|
+
}, R = (s) => {
|
|
53
|
+
if (!s) return null;
|
|
54
|
+
const o = s.trim().toLowerCase();
|
|
55
|
+
if (o === "auto" || o.endsWith("%"))
|
|
58
56
|
return null;
|
|
59
|
-
const
|
|
60
|
-
return Number.isNaN(
|
|
61
|
-
},
|
|
62
|
-
if (
|
|
63
|
-
|
|
57
|
+
const b = Number.parseFloat(o);
|
|
58
|
+
return Number.isNaN(b) ? null : b;
|
|
59
|
+
}, A = y(h), I = y(d), C = !h || h === "0", f = !d || d === "0", L = R(h), M = R(d);
|
|
60
|
+
if (A || I || C && f || L === u && M === m) {
|
|
61
|
+
x = !0, r.classList.add("content-render-svg-el--responsive"), r.classList.remove("content-render-svg-el--fixed"), r.style.width = "100%", r.style.height = "auto", !r.style.aspectRatio && m > 0 && (r.style.aspectRatio = `${u} / ${m}`);
|
|
64
62
|
return;
|
|
65
63
|
}
|
|
66
|
-
|
|
64
|
+
w = !0, r.classList.add("content-render-svg-el--fixed"), r.classList.remove("content-render-svg-el--responsive"), C && u > 0 && r.setAttribute("width", `${u}`), f && m > 0 && r.setAttribute("height", `${m}`);
|
|
67
65
|
});
|
|
68
|
-
const
|
|
69
|
-
a.classList.toggle("content-render-svg--responsive",
|
|
70
|
-
}, [
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
[
|
|
77
|
-
|
|
78
|
-
],
|
|
79
|
-
|
|
66
|
+
const g = x && !w;
|
|
67
|
+
a.classList.toggle("content-render-svg--responsive", g), a.classList.toggle("content-render-svg--fixed", !g);
|
|
68
|
+
}, [n]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref: l }) });
|
|
69
|
+
}, le = [oe, ie, P, ae], me = [
|
|
70
|
+
K,
|
|
71
|
+
re,
|
|
72
|
+
_,
|
|
73
|
+
J,
|
|
74
|
+
[se, { languages: X, subset: Q }],
|
|
75
|
+
ne
|
|
76
|
+
], de = ({ content: n, components: l }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-renderer", children: /* @__PURE__ */ t.jsx(
|
|
77
|
+
te,
|
|
80
78
|
{
|
|
81
|
-
remarkPlugins:
|
|
82
|
-
rehypePlugins:
|
|
83
|
-
components:
|
|
84
|
-
children:
|
|
79
|
+
remarkPlugins: le,
|
|
80
|
+
rehypePlugins: me,
|
|
81
|
+
components: l,
|
|
82
|
+
children: n
|
|
85
83
|
}
|
|
86
|
-
) }),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return r.forEach((a) => {
|
|
90
|
-
if (a.type === "sandbox") {
|
|
91
|
-
o.push(a);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const i = o[o.length - 1];
|
|
95
|
-
if (i && i.type !== "sandbox") {
|
|
96
|
-
o[o.length - 1] = {
|
|
97
|
-
type: "markdown",
|
|
98
|
-
value: `${i.value}${a.value}`
|
|
99
|
-
};
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
o.push({ type: "markdown", value: a.value });
|
|
103
|
-
}), o;
|
|
104
|
-
}, tt = ({
|
|
105
|
-
content: r,
|
|
106
|
-
customRenderBar: o,
|
|
84
|
+
) }), De = ({
|
|
85
|
+
content: n,
|
|
86
|
+
customRenderBar: l,
|
|
107
87
|
onSend: a,
|
|
108
|
-
typingSpeed:
|
|
109
|
-
enableTypewriter:
|
|
110
|
-
userInput:
|
|
111
|
-
interactionDefaultValueOptions:
|
|
112
|
-
defaultButtonText:
|
|
113
|
-
defaultInputText:
|
|
114
|
-
defaultSelectedValues:
|
|
115
|
-
readonly:
|
|
116
|
-
onTypeFinished:
|
|
117
|
-
confirmButtonText:
|
|
118
|
-
copyButtonText:
|
|
119
|
-
copiedButtonText:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
sandboxScriptLoadingText: g,
|
|
123
|
-
sandboxFullscreenButtonText: v,
|
|
124
|
-
sandboxMode: B = "content",
|
|
125
|
-
onClickCustomButtonAfterContent: A,
|
|
126
|
-
beforeSend: z
|
|
88
|
+
typingSpeed: c = 30,
|
|
89
|
+
enableTypewriter: N = !1,
|
|
90
|
+
userInput: i,
|
|
91
|
+
interactionDefaultValueOptions: p,
|
|
92
|
+
defaultButtonText: j,
|
|
93
|
+
defaultInputText: T,
|
|
94
|
+
defaultSelectedValues: x,
|
|
95
|
+
readonly: w = !1,
|
|
96
|
+
onTypeFinished: g,
|
|
97
|
+
confirmButtonText: r,
|
|
98
|
+
copyButtonText: k,
|
|
99
|
+
copiedButtonText: v,
|
|
100
|
+
onClickCustomButtonAfterContent: u,
|
|
101
|
+
beforeSend: m
|
|
127
102
|
// tooltipMinLength,
|
|
128
103
|
}) => {
|
|
129
|
-
const
|
|
130
|
-
() =>
|
|
131
|
-
[
|
|
132
|
-
),
|
|
133
|
-
() =>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
104
|
+
const h = B(
|
|
105
|
+
() => E(n),
|
|
106
|
+
[n]
|
|
107
|
+
), d = B(
|
|
108
|
+
() => O(
|
|
109
|
+
n,
|
|
110
|
+
i,
|
|
111
|
+
p
|
|
137
112
|
),
|
|
138
|
-
[
|
|
139
|
-
),
|
|
140
|
-
() =>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
113
|
+
[n, p, i]
|
|
114
|
+
), y = B(
|
|
115
|
+
() => ee(
|
|
116
|
+
n,
|
|
117
|
+
i,
|
|
118
|
+
p
|
|
144
119
|
),
|
|
145
|
-
[
|
|
146
|
-
),
|
|
120
|
+
[n, p, i]
|
|
121
|
+
), R = j?.trim() || d.buttonText, A = T?.trim() || d.inputText, I = x?.length ? x : y, C = {
|
|
147
122
|
"custom-button-after-content": ({
|
|
148
123
|
children: e
|
|
149
124
|
}) => /* @__PURE__ */ t.jsx(
|
|
150
125
|
"button",
|
|
151
126
|
{
|
|
152
127
|
className: "content-render-custom-button-after-content",
|
|
153
|
-
onClick:
|
|
128
|
+
onClick: u,
|
|
154
129
|
children: /* @__PURE__ */ t.jsx("span", { className: "content-render-custom-button-after-content-inner", children: e })
|
|
155
130
|
}
|
|
156
131
|
),
|
|
157
132
|
"custom-variable": (e) => /* @__PURE__ */ t.jsx(
|
|
158
|
-
|
|
133
|
+
q,
|
|
159
134
|
{
|
|
160
135
|
...e,
|
|
161
|
-
readonly:
|
|
162
|
-
defaultButtonText:
|
|
163
|
-
defaultInputText:
|
|
164
|
-
defaultSelectedValues:
|
|
136
|
+
readonly: w,
|
|
137
|
+
defaultButtonText: R,
|
|
138
|
+
defaultInputText: A,
|
|
139
|
+
defaultSelectedValues: I,
|
|
165
140
|
onSend: a,
|
|
166
|
-
beforeSend:
|
|
167
|
-
confirmButtonText:
|
|
141
|
+
beforeSend: m,
|
|
142
|
+
confirmButtonText: r
|
|
168
143
|
}
|
|
169
144
|
),
|
|
170
145
|
code: (e) => {
|
|
171
|
-
const { className: s, children:
|
|
146
|
+
const { className: s, children: o, ...b } = e;
|
|
172
147
|
if (/language-(\w+)/.exec(s || "")?.[1] === "mermaid") {
|
|
173
|
-
const
|
|
174
|
-
return /* @__PURE__ */ t.jsx(
|
|
148
|
+
const H = o?.toString().replace(/\n$/, "") || "", $ = Z(n, H);
|
|
149
|
+
return /* @__PURE__ */ t.jsx(V, { chart: H, frozen: $ });
|
|
175
150
|
}
|
|
176
|
-
return /* @__PURE__ */ t.jsx("code", { className: s, ...
|
|
151
|
+
return /* @__PURE__ */ t.jsx("code", { className: s, ...b, children: o });
|
|
177
152
|
},
|
|
178
153
|
table: ({ ...e }) => /* @__PURE__ */ t.jsx("div", { className: "content-render-table-container", children: /* @__PURE__ */ t.jsx("table", { className: "content-render-table", ...e }) }),
|
|
179
154
|
th: ({ ...e }) => /* @__PURE__ */ t.jsx("th", { className: "content-render-th", ...e }),
|
|
180
155
|
td: ({ ...e }) => /* @__PURE__ */ t.jsx("td", { className: "content-render-td", ...e }),
|
|
181
156
|
tr: ({ ...e }) => /* @__PURE__ */ t.jsx("tr", { className: "content-render-tr", ...e }),
|
|
182
157
|
li: ({ node: e, ...s }) => {
|
|
183
|
-
const
|
|
184
|
-
return typeof
|
|
158
|
+
const o = e?.properties?.className;
|
|
159
|
+
return typeof o == "string" && o.includes("task-list-item") || Array.isArray(o) && o.includes("task-list-item") ? /* @__PURE__ */ t.jsx("li", { className: "content-render-task-list-item", ...s }) : /* @__PURE__ */ t.jsx("li", { ...s });
|
|
185
160
|
},
|
|
186
161
|
ol: ({ ...e }) => /* @__PURE__ */ t.jsx("ol", { className: "content-render-ol", ...e }),
|
|
187
162
|
ul: ({ ...e }) => /* @__PURE__ */ t.jsx("ul", { className: "content-render-ul", ...e }),
|
|
@@ -196,87 +171,41 @@ const ke = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
196
171
|
) : /* @__PURE__ */ t.jsx("input", { ...e }),
|
|
197
172
|
a: ({ children: e, ...s }) => /* @__PURE__ */ t.jsx("a", { target: "_blank", rel: "noopener noreferrer", ...s, children: e }),
|
|
198
173
|
pre: (e) => /* @__PURE__ */ t.jsx(
|
|
199
|
-
|
|
174
|
+
U,
|
|
200
175
|
{
|
|
201
176
|
...e,
|
|
202
|
-
copyButtonText:
|
|
203
|
-
copiedButtonText:
|
|
177
|
+
copyButtonText: k,
|
|
178
|
+
copiedButtonText: v
|
|
204
179
|
}
|
|
205
180
|
)
|
|
206
|
-
}, { displayContent:
|
|
181
|
+
}, { displayContent: f, isComplete: L } = G({
|
|
207
182
|
// processMarkdownText will let code block printf("You win!\n") become printf("You win!<br/>");
|
|
208
183
|
// content: processMarkdownText(content),
|
|
209
|
-
content:
|
|
210
|
-
typingSpeed:
|
|
211
|
-
disabled: !
|
|
212
|
-
}),
|
|
213
|
-
() =>
|
|
214
|
-
[
|
|
215
|
-
),
|
|
216
|
-
|
|
217
|
-
[r, k]
|
|
218
|
-
), D = _.some(
|
|
219
|
-
(e) => e.type === "sandbox"
|
|
220
|
-
), E = p(
|
|
221
|
-
() => Te(_),
|
|
222
|
-
[_]
|
|
223
|
-
), O = p(
|
|
224
|
-
() => X(l),
|
|
225
|
-
[l]
|
|
226
|
-
), S = Z(!1);
|
|
227
|
-
G(() => {
|
|
184
|
+
content: h,
|
|
185
|
+
typingSpeed: c,
|
|
186
|
+
disabled: !N
|
|
187
|
+
}), M = B(
|
|
188
|
+
() => Y(f),
|
|
189
|
+
[f]
|
|
190
|
+
), S = W(!1);
|
|
191
|
+
return z(() => {
|
|
228
192
|
S.current = !1;
|
|
229
|
-
}, [
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
m && !S.current && (S.current = !0, f?.());
|
|
235
|
-
}, [D, m, f]);
|
|
236
|
-
const ee = (e, s) => {
|
|
237
|
-
const d = J(e);
|
|
238
|
-
return X(d).map((u, q) => {
|
|
239
|
-
const b = `${s}-${u.type}-${q}`;
|
|
240
|
-
return u.type === "text" ? /* @__PURE__ */ t.jsx(
|
|
241
|
-
Y,
|
|
242
|
-
{
|
|
243
|
-
components: V,
|
|
244
|
-
content: u.value
|
|
245
|
-
},
|
|
246
|
-
b
|
|
247
|
-
) : u.type === "mermaid" ? /* @__PURE__ */ t.jsx(F, { chart: u.value, frozen: !u.complete }, b) : u.type === "svg" ? /* @__PURE__ */ t.jsx(Q, { svg: u.value }, b) : null;
|
|
248
|
-
});
|
|
249
|
-
};
|
|
250
|
-
return D ? /* @__PURE__ */ t.jsx("div", { className: "content-render markdown-body", children: E.map(
|
|
251
|
-
(e, s) => e.type === "sandbox" ? /* @__PURE__ */ t.jsx(
|
|
252
|
-
he,
|
|
253
|
-
{
|
|
254
|
-
hideFullScreen: !0,
|
|
255
|
-
type: "sandbox",
|
|
256
|
-
content: e.value,
|
|
257
|
-
className: "content-render-iframe",
|
|
258
|
-
loadingText: x,
|
|
259
|
-
styleLoadingText: h,
|
|
260
|
-
scriptLoadingText: g,
|
|
261
|
-
fullScreenButtonText: v,
|
|
262
|
-
mode: B
|
|
263
|
-
},
|
|
264
|
-
`sandbox-${s}`
|
|
265
|
-
) : /* @__PURE__ */ t.jsx(K.Fragment, { children: ee(e.value, `md-${s}`) }, `md-${s}`)
|
|
266
|
-
) }) : /* @__PURE__ */ t.jsxs("div", { className: "content-render markdown-body", children: [
|
|
267
|
-
O.map((e, s) => {
|
|
193
|
+
}, [n]), z(() => {
|
|
194
|
+
L && !S.current && (S.current = !0, g?.());
|
|
195
|
+
}, [L, g]), /* @__PURE__ */ t.jsxs("div", { className: "content-render markdown-body", children: [
|
|
196
|
+
M.map((e, s) => {
|
|
268
197
|
if (e.type === "text")
|
|
269
198
|
return /* @__PURE__ */ t.jsx(
|
|
270
|
-
|
|
199
|
+
de,
|
|
271
200
|
{
|
|
272
|
-
components:
|
|
201
|
+
components: C,
|
|
273
202
|
content: e.value
|
|
274
203
|
},
|
|
275
204
|
s
|
|
276
205
|
);
|
|
277
206
|
if (e.type === "mermaid")
|
|
278
207
|
return /* @__PURE__ */ t.jsx(
|
|
279
|
-
|
|
208
|
+
V,
|
|
280
209
|
{
|
|
281
210
|
chart: e.value,
|
|
282
211
|
frozen: !e.complete
|
|
@@ -284,17 +213,17 @@ const ke = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
284
213
|
s
|
|
285
214
|
);
|
|
286
215
|
if (e.type === "svg")
|
|
287
|
-
return /* @__PURE__ */ t.jsx(
|
|
216
|
+
return /* @__PURE__ */ t.jsx(ce, { svg: e.value }, s);
|
|
288
217
|
}),
|
|
289
|
-
|
|
290
|
-
content:
|
|
291
|
-
displayContent:
|
|
218
|
+
l && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children: D.createElement(l, {
|
|
219
|
+
content: n,
|
|
220
|
+
displayContent: f,
|
|
292
221
|
onSend: a
|
|
293
222
|
}) })
|
|
294
223
|
] });
|
|
295
224
|
};
|
|
296
225
|
export {
|
|
297
|
-
|
|
298
|
-
|
|
226
|
+
de as MarkdownRenderer,
|
|
227
|
+
De as default
|
|
299
228
|
};
|
|
300
229
|
//# sourceMappingURL=ContentRender.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentRender.es.js","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport remarkBreaks from \"remark-breaks\";\nimport remarkFlow from \"remark-flow\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport CodeBlock from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart from \"./plugins/MermaidChart\";\nimport useTypewriterStateMachine from \"./useTypewriterStateMachine\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\n// import { processMarkdownText } from \"./utils/process-markdown\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultSelectedValues,\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\n\nconst SANDBOX_TAG_HINT_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\\b/i;\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n onTypeFinished?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n // tooltipMinLength?: number; // Control minimum character length for tooltip display, default 10\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string }> = ({ svg }) => {\n const hostRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <div className=\"content-render-svg-scroll\">\n <div className=\"content-render-svg\" ref={hostRef} />\n </div>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\nconst remarkPlugins = [remarkGfm, remarkMath, remarkFlow, remarkBreaks];\n\nconst rehypePlugins = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n}> = ({ content: markdownContent, components }) => (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n);\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\") {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\") {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n onTypeFinished,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n sandboxFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n // tooltipMinLength,\n}) => {\n const normalizedContent = useMemo(\n () => normalizeInlineHtml(content),\n [content]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n content,\n userInput,\n interactionDefaultValueOptions\n ),\n [content, interactionDefaultValueOptions, userInput]\n );\n\n const interactionDefaultSelectedValues = useMemo(\n () =>\n getInteractionDefaultSelectedValues(\n content,\n userInput,\n interactionDefaultValueOptions\n ),\n [content, interactionDefaultValueOptions, userInput]\n );\n\n const resolvedDefaultButtonText =\n defaultButtonText?.trim() || interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaultSelectedValues;\n\n // Use custom Hook to handle typewriter effect\n const components: CustomComponents = {\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={onClickCustomButtonAfterContent}\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={readonly}\n defaultButtonText={resolvedDefaultButtonText}\n defaultInputText={resolvedDefaultInputText}\n defaultSelectedValues={resolvedDefaultSelectedValues}\n onSend={onSend}\n beforeSend={beforeSend}\n confirmButtonText={confirmButtonText}\n // tooltipMinLength={tooltipMinLength}\n />\n ),\n code: (props) => {\n const { className, children, ...rest } = props as {\n className?: string;\n children?: React.ReactNode;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const frozen = mermaidBlockIsComplete(content, chartContent);\n return <MermaidChart chart={chartContent} frozen={frozen} />;\n }\n\n return (\n <code className={className} {...rest}>\n {children}\n </code>\n );\n },\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n />\n ),\n };\n\n const { displayContent, isComplete } = useTypewriterStateMachine({\n // processMarkdownText will let code block printf(\"You win!\\n\") become printf(\"You win!<br/>\");\n // content: processMarkdownText(content),\n content: normalizedContent,\n typingSpeed,\n disabled: !enableTypewriter,\n });\n\n const hasPotentialSandboxTags = useMemo(\n () => SANDBOX_TAG_HINT_PATTERN.test(content),\n [content]\n );\n\n const renderSegments = useMemo(\n () => (hasPotentialSandboxTags ? splitContentSegments(content, true) : []),\n [content, hasPotentialSandboxTags]\n );\n\n const hasSandbox = renderSegments.some(\n (segment) => segment.type === \"sandbox\"\n );\n const mergedRenderSegments = useMemo(\n () => mergeNonSandboxSegments(renderSegments),\n [renderSegments]\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(displayContent),\n [displayContent]\n );\n\n const hasCompleted = useRef(false);\n\n useEffect(() => {\n // Reset completion state on each content update so streaming patches can emit completion again.\n hasCompleted.current = false;\n }, [content]);\n\n useEffect(() => {\n if (hasSandbox) {\n if (!hasCompleted.current) {\n hasCompleted.current = true;\n onTypeFinished?.();\n }\n return;\n }\n\n if (isComplete && !hasCompleted.current) {\n hasCompleted.current = true; // Mark as completed\n onTypeFinished?.(); // Call the passed callback\n }\n }, [hasSandbox, isComplete, onTypeFinished]);\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={key}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart key={key} chart={seg.value} frozen={!seg.complete} />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n if (hasSandbox) {\n return (\n <div className=\"content-render markdown-body\">\n {mergedRenderSegments.map((segment, idx) =>\n segment.type === \"sandbox\" ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n fullScreenButtonText={sandboxFullscreenButtonText}\n mode={sandboxMode}\n />\n ) : (\n <React.Fragment key={`md-${idx}`}>\n {renderMarkdownSegments(segment.value, `md-${idx}`)}\n </React.Fragment>\n )\n )}\n </div>\n );\n }\n\n return (\n <div className=\"content-render markdown-body\">\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={index}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customRenderBar && (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent,\n onSend,\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["SANDBOX_TAG_HINT_PATTERN","SvgBlockInShadow","svg","hostRef","useRef","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","remarkPlugins","remarkGfm","remarkMath","remarkFlow","remarkBreaks","rehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","MarkdownRenderer","markdownContent","components","ReactMarkdown","mergeNonSandboxSegments","segments","merged","segment","last","ContentRender","content","customRenderBar","onSend","typingSpeed","enableTypewriter","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","onTypeFinished","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","sandboxFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","normalizedContent","useMemo","normalizeInlineHtml","interactionDefaults","getInteractionDefaultValues","interactionDefaultSelectedValues","getInteractionDefaultSelectedValues","resolvedDefaultButtonText","resolvedDefaultInputText","resolvedDefaultSelectedValues","children","props","CustomButtonInputVariable","className","rest","chartContent","frozen","mermaidBlockIsComplete","MermaidChart","CodeBlock","displayContent","isComplete","useTypewriterStateMachine","hasPotentialSandboxTags","renderSegments","splitContentSegments","hasSandbox","mergedRenderSegments","parseMarkdownSegments","hasCompleted","renderMarkdownSegments","raw","keyPrefix","seg","index","key","idx","IframeSandbox","React","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAMA,KACJ,mGAkDIC,IAA8C,CAAC,EAAE,KAAAC,QAAU;AAC/D,QAAMC,IAAUC,EAAuB,IAAI;AAE3C,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAOH,EAAQ;AACrB,QAAI,C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,GAAiB;AAAA,MACpC,SAAAD;AAAA,MACA,gBAAA0C;AAAA,MACA,QAAAxC;AAAA,IAAA,CACD,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ContentRender.es.js","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport remarkBreaks from \"remark-breaks\";\nimport remarkFlow from \"remark-flow\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport CodeBlock from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart from \"./plugins/MermaidChart\";\nimport useTypewriterStateMachine from \"./useTypewriterStateMachine\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\n// import { processMarkdownText } from \"./utils/process-markdown\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport {\n getInteractionDefaultSelectedValues,\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n onTypeFinished?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n // tooltipMinLength?: number; // Control minimum character length for tooltip display, default 10\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string }> = ({ svg }) => {\n const hostRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <div className=\"content-render-svg-scroll\">\n <div className=\"content-render-svg\" ref={hostRef} />\n </div>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\nconst remarkPlugins = [remarkGfm, remarkMath, remarkFlow, remarkBreaks];\n\nconst rehypePlugins = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n}> = ({ content: markdownContent, components }) => (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n);\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n onTypeFinished,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n onClickCustomButtonAfterContent,\n beforeSend,\n // tooltipMinLength,\n}) => {\n const normalizedContent = useMemo(\n () => normalizeInlineHtml(content),\n [content]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n content,\n userInput,\n interactionDefaultValueOptions\n ),\n [content, interactionDefaultValueOptions, userInput]\n );\n\n const interactionDefaultSelectedValues = useMemo(\n () =>\n getInteractionDefaultSelectedValues(\n content,\n userInput,\n interactionDefaultValueOptions\n ),\n [content, interactionDefaultValueOptions, userInput]\n );\n\n const resolvedDefaultButtonText =\n defaultButtonText?.trim() || interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaultSelectedValues;\n\n // Use custom Hook to handle typewriter effect\n const components: CustomComponents = {\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={onClickCustomButtonAfterContent}\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={readonly}\n defaultButtonText={resolvedDefaultButtonText}\n defaultInputText={resolvedDefaultInputText}\n defaultSelectedValues={resolvedDefaultSelectedValues}\n onSend={onSend}\n beforeSend={beforeSend}\n confirmButtonText={confirmButtonText}\n // tooltipMinLength={tooltipMinLength}\n />\n ),\n code: (props) => {\n const { className, children, ...rest } = props as {\n className?: string;\n children?: React.ReactNode;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const frozen = mermaidBlockIsComplete(content, chartContent);\n return <MermaidChart chart={chartContent} frozen={frozen} />;\n }\n\n return (\n <code className={className} {...rest}>\n {children}\n </code>\n );\n },\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n />\n ),\n };\n\n const { displayContent, isComplete } = useTypewriterStateMachine({\n // processMarkdownText will let code block printf(\"You win!\\n\") become printf(\"You win!<br/>\");\n // content: processMarkdownText(content),\n content: normalizedContent,\n typingSpeed,\n disabled: !enableTypewriter,\n });\n\n const segments = useMemo(\n () => parseMarkdownSegments(displayContent),\n [displayContent]\n );\n\n const hasCompleted = useRef(false);\n\n useEffect(() => {\n // Reset completion state on each content update so streaming patches can emit completion again.\n hasCompleted.current = false;\n }, [content]);\n\n useEffect(() => {\n if (isComplete && !hasCompleted.current) {\n hasCompleted.current = true; // Mark as completed\n onTypeFinished?.(); // Call the passed callback\n }\n }, [isComplete, onTypeFinished]);\n\n return (\n <div className=\"content-render markdown-body\">\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={index}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customRenderBar && (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent,\n onSend,\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["SvgBlockInShadow","svg","hostRef","useRef","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","remarkPlugins","remarkGfm","remarkMath","remarkFlow","remarkBreaks","rehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","MarkdownRenderer","markdownContent","components","ReactMarkdown","ContentRender","content","customRenderBar","onSend","typingSpeed","enableTypewriter","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","onTypeFinished","confirmButtonText","copyButtonText","copiedButtonText","onClickCustomButtonAfterContent","beforeSend","normalizedContent","useMemo","normalizeInlineHtml","interactionDefaults","getInteractionDefaultValues","interactionDefaultSelectedValues","getInteractionDefaultSelectedValues","resolvedDefaultButtonText","resolvedDefaultInputText","resolvedDefaultSelectedValues","children","props","CustomButtonInputVariable","className","rest","chartContent","frozen","mermaidBlockIsComplete","MermaidChart","CodeBlock","displayContent","isComplete","useTypewriterStateMachine","segments","parseMarkdownSegments","hasCompleted","jsxs","seg","index","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,MAAMA,KAA8C,CAAC,EAAE,KAAAC,QAAU;AAC/D,QAAMC,IAAUC,EAAuB,IAAI;AAE3C,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAOH,EAAQ;AACrB,QAAI,CAACG,EAAM;AACX,UAAMC,IAAaD,EAAK,cAAcA,EAAK,aAAa,EAAE,MAAM,QAAQ,GAClEE,IAAU;AAChB,QAAIC,IAAUF,EAAW,eAAeC,CAAO;AAE/C,IAAKC,MACHA,IAAU,SAAS,cAAc,OAAO,GACxCA,EAAQ,KAAKD,GAEbC,EAAQ,cAAc;AAAA;AAAA;AAAA;AAAA,SAKtBF,EAAW,YAAYE,CAAO,IAGV,MAAM,KAAKF,EAAW,UAAU,EAAE;AAAA,MACtD,CAACG,MAASA,MAASD;AAAA,IAAA,EAEP,QAAQ,CAACC,MAASH,EAAW,YAAYG,CAAI,CAAC;AAE5D,UAAMC,IAAW,SAAS,cAAc,UAAU,GAC5CC,IAAaC,EAAuBX,CAAG;AAC7C,IAAAS,EAAS,YAAYC,GACrBL,EAAW,OAAOI,EAAS,QAAQ,UAAU,EAAI,CAAC;AAElD,QAAIG,IAAmB,IACnBC,IAAc;AAElB,IAAAR,EAAW,iBAAiB,KAAK,EAAE,QAAQ,CAACS,MAAU;AAEpD,YAAMC,IAAUD,EAAM,aAAa,SAAS;AAC5C,UAAI,CAACC,EAAS;AAEd,YAAMC,IAAaD,EAChB,KAAA,EACA,MAAM,QAAQ,EACd,IAAI,CAACE,MAAU,OAAOA,CAAK,CAAC;AAE/B,UAAID,EAAW,WAAW,KAAKA,EAAW,KAAK,OAAO,KAAK,E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