@bendyline/squisq-react 2.11.0 → 2.11.2

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.
@@ -594,7 +594,7 @@ function RichTextLayer({ layer, viewport, blockTime }) {
594
594
  };
595
595
  const cls = `squisq-rich-text-${cssId(layer.id)}`;
596
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
+ 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} table{width:100%;margin:.65em 0;border-collapse:collapse;border-spacing:0;table-layout:fixed}.${cls} th,.${cls} td{box-sizing:border-box;padding:.38em .55em;border:1px solid rgba(127,127,127,.55);border-color:color-mix(in srgb,currentColor 32%,transparent);vertical-align:top;white-space:normal;overflow-wrap:anywhere}.${cls} th{background:rgba(127,127,127,.16);background:color-mix(in srgb,currentColor 12%,transparent);font-weight:600}.${cls} tbody tr:nth-child(even){background:rgba(127,127,127,.07);background:color-mix(in srgb,currentColor 5%,transparent)}.${cls} *:first-child{margin-top:0}.${cls} *:last-child{margin-bottom:0}.${cls} a{color:inherit;text-decoration:underline}`;
598
598
  return /* @__PURE__ */ jsx3("g", { className: `block-layer block-layer--text ${animStyle.className}`, "data-layer-id": layer.id, children: /* @__PURE__ */ jsx3(
599
599
  "foreignObject",
600
600
  {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BlockRenderer,
3
3
  LinearDocView
4
- } from "./chunk-R44JIBV3.js";
4
+ } from "./chunk-ZC7LI5UF.js";
5
5
  import {
6
6
  useAudioSync,
7
7
  useDocPlayback,
@@ -343,6 +343,16 @@ function useMediaClipDurations(schedule, basePath, mediaProviderOverride) {
343
343
  import { useMemo as useMemo2 } from "react";
344
344
  import { resolveFontFamily } from "@bendyline/squisq/schemas";
345
345
  import { jsx as jsx2 } from "react/jsx-runtime";
346
+ function positionStyle(position) {
347
+ switch (position) {
348
+ case "top":
349
+ return { top: "8%" };
350
+ case "center":
351
+ return { top: "50%", transform: "translateY(-50%)" };
352
+ default:
353
+ return { bottom: "18%" };
354
+ }
355
+ }
346
356
  var TARGET_CHUNK_SIZE = 4;
347
357
  var MIN_CHUNK_SIZE = 2;
348
358
  var MAX_CHUNK_SIZE = 6;
@@ -394,7 +404,8 @@ function SocialCaptionOverlay({
394
404
  currentTime,
395
405
  enabled = true,
396
406
  theme,
397
- viewport
407
+ viewport,
408
+ position = "bottom"
398
409
  }) {
399
410
  const { chunks } = useMemo2(
400
411
  () => captions ? buildWordStream(captions) : { words: [], chunks: [] },
@@ -407,7 +418,7 @@ function SocialCaptionOverlay({
407
418
  className: "social-caption-overlay",
408
419
  style: {
409
420
  position: "absolute",
410
- bottom: "18%",
421
+ ...positionStyle(position),
411
422
  left: 0,
412
423
  right: 0,
413
424
  zIndex: 50,
@@ -469,7 +480,7 @@ function SocialCaptionOverlay({
469
480
  className: "social-caption-overlay",
470
481
  style: {
471
482
  position: "absolute",
472
- bottom: "18%",
483
+ ...positionStyle(position),
473
484
  left: 0,
474
485
  right: 0,
475
486
  zIndex: 50,
@@ -516,12 +527,23 @@ function SocialCaptionOverlay({
516
527
  // src/CaptionOverlay.tsx
517
528
  import { getCaptionAtTime } from "@bendyline/squisq/schemas";
518
529
  import { jsx as jsx3 } from "react/jsx-runtime";
530
+ function standardPositionStyle(position) {
531
+ switch (position) {
532
+ case "bottom":
533
+ return { bottom: "6px", left: "50%", transform: "translateX(-50%)" };
534
+ case "center":
535
+ return { top: "50%", left: "50%", transform: "translate(-50%, -50%)" };
536
+ default:
537
+ return { top: "6px", left: "50%", transform: "translateX(-50%)" };
538
+ }
539
+ }
519
540
  function CaptionOverlay({
520
541
  captions,
521
542
  currentTime,
522
543
  enabled = true,
523
544
  fontSize = 16,
524
545
  captionStyle = "standard",
546
+ captionPosition,
525
547
  theme,
526
548
  viewport
527
549
  }) {
@@ -533,7 +555,8 @@ function CaptionOverlay({
533
555
  currentTime,
534
556
  enabled,
535
557
  theme,
536
- viewport
558
+ viewport,
559
+ position: captionPosition ?? "bottom"
537
560
  }
538
561
  );
539
562
  }
@@ -545,9 +568,7 @@ function CaptionOverlay({
545
568
  className: "caption-overlay",
546
569
  style: {
547
570
  position: "absolute",
548
- top: "6px",
549
- left: "50%",
550
- transform: "translateX(-50%)",
571
+ ...standardPositionStyle(captionPosition ?? "top"),
551
572
  zIndex: 50,
552
573
  pointerEvents: "none",
553
574
  maxWidth: "100%",
@@ -2663,6 +2684,7 @@ function DocPlayerContent({
2663
2684
  theme,
2664
2685
  surface,
2665
2686
  captionStyle = "standard",
2687
+ captionPosition,
2666
2688
  videoPresentation,
2667
2689
  pipSize,
2668
2690
  pipShape,
@@ -3631,8 +3653,9 @@ function DocPlayerContent({
3631
3653
  captions: doc.captions,
3632
3654
  currentTime,
3633
3655
  enabled: captionsEnabled && (renderMode || isPlaying || currentTime > 0),
3634
- fontSize: 16,
3656
+ fontSize: Math.min(34, Math.max(16, Math.round(activeViewport.height * 0.026))),
3635
3657
  captionStyle: activeCaptionStyle,
3658
+ captionPosition,
3636
3659
  theme: effectiveTheme,
3637
3660
  viewport: activeViewport
3638
3661
  }
@@ -9,7 +9,7 @@ import {
9
9
  TreeLayer,
10
10
  VideoLayer,
11
11
  getTransitionClass
12
- } from "./chunk-G6FVNYNW.js";
12
+ } from "./chunk-4MP7CH3C.js";
13
13
  import {
14
14
  useAutoSurface
15
15
  } from "./chunk-TT6ENR6T.js";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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, FlashcardFaceView, FlashcardFaceViewProps, FlashcardView, FlashcardViewProps, InlineAudioPlayer, InlineAudioPlayerProps, InlineVideoPlayer, InlineVideoPlayerProps, MediaClipLayer, MediaClipLayerProps, PlaybackActions, PlaybackState, RenderAudioSegmentInfo, RenderBlockInfo, RenderCaptionInfo, RenderChapterInfo, SlideNavActions, SocialCaptionOverlay, formatTime } from './player/index.js';
1
+ import { S as SquisqRenderAPI, V as VideoPresentation$1, P as PipSize, a as PipShape, b as PipPosition } from './player-DSMhm8SL.js';
2
+ export { B as BlockMarker, c as BlockRenderer, C as CaptionMode, d as CaptionOverlay, e as CaptionPosition, f as CaptionStyle, g as ControlsLayout, D as DisplayMode, h as DocControlsBottom, i as DocControlsOverlay, j as DocControlsSidebar, k as DocControlsSlideshow, l as DocPlayer, m as DocPlayerProps, n as DocPlayerWithSidebar, o as DocProgressBar, F as FlashcardFaceView, p as FlashcardFaceViewProps, q as FlashcardView, r as FlashcardViewProps, I as InlineAudioPlayer, s as InlineAudioPlayerProps, t as InlineVideoPlayer, u as InlineVideoPlayerProps, M as MediaClipLayer, v as MediaClipLayerProps, w as PlaybackActions, x as PlaybackState, R as RenderAudioSegmentInfo, y as RenderBlockInfo, z as RenderCaptionInfo, A as RenderChapterInfo, E as SlideNavActions, G as SocialCaptionOverlay, H as formatTime } from './player-DSMhm8SL.js';
3
3
  import { Theme, VideoPresentation, VideoPipSize, VideoPipShape, VideoPipPosition, Doc, ScheduledClip, MediaProvider } from '@bendyline/squisq/schemas';
4
4
  import { DashboardStyleId, ViewportConfig, CoverSlideTemplate, CoverSlidePlayback } from '@bendyline/squisq/doc';
5
5
  export { getAnimationStyle, getTransitionClass } from '@bendyline/squisq/doc';
@@ -105,6 +105,8 @@ interface MountOptions {
105
105
  animationsEnabled?: boolean;
106
106
  /** Caption style: 'standard' or 'social'. Omit or set to undefined for no captions. */
107
107
  captionStyle?: 'standard' | 'social';
108
+ /** Caption placement over the frame; omit for the style's classic spot. */
109
+ captionPosition?: 'top' | 'center' | 'bottom';
108
110
  /** Show a Copy button on fenced code blocks in static mode (default: false). */
109
111
  showCodeCopyButton?: boolean;
110
112
  /** Optional host clipboard adapter; otherwise the browser Clipboard API is used. */
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  formatTime,
16
16
  resolveDocPlayerAppearance,
17
17
  useMediaClipDurations
18
- } from "./chunk-VKXOZTYP.js";
18
+ } from "./chunk-HK7TY64K.js";
19
19
  import {
20
20
  BlockRenderer,
21
21
  CanvasSection,
@@ -23,7 +23,7 @@ import {
23
23
  PageSectionView,
24
24
  PageViewContext,
25
25
  usePageView
26
- } from "./chunk-R44JIBV3.js";
26
+ } from "./chunk-ZC7LI5UF.js";
27
27
  import {
28
28
  ImageLayer,
29
29
  MapLayer,
@@ -36,7 +36,7 @@ import {
36
36
  VideoLayer,
37
37
  getAnimationStyle,
38
38
  getTransitionClass
39
- } from "./chunk-G6FVNYNW.js";
39
+ } from "./chunk-4MP7CH3C.js";
40
40
  import {
41
41
  useModalDialog
42
42
  } from "./chunk-65POMKHR.js";
@@ -8,7 +8,7 @@ import {
8
8
  TextLayer,
9
9
  TreeLayer,
10
10
  VideoLayer
11
- } from "../chunk-G6FVNYNW.js";
11
+ } from "../chunk-4MP7CH3C.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-R44JIBV3.js";
8
- import "../chunk-G6FVNYNW.js";
7
+ } from "../chunk-ZC7LI5UF.js";
8
+ import "../chunk-4MP7CH3C.js";
9
9
  import "../chunk-TT6ENR6T.js";
10
10
  import "../chunk-ZY5N3JPM.js";
11
11
  import "../chunk-WLUZTUNZ.js";