@bendyline/squisq 2.10.0 → 2.11.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.
Files changed (32) hide show
  1. package/dist/{Doc-DTyeaFuW.d.ts → Doc-CRPQCkHn.d.ts} +34 -2
  2. package/dist/{ImageEditDoc-dFEclQ9l.d.ts → ImageEditDoc-MbvJM1HE.d.ts} +1 -1
  3. package/dist/{chunk-IO5XO6XH.js → chunk-64I44JAP.js} +1 -1
  4. package/dist/{chunk-XSW4QTMB.js → chunk-EH4S7HXE.js} +193 -3
  5. package/dist/{chunk-7YEZFHLS.js → chunk-O7HLQ22N.js} +11 -0
  6. package/dist/{chunk-NBKAXPSX.js → chunk-TMOHAFYE.js} +1 -0
  7. package/dist/{chunk-MIKKUKOD.js → chunk-UBFT2CDQ.js} +30 -15
  8. package/dist/{chunk-FCG3BIZN.js → chunk-UNVHAK3A.js} +5 -1
  9. package/dist/{chunk-NFHMHYUV.js → chunk-ZWID3HM5.js} +1 -1
  10. package/dist/{chunk-DRFJU4MK.js → chunk-ZYCSRDSX.js} +352 -2
  11. package/dist/doc/index.d.ts +123 -6
  12. package/dist/doc/index.js +12 -4
  13. package/dist/fence/index.d.ts +1 -1
  14. package/dist/generate/index.d.ts +1 -1
  15. package/dist/imageEdit/index.d.ts +3 -3
  16. package/dist/index.d.ts +7 -6
  17. package/dist/index.js +20 -8
  18. package/dist/jsonForm/index.d.ts +1 -1
  19. package/dist/markdown/index.js +3 -3
  20. package/dist/{materializePageSection-BRNIINlU.d.ts → materializePageSection-BeUPHeCl.d.ts} +1 -1
  21. package/dist/narration/index.d.ts +1 -1
  22. package/dist/narration/index.js +3 -3
  23. package/dist/schemas/index.d.ts +4 -4
  24. package/dist/storage/index.js +1 -1
  25. package/dist/table/index.d.ts +123 -0
  26. package/dist/table/index.js +298 -0
  27. package/dist/{themeLibrary-xaxN5UYu.d.ts → themeLibrary-BG3jr6mT.d.ts} +1 -1
  28. package/dist/transform/index.d.ts +2 -2
  29. package/dist/versions/index.d.ts +15 -1
  30. package/dist/versions/index.js +5 -1
  31. package/dist/viewState-lTZS-hP_.d.ts +91 -0
  32. package/package.json +6 -1
@@ -475,6 +475,38 @@ interface BigTextInput extends BaseTemplateBlock {
475
475
  /** Ambient motion for the background image. */
476
476
  ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
477
477
  }
478
+ /**
479
+ * Transcript block - one conversational beat: speaker (avatar + name)
480
+ * and a message bubble. Variants: plain `speech`, private `thought`
481
+ * (muted italic), and `tool` (mono chip + optional result line). A
482
+ * `counterpartName` turns the beat into a two-avatar handoff — how
483
+ * agent-to-agent delegation renders in recorded-session playback.
484
+ */
485
+ interface TranscriptBlockInput extends BaseTemplateBlock {
486
+ template: 'transcript';
487
+ /** Speaker display name. */
488
+ speaker: string;
489
+ /** Avatar image path (relative media). Missing → initials medallion. */
490
+ speakerImage?: string;
491
+ /** Which side the speaker column sits on. Default 'left'. */
492
+ side?: 'left' | 'right';
493
+ /** Beat kind. Default 'speech'. */
494
+ variant?: 'speech' | 'thought' | 'tool';
495
+ /** The message body. */
496
+ text: string;
497
+ /** Tool variant: the invoked tool's name, shown as a mono chip. */
498
+ toolName?: string;
499
+ /** Tool variant: bounded result line under the bubble. */
500
+ resultText?: string;
501
+ /** Handoff form: the receiving speaker's display name. */
502
+ counterpartName?: string;
503
+ /** Handoff form: the receiving speaker's avatar image path. */
504
+ counterpartImage?: string;
505
+ /** Muted corner line (timestamp, step, etc.). */
506
+ meta?: string;
507
+ /** Color scheme for the accent (tool chip, handoff arrow). */
508
+ colorScheme?: ColorScheme;
509
+ }
478
510
  /**
479
511
  * Content block - loss-averse heading and body layout.
480
512
  *
@@ -1085,7 +1117,7 @@ type ChartTemplateInput = BarChartInput | ColumnChartInput | PieChartInput | Don
1085
1117
  /**
1086
1118
  * Union of all template block types.
1087
1119
  */
