markdown-flow-ui 0.1.99 → 0.1.100-beta.1

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 (105) hide show
  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
  2. 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
  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.es.js +17 -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.es.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/file-pen-line.cjs.js +7 -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/file-pen-line.cjs.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.es.js +29 -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.es.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/maximize.cjs.js +7 -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/maximize.cjs.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.es.js +18 -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.es.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/rotate-ccw.cjs.js +7 -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/rotate-ccw.cjs.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.es.js +16 -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.es.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-cw.cjs.js +7 -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-cw.cjs.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.es.js +16 -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.es.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/volume-2.cjs.js +7 -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/volume-2.cjs.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.es.js +23 -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.es.js.map +1 -0
  25. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
  26. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
  27. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
  28. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
  29. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
  30. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
  31. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
  32. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
  33. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
  34. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
  35. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js +1 -1
  36. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.es.js +1 -1
  37. package/dist/_virtual/index.cjs.js +1 -1
  38. package/dist/_virtual/index.cjs7.js +1 -1
  39. package/dist/_virtual/index.cjs8.js +1 -1
  40. package/dist/_virtual/index.es.js +1 -0
  41. package/dist/_virtual/index.es7.js +3 -2
  42. package/dist/_virtual/index.es7.js.map +1 -1
  43. package/dist/_virtual/index.es8.js +2 -3
  44. package/dist/_virtual/index.es8.js.map +1 -1
  45. package/dist/assets/markdown-flow-ui.css +1 -1
  46. package/dist/components/ContentRender/ContentRender.cjs.js +1 -1
  47. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  48. package/dist/components/ContentRender/ContentRender.es.js +1 -0
  49. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  50. package/dist/components/ContentRender/IframeSandbox.cjs.js +3 -3
  51. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  52. package/dist/components/ContentRender/IframeSandbox.es.js +212 -164
  53. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  54. package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
  55. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  56. package/dist/components/ContentRender/SandboxApp.es.js +21 -21
  57. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  58. package/dist/components/ContentRender/index.cjs.js +1 -1
  59. package/dist/components/ContentRender/index.es.js +6 -5
  60. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  61. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  62. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +2 -2
  63. package/dist/components/Slide/Player.cjs.js +2 -0
  64. package/dist/components/Slide/Player.cjs.js.map +1 -0
  65. package/dist/components/Slide/Player.d.ts +19 -0
  66. package/dist/components/Slide/Player.es.js +327 -0
  67. package/dist/components/Slide/Player.es.js.map +1 -0
  68. package/dist/components/Slide/Slide.cjs.js +2 -0
  69. package/dist/components/Slide/Slide.cjs.js.map +1 -0
  70. package/dist/components/Slide/Slide.d.ts +12 -0
  71. package/dist/components/Slide/Slide.es.js +394 -0
  72. package/dist/components/Slide/Slide.es.js.map +1 -0
  73. package/dist/components/Slide/Slide.stories.d.ts +47 -0
  74. package/dist/components/Slide/diff-utils.cjs.js +5 -0
  75. package/dist/components/Slide/diff-utils.cjs.js.map +1 -0
  76. package/dist/components/Slide/diff-utils.d.ts +18 -0
  77. package/dist/components/Slide/diff-utils.es.js +113 -0
  78. package/dist/components/Slide/diff-utils.es.js.map +1 -0
  79. package/dist/components/Slide/index.d.ts +12 -0
  80. package/dist/components/Slide/interaction-defaults.cjs.js +2 -0
  81. package/dist/components/Slide/interaction-defaults.cjs.js.map +1 -0
  82. package/dist/components/Slide/interaction-defaults.d.ts +23 -0
  83. package/dist/components/Slide/interaction-defaults.es.js +85 -0
  84. package/dist/components/Slide/interaction-defaults.es.js.map +1 -0
  85. package/dist/components/Slide/types.d.ts +24 -0
  86. package/dist/components/Slide/useSlide.cjs.js +2 -0
  87. package/dist/components/Slide/useSlide.cjs.js.map +1 -0
  88. package/dist/components/Slide/useSlide.d.ts +21 -0
  89. package/dist/components/Slide/useSlide.es.js +102 -0
  90. package/dist/components/Slide/useSlide.es.js.map +1 -0
  91. package/dist/components/index.d.ts +5 -0
  92. package/dist/index.cjs.js +1 -1
  93. package/dist/index.es.js +21 -9
  94. package/dist/index.es.js.map +1 -1
  95. package/dist/lib/browserUserActivation.cjs.js +2 -0
  96. package/dist/lib/browserUserActivation.cjs.js.map +1 -0
  97. package/dist/lib/browserUserActivation.d.ts +5 -0
  98. package/dist/lib/browserUserActivation.es.js +13 -0
  99. package/dist/lib/browserUserActivation.es.js.map +1 -0
  100. package/dist/markdown-flow-ui-lib.css +1 -1
  101. package/dist/renderer.cjs.js +1 -1
  102. package/dist/renderer.d.ts +3 -2
  103. package/dist/renderer.es.js +20 -8
  104. package/dist/renderer.es.js.map +1 -1
  105. package/package.json +1 -1
