@bendyline/squisq 2.12.5 → 2.13.1

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.
Files changed (37) hide show
  1. package/dist/{Doc-CwmJZayl.d.ts → Doc-C7iCmmmF.d.ts} +61 -1
  2. package/dist/{ImageEditDoc-CtRgL0wh.d.ts → ImageEditDoc-CxRHe41J.d.ts} +1 -1
  3. package/dist/{chunk-RHLRHRWY.js → chunk-2LTALYXX.js} +130 -26
  4. package/dist/{chunk-PVFDR3XT.js → chunk-3A6YM375.js} +1 -1
  5. package/dist/{chunk-4OQFLZ6G.js → chunk-5HWYSUXS.js} +20 -4
  6. package/dist/{chunk-E2NFHYCB.js → chunk-5SVFLLOD.js} +4 -1
  7. package/dist/{chunk-ILLLGZCE.js → chunk-7ZXCS3UU.js} +2 -2
  8. package/dist/{chunk-UN6S5OID.js → chunk-DCO5GYVW.js} +5 -5
  9. package/dist/{chunk-GX3VSKYS.js → chunk-GLWQTZ4C.js} +1 -1
  10. package/dist/{chunk-MWSGNEH6.js → chunk-HE3HQZWU.js} +1 -0
  11. package/dist/{chunk-GGZCJ2MS.js → chunk-HGCIIXHP.js} +52 -7
  12. package/dist/{chunk-I3ENXLAN.js → chunk-ITLJQG7Z.js} +48 -18
  13. package/dist/{chunk-XFE6WYDK.js → chunk-V4USYYYO.js} +1 -1
  14. package/dist/{chunk-HYJ63N6V.js → chunk-WNEH3BZP.js} +14 -0
  15. package/dist/doc/index.d.ts +41 -9
  16. package/dist/doc/index.js +10 -8
  17. package/dist/fence/index.d.ts +1 -1
  18. package/dist/generate/index.d.ts +1 -1
  19. package/dist/imageEdit/index.d.ts +3 -3
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.js +14 -12
  22. package/dist/jsonForm/index.d.ts +1 -1
  23. package/dist/jsonForm/index.js +3 -3
  24. package/dist/markdown/index.js +3 -3
  25. package/dist/{materializePageSection-B5LehyBR.d.ts → materializePageSection-_5uQrEYP.d.ts} +1 -1
  26. package/dist/mediaEdit/index.d.ts +2 -2
  27. package/dist/narration/index.d.ts +1 -1
  28. package/dist/narration/index.js +5 -5
  29. package/dist/recommend/index.js +2 -2
  30. package/dist/schemas/index.d.ts +4 -4
  31. package/dist/schemas/index.js +2 -2
  32. package/dist/{themeLibrary-jYL3QKTn.d.ts → themeLibrary-DsntZLoa.d.ts} +1 -1
  33. package/dist/timing/index.d.ts +7 -1
  34. package/dist/timing/index.js +1 -1
  35. package/dist/transform/index.d.ts +2 -2
  36. package/dist/transform/index.js +6 -6
  37. package/package.json +2 -1
@@ -1936,6 +1936,13 @@ interface ThemeTypography {
1936
1936
  titleLineHeight?: number;
1937
1937
  /** Default title font weight */
1938
1938
  titleWeight?: 'normal' | 'bold';
1939
+ /** Font family for social (burned-in, word-by-word) captions (default: titleFont) */
1940
+ captionFont?: FontFamily;
1941
+ /**
1942
+ * Letter case of social captions: `'upper'` (default) sets them in capitals;
1943
+ * `'as-written'` keeps the narration's own casing, so names keep their capitals.
1944
+ */
1945
+ captionCase?: 'upper' | 'as-written';
1939
1946
  }
1940
1947
  /**
1941
1948
  * Global visual-style knobs that templates consult.
@@ -2708,10 +2715,58 @@ interface TextLayer extends BaseLayer {
2708
2715
  html?: string;
2709
2716
  /** Semantic steps targeted by generated data-squisq-build-step fragments. */
2710
2717
  buildSteps?: BuildStep[];
2718
+ /**
2719
+ * Optional paragraph structure, for consumers that write native
2720
+ * paragraphs (PPTX text boxes): which paragraphs are list items, at what
2721
+ * depth, with their text free of the marker. When present, `text` is its
2722
+ * plain projection — each paragraph prefixed with its indent and marker
2723
+ * (` • item`, `2. item`), joined with `\n` — and must be kept in sync.
2724
+ * Consumers that draw `text` as-is ignore it.
2725
+ */
2726
+ paragraphs?: TextParagraph[];
2727
+ /**
2728
+ * Marks this layer as one piece of a text flow split across layers for
2729
+ * layout — a list drawn as a marker column beside a body column, so the
2730
+ * SVG renderer gets a hanging indent. See {@link TextFlow}.
2731
+ */
2732
+ flow?: TextFlow;
2711
2733
  /** Text styling */
2712
2734
  style: TextStyle;
2713
2735
  };
2714
2736
  }
2737
+ /** One paragraph of a text layer's structured projection (`TextLayer.content.paragraphs`). */
2738
+ interface TextParagraph {
2739
+ /**
2740
+ * The paragraph's text, with any list marker and indent removed. May hold
2741
+ * `\n` line breaks (they stay inside the paragraph); `''` is a blank line.
2742
+ */
2743
+ text: string;
2744
+ /** Present when the paragraph is a list item. */
2745
+ list?: TextParagraphList;
2746
+ /** Extra space above the paragraph, in canvas px. */
2747
+ spaceBefore?: number;
2748
+ }
2749
+ /** List-item facts for a {@link TextParagraph}. */
2750
+ interface TextParagraphList {
2751
+ ordered: boolean;
2752
+ /** Nesting depth; 0 is the top level. */
2753
+ level: number;
2754
+ /** The item's number, for an ordered item. */
2755
+ number?: number;
2756
+ }
2757
+ /**
2758
+ * Ties together text layers that render one flow of text. A consumer that
2759
+ * lays text out natively (PPTX) draws the flow as ONE text box over the
2760
+ * combined area of its layers, from the `paragraphs` of the non-marker
2761
+ * layers in layer order, and drops the `marker` layers, whose job its own
2762
+ * list bullets take over. Every other consumer renders each layer as usual.
2763
+ */
2764
+ interface TextFlow {
2765
+ /** Layers with the same id are one flow; unique within a block. */
2766
+ id: string;
2767
+ /** A layout-only list marker, replaced by native bullets. */
2768
+ role?: 'marker';
2769
+ }
2715
2770
  /**
2716
2771
  * A two-stop linear gradient fill, shared by shape/path fills and text
2717
2772
  * backgrounds. When present it overrides the solid `fill` color.
@@ -3255,6 +3310,11 @@ interface CaptionWord {
3255
3310
  startTime: number;
3256
3311
  /** End time in seconds */