1088
- type TemplateBlock = TitleBlockInput | SectionHeaderInput | BigTextInput | ContentBlockInput | StatHighlightInput | QuoteBlockInput | FactCardInput | TwoColumnInput | DateEventInput | ImageWithCaptionInput | LeftFeatureInput | RightFeatureInput | MapBlockInput | FullBleedQuoteInput | ListBlockInput | PhotoGridInput | DefinitionCardInput | ComparisonBarInput | PullQuoteInput | VideoWithCaptionInput | VideoPullQuoteInput | DataTableInput | BarChartInput | ColumnChartInput | PieChartInput | DonutChartInput | LineChartInput | AreaChartInput | ScatterChartInput | DiagramBlockInput | TreeBlockInput | TimelineBlockInput | DrawingBlockInput | RawLayersInput;
1120
+ type TemplateBlock = TitleBlockInput | SectionHeaderInput | BigTextInput | TranscriptBlockInput | ContentBlockInput | StatHighlightInput | QuoteBlockInput | FactCardInput | TwoColumnInput | DateEventInput | ImageWithCaptionInput | LeftFeatureInput | RightFeatureInput | MapBlockInput | FullBleedQuoteInput | ListBlockInput | PhotoGridInput | DefinitionCardInput | ComparisonBarInput | PullQuoteInput | VideoWithCaptionInput | VideoPullQuoteInput | DataTableInput | BarChartInput | ColumnChartInput | PieChartInput | DonutChartInput | LineChartInput | AreaChartInput | ScatterChartInput | DiagramBlockInput | TreeBlockInput | TimelineBlockInput | DrawingBlockInput | RawLayersInput;
1089
1121
  /**
1090
1122
  * A block can be either a raw Block or a TemplateBlock.
1091
1123
  */
@@ -2798,4 +2830,4 @@ declare function getBlockAtTime(blocks: Block[], time: number): Block | null;
2798
2830
  */
2799
2831
  declare function getCaptionAtTime(captions: CaptionTrack | undefined, time: number): CaptionPhrase | null;
2800
2832
 
