markdown-flow-ui 0.1.100 → 0.1.101

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