markdown-flow-ui 0.1.100-beta.2 → 0.1.100-beta.20
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.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.cjs.js.map +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.cjs.js.map +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.cjs.js.map +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.cjs.js.map +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.cjs.js.map +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-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.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.cjs.js.map +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/react-is@18.3.1/node_modules/react-is/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.es.js +1 -1
- package/dist/_virtual/index.cjs10.js +1 -1
- package/dist/_virtual/index.cjs11.js +1 -1
- package/dist/_virtual/index.cjs12.js +1 -1
- package/dist/_virtual/index.cjs3.js +1 -1
- package/dist/_virtual/index.cjs4.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es10.js +2 -3
- package/dist/_virtual/index.es10.js.map +1 -1
- package/dist/_virtual/index.es11.js +3 -2
- package/dist/_virtual/index.es11.js.map +1 -1
- package/dist/_virtual/index.es12.js +2 -2
- package/dist/_virtual/index.es3.js +4 -5
- package/dist/_virtual/index.es3.js.map +1 -1
- package/dist/_virtual/index.es4.js +5 -4
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/_virtual/index.es9.js +3 -3
- package/dist/assets/markdown-flow-ui.css +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.d.ts +13 -10
- package/dist/components/ContentRender/ContentRender.es.js +175 -158
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.cjs.js +4 -4
- package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.d.ts +1 -0
- package/dist/components/ContentRender/IframeSandbox.es.js +291 -210
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.cjs.js +3 -3
- package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.d.ts +1 -0
- package/dist/components/ContentRender/SandboxApp.es.js +144 -111
- package/dist/components/ContentRender/SandboxApp.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.es.js +68 -64
- 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 +19 -16
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +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 +1 -0
- package/dist/components/Slide/Player.es.js +208 -168
- 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 +13 -0
- package/dist/components/Slide/Slide.es.js +374 -255
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/Slide.stories.d.ts +21 -1
- package/dist/components/Slide/index.d.ts +3 -3
- package/dist/components/Slide/types.d.ts +6 -6
- package/dist/components/Slide/useSlide.cjs.js +1 -1
- package/dist/components/Slide/useSlide.cjs.js.map +1 -1
- package/dist/components/Slide/useSlide.d.ts +4 -1
- package/dist/components/Slide/useSlide.es.js +115 -81
- package/dist/components/Slide/useSlide.es.js.map +1 -1
- package/dist/components/Slide/useWakePlayerFromIframe.cjs.js +2 -0
- package/dist/components/Slide/useWakePlayerFromIframe.cjs.js.map +1 -0
- package/dist/components/Slide/useWakePlayerFromIframe.d.ts +7 -0
- package/dist/components/Slide/useWakePlayerFromIframe.es.js +89 -0
- package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -0
- package/dist/components/index.d.ts +4 -2
- package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +24 -22
- package/dist/lib/interaction-defaults.cjs.js +2 -0
- package/dist/lib/interaction-defaults.cjs.js.map +1 -0
- package/dist/lib/interaction-defaults.es.js +106 -0
- package/dist/lib/interaction-defaults.es.js.map +1 -0
- package/dist/lib/sandboxInteraction.cjs.js +2 -0
- package/dist/lib/sandboxInteraction.cjs.js.map +1 -0
- package/dist/lib/sandboxInteraction.d.ts +8 -0
- package/dist/lib/sandboxInteraction.es.js +12 -0
- package/dist/lib/sandboxInteraction.es.js.map +1 -0
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/renderer.cjs.js +1 -1
- package/dist/renderer.d.ts +5 -3
- package/dist/renderer.es.js +18 -16
- package/package.json +17 -2
- package/dist/components/Slide/interaction-defaults.cjs.js +0 -2
- package/dist/components/Slide/interaction-defaults.cjs.js.map +0 -1
- package/dist/components/Slide/interaction-defaults.es.js +0 -85
- package/dist/components/Slide/interaction-defaults.es.js.map +0 -1
- /package/dist/{components/Slide → lib}/interaction-defaults.d.ts +0 -0
|
@@ -1,119 +1,203 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import
|
|
5
|
-
import { splitContentSegments as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
(
|
|
11
|
-
)),
|
|
12
|
-
typeof window < "u" &&
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (
|
|
1
|
+
import { j as v } from "../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import k, { useRef as l, useState as O, useCallback as Me, useEffect as y } from "react";
|
|
3
|
+
import { createRoot as Te } from "react-dom/client";
|
|
4
|
+
import Ie from "./SandboxApp.es.js";
|
|
5
|
+
import { splitContentSegments as _e } from "./utils/split-content.es.js";
|
|
6
|
+
import Ne from "./ContentRender.es.js";
|
|
7
|
+
import { SANDBOX_INTERACTION_MESSAGE_TYPE as Pe, SANDBOX_INTERACTION_MESSAGE_SOURCE as ke } from "../../lib/sandboxInteraction.es.js";
|
|
8
|
+
let Q = null;
|
|
9
|
+
const pe = () => (Q || (Q = import("./blackboard-vendor.es.js").then(
|
|
10
|
+
(e) => e.injectBlackboardLibraries
|
|
11
|
+
)), Q);
|
|
12
|
+
typeof window < "u" && pe();
|
|
13
|
+
const Oe = /<img\b[^>]*>/i, De = 180, Be = 240, $e = /<img\b[^>]*\bsrc\s*=\s*["']([^"']+)["'][^>]*>/gi, he = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Set(), je = (e) => {
|
|
14
|
+
const t = Array.from(e.matchAll($e));
|
|
15
|
+
return Array.from(
|
|
16
|
+
new Set(
|
|
17
|
+
t.map((r) => r[1]?.trim()).filter((r) => !!r)
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
}, Fe = (e) => {
|
|
21
|
+
if (!e)
|
|
22
|
+
return Promise.resolve();
|
|
23
|
+
const t = he.get(e);
|
|
24
|
+
if (t)
|
|
25
|
+
return t;
|
|
26
|
+
const r = new Promise((a) => {
|
|
27
|
+
if (typeof window > "u") {
|
|
28
|
+
z.add(e), a();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const s = new window.Image();
|
|
32
|
+
s.decoding = "sync", s.loading = "eager", s.fetchPriority = "high";
|
|
33
|
+
const u = () => {
|
|
34
|
+
(typeof s.decode == "function" ? s.decode().catch(() => {
|
|
35
|
+
}) : Promise.resolve()).finally(() => {
|
|
36
|
+
z.add(e), a();
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
s.onload = () => {
|
|
40
|
+
u();
|
|
41
|
+
}, s.onerror = () => {
|
|
42
|
+
z.add(e), a();
|
|
43
|
+
}, s.src = e, s.complete && s.naturalWidth > 0 && u();
|
|
44
|
+
});
|
|
45
|
+
return he.set(e, r), r;
|
|
46
|
+
}, me = (e = []) => Promise.allSettled(e.map((t) => Fe(t))), ee = (e) => e.split(/\s+/).filter(Boolean).map((t) => t.split(":").pop() || t), fe = (e) => {
|
|
47
|
+
const t = e.trim().toLowerCase();
|
|
48
|
+
if (!t) return null;
|
|
49
|
+
const r = t.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
|
|
50
|
+
return r ? `${r[1]}${r[2].toLowerCase()}` : null;
|
|
51
|
+
}, ge = (e) => {
|
|
52
|
+
if (!e.trim()) return null;
|
|
53
|
+
const t = ee(e);
|
|
54
|
+
if (t.includes("h-screen") || t.includes("h-dvh"))
|
|
22
55
|
return "100dvh";
|
|
23
|
-
if (
|
|
56
|
+
if (t.includes("h-svh"))
|
|
24
57
|
return "100svh";
|
|
25
|
-
if (
|
|
58
|
+
if (t.includes("h-lvh"))
|
|
26
59
|
return "100lvh";
|
|
27
|
-
const
|
|
28
|
-
(
|
|
60
|
+
const r = t.find(
|
|
61
|
+
(s) => /^h-\[[0-9.]+(vh|dvh|svh|lvh)\]$/i.test(s)
|
|
29
62
|
);
|
|
30
|
-
if (!
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
63
|
+
if (!r) return null;
|
|
64
|
+
const a = r.match(/^h-\[([0-9.]+)(vh|dvh|svh|lvh)\]$/i);
|
|
65
|
+
return a ? `${a[1]}${a[2].toLowerCase()}` : null;
|
|
66
|
+
}, ze = (e) => {
|
|
67
|
+
const t = e.trim();
|
|
68
|
+
if (!t) return null;
|
|
69
|
+
const r = t.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
|
|
70
|
+
return r ? r[2]?.match(/\bclass\s*=\s*["']([^"']*)["']/i)?.[1] ?? null : null;
|
|
71
|
+
}, Le = (e) => {
|
|
72
|
+
const t = ze(e);
|
|
73
|
+
return t ? ee(t).includes("h-screen") : !1;
|
|
74
|
+
}, Ve = (e) => e.split(/\s+/).filter(Boolean).map((t) => {
|
|
75
|
+
const r = t.split(":");
|
|
76
|
+
return r[r.length - 1] !== "h-screen" ? t : (r[r.length - 1] = "h-full", r.join(":"));
|
|
77
|
+
}).join(" "), qe = (e, t) => !t || !e.trim() ? e : e.replace(
|
|
78
|
+
/^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
|
|
79
|
+
(r, a, s = "") => {
|
|
80
|
+
const u = s.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
|
|
81
|
+
if (!u)
|
|
82
|
+
return r;
|
|
83
|
+
const x = Ve(u[2]);
|
|
84
|
+
return x === u[2] ? r : `${a}${s.replace(
|
|
85
|
+
u[0],
|
|
86
|
+
`class=${u[1]}${x}${u[1]}`
|
|
87
|
+
)}>`;
|
|
88
|
+
}
|
|
89
|
+
), Ke = ({
|
|
90
|
+
content: e,
|
|
91
|
+
type: t,
|
|
92
|
+
className: r,
|
|
93
|
+
loadingText: a,
|
|
94
|
+
styleLoadingText: s,
|
|
95
|
+
scriptLoadingText: u,
|
|
96
|
+
fullScreenButtonText: x,
|
|
97
|
+
hideFullScreen: te = !1,
|
|
98
|
+
mode: p = "content",
|
|
99
|
+
replaceRootScreenHeightWithFull: D = !1
|
|
43
100
|
}) => {
|
|
44
|
-
const
|
|
45
|
-
}), [
|
|
46
|
-
n
|
|
47
|
-
|
|
48
|
-
const e = ye(s).filter((l) => l.type === "sandbox");
|
|
49
|
-
return (h === "blackboard" ? e[e.length - 1]?.value || "" : e.map((l) => l.value).join(`
|
|
101
|
+
const ne = l(null), H = l(null), L = l(null), re = l(null), V = l(() => {
|
|
102
|
+
}), [be, we] = O(480), oe = l(0), [se, ve] = O(0), [xe, Ce] = O(!1), [, q] = O(!0), Ee = t === "sandbox", G = p === "blackboard", X = l(""), B = k.useMemo(() => {
|
|
103
|
+
const n = _e(e).filter((h) => h.type === "sandbox");
|
|
104
|
+
return (p === "blackboard" ? n[n.length - 1]?.value || "" : n.map((h) => h.value).join(`
|
|
50
105
|
`)) || "";
|
|
51
|
-
}, [
|
|
106
|
+
}, [e, p]), i = k.useMemo(
|
|
107
|
+
() => qe(
|
|
108
|
+
B,
|
|
109
|
+
D
|
|
110
|
+
),
|
|
111
|
+
[B, D]
|
|
112
|
+
), M = k.useMemo(
|
|
113
|
+
() => je(i),
|
|
114
|
+
[i]
|
|
115
|
+
), ie = k.useMemo(
|
|
116
|
+
() => D && Le(B),
|
|
117
|
+
[B, D]
|
|
118
|
+
), [$, U] = O(
|
|
119
|
+
i
|
|
120
|
+
), ce = l(i), W = l(i), T = l(null), I = l(null), Y = l(null), Z = l(0), S = Me((o) => {
|
|
52
121
|
if (typeof window > "u")
|
|
53
122
|
return;
|
|
54
|
-
const
|
|
55
|
-
|
|
123
|
+
const n = Date.now();
|
|
124
|
+
n - oe.current < Be || (oe.current = n, window.postMessage(
|
|
56
125
|
{
|
|
57
|
-
source:
|
|
58
|
-
type:
|
|
59
|
-
eventType:
|
|
126
|
+
source: ke,
|
|
127
|
+
type: Pe,
|
|
128
|
+
eventType: o
|
|
60
129
|
},
|
|
61
130
|
window.location.origin
|
|
62
131
|
));
|
|
63
|
-
}, []),
|
|
64
|
-
|
|
132
|
+
}, []), le = () => {
|
|
133
|
+
T.current !== null && (window.clearTimeout(T.current), T.current = null);
|
|
134
|
+
}, Re = () => {
|
|
135
|
+
I.current !== null && (window.cancelAnimationFrame(I.current), I.current = null), Y.current !== null && (window.cancelAnimationFrame(Y.current), Y.current = null);
|
|
65
136
|
};
|
|
66
|
-
|
|
137
|
+
y(
|
|
67
138
|
() => () => {
|
|
68
|
-
|
|
139
|
+
le(), Re();
|
|
69
140
|
},
|
|
70
141
|
[]
|
|
71
|
-
),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
142
|
+
), y(() => {
|
|
143
|
+
me(M);
|
|
144
|
+
}, [M]), y(() => {
|
|
145
|
+
const o = ce.current;
|
|
146
|
+
ce.current = i;
|
|
147
|
+
const n = !!o && i.length > o.length && i.startsWith(o), d = Oe.test(
|
|
148
|
+
i
|
|
149
|
+
), h = n && d && M.some(
|
|
150
|
+
(m) => !z.has(m)
|
|
151
|
+
), N = n && d;
|
|
152
|
+
if (W.current = i, le(), h) {
|
|
153
|
+
const m = Z.current + 1;
|
|
154
|
+
Z.current = m, me(M).then(() => {
|
|
155
|
+
Z.current === m && U(W.current);
|
|
156
|
+
});
|
|
77
157
|
return;
|
|
78
158
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
159
|
+
if (!N) {
|
|
160
|
+
U(i);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
T.current = window.setTimeout(() => {
|
|
164
|
+
U(W.current), T.current = null;
|
|
165
|
+
}, De);
|
|
166
|
+
}, [M, i]);
|
|
167
|
+
const ae = k.useMemo(() => {
|
|
168
|
+
const o = $.trim();
|
|
169
|
+
if (!o) return null;
|
|
170
|
+
const n = o.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
|
|
171
|
+
if (!n) return null;
|
|
172
|
+
const d = n[2] || "", h = d.match(/\bheight\s*=\s*["']([^"']+)["']/i);
|
|
173
|
+
if (h) {
|
|
174
|
+
const b = fe(h[1]);
|
|
175
|
+
if (b) return b;
|
|
92
176
|
}
|
|
93
|
-
const
|
|
177
|
+
const m = d.match(/\bstyle\s*=\s*["']([^"']+)["']/i)?.[1]?.match(
|
|
94
178
|
/\bheight\s*:\s*([^;]+)/i
|
|
95
179
|
)?.[1];
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
180
|
+
if (m) {
|
|
181
|
+
const b = fe(m);
|
|
182
|
+
if (b) return b;
|
|
99
183
|
}
|
|
100
|
-
const
|
|
101
|
-
return
|
|
102
|
-
}, [
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
184
|
+
const C = d.match(/\bclass\s*=\s*["']([^"']+)["']/i)?.[1];
|
|
185
|
+
return C ? ge(C) : null;
|
|
186
|
+
}, [$]), ue = !!ae, _ = G && t === "sandbox" ? ie ? "100%" : ae ?? `${be}px` : void 0;
|
|
187
|
+
y(() => {
|
|
188
|
+
if (p !== "blackboard") {
|
|
189
|
+
X.current = i;
|
|
106
190
|
return;
|
|
107
191
|
}
|
|
108
|
-
const
|
|
109
|
-
!(
|
|
110
|
-
}, [
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
115
|
-
|
|
116
|
-
<html${
|
|
192
|
+
const o = X.current;
|
|
193
|
+
!(o && i.startsWith(o)) && o && ve((d) => d + 1), X.current = i;
|
|
194
|
+
}, [p, i]), y(() => {
|
|
195
|
+
const o = H.current;
|
|
196
|
+
if (!o) return;
|
|
197
|
+
const n = o.contentDocument;
|
|
198
|
+
if (!n) return;
|
|
199
|
+
n.open(), n.write(`<!DOCTYPE html>
|
|
200
|
+
<html${p === "blackboard" ? ' style="height: 100%;"' : ""}>
|
|
117
201
|
<head>
|
|
118
202
|
<meta charset="utf-8" />
|
|
119
203
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -126,182 +210,179 @@ const He = /<img\b[^>]*>/i, Se = 180, Te = "markdown-flow-ui:sandbox", Ae = "int
|
|
|
126
210
|
<body>
|
|
127
211
|
<div id="root"></div>
|
|
128
212
|
</body>
|
|
129
|
-
</html>`),
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
let
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
140
|
-
const
|
|
141
|
-
return Number.isNaN(
|
|
142
|
-
},
|
|
143
|
-
if (!
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
146
|
-
return
|
|
147
|
-
const
|
|
148
|
-
(
|
|
213
|
+
</html>`), n.close(), re.current = n;
|
|
214
|
+
const d = G && t === "sandbox", h = () => S("pointerdown"), N = () => S("mousedown"), m = () => S("touchstart");
|
|
215
|
+
d && (n.addEventListener("pointerdown", h, !0), n.addEventListener("mousedown", N, !0), n.addEventListener("touchstart", m, !0));
|
|
216
|
+
const C = n.getElementById("root");
|
|
217
|
+
if (!C) return;
|
|
218
|
+
const b = Te(C);
|
|
219
|
+
L.current = b;
|
|
220
|
+
let P = !1;
|
|
221
|
+
const de = (f, w) => {
|
|
222
|
+
const c = f.trim().toLowerCase();
|
|
223
|
+
if (!c) return null;
|
|
224
|
+
const g = Number.parseFloat(c);
|
|
225
|
+
return Number.isNaN(g) ? null : /(dvh|svh|lvh|vh)$/i.test(c) ? g / 100 * w : c.endsWith("px") || /^[0-9.]+$/.test(c) ? g : null;
|
|
226
|
+
}, He = (f, w) => {
|
|
227
|
+
if (!f.trim()) return null;
|
|
228
|
+
const c = ge(f);
|
|
229
|
+
if (c)
|
|
230
|
+
return de(c, w);
|
|
231
|
+
const E = ee(f).find(
|
|
232
|
+
(F) => /^h-\[[0-9.]+px\]$/i.test(F)
|
|
149
233
|
);
|
|
150
|
-
if (!
|
|
151
|
-
const
|
|
152
|
-
if (!
|
|
153
|
-
const
|
|
154
|
-
return Number.isNaN(
|
|
155
|
-
},
|
|
156
|
-
if (!
|
|
157
|
-
const
|
|
234
|
+
if (!E) return null;
|
|
235
|
+
const R = E.match(/^h-\[([0-9.]+)px\]$/i);
|
|
236
|
+
if (!R) return null;
|
|
237
|
+
const A = Number.parseFloat(R[1]);
|
|
238
|
+
return Number.isNaN(A) ? null : A;
|
|
239
|
+
}, Se = () => {
|
|
240
|
+
if (!H.current || !n.body) return null;
|
|
241
|
+
const w = n.body.querySelector(
|
|
158
242
|
".sandbox-wrapper"
|
|
159
243
|
)?.firstElementChild;
|
|
160
|
-
if (!
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
return Math.ceil(
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
244
|
+
if (!w) return null;
|
|
245
|
+
const c = Array.from(w.children);
|
|
246
|
+
if (c.length !== 1) return null;
|
|
247
|
+
const g = c[0], E = g.style.height || g.getAttribute("height"), R = H.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, A = E ? de(E, R) : null;
|
|
248
|
+
if (A !== null)
|
|
249
|
+
return Math.ceil(A);
|
|
250
|
+
const F = He(
|
|
251
|
+
g.getAttribute("class") || "",
|
|
252
|
+
R
|
|
169
253
|
);
|
|
170
|
-
return
|
|
171
|
-
},
|
|
172
|
-
if (!
|
|
173
|
-
const
|
|
254
|
+
return F !== null ? Math.ceil(F) : null;
|
|
255
|
+
}, J = () => {
|
|
256
|
+
if (!H.current || !n.body) return;
|
|
257
|
+
const f = n.body.getBoundingClientRect(), w = n.documentElement?.getBoundingClientRect(), c = f.height, g = w?.height || 0, E = Math.max(c, g), R = Se(), A = Math.max(
|
|
174
258
|
200,
|
|
175
|
-
|
|
259
|
+
R ?? Math.ceil(E)
|
|
176
260
|
);
|
|
177
|
-
|
|
178
|
-
},
|
|
261
|
+
we(A);
|
|
262
|
+
}, j = () => {
|
|
179
263
|
requestAnimationFrame(() => {
|
|
180
|
-
|
|
264
|
+
P || J();
|
|
181
265
|
});
|
|
182
266
|
};
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
267
|
+
V.current = j, J(), j(), Ee ? pe().then((f) => {
|
|
268
|
+
P || (f(n), requestAnimationFrame(() => {
|
|
269
|
+
P || (q(!0), j());
|
|
186
270
|
}));
|
|
187
271
|
}).catch(() => {
|
|
188
|
-
|
|
189
|
-
}) :
|
|
190
|
-
const
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
|
|
272
|
+
P || (q(!0), j());
|
|
273
|
+
}) : q(!0);
|
|
274
|
+
const K = new ResizeObserver(() => J());
|
|
275
|
+
return K.observe(n.body), C && K.observe(C), () => {
|
|
276
|
+
P = !0, K.disconnect(), d && (n.removeEventListener("pointerdown", h, !0), n.removeEventListener("mousedown", N, !0), n.removeEventListener("touchstart", m, !0)), setTimeout(() => {
|
|
277
|
+
b.unmount(), L.current = null, re.current = null, V.current = () => {
|
|
194
278
|
};
|
|
195
279
|
}, 0);
|
|
196
280
|
};
|
|
197
|
-
}, []),
|
|
198
|
-
const
|
|
199
|
-
|
|
281
|
+
}, []), y(() => {
|
|
282
|
+
const o = () => {
|
|
283
|
+
Ce(!!document.fullscreenElement);
|
|
200
284
|
};
|
|
201
|
-
return document.addEventListener("fullscreenchange",
|
|
285
|
+
return document.addEventListener("fullscreenchange", o), () => document.removeEventListener("fullscreenchange", o);
|
|
202
286
|
}, []);
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
287
|
+
const Ae = () => {
|
|
288
|
+
const o = ne.current || H.current;
|
|
289
|
+
if (o) {
|
|
206
290
|
if (document.fullscreenElement) {
|
|
207
291
|
document.exitFullscreen().catch(() => {
|
|
208
292
|
});
|
|
209
293
|
return;
|
|
210
294
|
}
|
|
211
|
-
|
|
295
|
+
o.requestFullscreen && o.requestFullscreen().catch(() => {
|
|
212
296
|
});
|
|
213
297
|
}
|
|
214
298
|
};
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
|
|
299
|
+
y(() => {
|
|
300
|
+
const o = L.current;
|
|
301
|
+
o && (o.render(
|
|
302
|
+
/* @__PURE__ */ v.jsx(
|
|
303
|
+
Ie,
|
|
220
304
|
{
|
|
221
|
-
html:
|
|
222
|
-
loadingText:
|
|
223
|
-
styleLoadingText:
|
|
224
|
-
scriptLoadingText:
|
|
225
|
-
fullScreenButtonText:
|
|
226
|
-
hideFullScreen:
|
|
227
|
-
resetToken:
|
|
228
|
-
hasRootVhHeight:
|
|
229
|
-
mode:
|
|
305
|
+
html: $,
|
|
306
|
+
loadingText: a,
|
|
307
|
+
styleLoadingText: s,
|
|
308
|
+
scriptLoadingText: u,
|
|
309
|
+
fullScreenButtonText: x,
|
|
310
|
+
hideFullScreen: te,
|
|
311
|
+
resetToken: se,
|
|
312
|
+
hasRootVhHeight: ue,
|
|
313
|
+
mode: p,
|
|
314
|
+
stretchRootHeight: ie
|
|
230
315
|
}
|
|
231
316
|
)
|
|
232
|
-
), requestAnimationFrame(() =>
|
|
317
|
+
), I.current = window.requestAnimationFrame(() => {
|
|
318
|
+
V.current?.(), I.current = null;
|
|
319
|
+
}));
|
|
233
320
|
}, [
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
L
|
|
321
|
+
$,
|
|
322
|
+
a,
|
|
323
|
+
s,
|
|
324
|
+
u,
|
|
325
|
+
x,
|
|
326
|
+
se,
|
|
327
|
+
p
|
|
242
328
|
]);
|
|
243
|
-
const
|
|
329
|
+
const ye = [
|
|
244
330
|
"w-full relative content-render-iframe-sandbox",
|
|
245
|
-
|
|
246
|
-
].filter(Boolean).join(" ")
|
|
247
|
-
return /* @__PURE__ */
|
|
331
|
+
G ? "h-full overflow-auto flex flex-col" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
|
|
332
|
+
].filter(Boolean).join(" ");
|
|
333
|
+
return /* @__PURE__ */ v.jsxs(
|
|
248
334
|
"div",
|
|
249
335
|
{
|
|
250
|
-
ref:
|
|
251
|
-
"data-root-vh":
|
|
252
|
-
className:
|
|
253
|
-
style:
|
|
254
|
-
height:
|
|
255
|
-
minHeight:
|
|
336
|
+
ref: ne,
|
|
337
|
+
"data-root-vh": ue ? "true" : "false",
|
|
338
|
+
className: ye,
|
|
339
|
+
style: _ ? {
|
|
340
|
+
height: _,
|
|
341
|
+
minHeight: _
|
|
256
342
|
} : void 0,
|
|
257
343
|
children: [
|
|
258
|
-
!
|
|
344
|
+
!te && /* @__PURE__ */ v.jsx(
|
|
259
345
|
"button",
|
|
260
346
|
{
|
|
261
347
|
type: "button",
|
|
262
|
-
onClick:
|
|
348
|
+
onClick: Ae,
|
|
263
349
|
className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
|
|
264
|
-
children:
|
|
350
|
+
children: xe ? "退出全屏" : x || "全屏浏览"
|
|
265
351
|
}
|
|
266
352
|
),
|
|
267
|
-
|
|
353
|
+
p === "blackboard" && t === "markdown" ? /* @__PURE__ */ v.jsx(
|
|
268
354
|
"div",
|
|
269
355
|
{
|
|
270
|
-
onMouseDown: () =>
|
|
271
|
-
onPointerDown: () =>
|
|
272
|
-
onTouchStart: () =>
|
|
273
|
-
children: /* @__PURE__ */
|
|
356
|
+
onMouseDown: () => S("mousedown"),
|
|
357
|
+
onPointerDown: () => S("pointerdown"),
|
|
358
|
+
onTouchStart: () => S("touchstart"),
|
|
359
|
+
children: /* @__PURE__ */ v.jsx(Ne, { content: e })
|
|
274
360
|
}
|
|
275
|
-
) : /* @__PURE__ */
|
|
276
|
-
|
|
361
|
+
) : /* @__PURE__ */ v.jsxs(v.Fragment, { children: [
|
|
362
|
+
null,
|
|
363
|
+
/* @__PURE__ */ v.jsx(
|
|
277
364
|
"iframe",
|
|
278
365
|
{
|
|
279
|
-
ref:
|
|
366
|
+
ref: H,
|
|
280
367
|
sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
|
|
281
368
|
allow: "fullscreen",
|
|
282
369
|
allowFullScreen: !0,
|
|
283
|
-
className: [
|
|
370
|
+
className: [r, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
|
|
284
371
|
style: {
|
|
285
|
-
height:
|
|
286
|
-
minHeight:
|
|
372
|
+
height: _ ?? "100%",
|
|
373
|
+
minHeight: _,
|
|
287
374
|
margin: "auto",
|
|
288
|
-
visibility:
|
|
375
|
+
visibility: "visible"
|
|
289
376
|
}
|
|
290
377
|
}
|
|
291
378
|
),
|
|
292
|
-
|
|
293
|
-
Re,
|
|
294
|
-
{
|
|
295
|
-
"aria-label": p || "Preparing sandbox styles",
|
|
296
|
-
className: "text-primary h-7 w-7 animate-spin"
|
|
297
|
-
}
|
|
298
|
-
) }) : null
|
|
379
|
+
null
|
|
299
380
|
] })
|
|
300
381
|
]
|
|
301
382
|
}
|
|
302
383
|
);
|
|
303
384
|
};
|
|
304
385
|
export {
|
|
305
|
-
|
|
386
|
+
Ke as default
|
|
306
387
|
};
|
|
307
388
|
//# sourceMappingURL=IframeSandbox.es.js.map
|