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.
- 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
- 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
- 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/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/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
- package/dist/_virtual/index.cjs.js +1 -1
- package/dist/_virtual/index.cjs3.js +1 -1
- package/dist/_virtual/index.cjs4.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.es.js +1 -0
- 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.es5.js +4 -4
- package/dist/_virtual/index.es6.js +5 -5
- 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 +172 -155
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.stories.d.ts +1 -0
- 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 +214 -192
- 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 +90 -90
- 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 +94 -86
- package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
- package/dist/components/ContentRender/utils/iframe-viewport-height.cjs.js +2 -0
- package/dist/components/ContentRender/utils/iframe-viewport-height.cjs.js.map +1 -0
- package/dist/components/ContentRender/utils/iframe-viewport-height.d.ts +24 -0
- package/dist/components/ContentRender/utils/iframe-viewport-height.es.js +127 -0
- package/dist/components/ContentRender/utils/iframe-viewport-height.es.js.map +1 -0
- package/dist/components/ContentRender/utils/iframe-viewport-height.test.d.ts +1 -0
- 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 +2 -0
- package/dist/components/Slide/Player.cjs.js.map +1 -0
- package/dist/components/Slide/Player.d.ts +21 -0
- package/dist/components/Slide/Player.es.js +386 -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 +27 -0
- package/dist/components/Slide/Slide.es.js +583 -0
- package/dist/components/Slide/Slide.es.js.map +1 -0
- package/dist/components/Slide/Slide.stories.d.ts +79 -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.cjs.js +2 -0
- package/dist/components/Slide/index.cjs.js.map +1 -0
- package/dist/components/Slide/index.d.ts +12 -0
- package/dist/components/Slide/index.es.js +12 -0
- package/dist/components/Slide/index.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 +24 -0
- package/dist/components/Slide/useSlide.es.js +144 -0
- package/dist/components/Slide/useSlide.es.js.map +1 -0
- 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/Slide/utils/interactionPlayback.cjs.js +2 -0
- package/dist/components/Slide/utils/interactionPlayback.cjs.js.map +1 -0
- package/dist/components/Slide/utils/interactionPlayback.d.ts +9 -0
- package/dist/components/Slide/utils/interactionPlayback.es.js +11 -0
- package/dist/components/Slide/utils/interactionPlayback.es.js.map +1 -0
- package/dist/components/Slide/utils/interactionPlayback.test.d.ts +1 -0
- package/dist/components/Slide/utils/listenModeElementList.d.ts +81 -0
- package/dist/components/Slide/utils/listenModeElementList.test.d.ts +1 -0
- package/dist/components/Slide/utils/playbackSequence.cjs.js +2 -0
- package/dist/components/Slide/utils/playbackSequence.cjs.js.map +1 -0
- package/dist/components/Slide/utils/playbackSequence.d.ts +11 -0
- package/dist/components/Slide/utils/playbackSequence.es.js +16 -0
- package/dist/components/Slide/utils/playbackSequence.es.js.map +1 -0
- package/dist/components/Slide/utils/playbackSequence.test.d.ts +1 -0
- package/dist/components/Slide/utils/playerCustomActions.cjs.js +2 -0
- package/dist/components/Slide/utils/playerCustomActions.cjs.js.map +1 -0
- package/dist/components/Slide/utils/playerCustomActions.d.ts +3 -0
- package/dist/components/Slide/utils/playerCustomActions.es.js +7 -0
- package/dist/components/Slide/utils/playerCustomActions.es.js.map +1 -0
- package/dist/components/index.d.ts +7 -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 +13 -10
- package/dist/index.es.js.map +1 -1
- package/dist/lib/browserUserActivation.d.ts +5 -0
- package/dist/lib/interaction-defaults.cjs.js +2 -0
- package/dist/lib/interaction-defaults.cjs.js.map +1 -0
- package/dist/lib/interaction-defaults.d.ts +23 -0
- package/dist/lib/interaction-defaults.es.js +145 -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 +3 -1
- package/dist/renderer.es.js +9 -6
- package/dist/renderer.es.js.map +1 -1
- package/dist/slide.cjs.js +2 -0
- package/dist/slide.cjs.js.map +1 -0
- package/dist/slide.d.ts +2 -0
- package/dist/slide.es.js +18 -0
- package/dist/slide.es.js.map +1 -0
- package/package.json +25 -2
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { useRef as m, useMemo as c, useState as N, useEffect as R, useCallback as b } from "react";
|
|
2
|
+
import { applyDiffElement as w } from "./diff-utils.es.js";
|
|
3
|
+
const P = (e) => e.filter((n) => n.is_marker), B = (e) => e.reduce((n, t, r) => (t.is_marker && n.push(r), n), []), h = (e) => !!(e?.is_speakable && (e.audio_url || (e.audio_segments?.length ?? 0) > 0)), G = (e = []) => e.length > 0 && !e.some((n) => n.is_final), H = (e, n) => {
|
|
4
|
+
const t = e;
|
|
5
|
+
return t.element_bid || t.blockBid || t.generated_block_bid || `${e.type}:${String(e.sequence_number ?? n)}`;
|
|
6
|
+
}, K = (e) => e.reduce((n, t, r) => {
|
|
7
|
+
if (h(t)) {
|
|
8
|
+
const s = t.audio_segments ?? [], i = s.length > 0;
|
|
9
|
+
n.push({
|
|
10
|
+
audioKey: H(t, r),
|
|
11
|
+
sequenceNumber: t.sequence_number,
|
|
12
|
+
// Keep one canonical source to avoid duplicated playback resets.
|
|
13
|
+
// When streaming segments exist, keep playback on the segment source.
|
|
14
|
+
audioUrl: i ? "" : t.audio_url,
|
|
15
|
+
audioSegments: s,
|
|
16
|
+
isAudioStreaming: G(s)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return n;
|
|
20
|
+
}, []), $ = (e) => {
|
|
21
|
+
const n = /* @__PURE__ */ new Map();
|
|
22
|
+
let t = 0;
|
|
23
|
+
return e.forEach((r, s) => {
|
|
24
|
+
h(r) && (n.set(s, t), t += 1);
|
|
25
|
+
}), n;
|
|
26
|
+
}, v = (e, n, t) => n.reduce(
|
|
27
|
+
(r, s, i) => {
|
|
28
|
+
const f = n[i + 1] ?? e.length, l = [];
|
|
29
|
+
for (let a = s; a < f; a += 1) {
|
|
30
|
+
const u = e[a];
|
|
31
|
+
if (!h(u))
|
|
32
|
+
continue;
|
|
33
|
+
const d = t.get(a);
|
|
34
|
+
d != null && l.push(d);
|
|
35
|
+
}
|
|
36
|
+
return r.set(i, l), r;
|
|
37
|
+
},
|
|
38
|
+
/* @__PURE__ */ new Map()
|
|
39
|
+
), S = (e) => {
|
|
40
|
+
const n = e.findIndex(
|
|
41
|
+
(t) => t.is_renderable === !0
|
|
42
|
+
);
|
|
43
|
+
return n >= 0 ? n : e.findIndex(
|
|
44
|
+
(t) => t.is_renderable !== !1
|
|
45
|
+
);
|
|
46
|
+
}, p = (e) => ({
|
|
47
|
+
...e,
|
|
48
|
+
is_renderable: !0
|
|
49
|
+
}), _ = (e, n) => n < 0 ? [] : e.slice(0, n + 1).reduce((t, r) => {
|
|
50
|
+
if (r.type === "interaction")
|
|
51
|
+
return t;
|
|
52
|
+
const s = p(r);
|
|
53
|
+
return s.type === "diff" ? w(t, s) ?? [...t, s] : r.is_new ? [s] : t.length === 0 ? [s] : [...t, s];
|
|
54
|
+
}, []), z = (e) => e.map(
|
|
55
|
+
(n, t) => _(e, t)
|
|
56
|
+
), D = (e, n, t) => {
|
|
57
|
+
if (t < 0)
|
|
58
|
+
return !1;
|
|
59
|
+
const r = n[t];
|
|
60
|
+
if (typeof r != "number")
|
|
61
|
+
return !1;
|
|
62
|
+
const s = n[t + 1] ?? e.length;
|
|
63
|
+
for (let i = r; i < s; i += 1)
|
|
64
|
+
if (e[i]?.is_speakable)
|
|
65
|
+
return !0;
|
|
66
|
+
return !1;
|
|
67
|
+
}, U = (e, n) => e.length === n.length && e.every((t, r) => t === n[r]), j = (e, n) => e.length === n.length && e.every((t, r) => t === n[r]), O = (e = []) => {
|
|
68
|
+
const n = m(e), t = m([]), r = c(() => U(n.current, e) ? n.current : (n.current = e, e), [e]), s = c(
|
|
69
|
+
() => P(r),
|
|
70
|
+
[r]
|
|
71
|
+
), i = c(
|
|
72
|
+
() => B(r),
|
|
73
|
+
[r]
|
|
74
|
+
), f = c(
|
|
75
|
+
() => K(r),
|
|
76
|
+
[r]
|
|
77
|
+
), l = c(
|
|
78
|
+
() => $(r),
|
|
79
|
+
[r]
|
|
80
|
+
), a = c(
|
|
81
|
+
() => v(
|
|
82
|
+
r,
|
|
83
|
+
i,
|
|
84
|
+
l
|
|
85
|
+
),
|
|
86
|
+
[l, i, r]
|
|
87
|
+
), [u, d] = N(
|
|
88
|
+
() => S(s)
|
|
89
|
+
);
|
|
90
|
+
R(() => {
|
|
91
|
+
d((o) => s.length === 0 ? -1 : o >= 0 && o < s.length ? o : S(s));
|
|
92
|
+
}, [s]);
|
|
93
|
+
const x = b(() => {
|
|
94
|
+
d((o) => o <= 0 ? Math.max(o, 0) : Math.max(o - 1, 0));
|
|
95
|
+
}, []), E = b(() => {
|
|
96
|
+
d((o) => o < 0 ? o : Math.min(o + 1, s.length - 1));
|
|
97
|
+
}, [s.length]), M = u > 0, A = u >= 0 && u < s.length - 1, g = c(() => {
|
|
98
|
+
if (u < 0)
|
|
99
|
+
return;
|
|
100
|
+
const o = s[u];
|
|
101
|
+
if (o)
|
|
102
|
+
return p(o);
|
|
103
|
+
}, [u, s]), k = c(
|
|
104
|
+
() => _(s, u),
|
|
105
|
+
[u, s]
|
|
106
|
+
), y = c(
|
|
107
|
+
() => z(s),
|
|
108
|
+
[s]
|
|
109
|
+
), I = c(() => {
|
|
110
|
+
const o = a.get(u) ?? [];
|
|
111
|
+
return j(
|
|
112
|
+
t.current,
|
|
113
|
+
o
|
|
114
|
+
) ? t.current : (t.current = o, o);
|
|
115
|
+
}, [u, a]), q = c(
|
|
116
|
+
() => D(
|
|
117
|
+
r,
|
|
118
|
+
i,
|
|
119
|
+
u
|
|
120
|
+
),
|
|
121
|
+
[u, i, r]
|
|
122
|
+
), C = c(
|
|
123
|
+
() => g?.type === "interaction" ? g : void 0,
|
|
124
|
+
[g]
|
|
125
|
+
);
|
|
126
|
+
return {
|
|
127
|
+
currentElementList: k,
|
|
128
|
+
stepElementLists: y,
|
|
129
|
+
slideElementList: s,
|
|
130
|
+
currentIndex: u,
|
|
131
|
+
audioList: f,
|
|
132
|
+
currentAudioSequenceIndexes: I,
|
|
133
|
+
currentStepHasSpeakableElement: q,
|
|
134
|
+
currentInteractionElement: C,
|
|
135
|
+
canGoPrev: M,
|
|
136
|
+
canGoNext: A,
|
|
137
|
+
handlePrev: x,
|
|
138
|
+
handleNext: E
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export {
|
|
142
|
+
O as default
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=useSlide.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSlide.es.js","sources":["../../../src/components/Slide/useSlide.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { applyDiffElement } from \"./diff-utils\";\nimport type { Element, ElementAudioSegment } from \"./types\";\n\nexport interface SlideAudioItem {\n audioKey?: string;\n sequenceNumber?: number;\n audioUrl?: string;\n audioSegments?: ElementAudioSegment[];\n isAudioStreaming?: boolean;\n}\n\nexport interface UseSlideResult {\n currentElementList: Element[];\n stepElementLists: Element[][];\n slideElementList: Element[];\n currentIndex: number;\n audioList: SlideAudioItem[];\n currentAudioSequenceIndexes: number[];\n currentStepHasSpeakableElement: boolean;\n currentInteractionElement?: Element;\n canGoPrev: boolean;\n canGoNext: boolean;\n handlePrev: () => void;\n handleNext: () => void;\n}\n\nconst getMarkerElementList = (elementList: Element[]) =>\n elementList.filter((element) => element.is_marker);\n\nconst getMarkerElementIndexes = (elementList: Element[]) =>\n elementList.reduce<number[]>((indexes, element, index) => {\n if (element.is_marker) {\n indexes.push(index);\n }\n\n return indexes;\n }, []);\n\nconst hasPlayableAudio = (element?: Element) =>\n Boolean(\n element?.is_speakable &&\n (element.audio_url || (element.audio_segments?.length ?? 0) > 0)\n );\n\nconst isStreamingAudio = (segments: ElementAudioSegment[] = []) =>\n segments.length > 0 && !segments.some((segment) => segment.is_final);\n\nconst getElementAudioKey = (element: Element, index: number) => {\n const candidateElement = element as Element & {\n element_bid?: string;\n blockBid?: string;\n generated_block_bid?: string;\n };\n\n return (\n candidateElement.element_bid ||\n candidateElement.blockBid ||\n candidateElement.generated_block_bid ||\n `${element.type}:${String(element.sequence_number ?? index)}`\n );\n};\n\nconst getAudioList = (elementList: Element[]) =>\n elementList.reduce<SlideAudioItem[]>((list, element, elementIndex) => {\n if (hasPlayableAudio(element)) {\n const normalizedAudioSegments = element.audio_segments ?? [];\n const hasAudioSegments = normalizedAudioSegments.length > 0;\n\n list.push({\n audioKey: getElementAudioKey(element, elementIndex),\n sequenceNumber: element.sequence_number,\n // Keep one canonical source to avoid duplicated playback resets.\n // When streaming segments exist, keep playback on the segment source.\n audioUrl: hasAudioSegments ? \"\" : element.audio_url,\n audioSegments: normalizedAudioSegments,\n isAudioStreaming: isStreamingAudio(normalizedAudioSegments),\n });\n }\n\n return list;\n }, []);\n\nconst getAudioIndexMap = (elementList: Element[]) => {\n const audioIndexMap = new Map<number, number>();\n let audioIndex = 0;\n\n elementList.forEach((element, index) => {\n if (hasPlayableAudio(element)) {\n audioIndexMap.set(index, audioIndex);\n audioIndex += 1;\n }\n });\n\n return audioIndexMap;\n};\n\nconst getSlideAudioSequenceMap = (\n elementList: Element[],\n markerElementIndexes: number[],\n audioIndexMap: Map<number, number>\n) =>\n markerElementIndexes.reduce<Map<number, number[]>>(\n (sequenceMap, startIndex, slideIndex) => {\n const nextMarkerIndex =\n markerElementIndexes[slideIndex + 1] ?? elementList.length;\n const sequenceIndexes: number[] = [];\n\n for (let index = startIndex; index < nextMarkerIndex; index += 1) {\n const element = elementList[index];\n\n if (!hasPlayableAudio(element)) {\n continue;\n }\n\n const audioIndex = audioIndexMap.get(index);\n\n if (audioIndex == null) {\n continue;\n }\n\n sequenceIndexes.push(audioIndex);\n }\n\n sequenceMap.set(slideIndex, sequenceIndexes);\n return sequenceMap;\n },\n new Map<number, number[]>()\n );\n\nconst getInitialSlideIndex = (slideElementList: Element[]) => {\n const visibleIndex = slideElementList.findIndex(\n (element) => element.is_renderable === true\n );\n\n if (visibleIndex >= 0) {\n return visibleIndex;\n }\n\n return slideElementList.findIndex(\n (element) => element.is_renderable !== false\n );\n};\n\nconst getVisibleElement = (element: Element): Element => ({\n ...element,\n is_renderable: true,\n});\n\nconst getCurrentElementList = (\n slideElementList: Element[],\n currentIndex: number\n) => {\n if (currentIndex < 0) {\n return [];\n }\n\n return slideElementList\n .slice(0, currentIndex + 1)\n .reduce<Element[]>((currentList, element) => {\n if (element.type === \"interaction\") {\n return currentList;\n }\n\n const visibleElement = getVisibleElement(element);\n\n if (visibleElement.type === \"diff\") {\n const nextList = applyDiffElement(currentList, visibleElement);\n\n return nextList ?? [...currentList, visibleElement];\n }\n\n if (element.is_new) {\n return [visibleElement];\n }\n\n if (currentList.length === 0) {\n return [visibleElement];\n }\n\n return [...currentList, visibleElement];\n }, []);\n};\n\nconst getStepElementLists = (slideElementList: Element[]) =>\n slideElementList.map((_, index) =>\n getCurrentElementList(slideElementList, index)\n );\n\nconst getStepHasSpeakableElement = (\n elementList: Element[],\n markerElementIndexes: number[],\n currentIndex: number\n) => {\n if (currentIndex < 0) {\n return false;\n }\n\n const startIndex = markerElementIndexes[currentIndex];\n\n if (typeof startIndex !== \"number\") {\n return false;\n }\n\n const nextMarkerIndex =\n markerElementIndexes[currentIndex + 1] ?? elementList.length;\n\n for (let index = startIndex; index < nextMarkerIndex; index += 1) {\n if (elementList[index]?.is_speakable) {\n return true;\n }\n }\n\n return false;\n};\n\nconst hasSameElementReferences = (\n prevElementList: Element[],\n nextElementList: Element[]\n) =>\n prevElementList.length === nextElementList.length &&\n prevElementList.every((element, index) => element === nextElementList[index]);\n\nconst hasSameNumberValues = (prevValues: number[], nextValues: number[]) =>\n prevValues.length === nextValues.length &&\n prevValues.every((value, index) => value === nextValues[index]);\n\nconst useSlide = (elementList: Element[] = []): UseSlideResult => {\n const stableElementListRef = useRef(elementList);\n const stableCurrentAudioSequenceIndexesRef = useRef<number[]>([]);\n const stableElementList = useMemo(() => {\n if (hasSameElementReferences(stableElementListRef.current, elementList)) {\n return stableElementListRef.current;\n }\n\n // Reuse the previous wrapper array when the element references are unchanged.\n stableElementListRef.current = elementList;\n return elementList;\n }, [elementList]);\n const slideElementList = useMemo(\n () => getMarkerElementList(stableElementList),\n [stableElementList]\n );\n const markerElementIndexes = useMemo(\n () => getMarkerElementIndexes(stableElementList),\n [stableElementList]\n );\n const audioList = useMemo(\n () => getAudioList(stableElementList),\n [stableElementList]\n );\n const audioIndexMap = useMemo(\n () => getAudioIndexMap(stableElementList),\n [stableElementList]\n );\n const slideAudioSequenceMap = useMemo(\n () =>\n getSlideAudioSequenceMap(\n stableElementList,\n markerElementIndexes,\n audioIndexMap\n ),\n [audioIndexMap, markerElementIndexes, stableElementList]\n );\n const [currentIndex, setCurrentIndex] = useState(() =>\n getInitialSlideIndex(slideElementList)\n );\n\n useEffect(() => {\n setCurrentIndex((prevIndex) => {\n if (slideElementList.length === 0) {\n return -1;\n }\n\n if (prevIndex >= 0 && prevIndex < slideElementList.length) {\n return prevIndex;\n }\n\n return getInitialSlideIndex(slideElementList);\n });\n }, [slideElementList]);\n\n const handlePrev = useCallback(() => {\n setCurrentIndex((prevIndex) => {\n if (prevIndex <= 0) {\n return Math.max(prevIndex, 0);\n }\n\n return Math.max(prevIndex - 1, 0);\n });\n }, []);\n\n const handleNext = useCallback(() => {\n setCurrentIndex((prevIndex) => {\n if (prevIndex < 0) {\n return prevIndex;\n }\n\n return Math.min(prevIndex + 1, slideElementList.length - 1);\n });\n }, [slideElementList.length]);\n\n const canGoPrev = currentIndex > 0;\n const canGoNext =\n currentIndex >= 0 && currentIndex < slideElementList.length - 1;\n const currentStepElement = useMemo(() => {\n if (currentIndex < 0) {\n return undefined;\n }\n\n const element = slideElementList[currentIndex];\n\n if (!element) {\n return undefined;\n }\n\n return getVisibleElement(element);\n }, [currentIndex, slideElementList]);\n const currentElementList = useMemo(\n () => getCurrentElementList(slideElementList, currentIndex),\n [currentIndex, slideElementList]\n );\n const stepElementLists = useMemo(\n () => getStepElementLists(slideElementList),\n [slideElementList]\n );\n const currentAudioSequenceIndexes = useMemo(() => {\n const nextAudioSequenceIndexes =\n slideAudioSequenceMap.get(currentIndex) ?? [];\n\n if (\n hasSameNumberValues(\n stableCurrentAudioSequenceIndexesRef.current,\n nextAudioSequenceIndexes\n )\n ) {\n return stableCurrentAudioSequenceIndexesRef.current;\n }\n\n stableCurrentAudioSequenceIndexesRef.current = nextAudioSequenceIndexes;\n\n return nextAudioSequenceIndexes;\n }, [currentIndex, slideAudioSequenceMap]);\n const currentStepHasSpeakableElement = useMemo(\n () =>\n getStepHasSpeakableElement(\n stableElementList,\n markerElementIndexes,\n currentIndex\n ),\n [currentIndex, markerElementIndexes, stableElementList]\n );\n const currentInteractionElement = useMemo(\n () =>\n currentStepElement?.type === \"interaction\"\n ? currentStepElement\n : undefined,\n [currentStepElement]\n );\n\n return {\n currentElementList,\n stepElementLists,\n slideElementList,\n currentIndex,\n audioList,\n currentAudioSequenceIndexes,\n currentStepHasSpeakableElement,\n currentInteractionElement,\n canGoPrev,\n canGoNext,\n handlePrev,\n handleNext,\n };\n};\n\nexport default useSlide;\n"],"names":["getMarkerElementList","elementList","element","getMarkerElementIndexes","indexes","index","hasPlayableAudio","isStreamingAudio","segments","segment","getElementAudioKey","candidateElement","getAudioList","list","elementIndex","normalizedAudioSegments","hasAudioSegments","getAudioIndexMap","audioIndexMap","audioIndex","getSlideAudioSequenceMap","markerElementIndexes","sequenceMap","startIndex","slideIndex","nextMarkerIndex","sequenceIndexes","getInitialSlideIndex","slideElementList","visibleIndex","getVisibleElement","getCurrentElementList","currentIndex","currentList","visibleElement","applyDiffElement","getStepElementLists","_","getStepHasSpeakableElement","hasSameElementReferences","prevElementList","nextElementList","hasSameNumberValues","prevValues","nextValues","value","useSlide","stableElementListRef","useRef","stableCurrentAudioSequenceIndexesRef","stableElementList","useMemo","audioList","slideAudioSequenceMap","setCurrentIndex","useState","useEffect","prevIndex","handlePrev","useCallback","handleNext","canGoPrev","canGoNext","currentStepElement","currentElementList","stepElementLists","currentAudioSequenceIndexes","nextAudioSequenceIndexes","currentStepHasSpeakableElement","currentInteractionElement"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react"),h=({sectionRef:d,enabled:u,onWake:c})=>{const i=s.useRef(u),l=s.useRef(c);s.useEffect(()=>{i.current=u},[u]),s.useEffect(()=>{l.current=c},[c]),s.useEffect(()=>{const a=d.current;if(!a)return;const r=new Map,L=()=>{i.current&&l.current()},v=e=>{if(r.has(e))return;const o=()=>{r.get(e)?.cleanup(),r.delete(e),v(e)};e.addEventListener("load",o);const t=e.contentDocument;if(!t){r.set(e,{cleanup:()=>{e.removeEventListener("load",o)}});return}const n=()=>{L()};t.addEventListener("pointerdown",n,!0),t.addEventListener("mousedown",n,!0),t.addEventListener("touchstart",n,!0),r.set(e,{cleanup:()=>{t.removeEventListener("pointerdown",n,!0),t.removeEventListener("mousedown",n,!0),t.removeEventListener("touchstart",n,!0),e.removeEventListener("load",o)}})},f=()=>{const e=Array.from(a.querySelectorAll("iframe.content-render-iframe"));e.forEach(v),r.forEach((o,t)=>{e.includes(t)||(o.cleanup(),r.delete(t))})},p=new MutationObserver(()=>{f()});return f(),p.observe(a,{childList:!0,subtree:!0}),()=>{p.disconnect(),r.forEach(e=>e.cleanup()),r.clear()}},[d])};exports.default=h;
|
|
2
|
+
//# sourceMappingURL=useWakePlayerFromIframe.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWakePlayerFromIframe.cjs.js","sources":["../../../src/components/Slide/useWakePlayerFromIframe.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\ntype UseWakePlayerFromIframeParams = {\n sectionRef: React.RefObject<HTMLElement | null>;\n enabled: boolean;\n onWake: () => void;\n};\n\nconst useWakePlayerFromIframe = ({\n sectionRef,\n enabled,\n onWake,\n}: UseWakePlayerFromIframeParams) => {\n const enabledRef = useRef(enabled);\n const onWakeRef = useRef(onWake);\n\n useEffect(() => {\n enabledRef.current = enabled;\n }, [enabled]);\n\n useEffect(() => {\n onWakeRef.current = onWake;\n }, [onWake]);\n\n useEffect(() => {\n const sectionElement = sectionRef.current;\n\n if (!sectionElement) {\n return;\n }\n\n const cleanupMap = new Map<\n HTMLIFrameElement,\n {\n cleanup: () => void;\n }\n >();\n\n const restorePlayerControls = () => {\n if (!enabledRef.current) {\n return;\n }\n\n onWakeRef.current();\n };\n\n const bindIframeDocument = (iframeElement: HTMLIFrameElement) => {\n if (cleanupMap.has(iframeElement)) {\n return;\n }\n\n const handleLoad = () => {\n cleanupMap.get(iframeElement)?.cleanup();\n cleanupMap.delete(iframeElement);\n bindIframeDocument(iframeElement);\n };\n\n iframeElement.addEventListener(\"load\", handleLoad);\n\n const iframeDocument = iframeElement.contentDocument;\n\n if (!iframeDocument) {\n cleanupMap.set(iframeElement, {\n cleanup: () => {\n iframeElement.removeEventListener(\"load\", handleLoad);\n },\n });\n return;\n }\n\n const handleIframeDocumentInteraction = () => {\n restorePlayerControls();\n };\n\n iframeDocument.addEventListener(\n \"pointerdown\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.addEventListener(\n \"mousedown\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.addEventListener(\n \"touchstart\",\n handleIframeDocumentInteraction,\n true\n );\n\n cleanupMap.set(iframeElement, {\n cleanup: () => {\n iframeDocument.removeEventListener(\n \"pointerdown\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.removeEventListener(\n \"mousedown\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.removeEventListener(\n \"touchstart\",\n handleIframeDocumentInteraction,\n true\n );\n iframeElement.removeEventListener(\"load\", handleLoad);\n },\n });\n };\n\n const syncIframeBindings = () => {\n const iframeElements = Array.from(\n sectionElement.querySelectorAll<HTMLIFrameElement>(\n \"iframe.content-render-iframe\"\n )\n );\n\n iframeElements.forEach(bindIframeDocument);\n\n cleanupMap.forEach((value, iframeElement) => {\n if (iframeElements.includes(iframeElement)) {\n return;\n }\n\n value.cleanup();\n cleanupMap.delete(iframeElement);\n });\n };\n\n const mutationObserver = new MutationObserver(() => {\n syncIframeBindings();\n });\n\n syncIframeBindings();\n mutationObserver.observe(sectionElement, {\n childList: true,\n subtree: true,\n });\n\n return () => {\n mutationObserver.disconnect();\n cleanupMap.forEach((value) => value.cleanup());\n cleanupMap.clear();\n };\n }, [sectionRef]);\n};\n\nexport default useWakePlayerFromIframe;\n"],"names":["useWakePlayerFromIframe","sectionRef","enabled","onWake","enabledRef","useRef","onWakeRef","useEffect","sectionElement","cleanupMap","restorePlayerControls","bindIframeDocument","iframeElement","handleLoad","iframeDocument","handleIframeDocumentInteraction","syncIframeBindings","iframeElements","value","mutationObserver"],"mappings":"qIAQMA,EAA0B,CAAC,CAC/B,WAAAC,EACA,QAAAC,EACA,OAAAC,CACF,IAAqC,CACnC,MAAMC,EAAaC,EAAAA,OAAOH,CAAO,EAC3BI,EAAYD,EAAAA,OAAOF,CAAM,EAE/BI,EAAAA,UAAU,IAAM,CACdH,EAAW,QAAUF,CACvB,EAAG,CAACA,CAAO,CAAC,EAEZK,EAAAA,UAAU,IAAM,CACdD,EAAU,QAAUH,CACtB,EAAG,CAACA,CAAM,CAAC,EAEXI,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAiBP,EAAW,QAElC,GAAI,CAACO,EACH,OAGF,MAAMC,MAAiB,IAOjBC,EAAwB,IAAM,CAC7BN,EAAW,SAIhBE,EAAU,QAAA,CACZ,EAEMK,EAAsBC,GAAqC,CAC/D,GAAIH,EAAW,IAAIG,CAAa,EAC9B,OAGF,MAAMC,EAAa,IAAM,CACvBJ,EAAW,IAAIG,CAAa,GAAG,QAAA,EAC/BH,EAAW,OAAOG,CAAa,EAC/BD,EAAmBC,CAAa,CAClC,EAEAA,EAAc,iBAAiB,OAAQC,CAAU,EAEjD,MAAMC,EAAiBF,EAAc,gBAErC,GAAI,CAACE,EAAgB,CACnBL,EAAW,IAAIG,EAAe,CAC5B,QAAS,IAAM,CACbA,EAAc,oBAAoB,OAAQC,CAAU,CACtD,CAAA,CACD,EACD,MACF,CAEA,MAAME,EAAkC,IAAM,CAC5CL,EAAA,CACF,EAEAI,EAAe,iBACb,cACAC,EACA,EAAA,EAEFD,EAAe,iBACb,YACAC,EACA,EAAA,EAEFD,EAAe,iBACb,aACAC,EACA,EAAA,EAGFN,EAAW,IAAIG,EAAe,CAC5B,QAAS,IAAM,CACbE,EAAe,oBACb,cACAC,EACA,EAAA,EAEFD,EAAe,oBACb,YACAC,EACA,EAAA,EAEFD,EAAe,oBACb,aACAC,EACA,EAAA,EAEFH,EAAc,oBAAoB,OAAQC,CAAU,CACtD,CAAA,CACD,CACH,EAEMG,EAAqB,IAAM,CAC/B,MAAMC,EAAiB,MAAM,KAC3BT,EAAe,iBACb,8BAAA,CACF,EAGFS,EAAe,QAAQN,CAAkB,EAEzCF,EAAW,QAAQ,CAACS,EAAON,IAAkB,CACvCK,EAAe,SAASL,CAAa,IAIzCM,EAAM,QAAA,EACNT,EAAW,OAAOG,CAAa,EACjC,CAAC,CACH,EAEMO,EAAmB,IAAI,iBAAiB,IAAM,CAClDH,EAAA,CACF,CAAC,EAED,OAAAA,EAAA,EACAG,EAAiB,QAAQX,EAAgB,CACvC,UAAW,GACX,QAAS,EAAA,CACV,EAEM,IAAM,CACXW,EAAiB,WAAA,EACjBV,EAAW,QAASS,GAAUA,EAAM,SAAS,EAC7CT,EAAW,MAAA,CACb,CACF,EAAG,CAACR,CAAU,CAAC,CACjB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type UseWakePlayerFromIframeParams = {
|
|
2
|
+
sectionRef: React.RefObject<HTMLElement | null>;
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
onWake: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare const useWakePlayerFromIframe: ({ sectionRef, enabled, onWake, }: UseWakePlayerFromIframeParams) => void;
|
|
7
|
+
export default useWakePlayerFromIframe;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useRef as L, useEffect as a } from "react";
|
|
2
|
+
const w = ({
|
|
3
|
+
sectionRef: d,
|
|
4
|
+
enabled: s,
|
|
5
|
+
onWake: c
|
|
6
|
+
}) => {
|
|
7
|
+
const i = L(s), v = L(c);
|
|
8
|
+
a(() => {
|
|
9
|
+
i.current = s;
|
|
10
|
+
}, [s]), a(() => {
|
|
11
|
+
v.current = c;
|
|
12
|
+
}, [c]), a(() => {
|
|
13
|
+
const u = d.current;
|
|
14
|
+
if (!u)
|
|
15
|
+
return;
|
|
16
|
+
const r = /* @__PURE__ */ new Map(), h = () => {
|
|
17
|
+
i.current && v.current();
|
|
18
|
+
}, l = (e) => {
|
|
19
|
+
if (r.has(e))
|
|
20
|
+
return;
|
|
21
|
+
const o = () => {
|
|
22
|
+
r.get(e)?.cleanup(), r.delete(e), l(e);
|
|
23
|
+
};
|
|
24
|
+
e.addEventListener("load", o);
|
|
25
|
+
const t = e.contentDocument;
|
|
26
|
+
if (!t) {
|
|
27
|
+
r.set(e, {
|
|
28
|
+
cleanup: () => {
|
|
29
|
+
e.removeEventListener("load", o);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const n = () => {
|
|
35
|
+
h();
|
|
36
|
+
};
|
|
37
|
+
t.addEventListener(
|
|
38
|
+
"pointerdown",
|
|
39
|
+
n,
|
|
40
|
+
!0
|
|
41
|
+
), t.addEventListener(
|
|
42
|
+
"mousedown",
|
|
43
|
+
n,
|
|
44
|
+
!0
|
|
45
|
+
), t.addEventListener(
|
|
46
|
+
"touchstart",
|
|
47
|
+
n,
|
|
48
|
+
!0
|
|
49
|
+
), r.set(e, {
|
|
50
|
+
cleanup: () => {
|
|
51
|
+
t.removeEventListener(
|
|
52
|
+
"pointerdown",
|
|
53
|
+
n,
|
|
54
|
+
!0
|
|
55
|
+
), t.removeEventListener(
|
|
56
|
+
"mousedown",
|
|
57
|
+
n,
|
|
58
|
+
!0
|
|
59
|
+
), t.removeEventListener(
|
|
60
|
+
"touchstart",
|
|
61
|
+
n,
|
|
62
|
+
!0
|
|
63
|
+
), e.removeEventListener("load", o);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}, f = () => {
|
|
67
|
+
const e = Array.from(
|
|
68
|
+
u.querySelectorAll(
|
|
69
|
+
"iframe.content-render-iframe"
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
e.forEach(l), r.forEach((o, t) => {
|
|
73
|
+
e.includes(t) || (o.cleanup(), r.delete(t));
|
|
74
|
+
});
|
|
75
|
+
}, p = new MutationObserver(() => {
|
|
76
|
+
f();
|
|
77
|
+
});
|
|
78
|
+
return f(), p.observe(u, {
|
|
79
|
+
childList: !0,
|
|
80
|
+
subtree: !0
|
|
81
|
+
}), () => {
|
|
82
|
+
p.disconnect(), r.forEach((e) => e.cleanup()), r.clear();
|
|
83
|
+
};
|
|
84
|
+
}, [d]);
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
w as default
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=useWakePlayerFromIframe.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWakePlayerFromIframe.es.js","sources":["../../../src/components/Slide/useWakePlayerFromIframe.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\ntype UseWakePlayerFromIframeParams = {\n sectionRef: React.RefObject<HTMLElement | null>;\n enabled: boolean;\n onWake: () => void;\n};\n\nconst useWakePlayerFromIframe = ({\n sectionRef,\n enabled,\n onWake,\n}: UseWakePlayerFromIframeParams) => {\n const enabledRef = useRef(enabled);\n const onWakeRef = useRef(onWake);\n\n useEffect(() => {\n enabledRef.current = enabled;\n }, [enabled]);\n\n useEffect(() => {\n onWakeRef.current = onWake;\n }, [onWake]);\n\n useEffect(() => {\n const sectionElement = sectionRef.current;\n\n if (!sectionElement) {\n return;\n }\n\n const cleanupMap = new Map<\n HTMLIFrameElement,\n {\n cleanup: () => void;\n }\n >();\n\n const restorePlayerControls = () => {\n if (!enabledRef.current) {\n return;\n }\n\n onWakeRef.current();\n };\n\n const bindIframeDocument = (iframeElement: HTMLIFrameElement) => {\n if (cleanupMap.has(iframeElement)) {\n return;\n }\n\n const handleLoad = () => {\n cleanupMap.get(iframeElement)?.cleanup();\n cleanupMap.delete(iframeElement);\n bindIframeDocument(iframeElement);\n };\n\n iframeElement.addEventListener(\"load\", handleLoad);\n\n const iframeDocument = iframeElement.contentDocument;\n\n if (!iframeDocument) {\n cleanupMap.set(iframeElement, {\n cleanup: () => {\n iframeElement.removeEventListener(\"load\", handleLoad);\n },\n });\n return;\n }\n\n const handleIframeDocumentInteraction = () => {\n restorePlayerControls();\n };\n\n iframeDocument.addEventListener(\n \"pointerdown\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.addEventListener(\n \"mousedown\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.addEventListener(\n \"touchstart\",\n handleIframeDocumentInteraction,\n true\n );\n\n cleanupMap.set(iframeElement, {\n cleanup: () => {\n iframeDocument.removeEventListener(\n \"pointerdown\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.removeEventListener(\n \"mousedown\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.removeEventListener(\n \"touchstart\",\n handleIframeDocumentInteraction,\n true\n );\n iframeElement.removeEventListener(\"load\", handleLoad);\n },\n });\n };\n\n const syncIframeBindings = () => {\n const iframeElements = Array.from(\n sectionElement.querySelectorAll<HTMLIFrameElement>(\n \"iframe.content-render-iframe\"\n )\n );\n\n iframeElements.forEach(bindIframeDocument);\n\n cleanupMap.forEach((value, iframeElement) => {\n if (iframeElements.includes(iframeElement)) {\n return;\n }\n\n value.cleanup();\n cleanupMap.delete(iframeElement);\n });\n };\n\n const mutationObserver = new MutationObserver(() => {\n syncIframeBindings();\n });\n\n syncIframeBindings();\n mutationObserver.observe(sectionElement, {\n childList: true,\n subtree: true,\n });\n\n return () => {\n mutationObserver.disconnect();\n cleanupMap.forEach((value) => value.cleanup());\n cleanupMap.clear();\n };\n }, [sectionRef]);\n};\n\nexport default useWakePlayerFromIframe;\n"],"names":["useWakePlayerFromIframe","sectionRef","enabled","onWake","enabledRef","useRef","onWakeRef","useEffect","sectionElement","cleanupMap","restorePlayerControls","bindIframeDocument","iframeElement","handleLoad","iframeDocument","handleIframeDocumentInteraction","syncIframeBindings","iframeElements","value","mutationObserver"],"mappings":";AAQA,MAAMA,IAA0B,CAAC;AAAA,EAC/B,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AACF,MAAqC;AACnC,QAAMC,IAAaC,EAAOH,CAAO,GAC3BI,IAAYD,EAAOF,CAAM;AAE/B,EAAAI,EAAU,MAAM;AACd,IAAAH,EAAW,UAAUF;AAAA,EACvB,GAAG,CAACA,CAAO,CAAC,GAEZK,EAAU,MAAM;AACd,IAAAD,EAAU,UAAUH;AAAA,EACtB,GAAG,CAACA,CAAM,CAAC,GAEXI,EAAU,MAAM;AACd,UAAMC,IAAiBP,EAAW;AAElC,QAAI,CAACO;AACH;AAGF,UAAMC,wBAAiB,IAAA,GAOjBC,IAAwB,MAAM;AAClC,MAAKN,EAAW,WAIhBE,EAAU,QAAA;AAAA,IACZ,GAEMK,IAAqB,CAACC,MAAqC;AAC/D,UAAIH,EAAW,IAAIG,CAAa;AAC9B;AAGF,YAAMC,IAAa,MAAM;AACvB,QAAAJ,EAAW,IAAIG,CAAa,GAAG,QAAA,GAC/BH,EAAW,OAAOG,CAAa,GAC/BD,EAAmBC,CAAa;AAAA,MAClC;AAEA,MAAAA,EAAc,iBAAiB,QAAQC,CAAU;AAEjD,YAAMC,IAAiBF,EAAc;AAErC,UAAI,CAACE,GAAgB;AACnB,QAAAL,EAAW,IAAIG,GAAe;AAAA,UAC5B,SAAS,MAAM;AACb,YAAAA,EAAc,oBAAoB,QAAQC,CAAU;AAAA,UACtD;AAAA,QAAA,CACD;AACD;AAAA,MACF;AAEA,YAAME,IAAkC,MAAM;AAC5C,QAAAL,EAAA;AAAA,MACF;AAEA,MAAAI,EAAe;AAAA,QACb;AAAA,QACAC;AAAA,QACA;AAAA,MAAA,GAEFD,EAAe;AAAA,QACb;AAAA,QACAC;AAAA,QACA;AAAA,MAAA,GAEFD,EAAe;AAAA,QACb;AAAA,QACAC;AAAA,QACA;AAAA,MAAA,GAGFN,EAAW,IAAIG,GAAe;AAAA,QAC5B,SAAS,MAAM;AACb,UAAAE,EAAe;AAAA,YACb;AAAA,YACAC;AAAA,YACA;AAAA,UAAA,GAEFD,EAAe;AAAA,YACb;AAAA,YACAC;AAAA,YACA;AAAA,UAAA,GAEFD,EAAe;AAAA,YACb;AAAA,YACAC;AAAA,YACA;AAAA,UAAA,GAEFH,EAAc,oBAAoB,QAAQC,CAAU;AAAA,QACtD;AAAA,MAAA,CACD;AAAA,IACH,GAEMG,IAAqB,MAAM;AAC/B,YAAMC,IAAiB,MAAM;AAAA,QAC3BT,EAAe;AAAA,UACb;AAAA,QAAA;AAAA,MACF;AAGF,MAAAS,EAAe,QAAQN,CAAkB,GAEzCF,EAAW,QAAQ,CAACS,GAAON,MAAkB;AAC3C,QAAIK,EAAe,SAASL,CAAa,MAIzCM,EAAM,QAAA,GACNT,EAAW,OAAOG,CAAa;AAAA,MACjC,CAAC;AAAA,IACH,GAEMO,IAAmB,IAAI,iBAAiB,MAAM;AAClD,MAAAH,EAAA;AAAA,IACF,CAAC;AAED,WAAAA,EAAA,GACAG,EAAiB,QAAQX,GAAgB;AAAA,MACvC,WAAW;AAAA,MACX,SAAS;AAAA,IAAA,CACV,GAEM,MAAM;AACX,MAAAW,EAAiB,WAAA,GACjBV,EAAW,QAAQ,CAACS,MAAUA,EAAM,SAAS,GAC7CT,EAAW,MAAA;AAAA,IACb;AAAA,EACF,GAAG,CAACR,CAAU,CAAC;AACjB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=({hasInteraction:e,shouldBlockPlaybackForInteraction:r,shouldOpenInteractionOverlayAfterAudio:t,hasResolvedCurrentInteraction:n,currentStepHasSpeakableElement:u})=>e?r||t?!0:n?!u:!1:!1;exports.shouldPresentInteractionOverlay=i;
|
|
2
|
+
//# sourceMappingURL=interactionPlayback.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionPlayback.cjs.js","sources":["../../../../src/components/Slide/utils/interactionPlayback.ts"],"sourcesContent":["interface ShouldPresentInteractionOverlayParams {\n hasInteraction: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n shouldOpenInteractionOverlayAfterAudio: boolean;\n hasResolvedCurrentInteraction: boolean;\n currentStepHasSpeakableElement: boolean;\n}\n\nexport const shouldPresentInteractionOverlay = ({\n hasInteraction,\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n}: ShouldPresentInteractionOverlayParams) => {\n if (!hasInteraction) {\n return false;\n }\n\n if (shouldBlockPlaybackForInteraction) {\n return true;\n }\n\n if (shouldOpenInteractionOverlayAfterAudio) {\n return true;\n }\n\n if (!hasResolvedCurrentInteraction) {\n return false;\n }\n\n // Once a resolved interaction step starts receiving follow-up speech,\n // keep the overlay closed so the step can continue as normal playback.\n return !currentStepHasSpeakableElement;\n};\n"],"names":["shouldPresentInteractionOverlay","hasInteraction","shouldBlockPlaybackForInteraction","shouldOpenInteractionOverlayAfterAudio","hasResolvedCurrentInteraction","currentStepHasSpeakableElement"],"mappings":"gFAQO,MAAMA,EAAkC,CAAC,CAC9C,eAAAC,EACA,kCAAAC,EACA,uCAAAC,EACA,8BAAAC,EACA,+BAAAC,CACF,IACOJ,EAIDC,GAIAC,EACK,GAGJC,EAME,CAACC,EALC,GAZA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ShouldPresentInteractionOverlayParams {
|
|
2
|
+
hasInteraction: boolean;
|
|
3
|
+
shouldBlockPlaybackForInteraction: boolean;
|
|
4
|
+
shouldOpenInteractionOverlayAfterAudio: boolean;
|
|
5
|
+
hasResolvedCurrentInteraction: boolean;
|
|
6
|
+
currentStepHasSpeakableElement: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const shouldPresentInteractionOverlay: ({ hasInteraction, shouldBlockPlaybackForInteraction, shouldOpenInteractionOverlayAfterAudio, hasResolvedCurrentInteraction, currentStepHasSpeakableElement, }: ShouldPresentInteractionOverlayParams) => boolean;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const f = ({
|
|
2
|
+
hasInteraction: r,
|
|
3
|
+
shouldBlockPlaybackForInteraction: e,
|
|
4
|
+
shouldOpenInteractionOverlayAfterAudio: t,
|
|
5
|
+
hasResolvedCurrentInteraction: n,
|
|
6
|
+
currentStepHasSpeakableElement: u
|
|
7
|
+
}) => r ? e || t ? !0 : n ? !u : !1 : !1;
|
|
8
|
+
export {
|
|
9
|
+
f as shouldPresentInteractionOverlay
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=interactionPlayback.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionPlayback.es.js","sources":["../../../../src/components/Slide/utils/interactionPlayback.ts"],"sourcesContent":["interface ShouldPresentInteractionOverlayParams {\n hasInteraction: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n shouldOpenInteractionOverlayAfterAudio: boolean;\n hasResolvedCurrentInteraction: boolean;\n currentStepHasSpeakableElement: boolean;\n}\n\nexport const shouldPresentInteractionOverlay = ({\n hasInteraction,\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n}: ShouldPresentInteractionOverlayParams) => {\n if (!hasInteraction) {\n return false;\n }\n\n if (shouldBlockPlaybackForInteraction) {\n return true;\n }\n\n if (shouldOpenInteractionOverlayAfterAudio) {\n return true;\n }\n\n if (!hasResolvedCurrentInteraction) {\n return false;\n }\n\n // Once a resolved interaction step starts receiving follow-up speech,\n // keep the overlay closed so the step can continue as normal playback.\n return !currentStepHasSpeakableElement;\n};\n"],"names":["shouldPresentInteractionOverlay","hasInteraction","shouldBlockPlaybackForInteraction","shouldOpenInteractionOverlayAfterAudio","hasResolvedCurrentInteraction","currentStepHasSpeakableElement"],"mappings":"AAQO,MAAMA,IAAkC,CAAC;AAAA,EAC9C,gBAAAC;AAAA,EACA,mCAAAC;AAAA,EACA,wCAAAC;AAAA,EACA,+BAAAC;AAAA,EACA,gCAAAC;AACF,MACOJ,IAIDC,KAIAC,IACK,KAGJC,IAME,CAACC,IALC,KAZA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Element, ElementAudioSegment } from '../types';
|
|
2
|
+
export type RunStreamRawAudioSegment = ElementAudioSegment & {
|
|
3
|
+
element_id?: string | null;
|
|
4
|
+
};
|
|
5
|
+
export type RunStreamAudioTrack = {
|
|
6
|
+
position?: number;
|
|
7
|
+
slide_id?: string;
|
|
8
|
+
slideId?: string;
|
|
9
|
+
audio_url?: string;
|
|
10
|
+
audioUrl?: string;
|
|
11
|
+
is_audio_streaming?: boolean;
|
|
12
|
+
isAudioStreaming?: boolean;
|
|
13
|
+
audio_segments?: RunStreamRawAudioSegment[];
|
|
14
|
+
audioSegments?: RunStreamRawAudioSegment[];
|
|
15
|
+
};
|
|
16
|
+
export type RunStreamFixtureRecord = {
|
|
17
|
+
element_bid?: string;
|
|
18
|
+
target_element_bid?: string;
|
|
19
|
+
generated_block_bid?: string;
|
|
20
|
+
element_type?: string;
|
|
21
|
+
content?: Element["content"];
|
|
22
|
+
is_marker?: boolean;
|
|
23
|
+
is_renderable?: boolean;
|
|
24
|
+
is_new?: boolean;
|
|
25
|
+
is_speakable?: boolean;
|
|
26
|
+
audio_url?: string;
|
|
27
|
+
audioUrl?: string;
|
|
28
|
+
audio_segments?: RunStreamRawAudioSegment[];
|
|
29
|
+
audioTracks?: RunStreamAudioTrack[];
|
|
30
|
+
audio_tracks?: RunStreamAudioTrack[];
|
|
31
|
+
is_audio_streaming?: boolean;
|
|
32
|
+
isAudioStreaming?: boolean;
|
|
33
|
+
user_input?: string;
|
|
34
|
+
readonly?: boolean;
|
|
35
|
+
page?: number;
|
|
36
|
+
sequence_number?: number;
|
|
37
|
+
run_event_seq?: number;
|
|
38
|
+
};
|
|
39
|
+
export type RunStreamFixtureEvent = {
|
|
40
|
+
type?: string;
|
|
41
|
+
event_type?: string;
|
|
42
|
+
content?: RunStreamFixtureRecord | null;
|
|
43
|
+
run_event_seq?: number;
|
|
44
|
+
generated_block_bid?: string;
|
|
45
|
+
};
|
|
46
|
+
export type RunStreamFixtureElement = Element & {
|
|
47
|
+
element_bid: string;
|
|
48
|
+
blockBid?: string;
|
|
49
|
+
page?: number;
|
|
50
|
+
run_event_seq?: number;
|
|
51
|
+
is_audio_streaming?: boolean;
|
|
52
|
+
isAudioStreaming?: boolean;
|
|
53
|
+
};
|
|
54
|
+
export declare const normalizeRunStreamElement: (record: RunStreamFixtureRecord, fallbackEventSeq: number) => RunStreamFixtureElement | null;
|
|
55
|
+
export declare const upsertRunStreamElementList: ({ currentList, nextElement, sequenceMap, }: {
|
|
56
|
+
currentList: RunStreamFixtureElement[];
|
|
57
|
+
nextElement: RunStreamFixtureElement;
|
|
58
|
+
sequenceMap: Map<string, number>;
|
|
59
|
+
}) => {
|
|
60
|
+
page: number;
|
|
61
|
+
content: React.ReactNode;
|
|
62
|
+
type: import('../types').ElementType;
|
|
63
|
+
is_renderable?: boolean;
|
|
64
|
+
is_new?: boolean;
|
|
65
|
+
is_marker?: boolean;
|
|
66
|
+
sequence_number?: number;
|
|
67
|
+
is_speakable?: boolean;
|
|
68
|
+
audio_url?: string;
|
|
69
|
+
user_input?: string;
|
|
70
|
+
readonly?: boolean;
|
|
71
|
+
audio_segments?: ElementAudioSegment[];
|
|
72
|
+
element_bid: string;
|
|
73
|
+
blockBid?: string;
|
|
74
|
+
run_event_seq?: number;
|
|
75
|
+
is_audio_streaming?: boolean;
|
|
76
|
+
isAudioStreaming?: boolean;
|
|
77
|
+
}[];
|
|
78
|
+
export declare const buildRunStreamElementListFromEvents: ({ events, sequenceMap, }: {
|
|
79
|
+
events: RunStreamFixtureEvent[];
|
|
80
|
+
sequenceMap?: Map<string, number>;
|
|
81
|
+
}) => RunStreamFixtureElement[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=({previousResetKey:n,nextResetKey:t,currentAudioKey:i,hasCompletedCurrentStepAudio:a})=>{const e=n!==t;return{hasPlaybackContextChanged:e,shouldInitializeAudioSequence:e||!i&&!a}};exports.getPlaybackSequenceTransition=o;
|
|
2
|
+
//# sourceMappingURL=playbackSequence.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playbackSequence.cjs.js","sources":["../../../../src/components/Slide/utils/playbackSequence.ts"],"sourcesContent":["export interface PlaybackSequenceTransitionOptions {\n previousResetKey: string | null;\n nextResetKey: string;\n currentAudioKey: string | null;\n hasCompletedCurrentStepAudio: boolean;\n}\n\nexport interface PlaybackSequenceTransitionResult {\n hasPlaybackContextChanged: boolean;\n shouldInitializeAudioSequence: boolean;\n}\n\nexport const getPlaybackSequenceTransition = ({\n previousResetKey,\n nextResetKey,\n currentAudioKey,\n hasCompletedCurrentStepAudio,\n}: PlaybackSequenceTransitionOptions): PlaybackSequenceTransitionResult => {\n const hasPlaybackContextChanged = previousResetKey !== nextResetKey;\n const shouldInitializeAudioSequence =\n hasPlaybackContextChanged ||\n (!currentAudioKey && !hasCompletedCurrentStepAudio);\n\n return {\n hasPlaybackContextChanged,\n shouldInitializeAudioSequence,\n };\n};\n"],"names":["getPlaybackSequenceTransition","previousResetKey","nextResetKey","currentAudioKey","hasCompletedCurrentStepAudio","hasPlaybackContextChanged"],"mappings":"gFAYO,MAAMA,EAAgC,CAAC,CAC5C,iBAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,6BAAAC,CACF,IAA2E,CACzE,MAAMC,EAA4BJ,IAAqBC,EAKvD,MAAO,CACL,0BAAAG,EACA,8BALAA,GACC,CAACF,GAAmB,CAACC,CAItB,CAEJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface PlaybackSequenceTransitionOptions {
|
|
2
|
+
previousResetKey: string | null;
|
|
3
|
+
nextResetKey: string;
|
|
4
|
+
currentAudioKey: string | null;
|
|
5
|
+
hasCompletedCurrentStepAudio: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface PlaybackSequenceTransitionResult {
|
|
8
|
+
hasPlaybackContextChanged: boolean;
|
|
9
|
+
shouldInitializeAudioSequence: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const getPlaybackSequenceTransition: ({ previousResetKey, nextResetKey, currentAudioKey, hasCompletedCurrentStepAudio, }: PlaybackSequenceTransitionOptions) => PlaybackSequenceTransitionResult;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const c = ({
|
|
2
|
+
previousResetKey: n,
|
|
3
|
+
nextResetKey: t,
|
|
4
|
+
currentAudioKey: i,
|
|
5
|
+
hasCompletedCurrentStepAudio: o
|
|
6
|
+
}) => {
|
|
7
|
+
const e = n !== t;
|
|
8
|
+
return {
|
|
9
|
+
hasPlaybackContextChanged: e,
|
|
10
|
+
shouldInitializeAudioSequence: e || !i && !o
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
c as getPlaybackSequenceTransition
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=playbackSequence.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playbackSequence.es.js","sources":["../../../../src/components/Slide/utils/playbackSequence.ts"],"sourcesContent":["export interface PlaybackSequenceTransitionOptions {\n previousResetKey: string | null;\n nextResetKey: string;\n currentAudioKey: string | null;\n hasCompletedCurrentStepAudio: boolean;\n}\n\nexport interface PlaybackSequenceTransitionResult {\n hasPlaybackContextChanged: boolean;\n shouldInitializeAudioSequence: boolean;\n}\n\nexport const getPlaybackSequenceTransition = ({\n previousResetKey,\n nextResetKey,\n currentAudioKey,\n hasCompletedCurrentStepAudio,\n}: PlaybackSequenceTransitionOptions): PlaybackSequenceTransitionResult => {\n const hasPlaybackContextChanged = previousResetKey !== nextResetKey;\n const shouldInitializeAudioSequence =\n hasPlaybackContextChanged ||\n (!currentAudioKey && !hasCompletedCurrentStepAudio);\n\n return {\n hasPlaybackContextChanged,\n shouldInitializeAudioSequence,\n };\n};\n"],"names":["getPlaybackSequenceTransition","previousResetKey","nextResetKey","currentAudioKey","hasCompletedCurrentStepAudio","hasPlaybackContextChanged"],"mappings":"AAYO,MAAMA,IAAgC,CAAC;AAAA,EAC5C,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,8BAAAC;AACF,MAA2E;AACzE,QAAMC,IAA4BJ,MAAqBC;AAKvD,SAAO;AAAA,IACL,2BAAAG;AAAA,IACA,+BALAA,KACC,CAACF,KAAmB,CAACC;AAAA,EAItB;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playerCustomActions.cjs.js","sources":["../../../../src/components/Slide/utils/playerCustomActions.ts"],"sourcesContent":["import React from \"react\";\n\nexport const toPlayerCustomActionList = (customActions?: React.ReactNode) =>\n React.Children.toArray(customActions);\n\nexport const getPlayerCustomActionCount = (customActions?: React.ReactNode) =>\n toPlayerCustomActionList(customActions).length;\n"],"names":["toPlayerCustomActionList","customActions","React","getPlayerCustomActionCount"],"mappings":"yGAEaA,EAA4BC,GACvCC,EAAM,SAAS,QAAQD,CAAa,EAEzBE,EAA8BF,GACzCD,EAAyBC,CAAa,EAAE"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const toPlayerCustomActionList: (customActions?: React.ReactNode) => (string | number | bigint | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined>)[];
|
|
3
|
+
export declare const getPlayerCustomActionCount: (customActions?: React.ReactNode) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playerCustomActions.es.js","sources":["../../../../src/components/Slide/utils/playerCustomActions.ts"],"sourcesContent":["import React from \"react\";\n\nexport const toPlayerCustomActionList = (customActions?: React.ReactNode) =>\n React.Children.toArray(customActions);\n\nexport const getPlayerCustomActionCount = (customActions?: React.ReactNode) =>\n toPlayerCustomActionList(customActions).length;\n"],"names":["toPlayerCustomActionList","customActions","React","getPlayerCustomActionCount"],"mappings":";AAEO,MAAMA,IAA2B,CAACC,MACvCC,EAAM,SAAS,QAAQD,CAAa,GAEzBE,IAA6B,CAACF,MACzCD,EAAyBC,CAAa,EAAE;"}
|
|
@@ -2,6 +2,13 @@ export { default as ContentRender } from './ContentRender';
|
|
|
2
2
|
export { default as MarkdownFlow } from './MarkdownFlow';
|
|
3
3
|
export { default as ScrollableMarkdown } from './MarkdownFlow/ScrollableMarkdownFlow';
|
|
4
4
|
export { default as MarkdownFlowEditor } from './MarkdownFlowEditor';
|
|
5
|
+
export { default as Slide } from './Slide';
|
|
6
|
+
export { Player, useSlide } from './Slide';
|
|
7
|
+
export { getInteractionDefaultValues, getInteractionDefaultSelectedValues, } from '../lib/interaction-defaults';
|
|
5
8
|
export type { ContentRenderProps } from './ContentRender/ContentRender';
|
|
6
9
|
export type { OnSendContentParams, CustomRenderBarProps } from './types';
|
|
7
10
|
export type { EditMode, UploadProps, ImageResource, } from './MarkdownFlowEditor';
|
|
11
|
+
export type { Element, SlideInteractionTexts, SlideProps } from './Slide';
|
|
12
|
+
export type { InteractionDefaultResolver, InteractionDefaultResolverParams, InteractionDefaultValueOptions, InteractionDefaultValues, InteractionParseResult, } from '../lib/interaction-defaults';
|
|
13
|
+
export type { PlayerProps } from './Slide';
|
|
14
|
+
export type { UseSlideResult } from './Slide';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../_virtual/jsx-runtime.cjs.js"),s=require("react"),u=require("../../../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");require("../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../_virtual/jsx-runtime.cjs.js"),s=require("react"),u=require("../../../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");require("../../../_virtual/index.cjs6.js");require("../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.cjs.js");require("../../../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/hooks/useLayoutEffect.cjs.js");require("../../../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/raf.cjs.js");const d=require("../../../lib/utils.cjs.js");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const l=c(s),i=l.forwardRef(({className:e,autoSize:t={minRows:1},style:r,...a},n)=>o.jsxRuntimeExports.jsx(u.default,{ref:n,autoSize:t,className:d.cn("border-input placeholder:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 w-full rounded-md border bg-transparent pl-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50","resize-none",e),style:{whiteSpace:"pre-wrap",wordBreak:"break-word",...r},...a}));i.displayName="Textarea";exports.Textarea=i;
|
|
2
2
|
//# sourceMappingURL=textarea.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as i } from "../../../_virtual/jsx-runtime.es.js";
|
|
2
2
|
import * as d from "react";
|
|
3
3
|
import n from "../../../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";
|
|
4
|
-
import "../../../_virtual/index.
|
|
4
|
+
import "../../../_virtual/index.es6.js";
|
|
5
5
|
import "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.es.js";
|
|
6
6
|
import "../../../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/hooks/useLayoutEffect.es.js";
|
|
7
7
|
import "../../../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/raf.es.js";
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js"),n=require("./components/MarkdownFlow/MarkdownFlow.cjs.js");require("./_virtual/jsx-runtime.cjs.js");require("react");;/* empty css */const r=require("./components/ContentRender/ContentRender.cjs.js"),o=require("./components/ContentRender/IframeSandbox.cjs.js"),a=require("./components/ContentRender/utils/split-content.cjs.js"),u=require("./components/ContentRender/MarkdownFlowInput.cjs.js"),e=require("./lib/interaction-defaults.cjs.js");exports.MarkdownFlowEditor=t.default;exports.MarkdownFlow=n.default;exports.ContentRender=r.default;exports.IframeSandbox=o.default;exports.splitContentSegments=a.splitContentSegments;exports.MarkdownFlowInput=u.default;exports.getInteractionDefaultSelectedValues=e.getInteractionDefaultSelectedValues;exports.getInteractionDefaultValues=e.getInteractionDefaultValues;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.es.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { default as f } from "./components/MarkdownFlowEditor/MarkdownFlowEditor.es.js";
|
|
2
|
-
import { default as
|
|
2
|
+
import { default as l } from "./components/MarkdownFlow/MarkdownFlow.es.js";
|
|
3
3
|
import "./_virtual/jsx-runtime.es.js";
|
|
4
4
|
import "react";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import { splitContentSegments as
|
|
9
|
-
import { default as
|
|
6
|
+
import { default as m } from "./components/ContentRender/ContentRender.es.js";
|
|
7
|
+
import { default as u } from "./components/ContentRender/IframeSandbox.es.js";
|
|
8
|
+
import { splitContentSegments as x } from "./components/ContentRender/utils/split-content.es.js";
|
|
9
|
+
import { default as w } from "./components/ContentRender/MarkdownFlowInput.es.js";
|
|
10
|
+
import { getInteractionDefaultSelectedValues as c, getInteractionDefaultValues as g } from "./lib/interaction-defaults.es.js";
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
m as ContentRender,
|
|
13
|
+
u as IframeSandbox,
|
|
14
|
+
l as MarkdownFlow,
|
|
14
15
|
f as MarkdownFlowEditor,
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
w as MarkdownFlowInput,
|
|
17
|
+
c as getInteractionDefaultSelectedValues,
|
|
18
|
+
g as getInteractionDefaultValues,
|
|
19
|
+
x as splitContentSegments
|
|
17
20
|
};
|
|
18
21
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../_virtual/index.cjs.js"),I=b.distExports.createInteractionParser(),v=/<custom-variable\b/i,h=/\?\[%\{\{([^}]+)\}\}([\s\S]*?)\]/,g=/^[\[{]/,V=t=>{if(!t)return null;const r=t.match(h),s=r?.[1]?.trim(),e=r?.[2]?.trim();if(!e)return null;const u=e.includes("||"),o=u?"||":"|",n=e.split(o).map(l=>l.trim()).filter(Boolean);if(!n.length)return null;const c=[],i=[];let f;return n.forEach(l=>{if(l.startsWith("...")){const a=l.replace(/^\.\.\./,"").trim();a&&(f=a);return}c.push(l),i.push(l)}),{variableName:s,buttonTexts:c.length?c:void 0,buttonValues:i.length?i:void 0,placeholder:f,isMultiSelect:u}},S=t=>{if(!t)return null;try{return I.parseToRemarkFormat(t)}catch(r){console.warn("Failed to parse interaction block",r)}return V(t)},T=(t,r)=>{if(!t)return null;const s=t.trim(),e=r.buttonValues||[],u=r.buttonTexts||[],o=e.indexOf(s);if(o>-1)return{value:e[o],display:u[o]};const n=u.indexOf(s);return n>-1?{value:e[n]||u[n],display:u[n]}:null},D=t=>t.split(/[,,\n]/).map(r=>r.trim()).filter(Boolean),A=t=>{if(!t||Array.isArray(t))return null;const r=Array.isArray(t.selectedValues)?t.selectedValues.map(u=>`${u??""}`.trim()).filter(Boolean):void 0,s=`${t.buttonText??""}`.trim(),e=typeof t.inputText=="string"?t.inputText:void 0;return!r?.length&&!s&&!e?null:{buttonText:s||void 0,inputText:e,selectedValues:r?.length?r:void 0}},E=t=>{if(!t||!g.test(t.trim()))return null;try{const r=JSON.parse(t);return A(r)}catch{return null}},N=t=>!!(t&&(v.test(t)||h.test(t))),m=(t,r,s,e)=>e?.resolveDefaultValues?.({content:t,rawValue:r,interactionInfo:s})??null,x=(t,r,s)=>{const e=r?.toString().trim();if(!e)return{};const u=E(e);if(u)return u;const o=m(t,e,null,s);if(o)return o;if(!N(t))return{buttonText:e,inputText:e};const n=S(t),c=m(t,e,n,s);if(c)return c;if(!n)return{buttonText:e,inputText:e};if(n.isMultiSelect){const f=D(e);if(!f.length)return{};const l=[],a=[];return f.forEach(d=>{const p=T(d,n);if(p){l.push(p.value);return}if(n.placeholder){a.push(d);return}l.push(d)}),{selectedValues:l.length?l:void 0,inputText:a.length?a.join(", "):void 0}}const i=T(e,n);return i?{buttonText:i.value||i.display||e}:n.placeholder?{inputText:e}:{buttonText:e,inputText:e}},O=(t,r,s)=>{const e=x(t,r,s);return e.selectedValues?e.selectedValues:r?r.split(",").map(u=>u.trim()).filter(Boolean):void 0};exports.getInteractionDefaultSelectedValues=O;exports.getInteractionDefaultValues=x;
|
|
2
|
+
//# sourceMappingURL=interaction-defaults.cjs.js.map
|