@@ -0,0 +1,394 @@
1
+ import { j as t } from "../../_virtual/jsx-runtime.es.js";
2
+ import { memo as Ce, useRef as f, useState as p, useCallback as l, useEffect as S, useMemo as L } from "react";
3
+ import { hasBrowserUserActivation as Re } from "../../lib/browserUserActivation.es.js";
4
+ import { cn as j } from "../../lib/utils.es.js";
5
+ import Fe from "../ContentRender/ContentRender.es.js";
6
+ import ce from "../ContentRender/IframeSandbox.es.js";
7
+ import "../ui/inputGroup/input-group.es.js";
8
+ import { getInteractionDefaultValues as Be, getInteractionDefaultSelectedValues as Oe } from "./interaction-defaults.es.js";
9
+ import Ve from "./Player.es.js";
10
+ import qe from "./useSlide.es.js";
11
+ /* empty css */
12
+ const De = 1e3, ue = Ce(
13
+ ({
14
+ content: M,
15
+ title: $,
16
+ defaultButtonText: K,
17
+ defaultInputText: U,
18
+ defaultSelectedValues: _,
19
+ onSend: z,
20
+ readonly: C = !1
21
+ }) => /* @__PURE__ */ t.jsxs("div", { className: "slide-player__interaction-card", children: [
22
+ /* @__PURE__ */ t.jsx("div", { className: "slide-player__interaction-header", children: /* @__PURE__ */ t.jsx("p", { className: "slide-player__interaction-title", children: $ }) }),
23
+ /* @__PURE__ */ t.jsx("div", { className: "slide-player__interaction-body", children: /* @__PURE__ */ t.jsx(
24
+ Fe,
25
+ {
26
+ content: M,
27
+ defaultButtonText: K,
28
+ defaultInputText: U,
29
+ defaultSelectedValues: _,
30
+ onSend: z,
31
+ readonly: C,
32
+ enableTypewriter: !1,
33
+ sandboxMode: "content"
34
+ }
35
+ ) }),
36
+ /* @__PURE__ */ t.jsx("div", { className: "slide-player__interaction-arrow" })
37
+ ] })
38
+ );
39
+ ue.displayName = "InteractionOverlayCard";
40
+ const We = ({
41
+ elementList: M = [],
42
+ showPlayer: $ = !0,
43
+ playerClassName: K,
44
+ interactionTitle: U,
45
+ playerAutoHideDelay: _ = 3e3,
46
+ className: z,
47
+ onPointerDown: C,
48
+ ...de
49
+ }) => {
50
+ const X = f(null), G = f(null), Z = f(null), T = f(null), P = f(null), A = f(null), ee = f([]), R = f(!1), {
51
+ currentElementList: o,
52
+ slideElementList: Y,
53
+ currentIndex: te,
54
+ audioList: ne,
55
+ currentAudioSequenceIndexes: x,
56
+ currentInteractionElement: y,
57
+ canGoPrev: fe,
58
+ canGoNext: m,
59
+ handlePrev: re,
60
+ handleNext: u
61
+ } = qe(M), oe = Y.filter(
62
+ (e) => e.is_show !== !1
63
+ ).length === 1, d = $ && (oe || ne.length > 0 || !!y), [h, J] = p(!0), [E, me] = p(!1), [he] = p(() => Re()), pe = he || E, [xe, F] = p(-1), [B, O] = p(-1), [n, Q] = p(), [N, V] = p(!1), v = l(() => {
64
+ T.current !== null && (window.clearTimeout(T.current), T.current = null);
65
+ }, []), a = l(() => {
66
+ A.current !== null && (window.clearTimeout(A.current), A.current = null);
67
+ }, []), g = l(() => {
68
+ P.current !== null && (window.clearTimeout(P.current), P.current = null);
69
+ }, []), w = l(() => {
70
+ g(), a(), F(-1), O(-1), Q(void 0), V(!1);
71
+ }, [g, a]), q = l(() => {
72
+ const e = x[0];
73
+ return typeof e != "number" ? !1 : (O(0), F(e), !0);
74
+ }, [x]), D = l(() => {
75
+ a(), V(!1), !q() && m && u();
76
+ }, [
77
+ m,
78
+ a,
79
+ u,
80
+ q
81
+ ]), b = l(
82
+ (e = E) => {
83
+ d && (J(!0), v(), !(!e || _ <= 0) && (T.current = window.setTimeout(() => {
84
+ J(!1), T.current = null;
85
+ }, _)));
86
+ },
87
+ [
88
+ v,
89
+ E,
90
+ _,
91
+ d
92
+ ]
93
+ );
94
+ S(() => () => {
95
+ g(), v(), a();
96
+ }, [
97
+ g,
98
+ a,
99
+ v
100
+ ]), S(() => {
101
+ if (!d) {
102
+ v(), J(!1);
103
+ return;
104
+ }
105
+ E || b(!0);
106
+ }, [
107
+ v,
108
+ E,
109
+ d,
110
+ b
111
+ ]), S(() => {
112
+ if (w(), !(o.length === 0 && !y)) {
113
+ if (y) {
114
+ Q(y), V(!0);
115
+ return;
116
+ }
117
+ if (!q() && m)
118
+ return P.current = window.setTimeout(() => {
119
+ P.current = null, u();
120
+ }, De), () => {
121
+ g();
122
+ };
123
+ }
124
+ }, [
125
+ m,
126
+ g,
127
+ o,
128
+ y,
129
+ u,
130
+ w,
131
+ q
132
+ ]);
133
+ const le = L(() => n ? Be(
134
+ typeof n.content == "string" ? n.content : void 0,
135
+ n.user_input
136
+ ) : {}, [n]), ye = L(() => {
137
+ if (n)
138
+ return Oe(
139
+ typeof n.content == "string" ? n.content : void 0,
140
+ n.user_input
141
+ );
142
+ }, [n]), W = !!n?.user_input?.trim(), ve = l(
143
+ (e) => {
144
+ const i = [
145
+ ...e.selectedValues ?? [],
146
+ e.inputText?.trim() ?? "",
147
+ e.buttonText?.trim() ?? ""
148
+ ].filter(Boolean).join(", ");
149
+ Q((r) => !r || !i ? r : {
150
+ ...r,
151
+ user_input: i
152
+ }), D();
153
+ },
154
+ [D]
155
+ );
156
+ S(() => {
157
+ if (a(), !(!N || !W))
158
+ return A.current = window.setTimeout(() => {
159
+ A.current = null, D();
160
+ }, 2e3), () => {
161
+ a();
162
+ };
163
+ }, [
164
+ a,
165
+ D,
166
+ W,
167
+ N
168
+ ]);
169
+ const ge = (e) => e ? e.type === "slot" ? /* @__PURE__ */ t.jsx(t.Fragment, { children: e.content }) : e.type === "html" ? /* @__PURE__ */ t.jsx(
170
+ ce,
171
+ {
172
+ className: "content-render-iframe",
173
+ hideFullScreen: !0,
174
+ mode: "blackboard",
175
+ type: "sandbox",
176
+ content: e.content
177
+ }
178
+ ) : /* @__PURE__ */ t.jsx(
179
+ ce,
180
+ {
181
+ className: "content-render-iframe",
182
+ hideFullScreen: !0,
183
+ mode: "blackboard",
184
+ type: "markdown",
185
+ content: e.content
186
+ }
187
+ ) : null, we = (e = []) => {
188
+ if (e.length === 0)
189
+ return null;
190
+ const c = e.filter(
191
+ (r) => r.is_show !== !1
192
+ ).length, i = e.reduce(
193
+ (r, I, s) => I.is_show !== !1 ? s : r,
194
+ -1
195
+ );
196
+ return /* @__PURE__ */ t.jsx("div", { className: "slide-stage__content flex w-full flex-col gap-4", children: e.map((r, I) => {
197
+ const s = r.type === "html" && r.is_show === !1;
198
+ return /* @__PURE__ */ t.jsx(
199
+ "div",
200
+ {
201
+ ref: I === i ? Z : null,
202
+ "aria-hidden": s || void 0,
203
+ className: j(
204
+ "w-full shrink-0",
205
+ c === 1 && r.is_show !== !1 && "slide-element--single",
206
+ s ? "pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0" : r.is_show === !1 && "hidden"
207
+ ),
208
+ children: ge(r)
209
+ },
210
+ r.serial_number ?? `${r.type}-${I}`
211
+ );
212
+ }) });
213
+ }, be = () => {
214
+ const e = X.current;
215
+ if (e) {
216
+ if (document.fullscreenElement) {
217
+ document.exitFullscreen().catch(() => {
218
+ });
219
+ return;
220
+ }
221
+ e.requestFullscreen?.().catch(() => {
222
+ });
223
+ }
224
+ }, se = l(() => {
225
+ const e = G.current;
226
+ e && e.scrollTo({
227
+ top: e.scrollHeight,
228
+ behavior: "smooth"
229
+ });
230
+ }, []), Ie = l(() => {
231
+ R.current = !0, w(), re();
232
+ }, [re, w]), Se = l(() => {
233
+ R.current = !0, w(), u();
234
+ }, [u, w]), _e = l(
235
+ (e) => {
236
+ if (B < 0 || x[B] !== e)
237
+ return;
238
+ const c = B + 1, i = x[c];
239
+ if (typeof i == "number") {
240
+ O(c), F(i);
241
+ return;
242
+ }
243
+ F(-1), O(-1), m && u();
244
+ },
245
+ [
246
+ m,
247
+ x,
248
+ B,
249
+ u
250
+ ]
251
+ ), Te = l(() => {
252
+ n && V((e) => !e);
253
+ }, [n]), ie = l(
254
+ (e) => {
255
+ e.stopPropagation(), h && b(!0);
256
+ },
257
+ [h, b]
258
+ ), ae = l(
259
+ (e) => {
260
+ C?.(e), me(!0), b(!0);
261
+ },
262
+ [C, b]
263
+ ), Pe = !!n && N, k = L(
264
+ () => o.map(
265
+ (e, c) => `${e.serial_number ?? `${e.type}-${c}`}:${e.operation ?? ""}`
266
+ ),
267
+ [o]
268
+ ), Ae = L(() => {
269
+ const e = Y.slice(te + 1).find((i) => i.type === "html");
270
+ return !e || o.some(
271
+ (i) => i.serial_number === e.serial_number
272
+ ) ? o : [...o, { ...e, is_show: !1 }];
273
+ }, [o, te, Y]);
274
+ return S(() => {
275
+ const e = ee.current, r = (e.length > 0 && e.length < k.length && e.every((s, H) => s === k[H]) ? o.slice(e.length) : []).some(
276
+ (s) => s.operation === "append"
277
+ );
278
+ if (ee.current = k, !r)
279
+ return;
280
+ const I = window.requestAnimationFrame(() => {
281
+ const s = G.current, H = Z.current;
282
+ if (!s || !H)
283
+ return;
284
+ const Ee = s.getBoundingClientRect(), Ne = H.getBoundingClientRect(), je = s.scrollTop + (Ne.top - Ee.top);
285
+ s.scrollTo({
286
+ top: Math.max(je, 0),
287
+ behavior: "smooth"
288
+ });
289
+ });
290
+ return () => {
291
+ window.cancelAnimationFrame(I);
292
+ };
293
+ }, [o, k]), S(() => {
294
+ if (!R.current || (R.current = !1, o.length === 0))
295
+ return;
296
+ const e = window.requestAnimationFrame(() => {
297
+ se();
298
+ });
299
+ return () => {
300
+ window.cancelAnimationFrame(e);
301
+ };
302
+ }, [o, se]), console.log(
303
+ "currentElement",
304
+ o.at(-1),
305
+ o,
306
+ d,
307
+ h,
308
+ x,
309
+ y,
310
+ n,
311
+ N
312
+ ), /* @__PURE__ */ t.jsxs(
313
+ "section",
314
+ {
315
+ ref: X,
316
+ className: j("relative h-full w-full", z),
317
+ onPointerDown: ae,
318
+ ...de,
319
+ children: [
320
+ /* @__PURE__ */ t.jsxs(
321
+ "div",
322
+ {
323
+ className: j(
324
+ "h-full min-h-0 w-full",
325
+ oe ? "slide-content--single" : "grid gap-4"
326
+ ),
327
+ children: [
328
+ d && !h ? /* @__PURE__ */ t.jsx(
329
+ "button",
330
+ {
331
+ "aria-label": "Show player controls",
332
+ className: "slide-player-hit-area",
333
+ onPointerDown: ae,
334
+ type: "button"
335
+ }
336
+ ) : null,
337
+ o.length > 0 ? /* @__PURE__ */ t.jsx("div", { className: "slide-stage", children: /* @__PURE__ */ t.jsx("div", { ref: G, className: "slide-stage__layer w-full", children: we(Ae) }) }) : null
338
+ ]
339
+ }
340
+ ),
341
+ Pe ? /* @__PURE__ */ t.jsx(
342
+ "div",
343
+ {
344
+ className: j(
345
+ "slide-interaction-overlay",
346
+ h && d ? "slide-interaction-overlay--with-player" : "slide-interaction-overlay--standalone"
347
+ ),
348
+ onClick: ie,
349
+ onPointerDown: ie,
350
+ children: /* @__PURE__ */ t.jsx(
351
+ ue,
352
+ {
353
+ content: String(n?.content ?? ""),
354
+ defaultButtonText: le.buttonText ?? "",
355
+ defaultInputText: le.inputText ?? "",
356
+ defaultSelectedValues: ye,
357
+ onSend: ve,
358
+ readonly: W,
359
+ title: U ?? "Submit the content below to continue."
360
+ }
361
+ )
362
+ }
363
+ ) : null,
364
+ d ? /* @__PURE__ */ t.jsx(
365
+ Ve,
366
+ {
367
+ audioList: ne,
368
+ className: j(
369
+ "absolute left-1/2 bottom-6 z-[2] -translate-x-1/2",
370
+ K,
371
+ !h && "pointer-events-none opacity-0"
372
+ ),
373
+ currentAudioIndex: xe,
374
+ defaultPlaying: pe,
375
+ hasInteraction: !!n,
376
+ isInteractionOpen: N,
377
+ nextDisabled: !m,
378
+ onEnded: _e,
379
+ onFullscreen: be,
380
+ onInteractionToggle: Te,
381
+ onNext: Se,
382
+ onPrev: Ie,
383
+ prevDisabled: !fe,
384
+ showControls: h
385
+ }
386
+ ) : null
387
+ ]
388
+ }
389
+ );
390
+ };
391
+ export {
392
+ We as default
393
+ };
394
+ //# sourceMappingURL=Slide.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slide.es.js","sources":["../../../src/components/Slide/Slide.tsx"],"sourcesContent":["import React, {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { hasBrowserUserActivation } from \"../../lib/browserUserActivation\";\nimport { cn } from \"../../lib/utils\";\nimport ContentRender from \"../ContentRender\";\nimport IframeSandbox from \"../ContentRender/IframeSandbox\";\nimport type { OnSendContentParams } from \"../types\";\nimport {\n getInteractionDefaultSelectedValues,\n getInteractionDefaultValues,\n} from \"./interaction-defaults\";\nimport Player from \"./Player\";\nimport type { Element } from \"./types\";\nimport useSlide from \"./useSlide\";\nimport \"./slide.css\";\nexport type { Element, ElementAudioSegment } from \"./types\";\n\nconst CHECKPOINT_AUTO_ADVANCE_DELAY_MS = 1000;\n\ninterface InteractionOverlayCardProps {\n content: string;\n title: string;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n onSend?: (content: OnSendContentParams) => void;\n readonly?: boolean;\n}\n\nconst InteractionOverlayCard = memo(\n ({\n content,\n title,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n onSend,\n readonly = false,\n }: InteractionOverlayCardProps) => (\n <div className=\"slide-player__interaction-card\">\n <div className=\"slide-player__interaction-header\">\n <p className=\"slide-player__interaction-title\">{title}</p>\n </div>\n <div className=\"slide-player__interaction-body\">\n <ContentRender\n content={content}\n defaultButtonText={defaultButtonText}\n defaultInputText={defaultInputText}\n defaultSelectedValues={defaultSelectedValues}\n onSend={onSend}\n readonly={readonly}\n enableTypewriter={false}\n sandboxMode=\"content\"\n />\n </div>\n <div className=\"slide-player__interaction-arrow\" />\n </div>\n )\n);\n\nInteractionOverlayCard.displayName = \"InteractionOverlayCard\";\n\nexport interface SlideProps extends React.ComponentProps<\"section\"> {\n elementList?: Element[];\n showPlayer?: boolean;\n playerClassName?: string;\n interactionTitle?: string;\n playerAutoHideDelay?: number;\n}\n\nconst Slide: React.FC<SlideProps> = ({\n elementList = [],\n showPlayer = true,\n playerClassName,\n interactionTitle,\n playerAutoHideDelay = 3000,\n className,\n onPointerDown,\n ...props\n}) => {\n const sectionRef = useRef<HTMLElement | null>(null);\n const stageLayerRef = useRef<HTMLDivElement | null>(null);\n const lastElementRef = useRef<HTMLDivElement | null>(null);\n const playerHideTimerRef = useRef<number | null>(null);\n const autoAdvanceTimerRef = useRef<number | null>(null);\n const interactionAutoCloseTimerRef = useRef<number | null>(null);\n const prevRenderElementKeysRef = useRef<string[]>([]);\n const shouldScrollToBottomRef = useRef(false);\n const {\n currentElementList,\n slideElementList,\n currentIndex,\n audioList,\n currentAudioSequenceIndexes,\n currentInteractionElement,\n canGoPrev,\n canGoNext,\n handlePrev: goPrev,\n handleNext: goNext,\n } = useSlide(elementList);\n const visibleCheckpointCount = slideElementList.filter(\n (element) => element.is_show !== false\n ).length;\n const isSingleSlide = visibleCheckpointCount === 1;\n const shouldRenderPlayer =\n showPlayer &&\n (isSingleSlide ||\n audioList.length > 0 ||\n Boolean(currentInteractionElement));\n const [isPlayerVisible, setIsPlayerVisible] = useState(true);\n const [hasPlayerInteracted, setHasPlayerInteracted] = useState(false);\n const [shouldAutoPlay] = useState(() => hasBrowserUserActivation());\n const canAutoPlayAudio = shouldAutoPlay || hasPlayerInteracted;\n const [currentAudioIndex, setCurrentAudioIndex] = useState(-1);\n const [currentAudioSequencePosition, setCurrentAudioSequencePosition] =\n useState(-1);\n const [activeInteractionElement, setActiveInteractionElement] = useState<\n Element | undefined\n >();\n const [isInteractionOverlayOpen, setIsInteractionOverlayOpen] =\n useState(false);\n\n const clearPlayerHideTimer = useCallback(() => {\n if (playerHideTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(playerHideTimerRef.current);\n playerHideTimerRef.current = null;\n }, []);\n\n const clearInteractionAutoCloseTimer = useCallback(() => {\n if (interactionAutoCloseTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(interactionAutoCloseTimerRef.current);\n interactionAutoCloseTimerRef.current = null;\n }, []);\n\n const clearAutoAdvanceTimer = useCallback(() => {\n if (autoAdvanceTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(autoAdvanceTimerRef.current);\n autoAdvanceTimerRef.current = null;\n }, []);\n\n const resetAudioSequence = useCallback(() => {\n clearAutoAdvanceTimer();\n clearInteractionAutoCloseTimer();\n setCurrentAudioIndex(-1);\n setCurrentAudioSequencePosition(-1);\n setActiveInteractionElement(undefined);\n setIsInteractionOverlayOpen(false);\n }, [clearAutoAdvanceTimer, clearInteractionAutoCloseTimer]);\n\n const startCurrentAudioSequence = useCallback(() => {\n const nextAudioIndex = currentAudioSequenceIndexes[0];\n\n if (typeof nextAudioIndex !== \"number\") {\n return false;\n }\n\n // Start the first audio segment for the current step immediately.\n setCurrentAudioSequencePosition(0);\n setCurrentAudioIndex(nextAudioIndex);\n return true;\n }, [currentAudioSequenceIndexes]);\n\n const continueAfterInteraction = useCallback(() => {\n clearInteractionAutoCloseTimer();\n setIsInteractionOverlayOpen(false);\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (canGoNext) {\n goNext();\n }\n }, [\n canGoNext,\n clearInteractionAutoCloseTimer,\n goNext,\n startCurrentAudioSequence,\n ]);\n\n const showPlayerControls = useCallback(\n (enableAutoHide = hasPlayerInteracted) => {\n if (!shouldRenderPlayer) {\n return;\n }\n\n setIsPlayerVisible(true);\n clearPlayerHideTimer();\n\n if (!enableAutoHide || playerAutoHideDelay <= 0) {\n return;\n }\n\n playerHideTimerRef.current = window.setTimeout(() => {\n setIsPlayerVisible(false);\n playerHideTimerRef.current = null;\n }, playerAutoHideDelay);\n },\n [\n clearPlayerHideTimer,\n hasPlayerInteracted,\n playerAutoHideDelay,\n shouldRenderPlayer,\n ]\n );\n\n useEffect(() => {\n return () => {\n clearAutoAdvanceTimer();\n clearPlayerHideTimer();\n clearInteractionAutoCloseTimer();\n };\n }, [\n clearAutoAdvanceTimer,\n clearInteractionAutoCloseTimer,\n clearPlayerHideTimer,\n ]);\n\n useEffect(() => {\n if (!shouldRenderPlayer) {\n clearPlayerHideTimer();\n setIsPlayerVisible(false);\n return;\n }\n\n if (!hasPlayerInteracted) {\n // Keep the initial player visible briefly, then hide it automatically.\n showPlayerControls(true);\n }\n }, [\n clearPlayerHideTimer,\n hasPlayerInteracted,\n shouldRenderPlayer,\n showPlayerControls,\n ]);\n\n useEffect(() => {\n resetAudioSequence();\n\n if (currentElementList.length === 0 && !currentInteractionElement) {\n return;\n }\n\n if (currentInteractionElement) {\n // Show the interaction gate before playing any follow-up audio.\n setActiveInteractionElement(currentInteractionElement);\n setIsInteractionOverlayOpen(true);\n return;\n }\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (!canGoNext) {\n return;\n }\n\n // Auto-advance silent checkpoint-only steps so playback flow does not stall.\n autoAdvanceTimerRef.current = window.setTimeout(() => {\n autoAdvanceTimerRef.current = null;\n goNext();\n }, CHECKPOINT_AUTO_ADVANCE_DELAY_MS);\n\n return () => {\n clearAutoAdvanceTimer();\n };\n }, [\n canGoNext,\n clearAutoAdvanceTimer,\n currentElementList,\n currentInteractionElement,\n goNext,\n resetAudioSequence,\n startCurrentAudioSequence,\n ]);\n\n const interactionDefaults = useMemo(() => {\n if (!activeInteractionElement) {\n return {};\n }\n\n return getInteractionDefaultValues(\n typeof activeInteractionElement.content === \"string\"\n ? activeInteractionElement.content\n : undefined,\n activeInteractionElement.user_input\n );\n }, [activeInteractionElement]);\n\n const interactionDefaultSelectedValues = useMemo(() => {\n if (!activeInteractionElement) {\n return undefined;\n }\n\n return getInteractionDefaultSelectedValues(\n typeof activeInteractionElement.content === \"string\"\n ? activeInteractionElement.content\n : undefined,\n activeInteractionElement.user_input\n );\n }, [activeInteractionElement]);\n\n const hasResolvedInteractionInput = Boolean(\n activeInteractionElement?.user_input?.trim()\n );\n\n const handleInteractionSend = useCallback(\n (content: OnSendContentParams) => {\n const submittedValues = [\n ...(content.selectedValues ?? []),\n content.inputText?.trim() ?? \"\",\n content.buttonText?.trim() ?? \"\",\n ].filter(Boolean);\n const resolvedUserInput = submittedValues.join(\", \");\n\n setActiveInteractionElement((prevElement) => {\n if (!prevElement || !resolvedUserInput) {\n return prevElement;\n }\n\n return {\n ...prevElement,\n user_input: resolvedUserInput,\n };\n });\n\n continueAfterInteraction();\n },\n [continueAfterInteraction]\n );\n\n useEffect(() => {\n clearInteractionAutoCloseTimer();\n\n if (!isInteractionOverlayOpen || !hasResolvedInteractionInput) {\n return;\n }\n\n interactionAutoCloseTimerRef.current = window.setTimeout(() => {\n interactionAutoCloseTimerRef.current = null;\n\n continueAfterInteraction();\n }, 2000);\n\n return () => {\n clearInteractionAutoCloseTimer();\n };\n }, [\n clearInteractionAutoCloseTimer,\n continueAfterInteraction,\n hasResolvedInteractionInput,\n isInteractionOverlayOpen,\n ]);\n\n const renderSlideElement = (element?: Element) => {\n if (!element) {\n return null;\n }\n\n if (element.type === \"slot\") {\n return <>{element.content}</>;\n }\n\n if (element.type === \"html\") {\n return (\n <IframeSandbox\n className=\"content-render-iframe\"\n hideFullScreen\n mode=\"blackboard\"\n type=\"sandbox\"\n content={element.content as string}\n />\n );\n }\n\n return (\n <IframeSandbox\n className=\"content-render-iframe\"\n hideFullScreen\n mode=\"blackboard\"\n type=\"markdown\"\n content={element.content as string}\n />\n );\n };\n\n const renderSlideElementList = (elementList: Element[] = []) => {\n if (elementList.length === 0) {\n return null;\n }\n\n const visibleElementCount = elementList.filter(\n (element) => element.is_show !== false\n ).length;\n const lastVisibleElementIndex = elementList.reduce(\n (lastVisibleIndex, element, index) =>\n element.is_show !== false ? index : lastVisibleIndex,\n -1\n );\n\n return (\n <div className=\"slide-stage__content flex w-full flex-col gap-4\">\n {elementList.map((element, index) => {\n const isPreRenderedHtml =\n element.type === \"html\" && element.is_show === false;\n\n return (\n <div\n key={element.serial_number ?? `${element.type}-${index}`}\n ref={index === lastVisibleElementIndex ? lastElementRef : null}\n aria-hidden={isPreRenderedHtml || undefined}\n className={cn(\n \"w-full shrink-0\",\n visibleElementCount === 1 &&\n element.is_show !== false &&\n \"slide-element--single\",\n isPreRenderedHtml\n ? \"pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0\"\n : element.is_show === false && \"hidden\"\n )}\n >\n {renderSlideElement(element)}\n </div>\n );\n })}\n </div>\n );\n };\n\n const handleFullscreen = () => {\n const target = sectionRef.current;\n if (!target) return;\n\n if (document.fullscreenElement) {\n document.exitFullscreen().catch(() => {});\n return;\n }\n\n target.requestFullscreen?.().catch(() => {});\n };\n\n const scrollStageToBottom = useCallback(() => {\n const stageLayerElement = stageLayerRef.current;\n\n if (!stageLayerElement) {\n return;\n }\n\n // Keep the latest content visible after manual player navigation.\n stageLayerElement.scrollTo({\n top: stageLayerElement.scrollHeight,\n behavior: \"smooth\",\n });\n }, []);\n\n const handlePrev = useCallback(() => {\n shouldScrollToBottomRef.current = true;\n resetAudioSequence();\n goPrev();\n }, [goPrev, resetAudioSequence]);\n\n const handleNext = useCallback(() => {\n shouldScrollToBottomRef.current = true;\n resetAudioSequence();\n goNext();\n }, [goNext, resetAudioSequence]);\n\n const handlePlayerEnded = useCallback(\n (audioIndex: number) => {\n if (currentAudioSequencePosition < 0) {\n return;\n }\n\n if (\n currentAudioSequenceIndexes[currentAudioSequencePosition] !== audioIndex\n ) {\n return;\n }\n\n const nextSequencePosition = currentAudioSequencePosition + 1;\n const nextAudioIndex = currentAudioSequenceIndexes[nextSequencePosition];\n\n if (typeof nextAudioIndex === \"number\") {\n setCurrentAudioSequencePosition(nextSequencePosition);\n setCurrentAudioIndex(nextAudioIndex);\n return;\n }\n\n setCurrentAudioIndex(-1);\n setCurrentAudioSequencePosition(-1);\n\n if (canGoNext) {\n goNext();\n }\n },\n [\n canGoNext,\n currentAudioSequenceIndexes,\n currentAudioSequencePosition,\n goNext,\n ]\n );\n\n const handleInteractionToggle = useCallback(() => {\n if (!activeInteractionElement) {\n return;\n }\n\n setIsInteractionOverlayOpen((prevOpen) => !prevOpen);\n }, [activeInteractionElement]);\n\n const stopOverlayPropagation = useCallback(\n (\n event:\n | React.PointerEvent<HTMLDivElement>\n | React.MouseEvent<HTMLDivElement>\n ) => {\n event.stopPropagation();\n\n // Keep the player visible a bit longer when users interact with the overlay.\n if (isPlayerVisible) {\n showPlayerControls(true);\n }\n },\n [isPlayerVisible, showPlayerControls]\n );\n\n const handleSurfacePointerDown = useCallback(\n (event: React.PointerEvent<HTMLElement>) => {\n onPointerDown?.(event);\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n },\n [onPointerDown, showPlayerControls]\n );\n\n const shouldShowInteractionOverlay =\n Boolean(activeInteractionElement) && isInteractionOverlayOpen;\n\n const currentRenderElementKeys = useMemo(\n () =>\n currentElementList.map(\n (element, index) =>\n `${element.serial_number ?? `${element.type}-${index}`}:${element.operation ?? \"\"}`\n ),\n [currentElementList]\n );\n\n const renderElementList = useMemo(() => {\n const nextHtmlElement = slideElementList\n .slice(currentIndex + 1)\n .find((element) => element.type === \"html\");\n\n if (!nextHtmlElement) {\n return currentElementList;\n }\n\n const hasMountedNextHtml = currentElementList.some(\n (element) => element.serial_number === nextHtmlElement.serial_number\n );\n\n if (hasMountedNextHtml) {\n return currentElementList;\n }\n\n // Keep the next html sandbox mounted offscreen so it is ready when revealed.\n return [...currentElementList, { ...nextHtmlElement, is_show: false }];\n }, [currentElementList, currentIndex, slideElementList]);\n\n useEffect(() => {\n const prevKeys = prevRenderElementKeysRef.current;\n const hasStablePrefix =\n prevKeys.length > 0 &&\n prevKeys.length < currentRenderElementKeys.length &&\n prevKeys.every((key, index) => key === currentRenderElementKeys[index]);\n const appendedElements = hasStablePrefix\n ? currentElementList.slice(prevKeys.length)\n : [];\n const shouldAutoScrollToAppend = appendedElements.some(\n (element) => element.operation === \"append\"\n );\n\n prevRenderElementKeysRef.current = currentRenderElementKeys;\n\n if (!shouldAutoScrollToAppend) {\n return;\n }\n\n const animationFrameId = window.requestAnimationFrame(() => {\n const stageLayerElement = stageLayerRef.current;\n const targetElement = lastElementRef.current;\n\n if (!stageLayerElement || !targetElement) {\n return;\n }\n\n const stageLayerRect = stageLayerElement.getBoundingClientRect();\n const targetRect = targetElement.getBoundingClientRect();\n const nextScrollTop =\n stageLayerElement.scrollTop + (targetRect.top - stageLayerRect.top);\n\n // Keep newly appended content visible when the current slide grows downward.\n stageLayerElement.scrollTo({\n top: Math.max(nextScrollTop, 0),\n behavior: \"smooth\",\n });\n });\n\n return () => {\n window.cancelAnimationFrame(animationFrameId);\n };\n }, [currentElementList, currentRenderElementKeys]);\n\n useEffect(() => {\n if (!shouldScrollToBottomRef.current) {\n return;\n }\n\n shouldScrollToBottomRef.current = false;\n\n if (currentElementList.length === 0) {\n return;\n }\n\n const animationFrameId = window.requestAnimationFrame(() => {\n scrollStageToBottom();\n });\n\n return () => {\n window.cancelAnimationFrame(animationFrameId);\n };\n }, [currentElementList, scrollStageToBottom]);\n\n console.log(\n \"currentElement\",\n currentElementList.at(-1),\n currentElementList,\n shouldRenderPlayer,\n isPlayerVisible,\n currentAudioSequenceIndexes,\n currentInteractionElement,\n activeInteractionElement,\n isInteractionOverlayOpen\n );\n\n return (\n <section\n ref={sectionRef}\n className={cn(\"relative h-full w-full\", className)}\n onPointerDown={handleSurfacePointerDown}\n {...props}\n >\n <div\n className={cn(\n \"h-full min-h-0 w-full\",\n isSingleSlide ? \"slide-content--single\" : \"grid gap-4\"\n )}\n >\n {shouldRenderPlayer && !isPlayerVisible ? (\n <button\n aria-label=\"Show player controls\"\n className=\"slide-player-hit-area\"\n onPointerDown={handleSurfacePointerDown}\n type=\"button\"\n />\n ) : null}\n {currentElementList.length > 0 ? (\n <div className=\"slide-stage\">\n <div ref={stageLayerRef} className=\"slide-stage__layer w-full\">\n {renderSlideElementList(renderElementList)}\n </div>\n </div>\n ) : null}\n </div>\n\n {shouldShowInteractionOverlay ? (\n <div\n className={cn(\n \"slide-interaction-overlay\",\n isPlayerVisible && shouldRenderPlayer\n ? \"slide-interaction-overlay--with-player\"\n : \"slide-interaction-overlay--standalone\"\n )}\n onClick={stopOverlayPropagation}\n onPointerDown={stopOverlayPropagation}\n >\n <InteractionOverlayCard\n content={String(activeInteractionElement?.content ?? \"\")}\n defaultButtonText={interactionDefaults.buttonText ?? \"\"}\n defaultInputText={interactionDefaults.inputText ?? \"\"}\n defaultSelectedValues={interactionDefaultSelectedValues}\n onSend={handleInteractionSend}\n readonly={hasResolvedInteractionInput}\n title={interactionTitle ?? \"Submit the content below to continue.\"}\n />\n </div>\n ) : null}\n\n {shouldRenderPlayer ? (\n <Player\n audioList={audioList}\n className={cn(\n \"absolute left-1/2 bottom-6 z-[2] -translate-x-1/2\",\n playerClassName,\n !isPlayerVisible && \"pointer-events-none opacity-0\"\n )}\n currentAudioIndex={currentAudioIndex}\n defaultPlaying={canAutoPlayAudio}\n hasInteraction={Boolean(activeInteractionElement)}\n isInteractionOpen={isInteractionOverlayOpen}\n nextDisabled={!canGoNext}\n onEnded={handlePlayerEnded}\n onFullscreen={handleFullscreen}\n onInteractionToggle={handleInteractionToggle}\n onNext={handleNext}\n onPrev={handlePrev}\n prevDisabled={!canGoPrev}\n showControls={isPlayerVisible}\n />\n ) : null}\n </section>\n );\n};\n\nexport default Slide;\n"],"names":["CHECKPOINT_AUTO_ADVANCE_DELAY_MS","InteractionOverlayCard","memo","content","title","defaultButtonText","defaultInputText","defaultSelectedValues","onSend","readonly","jsxs","jsx","ContentRender","Slide","elementList","showPlayer","playerClassName","interactionTitle","playerAutoHideDelay","className","onPointerDown","props","sectionRef","useRef","stageLayerRef","lastElementRef","playerHideTimerRef","autoAdvanceTimerRef","interactionAutoCloseTimerRef","prevRenderElementKeysRef","shouldScrollToBottomRef","currentElementList","slideElementList","currentIndex","audioList","currentAudioSequenceIndexes","currentInteractionElement","canGoPrev","canGoNext","goPrev","goNext","useSlide","isSingleSlide","element","shouldRenderPlayer","isPlayerVisible","setIsPlayerVisible","useState","hasPlayerInteracted","setHasPlayerInteracted","shouldAutoPlay","hasBrowserUserActivation","canAutoPlayAudio","currentAudioIndex","setCurrentAudioIndex","currentAudioSequencePosition","setCurrentAudioSequencePosition","activeInteractionElement","setActiveInteractionElement","isInteractionOverlayOpen","setIsInteractionOverlayOpen","clearPlayerHideTimer","useCallback","clearInteractionAutoCloseTimer","clearAutoAdvanceTimer","resetAudioSequence","startCurrentAudioSequence","nextAudioIndex","continueAfterInteraction","showPlayerControls","enableAutoHide","useEffect","interactionDefaults","useMemo","getInteractionDefaultValues","interactionDefaultSelectedValues","getInteractionDefaultSelectedValues","hasResolvedInteractionInput","handleInteractionSend","resolvedUserInput","prevElement","renderSlideElement","Fragment","IframeSandbox","renderSlideElementList","visibleElementCount","lastVisibleElementIndex","lastVisibleIndex","index","isPreRenderedHtml","cn","handleFullscreen","target","scrollStageToBottom","stageLayerElement","handlePrev","handleNext","handlePlayerEnded","audioIndex","nextSequencePosition","handleInteractionToggle","prevOpen","stopOverlayPropagation","event","handleSurfacePointerDown","shouldShowInteractionOverlay","currentRenderElementKeys","renderElementList","nextHtmlElement","prevKeys","shouldAutoScrollToAppend","key","animationFrameId","targetElement","stageLayerRect","targetRect","nextScrollTop","Player"],"mappings":";;;;;;;;;;;AAwBA,MAAMA,KAAmC,KAYnCC,KAAyBC;AA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GAAoB,aAAa;AAAA,gBACnD,uBAAuBG;AAAA,gBACvB,QAAQG;AAAA,gBACR,UAAUD;AAAA,gBACV,OAAO5D,KAAoB;AAAA,cAAA;AAAA,YAAA;AAAA,UAC7B;AAAA,QAAA,IAEA;AAAA,QAEH2B,IACCjC,gBAAAA,EAAAA;AAAAA,UAAC0G;AAAA,UAAA;AAAA,YACC,WAAAnF;AAAA,YACA,WAAWwD;AAAA,cACT;AAAA,cACA1E;AAAA,cACA,CAAC6B,KAAmB;AAAA,YAAA;AAAA,YAEtB,mBAAAQ;AAAA,YACA,gBAAgBD;AAAA,YAChB,gBAAgB,EAAQK;AAAA,YACxB,mBAAmBE;AAAA,YACnB,cAAc,CAACrB;AAAA,YACf,SAAS2D;AAAA,YACT,cAAcN;AAAA,YACd,qBAAqBS;AAAA,YACrB,QAAQJ;AAAA,YACR,QAAQD;AAAA,YACR,cAAc,CAAC1D;AAAA,YACf,cAAcQ;AAAA,UAAA;AAAA,QAAA,IAEd;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV;"}
@@ -0,0 +1,47 @@
1
+ import { StoryObj } from '@storybook/nextjs-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: import('react').FC<import('./Slide').SlideProps>;
5
+ parameters: {
6
+ layout: string;
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ tags: string[];
14
+ argTypes: {
15
+ elementList: {
16
+ description: string;
17
+ table: {
18
+ type: {
19
+ summary: string;
20
+ };
21
+ };
22
+ };
23
+ interactionTitle: {
24
+ control: "text";
25
+ description: string;
26
+ };
27
+ playerAutoHideDelay: {
28
+ control: {
29
+ type: "number";
30
+ min: number;
31
+ step: number;
32
+ };
33
+ description: string;
34
+ };
35
+ };
36
+ args: {
37
+ elementList: never[];
38
+ interactionTitle: string;
39
+ playerAutoHideDelay: number;
40
+ };
41
+ };
42
+ export default meta;
43
+ type Story = StoryObj<typeof meta>;
44
+ export declare const Default: Story;
45
+ export declare const FullViewportSlides: Story;
46
+ export declare const FullViewportSingleSlide: Story;
47
+ export declare const FullViewportSingleSlideWithSSE: Story;
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=/!\+\+\+\s*([\s\S]*?)\s*!\+\+\+/,x=/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/,h=(e,n)=>e===n||e.trim()===n.trim(),d=e=>{if(!e)return{};const n=e.match(m);if(!n)return{trailingContent:e.trim()||void 0};const s=n[1]?.trim(),i=e.slice(n.index+n[0].length).trim();return{patchText:s||void 0,trailingContent:i||void 0}},p=e=>{const n=e.split(`
2
+ `),s=n[0]?.match(/^---\s+a\/(\d+)/),i=n[1]?.match(/^\+\+\+\s+b\/(\d+)/);if(!s||!i||s[1]!==i[1])return null;const r=[];let t=null;return n.slice(2).forEach(o=>{const l=o.match(x);if(l){t&&r.push(t),t={oldStart:Number.parseInt(l[1],10),lines:[]};return}t&&t.lines.push(o)}),t&&r.push(t),r.length===0?null:{targetIndex:Number.parseInt(s[1],10),hunks:r}},g=(e,n)=>{const s=p(n);if(!s)return null;const i=e.split(`
3
+ `),r=[];let t=0;for(const o of s.hunks){const l=Math.max(o.oldStart-1,0);for(;t<l&&t<i.length;)r.push(i[t]),t+=1;for(const f of o.lines){const u=f[0],a=f.slice(1);if(u===" "){const c=i[t];if(c==null||!h(c,a))return null;r.push(c),t+=1;continue}if(u==="-"){const c=i[t];if(c==null||!h(c,a))return null;t+=1;continue}if(u==="+"){r.push(a);continue}}}for(;t<i.length;)r.push(i[t]),t+=1;return r.join(`
4
+ `)},C=(e,n)=>{const s=typeof n.content=="string"?n.content:void 0,{patchText:i,trailingContent:r}=d(s);if(!i)return r?[...e,{...n,type:"text",content:r}]:null;const t=p(i);if(!t)return null;const o=e[t.targetIndex],l=typeof o?.content=="string"?o.content:void 0;if(!o||!l)return null;const f=g(l,i);if(!f)return null;const u=e.map((a,c)=>c===t.targetIndex?{...a,content:f}:a);return r?[...u,{...n,type:"text",content:r}]:u};exports.applyDiffElement=C;exports.applyUnifiedDiff=g;exports.parseUnifiedDiff=p;exports.splitDiffContent=d;
5
+ //# sourceMappingURL=diff-utils.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-utils.cjs.js","sources":["../../../src/components/Slide/diff-utils.ts"],"sourcesContent":["import type { Element } from \"./types\";\n\ntype DiffHunk = {\n oldStart: number;\n lines: string[];\n};\n\ntype ParsedUnifiedDiff = {\n targetIndex: number;\n hunks: DiffHunk[];\n};\n\ntype DiffContentParts = {\n patchText?: string;\n trailingContent?: string;\n};\n\nconst DIFF_BLOCK_PATTERN = /!\\+\\+\\+\\s*([\\s\\S]*?)\\s*!\\+\\+\\+/;\nconst HUNK_HEADER_PATTERN = /^@@\\s+-(\\d+)(?:,(\\d+))?\\s+\\+(\\d+)(?:,(\\d+))?\\s+@@/;\n\nconst isComparableLineMatch = (sourceLine: string, expectedLine: string) =>\n sourceLine === expectedLine || sourceLine.trim() === expectedLine.trim();\n\nexport const splitDiffContent = (content?: string): DiffContentParts => {\n if (!content) {\n return {};\n }\n\n const matched = content.match(DIFF_BLOCK_PATTERN);\n\n if (!matched) {\n return {\n trailingContent: content.trim() || undefined,\n };\n }\n\n const patchText = matched[1]?.trim();\n const trailingContent = content\n .slice(matched.index + matched[0].length)\n .trim();\n\n return {\n patchText: patchText || undefined,\n trailingContent: trailingContent || undefined,\n };\n};\n\nexport const parseUnifiedDiff = (\n patchText: string\n): ParsedUnifiedDiff | null => {\n const lines = patchText.split(\"\\n\");\n const targetMatch = lines[0]?.match(/^---\\s+a\\/(\\d+)/);\n const nextMatch = lines[1]?.match(/^\\+\\+\\+\\s+b\\/(\\d+)/);\n\n if (!targetMatch || !nextMatch || targetMatch[1] !== nextMatch[1]) {\n return null;\n }\n\n const hunks: DiffHunk[] = [];\n let currentHunk: DiffHunk | null = null;\n\n lines.slice(2).forEach((line) => {\n const headerMatch = line.match(HUNK_HEADER_PATTERN);\n\n if (headerMatch) {\n if (currentHunk) {\n hunks.push(currentHunk);\n }\n\n currentHunk = {\n oldStart: Number.parseInt(headerMatch[1], 10),\n lines: [],\n };\n return;\n }\n\n if (currentHunk) {\n currentHunk.lines.push(line);\n }\n });\n\n if (currentHunk) {\n hunks.push(currentHunk);\n }\n\n if (hunks.length === 0) {\n return null;\n }\n\n return {\n targetIndex: Number.parseInt(targetMatch[1], 10),\n hunks,\n };\n};\n\nexport const applyUnifiedDiff = (\n source: string,\n patchText: string\n): string | null => {\n const parsed = parseUnifiedDiff(patchText);\n\n if (!parsed) {\n return null;\n }\n\n const sourceLines = source.split(\"\\n\");\n const resultLines: string[] = [];\n let sourceCursor = 0;\n\n for (const hunk of parsed.hunks) {\n const hunkStartIndex = Math.max(hunk.oldStart - 1, 0);\n\n while (sourceCursor < hunkStartIndex && sourceCursor < sourceLines.length) {\n resultLines.push(sourceLines[sourceCursor]);\n sourceCursor += 1;\n }\n\n for (const line of hunk.lines) {\n const marker = line[0];\n const expectedLine = line.slice(1);\n\n if (marker === \" \") {\n const currentLine = sourceLines[sourceCursor];\n\n if (\n currentLine == null ||\n !isComparableLineMatch(currentLine, expectedLine)\n ) {\n return null;\n }\n\n resultLines.push(currentLine);\n sourceCursor += 1;\n continue;\n }\n\n if (marker === \"-\") {\n const currentLine = sourceLines[sourceCursor];\n\n if (\n currentLine == null ||\n !isComparableLineMatch(currentLine, expectedLine)\n ) {\n return null;\n }\n\n sourceCursor += 1;\n continue;\n }\n\n if (marker === \"+\") {\n resultLines.push(expectedLine);\n continue;\n }\n\n if (marker === \"\\\\\") {\n continue;\n }\n }\n }\n\n while (sourceCursor < sourceLines.length) {\n resultLines.push(sourceLines[sourceCursor]);\n sourceCursor += 1;\n }\n\n return resultLines.join(\"\\n\");\n};\n\nexport const applyDiffElement = (\n currentList: Element[],\n diffElement: Element\n): Element[] | null => {\n const content =\n typeof diffElement.content === \"string\" ? diffElement.content : undefined;\n const { patchText, trailingContent } = splitDiffContent(content);\n\n if (!patchText) {\n return trailingContent\n ? [\n ...currentList,\n {\n ...diffElement,\n type: \"text\",\n content: trailingContent,\n },\n ]\n : null;\n }\n\n const parsed = parseUnifiedDiff(patchText);\n\n if (!parsed) {\n return null;\n }\n\n const targetElement = currentList[parsed.targetIndex];\n const targetContent =\n typeof targetElement?.content === \"string\"\n ? targetElement.content\n : undefined;\n\n if (!targetElement || !targetContent) {\n return null;\n }\n\n const patchedContent = applyUnifiedDiff(targetContent, patchText);\n\n if (!patchedContent) {\n return null;\n }\n\n const nextList = currentList.map((element, index) =>\n index === parsed.targetIndex\n ? {\n ...element,\n content: patchedContent,\n }\n : element\n );\n\n if (!trailingContent) {\n return nextList;\n }\n\n return [\n ...nextList,\n {\n ...diffElement,\n type: \"text\",\n content: trailingContent,\n },\n ];\n};\n"],"names":["DIFF_BLOCK_PATTERN","HUNK_HEADER_PATTERN","isComparableLineMatch","sourceLine","expectedLine","splitDiffContent","content","matched","patchText","trailingContent","parseUnifiedDiff","lines","targetMatch","nextMatch","hunks","currentHunk","line","headerMatch","applyUnifiedDiff","source","parsed","sourceLines","resultLines","sourceCursor","hunk","hunkStartIndex","marker","currentLine","applyDiffElement","currentList","diffElement","targetElement","targetContent","patchedContent","nextList","element","index"],"mappings":"gFAiBA,MAAMA,EAAqB,iCACrBC,EAAsB,oDAEtBC,EAAwB,CAACC,EAAoBC,IACjDD,IAAeC,GAAgBD,EAAW,KAAA,IAAWC,EAAa,KAAA,EAEvDC,EAAoBC,GAAuC,CACtE,GAAI,CAACA,EACH,MAAO,CAAA,EAGT,MAAMC,EAAUD,EAAQ,MAAMN,CAAkB,EAEhD,GAAI,CAACO,EACH,MAAO,CACL,gBAAiBD,EAAQ,QAAU,MAAA,EAIvC,MAAME,EAAYD,EAAQ,CAAC,GAAG,KAAA,EACxBE,EAAkBH,EACrB,MAAMC,EAAQ,MAAQA,EAAQ,CAAC,EAAE,MAAM,EACvC,KAAA,EAEH,MAAO,CACL,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CACL,GAAGyB,EACH,CACE,GAAGJ,EACH,KAAM,OACN,QAASrB,CAAA,CACX,EATOyB,CAWX"}
@@ -0,0 +1,18 @@
1
+ import { Element } from './types';
2
+ type DiffHunk = {
3
+ oldStart: number;
4
+ lines: string[];
5
+ };
6
+ type ParsedUnifiedDiff = {
7
+ targetIndex: number;
8
+ hunks: DiffHunk[];
9
+ };
10
+ type DiffContentParts = {
11
+ patchText?: string;
12
+ trailingContent?: string;
13
+ };
14
+ export declare const splitDiffContent: (content?: string) => DiffContentParts;
15
+ export declare const parseUnifiedDiff: (patchText: string) => ParsedUnifiedDiff | null;
16
+ export declare const applyUnifiedDiff: (source: string, patchText: string) => string | null;
17
+ export declare const applyDiffElement: (currentList: Element[], diffElement: Element) => Element[] | null;
18
+ export {};
@@ -0,0 +1,113 @@
1
+ const d = /!\+\+\+\s*([\s\S]*?)\s*!\+\+\+/, g = /^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/, f = (e, n) => e === n || e.trim() === n.trim(), m = (e) => {
2
+ if (!e)
3
+ return {};
4
+ const n = e.match(d);
5
+ if (!n)
6
+ return {
7
+ trailingContent: e.trim() || void 0
8
+ };
9
+ const i = n[1]?.trim(), r = e.slice(n.index + n[0].length).trim();
10
+ return {
11
+ patchText: i || void 0,
12
+ trailingContent: r || void 0
13
+ };
14
+ }, p = (e) => {
15
+ const n = e.split(`
16
+ `), i = n[0]?.match(/^---\s+a\/(\d+)/), r = n[1]?.match(/^\+\+\+\s+b\/(\d+)/);
17
+ if (!i || !r || i[1] !== r[1])
18
+ return null;
19
+ const s = [];
20
+ let t = null;
21
+ return n.slice(2).forEach((o) => {
22
+ const u = o.match(g);
23
+ if (u) {
24
+ t && s.push(t), t = {
25
+ oldStart: Number.parseInt(u[1], 10),
26
+ lines: []
27
+ };
28
+ return;
29
+ }
30
+ t && t.lines.push(o);
31
+ }), t && s.push(t), s.length === 0 ? null : {
32
+ targetIndex: Number.parseInt(i[1], 10),
33
+ hunks: s
34
+ };
35
+ }, x = (e, n) => {
36
+ const i = p(n);
37
+ if (!i)
38
+ return null;
39
+ const r = e.split(`
40
+ `), s = [];
41
+ let t = 0;
42
+ for (const o of i.hunks) {
43
+ const u = Math.max(o.oldStart - 1, 0);
44
+ for (; t < u && t < r.length; )
45
+ s.push(r[t]), t += 1;
46
+ for (const h of o.lines) {
47
+ const l = h[0], a = h.slice(1);
48
+ if (l === " ") {
49
+ const c = r[t];
50
+ if (c == null || !f(c, a))
51
+ return null;
52
+ s.push(c), t += 1;
53
+ continue;
54
+ }
55
+ if (l === "-") {
56
+ const c = r[t];
57
+ if (c == null || !f(c, a))
58
+ return null;
59
+ t += 1;
60
+ continue;
61
+ }
62
+ if (l === "+") {
63
+ s.push(a);
64
+ continue;
65
+ }
66
+ }
67
+ }
68
+ for (; t < r.length; )
69
+ s.push(r[t]), t += 1;
70
+ return s.join(`
71
+ `);
72
+ }, C = (e, n) => {
73
+ const i = typeof n.content == "string" ? n.content : void 0, { patchText: r, trailingContent: s } = m(i);
74
+ if (!r)
75
+ return s ? [
76
+ ...e,
77
+ {
78
+ ...n,
79
+ type: "text",
80
+ content: s
81
+ }
82
+ ] : null;
83
+ const t = p(r);
84
+ if (!t)
85
+ return null;
86
+ const o = e[t.targetIndex], u = typeof o?.content == "string" ? o.content : void 0;
87
+ if (!o || !u)
88
+ return null;
89
+ const h = x(u, r);
90
+ if (!h)
91
+ return null;
92
+ const l = e.map(
93
+ (a, c) => c === t.targetIndex ? {
94
+ ...a,
95
+ content: h
96
+ } : a
97
+ );
98
+ return s ? [
99
+ ...l,
100
+ {
101
+ ...n,
102
+ type: "text",
103
+ content: s
104
+ }
105
+ ] : l;
106
+ };
107
+ export {
108
+ C as applyDiffElement,
109
+ x as applyUnifiedDiff,
110
+ p as parseUnifiedDiff,
111
+ m as splitDiffContent
112
+ };
113
+ //# sourceMappingURL=diff-utils.es.js.map