3257
3312
  endTime: number;
3313
+ /**
3314
+ * The narration text starts a new paragraph after this word, with no punctuation to
3315
+ * show it (a spoken title or heading): captions break here as at a sentence end.
3316
+ */
3317
+ paragraphEnd?: boolean;
3258
3318
  }
3259
3319
  /**
3260
3320
  * A single caption phrase to display during playback.
@@ -3346,4 +3406,4 @@ declare function getBlockAtTime(blocks: Block[], time: number): Block | null;
3346
3406
  */
3347
3407
  declare function getCaptionAtTime(captions: CaptionTrack | undefined, time: number): CaptionPhrase | null;
3348
3408
 
3349
- export { type FullBleedQuoteInput as $, type AccentImage as A, type BarChartInput as B, type CaptionPhrase as C, type CustomTemplateValidationError as D, type CustomTemplateValidationResult as E, DARK_SURFACE as F, DEFAULT_DOC_FONT as G, DEFAULT_TITLE_FONT as H, type DataTableInput as I, type DateEventInput as J, type DeepPartial as K, type DefinitionCardInput as L, type DiagramBlockInput as M, type DiagramEdgeAnchor as N, type DiagramTemplateEdge as O, type DiagramTemplateNode as P, type Doc as Q, type DocBlock as R, type DocDiagnostic as S, type DonutChartInput as T, type DrawingBlockInput as U, FRONTMATTER_CUSTOM_TEMPLATES_KEY as V, FRONTMATTER_CUSTOM_THEMES_KEY as W, FRONTMATTER_MOTION_KEY as X, type FactCardInput as Y, type FontFamily as Z, type FontFamilyKind as _, type AccentPosition as a, type PersistentLayerTemplate as a$, type GradientBackgroundConfig as a0, type ImageBackgroundConfig as a1, type ImageLayer as a2, type ImageTreatment as a3, type ImageWithCaptionInput as a4, LIGHT_SURFACE as a5, type Layer as a6, type LayerRepeat as a7, type LayoutHints as a8, type LeftFeatureInput as a9, PAGE_EMPHASES as aA, PAGE_EYEBROWS as aB, PAGE_HEADING_CASES as aC, PAGE_HEADING_SCALES as aD, PAGE_HEADING_UNDERLINES as aE, PAGE_HERO_STYLES as aF, PAGE_IMAGE_FRAMINGS as aG, PAGE_NUMERAL_STYLES as aH, PAGE_PATTERNS as aI, PAGE_QUOTE_MARKS as aJ, PAGE_SECTION_KINDS as aK, PAGE_SECTION_SPACINGS as aL, PAGE_SHADOWS as aM, PAGE_VARIANTS as aN, type PageAccentRotation as aO, type PageBackground as aP, type PageDesignFamily as aQ, type PageEmphasis as aR, type PageHeadingTreatment as aS, type PageSectionKind as aT, type PageSectionOverride as aU, type PageTokens as aV, type PageVariant as aW, type PathLayer as aX, type PatternBackgroundConfig as aY, type PersistentLayer as aZ, type PersistentLayerConfig as a_, type LineChartInput as aa, type LinearGradient as ab, type ListBlockInput as ac, MOTION_PROFILES as ad, type MapBlockInput as ae, type MapLayer as af, type MapMarker as ag, type MapTileStyle as ah, type MarkerStyle as ai, type MediaClip as aj, type MediaCrop as ak, type MediaCut as al, type MediaEdits as am, type MediaScheduleOptions as an, type MermaidLayer as ao, type MotionEntrance as ap, type MotionOrigin as aq, type MotionProfile as ar, type MotionProfileName as as, type MotionSpec as at, type MotionState as au, PAGE_ACCENT_STRATEGIES as av, PAGE_BACKGROUNDS as aw, PAGE_BACKGROUND_RHYTHMS as ax, PAGE_DESIGN_FAMILIES as ay, PAGE_DIVIDERS as az, type AmbientGradientConfig as b, type VideoPullQuoteInput as b$, type PersistentLayerTemplateConfig as b0, type PersistentLayerTemplateType as b1, type PhotoGridInput as b2, type PieChartInput as b3, type PipStyle as b4, type Position as b5, type ProgressIndicatorConfig as b6, type PromotedBodyAnnotation as b7, type PullQuoteInput as b8, type QuoteBlockInput as b9, type ThemePageStyle as bA, type ThemeRegistry as bB, type ThemeSchemaVersion as bC, type ThemeSeedColors as bD, type ThemeStyle as bE, type ThemeTypography as bF, type TimelineBlockInput as bG, type TimelineTemplateEvent as bH, type TimelineTemplateLink as bI, type TimelineTemplateTrack as bJ, type TitleBlockInput as bK, type TitleCaptionConfig as bL, type TranscriptBlockInput as bM, type TreeBlockInput as bN, type TreeLayer as bO, type TreeLayerItem as bP, type TreeLayerStyle as bQ, type TreeTemplateItem as bR, type TwoColumnInput as bS, VIEWPORT_PRESETS as bT, type VideoEmbedLayer as bU, type VideoLayer as bV, type VideoPipPosition as bW, type VideoPipShape as bX, type VideoPipSize as bY, type VideoPlacement as bZ, type VideoPresentation as b_, type RawLayersInput as ba, type RenderStyle as bb, type RightFeatureInput as bc, type ScatterChartInput as bd, type ScheduledClip as be, type SectionHeaderInput as bf, type ShapeFilter as bg, type ShapeLayer as bh, type ShapePattern as bi, type SolidBackgroundConfig as bj, type StartBlockConfig as bk, type StatHighlightInput as bl, type SurfaceScheme as bm, type SvgLayer as bn, THEME_SCHEMA_VERSION as bo, type TableLayer as bp, type TableLayerStyle as bq, type TemplateBlock as br, type TemplateContext as bs, type TemplateFunction as bt, type TemplateRegistry as bu, type TextLayer as bv, type TextStyle as bw, type Theme as bx, type ThemeColorPalette as by, type ThemeColorScheme as bz, type Animation as c, type VideoWithCaptionInput as c0, type ViewportConfig as c1, type ViewportOrientation as c2, type ViewportPreset as c3, type VignetteConfig as c4, applySurface as c5, calculateDuration as c6, calculateFontScale as c7, createTemplateContext as c8, createTheme as c9, MEDIA_FX_ORDER as cA, MEDIA_FX_SPECS as cB, type MediaEditParamKey as cC, type MediaEditParamValues as cD, type MediaFxOp as cE, formatMediaNumber as cF, hasRenderableFx as cG, mediaEditHtmlAttribute as cH, mediaEditValuesFromAttributes as cI, mediaEditValuesFromParams as cJ, mediaRenderKey as cK, normalizeMediaCrop as cL, normalizeMediaCuts as cM, parseMediaCrop as cN, parseMediaCuts as cO, parseMediaEdits as cP, parseMediaFx as cQ, serializeMediaCrop as cR, serializeMediaCuts as cS, serializeMediaEdits as cT, serializeMediaFx as cU, createThemeRegistry as ca, getAspectRatioString as cb, getBlockAtTime as cc, getCaptionAtTime as cd, getDocPlaybackDuration as ce, getLayoutHints as cf, getSafeTextBounds as cg, getSegmentAtTime as ch, getTwoColumnPositions as ci, getViewport as cj, getViewportOrientation as ck, isCustomTemplateDefinition as cl, isMotionProfileName as cm, isPersistentLayerTemplate as cn, isTemplateBlock as co, scaledFontSize$1 as cp, readFrontmatterMotion as cq, resolveMediaSchedule as cr, resolveMotionForDoc as cs, resolveMotionProfile as ct, scaledFontSize as cu, scheduleMediaClip as cv, validateCustomTemplateDefinition as cw, type MediaFxOpId as cx, type MediaFxChain as cy, MEDIA_EDIT_PARAMS as cz, type AnimationType as d, type AreaChartInput as e, type AudioBookmark as f, type AudioSegment as g, type AudioTimingData as h, type AudioTrack as i, type BigTextInput as j, type Block as k, type BlockConnection as l, type BorderStyle as m, type CaptionTrack as n, type CaptionWord as o, type ChartBaseFields as p, type ChartTemplateInput as q, type ColorScheme as r, type ColumnChartInput as s, type ComparisonBarInput as t, type ContentBlockInput as u, type CornerBrandingConfig as v, type CountUpSpec as w, type CreateTemplateContextOptions as x, type CustomTemplateDefinition as y, type CustomTemplateLayer as z };
3409
+ export { type FullBleedQuoteInput as $, type AccentImage as A, type BarChartInput as B, type CaptionPhrase as C, type CustomTemplateValidationError as D, type CustomTemplateValidationResult as E, DARK_SURFACE as F, DEFAULT_DOC_FONT as G, DEFAULT_TITLE_FONT as H, type DataTableInput as I, type DateEventInput as J, type DeepPartial as K, type DefinitionCardInput as L, type DiagramBlockInput as M, type DiagramEdgeAnchor as N, type DiagramTemplateEdge as O, type DiagramTemplateNode as P, type Doc as Q, type DocBlock as R, type DocDiagnostic as S, type DonutChartInput as T, type DrawingBlockInput as U, FRONTMATTER_CUSTOM_TEMPLATES_KEY as V, FRONTMATTER_CUSTOM_THEMES_KEY as W, FRONTMATTER_MOTION_KEY as X, type FactCardInput as Y, type FontFamily as Z, type FontFamilyKind as _, type AccentPosition as a, type PersistentLayerTemplate as a$, type GradientBackgroundConfig as a0, type ImageBackgroundConfig as a1, type ImageLayer as a2, type ImageTreatment as a3, type ImageWithCaptionInput as a4, LIGHT_SURFACE as a5, type Layer as a6, type LayerRepeat as a7, type LayoutHints as a8, type LeftFeatureInput as a9, PAGE_EMPHASES as aA, PAGE_EYEBROWS as aB, PAGE_HEADING_CASES as aC, PAGE_HEADING_SCALES as aD, PAGE_HEADING_UNDERLINES as aE, PAGE_HERO_STYLES as aF, PAGE_IMAGE_FRAMINGS as aG, PAGE_NUMERAL_STYLES as aH, PAGE_PATTERNS as aI, PAGE_QUOTE_MARKS as aJ, PAGE_SECTION_KINDS as aK, PAGE_SECTION_SPACINGS as aL, PAGE_SHADOWS as aM, PAGE_VARIANTS as aN, type PageAccentRotation as aO, type PageBackground as aP, type PageDesignFamily as aQ, type PageEmphasis as aR, type PageHeadingTreatment as aS, type PageSectionKind as aT, type PageSectionOverride as aU, type PageTokens as aV, type PageVariant as aW, type PathLayer as aX, type PatternBackgroundConfig as aY, type PersistentLayer as aZ, type PersistentLayerConfig as a_, type LineChartInput as aa, type LinearGradient as ab, type ListBlockInput as ac, MOTION_PROFILES as ad, type MapBlockInput as ae, type MapLayer as af, type MapMarker as ag, type MapTileStyle as ah, type MarkerStyle as ai, type MediaClip as aj, type MediaCrop as ak, type MediaCut as al, type MediaEdits as am, type MediaScheduleOptions as an, type MermaidLayer as ao, type MotionEntrance as ap, type MotionOrigin as aq, type MotionProfile as ar, type MotionProfileName as as, type MotionSpec as at, type MotionState as au, PAGE_ACCENT_STRATEGIES as av, PAGE_BACKGROUNDS as aw, PAGE_BACKGROUND_RHYTHMS as ax, PAGE_DESIGN_FAMILIES as ay, PAGE_DIVIDERS as az, type AmbientGradientConfig as b, type VideoPipSize as b$, type PersistentLayerTemplateConfig as b0, type PersistentLayerTemplateType as b1, type PhotoGridInput as b2, type PieChartInput as b3, type PipStyle as b4, type Position as b5, type ProgressIndicatorConfig as b6, type PromotedBodyAnnotation as b7, type PullQuoteInput as b8, type QuoteBlockInput as b9, type Theme as bA, type ThemeColorPalette as bB, type ThemeColorScheme as bC, type ThemePageStyle as bD, type ThemeRegistry as bE, type ThemeSchemaVersion as bF, type ThemeSeedColors as bG, type ThemeStyle as bH, type ThemeTypography as bI, type TimelineBlockInput as bJ, type TimelineTemplateEvent as bK, type TimelineTemplateLink as bL, type TimelineTemplateTrack as bM, type TitleBlockInput as bN, type TitleCaptionConfig as bO, type TranscriptBlockInput as bP, type TreeBlockInput as bQ, type TreeLayer as bR, type TreeLayerItem as bS, type TreeLayerStyle as bT, type TreeTemplateItem as bU, type TwoColumnInput as bV, VIEWPORT_PRESETS as bW, type VideoEmbedLayer as bX, type VideoLayer as bY, type VideoPipPosition as bZ, type VideoPipShape as b_, type RawLayersInput as ba, type RenderStyle as bb, type RightFeatureInput as bc, type ScatterChartInput as bd, type ScheduledClip as be, type SectionHeaderInput as bf, type ShapeFilter as bg, type ShapeLayer as bh, type ShapePattern as bi, type SolidBackgroundConfig as bj, type StartBlockConfig as bk, type StatHighlightInput as bl, type SurfaceScheme as bm, type SvgLayer as bn, THEME_SCHEMA_VERSION as bo, type TableLayer as bp, type TableLayerStyle as bq, type TemplateBlock as br, type TemplateContext as bs, type TemplateFunction as bt, type TemplateRegistry as bu, type TextFlow as bv, type TextLayer as bw, type TextParagraph as bx, type TextParagraphList as by, type TextStyle as bz, type Animation as c, type VideoPlacement as c0, type VideoPresentation as c1, type VideoPullQuoteInput as c2, type VideoWithCaptionInput as c3, type ViewportConfig as c4, type ViewportOrientation as c5, type ViewportPreset as c6, type VignetteConfig as c7, applySurface as c8, calculateDuration as c9, type MediaFxOpId as cA, type MediaFxChain as cB, MEDIA_EDIT_PARAMS as cC, MEDIA_FX_ORDER as cD, MEDIA_FX_SPECS as cE, type MediaEditParamKey as cF, type MediaEditParamValues as cG, type MediaFxOp as cH, formatMediaNumber as cI, hasRenderableFx as cJ, mediaEditHtmlAttribute as cK, mediaEditValuesFromAttributes as cL, mediaEditValuesFromParams as cM, mediaRenderKey as cN, normalizeMediaCrop as cO, normalizeMediaCuts as cP, parseMediaCrop as cQ, parseMediaCuts as cR, parseMediaEdits as cS, parseMediaFx as cT, serializeMediaCrop as cU, serializeMediaCuts as cV, serializeMediaEdits as cW, serializeMediaFx as cX, calculateFontScale as ca, createTemplateContext as cb, createTheme as cc, createThemeRegistry as cd, getAspectRatioString as ce, getBlockAtTime as cf, getCaptionAtTime as cg, getDocPlaybackDuration as ch, getLayoutHints as ci, getSafeTextBounds as cj, getSegmentAtTime as ck, getTwoColumnPositions as cl, getViewport as cm, getViewportOrientation as cn, isCustomTemplateDefinition as co, isMotionProfileName as cp, isPersistentLayerTemplate as cq, isTemplateBlock as cr, scaledFontSize$1 as cs, readFrontmatterMotion as ct, resolveMediaSchedule as cu, resolveMotionForDoc as cv, resolveMotionProfile as cw, scaledFontSize as cx, scheduleMediaClip as cy, validateCustomTemplateDefinition as cz, type AnimationType as d, type AreaChartInput as e, type AudioBookmark as f, type AudioSegment as g, type AudioTimingData as h, type AudioTrack as i, type BigTextInput as j, type Block as k, type BlockConnection as l, type BorderStyle as m, type CaptionTrack as n, type CaptionWord as o, type ChartBaseFields as p, type ChartTemplateInput as q, type ColorScheme as r, type ColumnChartInput as s, type ComparisonBarInput as t, type ContentBlockInput as u, type CornerBrandingConfig as v, type CountUpSpec as w, type CreateTemplateContextOptions as x, type CustomTemplateDefinition as y, type CustomTemplateLayer as z };
@@ -1,4 +1,4 @@
1
- import { a2 as ImageLayer, bv as TextLayer, bh as ShapeLayer, aX as PathLayer } from './Doc-CwmJZayl.js';
1
+ import { a2 as ImageLayer, bw as TextLayer, bh as ShapeLayer, aX as PathLayer } from './Doc-C7iCmmmF.js';
2
2
 
