@bendyline/squisq-react 2.12.34 → 2.12.36

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.
@@ -1,12 +1,137 @@
1
1
  import * as react from 'react';
2
- import { CSSProperties } from 'react';
3
- import { Block, VideoPresentation as VideoPresentation$1, VideoPipSize, VideoPipShape, VideoPipPosition, Doc, MediaScheduleOptions, Theme, MotionSpec, SurfaceScheme, BuildCursor, Transition, CaptionTrack, ViewportConfig as ViewportConfig$1, CustomTemplateDefinition, MediaEdits, ScheduledClip } from '@bendyline/squisq/schemas';
4
- import { ViewportConfig, DashboardStyleId, CoverSlideTemplate, CoverSlidePlayback, FlashcardFace, FlashcardSourceMode } from '@bendyline/squisq/doc';
2
+ import { ReactNode, CSSProperties } from 'react';
3
+ import { Doc, Theme, ViewportConfig, CustomTemplateDefinition, Block, VideoPresentation as VideoPresentation$1, VideoPipSize, VideoPipShape, VideoPipPosition, MediaScheduleOptions, MotionSpec, SurfaceScheme, BuildCursor, Transition, CaptionTrack, MediaEdits, ScheduledClip } from '@bendyline/squisq/schemas';
4
+ import { FlashcardSourceMode, Flashcard, FlashcardKind, FlashcardFace, ViewportConfig as ViewportConfig$1, DashboardStyleId, CoverSlideTemplate, CoverSlidePlayback } from '@bendyline/squisq/doc';
5
5
  import { FenceRendererMap } from '@bendyline/squisq/fence';
6
- import { a as AudioController } from './AudioController-DAwQyEM_.js';
7
6
  import { C as CodeBlockCopyHandler } from './MarkdownRenderer-C63CQ9Ca.js';
7
+ import { a as AudioController } from './AudioController-DAwQyEM_.js';
8
8
  import { a as TableLayerContentRenderer, c as VideoClipMode } from './VideoLayer-Bg3TRIOb.js';
9
9
 