2801
- export { type ImageLayer as $, type AccentImage as A, type BarChartInput as B, type CaptionPhrase as C, DARK_SURFACE as D, DEFAULT_DOC_FONT as E, DEFAULT_TITLE_FONT as F, type DataTableInput as G, type DateEventInput as H, type DeepPartial as I, type DefinitionCardInput as J, type DiagramBlockInput as K, type DiagramEdgeAnchor as L, type DiagramTemplateEdge as M, type DiagramTemplateNode as N, type Doc as O, type DocBlock as P, type DocDiagnostic as Q, type DonutChartInput as R, type DrawingBlockInput as S, FRONTMATTER_CUSTOM_TEMPLATES_KEY as T, FRONTMATTER_CUSTOM_THEMES_KEY as U, type FactCardInput as V, type FontFamily as W, type FontFamilyKind as X, type FullBleedQuoteInput as Y, type GradientBackgroundConfig as Z, type ImageBackgroundConfig as _, type AccentPosition as a, type ScheduledClip as a$, type ImageTreatment as a0, type ImageWithCaptionInput as a1, LIGHT_SURFACE as a2, type Layer as a3, type LayerRepeat as a4, type LayoutHints as a5, type LeftFeatureInput as a6, type LineChartInput as a7, type LinearGradient as a8, type ListBlockInput as a9, type PageAccentRotation as aA, type PageBackground as aB, type PageDesignFamily as aC, type PageEmphasis as aD, type PageHeadingTreatment as aE, type PageSectionKind as aF, type PageSectionOverride as aG, type PageTokens as aH, type PathLayer as aI, type PatternBackgroundConfig as aJ, type PersistentLayer as aK, type PersistentLayerConfig as aL, type PersistentLayerTemplate as aM, type PersistentLayerTemplateConfig as aN, type PersistentLayerTemplateType as aO, type PhotoGridInput as aP, type PieChartInput as aQ, type PipStyle as aR, type Position as aS, type ProgressIndicatorConfig as aT, type PromotedBodyAnnotation as aU, type PullQuoteInput as aV, type QuoteBlockInput as aW, type RawLayersInput as aX, type RenderStyle as aY, type RightFeatureInput as aZ, type ScatterChartInput as a_, type MapBlockInput as aa, type MapLayer as ab, type MapMarker as ac, type MapTileStyle as ad, type MarkerStyle as ae, type MediaClip as af, type MediaScheduleOptions as ag, type MermaidLayer as ah, PAGE_ACCENT_STRATEGIES as ai, PAGE_BACKGROUNDS as aj, PAGE_BACKGROUND_RHYTHMS as ak, PAGE_DESIGN_FAMILIES as al, PAGE_DIVIDERS as am, PAGE_EMPHASES as an, PAGE_EYEBROWS as ao, PAGE_HEADING_CASES as ap, PAGE_HEADING_SCALES as aq, PAGE_HEADING_UNDERLINES as ar, PAGE_HERO_STYLES as as, PAGE_IMAGE_FRAMINGS as at, PAGE_NUMERAL_STYLES as au, PAGE_PATTERNS as av, PAGE_QUOTE_MARKS as aw, PAGE_SECTION_KINDS as ax, PAGE_SECTION_SPACINGS as ay, PAGE_SHADOWS as az, type AmbientGradientConfig as b, getSegmentAtTime as b$, type SectionHeaderInput as b0, type ShapeFilter as b1, type ShapeLayer as b2, type ShapePattern as b3, type SolidBackgroundConfig as b4, type StartBlockConfig as b5, type StatHighlightInput as b6, type SurfaceScheme as b7, THEME_SCHEMA_VERSION as b8, type TableLayer as b9, type TreeTemplateItem as bA, type TwoColumnInput as bB, VIEWPORT_PRESETS as bC, type VideoLayer as bD, type VideoPipPosition as bE, type VideoPipShape as bF, type VideoPipSize as bG, type VideoPlacement as bH, type VideoPresentation as bI, type VideoPullQuoteInput as bJ, type VideoWithCaptionInput as bK, type ViewportConfig as bL, type ViewportOrientation as bM, type ViewportPreset as bN, type VignetteConfig as bO, applySurface as bP, calculateDuration as bQ, calculateFontScale as bR, createTemplateContext as bS, createTheme as bT, createThemeRegistry as bU, getAspectRatioString as bV, getBlockAtTime as bW, getCaptionAtTime as bX, getDocPlaybackDuration as bY, getLayoutHints as bZ, getSafeTextBounds as b_, type TableLayerStyle as ba, type TemplateBlock as bb, type TemplateContext as bc, type TemplateFunction as bd, type TemplateRegistry as be, type TextLayer as bf, type TextStyle as bg, type Theme as bh, type ThemeColorPalette as bi, type ThemeColorScheme as bj, type ThemePageStyle as bk, type ThemeRegistry as bl, type ThemeSchemaVersion as bm, type ThemeSeedColors as bn, type ThemeStyle as bo, type ThemeTypography as bp, type TimelineBlockInput as bq, type TimelineTemplateEvent as br, type TimelineTemplateLink as bs, type TimelineTemplateTrack as bt, type TitleBlockInput as bu, type TitleCaptionConfig as bv, type TreeBlockInput as bw, type TreeLayer as bx, type TreeLayerItem as by, type TreeLayerStyle as bz, type Animation as c, getTwoColumnPositions as c0, getViewport as c1, getViewportOrientation as c2, isCustomTemplateDefinition as c3, isPersistentLayerTemplate as c4, isTemplateBlock as c5, scaledFontSize$1 as c6, resolveMediaSchedule as c7, scaledFontSize as c8, validateCustomTemplateDefinition as c9, 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 CustomTemplateDefinition as w, type CustomTemplateLayer as x, type CustomTemplateValidationError as y, type CustomTemplateValidationResult as z };
2833
+ export { type ImageLayer as $, type AccentImage as A, type BarChartInput as B, type CaptionPhrase as C, DARK_SURFACE as D, DEFAULT_DOC_FONT as E, DEFAULT_TITLE_FONT as F, type DataTableInput as G, type DateEventInput as H, type DeepPartial as I, type DefinitionCardInput as J, type DiagramBlockInput as K, type DiagramEdgeAnchor as L, type DiagramTemplateEdge as M, type DiagramTemplateNode as N, type Doc as O, type DocBlock as P, type DocDiagnostic as Q, type DonutChartInput as R, type DrawingBlockInput as S, FRONTMATTER_CUSTOM_TEMPLATES_KEY as T, FRONTMATTER_CUSTOM_THEMES_KEY as U, type FactCardInput as V, type FontFamily as W, type FontFamilyKind as X, type FullBleedQuoteInput as Y, type GradientBackgroundConfig as Z, type ImageBackgroundConfig as _, type AccentPosition as a, type ScheduledClip as a$, type ImageTreatment as a0, type ImageWithCaptionInput as a1, LIGHT_SURFACE as a2, type Layer as a3, type LayerRepeat as a4, type LayoutHints as a5, type LeftFeatureInput as a6, type LineChartInput as a7, type LinearGradient as a8, type ListBlockInput as a9, type PageAccentRotation as aA, type PageBackground as aB, type PageDesignFamily as aC, type PageEmphasis as aD, type PageHeadingTreatment as aE, type PageSectionKind as aF, type PageSectionOverride as aG, type PageTokens as aH, type PathLayer as aI, type PatternBackgroundConfig as aJ, type PersistentLayer as aK, type PersistentLayerConfig as aL, type PersistentLayerTemplate as aM, type PersistentLayerTemplateConfig as aN, type PersistentLayerTemplateType as aO, type PhotoGridInput as aP, type PieChartInput as aQ, type PipStyle as aR, type Position as aS, type ProgressIndicatorConfig as aT, type PromotedBodyAnnotation as aU, type PullQuoteInput as aV, type QuoteBlockInput as aW, type RawLayersInput as aX, type RenderStyle as aY, type RightFeatureInput as aZ, type ScatterChartInput as a_, type MapBlockInput as aa, type MapLayer as ab, type MapMarker as ac, type MapTileStyle as ad, type MarkerStyle as ae, type MediaClip as af, type MediaScheduleOptions as ag, type MermaidLayer as ah, PAGE_ACCENT_STRATEGIES as ai, PAGE_BACKGROUNDS as aj, PAGE_BACKGROUND_RHYTHMS as ak, PAGE_DESIGN_FAMILIES as al, PAGE_DIVIDERS as am, PAGE_EMPHASES as an, PAGE_EYEBROWS as ao, PAGE_HEADING_CASES as ap, PAGE_HEADING_SCALES as aq, PAGE_HEADING_UNDERLINES as ar, PAGE_HERO_STYLES as as, PAGE_IMAGE_FRAMINGS as at, PAGE_NUMERAL_STYLES as au, PAGE_PATTERNS as av, PAGE_QUOTE_MARKS as aw, PAGE_SECTION_KINDS as ax, PAGE_SECTION_SPACINGS as ay, PAGE_SHADOWS as az, type AmbientGradientConfig as b, getSafeTextBounds as b$, type SectionHeaderInput as b0, type ShapeFilter as b1, type ShapeLayer as b2, type ShapePattern as b3, type SolidBackgroundConfig as b4, type StartBlockConfig as b5, type StatHighlightInput as b6, type SurfaceScheme as b7, THEME_SCHEMA_VERSION as b8, type TableLayer as b9, type TreeLayerStyle as bA, type TreeTemplateItem as bB, type TwoColumnInput as bC, VIEWPORT_PRESETS as bD, type VideoLayer as bE, type VideoPipPosition as bF, type VideoPipShape as bG, type VideoPipSize as bH, type VideoPlacement as bI, type VideoPresentation as bJ, type VideoPullQuoteInput as bK, type VideoWithCaptionInput as bL, type ViewportConfig as bM, type ViewportOrientation as bN, type ViewportPreset as bO, type VignetteConfig as bP, applySurface as bQ, calculateDuration as bR, calculateFontScale as bS, createTemplateContext as bT, createTheme as bU, createThemeRegistry as bV, getAspectRatioString as bW, getBlockAtTime as bX, getCaptionAtTime as bY, getDocPlaybackDuration as bZ, getLayoutHints as b_, type TableLayerStyle as ba, type TemplateBlock as bb, type TemplateContext as bc, type TemplateFunction as bd, type TemplateRegistry as be, type TextLayer as bf, type TextStyle as bg, type Theme as bh, type ThemeColorPalette as bi, type ThemeColorScheme as bj, type ThemePageStyle as bk, type ThemeRegistry as bl, type ThemeSchemaVersion as bm, type ThemeSeedColors as bn, type ThemeStyle as bo, type ThemeTypography as bp, type TimelineBlockInput as bq, type TimelineTemplateEvent as br, type TimelineTemplateLink as bs, type TimelineTemplateTrack as bt, type TitleBlockInput as bu, type TitleCaptionConfig as bv, type TranscriptBlockInput as bw, type TreeBlockInput as bx, type TreeLayer as by, type TreeLayerItem as bz, type Animation as c, getSegmentAtTime as c0, getTwoColumnPositions as c1, getViewport as c2, getViewportOrientation as c3, isCustomTemplateDefinition as c4, isPersistentLayerTemplate as c5, isTemplateBlock as c6, scaledFontSize$1 as c7, resolveMediaSchedule as c8, scaledFontSize as c9, validateCustomTemplateDefinition as ca, 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 CustomTemplateDefinition as w, type CustomTemplateLayer as x, type CustomTemplateValidationError as y, type CustomTemplateValidationResult as z };
@@ -1,4 +1,4 @@
1
- import { $ as ImageLayer, bf as TextLayer, b2 as ShapeLayer, aI as PathLayer } from './Doc-DTyeaFuW.js';
1
+ import { $ as ImageLayer, bf as TextLayer, b2 as ShapeLayer, aI as PathLayer } from './Doc-CRPQCkHn.js';
2
2
 
