@bendyline/squisq-react 2.12.22 → 2.12.24

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,6 +1,6 @@
1
1
  import {
2
2
  LinearDocView
3
- } from "./chunk-6LM6HDKH.js";
3
+ } from "./chunk-L3PODEKP.js";
4
4
 
5
5
  // src/PaginatedDocView.tsx
6
6
  import {
@@ -1842,13 +1842,15 @@ function TableLayer({
1842
1842
  return a ? { textAlign: a } : void 0;
1843
1843
  };
1844
1844
  const borderRadius = style.borderRadius ?? 8;
1845
+ const frame = `1px solid ${style.borderColor}`;
1845
1846
  const verticalCellPadding = style.fontSize * 0.6;
1846
1847
  const horizontalCellPadding = style.fontSize * 0.75;
1848
+ const cellWrap = content.wrap ? { whiteSpace: "pre-line", overflowWrap: "break-word", verticalAlign: "top" } : { whiteSpace: "nowrap" };
1847
1849
  const nativeTable = /* @__PURE__ */ jsxs6(
1848
1850
  "table",
1849
1851
  {
1850
1852
  style: {
1851
- width: "max-content",
1853
+ width: content.wrap ? "100%" : "max-content",
1852
1854
  minWidth: "100%",
1853
1855
  borderCollapse: "separate",
1854
1856
  borderSpacing: 0,
@@ -1869,7 +1871,7 @@ function TableLayer({
1869
1871
  position: "sticky",
1870
1872
  top: 0,
1871
1873
  zIndex: 1,
1872
- whiteSpace: "nowrap",
1874
+ ...cellWrap,
1873
1875
  borderBottom: `2px solid ${style.borderColor}`,
1874
1876
  borderRight: ci < headers.length - 1 ? `1px solid ${style.borderColor}` : void 0,
1875
1877
  ...cellAlign(ci)
@@ -1885,7 +1887,7 @@ function TableLayer({
1885
1887
  background: style.cellBackground,
1886
1888
  color: style.cellColor,
1887
1889
  padding: `${verticalCellPadding}px ${horizontalCellPadding}px`,
1888
- whiteSpace: "nowrap",
1890
+ ...cellWrap,
1889
1891
  borderBottom: ri < rows.length - 1 ? `1px solid ${style.borderColor}` : void 0,
1890
1892
  borderRight: ci < row.length - 1 ? `1px solid ${style.borderColor}` : void 0,
1891
1893
  ...cellAlign(ci)
@@ -1922,10 +1924,10 @@ function TableLayer({
1922
1924
  boxSizing: "border-box",
1923
1925
  overflow: ContentRenderer ? "hidden" : "auto",
1924
1926
  overscrollBehavior: "contain",
1925
- scrollbarGutter: "stable",
1926
- border: ContentRenderer ? void 0 : `1px solid ${style.borderColor}`,
1927
+ scrollbarGutter: content.wrap ? "auto" : "stable",
1928
+ border: ContentRenderer || content.wrap ? void 0 : frame,
1927
1929
  borderRadius: `${borderRadius}px`,
1928
- background: ContentRenderer ? "transparent" : style.cellBackground
1930
+ background: ContentRenderer || content.wrap ? "transparent" : style.cellBackground
1929
1931
  },
1930
1932
  children: ContentRenderer ? /* @__PURE__ */ jsx8(
1931
1933
  ContentRenderer,
@@ -1936,6 +1938,10 @@ function TableLayer({
1936
1938
  height,
1937
1939
  fallback: nativeTable
1938
1940
  }
1941
+ ) : content.wrap ? (
1942
+ // A fitted table is framed at its own height, so the spare room its
1943
+ // box keeps for the type estimate stays invisible.
1944
+ /* @__PURE__ */ jsx8("div", { style: { border: frame, borderRadius: `${borderRadius}px`, overflow: "hidden" }, children: nativeTable })
1939
1945
  ) : nativeTable
1940
1946
  }
1941
1947
  ) })
@@ -12,7 +12,7 @@ import {
12
12
  getAnchorOffset,
13
13
  getTransitionClass,
14
14
  resolveValue
15
- } from "./chunk-IPB22WG3.js";
15
+ } from "./chunk-E7TEWUNF.js";
16
16
 
17
17
  // src/BlockRenderer.tsx
18
18
  import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
@@ -253,6 +253,17 @@ function overlapPairs(rects) {
253
253
  }
254
254
  return pairs;
255
255
  }
256
+ function stepEntranceDelays(layers) {
257
+ const delays = /* @__PURE__ */ new Map();
258
+ for (const layer of layers ?? []) {
259
+ if (layer.buildStep === void 0 || !layer.animation || layer.animation.type === "none")
260
+ continue;
261
+ const delay = layer.animation.delay ?? 0;
262
+ const current = delays.get(layer.buildStep);
263
+ if (current === void 0 || delay < current) delays.set(layer.buildStep, delay);
264
+ }
265
+ return delays;
266
+ }
256
267
  function BlockRenderer({
257
268
  block,
258
269
  buildPlayback = "all",
@@ -292,6 +303,8 @@ function BlockRenderer({
292
303
  () => block.build ? resolveBuildTimeline(steps, block.build, block.duration, block.buildTiming) : void 0,
293
304
  [steps, block.build, block.duration, block.buildTiming]
294
305
  );
306
+ const entranceDelays = useMemo(() => stepEntranceDelays(block.layers), [block.layers]);
307
+ const shownSteps = useRef(null);
295
308
  const [reducedMotion, setReducedMotion] = useState(false);
296
309
  useEffect(() => {
297
310
  if (!respectReducedMotion) {
@@ -311,6 +324,9 @@ function BlockRenderer({
311
324
  const cursor = buildPlayback === "all" || !timeline ? { revealed: steps.length, progress: 1 } : buildPlayback === "timed" ? buildCursorAtTime(timeline, blockTime) : buildPlayback;
312
325
  svg.dataset.buildRevealed = String(cursor.revealed);
313
326
  svg.dataset.buildCount = String(steps.length);
327
+ const motion = animationsEnabled && !reducedMotion;
328
+ const shown = shownSteps.current?.block === block ? shownSteps.current.revealed : void 0;
329
+ shownSteps.current = { block, revealed: cursor.revealed };
314
330
  for (const target of svg.querySelectorAll("[data-squisq-build-step]")) {
315
331
  const index = Number(target.dataset.squisqBuildStep);
316
332
  if (!Number.isInteger(index) || index < 0 || index >= steps.length || !block.build) {
@@ -318,16 +334,19 @@ function BlockRenderer({
318
334
  target.style.opacity = "1";
319
335
  target.style.transform = "";
320
336
  target.style.pointerEvents = "";
337
+ target.style.removeProperty("--squisq-step-offset");
321
338
  target.removeAttribute("aria-hidden");
322
339
  target.removeAttribute("inert");
323
340
  continue;
324
341
  }
342
+ const delay = entranceDelays.get(index);
343
+ const spec = buildPlayback === "all" ? { ...block.build, previous: "keep" } : block.build;
325
344
  const state = buildTargetState(
326
345
  index,
327
346
  steps,
328
347
  cursor,
329
- buildPlayback === "all" ? { ...block.build, previous: "keep" } : block.build,
330
- animationsEnabled && !reducedMotion
348
+ delay === void 0 ? spec : { ...spec, effect: "appear" },
349
+ motion
331
350
  );
332
351
  target.style.visibility = state.hidden ? "hidden" : "visible";
333
352
  target.style.opacity = String(state.opacity);
@@ -335,8 +354,30 @@ function BlockRenderer({
335
354
  target.style.pointerEvents = state.hidden ? "none" : "";
336
355
  target.setAttribute("aria-hidden", String(state.hidden));
337
356
  target.toggleAttribute("inert", state.hidden);
357
+ if (delay === void 0) continue;
358
+ if (buildPlayback === "timed" && timeline)
359
+ target.style.setProperty(
360
+ "--squisq-step-offset",
361
+ `${Number((timeline.starts[index] - delay).toFixed(3))}s`
362
+ );
363
+ else target.style.removeProperty("--squisq-step-offset");
364
+ if (motion && typeof buildPlayback === "object" && shown !== void 0 && index >= shown && index < cursor.revealed) {
365
+ for (const animation of target.getAnimations?.({ subtree: true }) ?? []) {
366
+ animation.currentTime = delay * 1e3;
367
+ animation.play();
368
+ }
369
+ }
338
370
  }
339
- }, [block.build, steps, timeline, blockTime, buildPlayback, animationsEnabled, reducedMotion]);
371
+ }, [
372
+ block,
373
+ steps,
374
+ timeline,
375
+ entranceDelays,
376
+ blockTime,
377
+ buildPlayback,
378
+ animationsEnabled,
379
+ reducedMotion
380
+ ]);
340
381
  const growText = growTextToFit && !isGeometryBoundTemplate(block.template);
341
382
  useLayoutEffect(() => {
342
383
  const svg = svgRef.current;
@@ -389,26 +430,29 @@ function BlockRenderer({
389
430
  "data-squisq-text-scale": growText ? textScale : void 0,
390
431
  children: [
391
432
  /* @__PURE__ */ jsx2("defs", { children: /* @__PURE__ */ jsx2("clipPath", { id: clipId, children: /* @__PURE__ */ jsx2("rect", { x: "0", y: "0", width: viewport.width, height: viewport.height }) }) }),
392
- /* @__PURE__ */ jsx2("g", { clipPath: `url(#${clipId})`, children: (block.layers ?? []).map((layer) => /* @__PURE__ */ jsx2(
393
- LayerRenderer,
394
- {
395
- block,
396
- layer,
397
- basePath,
398
- viewport,
399
- blockTime,
400
- isPlaying,
401
- muted,
402
- animationsEnabled,
403
- theme,
404
- tableContentRenderer,
405
- textScale,
406
- videoEmbeds,
407
- videoClips,
408
- staticMedia: staticMedia || reducedMotion || !animationsEnabled
409
- },
410
- layer.id
411
- )) })
433
+ /* @__PURE__ */ jsx2("g", { clipPath: `url(#${clipId})`, children: (block.layers ?? []).map((layer) => {
434
+ const rendered = /* @__PURE__ */ jsx2(
435
+ LayerRenderer,
436
+ {
437
+ block,
438
+ layer,
439
+ basePath,
440
+ viewport,
441
+ blockTime,
442
+ isPlaying,
443
+ muted,
444
+ animationsEnabled,
445
+ theme,
446
+ tableContentRenderer,
447
+ textScale,
448
+ videoEmbeds,
449
+ videoClips,
450
+ staticMedia: staticMedia || reducedMotion || !animationsEnabled
451
+ },
452
+ layer.id
453
+ );
454
+ return layer.buildStep === void 0 ? rendered : /* @__PURE__ */ jsx2("g", { "data-squisq-build-step": layer.buildStep, children: rendered }, layer.id);
455
+ }) })
412
456
  ]
413
457
  }
414
458
  );
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-OWC7DNGJ.js";
9
9
  import {
10
10
  BlockRenderer
11
- } from "./chunk-4HVJHRL5.js";
11
+ } from "./chunk-HPABEDRG.js";
12
12
  import {
13
13
  svgDataImageSrc,
14
14
  useMediaUrl
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LinearDocView
3
- } from "./chunk-6LM6HDKH.js";
3
+ } from "./chunk-L3PODEKP.js";
4
4
  import {
5
5
  useAudioSync,
6
6
  useDocPlayback,
@@ -15,11 +15,11 @@ import {
15
15
  } from "./chunk-OWC7DNGJ.js";
16
16
  import {
17
17
  BlockRenderer
18
- } from "./chunk-4HVJHRL5.js";
18
+ } from "./chunk-HPABEDRG.js";
19
19
  import {
20
20
  isCaptureDrivenVideo,
21
21
  seekVideoToFrame
22
- } from "./chunk-IPB22WG3.js";
22
+ } from "./chunk-E7TEWUNF.js";
23
23
  import {
24
24
  useMediaProvider,
25
25
  useMediaUrl,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BlockRenderer
3
- } from "../chunk-4HVJHRL5.js";
4
- import "../chunk-IPB22WG3.js";
3
+ } from "../chunk-HPABEDRG.js";
4
+ import "../chunk-E7TEWUNF.js";
5
5
  import "../chunk-A65WPCGZ.js";
6
6
  import {
7
7
  renderMermaidSvgForExport
package/dist/index.js CHANGED
@@ -17,17 +17,17 @@ import {
17
17
  resolveDocPlayerAppearance,
18
18
  useBuildNavigation,
19
19
  useMediaClipDurations
20
- } from "./chunk-2DUF6C7B.js";
20
+ } from "./chunk-MPOVPKIJ.js";
21
21
  import {
22
22
  PaginatedDocView
23
- } from "./chunk-MIJNUVEL.js";
23
+ } from "./chunk-74MMSPTK.js";
24
24
  import {
25
25
  CanvasSection,
26
26
  LinearDocView,
27
27
  PageSectionView,
28
28
  PageViewContext,
29
29
  usePageView
30
- } from "./chunk-6LM6HDKH.js";
30
+ } from "./chunk-L3PODEKP.js";
31
31
  import {
32
32
  useModalDialog
33
33
  } from "./chunk-JP457U6N.js";
@@ -57,7 +57,7 @@ import {
57
57
  } from "./chunk-OWC7DNGJ.js";
58
58
  import {
59
59
  BlockRenderer
60
- } from "./chunk-4HVJHRL5.js";
60
+ } from "./chunk-HPABEDRG.js";
61
61
  import {
62
62
  ImageLayer,
63
63
  MapLayer,
@@ -71,7 +71,7 @@ import {
71
71
  VideoLayer,
72
72
  getAnimationStyle,
73
73
  getTransitionClass
74
- } from "./chunk-IPB22WG3.js";
74
+ } from "./chunk-E7TEWUNF.js";
75
75
  import {
76
76
  MermaidDiagram
77
77
  } from "./chunk-A65WPCGZ.js";
@@ -9,7 +9,7 @@ import {
9
9
  TextLayer,
10
10
  TreeLayer,
11
11
  VideoLayer
12
- } from "../chunk-IPB22WG3.js";
12
+ } from "../chunk-E7TEWUNF.js";
13
13
  import "../chunk-A65WPCGZ.js";
14
14
  import "../chunk-OTYJ4MRH.js";
15
15
  export {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  PaginatedDocView
3
- } from "../chunk-MIJNUVEL.js";
3
+ } from "../chunk-74MMSPTK.js";
4
4
  import {
5
5
  CanvasSection,
6
6
  LinearDocView,
7
7
  PageSectionView,
8
8
  PageViewContext,
9
9
  usePageView
10
- } from "../chunk-6LM6HDKH.js";
10
+ } from "../chunk-L3PODEKP.js";
11
11
  import "../chunk-TT6ENR6T.js";
12
12
  import "../chunk-OWC7DNGJ.js";
13
- import "../chunk-4HVJHRL5.js";
14
- import "../chunk-IPB22WG3.js";
13
+ import "../chunk-HPABEDRG.js";
14
+ import "../chunk-E7TEWUNF.js";
15
15
  import "../chunk-A65WPCGZ.js";
16
16
  import "../chunk-OTYJ4MRH.js";
17
17
  export {
@@ -12,8 +12,8 @@ import {
12
12
  MediaClipLayer,
13
13
  SocialCaptionOverlay,
14
14
  formatTime
15
- } from "../chunk-2DUF6C7B.js";
16
- import "../chunk-6LM6HDKH.js";
15
+ } from "../chunk-MPOVPKIJ.js";
16
+ import "../chunk-L3PODEKP.js";
17
17
  import "../chunk-TVYZINUR.js";
18
18
  import "../chunk-TT6ENR6T.js";
19
19
  import {
@@ -22,8 +22,8 @@ import {
22
22
  } from "../chunk-OWC7DNGJ.js";
23
23
  import {
24
24
  BlockRenderer
25
- } from "../chunk-4HVJHRL5.js";
26
- import "../chunk-IPB22WG3.js";
25
+ } from "../chunk-HPABEDRG.js";
26
+ import "../chunk-E7TEWUNF.js";
27
27
  import "../chunk-A65WPCGZ.js";
28
28
  import "../chunk-OTYJ4MRH.js";
29
29
  export {