markdown-flow-ui 0.1.129 → 0.2.0
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/_virtual/index.cjs8.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.d.ts +4 -0
- package/dist/components/ContentRender/ContentRender.es.js +217 -211
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.cjs.js +3 -3
- package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.d.ts +3 -0
- package/dist/components/ContentRender/IframeSandbox.es.js +199 -186
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.cjs.js +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.cjs.js.map +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.d.ts +3 -0
- package/dist/components/ContentRender/MarkdownFlowInput.es.js +35 -32
- package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.stories.d.ts +6 -0
- package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
- package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.d.ts +3 -0
- package/dist/components/ContentRender/SandboxApp.es.js +117 -104
- package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
- package/dist/components/ContentRender/contentRenderI18n.cjs.js +2 -0
- package/dist/components/ContentRender/contentRenderI18n.cjs.js.map +1 -0
- package/dist/components/ContentRender/contentRenderI18n.d.ts +15 -0
- package/dist/components/ContentRender/contentRenderI18n.es.js +59 -0
- package/dist/components/ContentRender/contentRenderI18n.es.js.map +1 -0
- package/dist/components/ContentRender/index.cjs.js +1 -1
- package/dist/components/ContentRender/index.d.ts +1 -0
- package/dist/components/ContentRender/index.es.js +1 -0
- package/dist/components/ContentRender/index.es.js.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.d.ts +3 -1
- package/dist/components/ContentRender/plugins/CustomVariable.es.js +131 -124
- package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +3 -0
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js +18 -15
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.stories.d.ts +6 -0
- package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.d.ts +1 -0
- package/dist/components/MarkdownFlow/index.cjs.js +1 -1
- package/dist/components/MarkdownFlow/index.es.js +1 -0
- package/dist/components/MarkdownFlow/index.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +2 -2
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +23 -22
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.stories.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -2
- package/dist/components/MarkdownFlowEditor/editorI18n.es.js +12 -24
- package/dist/components/MarkdownFlowEditor/editorI18n.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/index.d.ts +1 -1
- package/dist/components/Slide/Player.cjs.js +1 -1
- package/dist/components/Slide/Player.cjs.js.map +1 -1
- package/dist/components/Slide/Player.d.ts +14 -30
- package/dist/components/Slide/Player.es.js +395 -383
- package/dist/components/Slide/Player.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs.js +1 -1
- package/dist/components/Slide/Slide.cjs.js.map +1 -1
- package/dist/components/Slide/Slide.d.ts +22 -4
- package/dist/components/Slide/Slide.es.js +701 -659
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/Slide.stories.d.ts +19 -20
- package/dist/components/Slide/constants.d.ts +0 -24
- package/dist/components/Slide/index.d.ts +2 -1
- package/dist/components/Slide/slideI18n.cjs.js +2 -0
- package/dist/components/Slide/slideI18n.cjs.js.map +1 -0
- package/dist/components/Slide/slideI18n.d.ts +44 -0
- package/dist/components/Slide/slideI18n.es.js +162 -0
- package/dist/components/Slide/slideI18n.es.js.map +1 -0
- package/dist/components/Slide/utils/playerVisibility.cjs.js +2 -0
- package/dist/components/Slide/utils/playerVisibility.cjs.js.map +1 -0
- package/dist/components/Slide/utils/playerVisibility.d.ts +10 -0
- package/dist/components/Slide/utils/playerVisibility.es.js +11 -0
- package/dist/components/Slide/utils/playerVisibility.es.js.map +1 -0
- package/dist/components/Slide/utils/playerVisibility.test.d.ts +1 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/editor.d.ts +3 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +14 -13
- package/dist/index.es.js.map +1 -1
- package/dist/lib/locale.cjs.js +2 -0
- package/dist/lib/locale.cjs.js.map +1 -0
- package/dist/lib/locale.d.ts +4 -0
- package/dist/lib/locale.es.js +19 -0
- package/dist/lib/locale.es.js.map +1 -0
- package/dist/lib/localeTextMap.cjs.js +2 -0
- package/dist/lib/localeTextMap.cjs.js.map +1 -0
- package/dist/lib/localeTextMap.d.ts +4 -0
- package/dist/lib/localeTextMap.es.js +5 -0
- package/dist/lib/localeTextMap.es.js.map +1 -0
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/classnames/index.cjs.js +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/dist/renderer.cjs.js +1 -1
- package/dist/renderer.d.ts +1 -0
- package/dist/renderer.es.js +15 -14
- package/dist/renderer.es.js.map +1 -1
- package/dist/slide.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/Slide/constants.cjs.js +0 -2
- package/dist/components/Slide/constants.cjs.js.map +0 -1
- package/dist/components/Slide/constants.es.js +0 -28
- package/dist/components/Slide/constants.es.js.map +0 -1
|
@@ -1,242 +1,246 @@
|
|
|
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 se, { useState as be, useRef as D, useEffect as A, useMemo as g } from "react";
|
|
5
|
+
import Te from "../../_virtual/index.es.js";
|
|
6
|
+
import { sanitizeInvalidTagName as we } from "./utils/sanitize-invalid-tag-name.es.js";
|
|
7
|
+
import { stripSvgTextLineBreaks as ke } 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 { preserveCustomVariableProperties as
|
|
14
|
-
import { subsetLanguages as
|
|
15
|
-
import { parseMarkdownSegments as
|
|
16
|
-
import { normalizeInlineHtml as
|
|
17
|
-
import
|
|
18
|
-
import { splitContentSegments as
|
|
19
|
-
import { getInteractionDefaultValues as
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
10
|
+
import je from "./CodeBlock.es.js";
|
|
11
|
+
import Ne from "./plugins/CustomVariable.es.js";
|
|
12
|
+
import X from "./plugins/MermaidChart.es.js";
|
|
13
|
+
import { preserveCustomVariableProperties as Be, restoreCustomVariableProperties as Ce } from "./utils/custom-variable-props.es.js";
|
|
14
|
+
import { subsetLanguages as Se, highlightLanguages as Re } from "./utils/highlight-languages.es.js";
|
|
15
|
+
import { parseMarkdownSegments as ie, mermaidBlockIsComplete as Le } from "./utils/mermaid-parse.es.js";
|
|
16
|
+
import { normalizeInlineHtml as ae } from "./utils/normalize-inline-html.es.js";
|
|
17
|
+
import Ae from "./IframeSandbox.es.js";
|
|
18
|
+
import { splitContentSegments as $e } from "./utils/split-content.es.js";
|
|
19
|
+
import { getInteractionDefaultValues as ze } from "../../lib/interaction-defaults.es.js";
|
|
20
|
+
import { getContentRenderLocaleTexts as Me } from "./contentRenderI18n.es.js";
|
|
21
|
+
import { Markdown as Fe } from "../../node_modules/react-markdown/lib/index.es.js";
|
|
22
|
+
import Ie from "../../node_modules/rehype-raw/lib/index.es.js";
|
|
23
|
+
import Ve from "../../node_modules/rehype-highlight/lib/index.es.js";
|
|
24
|
+
import He from "../../node_modules/rehype-katex/lib/index.es.js";
|
|
25
|
+
import De from "../../node_modules/remark-gfm/lib/index.es.js";
|
|
26
|
+
import Pe from "../../node_modules/remark-math/lib/index.es.js";
|
|
27
|
+
import We from "../../node_modules/remark-breaks/lib/index.es.js";
|
|
28
|
+
const _e = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, ce = ({ svg: r }) => {
|
|
29
|
+
const s = D(null);
|
|
30
|
+
return A(() => {
|
|
31
|
+
const i = s.current;
|
|
32
|
+
if (!i) return;
|
|
33
|
+
const a = i.shadowRoot ?? i.attachShadow({ mode: "open" }), B = "content-render-svg-style";
|
|
34
|
+
let p = a.getElementById(B);
|
|
35
|
+
p || (p = document.createElement("style"), p.id = B, p.textContent = `
|
|
35
36
|
svg { height: auto; display: inline-block; }
|
|
36
37
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
37
38
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
38
|
-
`,
|
|
39
|
-
(
|
|
40
|
-
).forEach((
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
let
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const [, ,
|
|
50
|
-
if (!
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
},
|
|
54
|
-
if (!
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
39
|
+
`, a.appendChild(p)), Array.from(a.childNodes).filter(
|
|
40
|
+
(o) => o !== p
|
|
41
|
+
).forEach((o) => a.removeChild(o));
|
|
42
|
+
const C = document.createElement("template"), $ = ke(r);
|
|
43
|
+
C.innerHTML = $, a.append(C.content.cloneNode(!0));
|
|
44
|
+
let h = !1, S = !1;
|
|
45
|
+
a.querySelectorAll("svg").forEach((o) => {
|
|
46
|
+
const R = o.getAttribute("viewBox");
|
|
47
|
+
if (!R) return;
|
|
48
|
+
const L = R.trim().split(/[\s,]+/).map((m) => Number(m));
|
|
49
|
+
if (L.length !== 4 || L.some(Number.isNaN)) return;
|
|
50
|
+
const [, , T, v] = L, w = o.getAttribute("width"), k = o.getAttribute("height"), M = (m) => {
|
|
51
|
+
if (!m) return !1;
|
|
52
|
+
const f = m.trim().toLowerCase();
|
|
53
|
+
return f === "auto" || f.endsWith("%");
|
|
54
|
+
}, F = (m) => {
|
|
55
|
+
if (!m) return null;
|
|
56
|
+
const f = m.trim().toLowerCase();
|
|
57
|
+
if (f === "auto" || f.endsWith("%"))
|
|
57
58
|
return null;
|
|
58
|
-
const
|
|
59
|
-
return Number.isNaN(
|
|
60
|
-
},
|
|
61
|
-
if (
|
|
62
|
-
|
|
59
|
+
const H = Number.parseFloat(f);
|
|
60
|
+
return Number.isNaN(H) ? null : H;
|
|
61
|
+
}, P = M(w), W = M(k), I = !w || w === "0", V = !k || k === "0", _ = F(w), E = F(k);
|
|
62
|
+
if (P || W || I && V || _ === T && E === v) {
|
|
63
|
+
h = !0, o.classList.add("content-render-svg-el--responsive"), o.classList.remove("content-render-svg-el--fixed"), o.style.width = "100%", o.style.height = "auto", !o.style.aspectRatio && v > 0 && (o.style.aspectRatio = `${T} / ${v}`);
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
S = !0, o.classList.add("content-render-svg-el--fixed"), o.classList.remove("content-render-svg-el--responsive"), I && T > 0 && o.setAttribute("width", `${T}`), V && v > 0 && o.setAttribute("height", `${v}`);
|
|
66
67
|
});
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
}, [r]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref:
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
[
|
|
76
|
-
|
|
77
|
-
],
|
|
78
|
-
|
|
68
|
+
const z = h && !S;
|
|
69
|
+
i.classList.toggle("content-render-svg--responsive", z), i.classList.toggle("content-render-svg--fixed", !z);
|
|
70
|
+
}, [r]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref: s }) });
|
|
71
|
+
}, Ee = [De, Pe, Te, We], Ge = [
|
|
72
|
+
Be,
|
|
73
|
+
Ie,
|
|
74
|
+
we,
|
|
75
|
+
Ce,
|
|
76
|
+
[Ve, { languages: Re, subset: Se }],
|
|
77
|
+
He
|
|
78
|
+
], le = ({ content: r, components: s }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-renderer", children: /* @__PURE__ */ t.jsx(
|
|
79
|
+
Fe,
|
|
79
80
|
{
|
|
80
|
-
remarkPlugins:
|
|
81
|
-
rehypePlugins:
|
|
82
|
-
components:
|
|
81
|
+
remarkPlugins: Ee,
|
|
82
|
+
rehypePlugins: Ge,
|
|
83
|
+
components: s,
|
|
83
84
|
children: r
|
|
84
85
|
}
|
|
85
|
-
) }),
|
|
86
|
+
) }), Ue = (r) => {
|
|
86
87
|
if (r.length <= 1) return r;
|
|
87
|
-
const
|
|
88
|
-
return r.forEach((
|
|
89
|
-
if (
|
|
90
|
-
|
|
88
|
+
const s = [];
|
|
89
|
+
return r.forEach((i) => {
|
|
90
|
+
if (i.type === "sandbox") {
|
|
91
|
+
s.push(i);
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
|
|
94
|
+
const a = s[s.length - 1];
|
|
95
|
+
if (a && a.type !== "sandbox") {
|
|
96
|
+
s[s.length - 1] = {
|
|
96
97
|
type: "markdown",
|
|
97
|
-
value: `${
|
|
98
|
+
value: `${a.value}${i.value}`
|
|
98
99
|
};
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
-
}),
|
|
103
|
-
},
|
|
104
|
-
const
|
|
102
|
+
s.push({ type: "markdown", value: i.value });
|
|
103
|
+
}), s;
|
|
104
|
+
}, qe = (r, s) => {
|
|
105
|
+
const i = Math.max(1, s), a = Array.from(r);
|
|
105
106
|
return {
|
|
106
|
-
chunk:
|
|
107
|
-
rest:
|
|
107
|
+
chunk: a.slice(0, i).join(""),
|
|
108
|
+
rest: a.slice(i).join("")
|
|
108
109
|
};
|
|
109
|
-
},
|
|
110
|
+
}, Tt = ({
|
|
110
111
|
content: r,
|
|
111
|
-
contentType:
|
|
112
|
+
contentType: s,
|
|
113
|
+
locale: i,
|
|
112
114
|
customRenderBar: a,
|
|
113
|
-
onSend:
|
|
114
|
-
typingSpeed:
|
|
115
|
-
enableTypewriter:
|
|
116
|
-
onTypeFinished:
|
|
117
|
-
onTypewriterStateChange:
|
|
118
|
-
userInput:
|
|
119
|
-
interactionDefaultValueOptions:
|
|
120
|
-
defaultButtonText:
|
|
121
|
-
defaultInputText:
|
|
122
|
-
defaultSelectedValues:
|
|
123
|
-
readonly:
|
|
124
|
-
confirmButtonText:
|
|
125
|
-
copyButtonText:
|
|
126
|
-
copiedButtonText:
|
|
127
|
-
sandboxLoadingText:
|
|
128
|
-
sandboxStyleLoadingText:
|
|
129
|
-
sandboxScriptLoadingText:
|
|
130
|
-
disableSandboxLoadingOverlay:
|
|
131
|
-
sandboxFullscreenButtonText:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
115
|
+
onSend: B,
|
|
116
|
+
typingSpeed: p = 40,
|
|
117
|
+
enableTypewriter: J = !1,
|
|
118
|
+
onTypeFinished: C,
|
|
119
|
+
onTypewriterStateChange: $,
|
|
120
|
+
userInput: h,
|
|
121
|
+
interactionDefaultValueOptions: S,
|
|
122
|
+
defaultButtonText: z,
|
|
123
|
+
defaultInputText: o,
|
|
124
|
+
defaultSelectedValues: R,
|
|
125
|
+
readonly: L = !1,
|
|
126
|
+
confirmButtonText: T,
|
|
127
|
+
copyButtonText: v,
|
|
128
|
+
copiedButtonText: w,
|
|
129
|
+
sandboxLoadingText: k,
|
|
130
|
+
sandboxStyleLoadingText: M,
|
|
131
|
+
sandboxScriptLoadingText: F,
|
|
132
|
+
disableSandboxLoadingOverlay: P = !1,
|
|
133
|
+
sandboxFullscreenButtonText: W,
|
|
134
|
+
sandboxExitFullscreenButtonText: I,
|
|
135
|
+
sandboxMode: V = "content",
|
|
136
|
+
onClickCustomButtonAfterContent: _,
|
|
137
|
+
beforeSend: E
|
|
135
138
|
// tooltipMinLength,
|
|
136
139
|
}) => {
|
|
137
|
-
const l = !!
|
|
140
|
+
const j = Me(i), Q = T || j.confirmButtonText, m = v || j.copyButtonText, f = w || j.copiedButtonText, H = W || j.sandboxFullscreenButtonText, de = I || j.sandboxExitFullscreenButtonText, l = !!J && (!s || s === "text"), Y = 2, Z = Math.max(0, p), [x, G] = be(
|
|
138
141
|
() => l ? "" : r
|
|
139
|
-
),
|
|
140
|
-
|
|
141
|
-
const e =
|
|
142
|
-
if (
|
|
143
|
-
|
|
142
|
+
), b = D(""), ee = D(l), U = D(!1);
|
|
143
|
+
A(() => {
|
|
144
|
+
const e = ee.current;
|
|
145
|
+
if (ee.current = l, U.current = !1, !l) {
|
|
146
|
+
b.current = "", G(r);
|
|
144
147
|
return;
|
|
145
148
|
}
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
if (!
|
|
149
|
-
return
|
|
150
|
-
const d =
|
|
151
|
-
return
|
|
149
|
+
G((n) => {
|
|
150
|
+
const c = !e, y = r.startsWith(n);
|
|
151
|
+
if (!c && !y)
|
|
152
|
+
return b.current = "", r;
|
|
153
|
+
const d = c || !y ? "" : n;
|
|
154
|
+
return b.current = r.slice(d.length), d;
|
|
152
155
|
});
|
|
153
|
-
}, [r, l]),
|
|
154
|
-
l && (
|
|
155
|
-
}, [r,
|
|
156
|
-
if (!l || !
|
|
156
|
+
}, [r, l]), A(() => {
|
|
157
|
+
l && (U.current || b.current || x !== r || (U.current = !0, C?.()));
|
|
158
|
+
}, [r, x, l, C]), A(() => {
|
|
159
|
+
if (!l || !b.current)
|
|
157
160
|
return;
|
|
158
161
|
const e = window.setTimeout(() => {
|
|
159
|
-
|
|
160
|
-
const { chunk:
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
G((n) => {
|
|
163
|
+
const { chunk: c, rest: y } = qe(
|
|
164
|
+
b.current,
|
|
165
|
+
Y
|
|
163
166
|
);
|
|
164
|
-
return
|
|
167
|
+
return c ? (b.current = y, `${n}${c}`) : n;
|
|
165
168
|
});
|
|
166
|
-
},
|
|
169
|
+
}, Z);
|
|
167
170
|
return () => window.clearTimeout(e);
|
|
168
171
|
}, [
|
|
169
172
|
r,
|
|
170
|
-
|
|
173
|
+
x,
|
|
171
174
|
l,
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
Y,
|
|
176
|
+
Z
|
|
174
177
|
]);
|
|
175
|
-
const
|
|
178
|
+
const te = g(
|
|
176
179
|
() => ({
|
|
177
180
|
isTypewriterEnabled: l,
|
|
178
|
-
isTyping: l &&
|
|
179
|
-
isComplete:
|
|
180
|
-
renderedLength:
|
|
181
|
+
isTyping: l && x !== r,
|
|
182
|
+
isComplete: x === r,
|
|
183
|
+
renderedLength: x.length,
|
|
181
184
|
totalLength: r.length
|
|
182
185
|
}),
|
|
183
|
-
[r,
|
|
186
|
+
[r, x, l]
|
|
184
187
|
);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}, [
|
|
188
|
-
const
|
|
189
|
-
() =>
|
|
190
|
-
[
|
|
191
|
-
),
|
|
192
|
-
() =>
|
|
188
|
+
A(() => {
|
|
189
|
+
$?.(te);
|
|
190
|
+
}, [$, te]);
|
|
191
|
+
const u = l ? x : r, q = g(
|
|
192
|
+
() => ae(u),
|
|
193
|
+
[u]
|
|
194
|
+
), K = g(
|
|
195
|
+
() => ze(
|
|
196
|
+
u,
|
|
193
197
|
h,
|
|
194
|
-
|
|
195
|
-
T
|
|
198
|
+
S
|
|
196
199
|
),
|
|
197
|
-
[
|
|
198
|
-
),
|
|
199
|
-
() =>
|
|
200
|
-
[
|
|
201
|
-
),
|
|
200
|
+
[S, u, h]
|
|
201
|
+
), me = z?.trim() || K.buttonText, ue = o?.trim() || K.inputText, pe = g(
|
|
202
|
+
() => h ? h.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
|
|
203
|
+
[h]
|
|
204
|
+
), he = R?.length ? R : K.selectedValues || pe, re = {
|
|
202
205
|
"custom-button-after-content": ({
|
|
203
206
|
children: e
|
|
204
207
|
}) => /* @__PURE__ */ t.jsx(
|
|
205
208
|
"button",
|
|
206
209
|
{
|
|
207
210
|
className: "content-render-custom-button-after-content",
|
|
208
|
-
onClick:
|
|
211
|
+
onClick: _,
|
|
209
212
|
children: /* @__PURE__ */ t.jsx("span", { className: "content-render-custom-button-after-content-inner", children: e })
|
|
210
213
|
}
|
|
211
214
|
),
|
|
212
215
|
"custom-variable": (e) => /* @__PURE__ */ t.jsx(
|
|
213
|
-
|
|
216
|
+
Ne,
|
|
214
217
|
{
|
|
215
218
|
...e,
|
|
216
|
-
readonly:
|
|
217
|
-
defaultButtonText:
|
|
218
|
-
defaultInputText:
|
|
219
|
-
defaultSelectedValues:
|
|
220
|
-
onSend:
|
|
221
|
-
beforeSend:
|
|
222
|
-
|
|
219
|
+
readonly: L,
|
|
220
|
+
defaultButtonText: me,
|
|
221
|
+
defaultInputText: ue,
|
|
222
|
+
defaultSelectedValues: he,
|
|
223
|
+
onSend: B,
|
|
224
|
+
beforeSend: E,
|
|
225
|
+
locale: i,
|
|
226
|
+
confirmButtonText: Q
|
|
223
227
|
}
|
|
224
228
|
),
|
|
225
229
|
code: (e) => {
|
|
226
|
-
const { className: n, children:
|
|
230
|
+
const { className: n, children: c, ...y } = e;
|
|
227
231
|
if (/language-(\w+)/.exec(n || "")?.[1] === "mermaid") {
|
|
228
|
-
const
|
|
229
|
-
return /* @__PURE__ */ t.jsx(
|
|
232
|
+
const N = c?.toString().replace(/\n$/, "") || "", ve = Le(u, N);
|
|
233
|
+
return /* @__PURE__ */ t.jsx(X, { chart: N, frozen: ve });
|
|
230
234
|
}
|
|
231
|
-
return /* @__PURE__ */ t.jsx("code", { className: n, ...
|
|
235
|
+
return /* @__PURE__ */ t.jsx("code", { className: n, ...y, children: c });
|
|
232
236
|
},
|
|
233
237
|
table: ({ ...e }) => /* @__PURE__ */ t.jsx("div", { className: "content-render-table-container", children: /* @__PURE__ */ t.jsx("table", { className: "content-render-table", ...e }) }),
|
|
234
238
|
th: ({ ...e }) => /* @__PURE__ */ t.jsx("th", { className: "content-render-th", ...e }),
|
|
235
239
|
td: ({ ...e }) => /* @__PURE__ */ t.jsx("td", { className: "content-render-td", ...e }),
|
|
236
240
|
tr: ({ ...e }) => /* @__PURE__ */ t.jsx("tr", { className: "content-render-tr", ...e }),
|
|
237
241
|
li: ({ node: e, ...n }) => {
|
|
238
|
-
const
|
|
239
|
-
return typeof
|
|
242
|
+
const c = e?.properties?.className;
|
|
243
|
+
return typeof c == "string" && c.includes("task-list-item") || Array.isArray(c) && c.includes("task-list-item") ? /* @__PURE__ */ t.jsx("li", { className: "content-render-task-list-item", ...n }) : /* @__PURE__ */ t.jsx("li", { ...n });
|
|
240
244
|
},
|
|
241
245
|
ol: ({ ...e }) => /* @__PURE__ */ t.jsx("ol", { className: "content-render-ol", ...e }),
|
|
242
246
|
ul: ({ ...e }) => /* @__PURE__ */ t.jsx("ul", { className: "content-render-ul", ...e }),
|
|
@@ -251,72 +255,74 @@ const Me = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
251
255
|
) : /* @__PURE__ */ t.jsx("input", { ...e }),
|
|
252
256
|
a: ({ children: e, ...n }) => /* @__PURE__ */ t.jsx("a", { target: "_blank", rel: "noopener noreferrer", ...n, children: e }),
|
|
253
257
|
pre: (e) => /* @__PURE__ */ t.jsx(
|
|
254
|
-
|
|
258
|
+
je,
|
|
255
259
|
{
|
|
256
260
|
...e,
|
|
257
|
-
copyButtonText:
|
|
258
|
-
copiedButtonText:
|
|
261
|
+
copyButtonText: m,
|
|
262
|
+
copiedButtonText: f
|
|
259
263
|
}
|
|
260
264
|
)
|
|
261
|
-
},
|
|
262
|
-
() =>
|
|
263
|
-
[
|
|
264
|
-
),
|
|
265
|
-
() =>
|
|
266
|
-
[
|
|
267
|
-
),
|
|
265
|
+
}, ne = g(
|
|
266
|
+
() => _e.test(u),
|
|
267
|
+
[u]
|
|
268
|
+
), O = g(
|
|
269
|
+
() => ne ? $e(u, !0) : [],
|
|
270
|
+
[u, ne]
|
|
271
|
+
), fe = O.some(
|
|
268
272
|
(e) => e.type === "sandbox"
|
|
269
|
-
),
|
|
270
|
-
() =>
|
|
271
|
-
[
|
|
272
|
-
),
|
|
273
|
-
() =>
|
|
274
|
-
[
|
|
275
|
-
),
|
|
276
|
-
const
|
|
277
|
-
return
|
|
278
|
-
const
|
|
273
|
+
), xe = g(
|
|
274
|
+
() => Ue(O),
|
|
275
|
+
[O]
|
|
276
|
+
), ye = g(
|
|
277
|
+
() => ie(q),
|
|
278
|
+
[q]
|
|
279
|
+
), ge = (e, n) => {
|
|
280
|
+
const c = ae(e);
|
|
281
|
+
return ie(c).map((d, oe) => {
|
|
282
|
+
const N = `${n}-${d.type}-${oe}`;
|
|
279
283
|
return d.type === "text" ? /* @__PURE__ */ t.jsx(
|
|
280
|
-
|
|
284
|
+
le,
|
|
281
285
|
{
|
|
282
|
-
components:
|
|
286
|
+
components: re,
|
|
283
287
|
content: d.value
|
|
284
288
|
},
|
|
285
|
-
|
|
286
|
-
) : d.type === "mermaid" ? /* @__PURE__ */ t.jsx(
|
|
289
|
+
N
|
|
290
|
+
) : d.type === "mermaid" ? /* @__PURE__ */ t.jsx(X, { chart: d.value, frozen: !d.complete }, N) : d.type === "svg" ? /* @__PURE__ */ t.jsx(ce, { svg: d.value }, N) : null;
|
|
287
291
|
});
|
|
288
292
|
};
|
|
289
|
-
return
|
|
293
|
+
return fe ? /* @__PURE__ */ t.jsx("div", { className: "content-render markdown-body", children: xe.map(
|
|
290
294
|
(e, n) => e.type === "sandbox" ? /* @__PURE__ */ t.jsx(
|
|
291
|
-
|
|
295
|
+
Ae,
|
|
292
296
|
{
|
|
293
297
|
hideFullScreen: !0,
|
|
294
298
|
type: "sandbox",
|
|
295
299
|
content: e.value,
|
|
296
300
|
className: "content-render-iframe",
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
locale: i,
|
|
302
|
+
loadingText: k,
|
|
303
|
+
styleLoadingText: M,
|
|
304
|
+
scriptLoadingText: F,
|
|
305
|
+
disableLoadingOverlay: P,
|
|
306
|
+
fullScreenButtonText: H,
|
|
307
|
+
exitFullScreenButtonText: de,
|
|
308
|
+
mode: V
|
|
303
309
|
},
|
|
304
310
|
`sandbox-${n}`
|
|
305
|
-
) : /* @__PURE__ */ t.jsx(
|
|
311
|
+
) : /* @__PURE__ */ t.jsx(se.Fragment, { children: ge(e.value, `md-${n}`) }, `md-${n}`)
|
|
306
312
|
) }) : /* @__PURE__ */ t.jsxs("div", { className: "content-render markdown-body", children: [
|
|
307
|
-
|
|
313
|
+
ye.map((e, n) => {
|
|
308
314
|
if (e.type === "text")
|
|
309
315
|
return /* @__PURE__ */ t.jsx(
|
|
310
|
-
|
|
316
|
+
le,
|
|
311
317
|
{
|
|
312
|
-
components:
|
|
318
|
+
components: re,
|
|
313
319
|
content: e.value
|
|
314
320
|
},
|
|
315
321
|
n
|
|
316
322
|
);
|
|
317
323
|
if (e.type === "mermaid")
|
|
318
324
|
return /* @__PURE__ */ t.jsx(
|
|
319
|
-
|
|
325
|
+
X,
|
|
320
326
|
{
|
|
321
327
|
chart: e.value,
|
|
322
328
|
frozen: !e.complete
|
|
@@ -324,17 +330,17 @@ const Me = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
324
330
|
n
|
|
325
331
|
);
|
|
326
332
|
if (e.type === "svg")
|
|
327
|
-
return /* @__PURE__ */ t.jsx(
|
|
333
|
+
return /* @__PURE__ */ t.jsx(ce, { svg: e.value }, n);
|
|
328
334
|
}),
|
|
329
|
-
a && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children:
|
|
335
|
+
a && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children: se.createElement(a, {
|
|
330
336
|
content: r,
|
|
331
|
-
displayContent:
|
|
332
|
-
onSend:
|
|
337
|
+
displayContent: q,
|
|
338
|
+
onSend: B
|
|
333
339
|
}) })
|
|
334
340
|
] });
|
|
335
341
|
};
|
|
336
342
|
export {
|
|
337
|
-
|
|
338
|
-
|
|
343
|
+
le as MarkdownRenderer,
|
|
344
|
+
Tt as default
|
|
339
345
|
};
|
|
340
346
|
//# sourceMappingURL=ContentRender.es.js.map
|