10
+ interface FlashcardViewProps {
11
+ doc: Doc;
12
+ theme?: Theme;
13
+ basePath?: string;
14
+ source?: FlashcardSourceMode;
15
+ /** Start the deck in shuffled order (default false). */
16
+ shuffle?: boolean;
17
+ /** Capture shortcuts without requiring focus (default false). */
18
+ globalKeyboardShortcuts?: boolean;
19
+ showCodeCopyButton?: boolean;
20
+ onCopyCode?: CodeBlockCopyHandler;
21
+ fenceRenderers?: FenceRendererMap;
22
+ /** Viewport used to materialize diagrams and other spatial content. */
23
+ viewport?: ViewportConfig;
24
+ /**
25
+ * `compact` puts the title, position, and every control in one toolbar
26
+ * above a card with smaller type — for a deck embedded in a dialog or
27
+ * panel rather than given a page of its own. Default: 'comfortable'.
28
+ */
29
+ density?: 'comfortable' | 'compact';
30
+ className?: string;
31
+ /**
32
+ * Draws the deck's controls — Shuffle, Restart, Previous, the position and
33
+ * progress, and the card's actions (Reveal, or Again and Next) — in place of
34
+ * the deck's own, typically portaled into the host's chrome, as the editor's
35
+ * status bar does. The card then takes the height the controls used. Called
36
+ * on every change while the deck has cards; the end-of-session summary keeps
37
+ * its Retry missed and Study again buttons, which are that screen's content.
38
+ */
39
+ renderControls?: (controls: FlashcardControls) => ReactNode;
40
+ /** Study only these kinds of card (default: every kind). */
41
+ kinds?: readonly FlashcardKind[];
42
+ /** A basic card was rated. */
43
+ onRate?: (event: FlashcardRateEvent) => void;
44
+ /** A multiple-choice card was answered, or its answer shown unchosen (`choiceId` null). */
45
+ onAnswer?: (event: FlashcardAnswerEvent) => void;
46
+ /** The last card of a session was passed and the summary shows. */
47
+ onComplete?: (event: FlashcardCompleteEvent) => void;
48
+ }
49
+ /** How a person rates a basic card once its answer shows. */
50
+ type FlashcardRating = 'again' | 'got-it';
51
+ /**
52
+ * The card an event is about. `id` lasts: a study card's key stays the same
53
+ * when cards are reordered, moved or their answers fixed, so a host can keep
54
+ * progress against it.
55
+ */
56
+ interface FlashcardCardRef {
57
+ id: string;
58
+ kind: FlashcardKind;
59
+ sourceBlockId: string;
60
+ ownerBlockId?: string;
61
+ }
62
+ interface FlashcardRateEvent {
63
+ card: FlashcardCardRef;
64
+ rating: FlashcardRating;
65
+ /** Rated while retrying the missed cards. */
66
+ retry: boolean;
67
+ }
68
+ interface FlashcardAnswerEvent {
69
+ card: FlashcardCardRef;
70
+ /** The choice picked, or null when the answer was shown without one (counted as missed). */
71
+ choiceId: string | null;
72
+ correct: boolean;
73
+ retry: boolean;
74
+ }
75
+ interface FlashcardCompleteEvent {
76
+ /** Every card of the session with how it went (null when passed without a rating). */
77
+ results: Array<{
78
+ card: FlashcardCardRef;
79
+ rating: FlashcardRating | null;
80
+ }>;
81
+ remembered: number;
82
+ missed: number;
83
+ total: number;
84
+ retry: boolean;
85
+ }
86
+ /** What a host's flashcard controls draw from (`FlashcardView`'s `renderControls`). */
87
+ interface FlashcardControls {
88
+ /** The card on screen, 0-based in this session; `cardCount` once finished. */
89
+ cardIndex: number;
90
+ /** Cards in this session — only the missed ones while retrying. */
91
+ cardCount: number;
92
+ /** The card's answer is showing. */
93
+ revealed: boolean;
94
+ /** Every card is done and the summary is showing. */
95
+ finished: boolean;
96
+ /** The card on screen's kind; undefined once finished. */
97
+ cardKind?: Flashcard['kind'];
98
+ /** The card on screen is the session's last. */
99
+ lastCard: boolean;
100
+ /** How far through the session, 0–1 (a revealed answer counts its card). */
101
+ progress: number;
102
+ /** The cards are shuffled. */
103
+ shuffled: boolean;
104
+ /** Cards rated "Again" so far. */
105
+ missedCount: number;
106
+ /** Previous has somewhere to go. */
107
+ canGoBack: boolean;
108
+ /** Hide the answer, or go back a card (from the summary, to the last card). */
109
+ previous: () => void;
110
+ /** Reveal the answer, or — once it shows — go on without rating the card. */
111
+ next: () => void;
112
+ /** Rate a basic card whose answer shows, and go on. */
113
+ rate: (rating: FlashcardRating) => void;
114
+ /** Shuffle the cards, or put them back in order, and start over. */
115
+ toggleShuffle: () => void;
116
+ /** Start the session over. */
117
+ restart: () => void;
118
+ /** Study only the cards rated "Again". */
119
+ retryMissed: () => void;
120
+ }
121
+ interface FlashcardFaceViewProps {
122
+ face: FlashcardFace;
123
+ theme: Theme;
124
+ basePath: string;
125
+ showCodeCopyButton: boolean;
126
+ onCopyCode?: CodeBlockCopyHandler;
127
+ fenceRenderers?: FenceRendererMap;
128
+ viewport?: ViewportConfig;
129
+ customTemplates?: readonly CustomTemplateDefinition[];
130
+ }
131
+ /** Rich, theme-aware renderer for one materialized flashcard face. */
132
+ declare function FlashcardFaceView(props: FlashcardFaceViewProps): react.JSX.Element;
133
+ declare function FlashcardView({ doc, theme, basePath, source, shuffle: initialShuffle, globalKeyboardShortcuts, showCodeCopyButton, onCopyCode, fenceRenderers, viewport, density, className, renderControls, kinds, onRate, onAnswer, onComplete, }: FlashcardViewProps): react.JSX.Element;
134
+
10
135
  /**
11
136
  * Doc Player Control Types
12
137
  *
@@ -223,6 +348,46 @@ type RenderVideoFrameSelector = (video: HTMLVideoElement, targetTime: number) =>
223
348
  /** Format time in seconds to MM:SS string */
224
349
  declare function formatTime(seconds: number): string;
225
350
 