3
3
  /**
4
4
  * ImageEditDoc — JSON document describing a layered, editable image.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-FTN6SGW5.js";
4
4
  import {
5
5
  applySavedPresentation
6
- } from "./chunk-UN6S5OID.js";
6
+ } from "./chunk-DCO5GYVW.js";
7
7
  import {
8
8
  SHAPE_NAMES,
9
9
  buildChartData,
@@ -32,7 +32,7 @@ import {
32
32
  templateRegistry,
33
33
  writeCustomTemplatesToFrontmatter,
34
34
  writeCustomThemesToFrontmatter
35
- } from "./chunk-I3ENXLAN.js";
35
+ } from "./chunk-ITLJQG7Z.js";
36
36
  import {
37
37
  ASCII_TREE_VOCAB,
38
38
  ASCII_VOCAB,
@@ -50,10 +50,11 @@ import {
50
50
  isLineChar,
51
51
  isPictureFence,
52
52
  isVert,
53
+ parseAsciiDiagram,
53
54
  toCells,
54
55
  toGrid,
55
56
  traceBoxes
56
- } from "./chunk-GGZCJ2MS.js";
57
+ } from "./chunk-HGCIIXHP.js";
57
58
  import {
58
59
  iconMarker
59
60
  } from "./chunk-7ZAAICW4.js";
@@ -77,7 +78,7 @@ import {
77
78
  resolveFontFamily,
78
79
  resolveTheme,
79
80
  withAlpha
80
- } from "./chunk-HYJ63N6V.js";
81
+ } from "./chunk-WNEH3BZP.js";
81
82
  import {
82
83
  createMediaTimeMap
83
84
  } from "./chunk-JSGIWW35.js";
@@ -86,7 +87,7 @@ import {
86
87
  } from "./chunk-L7QZORLB.js";
87
88
  import {
88
89
  parseMarkdown
89
- } from "./chunk-PVFDR3XT.js";
90
+ } from "./chunk-3A6YM375.js";
90
91
  import {
91
92
  TABLE_FED_TEMPLATES,
92
93
  TEMPLATE_ALIASES,
@@ -104,14 +105,14 @@ import {
104
105
  parseHtmlToNodes,
105
106
  parseVideoEmbedUrl,
106
107
  readFrontmatterThemeId
107
- } from "./chunk-MWSGNEH6.js";
108
+ } from "./chunk-HE3HQZWU.js";
108
109
  import {
109
110
  BUILD_PARAM_KEYS,
110
111
  buildSpecParams
111
112
  } from "./chunk-P53Z4RYC.js";
112
113
  import {
113
114
  buildCaptionTrack
114
- } from "./chunk-4OQFLZ6G.js";
115
+ } from "./chunk-5HWYSUXS.js";
115
116
  import {
116
117
  estimateTimeFromText
117
118
  } from "./chunk-GHOPHGOK.js";
@@ -5304,6 +5305,26 @@ function computeSideDegrees(nodes, edges) {
5304
5305
  }
5305
5306
  return deg;
5306
5307
  }
5308
+ function leafBoxSize(node, deg) {
5309
+ const labelLines = normalizeLabelLines(node.label);
5310
+ const innerW = labelLines.reduce((w, l) => Math.max(w, cellWidth(l)), 0);
5311
+ const horizDeg = Math.max(deg.top, deg.bottom);
5312
+ const vertDeg = Math.max(deg.left, deg.right);
5313
+ return {
5314
+ wCols: Math.max(node.wCols, innerW + 4, 3, horizDeg > 0 ? 2 * horizDeg + 1 : 0),
5315
+ hRows: Math.max(node.hRows, labelLines.length + 2, 3, vertDeg > 0 ? 2 * vertDeg + 1 : 0)
5316
+ };
5317
+ }
5318
+ function containerBoxMargins(label) {
5319
+ const labelLines = normalizeLabelLines(label);
5320
+ const titleLen = cellWidth(labelLines[0] ?? "");
5321
+ const innerLinesW = labelLines.slice(1).reduce((w, l) => Math.max(w, cellWidth(l)), 0);
5322
+ return {
5323
+ top: 2 + Math.max(0, labelLines.length - 1),
5324
+ side: 2,
5325
+ minWidth: Math.max(titleLen > 0 ? titleLen + 6 : 3, innerLinesW > 0 ? innerLinesW + 4 : 3)
5326
+ };
5327
+ }
5307
5328
  function layoutNodes(nodes, edges) {
5308
5329
  const byId = /* @__PURE__ */ new Map();
