@bendyline/squisq-react 2.12.33 → 2.12.35
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/{chunk-IPTOV4W7.js → chunk-MPOU5JC4.js} +149 -69
- package/dist/index.d.ts +7 -5
- package/dist/index.js +164 -1
- package/dist/player/index.d.ts +1 -1
- package/dist/player/index.js +1 -1
- package/dist/{player-Wc6Nd4p5.d.ts → player-XTHVuSvh.d.ts} +108 -34
- package/dist/squisq-player.full.global.js +469 -468
- package/dist/squisq-player.global.js +91 -90
- package/dist/standalone-player-full.js +1 -1
- package/dist/standalone-source.js +1 -1
- package/package.json +2 -2
|
@@ -1048,13 +1048,45 @@ function formatTime(seconds) {
|
|
|
1048
1048
|
import { useRef as useRef2, useState as useState3, useCallback as useCallback2 } from "react";
|
|
1049
1049
|
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
1050
1050
|
var PLAYER_ACCENT = "var(--squisq-player-accent, #5b9bd5)";
|
|
1051
|
+
var VARIANTS = {
|
|
1052
|
+
overlay: {
|
|
1053
|
+
height: 24,
|
|
1054
|
+
track: 6,
|
|
1055
|
+
trackColor: "rgba(255,255,255,0.2)",
|
|
1056
|
+
chapter: 14,
|
|
1057
|
+
chapterFill: "rgba(255,255,255,0.75)",
|
|
1058
|
+
chapterActive: "#ffffff",
|
|
1059
|
+
chapterShadow: "0 1px 3px rgba(0,0,0,0.5)",
|
|
1060
|
+
bead: 12,
|
|
1061
|
+
beadFill: "rgba(255,255,255,0.55)",
|
|
1062
|
+
beadActive: "#ffffff",
|
|
1063
|
+
hoverLine: 16,
|
|
1064
|
+
hoverLineColor: "rgba(255,255,255,0.6)"
|
|
1065
|
+
},
|
|
1066
|
+
inline: {
|
|
1067
|
+
height: 16,
|
|
1068
|
+
track: 4,
|
|
1069
|
+
trackColor: "color-mix(in srgb, currentColor 22%, transparent)",
|
|
1070
|
+
chapter: 10,
|
|
1071
|
+
chapterFill: "var(--squisq-player-surface, Canvas)",
|
|
1072
|
+
chapterActive: PLAYER_ACCENT,
|
|
1073
|
+
chapterShadow: "none",
|
|
1074
|
+
bead: 10,
|
|
1075
|
+
beadFill: "color-mix(in srgb, currentColor 45%, transparent)",
|
|
1076
|
+
beadActive: "currentColor",
|
|
1077
|
+
hoverLine: 12,
|
|
1078
|
+
hoverLineColor: "color-mix(in srgb, currentColor 60%, transparent)"
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1051
1081
|
function DocProgressBar({
|
|
1052
1082
|
state,
|
|
1053
1083
|
actions,
|
|
1054
1084
|
blockMarkers,
|
|
1055
1085
|
expandedBlocks,
|
|
1056
|
-
getBlockTitle
|
|
1086
|
+
getBlockTitle,
|
|
1087
|
+
variant = "overlay"
|
|
1057
1088
|
}) {
|
|
1089
|
+
const look = VARIANTS[variant];
|
|
1058
1090
|
const progressBarRef = useRef2(null);
|
|
1059
1091
|
const [hoverPosition, setHoverPosition] = useState3(null);
|
|
1060
1092
|
const playProgress = state.totalDuration > 0 ? Math.max(0, Math.min(1, state.currentTime / state.totalDuration)) : 0;
|
|
@@ -1118,9 +1150,12 @@ function DocProgressBar({
|
|
|
1118
1150
|
ref: progressBarRef,
|
|
1119
1151
|
role: "group",
|
|
1120
1152
|
"aria-label": "Playback timeline",
|
|
1153
|
+
"data-variant": variant,
|
|
1121
1154
|
style: {
|
|
1122
1155
|
flex: 1,
|
|
1123
|
-
|
|
1156
|
+
// The clickable strip; the track stays centered in it. The inline
|
|
1157
|
+
// variant lets its host make it taller for a finger.
|
|
1158
|
+
height: variant === "inline" ? `var(--squisq-player-scrub-height, ${look.height}px)` : `${look.height}px`,
|
|
1124
1159
|
cursor: "pointer",
|
|
1125
1160
|
position: "relative",
|
|
1126
1161
|
display: "flex",
|
|
@@ -1150,9 +1185,9 @@ function DocProgressBar({
|
|
|
1150
1185
|
position: "absolute",
|
|
1151
1186
|
left: 0,
|
|
1152
1187
|
right: 0,
|
|
1153
|
-
height:
|
|
1154
|
-
background:
|
|
1155
|
-
borderRadius:
|
|
1188
|
+
height: `${look.track}px`,
|
|
1189
|
+
background: look.trackColor,
|
|
1190
|
+
borderRadius: `${look.track / 2}px`
|
|
1156
1191
|
}
|
|
1157
1192
|
}
|
|
1158
1193
|
),
|
|
@@ -1164,9 +1199,9 @@ function DocProgressBar({
|
|
|
1164
1199
|
position: "absolute",
|
|
1165
1200
|
left: 0,
|
|
1166
1201
|
width: `${playProgress * 100}%`,
|
|
1167
|
-
height:
|
|
1202
|
+
height: `${look.track}px`,
|
|
1168
1203
|
background: PLAYER_ACCENT,
|
|
1169
|
-
borderRadius:
|
|
1204
|
+
borderRadius: `${look.track / 2}px`
|
|
1170
1205
|
}
|
|
1171
1206
|
}
|
|
1172
1207
|
),
|
|
@@ -1188,19 +1223,19 @@ function DocProgressBar({
|
|
|
1188
1223
|
cursor: "pointer",
|
|
1189
1224
|
transition: "transform 0.15s, background-color 0.15s",
|
|
1190
1225
|
...chapter ? {
|
|
1191
|
-
width:
|
|
1192
|
-
height:
|
|
1226
|
+
width: `${look.chapter}px`,
|
|
1227
|
+
height: `${look.chapter}px`,
|
|
1193
1228
|
padding: 0,
|
|
1194
|
-
backgroundColor: active ?
|
|
1229
|
+
backgroundColor: active ? look.chapterActive : look.chapterFill,
|
|
1195
1230
|
border: `2px solid ${PLAYER_ACCENT}`,
|
|
1196
|
-
boxShadow:
|
|
1231
|
+
boxShadow: look.chapterShadow,
|
|
1197
1232
|
zIndex: 3
|
|
1198
1233
|
} : {
|
|
1199
|
-
width:
|
|
1200
|
-
height:
|
|
1234
|
+
width: `${look.bead}px`,
|
|
1235
|
+
height: `${look.bead}px`,
|
|
1201
1236
|
padding: "3px",
|
|
1202
1237
|
backgroundClip: "content-box",
|
|
1203
|
-
backgroundColor: active ?
|
|
1238
|
+
backgroundColor: active ? look.beadActive : look.beadFill,
|
|
1204
1239
|
border: "none",
|
|
1205
1240
|
zIndex: 2
|
|
1206
1241
|
}
|
|
@@ -1259,8 +1294,8 @@ function DocProgressBar({
|
|
|
1259
1294
|
top: "50%",
|
|
1260
1295
|
transform: "translate(-50%, -50%)",
|
|
1261
1296
|
width: "2px",
|
|
1262
|
-
height:
|
|
1263
|
-
background:
|
|
1297
|
+
height: `${look.hoverLine}px`,
|
|
1298
|
+
background: look.hoverLineColor,
|
|
1264
1299
|
pointerEvents: "none",
|
|
1265
1300
|
zIndex: 1
|
|
1266
1301
|
}
|
|
@@ -1369,7 +1404,13 @@ function PlayPauseIcon({ isPlaying, isBuffering = false, size }) {
|
|
|
1369
1404
|
}
|
|
1370
1405
|
|
|
1371
1406
|
// src/DocControlsOverlay.tsx
|
|
1372
|
-
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1407
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1408
|
+
function PlaybackControls({
|
|
1409
|
+
render,
|
|
1410
|
+
...controls
|
|
1411
|
+
}) {
|
|
1412
|
+
return /* @__PURE__ */ jsx6(Fragment2, { children: render ? render(controls) : /* @__PURE__ */ jsx6(DocControlsOverlay, { ...controls }) });
|
|
1413
|
+
}
|
|
1373
1414
|
function DocControlsOverlay({
|
|
1374
1415
|
state,
|
|
1375
1416
|
actions,
|
|
@@ -1510,7 +1551,13 @@ function DocControlsOverlay({
|
|
|
1510
1551
|
|
|
1511
1552
|
// src/DocControlsSlideshow.tsx
|
|
1512
1553
|
import { useCallback as useCallback3, useEffect as useEffect4, useId, useLayoutEffect, useRef as useRef3, useState as useState4 } from "react";
|
|
1513
|
-
import { Fragment as
|
|
1554
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1555
|
+
function SlideshowControls({
|
|
1556
|
+
controls,
|
|
1557
|
+
render
|
|
1558
|
+
}) {
|
|
1559
|
+
return /* @__PURE__ */ jsx7(Fragment3, { children: render ? render(controls) : /* @__PURE__ */ jsx7(DocControlsSlideshow, { ...controls }) });
|
|
1560
|
+
}
|
|
1514
1561
|
function DocControlsSlideshow({
|
|
1515
1562
|
state,
|
|
1516
1563
|
slideNav,
|
|
@@ -1782,7 +1829,7 @@ function DocControlsSlideshow({
|
|
|
1782
1829
|
})
|
|
1783
1830
|
}
|
|
1784
1831
|
),
|
|
1785
|
-
!!state.buildCount && /* @__PURE__ */ jsxs4(
|
|
1832
|
+
!!state.buildCount && /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1786
1833
|
/* @__PURE__ */ jsxs4("span", { role: "status", style: { color: "inherit", fontSize: 12 }, children: [
|
|
1787
1834
|
"Build ",
|
|
1788
1835
|
state.buildStep ?? 0,
|
|
@@ -1867,7 +1914,7 @@ async function decodeSvgImages(root) {
|
|
|
1867
1914
|
}
|
|
1868
1915
|
|
|
1869
1916
|
// src/DashboardView.tsx
|
|
1870
|
-
import { Fragment as
|
|
1917
|
+
import { Fragment as Fragment4, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef4 } from "react";
|
|
1871
1918
|
import { materializeDashboard, resolveThemeForDoc, VIEWPORT_PRESETS } from "@bendyline/squisq/doc";
|
|
1872
1919
|
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1873
1920
|
async function waitForDashboardAssets(root) {
|
|
@@ -2004,7 +2051,7 @@ function DashboardView({
|
|
|
2004
2051
|
theme: activeTheme
|
|
2005
2052
|
}
|
|
2006
2053
|
) }),
|
|
2007
|
-
materialization.cells.map((cell) => /* @__PURE__ */ jsxs5(
|
|
2054
|
+
materialization.cells.map((cell) => /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
2008
2055
|
cell.frame && /* @__PURE__ */ jsx8(
|
|
2009
2056
|
"div",
|
|
2010
2057
|
{
|
|
@@ -2306,9 +2353,11 @@ function FlashcardView({
|
|
|
2306
2353
|
fenceRenderers,
|
|
2307
2354
|
viewport = VIEWPORT_PRESETS2.landscape,
|
|
2308
2355
|
density = "comfortable",
|
|
2309
|
-
className
|
|
2356
|
+
className,
|
|
2357
|
+
renderControls
|
|
2310
2358
|
}) {
|
|
2311
2359
|
const compact = density === "compact";
|
|
2360
|
+
const hostControls = !!renderControls;
|
|
2312
2361
|
const rootClassName = "squisq-flashcards" + (compact ? " squisq-flashcards--compact" : "") + (className ? ` ${className}` : "");
|
|
2313
2362
|
const activeTheme = useMemo5(() => theme ?? resolveThemeForDoc2(doc), [doc, theme]);
|
|
2314
2363
|
const deck = useMemo5(() => materializeFlashcards(doc, { source }), [doc, source]);
|
|
@@ -2363,7 +2412,7 @@ function FlashcardView({
|
|
|
2363
2412
|
if (delta > 0) viewport2.scrollTop += delta;
|
|
2364
2413
|
}, [revealed, cardIndex, retryIds]);
|
|
2365
2414
|
useLayoutEffect2(() => {
|
|
2366
|
-
if (compact || !deckElement) return;
|
|
2415
|
+
if (compact || hostControls || !deckElement) return;
|
|
2367
2416
|
const measure = () => {
|
|
2368
2417
|
const { width, height } = deckElement.getBoundingClientRect();
|
|
2369
2418
|
setSideRails((current) => wantsSideRails(width, height, current));
|
|
@@ -2373,7 +2422,7 @@ function FlashcardView({
|
|
|
2373
2422
|
const observer = new ResizeObserver(measure);
|
|
2374
2423
|
observer.observe(deckElement);
|
|
2375
2424
|
return () => observer.disconnect();
|
|
2376
|
-
}, [compact, deckElement]);
|
|
2425
|
+
}, [compact, hostControls, deckElement]);
|
|
2377
2426
|
const revealAnswer = useCallback4(() => {
|
|
2378
2427
|
if (!currentCard) return;
|
|
2379
2428
|
setRevealed(true);
|
|
@@ -2483,6 +2532,33 @@ function FlashcardView({
|
|
|
2483
2532
|
};
|
|
2484
2533
|
const missedIds = deck.cards.filter((card) => ratings[card.id] === "again").map((card) => card.id);
|
|
2485
2534
|
const gotItCount = deck.cards.filter((card) => ratings[card.id] === "got-it").length;
|
|
2535
|
+
const lastCard = cardIndex === sessionCards.length - 1;
|
|
2536
|
+
const toggleShuffle = () => {
|
|
2537
|
+
setShuffleEnabled((enabled) => !enabled);
|
|
2538
|
+
restart();
|
|
2539
|
+
};
|
|
2540
|
+
const retryMissed = () => {
|
|
2541
|
+
setRetryIds(missedIds);
|
|
2542
|
+
resetPosition();
|
|
2543
|
+
};
|
|
2544
|
+
const controls = {
|
|
2545
|
+
cardIndex: Math.min(cardIndex, sessionCards.length),
|
|
2546
|
+
cardCount: sessionCards.length,
|
|
2547
|
+
revealed,
|
|
2548
|
+
finished,
|
|
2549
|
+
cardKind: currentCard?.kind,
|
|
2550
|
+
lastCard,
|
|
2551
|
+
progress: sessionCards.length ? Math.min(1, (cardIndex + (revealed ? 1 : 0)) / sessionCards.length) : 0,
|
|
2552
|
+
shuffled: shuffleEnabled,
|
|
2553
|
+
missedCount: missedIds.length,
|
|
2554
|
+
canGoBack: cardIndex > 0 || revealed,
|
|
2555
|
+
previous: previousCard,
|
|
2556
|
+
next: nextCard,
|
|
2557
|
+
rate,
|
|
2558
|
+
toggleShuffle,
|
|
2559
|
+
restart,
|
|
2560
|
+
retryMissed
|
|
2561
|
+
};
|
|
2486
2562
|
if (deck.cards.length === 0) {
|
|
2487
2563
|
return /* @__PURE__ */ jsx9(
|
|
2488
2564
|
"div",
|
|
@@ -2500,7 +2576,7 @@ function FlashcardView({
|
|
|
2500
2576
|
);
|
|
2501
2577
|
}
|
|
2502
2578
|
if (finished) {
|
|
2503
|
-
return /* @__PURE__ */
|
|
2579
|
+
return /* @__PURE__ */ jsxs6(
|
|
2504
2580
|
"div",
|
|
2505
2581
|
{
|
|
2506
2582
|
className: rootClassName,
|
|
@@ -2509,39 +2585,38 @@ function FlashcardView({
|
|
|
2509
2585
|
"aria-label": "Flashcard session summary",
|
|
2510
2586
|
tabIndex: 0,
|
|
2511
2587
|
onKeyDown: globalKeyboardShortcuts ? void 0 : handleShortcut,
|
|
2512
|
-
children:
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2588
|
+
children: [
|
|
2589
|
+
/* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__summary", children: [
|
|
2590
|
+
/* @__PURE__ */ jsx9("span", { className: "squisq-flashcards__eyebrow", children: "Session complete" }),
|
|
2591
|
+
/* @__PURE__ */ jsxs6("h2", { children: [
|
|
2592
|
+
gotItCount,
|
|
2593
|
+
" remembered"
|
|
2594
|
+
] }),
|
|
2595
|
+
/* @__PURE__ */ jsx9("p", { children: missedIds.length === 0 ? `You completed all ${deck.cards.length} cards.` : `${missedIds.length} ${missedIds.length === 1 ? "card needs" : "cards need"} another look.` }),
|
|
2596
|
+
/* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__summary-actions", children: [
|
|
2597
|
+
missedIds.length > 0 && /* @__PURE__ */ jsx9(
|
|
2598
|
+
"button",
|
|
2599
|
+
{
|
|
2600
|
+
type: "button",
|
|
2601
|
+
className: "squisq-flashcards__button squisq-flashcards__button--primary",
|
|
2602
|
+
onClick: retryMissed,
|
|
2603
|
+
children: "Retry missed"
|
|
2604
|
+
}
|
|
2605
|
+
),
|
|
2606
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: "squisq-flashcards__button", onClick: restart, children: "Study again" }),
|
|
2607
|
+
!hostControls && /* @__PURE__ */ jsx9("button", { type: "button", className: "squisq-flashcards__button", onClick: previousCard, children: "Previous card" })
|
|
2608
|
+
] })
|
|
2517
2609
|
] }),
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
missedIds.length > 0 && /* @__PURE__ */ jsx9(
|
|
2521
|
-
"button",
|
|
2522
|
-
{
|
|
2523
|
-
type: "button",
|
|
2524
|
-
className: "squisq-flashcards__button squisq-flashcards__button--primary",
|
|
2525
|
-
onClick: () => {
|
|
2526
|
-
setRetryIds(missedIds);
|
|
2527
|
-
resetPosition();
|
|
2528
|
-
},
|
|
2529
|
-
children: "Retry missed"
|
|
2530
|
-
}
|
|
2531
|
-
),
|
|
2532
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className: "squisq-flashcards__button", onClick: restart, children: "Study again" }),
|
|
2533
|
-
/* @__PURE__ */ jsx9("button", { type: "button", className: "squisq-flashcards__button", onClick: previousCard, children: "Previous card" })
|
|
2534
|
-
] })
|
|
2535
|
-
] })
|
|
2610
|
+
renderControls?.(controls)
|
|
2611
|
+
]
|
|
2536
2612
|
}
|
|
2537
2613
|
);
|
|
2538
2614
|
}
|
|
2539
2615
|
const choices = currentCard?.choices ? shuffled(currentCard.choices, `${currentCard.id}:${sessionSeed}`) : [];
|
|
2540
2616
|
const selectedChoice = choices.find((choice) => choice.id === selectedChoiceId);
|
|
2541
2617
|
const position = `Card ${cardIndex + 1} of ${sessionCards.length}`;
|
|
2542
|
-
const lastCard = cardIndex === sessionCards.length - 1;
|
|
2543
2618
|
const nextLabel = revealed ? lastCard ? "Finish" : "Next card" : "Reveal";
|
|
2544
|
-
const railsActive = sideRails && !compact;
|
|
2619
|
+
const railsActive = sideRails && !compact && !hostControls;
|
|
2545
2620
|
const tools = /* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__tools", children: [
|
|
2546
2621
|
/* @__PURE__ */ jsx9(
|
|
2547
2622
|
"button",
|
|
@@ -2549,10 +2624,7 @@ function FlashcardView({
|
|
|
2549
2624
|
type: "button",
|
|
2550
2625
|
className: "squisq-flashcards__tool",
|
|
2551
2626
|
"aria-pressed": shuffleEnabled,
|
|
2552
|
-
onClick:
|
|
2553
|
-
setShuffleEnabled((enabled) => !enabled);
|
|
2554
|
-
restart();
|
|
2555
|
-
},
|
|
2627
|
+
onClick: toggleShuffle,
|
|
2556
2628
|
children: "Shuffle"
|
|
2557
2629
|
}
|
|
2558
2630
|
),
|
|
@@ -2624,9 +2696,9 @@ function FlashcardView({
|
|
|
2624
2696
|
/* @__PURE__ */ jsxs6("header", { className: "squisq-flashcards__header", children: [
|
|
2625
2697
|
/* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__deck-copy", children: [
|
|
2626
2698
|
deck.title && /* @__PURE__ */ jsx9("h1", { title: compact ? deck.title : void 0, children: deck.title }),
|
|
2627
|
-
compact && /* @__PURE__ */ jsx9("span", { className: "squisq-flashcards__position", children: position })
|
|
2699
|
+
compact && !hostControls && /* @__PURE__ */ jsx9("span", { className: "squisq-flashcards__position", children: position })
|
|
2628
2700
|
] }),
|
|
2629
|
-
compact ? /* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__controls", children: [
|
|
2701
|
+
hostControls ? null : compact ? /* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__controls", children: [
|
|
2630
2702
|
tools,
|
|
2631
2703
|
/* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__navigation", children: [
|
|
2632
2704
|
previousButton,
|
|
@@ -2634,7 +2706,7 @@ function FlashcardView({
|
|
|
2634
2706
|
] })
|
|
2635
2707
|
] }) : tools
|
|
2636
2708
|
] }),
|
|
2637
|
-
compact && progressBar,
|
|
2709
|
+
compact && !hostControls && progressBar,
|
|
2638
2710
|
/* @__PURE__ */ jsxs6(
|
|
2639
2711
|
"main",
|
|
2640
2712
|
{
|
|
@@ -2692,7 +2764,7 @@ function FlashcardView({
|
|
|
2692
2764
|
]
|
|
2693
2765
|
}
|
|
2694
2766
|
),
|
|
2695
|
-
!compact && /* @__PURE__ */ jsxs6("footer", { className: "squisq-flashcards__footer", children: [
|
|
2767
|
+
!compact && !hostControls && /* @__PURE__ */ jsxs6("footer", { className: "squisq-flashcards__footer", children: [
|
|
2696
2768
|
/* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__back", children: [
|
|
2697
2769
|
previousButton,
|
|
2698
2770
|
/* @__PURE__ */ jsxs6("div", { className: "squisq-flashcards__progress-group", children: [
|
|
@@ -2701,7 +2773,8 @@ function FlashcardView({
|
|
|
2701
2773
|
] })
|
|
2702
2774
|
] }),
|
|
2703
2775
|
primaryActions
|
|
2704
|
-
] })
|
|
2776
|
+
] }),
|
|
2777
|
+
renderControls?.(controls)
|
|
2705
2778
|
]
|
|
2706
2779
|
}
|
|
2707
2780
|
);
|
|
@@ -2786,7 +2859,7 @@ function resolveDocPlayerAppearance(doc, overrides = {}) {
|
|
|
2786
2859
|
|
|
2787
2860
|
// src/DocPlayer.tsx
|
|
2788
2861
|
import {
|
|
2789
|
-
Fragment as
|
|
2862
|
+
Fragment as Fragment5,
|
|
2790
2863
|
useId as useId2,
|
|
2791
2864
|
useRef as useRef7,
|
|
2792
2865
|
useState as useState7,
|
|
@@ -3113,7 +3186,9 @@ function DocPlayerContent({
|
|
|
3113
3186
|
showCodeCopyButton = false,
|
|
3114
3187
|
onCopyCode,
|
|
3115
3188
|
fenceRenderers,
|
|
3116
|
-
tableContentRenderer
|
|
3189
|
+
tableContentRenderer,
|
|
3190
|
+
renderSlideshowControls,
|
|
3191
|
+
renderPlaybackControls
|
|
3117
3192
|
}) {
|
|
3118
3193
|
const isSlideshowMode = displayMode === "slideshow";
|
|
3119
3194
|
const isLinearMode = displayMode === "linear";
|
|
@@ -4363,7 +4438,7 @@ function DocPlayerContent({
|
|
|
4363
4438
|
hasCaptions && (() => {
|
|
4364
4439
|
const debugPhrase = getCaptionAtTime2(doc.captions, currentTime);
|
|
4365
4440
|
const debugEnabled = captionsEnabled && captionClockRunning;
|
|
4366
|
-
return /* @__PURE__ */ jsxs7(
|
|
4441
|
+
return /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
4367
4442
|
/* @__PURE__ */ jsxs7("div", { children: [
|
|
4368
4443
|
/* @__PURE__ */ jsx10("span", { style: { color: "#888" }, children: "captions:" }),
|
|
4369
4444
|
" ",
|
|
@@ -4436,8 +4511,9 @@ function DocPlayerContent({
|
|
|
4436
4511
|
}
|
|
4437
4512
|
),
|
|
4438
4513
|
!renderMode && !isSlideshowMode && showControls && /* @__PURE__ */ jsx10(
|
|
4439
|
-
|
|
4514
|
+
PlaybackControls,
|
|
4440
4515
|
{
|
|
4516
|
+
render: renderPlaybackControls,
|
|
4441
4517
|
state: playbackState,
|
|
4442
4518
|
actions: playbackActions,
|
|
4443
4519
|
blockMarkers,
|
|
@@ -4473,13 +4549,16 @@ function DocPlayerContent({
|
|
|
4473
4549
|
}
|
|
4474
4550
|
),
|
|
4475
4551
|
!renderMode && isSlideshowMode && showControls && /* @__PURE__ */ jsx10(
|
|
4476
|
-
|
|
4552
|
+
SlideshowControls,
|
|
4477
4553
|
{
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4554
|
+
controls: {
|
|
4555
|
+
state: playbackState,
|
|
4556
|
+
slideNav: stepNavActions,
|
|
4557
|
+
slides: slideshowPickerItems,
|
|
4558
|
+
pickerOpen: isSlideshowPickerOpen,
|
|
4559
|
+
onPickerOpenChange: setIsSlideshowPickerOpen
|
|
4560
|
+
},
|
|
4561
|
+
render: renderSlideshowControls
|
|
4483
4562
|
}
|
|
4484
4563
|
),
|
|
4485
4564
|
!isSlideshowMode && tapFeedback && /* @__PURE__ */ jsx10("div", { className: "doc-player__tap-feedback", children: /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 24 24", fill: "white", width: "48", height: "48", children: tapFeedback === "pause" ? /* @__PURE__ */ jsx10("path", { d: "M6 19h4V5H6v14zm8-14v14h4V5h-4z" }) : /* @__PURE__ */ jsx10("path", { d: "M8 5v14l11-7z" }) }) }, tapFeedback)
|
|
@@ -4722,6 +4801,7 @@ export {
|
|
|
4722
4801
|
CaptionOverlay,
|
|
4723
4802
|
formatTime,
|
|
4724
4803
|
DocProgressBar,
|
|
4804
|
+
PlayPauseIcon,
|
|
4725
4805
|
DocControlsOverlay,
|
|
4726
4806
|
DocControlsSlideshow,
|
|
4727
4807
|
decodeSvgImages,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { S as SquisqRenderAPI, V as VideoPresentation$1,
|
|
2
|
-
export { B as BlockMarker,
|
|
1
|
+
import { S as SquisqRenderAPI, P as PlaybackControlsProps, V as VideoPresentation$1, a as PipSize, b as PipShape, c as PipPosition } from './player-XTHVuSvh.js';
|
|
2
|
+
export { B as BlockMarker, d as BlockRenderer, C as CaptionMode, e as CaptionOverlay, f as CaptionPosition, g as CaptionStyle, h as ControlsLayout, D as DisplayMode, i as DocControlsBottom, j as DocControlsOverlay, k as DocControlsSidebar, l as DocControlsSlideshow, m as DocPlayer, n as DocPlayerProps, o as DocPlayerWithSidebar, p as DocProgressBar, F as FlashcardControls, q as FlashcardFaceView, r as FlashcardFaceViewProps, s as FlashcardRating, t as FlashcardView, u as FlashcardViewProps, I as InlineAudioPlayer, v as InlineAudioPlayerProps, w as InlineVideoPlayer, x as InlineVideoPlayerProps, M as MediaClipLayer, y as MediaClipLayerProps, z as PlaybackActions, A as PlaybackState, R as RenderAudioSegmentInfo, E as RenderBlockInfo, G as RenderCaptionInfo, H as RenderChapterInfo, J as RenderVideoFrameSelector, K as SlideNavActions, L as SlideshowControlsProps, N as SlideshowPickerItem, O as SocialCaptionOverlay, Q as formatTime } from './player-XTHVuSvh.js';
|
|
3
3
|
import { Theme, VideoPresentation, VideoPipSize, VideoPipShape, VideoPipPosition, MotionSpec, Doc, MediaProvider, ScheduledClip, Block, BuildCursor } from '@bendyline/squisq/schemas';
|
|
4
4
|
import { DashboardStyleId, ViewportConfig, CoverSlideTemplate, CoverSlidePlayback } from '@bendyline/squisq/doc';
|
|
5
5
|
export { getAnimationStyle, getTransitionClass } from '@bendyline/squisq/doc';
|
|
6
6
|
import { C as CodeBlockCopyHandler } from './MarkdownRenderer-C63CQ9Ca.js';
|
|
7
7
|
export { a as CodeBlockCopyContext, M as MarkdownRenderer, b as MarkdownRendererProps } from './MarkdownRenderer-C63CQ9Ca.js';
|
|
8
|
-
export { FenceRendererContext, MermaidDiagram, MermaidDiagramProps, VideoEmbedFrame, VideoEmbedFrameProps, useFenceRenderers } from './markdown/index.js';
|
|
9
|
-
export { CanvasSection, CanvasSectionProps, ImageDisplayMode, LinearDocView, LinearDocViewProps, PageSectionView, PageSectionViewProps, PageViewContext, PageViewContextValue, PaginatedDocPage, PaginatedDocView, PaginatedDocViewProps, usePageView } from './page/index.js';
|
|
10
8
|
import * as react from 'react';
|
|
11
9
|
import { ReactNode, RefObject, CSSProperties } from 'react';
|
|
10
|
+
export { FenceRendererContext, MermaidDiagram, MermaidDiagramProps, VideoEmbedFrame, VideoEmbedFrameProps, useFenceRenderers } from './markdown/index.js';
|
|
11
|
+
export { CanvasSection, CanvasSectionProps, ImageDisplayMode, LinearDocView, LinearDocViewProps, PageSectionView, PageSectionViewProps, PageViewContext, PageViewContextValue, PaginatedDocPage, PaginatedDocView, PaginatedDocViewProps, usePageView } from './page/index.js';
|
|
12
12
|
import { AnimatedImageInfo } from '@bendyline/squisq/imageEdit';
|
|
13
13
|
export { ImageLayer, MapLayer, MermaidLayer, PathLayer, ShapeLayer, SvgLayer, TextLayer, TreeLayer } from './layers/index.js';
|
|
14
14
|
export { T as TableLayer, a as TableLayerContentRenderer, b as TableLayerContentRendererProps, V as VideoLayer } from './VideoLayer-Bg3TRIOb.js';
|
|
@@ -145,6 +145,8 @@ interface SquisqPlayerHandle {
|
|
|
145
145
|
unmount(): void;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
declare function DocControlsCompact({ state, actions, blockMarkers, expandedBlocks, getBlockTitle, }: PlaybackControlsProps): react.JSX.Element;
|
|
149
|
+
|
|
148
150
|
/** Browser-only, lazy official Mermaid renderer shared by page and slide views. */
|
|
149
151
|
|
|
150
152
|
/**
|
|
@@ -414,4 +416,4 @@ declare function useBuildNavigation(block: Block | null | undefined, enabled: bo
|
|
|
414
416
|
showAll: () => void;
|
|
415
417
|
};
|
|
416
418
|
|
|
417
|
-
export { AnimatedImageControls, type AnimatedImageControlsProps, type AnimatedImagePlayback, type AnimatedImageStatus, CodeBlockCopyHandler, DashboardView, type DashboardViewProps, type DocPlayerAppearanceOverrides, type MountOptions, PipPosition, PipShape, PipSize, type ResolvedDocPlayerAppearance, type SanitizedSvgImageOptions, type SquisqPlayerHandle, SquisqRenderAPI, SvgIslandImage, type SvgIslandImageProps, type VideoDurationProbeOptions, VideoPresentation$1 as VideoPresentation, applyMediaLevel, decodeSvgImages, isLocalSvgUrl, mediaCropStyle, probeVideoDurations, recipeLevelAt, resolveDocPlayerAppearance, resolveVideoDurations, sanitizedSvgImageUrl, useAnimatedImage, useBuildNavigation, useCutTimeMap, useMediaClipDurations, useSanitizedSvgImage, useSkipCuts, useVideoDurations, withMermaidLabelWrapping };
|
|
419
|
+
export { AnimatedImageControls, type AnimatedImageControlsProps, type AnimatedImagePlayback, type AnimatedImageStatus, CodeBlockCopyHandler, DashboardView, type DashboardViewProps, DocControlsCompact, type DocPlayerAppearanceOverrides, type MountOptions, PipPosition, PipShape, PipSize, PlaybackControlsProps, type ResolvedDocPlayerAppearance, type SanitizedSvgImageOptions, type SquisqPlayerHandle, SquisqRenderAPI, SvgIslandImage, type SvgIslandImageProps, type VideoDurationProbeOptions, VideoPresentation$1 as VideoPresentation, applyMediaLevel, decodeSvgImages, isLocalSvgUrl, mediaCropStyle, probeVideoDurations, recipeLevelAt, resolveDocPlayerAppearance, resolveVideoDurations, sanitizedSvgImageUrl, useAnimatedImage, useBuildNavigation, useCutTimeMap, useMediaClipDurations, useSanitizedSvgImage, useSkipCuts, useVideoDurations, withMermaidLabelWrapping };
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
FlashcardFaceView,
|
|
12
12
|
FlashcardView,
|
|
13
13
|
MediaClipLayer,
|
|
14
|
+
PlayPauseIcon,
|
|
14
15
|
SocialCaptionOverlay,
|
|
15
16
|
decodeSvgImages,
|
|
16
17
|
formatTime,
|
|
@@ -20,7 +21,7 @@ import {
|
|
|
20
21
|
useBuildNavigation,
|
|
21
22
|
useMediaClipDurations,
|
|
22
23
|
useVideoDurations
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-MPOU5JC4.js";
|
|
24
25
|
import {
|
|
25
26
|
PaginatedDocView
|
|
26
27
|
} from "./chunk-GIRDBU3E.js";
|
|
@@ -97,6 +98,167 @@ import {
|
|
|
97
98
|
useSanitizedSvgImage,
|
|
98
99
|
withMermaidLabelWrapping
|
|
99
100
|
} from "./chunk-ZKMBIWAA.js";
|
|
101
|
+
|
|
102
|
+
// src/DocControlsCompact.tsx
|
|
103
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
104
|
+
var CONTROL_SIZE = "var(--squisq-player-control-size, 22px)";
|
|
105
|
+
var BUTTON = {
|
|
106
|
+
display: "inline-flex",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
justifyContent: "center",
|
|
109
|
+
flex: "none",
|
|
110
|
+
minWidth: CONTROL_SIZE,
|
|
111
|
+
height: CONTROL_SIZE,
|
|
112
|
+
padding: "0 3px",
|
|
113
|
+
border: "none",
|
|
114
|
+
borderRadius: 4,
|
|
115
|
+
background: "var(--squisq-player-button-bg, none)",
|
|
116
|
+
color: "inherit",
|
|
117
|
+
font: "inherit",
|
|
118
|
+
cursor: "pointer"
|
|
119
|
+
};
|
|
120
|
+
var PLAY = {
|
|
121
|
+
...BUTTON,
|
|
122
|
+
width: CONTROL_SIZE,
|
|
123
|
+
padding: 0,
|
|
124
|
+
borderRadius: "50%",
|
|
125
|
+
background: "var(--squisq-player-accent, #5b9bd5)",
|
|
126
|
+
color: "var(--squisq-player-on-accent, #fff)"
|
|
127
|
+
};
|
|
128
|
+
function Readout({ className, text, widest }) {
|
|
129
|
+
return /* @__PURE__ */ jsxs(
|
|
130
|
+
"span",
|
|
131
|
+
{
|
|
132
|
+
className,
|
|
133
|
+
style: {
|
|
134
|
+
display: "inline-grid",
|
|
135
|
+
flex: "none",
|
|
136
|
+
justifyItems: "center",
|
|
137
|
+
fontVariantNumeric: "tabular-nums",
|
|
138
|
+
whiteSpace: "nowrap"
|
|
139
|
+
},
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ jsx("span", { style: { gridArea: "1 / 1" }, children: text }),
|
|
142
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { gridArea: "1 / 1", visibility: "hidden" }, children: widest })
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
function DocControlsCompact({
|
|
148
|
+
state,
|
|
149
|
+
actions,
|
|
150
|
+
blockMarkers,
|
|
151
|
+
expandedBlocks,
|
|
152
|
+
getBlockTitle
|
|
153
|
+
}) {
|
|
154
|
+
const total = formatTime(state.totalDuration);
|
|
155
|
+
const buffering = state.isPlaying && state.isBuffering;
|
|
156
|
+
const captionTitle = state.captionMode === "off" ? "Captions: Off (click for Standard)" : state.captionMode === "standard" ? "Captions: Standard (click for Social)" : "Captions: Social (click to turn off)";
|
|
157
|
+
return /* @__PURE__ */ jsxs(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
className: "doc-controls-compact",
|
|
161
|
+
role: "group",
|
|
162
|
+
"aria-label": "Playback controls",
|
|
163
|
+
"data-testid": "playback-controls-compact",
|
|
164
|
+
style: {
|
|
165
|
+
display: "flex",
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
gap: 6,
|
|
168
|
+
minWidth: 0,
|
|
169
|
+
minHeight: 24,
|
|
170
|
+
fontSize: 12
|
|
171
|
+
},
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
"button",
|
|
175
|
+
{
|
|
176
|
+
type: "button",
|
|
177
|
+
className: "doc-controls-compact__button doc-controls-compact__play",
|
|
178
|
+
onClick: actions.toggle,
|
|
179
|
+
"aria-label": state.isPlaying ? "Pause" : "Play",
|
|
180
|
+
"aria-busy": buffering ? true : void 0,
|
|
181
|
+
title: buffering ? "Loading audio\u2026" : state.isPlaying ? "Pause" : "Play",
|
|
182
|
+
style: PLAY,
|
|
183
|
+
children: /* @__PURE__ */ jsx(PlayPauseIcon, { isPlaying: state.isPlaying, isBuffering: state.isBuffering, size: 14 })
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ jsx(
|
|
187
|
+
"button",
|
|
188
|
+
{
|
|
189
|
+
type: "button",
|
|
190
|
+
className: "doc-controls-compact__button",
|
|
191
|
+
onClick: actions.restart,
|
|
192
|
+
"aria-label": "Restart from beginning",
|
|
193
|
+
title: "Restart",
|
|
194
|
+
style: BUTTON,
|
|
195
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "15", height: "15", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z" }) })
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ jsx(
|
|
199
|
+
Readout,
|
|
200
|
+
{
|
|
201
|
+
className: "doc-controls-compact__time",
|
|
202
|
+
text: `${formatTime(state.currentTime)} / ${total}`,
|
|
203
|
+
widest: `${total} / ${total}`
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
/* @__PURE__ */ jsx("div", { style: { flex: "1 1 auto", minWidth: 48, display: "flex", padding: "0 6px" }, children: /* @__PURE__ */ jsx(
|
|
207
|
+
DocProgressBar,
|
|
208
|
+
{
|
|
209
|
+
variant: "inline",
|
|
210
|
+
state,
|
|
211
|
+
actions,
|
|
212
|
+
blockMarkers,
|
|
213
|
+
expandedBlocks,
|
|
214
|
+
getBlockTitle
|
|
215
|
+
}
|
|
216
|
+
) }),
|
|
217
|
+
/* @__PURE__ */ jsx(
|
|
218
|
+
Readout,
|
|
219
|
+
{
|
|
220
|
+
className: "doc-controls-compact__counter",
|
|
221
|
+
text: `${state.currentBlockIndex + 1}/${state.totalBlocks}`,
|
|
222
|
+
widest: `${state.totalBlocks}/${state.totalBlocks}`
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
state.hasCaptions && /* @__PURE__ */ jsxs(
|
|
226
|
+
"button",
|
|
227
|
+
{
|
|
228
|
+
type: "button",
|
|
229
|
+
className: "doc-controls-compact__button",
|
|
230
|
+
onClick: () => actions.cycleCaptionMode(),
|
|
231
|
+
"aria-label": "Cycle caption style",
|
|
232
|
+
"aria-pressed": state.captionMode !== "off",
|
|
233
|
+
title: captionTitle,
|
|
234
|
+
style: { ...BUTTON, opacity: state.captionMode === "off" ? 0.6 : 1 },
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "16", height: "16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M19 4H5a2 2 0 00-2 2v12a2 2 0 002 2h14a2 2 0 002-2V6a2 2 0 00-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-4a1 1 0 011-1h3a1 1 0 011 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1a1 1 0 01-1 1h-3a1 1 0 01-1-1v-4a1 1 0 011-1h3a1 1 0 011 1v1z" }) }),
|
|
237
|
+
state.captionMode !== "off" && /* @__PURE__ */ jsx("span", { style: { marginLeft: 2, fontSize: 10, letterSpacing: "0.04em" }, children: state.captionMode === "standard" ? "CC" : "SM" })
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
actions.toggleFullscreen && /* @__PURE__ */ jsx(
|
|
242
|
+
"button",
|
|
243
|
+
{
|
|
244
|
+
type: "button",
|
|
245
|
+
className: "doc-controls-compact__button",
|
|
246
|
+
onClick: actions.toggleFullscreen,
|
|
247
|
+
"aria-label": state.isFullscreen ? "Exit fullscreen" : "Enter fullscreen",
|
|
248
|
+
title: state.isFullscreen ? "Exit fullscreen (F)" : "Fullscreen (F)",
|
|
249
|
+
style: BUTTON,
|
|
250
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "16", height: "16", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
251
|
+
"path",
|
|
252
|
+
{
|
|
253
|
+
d: state.isFullscreen ? "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" : "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"
|
|
254
|
+
}
|
|
255
|
+
) })
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
100
262
|
export {
|
|
101
263
|
AnimatedImageControls,
|
|
102
264
|
BlockRenderer,
|
|
@@ -104,6 +266,7 @@ export {
|
|
|
104
266
|
CaptionOverlay,
|
|
105
267
|
DashboardView,
|
|
106
268
|
DocControlsBottom,
|
|
269
|
+
DocControlsCompact,
|
|
107
270
|
DocControlsOverlay,
|
|
108
271
|
DocControlsSidebar,
|
|
109
272
|
DocControlsSlideshow,
|