@bendyline/squisq-react 2.7.2 → 2.9.0

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.
@@ -593,7 +593,8 @@ function RichTextLayer({ layer, viewport, blockTime }) {
593
593
  ...animStyle.style
594
594
  };
595
595
  const cls = `squisq-rich-text-${cssId(layer.id)}`;
596
- const scopedCss = `.${cls}{margin:0}.${cls} p{margin:0 0 .4em}.${cls} h1,.${cls} h2,.${cls} h3,.${cls} h4,.${cls} h5,.${cls} h6{margin:0 0 .3em;line-height:1.2}.${cls} ul,.${cls} ol{margin:0 0 .4em;padding-left:1.2em;list-style-position:inside}.${cls} li{margin:0}.${cls} li>p{display:inline;margin:0}.${cls} *:first-child{margin-top:0}.${cls} *:last-child{margin-bottom:0}.${cls} a{color:inherit;text-decoration:underline}`;
596
+ const listStylePosition = style.textAlign === "center" || style.textAlign === "right" ? "inside" : "outside";
597
+ const scopedCss = `.${cls}{margin:0}.${cls} p{margin:0 0 .4em}.${cls} h1,.${cls} h2,.${cls} h3,.${cls} h4,.${cls} h5,.${cls} h6{margin:0 0 .3em;line-height:1.2}.${cls} ul,.${cls} ol{margin:0 0 .7em;padding-left:1.2em;list-style-position:${listStylePosition}}.${cls} li{margin:0}.${cls} li>p{display:inline;margin:0}.${cls} *:first-child{margin-top:0}.${cls} *:last-child{margin-bottom:0}.${cls} a{color:inherit;text-decoration:underline}`;
597
598
  return /* @__PURE__ */ jsx3("g", { className: `block-layer block-layer--text ${animStyle.className}`, "data-layer-id": layer.id, children: /* @__PURE__ */ jsx3(
598
599
  "foreignObject",
599
600
  {
@@ -9,7 +9,7 @@ import {
9
9
  TreeLayer,
10
10
  VideoLayer,
11
11
  getTransitionClass
12
- } from "./chunk-UJEHDVQO.js";
12
+ } from "./chunk-G6FVNYNW.js";
13
13
  import {
14
14
  useAutoSurface
15
15
  } from "./chunk-TT6ENR6T.js";
package/dist/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import { SquisqRenderAPI, VideoPresentation as VideoPresentation$1, PipSize, PipShape, PipPosition } from './player/index.js';
2
- export { BlockMarker, BlockRenderer, CaptionMode, CaptionOverlay, CaptionStyle, ControlsLayout, DisplayMode, DocControlsBottom, DocControlsOverlay, DocControlsSidebar, DocControlsSlideshow, DocPlayer, DocPlayerProps, DocPlayerWithSidebar, DocProgressBar, InlineAudioPlayer, InlineAudioPlayerProps, InlineVideoPlayer, InlineVideoPlayerProps, MediaClipLayer, MediaClipLayerProps, PlaybackActions, PlaybackState, RenderAudioSegmentInfo, RenderBlockInfo, RenderCaptionInfo, RenderChapterInfo, SlideNavActions, SocialCaptionOverlay, formatTime } from './player/index.js';
2
+ export { BlockMarker, BlockRenderer, CaptionMode, CaptionOverlay, CaptionStyle, ControlsLayout, DisplayMode, DocControlsBottom, DocControlsOverlay, DocControlsSidebar, DocControlsSlideshow, DocPlayer, DocPlayerProps, DocPlayerWithSidebar, DocProgressBar, FlashcardFaceView, FlashcardFaceViewProps, FlashcardView, FlashcardViewProps, InlineAudioPlayer, InlineAudioPlayerProps, InlineVideoPlayer, InlineVideoPlayerProps, MediaClipLayer, MediaClipLayerProps, PlaybackActions, PlaybackState, RenderAudioSegmentInfo, RenderBlockInfo, RenderCaptionInfo, RenderChapterInfo, SlideNavActions, SocialCaptionOverlay, formatTime } from './player/index.js';
3
3
  import { Theme, VideoPresentation, VideoPipSize, VideoPipShape, VideoPipPosition, Doc, ScheduledClip, MediaProvider } from '@bendyline/squisq/schemas';
4
+ import { DashboardStyleId, ViewportConfig, CoverSlideTemplate, CoverSlidePlayback } from '@bendyline/squisq/doc';
5
+ export { getAnimationStyle, getTransitionClass } from '@bendyline/squisq/doc';
4
6
  import { C as CodeBlockCopyHandler } from './MarkdownRenderer-CC9dOc6b.js';
5
7
  export { a as CodeBlockCopyContext, M as MarkdownRenderer, b as MarkdownRendererProps } from './MarkdownRenderer-CC9dOc6b.js';
6
8
  export { FenceRendererContext, MermaidDiagram, MermaidDiagramProps, useFenceRenderers } from './markdown/index.js';
7
9
  export { CanvasSection, CanvasSectionProps, ImageDisplayMode, LinearDocView, LinearDocViewProps, PageSectionView, PageSectionViewProps, PageViewContext, PageViewContextValue, usePageView } from './page/index.js';
10
+ import * as react_jsx_runtime from 'react/jsx-runtime';
8
11
  export { ImageLayer, MapLayer, MermaidLayer, PathLayer, ShapeLayer, TableLayer, TextLayer, TreeLayer, VideoLayer } from './layers/index.js';
9
- import { CoverSlideTemplate, CoverSlidePlayback } from '@bendyline/squisq/doc';
10
- export { getAnimationStyle, getTransitionClass } from '@bendyline/squisq/doc';
11
12
  export { MediaContext, MediaScheduleController, ModalDialogOptions, ResourcePolicyContext, UseDocPlaybackOptions, useAudioSync, useAutoSurface, useDocPlayback, useMediaProvider, useMediaSchedule, useMediaUrl, useModalDialog, useResourcePolicy, useViewportOrientation } from './hooks/index.js';
12
13
  export { FenceRenderContext, FenceRenderer, FenceRendererMap } from '@bendyline/squisq/fence';
13
14
  export { A as AudioActions, a as AudioController, b as AudioState } from './AudioController-DwMsPe38.js';
14
15
  export { JsonFormFenceAction, JsonFormFenceRendererOptions, JsonView, JsonViewProps, createJsonFormFenceRenderer } from './json-view/index.js';
15
- import 'react/jsx-runtime';
16
16
  import 'react';
17
17
  import '@bendyline/squisq/markdown';
18
18
  import '@bendyline/squisq/jsonForm';
@@ -42,8 +42,23 @@ import '@bendyline/squisq/jsonForm';
42
42
  */
43
43
 
44
44
  interface MountOptions {
45
- /** Rendering mode: 'slideshow' (interactive, default) or 'static' (scrollable) */
46
- mode?: 'slideshow' | 'static';
45
+ /**
46
+ * Rendering mode: 'slideshow' (interactive, default), 'static'
47
+ * (scrollable page), 'dashboard' (one canvas of arranged blocks), or
48
+ * 'flashcards' (progressively revealed study deck).
49
+ */
50
+ mode?: 'slideshow' | 'static' | 'dashboard' | 'flashcards';
51
+ /** Dashboard-mode options (ignored by the other modes). */
52
+ dashboard?: {
53
+ /** Layout id or 'auto'. Overrides doc frontmatter. */
54
+ layout?: string;
55
+ /** Title-band override. Overrides doc frontmatter. */
56
+ title?: boolean;
57
+ /** Cell style variant ('basic' | 'card' | 'panel' | 'accent'). */
58
+ style?: DashboardStyleId;
59
+ /** Host-supplied title fallback (typically the file name). */
60
+ documentTitle?: string;
61
+ };
47
62
  /** Base path for resolving relative media URLs */
48
63
  basePath?: string;
49
64
  /**
@@ -104,6 +119,37 @@ interface SquisqPlayerHandle {
104
119
  unmount(): void;
105
120
  }
106
121
 
122
+ interface DashboardViewProps {
123
+ doc: Doc;
124
+ /** Resolved theme; defaults to the doc's own theme resolution. */
125
+ theme?: Theme;
126
+ /** Canvas viewport (default: the landscape preset). */
127
+ viewport?: ViewportConfig;
128
+ /** Layout override: an id or `'auto'`. Overrides doc frontmatter. */
129
+ layout?: string;
130
+ /** Title-band override. Overrides doc frontmatter (default true). */
131
+ showTitle?: boolean;
132
+ /**
133
+ * Cell style variant (`basic` | `card` | `panel` | `accent`). Overrides
134
+ * doc frontmatter; all variants take their colors from the active theme.
135
+ */
136
+ style?: DashboardStyleId;
137
+ /** Host-supplied title fallback (typically the file name). */
138
+ documentTitle?: string;
139
+ /** Base path for resolving media URLs (default `'.'`). */
140
+ basePath?: string;
141
+ /** Render ambient/authored layer animations (default true). */
142
+ animationsEnabled?: boolean;
143
+ /** Silence audio carried by cell video layers (default true). */
144
+ muted?: boolean;
145
+ /** Publish the capture-readiness render API (headless export). */
146
+ renderMode?: boolean;
147
+ /** Receives the minimal render API, and `null` on cleanup. */
148
+ onRenderAPIReady?: (api: SquisqRenderAPI | null) => void;
149
+ className?: string;
150
+ }
151
+ declare function DashboardView({ doc, theme, viewport, layout, showTitle, style, documentTitle, basePath, animationsEnabled, muted, renderMode, onRenderAPIReady, className, }: DashboardViewProps): react_jsx_runtime.JSX.Element;
152
+
107
153
  interface DocPlayerAppearanceOverrides {
108
154
  theme?: Theme;
109
155
  videoPresentation?: VideoPresentation$1;
@@ -154,4 +200,4 @@ declare function resolveDocPlayerAppearance(doc: Doc, overrides?: DocPlayerAppea
154
200
  */
155
201
  declare function useMediaClipDurations(schedule: ScheduledClip[], basePath: string, mediaProviderOverride?: MediaProvider | null): Map<string, number>;
156
202
 
157
- export { CodeBlockCopyHandler, type DocPlayerAppearanceOverrides, type MountOptions, PipPosition, PipShape, PipSize, type ResolvedDocPlayerAppearance, type SquisqPlayerHandle, SquisqRenderAPI, VideoPresentation$1 as VideoPresentation, resolveDocPlayerAppearance, useMediaClipDurations };
203
+ export { CodeBlockCopyHandler, DashboardView, type DashboardViewProps, type DocPlayerAppearanceOverrides, type MountOptions, PipPosition, PipShape, PipSize, type ResolvedDocPlayerAppearance, type SquisqPlayerHandle, SquisqRenderAPI, VideoPresentation$1 as VideoPresentation, resolveDocPlayerAppearance, useMediaClipDurations };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  CaptionOverlay,
3
+ DashboardView,
3
4
  DocControlsBottom,
4
5
  DocControlsOverlay,
5
6
  DocControlsSidebar,
@@ -7,12 +8,14 @@ import {
7
8
  DocPlayer,
8
9
  DocPlayerWithSidebar,
9
10
  DocProgressBar,
11
+ FlashcardFaceView,
12
+ FlashcardView,
10
13
  MediaClipLayer,
11
14
  SocialCaptionOverlay,
12
15
  formatTime,
13
16
  resolveDocPlayerAppearance,
14
17
  useMediaClipDurations
15
- } from "./chunk-KXYE4AGL.js";
18
+ } from "./chunk-2Y7F3S6M.js";
16
19
  import {
17
20
  BlockRenderer,
18
21
  CanvasSection,
@@ -20,7 +23,7 @@ import {
20
23
  PageSectionView,
21
24
  PageViewContext,
22
25
  usePageView
23
- } from "./chunk-IQGW6SA6.js";
26
+ } from "./chunk-NGQQKH7J.js";
24
27
  import {
25
28
  ImageLayer,
26
29
  MapLayer,
@@ -33,7 +36,7 @@ import {
33
36
  VideoLayer,
34
37
  getAnimationStyle,
35
38
  getTransitionClass
36
- } from "./chunk-UJEHDVQO.js";
39
+ } from "./chunk-G6FVNYNW.js";
37
40
  import {
38
41
  useModalDialog
39
42
  } from "./chunk-65POMKHR.js";
@@ -71,6 +74,7 @@ export {
71
74
  BlockRenderer,
72
75
  CanvasSection,
73
76
  CaptionOverlay,
77
+ DashboardView,
74
78
  DocControlsBottom,
75
79
  DocControlsOverlay,
76
80
  DocControlsSidebar,
@@ -79,6 +83,8 @@ export {
79
83
  DocPlayerWithSidebar,
80
84
  DocProgressBar,
81
85
  FenceRendererContext,
86
+ FlashcardFaceView,
87
+ FlashcardView,
82
88
  ImageLayer,
83
89
  InlineAudioPlayer,
84
90
  InlineVideoPlayer,
@@ -8,7 +8,7 @@ import {
8
8
  TextLayer,
9
9
  TreeLayer,
10
10
  VideoLayer
11
- } from "../chunk-UJEHDVQO.js";
11
+ } from "../chunk-G6FVNYNW.js";
12
12
  import "../chunk-WLUZTUNZ.js";
13
13
  import "../chunk-LR3AIGDD.js";
14
14
  export {
@@ -4,8 +4,8 @@ import {
4
4
  PageSectionView,
5
5
  PageViewContext,
6
6
  usePageView
7
- } from "../chunk-IQGW6SA6.js";
8
- import "../chunk-UJEHDVQO.js";
7
+ } from "../chunk-NGQQKH7J.js";
8
+ import "../chunk-G6FVNYNW.js";
9
9
  import "../chunk-TT6ENR6T.js";
10
10
  import "../chunk-ESI3P77P.js";
11
11
  import "../chunk-WLUZTUNZ.js";
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Block, VideoPresentation as VideoPresentation$1, VideoPipSize, VideoPipShape, VideoPipPosition, Doc, Theme, SurfaceScheme, Transition, CaptionTrack, ViewportConfig as ViewportConfig$1, ScheduledClip } from '@bendyline/squisq/schemas';
3
- import { ViewportConfig, CoverSlideTemplate, CoverSlidePlayback } from '@bendyline/squisq/doc';
2
+ import { Block, VideoPresentation as VideoPresentation$1, VideoPipSize, VideoPipShape, VideoPipPosition, Doc, Theme, SurfaceScheme, Transition, CaptionTrack, ViewportConfig as ViewportConfig$1, CustomTemplateDefinition, ScheduledClip } from '@bendyline/squisq/schemas';
3
+ import { ViewportConfig, DashboardStyleId, CoverSlideTemplate, CoverSlidePlayback, FlashcardFace, FlashcardSourceMode } from '@bendyline/squisq/doc';
4
4
  import { FenceRendererMap } from '@bendyline/squisq/fence';
5
5
  import { a as AudioController } from '../AudioController-DwMsPe38.js';
6
6
  import { C as CodeBlockCopyHandler } from '../MarkdownRenderer-CC9dOc6b.js';
@@ -57,8 +57,13 @@ type PipPosition = VideoPipPosition;
57
57
  * implement this mode; it is owned by the editor package
58
58
  * (`@bendyline/squisq-editor-react`), which renders its own
59
59
  * voice-paced teleprompter view for it.
60
+ * - `'dashboard'` — One static canvas that arranges every block into a
61
+ * layout's cells (grids, hero mosaics). No timeline, no navigation;
62
+ * overflow blocks beyond the layout's capacity are not rendered.
63
+ * - `'flashcards'` — A progressively revealed study deck derived from the
64
+ * document's nested block hierarchy, including multiple-choice quizzes.
60
65
  */
61
- type DisplayMode = 'video' | 'slideshow' | 'linear' | 'page' | 'narrate';
66
+ type DisplayMode = 'video' | 'slideshow' | 'linear' | 'page' | 'narrate' | 'dashboard' | 'flashcards';
62
67
  /**
63
68
  * Caption display style.
64
69
  *
@@ -223,8 +228,16 @@ interface DocPlayerProps {
223
228
  forceViewport?: ViewportConfig;
224
229
  theme?: Theme;
225
230
  surface?: SurfaceScheme | 'auto';
226
- /** Video, manual slideshow, or long-scrolling linear rendition. */
231
+ /** Video, slideshow, page, dashboard, or flashcards rendition. */
227
232
  displayMode?: DisplayMode;
233
+ /** Dashboard mode: layout id or `'auto'`. Overrides doc frontmatter. */
234
+ dashboardLayout?: string;
235
+ /** Dashboard mode: title-band override. Overrides doc frontmatter. */
236
+ dashboardShowTitle?: boolean;
237
+ /** Dashboard mode: cell style variant. Overrides doc frontmatter. */
238
+ dashboardStyle?: DashboardStyleId;
239
+ /** Dashboard mode: host-supplied title fallback (typically the file name). */
240
+ dashboardDocumentTitle?: string;
228
241
  showCoverSlide?: boolean;
229
242
  /** Visual template used to materialize the managed cover. */
230
243
  coverSlideTemplate?: CoverSlideTemplate;
@@ -416,6 +429,36 @@ interface DocProgressBarProps {
416
429
  }
417
430
  declare function DocProgressBar({ state, actions, blockMarkers, expandedBlocks, getBlockTitle, }: DocProgressBarProps): react_jsx_runtime.JSX.Element;
418
431
 
432
+ interface FlashcardViewProps {
433
+ doc: Doc;
434
+ theme?: Theme;
435
+ basePath?: string;
436
+ source?: FlashcardSourceMode;
437
+ /** Start the deck in shuffled order (default false). */
438
+ shuffle?: boolean;
439
+ /** Capture shortcuts without requiring focus (default false). */
440
+ globalKeyboardShortcuts?: boolean;
441
+ showCodeCopyButton?: boolean;
442
+ onCopyCode?: CodeBlockCopyHandler;
443
+ fenceRenderers?: FenceRendererMap;
444
+ /** Viewport used to materialize diagrams and other spatial content. */
445
+ viewport?: ViewportConfig$1;
446
+ className?: string;
447
+ }
448
+ interface FlashcardFaceViewProps {
449
+ face: FlashcardFace;
450
+ theme: Theme;
451
+ basePath: string;
452
+ showCodeCopyButton: boolean;
453
+ onCopyCode?: CodeBlockCopyHandler;
454
+ fenceRenderers?: FenceRendererMap;
455
+ viewport?: ViewportConfig$1;
456
+ customTemplates?: readonly CustomTemplateDefinition[];
457
+ }
458
+ /** Rich, theme-aware renderer for one materialized flashcard face. */
459
+ declare function FlashcardFaceView(props: FlashcardFaceViewProps): react_jsx_runtime.JSX.Element;
460
+ declare function FlashcardView({ doc, theme, basePath, source, shuffle: initialShuffle, globalKeyboardShortcuts, showCodeCopyButton, onCopyCode, fenceRenderers, viewport, className, }: FlashcardViewProps): react_jsx_runtime.JSX.Element;
461
+
419
462
  interface InlineVideoPlayerProps {
420
463
  /** Source path — resolved through MediaContext when relative. */
421
464
  src: string;
@@ -475,4 +518,4 @@ interface MediaClipLayerProps {
475
518
  }
476
519
  declare function MediaClipLayer({ schedule, currentTime, isPlaying, basePath, renderMode, muted, presentation, pipSize, pipShape, pipPosition, pipOrientation, pipFrameStyle, honorClipPresentation, }: MediaClipLayerProps): react_jsx_runtime.JSX.Element | null;
477
520
 
478
- export { type BlockMarker, BlockRenderer, type CaptionMode, CaptionOverlay, type CaptionStyle, CodeBlockCopyHandler, type ControlsLayout, type DisplayMode, DocControlsBottom, DocControlsOverlay, DocControlsSidebar, DocControlsSlideshow, DocPlayer, type DocPlayerProps, DocPlayerWithSidebar, DocProgressBar, InlineAudioPlayer, type InlineAudioPlayerProps, InlineVideoPlayer, type InlineVideoPlayerProps, MediaClipLayer, type MediaClipLayerProps, type PipPosition, type PipShape, type PipSize, type PlaybackActions, type PlaybackState, type RenderAudioSegmentInfo, type RenderBlockInfo, type RenderCaptionInfo, type RenderChapterInfo, type SlideNavActions, SocialCaptionOverlay, type SquisqRenderAPI, type VideoPresentation, formatTime };
521
+ export { type BlockMarker, BlockRenderer, type CaptionMode, CaptionOverlay, type CaptionStyle, CodeBlockCopyHandler, type ControlsLayout, type DisplayMode, DocControlsBottom, DocControlsOverlay, DocControlsSidebar, DocControlsSlideshow, DocPlayer, type DocPlayerProps, DocPlayerWithSidebar, DocProgressBar, FlashcardFaceView, type FlashcardFaceViewProps, FlashcardView, type FlashcardViewProps, InlineAudioPlayer, type InlineAudioPlayerProps, InlineVideoPlayer, type InlineVideoPlayerProps, MediaClipLayer, type MediaClipLayerProps, type PipPosition, type PipShape, type PipSize, type PlaybackActions, type PlaybackState, type RenderAudioSegmentInfo, type RenderBlockInfo, type RenderCaptionInfo, type RenderChapterInfo, type SlideNavActions, SocialCaptionOverlay, type SquisqRenderAPI, type VideoPresentation, formatTime };
@@ -7,14 +7,16 @@ import {
7
7
  DocPlayer,
8
8
  DocPlayerWithSidebar,
9
9
  DocProgressBar,
10
+ FlashcardFaceView,
11
+ FlashcardView,
10
12
  MediaClipLayer,
11
13
  SocialCaptionOverlay,
12
14
  formatTime
13
- } from "../chunk-KXYE4AGL.js";
15
+ } from "../chunk-2Y7F3S6M.js";
14
16
  import {
15
17
  BlockRenderer
16
- } from "../chunk-IQGW6SA6.js";
17
- import "../chunk-UJEHDVQO.js";
18
+ } from "../chunk-NGQQKH7J.js";
19
+ import "../chunk-G6FVNYNW.js";
18
20
  import "../chunk-MVJQL2W2.js";
19
21
  import "../chunk-TT6ENR6T.js";
20
22
  import {
@@ -33,6 +35,8 @@ export {
33
35
  DocPlayer,
34
36
  DocPlayerWithSidebar,
35
37
  DocProgressBar,
38
+ FlashcardFaceView,
39
+ FlashcardView,
36
40
  InlineAudioPlayer,
37
41
  InlineVideoPlayer,
38
42
  MediaClipLayer,