@bendyline/squisq-react 2.11.18 → 2.11.20
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/THIRD_PARTY_LICENSES.txt +3 -3
- package/dist/{chunk-2VSD55NT.js → chunk-4HJBKCSY.js} +17 -10
- package/dist/{chunk-SVVPYDV3.js → chunk-7J4YN7EK.js} +1 -1
- package/dist/{chunk-PZCWGBRQ.js → chunk-DI7CKFRY.js} +4 -2
- package/dist/{chunk-63G5OJWY.js → chunk-HCKL2AFN.js} +11 -7
- package/dist/{chunk-PSAO2CTF.js → chunk-JEEBHC5W.js} +1 -1
- package/dist/{chunk-5FJZDX7H.js → chunk-LCBV2SE4.js} +169 -18
- package/dist/{chunk-2FZUFQO3.js → chunk-T7NVETOH.js} +176 -85
- package/dist/{chunk-L4LIIOU2.js → chunk-XQSZ55EQ.js} +1 -1
- package/dist/{chunk-CB2MCXJ6.js → chunk-Y4YCIMES.js} +14 -10
- package/dist/{chunk-QXZXQPL3.js → chunk-Z7OW6RGR.js} +1 -1
- package/dist/diagram-pictures/index.js +4 -4
- package/dist/hooks/index.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -10
- package/dist/json-view/index.js +4 -4
- package/dist/layers/index.js +3 -3
- package/dist/markdown/index.d.ts +22 -2
- package/dist/markdown/index.js +5 -3
- package/dist/page/index.js +7 -7
- package/dist/player/index.d.ts +1 -1
- package/dist/player/index.js +8 -8
- package/dist/{player-BCPc3Tv3.d.ts → player-xxe4LWQI.d.ts} +15 -3
- package/dist/squisq-player.full.global.js +457 -441
- package/dist/squisq-player.global.js +86 -71
- package/dist/standalone-player-full.js +1 -1
- package/dist/standalone-source.js +1 -1
- package/dist/styles/index.css +22 -0
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MermaidDiagram
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Z7OW6RGR.js";
|
|
4
4
|
import {
|
|
5
5
|
useMediaProvider,
|
|
6
6
|
useMediaUrl
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HCKL2AFN.js";
|
|
8
8
|
|
|
9
9
|
// src/hooks/FenceRendererContext.tsx
|
|
10
10
|
import { createContext, useContext } from "react";
|
|
@@ -23,7 +23,8 @@ function InlineVideoPlayer({
|
|
|
23
23
|
poster,
|
|
24
24
|
controls = true,
|
|
25
25
|
preload = "metadata",
|
|
26
|
-
className
|
|
26
|
+
className,
|
|
27
|
+
label
|
|
27
28
|
}) {
|
|
28
29
|
const resolvedSrc = useMediaUrl(src, basePath);
|
|
29
30
|
const resolvedPoster = useMediaUrl(poster ?? "", basePath);
|
|
@@ -38,7 +39,9 @@ function InlineVideoPlayer({
|
|
|
38
39
|
preload,
|
|
39
40
|
width,
|
|
40
41
|
height,
|
|
41
|
-
playsInline: true
|
|
42
|
+
playsInline: true,
|
|
43
|
+
"aria-label": label,
|
|
44
|
+
title: label
|
|
42
45
|
}
|
|
43
46
|
) });
|
|
44
47
|
}
|
|
@@ -50,16 +53,79 @@ function InlineAudioPlayer({
|
|
|
50
53
|
basePath = "",
|
|
51
54
|
controls = true,
|
|
52
55
|
preload = "metadata",
|
|
53
|
-
className
|
|
56
|
+
className,
|
|
57
|
+
label
|
|
54
58
|
}) {
|
|
55
59
|
const resolvedSrc = useMediaUrl(src, basePath);
|
|
56
60
|
if (!resolvedSrc) return null;
|
|
57
|
-
return /* @__PURE__ */ jsx2("span", { className: `squisq-inline-audio-player ${className ?? ""}`.trim(), children: /* @__PURE__ */ jsx2(
|
|
61
|
+
return /* @__PURE__ */ jsx2("span", { className: `squisq-inline-audio-player ${className ?? ""}`.trim(), children: /* @__PURE__ */ jsx2(
|
|
62
|
+
"audio",
|
|
63
|
+
{
|
|
64
|
+
src: resolvedSrc,
|
|
65
|
+
controls,
|
|
66
|
+
preload,
|
|
67
|
+
"aria-label": label,
|
|
68
|
+
title: label
|
|
69
|
+
}
|
|
70
|
+
) });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/VideoEmbedFrame.tsx
|
|
74
|
+
import { videoEmbedIframeAttributes } from "@bendyline/squisq/markdown";
|
|
75
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
76
|
+
var IFRAME_STYLE = {
|
|
77
|
+
position: "absolute",
|
|
78
|
+
inset: 0,
|
|
79
|
+
width: "100%",
|
|
80
|
+
height: "100%",
|
|
81
|
+
border: 0
|
|
82
|
+
};
|
|
83
|
+
function VideoEmbedFrame({
|
|
84
|
+
embed,
|
|
85
|
+
title,
|
|
86
|
+
showCaption = true,
|
|
87
|
+
inline = false,
|
|
88
|
+
className
|
|
89
|
+
}) {
|
|
90
|
+
const attrs = videoEmbedIframeAttributes(embed, title);
|
|
91
|
+
const portrait = embed.aspectRatio < 1;
|
|
92
|
+
const caption = showCaption && !inline ? title?.trim() : "";
|
|
93
|
+
const Root = inline ? "span" : "figure";
|
|
94
|
+
return /* @__PURE__ */ jsxs(
|
|
95
|
+
Root,
|
|
96
|
+
{
|
|
97
|
+
className: `squisq-video-embed ${className ?? ""}`.trim(),
|
|
98
|
+
"data-provider": embed.provider,
|
|
99
|
+
"data-orientation": portrait ? "portrait" : "landscape",
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx3(
|
|
102
|
+
"span",
|
|
103
|
+
{
|
|
104
|
+
className: "squisq-video-embed-frame",
|
|
105
|
+
style: { position: "relative", display: "block", aspectRatio: String(embed.aspectRatio) },
|
|
106
|
+
children: /* @__PURE__ */ jsx3(
|
|
107
|
+
"iframe",
|
|
108
|
+
{
|
|
109
|
+
src: attrs.src,
|
|
110
|
+
title: attrs.title,
|
|
111
|
+
allow: attrs.allow,
|
|
112
|
+
allowFullScreen: true,
|
|
113
|
+
referrerPolicy: "strict-origin-when-cross-origin",
|
|
114
|
+
loading: "lazy",
|
|
115
|
+
style: IFRAME_STYLE
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
caption ? /* @__PURE__ */ jsx3("figcaption", { className: "squisq-video-embed-caption", children: /* @__PURE__ */ jsx3("a", { href: embed.watchUrl, target: "_blank", rel: "noopener noreferrer", children: caption }) }) : null
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
58
124
|
}
|
|
59
125
|
|
|
60
126
|
// src/animatedImage/AnimatedImageControls.tsx
|
|
61
127
|
import { useLayoutEffect, useRef } from "react";
|
|
62
|
-
import { Fragment, jsx as
|
|
128
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
63
129
|
var FORMAT_LABELS = { gif: "GIF", webp: "WEBP", png: "APNG" };
|
|
64
130
|
function AnimatedImageControls({ playback, imageRef }) {
|
|
65
131
|
const canvasRef = useRef(null);
|
|
@@ -86,8 +152,8 @@ function AnimatedImageControls({ playback, imageRef }) {
|
|
|
86
152
|
}, [paused, animated, displaySrc, imageRef]);
|
|
87
153
|
if (!info || !animated) return null;
|
|
88
154
|
const label = status === "playing" ? "Pause animation" : status === "ended" ? "Replay animation" : "Play animation";
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
paused && /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
156
|
+
paused && /* @__PURE__ */ jsx4(
|
|
91
157
|
"canvas",
|
|
92
158
|
{
|
|
93
159
|
ref: canvasRef,
|
|
@@ -102,7 +168,7 @@ function AnimatedImageControls({ playback, imageRef }) {
|
|
|
102
168
|
}
|
|
103
169
|
}
|
|
104
170
|
),
|
|
105
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ jsxs2(
|
|
106
172
|
"button",
|
|
107
173
|
{
|
|
108
174
|
type: "button",
|
|
@@ -119,8 +185,8 @@ function AnimatedImageControls({ playback, imageRef }) {
|
|
|
119
185
|
else playback.play();
|
|
120
186
|
},
|
|
121
187
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ jsx4(StatusGlyph, { status }),
|
|
189
|
+
/* @__PURE__ */ jsx4("span", { className: "squisq-animated-image-format", children: FORMAT_LABELS[info.format] })
|
|
124
190
|
]
|
|
125
191
|
}
|
|
126
192
|
)
|
|
@@ -128,7 +194,7 @@ function AnimatedImageControls({ playback, imageRef }) {
|
|
|
128
194
|
}
|
|
129
195
|
function StatusGlyph({ status }) {
|
|
130
196
|
const path = status === "playing" ? "M2.5 1.5h2.75v9H2.5zM6.75 1.5H9.5v9H6.75z" : status === "ended" ? "M6 1.5V0L3.5 2.25 6 4.5V3a3 3 0 1 1-3 3H1.5A4.5 4.5 0 1 0 6 1.5z" : "M3 1.5v9l7.5-4.5z";
|
|
131
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx4("path", { d: path }) });
|
|
132
198
|
}
|
|
133
199
|
|
|
134
200
|
// src/animatedImage/useAnimatedImage.ts
|
|
@@ -245,11 +311,17 @@ function useAnimatedImage(src, resolvedUrl) {
|
|
|
245
311
|
import { Component, Fragment as Fragment2, useEffect as useEffect2, useRef as useRef3, useState as useState2 } from "react";
|
|
246
312
|
import { mayBeAnimatedImage as mayBeAnimatedImage2 } from "@bendyline/squisq/imageEdit";
|
|
247
313
|
import {
|
|
314
|
+
findBlockVideoEmbed,
|
|
248
315
|
sanitizeHtmlNodes,
|
|
249
|
-
|
|
316
|
+
mediaKindForUrl,
|
|
317
|
+
sanitizeUrl,
|
|
318
|
+
videoEmbedFromIframe
|
|
250
319
|
} from "@bendyline/squisq/markdown";
|
|
251
|
-
import { jsx as
|
|
320
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
252
321
|
var DEFAULT_CTX = { htmlPolicy: "sanitize" };
|
|
322
|
+
function nestedCtx(ctx) {
|
|
323
|
+
return ctx.nested ? ctx : { ...ctx, nested: true };
|
|
324
|
+
}
|
|
253
325
|
var CODE_COPY_LABELS = {
|
|
254
326
|
idle: "Copy",
|
|
255
327
|
copying: "Copying\u2026",
|
|
@@ -279,7 +351,7 @@ function CodeBlock({
|
|
|
279
351
|
},
|
|
280
352
|
[]
|
|
281
353
|
);
|
|
282
|
-
const pre = /* @__PURE__ */
|
|
354
|
+
const pre = /* @__PURE__ */ jsx5("pre", { className: "squisq-md-code-block", children: /* @__PURE__ */ jsx5("code", { className: language ? `language-${language}` : void 0, children: value }) });
|
|
283
355
|
if (!ctx.showCodeCopyButton) return pre;
|
|
284
356
|
const handleCopy = async () => {
|
|
285
357
|
if (status === "copying") return;
|
|
@@ -293,9 +365,9 @@ function CodeBlock({
|
|
|
293
365
|
if (resetTimer.current !== void 0) clearTimeout(resetTimer.current);
|
|
294
366
|
resetTimer.current = setTimeout(() => setStatus("idle"), 1600);
|
|
295
367
|
};
|
|
296
|
-
return /* @__PURE__ */
|
|
368
|
+
return /* @__PURE__ */ jsxs3("div", { className: "squisq-md-code-frame", children: [
|
|
297
369
|
pre,
|
|
298
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ jsx5(
|
|
299
371
|
"button",
|
|
300
372
|
{
|
|
301
373
|
type: "button",
|
|
@@ -328,7 +400,7 @@ function HostFence({
|
|
|
328
400
|
}) {
|
|
329
401
|
const renderer = ctx.fenceRenderers?.[lang];
|
|
330
402
|
if (!renderer) return null;
|
|
331
|
-
return /* @__PURE__ */
|
|
403
|
+
return /* @__PURE__ */ jsx5("div", { className: `squisq-md-fence-widget squisq-md-fence-widget-${lang}`, "data-fence-lang": lang, children: renderer({
|
|
332
404
|
lang,
|
|
333
405
|
...node.meta != null ? { meta: node.meta } : {},
|
|
334
406
|
value: node.value,
|
|
@@ -342,37 +414,37 @@ function renderInline(nodes, keyPrefix = "", ctx = DEFAULT_CTX) {
|
|
|
342
414
|
switch (node.type) {
|
|
343
415
|
case "text": {
|
|
344
416
|
if (!node.value.includes("\n")) {
|
|
345
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: node.value }, key);
|
|
346
418
|
}
|
|
347
419
|
const parts = node.value.split("\n");
|
|
348
|
-
return /* @__PURE__ */
|
|
349
|
-
j > 0 && /* @__PURE__ */
|
|
420
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: parts.map((part, j) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
421
|
+
j > 0 && /* @__PURE__ */ jsx5("br", {}),
|
|
350
422
|
part
|
|
351
423
|
] }, j)) }, key);
|
|
352
424
|
}
|
|
353
425
|
case "emphasis":
|
|
354
|
-
return /* @__PURE__ */
|
|
426
|
+
return /* @__PURE__ */ jsx5("em", { className: "squisq-md-em", children: renderInline(node.children, key, ctx) }, key);
|
|
355
427
|
case "strong":
|
|
356
|
-
return /* @__PURE__ */
|
|
428
|
+
return /* @__PURE__ */ jsx5("strong", { className: "squisq-md-strong", children: renderInline(node.children, key, ctx) }, key);
|
|
357
429
|
case "delete":
|
|
358
|
-
return /* @__PURE__ */
|
|
430
|
+
return /* @__PURE__ */ jsx5("del", { className: "squisq-md-del", children: renderInline(node.children, key, ctx) }, key);
|
|
359
431
|
case "superscript":
|
|
360
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ jsx5("sup", { className: "squisq-md-sup", children: renderInline(node.children, key, ctx) }, key);
|
|
361
433
|
case "subscript":
|
|
362
|
-
return /* @__PURE__ */
|
|
434
|
+
return /* @__PURE__ */ jsx5("sub", { className: "squisq-md-sub", children: renderInline(node.children, key, ctx) }, key);
|
|
363
435
|
case "inlineCode":
|
|
364
|
-
return /* @__PURE__ */
|
|
436
|
+
return /* @__PURE__ */ jsx5("code", { className: "squisq-md-inline-code", children: node.value }, key);
|
|
365
437
|
case "link": {
|
|
366
438
|
if (ctx.accessoryPaths?.has(node.url)) {
|
|
367
|
-
return /* @__PURE__ */
|
|
439
|
+
return /* @__PURE__ */ jsxs3(
|
|
368
440
|
"span",
|
|
369
441
|
{
|
|
370
442
|
className: "squisq-md-attachment",
|
|
371
443
|
"data-attachment-path": node.url,
|
|
372
444
|
title: node.title ?? `Attachment: ${node.url}`,
|
|
373
445
|
children: [
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ jsx5("i", { className: "fa-solid fa-paperclip", "aria-hidden": "true" }),
|
|
447
|
+
/* @__PURE__ */ jsx5("span", { className: "squisq-md-attachment-label", children: renderInline(node.children, key, ctx) })
|
|
376
448
|
]
|
|
377
449
|
},
|
|
378
450
|
key
|
|
@@ -380,9 +452,9 @@ function renderInline(nodes, keyPrefix = "", ctx = DEFAULT_CTX) {
|
|
|
380
452
|
}
|
|
381
453
|
const href = sanitizeUrl(node.url, "link", { extraLinkSchemes: ctx.linkSchemes });
|
|
382
454
|
if (!href) {
|
|
383
|
-
return /* @__PURE__ */
|
|
455
|
+
return /* @__PURE__ */ jsx5("span", { className: "squisq-md-link squisq-md-link--blocked", children: renderInline(node.children, key, ctx) }, key);
|
|
384
456
|
}
|
|
385
|
-
return /* @__PURE__ */
|
|
457
|
+
return /* @__PURE__ */ jsx5(
|
|
386
458
|
"a",
|
|
387
459
|
{
|
|
388
460
|
className: "squisq-md-link",
|
|
@@ -395,14 +467,22 @@ function renderInline(nodes, keyPrefix = "", ctx = DEFAULT_CTX) {
|
|
|
395
467
|
key
|
|
396
468
|
);
|
|
397
469
|
}
|
|
398
|
-
case "image":
|
|
399
|
-
|
|
470
|
+
case "image": {
|
|
471
|
+
const kind = mediaKindForUrl(node.url);
|
|
472
|
+
if (kind) {
|
|
473
|
+
const src = sanitizeUrl(node.url, "media");
|
|
474
|
+
if (!src) return null;
|
|
475
|
+
const label = node.alt || node.title || void 0;
|
|
476
|
+
return kind === "video" ? /* @__PURE__ */ jsx5(InlineVideoPlayer, { src, basePath: ".", label }, key) : /* @__PURE__ */ jsx5(InlineAudioPlayer, { src, basePath: ".", label }, key);
|
|
477
|
+
}
|
|
478
|
+
return /* @__PURE__ */ jsx5(MdImage, { src: node.url, alt: node.alt ?? "", title: node.title ?? void 0 }, key);
|
|
479
|
+
}
|
|
400
480
|
case "break":
|
|
401
|
-
return /* @__PURE__ */
|
|
481
|
+
return /* @__PURE__ */ jsx5("br", {}, key);
|
|
402
482
|
case "inlineMath":
|
|
403
|
-
return /* @__PURE__ */
|
|
483
|
+
return /* @__PURE__ */ jsx5("code", { className: "squisq-md-inline-math", children: node.value }, key);
|
|
404
484
|
case "inlineIcon":
|
|
405
|
-
return /* @__PURE__ */
|
|
485
|
+
return /* @__PURE__ */ jsx5(
|
|
406
486
|
"i",
|
|
407
487
|
{
|
|
408
488
|
className: `fa-${node.family} fa-${node.name}`,
|
|
@@ -413,25 +493,25 @@ function renderInline(nodes, keyPrefix = "", ctx = DEFAULT_CTX) {
|
|
|
413
493
|
);
|
|
414
494
|
case "htmlInline":
|
|
415
495
|
if (ctx.htmlPolicy === "strip") return null;
|
|
416
|
-
return /* @__PURE__ */
|
|
496
|
+
return /* @__PURE__ */ jsx5("span", { className: "squisq-md-html-inline", children: renderHtmlNodes(resolveHtmlNodes(node.htmlChildren, ctx.htmlPolicy), `${key}h`, ctx) }, key);
|
|
417
497
|
case "footnoteReference":
|
|
418
|
-
return /* @__PURE__ */
|
|
498
|
+
return /* @__PURE__ */ jsx5("sup", { className: "squisq-md-footnote-ref", children: /* @__PURE__ */ jsxs3("a", { href: `#fn-${node.identifier}`, children: [
|
|
419
499
|
"[",
|
|
420
500
|
node.label ?? node.identifier,
|
|
421
501
|
"]"
|
|
422
502
|
] }) }, key);
|
|
423
503
|
case "linkReference":
|
|
424
|
-
return /* @__PURE__ */
|
|
504
|
+
return /* @__PURE__ */ jsx5("span", { className: "squisq-md-link-ref", children: renderInline(node.children, key, ctx) }, key);
|
|
425
505
|
case "imageReference":
|
|
426
|
-
return /* @__PURE__ */
|
|
506
|
+
return /* @__PURE__ */ jsxs3("span", { className: "squisq-md-image-ref", children: [
|
|
427
507
|
"[",
|
|
428
508
|
node.alt ?? node.identifier,
|
|
429
509
|
"]"
|
|
430
510
|
] }, key);
|
|
431
511
|
case "textDirective":
|
|
432
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ jsx5("span", { className: "squisq-md-text-directive", "data-directive": node.name, children: renderInline(node.children, key, ctx) }, key);
|
|
433
513
|
case "mention":
|
|
434
|
-
return /* @__PURE__ */
|
|
514
|
+
return /* @__PURE__ */ jsxs3(
|
|
435
515
|
"span",
|
|
436
516
|
{
|
|
437
517
|
className: "squisq-md-mention mention",
|
|
@@ -453,33 +533,36 @@ function renderInline(nodes, keyPrefix = "", ctx = DEFAULT_CTX) {
|
|
|
453
533
|
}
|
|
454
534
|
function renderBlock(node, key, ctx = DEFAULT_CTX) {
|
|
455
535
|
switch (node.type) {
|
|
456
|
-
case "paragraph":
|
|
457
|
-
|
|
536
|
+
case "paragraph": {
|
|
537
|
+
const video = ctx.nested ? null : findBlockVideoEmbed(node);
|
|
538
|
+
if (video) return /* @__PURE__ */ jsx5(VideoEmbedFrame, { embed: video.embed, title: video.title }, key);
|
|
539
|
+
return /* @__PURE__ */ jsx5("p", { className: "squisq-md-p", children: renderInline(node.children, key, ctx) }, key);
|
|
540
|
+
}
|
|
458
541
|
case "heading": {
|
|
459
542
|
const Tag = `h${node.depth}`;
|
|
460
|
-
return /* @__PURE__ */
|
|
543
|
+
return /* @__PURE__ */ jsx5(Tag, { className: `squisq-md-heading squisq-md-h${node.depth}`, children: renderInline(node.children, key, ctx) }, key);
|
|
461
544
|
}
|
|
462
545
|
case "blockquote":
|
|
463
|
-
return /* @__PURE__ */
|
|
546
|
+
return /* @__PURE__ */ jsx5("blockquote", { className: "squisq-md-blockquote", children: renderBlocks(node.children, key, nestedCtx(ctx)) }, key);
|
|
464
547
|
case "list":
|
|
465
548
|
if (node.ordered) {
|
|
466
|
-
return /* @__PURE__ */
|
|
549
|
+
return /* @__PURE__ */ jsx5("ol", { className: "squisq-md-list squisq-md-ol", start: node.start ?? void 0, children: node.children.map((item, i) => renderListItem(item, `${key}li${i}`, ctx)) }, key);
|
|
467
550
|
}
|
|
468
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ jsx5("ul", { className: "squisq-md-list squisq-md-ul", children: node.children.map((item, i) => renderListItem(item, `${key}li${i}`, ctx)) }, key);
|
|
469
552
|
case "code": {
|
|
470
553
|
const fenceLang = node.lang?.trim().toLowerCase();
|
|
471
554
|
if (fenceLang && ctx.fenceRenderers?.[fenceLang]) {
|
|
472
|
-
return /* @__PURE__ */
|
|
555
|
+
return /* @__PURE__ */ jsx5(
|
|
473
556
|
FenceWidgetBoundary,
|
|
474
557
|
{
|
|
475
|
-
fallback: /* @__PURE__ */
|
|
476
|
-
children: /* @__PURE__ */
|
|
558
|
+
fallback: /* @__PURE__ */ jsx5(CodeBlock, { value: node.value, language: node.lang, ctx }),
|
|
559
|
+
children: /* @__PURE__ */ jsx5(HostFence, { node, lang: fenceLang, ctx })
|
|
477
560
|
},
|
|
478
561
|
key
|
|
479
562
|
);
|
|
480
563
|
}
|
|
481
564
|
if (fenceLang === "mermaid") {
|
|
482
|
-
return /* @__PURE__ */
|
|
565
|
+
return /* @__PURE__ */ jsx5(
|
|
483
566
|
MermaidDiagram,
|
|
484
567
|
{
|
|
485
568
|
source: node.value,
|
|
@@ -490,39 +573,42 @@ function renderBlock(node, key, ctx = DEFAULT_CTX) {
|
|
|
490
573
|
key
|
|
491
574
|
);
|
|
492
575
|
}
|
|
493
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ jsx5(CodeBlock, { value: node.value, language: node.lang, ctx }, key);
|
|
494
577
|
}
|
|
495
578
|
case "thematicBreak":
|
|
496
|
-
return /* @__PURE__ */
|
|
579
|
+
return /* @__PURE__ */ jsx5("hr", { className: "squisq-md-hr" }, key);
|
|
497
580
|
case "table":
|
|
498
581
|
return renderTable(node.children, node.align, key, ctx);
|
|
499
|
-
case "htmlBlock":
|
|
582
|
+
case "htmlBlock": {
|
|
500
583
|
if (ctx.htmlPolicy === "strip") return null;
|
|
501
|
-
|
|
584
|
+
const video = findBlockVideoEmbed(node);
|
|
585
|
+
if (video) return /* @__PURE__ */ jsx5(VideoEmbedFrame, { embed: video.embed, title: video.title }, key);
|
|
586
|
+
return /* @__PURE__ */ jsx5("div", { className: "squisq-md-html-block", children: renderHtmlNodes(resolveHtmlNodes(node.htmlChildren, ctx.htmlPolicy), `${key}h`, ctx) }, key);
|
|
587
|
+
}
|
|
502
588
|
case "math":
|
|
503
|
-
return /* @__PURE__ */
|
|
589
|
+
return /* @__PURE__ */ jsx5("pre", { className: "squisq-md-math-block", children: /* @__PURE__ */ jsx5("code", { children: node.value }) }, key);
|
|
504
590
|
case "definition":
|
|
505
591
|
return null;
|
|
506
592
|
case "footnoteDefinition":
|
|
507
|
-
return /* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
509
|
-
renderBlocks(node.children, key, ctx)
|
|
593
|
+
return /* @__PURE__ */ jsxs3("div", { className: "squisq-md-footnote-def", id: `fn-${node.identifier}`, children: [
|
|
594
|
+
/* @__PURE__ */ jsx5("sup", { children: node.label ?? node.identifier }),
|
|
595
|
+
renderBlocks(node.children, key, nestedCtx(ctx))
|
|
510
596
|
] }, key);
|
|
511
597
|
case "containerDirective":
|
|
512
|
-
return /* @__PURE__ */
|
|
598
|
+
return /* @__PURE__ */ jsxs3(
|
|
513
599
|
"div",
|
|
514
600
|
{
|
|
515
601
|
className: `squisq-md-directive squisq-md-directive-${node.name}`,
|
|
516
602
|
"data-directive": node.name,
|
|
517
603
|
children: [
|
|
518
|
-
node.label && /* @__PURE__ */
|
|
519
|
-
renderBlocks(node.children, key, ctx)
|
|
604
|
+
node.label && /* @__PURE__ */ jsx5("div", { className: "squisq-md-directive-label", children: node.label }),
|
|
605
|
+
renderBlocks(node.children, key, nestedCtx(ctx))
|
|
520
606
|
]
|
|
521
607
|
},
|
|
522
608
|
key
|
|
523
609
|
);
|
|
524
610
|
case "leafDirective":
|
|
525
|
-
return /* @__PURE__ */
|
|
611
|
+
return /* @__PURE__ */ jsx5(
|
|
526
612
|
"div",
|
|
527
613
|
{
|
|
528
614
|
className: `squisq-md-directive squisq-md-directive-${node.name}`,
|
|
@@ -532,11 +618,11 @@ function renderBlock(node, key, ctx = DEFAULT_CTX) {
|
|
|
532
618
|
key
|
|
533
619
|
);
|
|
534
620
|
case "definitionList":
|
|
535
|
-
return /* @__PURE__ */
|
|
621
|
+
return /* @__PURE__ */ jsx5("dl", { className: "squisq-md-dl", children: node.children.map((child, i) => {
|
|
536
622
|
if (child.type === "definitionTerm") {
|
|
537
|
-
return /* @__PURE__ */
|
|
623
|
+
return /* @__PURE__ */ jsx5("dt", { className: "squisq-md-dt", children: renderInline(child.children, `${key}dt${i}`, ctx) }, `${key}dt${i}`);
|
|
538
624
|
}
|
|
539
|
-
return /* @__PURE__ */
|
|
625
|
+
return /* @__PURE__ */ jsx5("dd", { className: "squisq-md-dd", children: renderBlocks(child.children, `${key}dd${i}`, nestedCtx(ctx)) }, `${key}dd${i}`);
|
|
540
626
|
}) }, key);
|
|
541
627
|
default:
|
|
542
628
|
return null;
|
|
@@ -544,15 +630,15 @@ function renderBlock(node, key, ctx = DEFAULT_CTX) {
|
|
|
544
630
|
}
|
|
545
631
|
function renderListItem(item, key, ctx = DEFAULT_CTX) {
|
|
546
632
|
const isTask = item.checked !== null && item.checked !== void 0;
|
|
547
|
-
return /* @__PURE__ */
|
|
548
|
-
isTask && /* @__PURE__ */
|
|
549
|
-
renderBlocks(item.children, key, ctx)
|
|
633
|
+
return /* @__PURE__ */ jsxs3("li", { className: `squisq-md-li${isTask ? " squisq-md-task" : ""}`, children: [
|
|
634
|
+
isTask && /* @__PURE__ */ jsx5("input", { type: "checkbox", checked: !!item.checked, readOnly: true, className: "squisq-md-checkbox" }),
|
|
635
|
+
renderBlocks(item.children, key, nestedCtx(ctx))
|
|
550
636
|
] }, key);
|
|
551
637
|
}
|
|
552
638
|
function renderTable(rows, align, key, ctx = DEFAULT_CTX) {
|
|
553
639
|
const [headerRow, ...bodyRows] = rows;
|
|
554
|
-
return /* @__PURE__ */
|
|
555
|
-
headerRow && /* @__PURE__ */
|
|
640
|
+
return /* @__PURE__ */ jsxs3("table", { className: "squisq-md-table", children: [
|
|
641
|
+
headerRow && /* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsx5("tr", { children: headerRow.children.map((cell, ci) => /* @__PURE__ */ jsx5(
|
|
556
642
|
"th",
|
|
557
643
|
{
|
|
558
644
|
className: "squisq-md-th",
|
|
@@ -561,7 +647,7 @@ function renderTable(rows, align, key, ctx = DEFAULT_CTX) {
|
|
|
561
647
|
},
|
|
562
648
|
`${key}th${ci}`
|
|
563
649
|
)) }) }),
|
|
564
|
-
bodyRows.length > 0 && /* @__PURE__ */
|
|
650
|
+
bodyRows.length > 0 && /* @__PURE__ */ jsx5("tbody", { children: bodyRows.map((row, ri) => /* @__PURE__ */ jsx5("tr", { children: row.children.map((cell, ci) => /* @__PURE__ */ jsx5(
|
|
565
651
|
"td",
|
|
566
652
|
{
|
|
567
653
|
className: "squisq-md-td",
|
|
@@ -582,16 +668,16 @@ function MdImage({ src, alt, title }) {
|
|
|
582
668
|
const playback = useAnimatedImage(safeSrc ?? "", resolved);
|
|
583
669
|
if (!safeSrc) return null;
|
|
584
670
|
if (!mayBeAnimatedImage2(safeSrc)) {
|
|
585
|
-
return /* @__PURE__ */
|
|
671
|
+
return /* @__PURE__ */ jsx5("img", { className: "squisq-md-image", src: resolved, alt, title });
|
|
586
672
|
}
|
|
587
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ jsxs3(
|
|
588
674
|
"span",
|
|
589
675
|
{
|
|
590
676
|
className: "squisq-animated-image",
|
|
591
677
|
"data-animated": playback.animated ? "true" : void 0,
|
|
592
678
|
style: { position: "relative", display: "inline-block", maxWidth: "100%" },
|
|
593
679
|
children: [
|
|
594
|
-
/* @__PURE__ */
|
|
680
|
+
/* @__PURE__ */ jsx5(
|
|
595
681
|
"img",
|
|
596
682
|
{
|
|
597
683
|
ref: imageRef,
|
|
@@ -602,7 +688,7 @@ function MdImage({ src, alt, title }) {
|
|
|
602
688
|
style: { display: "block", maxWidth: "100%" }
|
|
603
689
|
}
|
|
604
690
|
),
|
|
605
|
-
/* @__PURE__ */
|
|
691
|
+
/* @__PURE__ */ jsx5(AnimatedImageControls, { playback, imageRef })
|
|
606
692
|
]
|
|
607
693
|
}
|
|
608
694
|
);
|
|
@@ -673,11 +759,15 @@ function reactPropsFromAttrs(attrs, ctx) {
|
|
|
673
759
|
}
|
|
674
760
|
function renderHtmlElement(el, key, ctx) {
|
|
675
761
|
const tagName = el.tagName.toLowerCase();
|
|
762
|
+
if (tagName === "iframe") {
|
|
763
|
+
const video = videoEmbedFromIframe(el);
|
|
764
|
+
return video ? /* @__PURE__ */ jsx5(VideoEmbedFrame, { embed: video.embed, title: video.title, inline: true }, key) : null;
|
|
765
|
+
}
|
|
676
766
|
if (DANGEROUS_HTML_TAGS.has(tagName)) return null;
|
|
677
767
|
if (tagName === "video") {
|
|
678
768
|
const src = sanitizeUrl(el.attributes.src ?? "", "media") ?? "";
|
|
679
769
|
const poster = sanitizeUrl(el.attributes.poster ?? "", "media") ?? void 0;
|
|
680
|
-
return /* @__PURE__ */
|
|
770
|
+
return /* @__PURE__ */ jsx5(
|
|
681
771
|
InlineVideoPlayer,
|
|
682
772
|
{
|
|
683
773
|
src,
|
|
@@ -692,7 +782,7 @@ function renderHtmlElement(el, key, ctx) {
|
|
|
692
782
|
}
|
|
693
783
|
if (tagName === "audio") {
|
|
694
784
|
const src = sanitizeUrl(el.attributes.src ?? "", "media") ?? "";
|
|
695
|
-
return /* @__PURE__ */
|
|
785
|
+
return /* @__PURE__ */ jsx5(
|
|
696
786
|
InlineAudioPlayer,
|
|
697
787
|
{
|
|
698
788
|
src,
|
|
@@ -705,9 +795,9 @@ function renderHtmlElement(el, key, ctx) {
|
|
|
705
795
|
const Tag = tagName;
|
|
706
796
|
const props = reactPropsFromAttrs(el.attributes, ctx);
|
|
707
797
|
if (el.selfClosing) {
|
|
708
|
-
return /* @__PURE__ */
|
|
798
|
+
return /* @__PURE__ */ jsx5(Tag, { ...props }, key);
|
|
709
799
|
}
|
|
710
|
-
return /* @__PURE__ */
|
|
800
|
+
return /* @__PURE__ */ jsx5(Tag, { ...props, children: renderHtmlNodes(el.children, `${key}c`, ctx) }, key);
|
|
711
801
|
}
|
|
712
802
|
function renderHtmlNodes(nodes, keyPrefix, ctx = DEFAULT_CTX) {
|
|
713
803
|
return nodes.map((node, i) => {
|
|
@@ -716,7 +806,7 @@ function renderHtmlNodes(nodes, keyPrefix, ctx = DEFAULT_CTX) {
|
|
|
716
806
|
case "htmlElement":
|
|
717
807
|
return renderHtmlElement(node, key, ctx);
|
|
718
808
|
case "htmlText":
|
|
719
|
-
return /* @__PURE__ */
|
|
809
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: node.value }, key);
|
|
720
810
|
case "htmlComment":
|
|
721
811
|
return null;
|
|
722
812
|
default:
|
|
@@ -758,7 +848,7 @@ function MarkdownRenderer({
|
|
|
758
848
|
};
|
|
759
849
|
}, [mediaProvider]);
|
|
760
850
|
if (!nodes || nodes.length === 0) return null;
|
|
761
|
-
return /* @__PURE__ */
|
|
851
|
+
return /* @__PURE__ */ jsx5("div", { className: `squisq-md ${className || ""}`, children: renderBlocks(nodes, "", {
|
|
762
852
|
htmlPolicy,
|
|
763
853
|
linkSchemes,
|
|
764
854
|
theme,
|
|
@@ -774,6 +864,7 @@ export {
|
|
|
774
864
|
useFenceRenderers,
|
|
775
865
|
InlineVideoPlayer,
|
|
776
866
|
InlineAudioPlayer,
|
|
867
|
+
VideoEmbedFrame,
|
|
777
868
|
AnimatedImageControls,
|
|
778
869
|
useAnimatedImage,
|
|
779
870
|
MarkdownRenderer
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LinearDocView
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4HJBKCSY.js";
|
|
4
4
|
import {
|
|
5
5
|
useAudioSync,
|
|
6
6
|
useDocPlayback,
|
|
7
7
|
useMediaSchedule,
|
|
8
8
|
useViewportOrientation
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7J4YN7EK.js";
|
|
10
10
|
import {
|
|
11
11
|
useAutoSurface
|
|
12
12
|
} from "./chunk-TT6ENR6T.js";
|
|
13
13
|
import {
|
|
14
14
|
MarkdownRenderer
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-T7NVETOH.js";
|
|
16
16
|
import {
|
|
17
17
|
BlockRenderer
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-LCBV2SE4.js";
|
|
19
19
|
import {
|
|
20
20
|
isCaptureDrivenVideo,
|
|
21
21
|
seekVideoToFrame
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DI7CKFRY.js";
|
|
23
23
|
import {
|
|
24
24
|
useMediaProvider,
|
|
25
25
|
useMediaUrl,
|
|
26
26
|
useResourcePolicy
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-HCKL2AFN.js";
|
|
28
28
|
|
|
29
29
|
// src/MediaClipLayer.tsx
|
|
30
30
|
import { useEffect, useRef } from "react";
|
|
@@ -1630,7 +1630,8 @@ function DashboardView({
|
|
|
1630
1630
|
isPlaying: false,
|
|
1631
1631
|
muted,
|
|
1632
1632
|
animationsEnabled,
|
|
1633
|
-
theme: activeTheme
|
|
1633
|
+
theme: activeTheme,
|
|
1634
|
+
videoEmbeds: renderMode ? "placeholder" : "player"
|
|
1634
1635
|
}
|
|
1635
1636
|
),
|
|
1636
1637
|
cell.frame && cell.frame.overlayLayers.length > 0 && // Borders and accents ride above the block: a template that
|
|
@@ -3617,7 +3618,8 @@ function DocPlayerContent({
|
|
|
3617
3618
|
animationsEnabled,
|
|
3618
3619
|
theme: effectiveTheme,
|
|
3619
3620
|
tableContentRenderer,
|
|
3620
|
-
growTextToFit: isSlideshowMode
|
|
3621
|
+
growTextToFit: isSlideshowMode,
|
|
3622
|
+
videoEmbeds: renderMode ? "placeholder" : "poster"
|
|
3621
3623
|
}
|
|
3622
3624
|
) }),
|
|
3623
3625
|
animationsEnabled && !showCoverBlock && previousBlock && isExiting && // Keyed by block id so each block is its own DOM subtree: React never
|
|
@@ -3637,7 +3639,8 @@ function DocPlayerContent({
|
|
|
3637
3639
|
animationsEnabled,
|
|
3638
3640
|
theme: effectiveTheme,
|
|
3639
3641
|
tableContentRenderer,
|
|
3640
|
-
growTextToFit: isSlideshowMode
|
|
3642
|
+
growTextToFit: isSlideshowMode,
|
|
3643
|
+
videoEmbeds: renderMode ? "placeholder" : "poster"
|
|
3641
3644
|
}
|
|
3642
3645
|
) }, previousBlock.id),
|
|
3643
3646
|
currentBlock && /* @__PURE__ */ jsx9(
|
|
@@ -3662,7 +3665,8 @@ function DocPlayerContent({
|
|
|
3662
3665
|
animationsEnabled,
|
|
3663
3666
|
theme: effectiveTheme,
|
|
3664
3667
|
tableContentRenderer,
|
|
3665
|
-
growTextToFit: isSlideshowMode
|
|
3668
|
+
growTextToFit: isSlideshowMode,
|
|
3669
|
+
videoEmbeds: renderMode ? "placeholder" : "player"
|
|
3666
3670
|
}
|
|
3667
3671
|
)
|
|
3668
3672
|
},
|