3
3
  /**
4
4
  * ImageEditDoc — JSON document describing a layered, editable image.
@@ -2,7 +2,7 @@ import {
2
2
  assertMarkdownDocumentWithinLimits,
3
3
  parseMarkdown,
4
4
  toMdast
5
- } from "./chunk-MIKKUKOD.js";
5
+ } from "./chunk-UBFT2CDQ.js";
6
6
  import {
7
7
  formatFrontmatterYaml,
8
8
  getChildren,
@@ -30,7 +30,7 @@ import {
30
30
  templateRegistry,
31
31
  writeCustomTemplatesToFrontmatter,
32
32
  writeCustomThemesToFrontmatter
33
- } from "./chunk-DRFJU4MK.js";
33
+ } from "./chunk-ZYCSRDSX.js";
34
34
  import {
35
35
  iconMarker
36
36
  } from "./chunk-7ZAAICW4.js";
@@ -75,15 +75,16 @@ import {
75
75
  } from "./chunk-BAOV476U.js";
76
76
  import {
77
77
  parseMarkdown
78
- } from "./chunk-MIKKUKOD.js";
78
+ } from "./chunk-UBFT2CDQ.js";
79
79
  import {
80
80
  KNOWN_BLOCK_META_KEYS,
81
+ TABLE_FED_TEMPLATES,
81
82
  TEMPLATE_ALIASES,
82
83
  coerceAnnotationValues,
83
84
  isContainerTemplate,
84
85
  resolveTemplateName,
85
86
  serializeAnnotation
86
- } from "./chunk-NBKAXPSX.js";
87
+ } from "./chunk-TMOHAFYE.js";
87
88
  import {
88
89
  extractPlainText,
89
90
  getChildren,
@@ -1148,6 +1149,19 @@ var content = (input) => {
1148
1149
  slots: { title: c.title, body: bodyRichText(input) }
1149
1150
  };
1150
1151
  };
1152
+ var transcript = (input) => {
1153
+ const t = input;
1154
+ const attribution = t.counterpartName ? `${t.speaker} \u2192 ${t.counterpartName}` : t.speaker;
1155
+ return {
1156
+ kind: "quote-band",
1157
+ variant: "plain",
1158
+ slots: {
1159
+ title: t.variant === "tool" ? t.toolName : void 0,
1160
+ body: { text: t.text ?? "" },
1161
+ attribution
1162
+ }
1163
+ };
1164
+ };
1151
1165
  var statHighlight = (input) => {
1152
1166
  const s = input;
1153
1167
  return {
@@ -1426,6 +1440,7 @@ var sectionExtractors = {
1426
1440
  title,
1427
1441
  sectionHeader,
1428
1442
  bigText,
1443
+ transcript,
1429
1444
  content,
1430
1445
  statHighlight,
1431
1446
  quote,
@@ -4267,6 +4282,177 @@ function assignSegmentIndices(blocks, blockToSegment, inheritedSegment) {
4267
4282
  });
4268
4283
  }
4269
4284
 
4285
+ // src/doc/dataReferences.ts
4286
+ var DATA_FILE_EXTENSIONS = ["csv", "tsv", "xlsx", "parquet"];
4287
+ var WORKBOOK_EXTENSIONS = /* @__PURE__ */ new Set(["xlsx"]);
4288
+ function extensionOf(path) {
4289
+ const base = path.split("/").pop() ?? path;
4290
+ const dot = base.lastIndexOf(".");
4291
+ return dot > 0 ? base.slice(dot + 1).toLowerCase() : "";
4292
+ }
4293
+ function isDataFilePath(path) {
4294
+ if (!path || /^(?:[a-z][a-z0-9+.-]*:|\/\/|\/)/i.test(path)) return false;
4295
+ return DATA_FILE_EXTENSIONS.includes(extensionOf(path));
4296
+ }
4297
+ function dataSidecarPrefix(docBasename) {
4298
+ return `${docBasename}_files/data/`;
4299
+ }
4300
+ var DEFAULT_MAX_PREVIEW_ROWS = 50;
4301
+ function hasAuthoredData(block) {
4302
+ const provided = (key) => !!(block.templateData && key in block.templateData) || !!(block.templateOverrides && key in block.templateOverrides);
4303
+ return provided("headers") || provided("rows");
4304
+ }
4305
+ function isEligible(block) {
4306
+ return !!block.templateOverrides?.src && TABLE_FED_TEMPLATES.has(resolveTemplateName(block.template ?? ""));
4307
+ }
4308
+ async function resolveDataReferences(doc, container, options) {
4309
+ const diagnostics = [];
4310
+ const maxPreviewRows = options.maxPreviewRows ?? DEFAULT_MAX_PREVIEW_ROWS;
4311
+ const readerByExt = /* @__PURE__ */ new Map();
4312
+ for (const reader of options.readers) {
4313
+ for (const ext of reader.extensions) readerByExt.set(ext.toLowerCase(), reader);
4314
+ }
4315
+ const fileCache = /* @__PURE__ */ new Map();
4316
+ const readCached = (path) => {
4317
+ let pending = fileCache.get(path);
4318
+ if (!pending) {
4319
+ pending = container.readFile(path).catch(() => null);
4320
+ fileCache.set(path, pending);
4321
+ }
4322
+ return pending;
4323
+ };
4324
+ const resolveBlock = async (block) => {
4325
+ const overrides = block.templateOverrides;
4326
+ const src = overrides.src;
4327
+ const ext = extensionOf(src);
4328
+ if (!isDataFilePath(src)) {
4329
+ diagnostics.push({
4330
+ severity: "warning",
4331
+ code: "data-src-no-reader",
4332
+ message: `Block "${block.id}": src "${src}" is not a relative data-file path (.${DATA_FILE_EXTENSIONS.join("/.")}).`,
4333
+ blockId: block.id
4334
+ });
4335
+ return null;
4336
+ }
4337
+ const reader = readerByExt.get(ext);
4338
+ if (!reader) {
4339
+ diagnostics.push({
4340
+ severity: "warning",
4341
+ code: "data-src-no-reader",
4342
+ message: `Block "${block.id}": no data reader registered for ".${ext}" (src "${src}").`,
4343
+ blockId: block.id
4344
+ });
4345
+ return null;
4346
+ }
4347
+ if ((overrides.sheet || overrides.anchor) && !WORKBOOK_EXTENSIONS.has(ext)) {
4348
+ diagnostics.push({
4349
+ severity: "info",
4350
+ code: "data-src-param-ignored",
4351
+ message: `Block "${block.id}": sheet/anchor only address workbook sources; ignored for ".${ext}".`,
4352
+ blockId: block.id
4353
+ });
4354
+ }
4355
+ const bytes = await readCached(src);
4356
+ if (!bytes) {
4357
+ diagnostics.push({
4358
+ severity: "warning",
4359
+ code: "data-src-missing",
4360
+ message: `Block "${block.id}": data file "${src}" was not found in the document container.`,
4361
+ blockId: block.id
4362
+ });
4363
+ return null;
4364
+ }
4365
+ const parsedPreviewRows = Number.parseInt(overrides.previewRows ?? "", 10);
4366
+ const maxRows = Number.isFinite(parsedPreviewRows) && parsedPreviewRows > 0 ? parsedPreviewRows : maxPreviewRows;
4367
+ const readOpts = {
4368
+ ...overrides.sheet ? { sheet: overrides.sheet } : {},
4369
+ ...overrides.anchor ? { anchor: overrides.anchor } : {},
4370
+ ...overrides.headerRow !== void 0 ? { headerRow: overrides.headerRow !== "false" } : {},
4371
+ ...overrides.sort ? { sort: overrides.sort } : {},
4372
+ ...overrides.filter ? { filter: overrides.filter } : {},
4373
+ maxRows
4374
+ };
4375
+ let table;
4376
+ try {
4377
+ const cacheKey = [
4378
+ src,
4379
+ readOpts.sheet ?? "",
4380
+ readOpts.anchor ?? "",
4381
+ String(readOpts.headerRow ?? ""),
4382
+ readOpts.sort ?? "",
4383
+ readOpts.filter ?? "",
4384
+ String(maxRows)
4385
+ ].join("\0");
4386
+ let pending = options.tableCache?.get(cacheKey);
4387
+ if (!pending) {
4388
+ pending = reader.read(bytes, readOpts);
4389
+ options.tableCache?.set(cacheKey, pending);
4390
+ }
4391
+ table = await pending;
4392
+ } catch (err) {
4393
+ const reason = err instanceof Error ? err.message : String(err);
4394
+ const sheetMiss = /sheet|worksheet/i.test(reason) && WORKBOOK_EXTENSIONS.has(ext);
4395
+ diagnostics.push({
4396
+ severity: sheetMiss ? "warning" : "error",
4397
+ code: sheetMiss ? "data-src-sheet-missing" : "data-src-parse",
4398
+ message: `Block "${block.id}": could not read "${src}": ${reason}`,
4399
+ blockId: block.id
4400
+ });
4401
+ return null;
4402
+ }
4403
+ for (const issue of table.viewIssues ?? []) {
4404
+ diagnostics.push({
4405
+ severity: "info",
4406
+ code: issue.code,
4407
+ message: `Block "${block.id}": ${issue.message}`,
4408
+ blockId: block.id
4409
+ });
4410
+ }
4411
+ const srcStats = {
4412
+ totalRows: table.totalRows,
4413
+ totalCols: table.totalCols,
4414
+ previewRows: table.rows.length,
4415
+ truncated: table.rows.length < table.totalRows,
4416
+ ...table.unfilteredTotalRows !== void 0 ? { unfilteredTotalRows: table.unfilteredTotalRows } : {}
4417
+ };
4418
+ return {
4419
+ ...block,
4420
+ templateData: {
4421
+ headers: table.headers,
4422
+ rows: table.rows,
4423
+ ...table.align ? { align: table.align } : {},
4424
+ srcStats,
4425
+ ...block.templateData
4426
+ }
4427
+ };
4428
+ };
4429
+ let changed = false;
4430
+ const resolveBlocks = async (blocks2) => {
4431
+ const next = await Promise.all(
4432
+ blocks2.map(async (block) => {
4433
+ let replacement = null;
4434
+ if (isEligible(block) && !hasAuthoredData(block)) {
4435
+ replacement = await resolveBlock(block);
4436
+ }
4437
+ let children = block.children;
4438
+ if (block.children && block.children.length > 0) {
4439
+ children = await resolveBlocks(block.children);
4440
+ }
4441
+ if (!replacement && children === block.children) return block;
4442
+ changed = true;
4443
+ const base = replacement ?? block;
4444
+ return children === block.children ? base : { ...base, children };
4445
+ })
4446
+ );
4447
+ return next.some((b, i) => b !== blocks2[i]) ? next : blocks2;
4448
+ };
4449
+ const blocks = await resolveBlocks(doc.blocks);
4450
+ return {
4451
+ doc: changed ? { ...doc, blocks } : doc,
4452
+ diagnostics
4453
+ };
4454
+ }
4455
+
4270
4456
  // src/doc/validate.ts
