markdown-flow-ui 0.1.99-beta.3 → 0.1.100-beta.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/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/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js +7 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js +17 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.js +7 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js +29 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.cjs.js +7 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.cjs.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.es.js +18 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.es.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js +7 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js +16 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js +7 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js +16 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.js +7 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.js.map +1 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.es.js +23 -0
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.es.js.map +1 -0
- 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/remark-flow@0.1.6/node_modules/remark-flow/dist/index.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/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js.map +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.es.js +1 -1
- package/dist/_virtual/index.cjs.js +1 -1
- package/dist/_virtual/index.cjs2.js +1 -1
- package/dist/_virtual/index.cjs3.js +1 -1
- package/dist/_virtual/index.cjs7.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es.js +1 -0
- package/dist/_virtual/index.es2.js +2 -5
- package/dist/_virtual/index.es2.js.map +1 -1
- package/dist/_virtual/index.es3.js +5 -2
- package/dist/_virtual/index.es3.js.map +1 -1
- package/dist/_virtual/index.es7.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/assets/markdown-flow-ui.css +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.es.js +223 -190
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
- package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.es.js +21 -21
- package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
- package/dist/components/ContentRender/index.cjs.js +1 -1
- package/dist/components/ContentRender/index.es.js +6 -5
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js +2 -2
- package/dist/components/Slide/Player.cjs.js +2 -0
- package/dist/components/Slide/Player.cjs.js.map +1 -0
- package/dist/components/Slide/Player.d.ts +19 -0
- package/dist/components/Slide/Player.es.js +327 -0
- package/dist/components/Slide/Player.es.js.map +1 -0
- package/dist/components/Slide/Slide.cjs.js +2 -0
- package/dist/components/Slide/Slide.cjs.js.map +1 -0
- package/dist/components/Slide/Slide.d.ts +12 -0
- package/dist/components/Slide/Slide.es.js +394 -0
- package/dist/components/Slide/Slide.es.js.map +1 -0
- package/dist/components/Slide/Slide.stories.d.ts +47 -0
- package/dist/components/Slide/diff-utils.cjs.js +5 -0
- package/dist/components/Slide/diff-utils.cjs.js.map +1 -0
- package/dist/components/Slide/diff-utils.d.ts +18 -0
- package/dist/components/Slide/diff-utils.es.js +113 -0
- package/dist/components/Slide/diff-utils.es.js.map +1 -0
- package/dist/components/Slide/index.d.ts +12 -0
- package/dist/components/Slide/interaction-defaults.cjs.js +2 -0
- package/dist/components/Slide/interaction-defaults.cjs.js.map +1 -0
- package/dist/components/Slide/interaction-defaults.d.ts +23 -0
- package/dist/components/Slide/interaction-defaults.es.js +85 -0
- package/dist/components/Slide/interaction-defaults.es.js.map +1 -0
- package/dist/components/Slide/types.d.ts +24 -0
- package/dist/components/Slide/useSlide.cjs.js +2 -0
- package/dist/components/Slide/useSlide.cjs.js.map +1 -0
- package/dist/components/Slide/useSlide.d.ts +21 -0
- package/dist/components/Slide/useSlide.es.js +102 -0
- package/dist/components/Slide/useSlide.es.js.map +1 -0
- package/dist/components/index.d.ts +5 -0
- 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 +21 -9
- package/dist/index.es.js.map +1 -1
- package/dist/lib/browserUserActivation.cjs.js +2 -0
- package/dist/lib/browserUserActivation.cjs.js.map +1 -0
- package/dist/lib/browserUserActivation.d.ts +5 -0
- package/dist/lib/browserUserActivation.es.js +13 -0
- package/dist/lib/browserUserActivation.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 +3 -2
- package/dist/renderer.es.js +20 -8
- package/dist/renderer.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,99 +1,119 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import
|
|
5
|
-
import { splitContentSegments as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { j as u } from "../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import se, { useRef as d, useState as A, useCallback as ve, useEffect as C } from "react";
|
|
3
|
+
import { createRoot as xe } from "react-dom/client";
|
|
4
|
+
import Ee from "./SandboxApp.es.js";
|
|
5
|
+
import { splitContentSegments as ye } from "./utils/split-content.es.js";
|
|
6
|
+
import Ce from "./ContentRender.es.js";
|
|
7
|
+
import Re from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js";
|
|
8
|
+
let G = null;
|
|
9
|
+
const ce = () => (G || (G = import("./blackboard-vendor.es.js").then(
|
|
10
|
+
(s) => s.injectBlackboardLibraries
|
|
11
|
+
)), G);
|
|
12
|
+
typeof window < "u" && ce();
|
|
13
|
+
const He = /<img\b[^>]*>/i, Se = 180, Te = "markdown-flow-ui:sandbox", Ae = "interaction", Me = 240, ae = (s) => s.split(/\s+/).filter(Boolean).map((n) => n.split(":").pop() || n), ie = (s) => {
|
|
14
|
+
const n = s.trim().toLowerCase();
|
|
15
|
+
if (!n) return null;
|
|
16
|
+
const m = n.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
|
|
17
|
+
return m ? `${m[1]}${m[2].toLowerCase()}` : null;
|
|
18
|
+
}, le = (s) => {
|
|
13
19
|
if (!s.trim()) return null;
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
20
|
+
const n = ae(s);
|
|
21
|
+
if (n.includes("h-screen") || n.includes("h-dvh"))
|
|
16
22
|
return "100dvh";
|
|
17
|
-
if (
|
|
23
|
+
if (n.includes("h-svh"))
|
|
18
24
|
return "100svh";
|
|
19
|
-
if (
|
|
25
|
+
if (n.includes("h-lvh"))
|
|
20
26
|
return "100lvh";
|
|
21
|
-
const
|
|
22
|
-
(
|
|
27
|
+
const m = n.find(
|
|
28
|
+
(M) => /^h-\[[0-9.]+(vh|dvh|svh|lvh)\]$/i.test(M)
|
|
23
29
|
);
|
|
24
|
-
if (!
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
},
|
|
30
|
+
if (!m) return null;
|
|
31
|
+
const p = m.match(/^h-\[([0-9.]+)(vh|dvh|svh|lvh)\]$/i);
|
|
32
|
+
return p ? `${p[1]}${p[2].toLowerCase()}` : null;
|
|
33
|
+
}, Oe = ({
|
|
28
34
|
content: s,
|
|
29
|
-
type:
|
|
30
|
-
className:
|
|
31
|
-
loadingText:
|
|
32
|
-
styleLoadingText:
|
|
33
|
-
scriptLoadingText:
|
|
34
|
-
fullScreenButtonText:
|
|
35
|
-
hideFullScreen:
|
|
36
|
-
mode:
|
|
35
|
+
type: n,
|
|
36
|
+
className: m,
|
|
37
|
+
loadingText: p,
|
|
38
|
+
styleLoadingText: M,
|
|
39
|
+
scriptLoadingText: U,
|
|
40
|
+
fullScreenButtonText: j,
|
|
41
|
+
hideFullScreen: W = !1,
|
|
42
|
+
mode: h = "content"
|
|
37
43
|
}) => {
|
|
38
|
-
const
|
|
39
|
-
}), [,
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
const X = d(null), E = d(null), _ = d(null), Y = d(null), D = d(() => {
|
|
45
|
+
}), [ue, de] = A(480), Z = d(0), [J, he] = A(0), [me, fe] = A(!1), [L, O] = A(
|
|
46
|
+
n !== "sandbox"
|
|
47
|
+
), B = h === "blackboard", F = d(""), r = se.useMemo(() => {
|
|
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(`
|
|
42
50
|
`)) || "";
|
|
43
|
-
}, [s,
|
|
44
|
-
|
|
51
|
+
}, [s, h]), [k, K] = A(r), Q = d(r), z = d(r), R = d(null), y = ve((t) => {
|
|
52
|
+
if (typeof window > "u")
|
|
53
|
+
return;
|
|
54
|
+
const e = Date.now();
|
|
55
|
+
e - Z.current < Me || (Z.current = e, window.postMessage(
|
|
56
|
+
{
|
|
57
|
+
source: Te,
|
|
58
|
+
type: Ae,
|
|
59
|
+
eventType: t
|
|
60
|
+
},
|
|
61
|
+
window.location.origin
|
|
62
|
+
));
|
|
63
|
+
}, []), $ = () => {
|
|
64
|
+
R.current !== null && (window.clearTimeout(R.current), R.current = null);
|
|
45
65
|
};
|
|
46
|
-
|
|
66
|
+
C(
|
|
47
67
|
() => () => {
|
|
48
|
-
|
|
68
|
+
$();
|
|
49
69
|
},
|
|
50
70
|
[]
|
|
51
|
-
),
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
if (!(
|
|
56
|
-
|
|
71
|
+
), C(() => {
|
|
72
|
+
const t = Q.current;
|
|
73
|
+
Q.current = r;
|
|
74
|
+
const e = !!t && r.length > t.length && r.startsWith(t), i = He.test(r);
|
|
75
|
+
if (!(e && i)) {
|
|
76
|
+
$(), z.current = r, K(r);
|
|
57
77
|
return;
|
|
58
78
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
}, [
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
if (!e) return null;
|
|
66
|
-
const t = e.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
|
|
79
|
+
z.current = r, $(), R.current = window.setTimeout(() => {
|
|
80
|
+
K(z.current), R.current = null;
|
|
81
|
+
}, Se);
|
|
82
|
+
}, [r]);
|
|
83
|
+
const ee = se.useMemo(() => {
|
|
84
|
+
const t = k.trim();
|
|
67
85
|
if (!t) return null;
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
const e = t.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
|
|
87
|
+
if (!e) return null;
|
|
88
|
+
const i = e[2] || "", l = i.match(/\bheight\s*=\s*["']([^"']+)["']/i);
|
|
89
|
+
if (l) {
|
|
90
|
+
const f = ie(l[1]);
|
|
91
|
+
if (f) return f;
|
|
72
92
|
}
|
|
73
|
-
const
|
|
93
|
+
const S = i.match(/\bstyle\s*=\s*["']([^"']+)["']/i)?.[1]?.match(
|
|
74
94
|
/\bheight\s*:\s*([^;]+)/i
|
|
75
95
|
)?.[1];
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
96
|
+
if (S) {
|
|
97
|
+
const f = ie(S);
|
|
98
|
+
if (f) return f;
|
|
79
99
|
}
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
}, [
|
|
83
|
-
|
|
84
|
-
if (
|
|
85
|
-
|
|
100
|
+
const g = i.match(/\bclass\s*=\s*["']([^"']+)["']/i)?.[1];
|
|
101
|
+
return g ? le(g) : null;
|
|
102
|
+
}, [k]), te = !!ee, ne = n === "sandbox", H = B && n === "sandbox" ? ee ?? `${ue}px` : void 0;
|
|
103
|
+
C(() => {
|
|
104
|
+
if (h !== "blackboard") {
|
|
105
|
+
F.current = r;
|
|
86
106
|
return;
|
|
87
107
|
}
|
|
88
|
-
const
|
|
89
|
-
!(
|
|
90
|
-
}, [
|
|
91
|
-
const
|
|
92
|
-
if (!e) return;
|
|
93
|
-
const t = e.contentDocument;
|
|
108
|
+
const t = F.current;
|
|
109
|
+
!(t && r.startsWith(t)) && t && he((i) => i + 1), F.current = r;
|
|
110
|
+
}, [r, h]), C(() => {
|
|
111
|
+
const t = E.current;
|
|
94
112
|
if (!t) return;
|
|
95
|
-
|
|
96
|
-
|
|
113
|
+
const e = t.contentDocument;
|
|
114
|
+
if (!e) return;
|
|
115
|
+
e.open(), e.write(`<!DOCTYPE html>
|
|
116
|
+
<html${h === "blackboard" ? ' style="height: 100%;"' : ""}>
|
|
97
117
|
<head>
|
|
98
118
|
<meta charset="utf-8" />
|
|
99
119
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -106,169 +126,182 @@ const mt = () => import("./blackboard-vendor.es.js").then((s) => s.injectBlackbo
|
|
|
106
126
|
<body>
|
|
107
127
|
<div id="root"></div>
|
|
108
128
|
</body>
|
|
109
|
-
</html>`),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
eventType: i
|
|
120
|
-
},
|
|
121
|
-
window.location.origin
|
|
122
|
-
));
|
|
123
|
-
}, j = G && r === "sandbox", C = () => a("pointerdown"), y = () => a("touchstart");
|
|
124
|
-
j && (t.addEventListener("pointerdown", C, !0), t.addEventListener("touchstart", y, !0));
|
|
125
|
-
const u = t.getElementById("root");
|
|
126
|
-
if (!u) return;
|
|
127
|
-
const Y = at(u);
|
|
128
|
-
_.current = Y;
|
|
129
|
-
let A = !1;
|
|
130
|
-
const Z = (i, c) => {
|
|
131
|
-
const o = i.trim().toLowerCase();
|
|
129
|
+
</html>`), e.close(), Y.current = e;
|
|
130
|
+
const i = B && n === "sandbox", l = () => y("pointerdown"), V = () => y("mousedown"), S = () => y("touchstart");
|
|
131
|
+
i && (e.addEventListener("pointerdown", l, !0), e.addEventListener("mousedown", V, !0), e.addEventListener("touchstart", S, !0));
|
|
132
|
+
const g = e.getElementById("root");
|
|
133
|
+
if (!g) return;
|
|
134
|
+
const f = xe(g);
|
|
135
|
+
_.current = f;
|
|
136
|
+
let T = !1;
|
|
137
|
+
const oe = (c, b) => {
|
|
138
|
+
const o = c.trim().toLowerCase();
|
|
132
139
|
if (!o) return null;
|
|
133
|
-
const
|
|
134
|
-
return Number.isNaN(
|
|
135
|
-
},
|
|
136
|
-
if (!
|
|
137
|
-
const o =
|
|
140
|
+
const a = Number.parseFloat(o);
|
|
141
|
+
return Number.isNaN(a) ? null : /(dvh|svh|lvh|vh)$/i.test(o) ? a / 100 * b : o.endsWith("px") || /^[0-9.]+$/.test(o) ? a : null;
|
|
142
|
+
}, ge = (c, b) => {
|
|
143
|
+
if (!c.trim()) return null;
|
|
144
|
+
const o = le(c);
|
|
138
145
|
if (o)
|
|
139
|
-
return
|
|
140
|
-
const
|
|
141
|
-
(
|
|
146
|
+
return oe(o, b);
|
|
147
|
+
const w = ae(c).find(
|
|
148
|
+
(I) => /^h-\[[0-9.]+px\]$/i.test(I)
|
|
142
149
|
);
|
|
143
|
-
if (!
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
146
|
-
const
|
|
147
|
-
return Number.isNaN(
|
|
148
|
-
},
|
|
149
|
-
if (!
|
|
150
|
-
const
|
|
150
|
+
if (!w) return null;
|
|
151
|
+
const v = w.match(/^h-\[([0-9.]+)px\]$/i);
|
|
152
|
+
if (!v) return null;
|
|
153
|
+
const x = Number.parseFloat(v[1]);
|
|
154
|
+
return Number.isNaN(x) ? null : x;
|
|
155
|
+
}, we = () => {
|
|
156
|
+
if (!E.current || !e.body) return null;
|
|
157
|
+
const b = e.body.querySelector(
|
|
151
158
|
".sandbox-wrapper"
|
|
152
159
|
)?.firstElementChild;
|
|
153
|
-
if (!
|
|
154
|
-
const o = Array.from(
|
|
160
|
+
if (!b) return null;
|
|
161
|
+
const o = Array.from(b.children);
|
|
155
162
|
if (o.length !== 1) return null;
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
return Math.ceil(
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
const a = o[0], w = a.style.height || a.getAttribute("height"), v = E.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, x = w ? oe(w, v) : null;
|
|
164
|
+
if (x !== null)
|
|
165
|
+
return Math.ceil(x);
|
|
166
|
+
const I = ge(
|
|
167
|
+
a.getAttribute("class") || "",
|
|
168
|
+
v
|
|
162
169
|
);
|
|
163
|
-
return
|
|
164
|
-
},
|
|
165
|
-
if (!
|
|
166
|
-
const
|
|
170
|
+
return I !== null ? Math.ceil(I) : null;
|
|
171
|
+
}, P = () => {
|
|
172
|
+
if (!E.current || !e.body) return;
|
|
173
|
+
const c = e.body.getBoundingClientRect(), b = e.documentElement?.getBoundingClientRect(), o = c.height, a = b?.height || 0, w = Math.max(o, a), v = we(), x = Math.max(
|
|
167
174
|
200,
|
|
168
|
-
|
|
175
|
+
v ?? Math.ceil(w)
|
|
169
176
|
);
|
|
170
|
-
|
|
171
|
-
},
|
|
177
|
+
de(x);
|
|
178
|
+
}, N = () => {
|
|
172
179
|
requestAnimationFrame(() => {
|
|
173
|
-
|
|
180
|
+
T || P();
|
|
174
181
|
});
|
|
175
182
|
};
|
|
176
|
-
|
|
177
|
-
|
|
183
|
+
D.current = N, P(), N(), ne ? ce().then((c) => {
|
|
184
|
+
T || (c(e), requestAnimationFrame(() => {
|
|
185
|
+
T || (O(!0), N());
|
|
186
|
+
}));
|
|
178
187
|
}).catch(() => {
|
|
179
|
-
|
|
180
|
-
});
|
|
181
|
-
const
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
T || (O(!0), N());
|
|
189
|
+
}) : O(!0);
|
|
190
|
+
const q = new ResizeObserver(() => P());
|
|
191
|
+
return q.observe(e.body), g && q.observe(g), () => {
|
|
192
|
+
T = !0, q.disconnect(), i && (e.removeEventListener("pointerdown", l, !0), e.removeEventListener("mousedown", V, !0), e.removeEventListener("touchstart", S, !0)), setTimeout(() => {
|
|
193
|
+
f.unmount(), _.current = null, Y.current = null, D.current = () => {
|
|
185
194
|
};
|
|
186
195
|
}, 0);
|
|
187
196
|
};
|
|
188
|
-
}, []),
|
|
189
|
-
const
|
|
190
|
-
|
|
197
|
+
}, []), C(() => {
|
|
198
|
+
const t = () => {
|
|
199
|
+
fe(!!document.fullscreenElement);
|
|
191
200
|
};
|
|
192
|
-
return document.addEventListener("fullscreenchange",
|
|
201
|
+
return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
|
|
193
202
|
}, []);
|
|
194
|
-
const
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
203
|
+
const be = () => {
|
|
204
|
+
const t = X.current || E.current;
|
|
205
|
+
if (t) {
|
|
197
206
|
if (document.fullscreenElement) {
|
|
198
207
|
document.exitFullscreen().catch(() => {
|
|
199
208
|
});
|
|
200
209
|
return;
|
|
201
210
|
}
|
|
202
|
-
|
|
211
|
+
t.requestFullscreen && t.requestFullscreen().catch(() => {
|
|
203
212
|
});
|
|
204
213
|
}
|
|
205
214
|
};
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
|
|
215
|
+
C(() => {
|
|
216
|
+
const t = _.current;
|
|
217
|
+
!t || !L || (t.render(
|
|
218
|
+
/* @__PURE__ */ u.jsx(
|
|
219
|
+
Ee,
|
|
211
220
|
{
|
|
212
|
-
html:
|
|
213
|
-
loadingText:
|
|
214
|
-
styleLoadingText:
|
|
215
|
-
scriptLoadingText:
|
|
216
|
-
fullScreenButtonText:
|
|
217
|
-
hideFullScreen:
|
|
218
|
-
resetToken:
|
|
219
|
-
hasRootVhHeight:
|
|
220
|
-
mode:
|
|
221
|
+
html: k,
|
|
222
|
+
loadingText: p,
|
|
223
|
+
styleLoadingText: M,
|
|
224
|
+
scriptLoadingText: U,
|
|
225
|
+
fullScreenButtonText: j,
|
|
226
|
+
hideFullScreen: W,
|
|
227
|
+
resetToken: J,
|
|
228
|
+
hasRootVhHeight: te,
|
|
229
|
+
mode: h
|
|
221
230
|
}
|
|
222
231
|
)
|
|
223
|
-
), requestAnimationFrame(() =>
|
|
232
|
+
), requestAnimationFrame(() => D.current?.()));
|
|
224
233
|
}, [
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
k,
|
|
235
|
+
p,
|
|
236
|
+
M,
|
|
237
|
+
U,
|
|
238
|
+
j,
|
|
239
|
+
J,
|
|
240
|
+
h,
|
|
241
|
+
L
|
|
232
242
|
]);
|
|
233
|
-
const
|
|
243
|
+
const pe = [
|
|
234
244
|
"w-full relative content-render-iframe-sandbox",
|
|
235
|
-
|
|
236
|
-
].filter(Boolean).join(" ");
|
|
237
|
-
return /* @__PURE__ */
|
|
245
|
+
B ? "h-full overflow-auto flex flex-col" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
|
|
246
|
+
].filter(Boolean).join(" "), re = ne && !L;
|
|
247
|
+
return /* @__PURE__ */ u.jsxs(
|
|
238
248
|
"div",
|
|
239
249
|
{
|
|
240
|
-
ref:
|
|
241
|
-
"data-root-vh":
|
|
242
|
-
className:
|
|
250
|
+
ref: X,
|
|
251
|
+
"data-root-vh": te ? "true" : "false",
|
|
252
|
+
className: pe,
|
|
253
|
+
style: H ? {
|
|
254
|
+
height: H,
|
|
255
|
+
minHeight: H
|
|
256
|
+
} : void 0,
|
|
243
257
|
children: [
|
|
244
|
-
!
|
|
258
|
+
!W && /* @__PURE__ */ u.jsx(
|
|
245
259
|
"button",
|
|
246
260
|
{
|
|
247
261
|
type: "button",
|
|
248
|
-
onClick:
|
|
262
|
+
onClick: be,
|
|
249
263
|
className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
|
|
250
|
-
children:
|
|
264
|
+
children: me ? "退出全屏" : j || "全屏浏览"
|
|
251
265
|
}
|
|
252
266
|
),
|
|
253
|
-
|
|
254
|
-
"
|
|
267
|
+
h === "blackboard" && n === "markdown" ? /* @__PURE__ */ u.jsx(
|
|
268
|
+
"div",
|
|
255
269
|
{
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
className: [f, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
|
|
261
|
-
style: {
|
|
262
|
-
height: "100%",
|
|
263
|
-
margin: "auto"
|
|
264
|
-
}
|
|
270
|
+
onMouseDown: () => y("mousedown"),
|
|
271
|
+
onPointerDown: () => y("pointerdown"),
|
|
272
|
+
onTouchStart: () => y("touchstart"),
|
|
273
|
+
children: /* @__PURE__ */ u.jsx(Ce, { content: s })
|
|
265
274
|
}
|
|
266
|
-
)
|
|
275
|
+
) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
276
|
+
/* @__PURE__ */ u.jsx(
|
|
277
|
+
"iframe",
|
|
278
|
+
{
|
|
279
|
+
ref: E,
|
|
280
|
+
sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
|
|
281
|
+
allow: "fullscreen",
|
|
282
|
+
allowFullScreen: !0,
|
|
283
|
+
className: [m, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
|
|
284
|
+
style: {
|
|
285
|
+
height: H ?? "100%",
|
|
286
|
+
minHeight: H,
|
|
287
|
+
margin: "auto",
|
|
288
|
+
visibility: re ? "hidden" : "visible"
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
re ? /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute inset-0 z-20 flex items-center justify-center", children: /* @__PURE__ */ u.jsx(
|
|
293
|
+
Re,
|
|
294
|
+
{
|
|
295
|
+
"aria-label": p || "Preparing sandbox styles",
|
|
296
|
+
className: "text-primary h-7 w-7 animate-spin"
|
|
297
|
+
}
|
|
298
|
+
) }) : null
|
|
299
|
+
] })
|
|
267
300
|
]
|
|
268
301
|
}
|
|
269
302
|
);
|
|
270
303
|
};
|
|
271
304
|
export {
|
|
272
|
-
|
|
305
|
+
Oe as default
|
|
273
306
|
};
|
|
274
307
|
//# sourceMappingURL=IframeSandbox.es.js.map
|