@bendyline/squisq-react 2.12.35 → 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
2
  import { ReactNode, 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, Flashcard, FlashcardFace, FlashcardSourceMode } from '@bendyline/squisq/doc';
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
  *
@@ -260,6 +385,9 @@ interface PlaybackControlsProps {
260
385
  }
261
386
  declare function DocControlsOverlay({ state, actions, blockMarkers, expandedBlocks, getBlockTitle, }: PlaybackControlsProps): react.JSX.Element;
262
387
 
388
+ /** `DocPlayer`'s flashcards-mode options (see `FlashcardView`). */
389
+ type DocPlayerFlashcardOptions = Pick<FlashcardViewProps, 'source' | 'kinds' | 'shuffle' | 'onAnswer' | 'onRate' | 'onComplete'>;
390
+
263
391
  interface DocPlayerProps {
264
392
  /** The Doc to play. Wins over `markdown` when both are provided. */
265
393
  doc?: Doc;
@@ -309,7 +437,7 @@ interface DocPlayerProps {
309
437
  isFullscreen?: boolean;
310
438
  onFullscreenToggle?: () => void;
311
439
  onBlockMarkers?: (markers: BlockMarker[]) => void;
312
- forceViewport?: ViewportConfig;
440
+ forceViewport?: ViewportConfig$1;
313
441
  theme?: Theme;
314
442
  /**
315
443
  * Motion profile override (`calm` | `documentary` | `vibrant`, or a spec
@@ -320,6 +448,11 @@ interface DocPlayerProps {
320
448
  surface?: SurfaceScheme | 'auto';
321
449
  /** Video, slideshow, page, dashboard, or flashcards rendition. */
322
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;
323
456
  /** Dashboard mode: layout id or `'auto'`. Overrides doc frontmatter. */
324
457
  dashboardLayout?: string;
325
458
  /** Dashboard mode: title-band override. Overrides doc frontmatter. */
@@ -490,7 +623,7 @@ interface CaptionOverlayProps {
490
623
  /** Theme for social-style caption colors and fonts */
491
624
  theme?: Theme;
492
625
  /** Viewport config for social-style font scaling */
493
- viewport?: ViewportConfig$1;
626
+ viewport?: ViewportConfig;
494
627
  }
495
628
  declare function CaptionOverlay({ captions, currentTime, enabled, fontSize, captionStyle, captionPosition, theme, viewport, }: CaptionOverlayProps): react.JSX.Element;
496
629
 
@@ -499,7 +632,7 @@ interface SocialCaptionOverlayProps {
499
632
  currentTime: number;
500
633
  enabled?: boolean;
501
634
  theme?: Theme;
502
- viewport?: ViewportConfig$1;
635
+ viewport?: ViewportConfig;
503
636
  /** Frame placement (default `'bottom'`). */
504
637
  position?: CaptionPosition;
505
638
  }
@@ -539,7 +672,7 @@ interface DocPlayerWithSidebarProps {
539
672
  isFullscreen?: boolean;
540
673
  onFullscreenToggle?: () => void;
541
674
  /** Force a specific viewport preset, bypassing window-based orientation detection. */
542
- forceViewport?: ViewportConfig$1;
675
+ forceViewport?: ViewportConfig;
543
676
  /** Called when playing state changes */
544
677
  onPlayingChange?: (isPlaying: boolean) => void;
545
678
  /**
@@ -565,88 +698,6 @@ interface DocProgressBarProps {
565
698
  }
566
699
  declare function DocProgressBar({ state, actions, blockMarkers, expandedBlocks, getBlockTitle, variant, }: DocProgressBarProps): react.JSX.Element;
567
700
 
568
- interface FlashcardViewProps {
569
- doc: Doc;
570
- theme?: Theme;
571
- basePath?: string;
572
- source?: FlashcardSourceMode;
573
- /** Start the deck in shuffled order (default false). */
574
- shuffle?: boolean;
575
- /** Capture shortcuts without requiring focus (default false). */
576
- globalKeyboardShortcuts?: boolean;
577
- showCodeCopyButton?: boolean;
578
- onCopyCode?: CodeBlockCopyHandler;
579
- fenceRenderers?: FenceRendererMap;
580
- /** Viewport used to materialize diagrams and other spatial content. */
581
- viewport?: ViewportConfig$1;
582
- /**
583
- * `compact` puts the title, position, and every control in one toolbar
584
- * above a card with smaller type — for a deck embedded in a dialog or
585
- * panel rather than given a page of its own. Default: 'comfortable'.
586
- */
587
- density?: 'comfortable' | 'compact';
588
- className?: string;
589
- /**
590
- * Draws the deck's controls — Shuffle, Restart, Previous, the position and
591
- * progress, and the card's actions (Reveal, or Again and Next) — in place of
592
- * the deck's own, typically portaled into the host's chrome, as the editor's
593
- * status bar does. The card then takes the height the controls used. Called
594
- * on every change while the deck has cards; the end-of-session summary keeps
595
- * its Retry missed and Study again buttons, which are that screen's content.
596
- */
597
- renderControls?: (controls: FlashcardControls) => ReactNode;
598
- }
599
- /** How a person rates a basic card once its answer shows. */
600
- type FlashcardRating = 'again' | 'got-it';
601
- /** What a host's flashcard controls draw from (`FlashcardView`'s `renderControls`). */
602
- interface FlashcardControls {
603
- /** The card on screen, 0-based in this session; `cardCount` once finished. */
604
- cardIndex: number;
605
- /** Cards in this session — only the missed ones while retrying. */
606
- cardCount: number;
607
- /** The card's answer is showing. */
608
- revealed: boolean;
609
- /** Every card is done and the summary is showing. */
610
- finished: boolean;
611
- /** The card on screen's kind; undefined once finished. */
612
- cardKind?: Flashcard['kind'];
613
- /** The card on screen is the session's last. */
614
- lastCard: boolean;
615
- /** How far through the session, 0–1 (a revealed answer counts its card). */
616
- progress: number;
617
- /** The cards are shuffled. */
618
- shuffled: boolean;
619
- /** Cards rated "Again" so far. */
620
- missedCount: number;
621
- /** Previous has somewhere to go. */
622
- canGoBack: boolean;
623
- /** Hide the answer, or go back a card (from the summary, to the last card). */
624
- previous: () => void;
625
- /** Reveal the answer, or — once it shows — go on without rating the card. */
626
- next: () => void;
627
- /** Rate a basic card whose answer shows, and go on. */
628
- rate: (rating: FlashcardRating) => void;
629
- /** Shuffle the cards, or put them back in order, and start over. */
630
- toggleShuffle: () => void;
631
- /** Start the session over. */
632
- restart: () => void;
633
- /** Study only the cards rated "Again". */
634
- retryMissed: () => void;
635
- }
636
- interface FlashcardFaceViewProps {
637
- face: FlashcardFace;
638
- theme: Theme;
639
- basePath: string;
640
- showCodeCopyButton: boolean;
641
- onCopyCode?: CodeBlockCopyHandler;
642
- fenceRenderers?: FenceRendererMap;
643
- viewport?: ViewportConfig$1;
644
- customTemplates?: readonly CustomTemplateDefinition[];
645
- }
646
- /** Rich, theme-aware renderer for one materialized flashcard face. */
647
- declare function FlashcardFaceView(props: FlashcardFaceViewProps): react.JSX.Element;
648
- declare function FlashcardView({ doc, theme, basePath, source, shuffle: initialShuffle, globalKeyboardShortcuts, showCodeCopyButton, onCopyCode, fenceRenderers, viewport, density, className, renderControls, }: FlashcardViewProps): react.JSX.Element;
649
-
650
701
  interface InlineVideoPlayerProps {
651
702
  /** Source path — resolved through MediaContext when relative. */
652
703
  src: string;
@@ -717,4 +768,4 @@ interface MediaClipLayerProps {
717
768
  }
718
769
  declare function MediaClipLayer({ schedule, currentTime, isPlaying, basePath, renderMode, muted, presentation, pipSize, pipShape, pipPosition, pipOrientation, pipFrameStyle, honorClipPresentation, }: MediaClipLayerProps): react.JSX.Element | null;
719
770
 
720
- export { type PlaybackState as A, type BlockMarker as B, type CaptionMode as C, type DisplayMode as D, type RenderBlockInfo as E, type FlashcardControls as F, type RenderCaptionInfo as G, type RenderChapterInfo as H, InlineAudioPlayer as I, type RenderVideoFrameSelector as J, type SlideNavActions as K, type SlideshowControlsProps as L, MediaClipLayer as M, type SlideshowPickerItem as N, SocialCaptionOverlay as O, type PlaybackControlsProps as P, formatTime as Q, type RenderAudioSegmentInfo as R, type SquisqRenderAPI as S, type VideoPresentation as V, 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, DocControlsBottom as i, DocControlsOverlay as j, DocControlsSidebar as k, DocControlsSlideshow as l, DocPlayer as m, type DocPlayerProps as n, DocPlayerWithSidebar as o, DocProgressBar as p, FlashcardFaceView as q, type FlashcardFaceViewProps as r, type FlashcardRating as s, FlashcardView as t, type FlashcardViewProps as u, type InlineAudioPlayerProps as v, InlineVideoPlayer as w, type InlineVideoPlayerProps as x, type MediaClipLayerProps as y, type PlaybackActions 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 };