351
+ interface SlideshowPickerItem {
352
+ /** Stable identifier for the slide/block. */
353
+ id: string;
354
+ /** Human-facing slide number, or a special label such as "Cover". */
355
+ label: string;
356
+ /** Short description shown in the slide picker. */
357
+ summary: string;
358
+ }
359
+ /**
360
+ * What slideshow controls draw from: the overlay pill here, or a host's own
361
+ * through DocPlayer's `renderSlideshowControls`.
362
+ */
363
+ interface SlideshowControlsProps {
364
+ state: PlaybackState;
365
+ slideNav: SlideNavActions;
366
+ /** Slides available for direct navigation from the counter popover. */
367
+ slides?: readonly SlideshowPickerItem[];
368
+ /** Controlled open state for hosts that expose their own picker shortcut. */
369
+ pickerOpen?: boolean;
370
+ /** Called whenever the slide picker should open or close. */
371
+ onPickerOpenChange?: (open: boolean) => void;
372
+ }
373
+ declare function DocControlsSlideshow({ state, slideNav, slides, pickerOpen, onPickerOpenChange, }: SlideshowControlsProps): react.JSX.Element;
374
+
375
+ /**
376
+ * What playback controls draw from: the overlay here, DocControlsCompact, or
377
+ * a host's own through DocPlayer's `renderPlaybackControls`.
378
+ */
379
+ interface PlaybackControlsProps {
380
+ state: PlaybackState;
381
+ actions: PlaybackActions;
382
+ blockMarkers: BlockMarker[];
383
+ expandedBlocks: Block[];
384
+ getBlockTitle?: (block: Block) => string;
385
+ }
386
+ declare function DocControlsOverlay({ state, actions, blockMarkers, expandedBlocks, getBlockTitle, }: PlaybackControlsProps): react.JSX.Element;
387
+
388
+ /** `DocPlayer`'s flashcards-mode options (see `FlashcardView`). */
389
+ type DocPlayerFlashcardOptions = Pick<FlashcardViewProps, 'source' | 'kinds' | 'shuffle' | 'onAnswer' | 'onRate' | 'onComplete'>;
390
+
226
391
  interface DocPlayerProps {
227
392
  /** The Doc to play. Wins over `markdown` when both are provided. */
228
393
  doc?: Doc;
@@ -272,7 +437,7 @@ interface DocPlayerProps {
272
437
  isFullscreen?: boolean;
273
438
  onFullscreenToggle?: () => void;
274
439
  onBlockMarkers?: (markers: BlockMarker[]) => void;
275
- forceViewport?: ViewportConfig;
440
+ forceViewport?: ViewportConfig$1;
276
441
  theme?: Theme;
277
442
  /**
278
443
  * Motion profile override (`calm` | `documentary` | `vibrant`, or a spec
@@ -283,6 +448,11 @@ interface DocPlayerProps {
283
448
  surface?: SurfaceScheme | 'auto';
284
449
  /** Video, slideshow, page, dashboard, or flashcards rendition. */
285
450
  displayMode?: DisplayMode;
451
+ /**
452
+ * Flashcards mode: where the cards come from, which kinds, shuffled or not,
453
+ * and what to tell the host as each card is studied.
454
+ */
455
+ flashcards?: DocPlayerFlashcardOptions;
286
456
  /** Dashboard mode: layout id or `'auto'`. Overrides doc frontmatter. */
287
457
  dashboardLayout?: string;
288
458
  /** Dashboard mode: title-band override. Overrides doc frontmatter. */
@@ -331,6 +501,24 @@ interface DocPlayerProps {
331
501
  fenceRenderers?: FenceRendererMap;
332
502
  /** Optional host renderer for interactive table-layer content. */
333
503
  tableContentRenderer?: TableLayerContentRenderer;
504
+ /**
505
+ * Slideshow mode: draws the slide navigation (previous / counter / next,
506
+ * the slide picker, build steps) in place of the player's own overlay
507
+ * pill — typically portaled into the host's chrome, as the editor's status
508
+ * bar does. Called on every playback change with the same state and
509
+ * actions the pill gets; return null to show no controls. Ignored outside
510
+ * slideshow mode, in render mode, and when `showControls` is false.
511
+ */
512
+ renderSlideshowControls?: (controls: SlideshowControlsProps) => ReactNode;
513
+ /**
514
+ * Video mode: draws the playback controls (play/pause, restart, time, the
515
+ * timeline, captions) in place of the overlay over the video — typically
516
+ * DocControlsCompact portaled into the host's chrome, as the editor's status
517
+ * bar does. Called on every playback change with the state and actions the
518
+ * overlay gets; return null to show no controls. Ignored in slideshow mode,
519
+ * in render mode, and when `showControls` is false.
520
+ */
521
+ renderPlaybackControls?: (controls: PlaybackControlsProps) => ReactNode;
334
522
  }
335
523
 
336
524
  /**
@@ -435,7 +623,7 @@ interface CaptionOverlayProps {
435
623
  /** Theme for social-style caption colors and fonts */
436
624
  theme?: Theme;
437
625
  /** Viewport config for social-style font scaling */
438
- viewport?: ViewportConfig$1;
626
+ viewport?: ViewportConfig;
439
627
  }
440
628
  declare function CaptionOverlay({ captions, currentTime, enabled, fontSize, captionStyle, captionPosition, theme, viewport, }: CaptionOverlayProps): react.JSX.Element;
441
629
 
@@ -444,21 +632,12 @@ interface SocialCaptionOverlayProps {
444
632
  currentTime: number;
445
633
  enabled?: boolean;
446
634
  theme?: Theme;
447
- viewport?: ViewportConfig$1;
635
+ viewport?: ViewportConfig;
448
636
  /** Frame placement (default `'bottom'`). */
449
637
  position?: CaptionPosition;
450
638
  }
451
639
  declare function SocialCaptionOverlay({ captions, currentTime, enabled, theme, viewport, position, }: SocialCaptionOverlayProps): react.JSX.Element | null;
452
640
 
453
- interface DocControlsOverlayProps {
454
- state: PlaybackState;
455
- actions: PlaybackActions;
456
- blockMarkers: BlockMarker[];
457
- expandedBlocks: Block[];
458
- getBlockTitle?: (block: Block) => string;
459
- }
460
- declare function DocControlsOverlay({ state, actions, blockMarkers, expandedBlocks, getBlockTitle, }: DocControlsOverlayProps): react.JSX.Element;
461
-
462
641
  interface DocControlsBottomProps {
463
642
  state: PlaybackState;
464
643
  actions: PlaybackActions;
@@ -474,26 +653,6 @@ interface DocControlsSidebarProps {
474
653
  }
475
654
  declare function DocControlsSidebar({ state, actions }: DocControlsSidebarProps): react.JSX.Element;
476
655
 
477
- interface SlideshowPickerItem {
478
- /** Stable identifier for the slide/block. */
479
- id: string;
480
- /** Human-facing slide number, or a special label such as "Cover". */
481
- label: string;
482
- /** Short description shown in the slide picker. */
483
- summary: string;
484
- }
485
- interface DocControlsSlideshowProps {
486
- state: PlaybackState;
487
- slideNav: SlideNavActions;
488
- /** Slides available for direct navigation from the counter popover. */
489
- slides?: readonly SlideshowPickerItem[];
490
- /** Controlled open state for hosts that expose their own picker shortcut. */
491
- pickerOpen?: boolean;
492
- /** Called whenever the slide picker should open or close. */
493
- onPickerOpenChange?: (open: boolean) => void;
494
- }
495
- declare function DocControlsSlideshow({ state, slideNav, slides, pickerOpen, onPickerOpenChange, }: DocControlsSlideshowProps): react.JSX.Element;
496
-
497
656
  interface DocPlayerWithSidebarProps {
498
657
  /** The Doc to play */
499
658
  doc: Doc;
@@ -513,7 +672,7 @@ interface DocPlayerWithSidebarProps {
513
672
  isFullscreen?: boolean;
514
673
  onFullscreenToggle?: () => void;
515
674
  /** Force a specific viewport preset, bypassing window-based orientation detection. */
516
- forceViewport?: ViewportConfig$1;
675
+ forceViewport?: ViewportConfig;
517
676
  /** Called when playing state changes */
518
677
  onPlayingChange?: (isPlaying: boolean) => void;
519
678
  /**
@@ -534,44 +693,10 @@ interface DocProgressBarProps {
534
693
  expandedBlocks: Block[];
535
694
  /** Optional: get block title for hover tooltip */
536
695
  getBlockTitle?: (block: Block) => string;
696
+ /** `overlay` (default): white, over the video. `inline`: compact, in the host's colors. */
697
+ variant?: 'overlay' | 'inline';
537
698
  }
538
- declare function DocProgressBar({ state, actions, blockMarkers, expandedBlocks, getBlockTitle, }: DocProgressBarProps): react.JSX.Element;
539
-
540
- interface FlashcardViewProps {
541
- doc: Doc;
542
- theme?: Theme;
543
- basePath?: string;
544
- source?: FlashcardSourceMode;
545
- /** Start the deck in shuffled order (default false). */
546
- shuffle?: boolean;
547
- /** Capture shortcuts without requiring focus (default false). */
548
- globalKeyboardShortcuts?: boolean;
549
- showCodeCopyButton?: boolean;
550
- onCopyCode?: CodeBlockCopyHandler;
551
- fenceRenderers?: FenceRendererMap;
552
- /** Viewport used to materialize diagrams and other spatial content. */
553
- viewport?: ViewportConfig$1;
554
- /**
555
- * `compact` puts the title, position, and every control in one toolbar
556
- * above a card with smaller type — for a deck embedded in a dialog or
557
- * panel rather than given a page of its own. Default: 'comfortable'.
558
- */
559
- density?: 'comfortable' | 'compact';
560
- className?: string;
561
- }
562
- interface FlashcardFaceViewProps {
563
- face: FlashcardFace;
564
- theme: Theme;
565
- basePath: string;
566
- showCodeCopyButton: boolean;
567
- onCopyCode?: CodeBlockCopyHandler;
568
- fenceRenderers?: FenceRendererMap;
569
- viewport?: ViewportConfig$1;
570
- customTemplates?: readonly CustomTemplateDefinition[];
571
- }
572
- /** Rich, theme-aware renderer for one materialized flashcard face. */
573
- declare function FlashcardFaceView(props: FlashcardFaceViewProps): react.JSX.Element;
574
- declare function FlashcardView({ doc, theme, basePath, source, shuffle: initialShuffle, globalKeyboardShortcuts, showCodeCopyButton, onCopyCode, fenceRenderers, viewport, density, className, }: FlashcardViewProps): react.JSX.Element;
699
+ declare function DocProgressBar({ state, actions, blockMarkers, expandedBlocks, getBlockTitle, variant, }: DocProgressBarProps): react.JSX.Element;
575
700
 
576
701
  interface InlineVideoPlayerProps {
577
702
  /** Source path — resolved through MediaContext when relative. */
@@ -643,4 +768,4 @@ interface MediaClipLayerProps {
643
768
  }
644
769
  declare function MediaClipLayer({ schedule, currentTime, isPlaying, basePath, renderMode, muted, presentation, pipSize, pipShape, pipPosition, pipOrientation, pipFrameStyle, honorClipPresentation, }: MediaClipLayerProps): react.JSX.Element | null;
645
770
 
646
- export { type RenderChapterInfo as A, type BlockMarker as B, type CaptionMode as C, type DisplayMode as D, type RenderVideoFrameSelector as E, FlashcardFaceView as F, type SlideNavActions as G, SocialCaptionOverlay as H, InlineAudioPlayer as I, formatTime as J, MediaClipLayer as M, type PipSize as P, type RenderAudioSegmentInfo as R, type SquisqRenderAPI as S, type VideoPresentation as V, type PipShape as a, type PipPosition as b, BlockRenderer as c, CaptionOverlay as d, type CaptionPosition as e, type CaptionStyle as f, type ControlsLayout as g, DocControlsBottom as h, DocControlsOverlay as i, DocControlsSidebar as j, DocControlsSlideshow as k, DocPlayer as l, type DocPlayerProps as m, DocPlayerWithSidebar as n, DocProgressBar as o, type FlashcardFaceViewProps as p, FlashcardView as q, type FlashcardViewProps as r, type InlineAudioPlayerProps as s, InlineVideoPlayer as t, type InlineVideoPlayerProps as u, type MediaClipLayerProps as v, type PlaybackActions as w, type PlaybackState as x, type RenderBlockInfo as y, type RenderCaptionInfo as z };
771
+ export { type InlineAudioPlayerProps as A, type BlockMarker as B, type CaptionMode as C, type DocPlayerFlashcardOptions as D, InlineVideoPlayer as E, type FlashcardAnswerEvent as F, type InlineVideoPlayerProps as G, type MediaClipLayerProps as H, InlineAudioPlayer as I, type PlaybackActions as J, type PlaybackState as K, type RenderBlockInfo as L, MediaClipLayer as M, type RenderCaptionInfo as N, type RenderChapterInfo as O, type PlaybackControlsProps as P, type RenderVideoFrameSelector as Q, type RenderAudioSegmentInfo as R, type SquisqRenderAPI as S, type SlideNavActions as T, type SlideshowControlsProps as U, type VideoPresentation as V, type SlideshowPickerItem as W, SocialCaptionOverlay as X, formatTime as Y, type PipSize as a, type PipShape as b, type PipPosition as c, BlockRenderer as d, CaptionOverlay as e, type CaptionPosition as f, type CaptionStyle as g, type ControlsLayout as h, type DisplayMode as i, DocControlsBottom as j, DocControlsOverlay as k, DocControlsSidebar as l, DocControlsSlideshow as m, DocPlayer as n, type DocPlayerProps as o, DocPlayerWithSidebar as p, DocProgressBar as q, type FlashcardCardRef as r, type FlashcardCompleteEvent as s, type FlashcardControls as t, FlashcardFaceView as u, type FlashcardFaceViewProps as v, type FlashcardRateEvent as w, type FlashcardRating as x, FlashcardView as y, type FlashcardViewProps as z };