markdown-flow-ui 0.1.128 → 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/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/components/EditorToolbar.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +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 +30 -30
- package/dist/components/Slide/Player.es.js +721 -638
- 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 +758 -638
- 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/useSlide.cjs.js +1 -1
- package/dist/components/Slide/useSlide.cjs.js.map +1 -1
- package/dist/components/Slide/useSlide.d.ts +2 -0
- package/dist/components/Slide/useSlide.es.js +124 -105
- package/dist/components/Slide/useSlide.es.js.map +1 -1
- package/dist/components/Slide/utils/audioSegments.cjs.js +2 -0
- package/dist/components/Slide/utils/audioSegments.cjs.js.map +1 -0
- package/dist/components/Slide/utils/audioSegments.d.ts +2 -0
- package/dist/components/Slide/utils/audioSegments.es.js +21 -0
- package/dist/components/Slide/utils/audioSegments.es.js.map +1 -0
- package/dist/components/Slide/utils/audioSegments.test.d.ts +1 -0
- package/dist/components/Slide/utils/playbackSequence.cjs.js +1 -1
- package/dist/components/Slide/utils/playbackSequence.cjs.js.map +1 -1
- package/dist/components/Slide/utils/playbackSequence.d.ts +10 -0
- package/dist/components/Slide/utils/playbackSequence.es.js +15 -6
- package/dist/components/Slide/utils/playbackSequence.es.js.map +1 -1
- 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/Slide/utils/subtitleCue.cjs.js +2 -2
- package/dist/components/Slide/utils/subtitleCue.cjs.js.map +1 -1
- package/dist/components/Slide/utils/subtitleCue.d.ts +21 -0
- package/dist/components/Slide/utils/subtitleCue.es.js +146 -49
- package/dist/components/Slide/utils/subtitleCue.es.js.map +1 -1
- package/dist/components/Slide/utils/subtitleJumpNavigation.cjs.js +2 -0
- package/dist/components/Slide/utils/subtitleJumpNavigation.cjs.js.map +1 -0
- package/dist/components/Slide/utils/subtitleJumpNavigation.d.ts +10 -0
- package/dist/components/Slide/utils/subtitleJumpNavigation.es.js +22 -0
- package/dist/components/Slide/utils/subtitleJumpNavigation.es.js.map +1 -0
- package/dist/components/Slide/utils/subtitleJumpNavigation.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/lucide-react/dist/esm/icons/fast-forward.cjs.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js.map +1 -0
- 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
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js +0 -16
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js +0 -16
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js.map +0 -1
|
@@ -1,112 +1,116 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { inspectViewportHeightFromHtmlRootString as
|
|
7
|
-
import { SANDBOX_INTERACTION_MESSAGE_TYPE as
|
|
8
|
-
import { injectScalingSystem as
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { j as M } from "../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import W, { useRef as i, useState as y, useCallback as Le, useEffect as H, useMemo as Ue } from "react";
|
|
3
|
+
import { createRoot as Ye } from "react-dom/client";
|
|
4
|
+
import Xe from "./SandboxApp.es.js";
|
|
5
|
+
import Ze from "./ContentRender.es.js";
|
|
6
|
+
import { inspectViewportHeightFromHtmlRootString as ye, EMPTY_ROOT_HEIGHT_META as Je, parseExplicitHeight as Te, inspectViewportHeightFromNodeChain as Ke, resolveExplicitHeightFromNodeChain as Qe } from "./utils/iframe-viewport-height.es.js";
|
|
7
|
+
import { SANDBOX_INTERACTION_MESSAGE_TYPE as et, SANDBOX_INTERACTION_MESSAGE_SOURCE as tt } from "../../lib/sandboxInteraction.es.js";
|
|
8
|
+
import { injectScalingSystem as nt } from "./utils/iframe-scaling.es.js";
|
|
9
|
+
import { getContentRenderLocaleTexts as rt } from "./contentRenderI18n.es.js";
|
|
10
|
+
let le = null;
|
|
11
|
+
const ot = () => (le || (le = import("./blackboard-vendor.es.js").then(
|
|
11
12
|
(c) => c.injectBlackboardLibraries
|
|
12
|
-
)),
|
|
13
|
+
)), le), it = /<img\b[^>]*>/i, st = 180, ct = 240, lt = (c) => c.split(/\s+/).filter(Boolean).map((o) => {
|
|
13
14
|
const s = o.split(":");
|
|
14
15
|
return s[s.length - 1] !== "h-screen" && s[s.length - 1] !== "min-h-screen" ? o : (s[s.length - 1] = "h-full", s.join(":"));
|
|
15
|
-
}).join(" "),
|
|
16
|
+
}).join(" "), at = (c, o) => !o || !c.trim() ? c : c.replace(
|
|
16
17
|
/^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
|
|
17
|
-
(s,
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
18
|
+
(s, S, T = "") => {
|
|
19
|
+
const h = T.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
|
|
20
|
+
if (!h)
|
|
20
21
|
return s;
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
`class=${
|
|
22
|
+
const A = lt(h[2]);
|
|
23
|
+
return A === h[2] ? s : `${S}${T.replace(
|
|
24
|
+
h[0],
|
|
25
|
+
`class=${h[1]}${A}${h[1]}`
|
|
25
26
|
)}>`;
|
|
26
27
|
}
|
|
27
|
-
),
|
|
28
|
+
), xt = ({
|
|
28
29
|
content: c,
|
|
29
30
|
type: o,
|
|
30
31
|
className: s,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
locale: S,
|
|
33
|
+
loadingText: T,
|
|
34
|
+
styleLoadingText: h,
|
|
35
|
+
scriptLoadingText: A,
|
|
36
|
+
fullScreenButtonText: Ae,
|
|
37
|
+
exitFullScreenButtonText: ke,
|
|
38
|
+
hideFullScreen: _e = !1,
|
|
35
39
|
mode: a = "content",
|
|
36
|
-
replaceRootScreenHeightWithFull:
|
|
37
|
-
enableScaling:
|
|
38
|
-
disableLoadingOverlay:
|
|
40
|
+
replaceRootScreenHeightWithFull: Fe = !1,
|
|
41
|
+
enableScaling: Ie = !1,
|
|
42
|
+
disableLoadingOverlay: Y = !1
|
|
39
43
|
}) => {
|
|
40
|
-
const D = i(null), f = i(null),
|
|
41
|
-
}), [
|
|
44
|
+
const ae = rt(S), Ne = Ae || ae.sandboxFullscreenButtonText, Be = ke || ae.sandboxExitFullscreenButtonText, D = i(null), f = i(null), X = i(null), k = i(() => {
|
|
45
|
+
}), [Oe, Ve] = y(480), [ue, je] = y(0), [Z, he] = y(0), J = i(!1), K = i(!1), de = i(0), [me, We] = y(0), [Q, De] = y(!1), Pe = o === "sandbox", g = a === "blackboard", b = Ie && g && o === "sandbox", _ = g && o === "sandbox", R = _ && Fe, ee = i(""), P = W.useMemo(
|
|
42
46
|
() => o === "sandbox" ? c : "",
|
|
43
47
|
[c, o]
|
|
44
|
-
), n =
|
|
45
|
-
() =>
|
|
48
|
+
), n = W.useMemo(
|
|
49
|
+
() => at(
|
|
46
50
|
P,
|
|
47
51
|
R
|
|
48
52
|
),
|
|
49
53
|
[P, R]
|
|
50
|
-
),
|
|
51
|
-
() => R ?
|
|
54
|
+
), fe = W.useMemo(
|
|
55
|
+
() => R ? ye(P) : Je,
|
|
52
56
|
[P, R]
|
|
53
|
-
),
|
|
54
|
-
() => R &&
|
|
57
|
+
), te = W.useMemo(
|
|
58
|
+
() => R && fe.hasFullViewportHeight,
|
|
55
59
|
[
|
|
56
|
-
|
|
60
|
+
fe.hasFullViewportHeight,
|
|
57
61
|
R
|
|
58
62
|
]
|
|
59
|
-
), [$,
|
|
63
|
+
), [$, ge] = y(
|
|
60
64
|
n
|
|
61
|
-
),
|
|
65
|
+
), be = i(n), ne = i(n), F = i(null), I = i(null), pe = i(null), He = Le((t) => {
|
|
62
66
|
if (typeof window > "u")
|
|
63
67
|
return;
|
|
64
68
|
const e = Date.now();
|
|
65
|
-
e -
|
|
69
|
+
e - de.current < ct || (de.current = e, window.postMessage(
|
|
66
70
|
{
|
|
67
|
-
source:
|
|
68
|
-
type:
|
|
71
|
+
source: tt,
|
|
72
|
+
type: et,
|
|
69
73
|
eventType: t
|
|
70
74
|
},
|
|
71
75
|
window.location.origin
|
|
72
76
|
));
|
|
73
|
-
}, []),
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
+
}, []), re = () => {
|
|
78
|
+
F.current !== null && (window.clearTimeout(F.current), F.current = null);
|
|
79
|
+
}, $e = () => {
|
|
80
|
+
I.current !== null && (window.cancelAnimationFrame(I.current), I.current = null);
|
|
77
81
|
};
|
|
78
|
-
|
|
82
|
+
H(
|
|
79
83
|
() => () => {
|
|
80
|
-
|
|
84
|
+
re(), $e();
|
|
81
85
|
},
|
|
82
86
|
[]
|
|
83
|
-
),
|
|
84
|
-
const t =
|
|
85
|
-
|
|
86
|
-
const e = !!t && n.length > t.length && n.startsWith(t), u =
|
|
87
|
+
), H(() => {
|
|
88
|
+
const t = be.current;
|
|
89
|
+
be.current = n;
|
|
90
|
+
const e = !!t && n.length > t.length && n.startsWith(t), u = it.test(
|
|
87
91
|
n
|
|
88
92
|
);
|
|
89
93
|
if (!(e && u)) {
|
|
90
|
-
|
|
94
|
+
re(), ne.current = n, ge(n);
|
|
91
95
|
return;
|
|
92
96
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
97
|
+
ne.current = n, re(), F.current = window.setTimeout(() => {
|
|
98
|
+
ge(ne.current), F.current = null;
|
|
99
|
+
}, st);
|
|
96
100
|
}, [n]);
|
|
97
|
-
const z =
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
const z = W.useMemo(() => _ ? ye($).viewportHeightCss : null, [$, _]);
|
|
102
|
+
H(() => {
|
|
103
|
+
pe.current = z;
|
|
100
104
|
}, [z]);
|
|
101
|
-
const
|
|
102
|
-
|
|
105
|
+
const oe = !!z, N = g && o === "sandbox" ? b || te ? "100%" : z ?? `${Oe}px` : void 0;
|
|
106
|
+
H(() => {
|
|
103
107
|
if (a !== "blackboard") {
|
|
104
|
-
|
|
108
|
+
ee.current = n;
|
|
105
109
|
return;
|
|
106
110
|
}
|
|
107
|
-
const t =
|
|
108
|
-
!(t && n.startsWith(t)) && t &&
|
|
109
|
-
}, [a, n]),
|
|
111
|
+
const t = ee.current;
|
|
112
|
+
!(t && n.startsWith(t)) && t && We((u) => u + 1), ee.current = n;
|
|
113
|
+
}, [a, n]), H(() => {
|
|
110
114
|
const t = f.current;
|
|
111
115
|
if (!t) return;
|
|
112
116
|
const e = t.contentDocument;
|
|
@@ -120,7 +124,7 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
|
|
|
120
124
|
:root { color-scheme: light; }
|
|
121
125
|
html, body, #root { width: 100%; }
|
|
122
126
|
${a === "blackboard" ? "html, body, #root { height: 100%; }" : ""}
|
|
123
|
-
html, body { margin: 0; padding: 0; overflow: ${
|
|
127
|
+
html, body { margin: 0; padding: 0; overflow: ${b ? "hidden auto" : a === "blackboard" ? "auto" : "hidden"}; }
|
|
124
128
|
*, *::before, *::after { box-sizing: border-box; }
|
|
125
129
|
${a !== "blackboard" ? `
|
|
126
130
|
.h-screen { height: auto !important; }
|
|
@@ -134,167 +138,167 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
|
|
|
134
138
|
<div id="root"></div>
|
|
135
139
|
</body>
|
|
136
140
|
</html>`), e.close(), e.documentElement.setAttribute("data-theme", "light"), e.documentElement.style.colorScheme = "light", e.body?.style.setProperty("color-scheme", "light");
|
|
137
|
-
const u = g && o === "sandbox", q = () =>
|
|
141
|
+
const u = g && o === "sandbox", q = () => He("click");
|
|
138
142
|
u && e.addEventListener("click", q, !0);
|
|
139
|
-
const
|
|
140
|
-
if (!
|
|
141
|
-
const we =
|
|
142
|
-
|
|
143
|
-
let
|
|
144
|
-
const
|
|
143
|
+
const B = e.getElementById("root");
|
|
144
|
+
if (!B) return;
|
|
145
|
+
const we = Ye(B);
|
|
146
|
+
X.current = we;
|
|
147
|
+
let O = !1;
|
|
148
|
+
const ve = (r) => ({
|
|
145
149
|
heightAttrValue: r.getAttribute("height"),
|
|
146
150
|
styleAttrValue: r.getAttribute("style"),
|
|
147
151
|
classAttrValue: r.getAttribute("class")
|
|
148
|
-
}),
|
|
149
|
-
const
|
|
150
|
-
return
|
|
151
|
-
},
|
|
152
|
-
if (!
|
|
153
|
-
const r = f.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight,
|
|
154
|
-
|
|
152
|
+
}), Ee = (r) => {
|
|
153
|
+
const x = Array.from(r.children);
|
|
154
|
+
return x.length === 1 ? x[0] : null;
|
|
155
|
+
}, Ge = () => {
|
|
156
|
+
if (!_ || !f.current || !e.body) return null;
|
|
157
|
+
const r = f.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, x = pe.current, G = x ? Te(
|
|
158
|
+
x,
|
|
155
159
|
r
|
|
156
160
|
) : null;
|
|
157
161
|
if (G !== null)
|
|
158
162
|
return Math.ceil(G);
|
|
159
|
-
const
|
|
163
|
+
const d = e.body.querySelector(
|
|
160
164
|
".sandbox-wrapper"
|
|
161
165
|
)?.firstElementChild;
|
|
162
|
-
if (!
|
|
163
|
-
const
|
|
164
|
-
|
|
166
|
+
if (!d) return null;
|
|
167
|
+
const m = Array.from(d.children), w = m.length === 1 ? m[0] : null, L = Ke(
|
|
168
|
+
w,
|
|
165
169
|
{
|
|
166
|
-
getNode:
|
|
167
|
-
getSingleChild:
|
|
170
|
+
getNode: ve,
|
|
171
|
+
getSingleChild: Ee
|
|
168
172
|
}
|
|
169
173
|
).viewportHeightCss;
|
|
170
174
|
if (L) {
|
|
171
|
-
const
|
|
175
|
+
const V = Te(
|
|
172
176
|
L,
|
|
173
177
|
r
|
|
174
178
|
);
|
|
175
|
-
if (
|
|
176
|
-
return Math.ceil(
|
|
179
|
+
if (V !== null)
|
|
180
|
+
return Math.ceil(V);
|
|
177
181
|
}
|
|
178
|
-
const l =
|
|
179
|
-
|
|
182
|
+
const l = Qe(
|
|
183
|
+
w,
|
|
180
184
|
r,
|
|
181
185
|
{
|
|
182
|
-
getNode:
|
|
183
|
-
getSingleChild:
|
|
186
|
+
getNode: ve,
|
|
187
|
+
getSingleChild: Ee
|
|
184
188
|
}
|
|
185
189
|
);
|
|
186
190
|
return l !== null ? Math.ceil(l) : null;
|
|
187
|
-
},
|
|
191
|
+
}, ie = () => {
|
|
188
192
|
if (!f.current || !e.body) return;
|
|
189
193
|
if (!g) {
|
|
190
|
-
if (
|
|
191
|
-
|
|
194
|
+
if (J.current) {
|
|
195
|
+
K.current = !0;
|
|
192
196
|
return;
|
|
193
197
|
}
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
|
|
198
|
+
J.current = !0;
|
|
199
|
+
const d = f.current, m = D.current?.clientWidth || 0, w = d.style.height;
|
|
200
|
+
if (m > 0) {
|
|
201
|
+
const ce = Math.round(m * 9 / 16), L = Math.max(8192, m * 20);
|
|
202
|
+
d.style.height = ce + "px", e.body.offsetHeight;
|
|
199
203
|
let l = e.body.scrollHeight;
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
const
|
|
204
|
+
const V = e.defaultView;
|
|
205
|
+
if (V) {
|
|
206
|
+
const j = (p) => {
|
|
203
207
|
let v = 0;
|
|
204
|
-
const
|
|
205
|
-
if (E !==
|
|
206
|
-
const U =
|
|
208
|
+
const Ce = (E) => {
|
|
209
|
+
if (E !== p && E.scrollHeight > E.clientHeight + 1) {
|
|
210
|
+
const U = V.getComputedStyle(E).overflowY;
|
|
207
211
|
if (U === "auto" || U === "scroll") {
|
|
208
|
-
const
|
|
209
|
-
|
|
212
|
+
const Me = E.getBoundingClientRect();
|
|
213
|
+
Me.top >= 0 && (v = Math.max(
|
|
210
214
|
v,
|
|
211
|
-
Math.ceil(
|
|
215
|
+
Math.ceil(Me.top + E.scrollHeight)
|
|
212
216
|
));
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
|
-
for (const U of E.children)
|
|
219
|
+
for (const U of E.children) Ce(U);
|
|
216
220
|
};
|
|
217
|
-
return
|
|
221
|
+
return Ce(p), v;
|
|
218
222
|
};
|
|
219
|
-
l = Math.max(l,
|
|
220
|
-
for (let
|
|
221
|
-
|
|
223
|
+
l = Math.max(l, j(e.body));
|
|
224
|
+
for (let p = 0; p < 8 && l > ce; p++) {
|
|
225
|
+
d.style.height = l + "px", e.body.offsetHeight;
|
|
222
226
|
const v = Math.max(
|
|
223
227
|
e.body.scrollHeight,
|
|
224
|
-
|
|
228
|
+
j(e.body)
|
|
225
229
|
);
|
|
226
230
|
if (v <= l + 1 || v >= l * 1.5) break;
|
|
227
231
|
l = v;
|
|
228
232
|
}
|
|
229
233
|
}
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
return
|
|
234
|
+
d.style.height = w, je((j) => {
|
|
235
|
+
const p = Math.min(L, Math.max(200, Math.ceil(l)));
|
|
236
|
+
return j === p ? j : p;
|
|
233
237
|
});
|
|
234
238
|
}
|
|
235
239
|
setTimeout(() => {
|
|
236
|
-
|
|
240
|
+
J.current = !1, K.current && (K.current = !1, C());
|
|
237
241
|
}, 50);
|
|
238
242
|
return;
|
|
239
243
|
}
|
|
240
|
-
if (
|
|
241
|
-
const r = e.body.scrollHeight,
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
+
if (b) return;
|
|
245
|
+
const r = e.body.scrollHeight, x = e.documentElement?.scrollHeight || 0, G = B?.scrollHeight || 0, Re = Math.max(r, x, G);
|
|
246
|
+
if (_) {
|
|
247
|
+
const d = Ge(), m = Math.max(
|
|
244
248
|
200,
|
|
245
|
-
|
|
249
|
+
d ?? Math.ceil(Re)
|
|
246
250
|
);
|
|
247
|
-
|
|
248
|
-
(
|
|
251
|
+
Ve(
|
|
252
|
+
(w) => w === m ? w : m
|
|
249
253
|
);
|
|
250
254
|
}
|
|
251
|
-
},
|
|
255
|
+
}, C = () => {
|
|
252
256
|
requestAnimationFrame(() => {
|
|
253
|
-
|
|
257
|
+
O || ie();
|
|
254
258
|
});
|
|
255
259
|
};
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
k.current = C, ie(), C(), Pe && ot().then((r) => {
|
|
261
|
+
O || (r(e), b && nt(e), requestAnimationFrame(() => {
|
|
262
|
+
O || C();
|
|
259
263
|
}));
|
|
260
264
|
}).catch(() => {
|
|
261
|
-
|
|
265
|
+
O || C();
|
|
262
266
|
});
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
+
const se = new ResizeObserver(() => ie());
|
|
268
|
+
se.observe(e.body), B && se.observe(B);
|
|
269
|
+
const Se = new MutationObserver(() => {
|
|
270
|
+
C();
|
|
267
271
|
});
|
|
268
|
-
return
|
|
272
|
+
return Se.observe(e.body, {
|
|
269
273
|
childList: !0,
|
|
270
274
|
subtree: !0,
|
|
271
275
|
attributes: !0,
|
|
272
276
|
attributeFilter: ["style", "class"]
|
|
273
277
|
}), () => {
|
|
274
|
-
|
|
275
|
-
we.unmount(),
|
|
278
|
+
O = !0, se.disconnect(), Se.disconnect(), b && t.contentWindow?.__mdf_cleanupScaling?.(), u && e.removeEventListener("click", q, !0), setTimeout(() => {
|
|
279
|
+
we.unmount(), X.current = null, k.current = () => {
|
|
276
280
|
};
|
|
277
281
|
}, 0);
|
|
278
282
|
};
|
|
279
|
-
}, []),
|
|
283
|
+
}, []), H(() => {
|
|
280
284
|
const t = () => {
|
|
281
|
-
|
|
285
|
+
De(!!document.fullscreenElement);
|
|
282
286
|
};
|
|
283
287
|
return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
|
|
284
|
-
}, []),
|
|
288
|
+
}, []), H(() => {
|
|
285
289
|
const t = D.current;
|
|
286
290
|
if (!t) return;
|
|
287
291
|
const e = new ResizeObserver((u) => {
|
|
288
|
-
|
|
292
|
+
he(u[0]?.contentRect.width ?? t.clientWidth);
|
|
289
293
|
});
|
|
290
|
-
return e.observe(t),
|
|
294
|
+
return e.observe(t), he(t.clientWidth), () => e.disconnect();
|
|
291
295
|
}, []);
|
|
292
|
-
const
|
|
293
|
-
if (g ||
|
|
296
|
+
const xe = Ue(() => {
|
|
297
|
+
if (g || Z === 0 || Q)
|
|
294
298
|
return;
|
|
295
|
-
const t = Math.round(
|
|
296
|
-
return { height: Math.max(t,
|
|
297
|
-
}, [g,
|
|
299
|
+
const t = Math.round(Z * 9 / 16);
|
|
300
|
+
return { height: Math.max(t, ue) };
|
|
301
|
+
}, [g, Z, ue, Q]), ze = () => {
|
|
298
302
|
const t = D.current || f.current;
|
|
299
303
|
if (t) {
|
|
300
304
|
if (document.fullscreenElement) {
|
|
@@ -306,69 +310,78 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
|
|
|
306
310
|
});
|
|
307
311
|
}
|
|
308
312
|
};
|
|
309
|
-
|
|
310
|
-
const t =
|
|
313
|
+
H(() => {
|
|
314
|
+
const t = X.current;
|
|
311
315
|
if (!t) return;
|
|
312
316
|
t.render(
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
|
|
317
|
+
/* @__PURE__ */ M.jsx(
|
|
318
|
+
Xe,
|
|
315
319
|
{
|
|
316
320
|
html: $,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
321
|
+
locale: S,
|
|
322
|
+
loadingText: T,
|
|
323
|
+
styleLoadingText: h,
|
|
324
|
+
scriptLoadingText: A,
|
|
325
|
+
disableLoadingOverlay: Y,
|
|
326
|
+
resetToken: me,
|
|
327
|
+
hasRootVhHeight: oe,
|
|
322
328
|
mode: a,
|
|
323
|
-
stretchRootHeight:
|
|
324
|
-
enableScaling:
|
|
329
|
+
stretchRootHeight: te,
|
|
330
|
+
enableScaling: b
|
|
325
331
|
}
|
|
326
332
|
)
|
|
327
|
-
),
|
|
328
|
-
|
|
333
|
+
), I.current = window.requestAnimationFrame(() => {
|
|
334
|
+
k.current?.(), b && f.current?.contentWindow?.__mdf_triggerFitContent?.(), I.current = null;
|
|
329
335
|
});
|
|
330
|
-
const e = setTimeout(() =>
|
|
336
|
+
const e = setTimeout(() => k.current?.(), 100), u = setTimeout(() => k.current?.(), 500);
|
|
331
337
|
return () => {
|
|
332
338
|
clearTimeout(e), clearTimeout(u);
|
|
333
339
|
};
|
|
334
340
|
}, [
|
|
335
341
|
$,
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
342
|
+
S,
|
|
343
|
+
T,
|
|
344
|
+
h,
|
|
345
|
+
A,
|
|
346
|
+
me,
|
|
347
|
+
Y,
|
|
348
|
+
oe,
|
|
349
|
+
a,
|
|
350
|
+
te,
|
|
351
|
+
b
|
|
340
352
|
]);
|
|
341
|
-
const
|
|
353
|
+
const qe = [
|
|
342
354
|
"w-full relative content-render-iframe-sandbox",
|
|
343
|
-
g ? "h-full overflow-auto flex flex-col" :
|
|
355
|
+
g ? "h-full overflow-auto flex flex-col" : xe ? "overflow-hidden flex items-center justify-center" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
|
|
344
356
|
].filter(Boolean).join(" ");
|
|
345
|
-
return /* @__PURE__ */
|
|
357
|
+
return /* @__PURE__ */ M.jsxs(
|
|
346
358
|
"div",
|
|
347
359
|
{
|
|
348
360
|
ref: D,
|
|
349
|
-
"data-root-vh":
|
|
350
|
-
className:
|
|
351
|
-
style:
|
|
352
|
-
height:
|
|
353
|
-
minHeight:
|
|
354
|
-
} :
|
|
361
|
+
"data-root-vh": oe ? "true" : "false",
|
|
362
|
+
className: qe,
|
|
363
|
+
style: N ? {
|
|
364
|
+
height: N,
|
|
365
|
+
minHeight: N
|
|
366
|
+
} : xe,
|
|
355
367
|
children: [
|
|
356
|
-
!
|
|
368
|
+
!_e && /* @__PURE__ */ M.jsx(
|
|
357
369
|
"button",
|
|
358
370
|
{
|
|
359
371
|
type: "button",
|
|
360
|
-
onClick:
|
|
372
|
+
onClick: ze,
|
|
361
373
|
className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
|
|
362
|
-
children:
|
|
374
|
+
children: Q ? Be : Ne
|
|
363
375
|
}
|
|
364
376
|
),
|
|
365
|
-
a === "blackboard" && o === "markdown" ? /* @__PURE__ */
|
|
366
|
-
|
|
377
|
+
a === "blackboard" && o === "markdown" ? /* @__PURE__ */ M.jsx("div", { onClick: () => He("click"), children: /* @__PURE__ */ M.jsx(
|
|
378
|
+
Ze,
|
|
367
379
|
{
|
|
368
380
|
content: c,
|
|
369
|
-
|
|
381
|
+
locale: S,
|
|
382
|
+
disableSandboxLoadingOverlay: Y
|
|
370
383
|
}
|
|
371
|
-
) }) : /* @__PURE__ */
|
|
384
|
+
) }) : /* @__PURE__ */ M.jsx(
|
|
372
385
|
"iframe",
|
|
373
386
|
{
|
|
374
387
|
ref: f,
|
|
@@ -377,8 +390,8 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
|
|
|
377
390
|
allowFullScreen: !0,
|
|
378
391
|
className: [s, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
|
|
379
392
|
style: {
|
|
380
|
-
height:
|
|
381
|
-
minHeight:
|
|
393
|
+
height: N ?? "100%",
|
|
394
|
+
minHeight: N,
|
|
382
395
|
margin: "auto"
|
|
383
396
|
}
|
|
384
397
|
}
|
|
@@ -388,6 +401,6 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
|
|
|
388
401
|
);
|
|
389
402
|
};
|
|
390
403
|
export {
|
|
391
|
-
|
|
404
|
+
xt as default
|
|
392
405
|
};
|
|
393
406
|
//# sourceMappingURL=IframeSandbox.es.js.map
|