5309
5330
  for (const node of nodes) byId.set(node.id, node);
@@ -5357,17 +5378,8 @@ function layoutNodes(nodes, edges) {
5357
5378
  const labelLines = normalizeLabelLines(node.label);
5358
5379
  const children = childIds.get(id) ?? [];
5359
5380
  if (children.length === 0) {
5360
- const innerW = labelLines.reduce((w, l) => Math.max(w, cellWidth(l)), 0);
5361
5381
  const deg = sideDeg.get(id) ?? { top: 0, bottom: 0, left: 0, right: 0 };
5362
- const horizDeg = Math.max(deg.top, deg.bottom);
5363
- const vertDeg = Math.max(deg.left, deg.right);
5364
- const wCols = Math.max(node.wCols, innerW + 4, 3, horizDeg > 0 ? 2 * horizDeg + 1 : 0);
5365
- const hRows = Math.max(
5366
- node.hRows,
5367
- labelLines.length + 2,
5368
- 3,
5369
- vertDeg > 0 ? 2 * vertDeg + 1 : 0
5370
- );
5382
+ const { wCols, hRows } = leafBoxSize(node, deg);
5371
5383
  const rect2 = {
5372
5384
  r0: node.row,
5373
5385
  c0: node.col,
@@ -5379,17 +5391,14 @@ function layoutNodes(nodes, edges) {
5379
5391
  }
5380
5392
  const childRects = placeSiblings(children, (childId) => layoutSubtree(childId, depth + 1));
5381
5393
  const bbox = unionRects(childRects);
5382
- const extraRows = Math.max(0, labelLines.length - 1);
5383
- const titleLen = cellWidth(labelLines[0] ?? "");
5394
+ const margins = containerBoxMargins(node.label);
5384
5395
  const rect = {
5385
- r0: bbox.r0 - 2 - extraRows,
5386
- c0: bbox.c0 - 2,
5387
- r1: bbox.r1 + 2,
5388
- c1: bbox.c1 + 2
5396
+ r0: bbox.r0 - margins.top,
5397
+ c0: bbox.c0 - margins.side,
5398
+ r1: bbox.r1 + margins.side,
5399
+ c1: bbox.c1 + margins.side
5389
5400
  };
5390
- const innerLinesW = labelLines.slice(1).reduce((w, l) => Math.max(w, cellWidth(l)), 0);
5391
- const minW = Math.max(titleLen > 0 ? titleLen + 6 : 3, innerLinesW > 0 ? innerLinesW + 4 : 3);
5392
- if (rect.c1 - rect.c0 + 1 < minW) rect.c1 = rect.c0 + minW - 1;
5401
+ if (rect.c1 - rect.c0 + 1 < margins.minWidth) rect.c1 = rect.c0 + margins.minWidth - 1;
5393
5402
  if (rect.c1 - rect.c0 + 1 < node.wCols) rect.c1 = rect.c0 + node.wCols - 1;
5394
5403
  placed.set(id, { node, rect, labelLines, isContainer: true, depth });
5395
5404
  return rect;
@@ -6237,6 +6246,100 @@ function detectGridStyle(grid) {
6237
6246
  return ascii > unicode ? "ascii" : "unicode";
6238
6247
  }
6239
6248
 
6249
+ // src/doc/asciiDiagram/arrange.ts
6250
+ import { layoutGraph } from "@bendyline/squisq-graph";
6251
+ var CELL_ASPECT = 2;
6252
+ var TARGET_ASPECT = 1.6;
6253
+ function arrangeAsciiDiagram(diagram2, options = {}) {
6254
+ if (diagram2.nodes.length === 0) return diagram2;
6255
+ const first = options.direction ?? "down";
6256
+ const meaning = diagramMeaning(diagram2);
6257
+ const asRendered = diagramMeaning(parseAsciiDiagram(renderAsciiDiagram(diagram2)));
6258
+ for (const direction of [first, first === "down" ? "right" : "down"]) {
6259
+ const arranged = arrangeOnce(diagram2, direction);
6260
+ const back = diagramMeaning(parseAsciiDiagram(renderAsciiDiagram(arranged)));
6261
+ if (back === meaning || back === asRendered) return arranged;
6262
+ }
6263
+ return diagram2;
6264
+ }
6265
+ function diagramMeaning(d) {
6266
+ const labelOf = new Map(d.nodes.map((n) => [n.id, n.label]));
6267
+ const nodes = d.nodes.map((n) => JSON.stringify([n.label, n.containerId ? labelOf.get(n.containerId) : null])).sort();
6268
+ const edges = d.edges.map((e) => {
6269
+ const ends = [labelOf.get(e.source) ?? "", labelOf.get(e.target) ?? ""];
6270
+ if (!e.directed) ends.sort();
6271
+ return JSON.stringify([...ends, e.label ?? null, e.directed]);
6272
+ }).sort();
6273
+ return JSON.stringify([nodes, edges]);
6274
+ }
6275
+ function arrangeOnce(diagram2, direction) {
6276
+ const ids = new Set(diagram2.nodes.map((n) => n.id));
6277
+ const parentOf = (n) => n.containerId && n.containerId !== n.id && ids.has(n.containerId) ? n.containerId : void 0;
6278
+ const containers = new Set(diagram2.nodes.map(parentOf).filter((p) => !!p));
6279
+ const longestLabel = diagram2.edges.reduce((m, e) => Math.max(m, (e.label ?? "").length), 0);
6280
+ const titleRows = diagram2.nodes.filter((n) => containers.has(n.id)).reduce((m, n) => Math.max(m, containerBoxMargins(n.label).top), 2);
6281
+ const right = direction === "right";
6282
+ const settings = {
6283
+ direction,
6284
+ integerCoordinates: true,
6285
+ nodeSpacing: right ? 2 : 4,
6286
+ layerSpacing: right ? Math.max(8, longestLabel + 6) : 3,
6287
+ edgeSpacing: 2,
6288
+ componentSpacing: right ? 4 : 2,
6289
+ containerPadding: { top: titleRows, right: 2, bottom: 2, left: 2 },
6290
+ aspectRatio: TARGET_ASPECT * CELL_ASPECT
6291
+ };
6292
+ const degrees = new Map(
6293
+ diagram2.nodes.map((n) => [n.id, { top: 0, bottom: 0, left: 0, right: 0 }])
6294
+ );
6295
+ for (const e of diagram2.edges) {
6296
+ if (e.source === e.target || !ids.has(e.source) || !ids.has(e.target)) continue;
6297
+ degrees.get(e.source)[right ? "right" : "bottom"]++;
6298
+ degrees.get(e.target)[right ? "left" : "top"]++;
6299
+ }
6300
+ let arranged = diagram2.nodes;
6301
+ for (let pass = 0; pass < 3; pass++) {
6302
+ const graph = {
6303
+ nodes: diagram2.nodes.map((n) => {
6304
+ const parent = parentOf(n);
6305
+ if (containers.has(n.id)) {
6306
+ return { id: n.id, width: containerBoxMargins(n.label).minWidth, height: 3, parent };
6307
+ }
6308
+ const size = leafBoxSize(n, degrees.get(n.id));
6309
+ return { id: n.id, width: size.wCols, height: size.hRows, parent };
6310
+ }),
6311
+ edges: diagram2.edges.map((e, i) => ({ id: String(i), source: e.source, target: e.target }))
6312
+ };
6313
+ const result = layoutGraph(graph, settings);
6314
+ arranged = diagram2.nodes.map((n, i) => {
6315
+ const placed = result.nodes[i];
6316
+ return containers.has(n.id) ? { ...n, col: placed.x, row: placed.y, wCols: graph.nodes[i].width, hRows: 3 } : { ...n, col: placed.x, row: placed.y, wCols: placed.width, hRows: placed.height };
6317
+ });
6318
+ let grew = false;
6319
+ const actual = computeSideDegrees(arranged, diagram2.edges);
6320
+ for (const n of arranged) {
6321
+ if (containers.has(n.id)) continue;
6322
+ const need = leafBoxSize(n, actual.get(n.id));
6323
+ if (need.wCols > n.wCols || need.hRows > n.hRows) {
6324
+ const d = degrees.get(n.id);
6325
+ const a = actual.get(n.id);
6326
+ degrees.set(n.id, {
6327
+ top: Math.max(d.top, a.top),
6328
+ bottom: Math.max(d.bottom, a.bottom),
6329
+ left: Math.max(d.left, a.left),
6330
+ right: Math.max(d.right, a.right)
6331
+ });
6332
+ grew = true;
6333
+ }
6334
+ }
6335
+ if (!grew) break;
6336
+ }
6337
+ return {
6338
+ ...diagram2,
6339
+ nodes: [...arranged].sort((a, b) => a.row - b.row || a.col - b.col)
6340
+ };
6341
+ }
6342
+
6240
6343
  // src/doc/asciiTimeline/render.ts
6241
6344
  var UNICODE_VOCAB2 = {
6242
6345
  rail: "\u2500",
@@ -6589,6 +6692,7 @@ export {
6589
6692
  renderAsciiDiagram,
6590
6693
  isRepairableDiagram,
6591
6694
  repairAsciiDiagram,
6695
+ arrangeAsciiDiagram,
6592
6696
  renderAsciiTimeline,
6593
6697
  renderTree
6594
6698
  };
@@ -11,7 +11,7 @@ import {
11
11
  parseFrontmatter,
12
12
  parseHtmlToNodes,
13
13
  sanitizeUrl
14
- } from "./chunk-MWSGNEH6.js";
14
+ } from "./chunk-HE3HQZWU.js";
15
15
  import {
16
16
  resolveIcon
17
17
  } from "./chunk-CZ7AUSLI.js";
@@ -8,6 +8,20 @@ var DEFAULT_TARGET_WORDS = 10;
8
8
  var DEFAULT_MIN_DURATION = 1.5;
9
9
  var DEFAULT_MAX_DURATION = 6;
10
10
  var DEFAULT_WORDS_PER_SECOND = 2.5;
11
+ var CLOSING_MARKS = /^[.,;:!?…"'”’»)\]]+/;
12
+ var OPENING_MARKS = /[“"‘'«([]+$/;
13
+ function writtenWord(sourceText, bookmark, fragment) {
14
+ const at = bookmark.charOffset;
15
+ if (!sourceText || !(at >= 0)) return { text: fragment, paragraphEnd: false };
16
+ if (sourceText.slice(at, at + fragment.length).toLowerCase() !== fragment.toLowerCase()) {
17
+ return { text: fragment, paragraphEnd: false };
18
+ }
19
+ const end = at + fragment.length;
20
+ const before = OPENING_MARKS.exec(sourceText.slice(Math.max(0, at - 3), at))?.[0] ?? "";
21
+ const after = CLOSING_MARKS.exec(sourceText.slice(end, end + 4))?.[0] ?? "";
22
+ const paragraphEnd = /^[^\S\n]*\n/.test(sourceText.slice(end + after.length));
23
+ return { text: before + fragment + after, paragraphEnd };
24
+ }
11
25
  function phrasesFromTiming(source, segmentIndex, targetWords) {
12
26
  const { segment, timing } = source;
13
27
  if (!timing || timing.bookmarks.length === 0) return [];
@@ -17,8 +31,9 @@ function phrasesFromTiming(source, segmentIndex, targetWords) {
17
31
  let phraseText = "";
18
32
  for (let index = 0; index < timing.bookmarks.length; index += 1) {
19
33
  const bookmark = timing.bookmarks[index];
20
- const text = bookmark.textFragment?.trim() ?? "";
21
- if (!text) continue;
34
+ const fragment = bookmark.textFragment?.trim() ?? "";
35
+ if (!fragment) continue;
36
+ const { text, paragraphEnd } = writtenWord(timing.sourceText, bookmark, fragment);
22
37
  const next = timing.bookmarks[index + 1];
23
38
  const startTime = Math.min(
24
39
  segmentEnd,
@@ -31,11 +46,12 @@ function phrasesFromTiming(source, segmentIndex, targetWords) {
31
46
  const word = {
32
47
  text,
33
48
  startTime,
34
- endTime
49
+ endTime,
50
+ ...paragraphEnd ? { paragraphEnd: true } : {}
35
51
  };
36
52
  words.push(word);
37
53
  phraseText += `${phraseText ? " " : ""}${text}`;
38
- const flush = /[.!?]$/.test(text) && words.length >= 4 || /[,;:]$/.test(text) && words.length >= targetWords - 2 || words.length >= targetWords + 3 || index === timing.bookmarks.length - 1;
54
+ const flush = paragraphEnd || /[.!?]$/.test(text) && words.length >= 4 || /[,;:]$/.test(text) && words.length >= targetWords - 2 || words.length >= targetWords + 3 || index === timing.bookmarks.length - 1;
39
55
  if (flush) {
40
56
  phrases.push({
41
57
  text: phraseText,
@@ -15,7 +15,7 @@ import {
15
15
  relativeLuminance,
16
16
  resolveFontFamily,
17
17
  withAlpha
18
- } from "./chunk-HYJ63N6V.js";
18
+ } from "./chunk-WNEH3BZP.js";
19
19
  import {
20
20
  SVG_ISLAND_LIMITS,
21
21
  parseBuildSpec
@@ -598,6 +598,9 @@ function compileTheme(partial, opts = {}) {
598
598
  if (partialTypography.monoFont !== void 0) {
599
599
  merged.typography.monoFont = partialTypography.monoFont;
600
600
  }
601
+ if (partialTypography.captionFont !== void 0) {
602
+ merged.typography.captionFont = partialTypography.captionFont;
603
+ }
601
604
  }
602
605
  if (partial.colorSchemes !== void 0) {
603
606
  merged.colorSchemes = partial.colorSchemes;
@@ -3,14 +3,14 @@ import {
3
3
  parseMarkdown,
4
4
  remarkWikiLinks,
5
5
  toMdast
6
- } from "./chunk-PVFDR3XT.js";
6
+ } from "./chunk-3A6YM375.js";
7
7
  import {
8
8
  formatFrontmatterYaml,
9
9
  getChildren,
10
10
  splitFrontmatterBlock,
11
11
  stringifyHtmlNodes,
12
12
  walkMarkdownTree
13
- } from "./chunk-MWSGNEH6.js";
13
+ } from "./chunk-HE3HQZWU.js";
14
14
 
15
15
  // src/markdown/stringify.ts
16
16
  import { unified } from "unified";
@@ -4,7 +4,7 @@ import {
4
4
  flattenRenderableBlocks,
5
5
  getPinnedBlockMeta,
6
6
  markdownToDoc
7
- } from "./chunk-I3ENXLAN.js";
7
+ } from "./chunk-ITLJQG7Z.js";
8
8
  import {
9
9
  deriveTemplateInputs,
10
10
  extractImages,
@@ -12,7 +12,7 @@ import {
12
12
  isAsciiTimelineFence,
13
13
  isPictureFence,
14
14
  isTreeFence
15
- } from "./chunk-GGZCJ2MS.js";
15
+ } from "./chunk-HGCIIXHP.js";
16
16
  import {
17
17
  extractContent,
18
18
  mapElementToBlock,
@@ -21,10 +21,10 @@ import {
21
21
  import {
22
22
  cloneAndFreezeData,
23
23
  isTemplateBlock
24
- } from "./chunk-HYJ63N6V.js";
24
+ } from "./chunk-WNEH3BZP.js";
25
25
  import {
26
26
  parseMarkdown
27
- } from "./chunk-PVFDR3XT.js";
27
+ } from "./chunk-3A6YM375.js";
28
28
  import {
29
29
  isContainerTemplate
30
30
  } from "./chunk-Y25EJEZN.js";
@@ -32,7 +32,7 @@ import {
32
32
  extractPlainText,
33
33
  getChildren,
34
34
  stringifyHtmlNodes
35
- } from "./chunk-MWSGNEH6.js";
35
+ } from "./chunk-HE3HQZWU.js";
36
36
  import {
37
37
  parseBuildSpec
38
38
  } from "./chunk-P53Z4RYC.js";
@@ -2,7 +2,7 @@ import {
2
2
  DEFAULT_THEME,
3
3
  applySurface,
4
4
  resolveFontFamily
5
- } from "./chunk-HYJ63N6V.js";
5
+ } from "./chunk-WNEH3BZP.js";
6
6
 
7
7
  // src/jsonForm/chooseControl.ts
8
8
  var ENUM_SEGMENTED_LIMIT = 4;
@@ -176,6 +176,7 @@ function extractPlainText(node) {
176
176
  if ("value" in node && typeof node.value === "string") {
177
177
  return node.value;
178
178
  }
179
+ if (node.type === "break") return "\n";
179
180
  const children = getChildren(node);
180
181
  const separator = node.type === "list" || node.type === "listItem" || node.type === "table" ? "\n" : node.type === "tableRow" ? " " : "";
181
182
  return children.map(extractPlainText).join(separator);
@@ -8,7 +8,7 @@ import {
8
8
  parseTimeSeconds,
9
9
  sanitizeUrl,
10
10
  walkMarkdownTree
11
- } from "./chunk-MWSGNEH6.js";
11
+ } from "./chunk-HE3HQZWU.js";
12
12
 
13
13
  // src/doc/asciiDiagram/chars.ts
14
14
  function toCells(s) {
@@ -1212,12 +1212,16 @@ function isLattice(diagram) {
1212
1212
  }
1213
1213
 
1214
1214
  // src/doc/templates/diagramLayout.ts
1215
+ import { layoutGraph } from "@bendyline/squisq-graph";
1215
1216
  var DEFAULT_OPTS = {
1216
1217
  gapX: 260,
1217
1218
  gapY: 140,
1218
1219
  gridPad: 80,
1219
1220
  gridOriginX: 80,
1220
- gridOriginY: 80
1221
+ gridOriginY: 80,
1222
+ nodeWidth: 180,
1223
+ nodeHeight: 64,
1224
+ direction: "right"
1221
1225
  };
1222
1226
  function computeDiagramLayout(children, options = {}) {
1223
1227
  const opts = { ...DEFAULT_OPTS, ...options };
@@ -1236,7 +1240,6 @@ function computeDiagramLayout(children, options = {}) {
1236
1240
  }
1237
1241
  }
1238
1242
  if (unpositionedIdx.length > 0) {
1239
- const cols = Math.max(1, Math.ceil(Math.sqrt(unpositionedIdx.length)));
1240
1243
  let baseX = opts.gridOriginX;
1241
1244
  let baseY = opts.gridOriginY;
1242
1245
  const pinned = entries.filter((e) => e.pinned);
@@ -1246,11 +1249,15 @@ function computeDiagramLayout(children, options = {}) {
1246
1249
  baseX = minX;
1247
1250
  baseY = maxY + opts.gridPad + opts.gapY;
1248
1251
  }
1252
+ const placed = layeredPlacement(children, unpositionedIdx, opts);
1253
+ const cols = Math.max(1, Math.ceil(Math.sqrt(unpositionedIdx.length)));
1249
1254
  unpositionedIdx.forEach((entryIdx, k) => {
1250
- const col = k % cols;
1251
- const row = Math.floor(k / cols);
1252
- entries[entryIdx].x = baseX + col * opts.gapX;
1253
- entries[entryIdx].y = baseY + row * opts.gapY;
1255
+ const at = placed?.get(entryIdx) ?? {
1256
+ x: k % cols * opts.gapX,
1257
+ y: Math.floor(k / cols) * opts.gapY
1258
+ };
1259
+ entries[entryIdx].x = baseX + at.x;
1260
+ entries[entryIdx].y = baseY + at.y;
1254
1261
  });
1255
1262
  }
1256
1263
  const nodes = entries.map((e) => ({
@@ -1284,6 +1291,44 @@ function computeDiagramLayout(children, options = {}) {
1284
1291
  }
1285
1292
  return { nodes, edges, warnings };
1286
1293
  }
1294
+ function layeredPlacement(children, unpositionedIdx, opts) {
1295
+ const free = new Set(unpositionedIdx.map((i) => children[i].id));
1296
+ const edges = [];
1297
+ for (const i of unpositionedIdx) {
1298
+ for (const conn of children[i].connectsTo ?? []) {
1299
+ if (free.has(conn.target) && conn.target !== children[i].id) {
1300
+ edges.push({ id: String(edges.length), source: children[i].id, target: conn.target });
1301
+ }
1302
+ }
1303
+ }
1304
+ if (edges.length === 0) return null;
1305
+ const across = opts.direction === "right";
1306
+ const result = layoutGraph(
1307
+ {
1308
+ nodes: unpositionedIdx.map((i) => ({
1309
+ id: children[i].id,
1310
+ width: opts.nodeWidth,
1311
+ height: opts.nodeHeight
1312
+ })),
1313
+ edges
1314
+ },
1315
+ {
1316
+ direction: opts.direction,
1317
+ layerSpacing: Math.max(0, across ? opts.gapX - opts.nodeWidth : opts.gapY - opts.nodeHeight),
1318
+ nodeSpacing: Math.max(0, across ? opts.gapY - opts.nodeHeight : opts.gapX - opts.nodeWidth),
1319
+ componentSpacing: Math.max(0, opts.gapX - opts.nodeWidth),
1320
+ // The template draws its own connectors between card sides; only the
1321
+ // positions are used, so no room is reserved for routing tracks.
1322
+ edgeSpacing: 1
1323
+ }
1324
+ );
1325
+ const out = /* @__PURE__ */ new Map();
1326
+ unpositionedIdx.forEach((entryIdx, k) => {
1327
+ const n = result.nodes[k];
1328
+ out.set(entryIdx, { x: Math.round(n.x), y: Math.round(n.y) });
1329
+ });
1330
+ return out;
1331
+ }
1287
1332
  function makeEdgeId(source, conn) {
1288
1333
  return conn.type ? `${source}->${conn.target}:${conn.type}` : `${source}->${conn.target}`;
1289
1334
  }