4271
4457
  function validateMarkdownSource(source, options) {
4272
4458
  return validateMarkdownDoc(parseMarkdown(source), options);
@@ -5874,6 +6060,10 @@ export {
5874
6060
  applyNarrationTiming,
5875
6061
  scoreTextSimilarity,
5876
6062
  resolveAudioMapping,
6063
+ DATA_FILE_EXTENSIONS,
6064
+ isDataFilePath,
6065
+ dataSidecarPrefix,
6066
+ resolveDataReferences,
5877
6067
  validateMarkdownSource,
5878
6068
  validateMarkdownDoc,
5879
6069
  renderAsciiDiagram,
@@ -26,6 +26,15 @@ function buildVersionPath(basename, date, collision = 0) {
26
26
  function parseVersionPath(path) {
27
27
  return parseSnapshotPath(DOCUMENT_VERSION_PATHS, path);
28
28
  }
29
+ var DATA_BACKUP_PREFIX = ".versions/data/";
30
+ function buildDataBackupPath(sidecarPath, date, collision = 0) {
31
+ const slash = sidecarPath.lastIndexOf(".");
32
+ const extension = slash > 0 ? sidecarPath.slice(slash + 1).toLowerCase() : "bin";
33
+ const withoutExt = slash > 0 ? sidecarPath.slice(0, slash) : sidecarPath;
34
+ const flattened = withoutExt.replace(/\//g, "__");
35
+ const strategy = { prefix: DATA_BACKUP_PREFIX, extension };
36
+ return buildSnapshotPath(strategy, flattened, date, collision);
37
+ }
29
38
 
30
39
  // src/versions/operations.ts
31
40
  async function resolveBasename(container, override) {
@@ -119,6 +128,8 @@ export {
119
128
  getDocBasename,
120
129
  buildVersionPath,
121
130
  parseVersionPath,
131
+ DATA_BACKUP_PREFIX,
132
+ buildDataBackupPath,
122
133
  listVersions,
123
134
  readVersion,
124
135
  saveVersion,
@@ -35,6 +35,7 @@ var TEMPLATE_TOKEN_NAMES = /* @__PURE__ */ new Set([
35
35
  "title",
36
36
  "sectionHeader",
37
37
  "bigText",
38
+ "transcript",
38
39
  "content",
39
40
  "statHighlight",
40
41
  "quote",
@@ -6,7 +6,7 @@ import {
6
6
  quoteAttrValue,
7
7
  splitKeyValueToken,
8
8
  tokenizeAttrTokens
9
- } from "./chunk-NBKAXPSX.js";
9
+ } from "./chunk-TMOHAFYE.js";
10
10
  import {
11
11
  resolveIcon
12
12
  } from "./chunk-7N4G32LG.js";
@@ -259,7 +259,8 @@ function convertInlineChildren(children, parseHtml, applyIconSplit = true) {
259
259
  if (node) result.push(node);
260
260
  }
261
261
  const mentioned = coalesceMentions(result);
262
- const split = applyIconSplit ? splitInlineIcons(mentioned) : mentioned;
262
+ const repaired = recombineDirectiveTokens(mentioned);
263
+ const split = applyIconSplit ? splitInlineIcons(repaired) : repaired;
263
264
  return foldPairedInlineHtml(split);
264
265
  }
265
266
  var PAIRED_INLINE_HTML = /* @__PURE__ */ new Map([
@@ -341,24 +342,38 @@ function recombineDirectiveTokens(nodes) {
341
342
  const out = [];
342
343
  for (let i = 0; i < nodes.length; i++) {
343
344
  const cur = nodes[i];
344
- const next = nodes[i + 1];
345
- const after = nodes[i + 2];
346
- if (cur?.type === "text" && next?.type === "textDirective" && after?.type === "text" && /\{\[[a-zA-Z0-9_-]+$/.test(cur.value) && /^\]\}/.test(after.value)) {
347
- const directive = next;
348
- const directiveName = directive.name ?? "";
349
- const merged = {
350
- type: "text",
351
- value: cur.value + ":" + directiveName + after.value,
352
- ...cur.position ? { position: cur.position } : {}
353
- };
354
- out.push(merged);
355
- i += 2;
356
- continue;
345
+ if (cur?.type === "text") {
346
+ let value = cur.value;
347
+ let j = i;
348
+ while (hasUnclosedAnnotationSpan(value) && nodes[j + 1]?.type === "textDirective") {
349
+ const directive = nodes[j + 1];
350
+ value += ":" + (directive.name ?? "");
351
+ j += 1;
352
+ const following = nodes[j + 1];
353
+ if (following?.type === "text") {
354
+ value += following.value;
355
+ j += 1;
356
+ }
357
+ }
358
+ if (j !== i) {
359
+ out.push({
360
+ type: "text",
361
+ value,
362
+ ...cur.position ? { position: cur.position } : {}
363
+ });
364
+ i = j;
365
+ continue;
366
+ }
357
367
  }
358
368
  out.push(cur);
359
369
  }
360
370
  return out;
361
371
  }
372
+ function hasUnclosedAnnotationSpan(text) {
373
+ const open = text.lastIndexOf("{[");
374
+ if (open === -1) return false;
375
+ return !text.includes("]}", open);
376
+ }
362
377
  var ICON_TOKEN_RE = /\{\[([a-zA-Z0-9_:-]+)\]\}/g;
363
378
  function splitTextOnIcons(value, position) {
364
379
  if (!value) return [];
@@ -230,7 +230,11 @@ var EXTENSION_MIME_MAP = {
230
230
  ".ogg": "audio/ogg",
231
231
  ".css": "text/css",
232
232
  ".html": "text/html",
233
- ".js": "application/javascript"
233
+ ".js": "application/javascript",
234
+ ".csv": "text/csv",
235
+ ".tsv": "text/tab-separated-values",
236
+ ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
237
+ ".parquet": "application/vnd.apache.parquet"
234
238
  };
235
239
  function guessMimeType(path) {
236
240
  const dot = path.lastIndexOf(".");
@@ -3,7 +3,7 @@ import {
3
3
  expectedSyllablesAt,
4
4
  flattenRenderableBlocks,
5
5
  wordPosAtExpectedSyllables
6
- } from "./chunk-DRFJU4MK.js";
6
+ } from "./chunk-ZYCSRDSX.js";
7
7
 
8
8
  // src/narration/types.ts
9
9
  var DEFAULT_FEATURE_CONFIG = Object.freeze({