@bendyline/squisq-react 2.11.9 → 2.11.10

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,7 +1,7 @@
1
1
  import {
2
2
  BlockRenderer,
3
3
  LinearDocView
4
- } from "./chunk-LDXH4FOY.js";
4
+ } from "./chunk-CLP3VWJ2.js";
5
5
  import {
6
6
  isCaptureDrivenVideo,
7
7
  seekVideoToFrame
@@ -742,6 +742,8 @@ function PageSectionView({ entry, featureFlip, isLeadProse }) {
742
742
  const hintAttrs = {};
743
743
  if (section.hints?.vignette) hintAttrs["data-hint-vignette"] = "";
744
744
  if (section.hints?.dropCap && isLeadProse) hintAttrs["data-hint-drop-cap"] = "";
745
+ const headingLevel = section.kind !== "hero" && section.slots.title !== void 0 ? section.slots.headingLevel ?? entry.block?.sourceHeading?.depth : void 0;
746
+ if (headingLevel !== void 0) hintAttrs["data-heading-level"] = String(headingLevel);
745
747
  return /* @__PURE__ */ jsx4(
746
748
  "section",
747
749
  {
@@ -803,6 +805,7 @@ function LinearDocView({
803
805
  imageDisplayMode = "inline",
804
806
  globalKeyboardShortcuts = false,
805
807
  showCover = true,
808
+ variant = "page",
806
809
  transformPage,
807
810
  showCodeCopyButton = false,
808
811
  onCopyCode,
@@ -824,8 +827,8 @@ function LinearDocView({
824
827
  return resolvedSurface ? applySurface(baseTheme, resolvedSurface) : baseTheme;
825
828
  }, [theme, resolvedSurface]);
826
829
  const pageStyle = useMemo2(
827
- () => resolvePageStyle2(activeTheme, transformPage),
828
- [activeTheme, transformPage]
830
+ () => resolvePageStyle2(activeTheme, transformPage, variant),
831
+ [activeTheme, transformPage, variant]
829
832
  );
830
833
  const widgetFenceLangs = useMemo2(() => fenceRendererLangs(fenceRenderers), [fenceRenderers]);
831
834
  const sections = useMemo2(() => {
@@ -836,9 +839,18 @@ function LinearDocView({
836
839
  customTemplates: resolvedDoc.customTemplates,
837
840
  cover: showCover !== false ? resolvedDoc.startBlock : false,
838
841
  transformPage,
842
+ variant,
839
843
  ...widgetFenceLangs.length > 0 ? { widgetFenceLangs } : {}
840
844
  });
841
- }, [resolvedDoc, activeTheme, activeViewport, showCover, transformPage, widgetFenceLangs]);
845
+ }, [
846
+ resolvedDoc,
847
+ activeTheme,
848
+ activeViewport,
849
+ showCover,
850
+ transformPage,
851
+ variant,
852
+ widgetFenceLangs
853
+ ]);
842
854
  const renderContext = useMemo2(
843
855
  () => ({
844
856
  theme: activeTheme,
@@ -887,12 +899,12 @@ function LinearDocView({
887
899
  if (entry.section.kind === "feature-split") {
888
900
  ordinals.set(entry.section.index, featureCount++);
889
901
  }
890
- if (firstProse < 0 && entry.section.kind === "prose") {
902
+ if (variant !== "document" && firstProse < 0 && entry.section.kind === "prose") {
891
903
  firstProse = entry.section.index;
892
904
  }
893
905
  }
894
906
  return { featureOrdinals: ordinals, leadProseIndex: firstProse };
895
- }, [sections]);
907
+ }, [sections, variant]);
896
908
  useEffect(() => {
897
909
  if (!globalKeyboardShortcuts) return;
898
910
  const handleKeyDown = (event) => {
@@ -932,6 +944,7 @@ function LinearDocView({
932
944
  "squisq-md",
933
945
  "squisq-page",
934
946
  thinMargins ? "squisq-linear-content--thin squisq-page--thin" : "",
947
+ variant === "document" ? "squisq-linear-content--document squisq-page--document" : "",
935
948
  imageDisplayMode === "thumbnail" ? "squisq-linear-content--thumbnail-images squisq-page--thumbnail-images" : ""
936
949
  ].filter(Boolean).join(" ");
937
950
  return /* @__PURE__ */ jsx5(
@@ -966,7 +979,7 @@ function LinearDocView({
966
979
  ...pageStyleDataAttributes(pageStyle),
967
980
  style: {
968
981
  lineHeight: lineHt,
969
- fontSize: "16px",
982
+ fontSize: variant === "document" ? "15px" : "16px",
970
983
  fontFamily: bodyFont,
971
984
  color: textColor,
972
985
  ...buildPageCssVars(activeTheme, pageStyle),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LinearDocView
3
- } from "./chunk-LDXH4FOY.js";
3
+ } from "./chunk-CLP3VWJ2.js";
4
4
 
5
5
  // src/PaginatedDocView.tsx
6
6
  import {
package/dist/index.js CHANGED
@@ -15,10 +15,10 @@ import {
15
15
  formatTime,
16
16
  resolveDocPlayerAppearance,
17
17
  useMediaClipDurations
18
- } from "./chunk-Y2ANJRT3.js";
18
+ } from "./chunk-4KBT2CXQ.js";
19
19
  import {
20
20
  PaginatedDocView
21
- } from "./chunk-SESRQ7XH.js";
21
+ } from "./chunk-X4I6Y3OP.js";
22
22
  import {
23
23
  BlockRenderer,
24
24
  CanvasSection,
@@ -26,7 +26,7 @@ import {
26
26
  PageSectionView,
27
27
  PageViewContext,
28
28
  usePageView
29
- } from "./chunk-LDXH4FOY.js";
29
+ } from "./chunk-CLP3VWJ2.js";
30
30
  import {
31
31
  ImageLayer,
32
32
  MapLayer,
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Doc, ViewportConfig, Theme, SurfaceScheme, ThemePageStyle } from '@bendyline/squisq/schemas';
2
+ import { Doc, ViewportConfig, Theme, SurfaceScheme, PageVariant, ThemePageStyle } from '@bendyline/squisq/schemas';
3
3
  import { PageTransformHints, PageSectionMaterialization, PageSection, MaterializeBlockLayersOptions } from '@bendyline/squisq/doc';
4
4
  import { HtmlPolicy } from '@bendyline/squisq/markdown';
5
5
  import { FenceRendererMap } from '@bendyline/squisq/fence';
@@ -60,9 +60,18 @@ interface LinearDocViewProps {
60
60
  globalKeyboardShortcuts?: boolean;
61
61
  /**
62
62
  * Synthesize a hero section from `doc.startBlock` at the top of the
63
- * page (default: true). The editor's Cover toggle maps here.
63
+ * page (default: true). The editor's Cover toggle maps here. Under the
64
+ * `document` variant the cover is a left-aligned, title-only masthead.
64
65
  */
65
66
  showCover?: boolean;
67
+ /**
68
+ * Rendition register (default `'page'`, the art-directed scrolling site).
69
+ * `'document'` reads as a report: a masthead instead of a hero, one em-based
70
+ * heading scale that follows the markdown hierarchy, a 15px base, flat
71
+ * backgrounds, and auto-picked templates rendered as the prose they came
72
+ * from. Authored `{[template]}` annotations still render as typed sections.
73
+ */
74
+ variant?: PageVariant;
66
75
  /**
67
76
  * Page hints from the active transform (Summarize) style — spacing and
68
77
  * emphasis-curve adjustments defined by `TransformStyleConfig.page`.
@@ -94,7 +103,7 @@ type ImageDisplayMode = 'inline' | 'thumbnail';
94
103
  * <LinearDocView doc={doc} basePath="/media/" />
95
104
  * ```
96
105
  */
97
- declare function LinearDocView({ doc, markdown, basePath, viewport, className, theme, surface, animationsEnabled, thinMargins, imageDisplayMode, globalKeyboardShortcuts, showCover, transformPage, showCodeCopyButton, onCopyCode, fenceRenderers, htmlPolicy, linkSchemes, }: LinearDocViewProps): react_jsx_runtime.JSX.Element;
106
+ declare function LinearDocView({ doc, markdown, basePath, viewport, className, theme, surface, animationsEnabled, thinMargins, imageDisplayMode, globalKeyboardShortcuts, showCover, variant, transformPage, showCodeCopyButton, onCopyCode, fenceRenderers, htmlPolicy, linkSchemes, }: LinearDocViewProps): react_jsx_runtime.JSX.Element;
98
107
 
99
108
  interface PaginatedDocPage {
100
109
  key: string;
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  PaginatedDocView
3
- } from "../chunk-SESRQ7XH.js";
3
+ } from "../chunk-X4I6Y3OP.js";
4
4
  import {
5
5
  CanvasSection,
6
6
  LinearDocView,
7
7
  PageSectionView,
8
8
  PageViewContext,
9
9
  usePageView
10
- } from "../chunk-LDXH4FOY.js";
10
+ } from "../chunk-CLP3VWJ2.js";
11
11
  import "../chunk-W6MKRWL6.js";
12
12
  import "../chunk-TT6ENR6T.js";
13
13
  import "../chunk-6PUMLLJH.js";
@@ -12,10 +12,10 @@ import {
12
12
  MediaClipLayer,
13
13
  SocialCaptionOverlay,
14
14
  formatTime
15
- } from "../chunk-Y2ANJRT3.js";
15
+ } from "../chunk-4KBT2CXQ.js";
16
16
  import {
17
17
  BlockRenderer
18
- } from "../chunk-LDXH4FOY.js";
18
+ } from "../chunk-CLP3VWJ2.js";
19
19
  import "../chunk-W6MKRWL6.js";
20
20
  import "../chunk-MVJQL2W2.js";
21
21
  import "../chunk-TT6ENR6T.js";