@bendyline/squisq 2.11.4 → 2.11.6

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 (34) hide show
  1. package/dist/chunk-44BJ42GT.js +165 -0
  2. package/dist/chunk-764WHWKM.js +332 -0
  3. package/dist/{chunk-XV4SF2N5.js → chunk-BUJ5RV2P.js} +1 -1
  4. package/dist/{chunk-PJRVODWW.js → chunk-C3NAY5YP.js} +7 -2
  5. package/dist/{chunk-67L6WRJN.js → chunk-GHOPHGOK.js} +28 -1
  6. package/dist/{chunk-NV7LNKS2.js → chunk-GRGLZF4A.js} +18 -30
  7. package/dist/{chunk-ZSU5DJLX.js → chunk-J2IPSQKP.js} +104 -4
  8. package/dist/{chunk-NKNMGIIN.js → chunk-SVN7T6BK.js} +0 -3
  9. package/dist/{chunk-4UNTPQ4J.js → chunk-UUI35INI.js} +4 -2
  10. package/dist/{chunk-DQRELU4S.js → chunk-VU4T74LI.js} +1 -1
  11. package/dist/{chunk-LI547QHN.js → chunk-WAGJK36Q.js} +19 -346
  12. package/dist/{chunk-RXYKU6EX.js → chunk-Y4D6TDZT.js} +212 -3
  13. package/dist/chunk-ZP5F7LUH.js +223 -0
  14. package/dist/doc/index.js +9 -11
  15. package/dist/generate/index.d.ts +61 -1
  16. package/dist/generate/index.js +14 -1
  17. package/dist/index.d.ts +5 -4
  18. package/dist/index.js +57 -39
  19. package/dist/jsonForm/index.js +3 -4
  20. package/dist/narration/index.js +6 -7
  21. package/dist/proof/index.d.ts +3 -45
  22. package/dist/recommend/index.d.ts +6 -0
  23. package/dist/recommend/index.js +1 -1
  24. package/dist/review/index.d.ts +141 -0
  25. package/dist/review/index.js +29 -0
  26. package/dist/schemas/index.js +17 -19
  27. package/dist/timing/index.d.ts +29 -1
  28. package/dist/timing/index.js +6 -4
  29. package/dist/transform/index.d.ts +63 -2
  30. package/dist/transform/index.js +17 -6
  31. package/dist/types-BQWu0gzi.d.ts +46 -0
  32. package/package.json +6 -1
  33. package/dist/chunk-BAOV476U.js +0 -214
  34. package/dist/chunk-XOFT65EX.js +0 -34
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  recordSlideShown,
28
28
  traceWordPosAt,
29
29
  vadStep
30
- } from "./chunk-4UNTPQ4J.js";
30
+ } from "./chunk-UUI35INI.js";
31
31
  import {
32
32
  fenceRendererLangs
33
33
  } from "./chunk-PGI7HSWE.js";
@@ -47,21 +47,30 @@ import {
47
47
  readProofingSettings,
48
48
  resolveProofDialect
49
49
  } from "./chunk-B3AK7SLZ.js";
50
+ import {
51
+ calculateKeywordAffinity,
52
+ extractKeywords,
53
+ matchByKeywordAffinity,
54
+ selectSafeZoneClips,
55
+ selectTranscriptClips
56
+ } from "./chunk-ZP5F7LUH.js";
50
57
  import {
51
58
  DEFAULT_TRANSFORM_STYLE_ID,
59
+ allocateTiming,
52
60
  analyzeBlocks,
53
61
  applyTransform,
54
62
  createTransformStyleRegistry,
55
63
  extractDocImages,
56
64
  getTransformStyleIds,
57
65
  getTransformStyleSummaries,
58
- resolveTransformStyle
59
- } from "./chunk-ZSU5DJLX.js";
66
+ resolveTransformStyle,
67
+ transformNarratedSegment
68
+ } from "./chunk-J2IPSQKP.js";
60
69
  import {
61
70
  extractContent,
62
71
  mapElementToBlock,
63
72
  stripMarkdown
64
- } from "./chunk-NKNMGIIN.js";
73
+ } from "./chunk-SVN7T6BK.js";
65
74
  import {
66
75
  DATA_BACKUP_PREFIX,
67
76
  DocumentVersionManager,
@@ -94,7 +103,7 @@ import {
94
103
  resolveRef,
95
104
  setByPointer,
96
105
  toPointer
97
- } from "./chunk-DQRELU4S.js";
106
+ } from "./chunk-VU4T74LI.js";
98
107
  import {
99
108
  IMAGE_EDIT_ASSETS_PREFIX,
100
109
  IMAGE_EDIT_DEFAULT_BASENAME,
@@ -142,7 +151,7 @@ import {
142
151
  pipStyleVars,
143
152
  serializeTheme,
144
153
  validateDocSchema
145
- } from "./chunk-XV4SF2N5.js";
154
+ } from "./chunk-BUJ5RV2P.js";
146
155
  import {
147
156
  calculateBearing,
148
157
  decodeGeohash,
@@ -227,7 +236,17 @@ import {
227
236
  validateMarkdownDoc,
228
237
  validateMarkdownSource,
229
238
  writeDashboardLayoutsToFrontmatter
230
- } from "./chunk-NV7LNKS2.js";
239
+ } from "./chunk-GRGLZF4A.js";
240
+ import {
241
+ buildNarrationScript,
242
+ buildNarrationTimingJson,
243
+ estimateSyllables,
244
+ expectedSyllablesAt,
245
+ parseNarrationTimingJson,
246
+ wordIndexAtChar,
247
+ wordIndexAtTime,
248
+ wordPosAtExpectedSyllables
249
+ } from "./chunk-764WHWKM.js";
231
250
  import {
232
251
  ASCII_CHAR_H,
233
252
  ASCII_CHAR_W,
@@ -251,8 +270,6 @@ import {
251
270
  asciiTimelineToTemplateData,
252
271
  autoTemplatePreservesContent,
253
272
  bigText,
254
- buildNarrationScript,
255
- buildNarrationTimingJson,
256
273
  buildRegistry,
257
274
  canvasToAsciiCell,
258
275
  coerceTemplateParams,
@@ -270,11 +287,9 @@ import {
270
287
  deriveTemplateInputs,
271
288
  diagramBlock,
272
289
  drawingBlock,
273
- estimateSyllables,
274
290
  expandCoverBlock,
275
291
  expandDocBlocks,
276
292
  expandPersistentLayers,
277
- expectedSyllablesAt,
278
293
  extractBlockquoteText,
279
294
  extractBodyPlainText,
280
295
  extractEmbeddedVideos,
@@ -319,7 +334,6 @@ import {
319
334
  materializeBlockLayers,
320
335
  normalizeShapeKind,
321
336
  parseDataFence,
322
- parseNarrationTimingJson,
323
337
  parseYamlSubset,
324
338
  photoGrid,
325
339
  pullQuote,
@@ -351,13 +365,10 @@ import {
351
365
  twoColumn,
352
366
  videoPullQuote,
353
367
  videoWithCaption,
354
- wordIndexAtChar,
355
- wordIndexAtTime,
356
- wordPosAtExpectedSyllables,
357
368
  wrapWithPersistentLayers,
358
369
  writeCustomTemplatesToFrontmatter,
359
370
  writeCustomThemesToFrontmatter
360
- } from "./chunk-LI547QHN.js";
371
+ } from "./chunk-WAGJK36Q.js";
361
372
  import {
362
373
  PATH_SHAPE_KINDS,
363
374
  anchorPoint,
@@ -402,7 +413,7 @@ import {
402
413
  parseWrappedFlowTimeline,
403
414
  profileBlockContents,
404
415
  recommendTemplatesForBlock
405
- } from "./chunk-PJRVODWW.js";
416
+ } from "./chunk-C3NAY5YP.js";
406
417
  import {
407
418
  defaultPageStyle,
408
419
  getDocPlaybackDuration,
@@ -411,8 +422,10 @@ import {
411
422
  import {
412
423
  AVAILABLE_FONT_STACKS,
413
424
  DARK_SURFACE,
425
+ DEFAULT_DOC_FONT,
414
426
  DEFAULT_THEME,
415
427
  DEFAULT_THEME_ID,
428
+ DEFAULT_TITLE_FONT,
416
429
  FONT_FALLBACKS,
417
430
  FRONTMATTER_CUSTOM_TEMPLATES_KEY,
418
431
  FRONTMATTER_CUSTOM_THEMES_KEY,
@@ -437,21 +450,32 @@ import {
437
450
  PAGE_SHADOWS,
438
451
  THEMES,
439
452
  THEME_SCHEMA_VERSION,
453
+ VIEWPORT_PRESETS,
440
454
  applySurface,
441
455
  assertTheme,
442
456
  buildGoogleFontsUrl,
457
+ calculateFontScale,
443
458
  contrastRatio,
459
+ createTemplateContext,
444
460
  createTheme,
445
461
  createThemeRegistry,
446
462
  deriveScale,
447
463
  fontStack,
464
+ getAspectRatioString,
448
465
  getAvailableThemes,
449
466
  getFontStack,
467
+ getLayoutHints,
468
+ getSafeTextBounds,
450
469
  getThemeSummaries,
470
+ getTwoColumnPositions,
471
+ getViewport,
472
+ getViewportOrientation,
451
473
  guessFontFallback,
452
474
  hexHueDegrees,
453
475
  isCustomTemplateDefinition,
454
476
  isHex,
477
+ isPersistentLayerTemplate,
478
+ isTemplateBlock,
455
479
  matchFontFamily,
456
480
  oklchDarken,
457
481
  oklchLighten,
@@ -460,27 +484,12 @@ import {
460
484
  relativeLuminance,
461
485
  resolveFontFamily,
462
486
  resolveTheme,
487
+ scaledFontSize,
488
+ scaledFontSize2,
463
489
  validateCustomTemplateDefinition,
464
490
  validateTheme,
465
491
  withAlpha
466
- } from "./chunk-RXYKU6EX.js";
467
- import {
468
- DEFAULT_DOC_FONT,
469
- DEFAULT_TITLE_FONT,
470
- VIEWPORT_PRESETS,
471
- calculateFontScale,
472
- createTemplateContext,
473
- getAspectRatioString,
474
- getLayoutHints,
475
- getSafeTextBounds,
476
- getTwoColumnPositions,
477
- getViewport,
478
- getViewportOrientation,
479
- isPersistentLayerTemplate,
480
- isTemplateBlock,
481
- scaledFontSize,
482
- scaledFontSize2
483
- } from "./chunk-BAOV476U.js";
492
+ } from "./chunk-Y4D6TDZT.js";
484
493
  import {
485
494
  LocalForageAdapter,
486
495
  LocalStorageAdapter,
@@ -576,17 +585,18 @@ import {
576
585
  resolveTransitionDuration
577
586
  } from "./chunk-4VOD55SX.js";
578
587
  import {
579
- estimateNarrationTime,
580
- estimateReadingTime
581
- } from "./chunk-XOFT65EX.js";
588
+ buildCaptionTrack
589
+ } from "./chunk-44BJ42GT.js";
582
590
  import {
583
591
  DEFAULT_WORDS_PER_SECOND,
584
592
  calculatePrefixDuration,
585
593
  countSpokenWords,
586
594
  estimateNarrationDuration,
595
+ estimateNarrationTime,
596
+ estimateReadingTime,
587
597
  estimateSpokenWordCount,
588
598
  estimateTimeFromText
589
- } from "./chunk-67L6WRJN.js";
599
+ } from "./chunk-GHOPHGOK.js";
590
600
  import {
591
601
  SeededRandom,
592
602
  hashString
@@ -706,6 +716,7 @@ export {
706
716
  adjustY,
707
717
  advanceCoverage,
708
718
  alignNarration,
719
+ allocateTiming,
709
720
  analyzeBlocks,
710
721
  anchorPoint,
711
722
  appendPointer,
@@ -729,6 +740,7 @@ export {
729
740
  bigText,
730
741
  blankProtectedSpans,
731
742
  buildAdvanceTimingJson,
743
+ buildCaptionTrack,
732
744
  buildDashboardCellChrome,
733
745
  buildDataBackupPath,
734
746
  buildGoogleFontsUrl,
@@ -747,6 +759,7 @@ export {
747
759
  calculateBearing,
748
760
  calculateDuration,
749
761
  calculateFontScale,
762
+ calculateKeywordAffinity,
750
763
  calculatePrefixDuration,
751
764
  canonicalIconToken,
752
765
  canvasToAsciiCell,
@@ -833,6 +846,7 @@ export {
833
846
  extractFirstImage,
834
847
  extractFrameFeatures,
835
848
  extractImages,
849
+ extractKeywords,
836
850
  extractListItems,
837
851
  extractPlainText,
838
852
  extractRichListItems,
@@ -951,6 +965,7 @@ export {
951
965
  markdownBlockSeparatorLines,
952
966
  markdownToDoc,
953
967
  markerPath,
968
+ matchByKeywordAffinity,
954
969
  matchFontFamily,
955
970
  matchTrailingPandocAttr,
956
971
  matchTrailingTemplateAnnotation,
@@ -1064,6 +1079,8 @@ export {
1064
1079
  scoreTextSimilarity,
1065
1080
  sectionExtractors,
1066
1081
  sectionHeader,
1082
+ selectSafeZoneClips,
1083
+ selectTranscriptClips,
1067
1084
  serializePandocAttributes,
1068
1085
  serializeTheme,
1069
1086
  setByPointer,
@@ -1098,6 +1115,7 @@ export {
1098
1115
  tokenizeAttrTokens,
1099
1116
  touch,
1100
1117
  traceWordPosAt,
1118
+ transformNarratedSegment,
1101
1119
  transposeCells,
1102
1120
  treeBlock,
1103
1121
  treeFromMarkdownList,
@@ -15,11 +15,10 @@ import {
15
15
  resolveRef,
16
16
  setByPointer,
17
17
  toPointer
18
- } from "../chunk-DQRELU4S.js";
19
- import "../chunk-XV4SF2N5.js";
18
+ } from "../chunk-VU4T74LI.js";
19
+ import "../chunk-BUJ5RV2P.js";
20
20
  import "../chunk-GAZKTT4R.js";
21
- import "../chunk-RXYKU6EX.js";
22
- import "../chunk-BAOV476U.js";
21
+ import "../chunk-Y4D6TDZT.js";
23
22
  import "../chunk-4VOD55SX.js";
24
23
  export {
25
24
  appendPointer,
@@ -27,7 +27,7 @@ import {
27
27
  recordSlideShown,
28
28
  traceWordPosAt,
29
29
  vadStep
30
- } from "../chunk-4UNTPQ4J.js";
30
+ } from "../chunk-UUI35INI.js";
31
31
  import {
32
32
  buildNarrationScript,
33
33
  buildNarrationTimingJson,
@@ -37,16 +37,15 @@ import {
37
37
  wordIndexAtChar,
38
38
  wordIndexAtTime,
39
39
  wordPosAtExpectedSyllables
40
- } from "../chunk-LI547QHN.js";
40
+ } from "../chunk-764WHWKM.js";
41
+ import "../chunk-WAGJK36Q.js";
41
42
  import "../chunk-PUS54YU6.js";
42
- import "../chunk-PJRVODWW.js";
43
- import "../chunk-RXYKU6EX.js";
44
- import "../chunk-BAOV476U.js";
43
+ import "../chunk-C3NAY5YP.js";
44
+ import "../chunk-Y4D6TDZT.js";
45
45
  import "../chunk-TMOHAFYE.js";
46
46
  import "../chunk-X7BNDUNI.js";
47
47
  import "../chunk-4VOD55SX.js";
48
- import "../chunk-XOFT65EX.js";
49
- import "../chunk-67L6WRJN.js";
48
+ import "../chunk-GHOPHGOK.js";
50
49
  import "../chunk-XRW6P7IF.js";
51
50
  export {
52
51
  DEFAULT_ALIGN_CONFIG,
@@ -1,47 +1,5 @@
1
- /**
2
- * Plain-data types for the proofing (grammar + spellcheck) pipeline.
3
- *
4
- * These types are engine-agnostic: an editor host adapts a concrete
5
- * engine (harper.js, a service, a test fake) to produce `ProofFinding`s,
6
- * while this module stays pure and dependency-free so the mapping and
7
- * masking helpers can run in Node tests and any consumer bundle.
8
- */
9
- /** Severity/color tier of a finding: red, green, or blue squiggle. */
10
- type ProofCategory = 'spelling' | 'grammar' | 'style';
11
- /** How a suggestion is applied relative to the finding's span. */
12
- type ProofSuggestionKind = 'replace' | 'remove' | 'insertAfter';
13
- /** One candidate fix for a finding. */
14
- interface ProofSuggestion {
15
- /** Replacement/insertion text (empty for `remove`). */
16
- text: string;
17
- kind: ProofSuggestionKind;
18
- }
19
- /** A half-open `[start, end)` range in UTF-16 code units. */
20
- interface ProofRange {
21
- start: number;
22
- end: number;
23
- }
24
- /**
25
- * One issue found in a linted text. Offsets index into the exact string
26
- * that was linted (UTF-16 code units — the same coordinate space as
27
- * ProseMirror, Monaco, and DOM Range).
28
- */
29
- interface ProofFinding extends ProofRange {
30
- /** Stable within one lint pass; the provider maps id → engine handle. */
31
- id: string;
32
- category: ProofCategory;
33
- /** Raw engine kind (e.g. `Typo`), for diagnostics and future filtering. */
34
- kind: string;
35
- /** Human-readable description of the issue. */
36
- message: string;
37
- /** Text at `[start, end)` when linted — staleness check before applying. */
38
- originalText: string;
39
- suggestions: ProofSuggestion[];
40
- }
41
- /** English dialects supported by the proofing engine. */
42
- type ProofDialect = 'American' | 'British' | 'Australian' | 'Canadian' | 'Indian';
43
- /** All supported dialects, in display order. */
44
- declare const PROOF_DIALECTS: readonly ProofDialect[];
1
+ import { a as ProofCategory, d as ProofRange, b as ProofDialect } from '../types-BQWu0gzi.js';
2
+ export { P as PROOF_DIALECTS, c as ProofFinding, e as ProofSuggestion, f as ProofSuggestionKind } from '../types-BQWu0gzi.js';
45
3
 
46
4
  /**
47
5
  * Mapping from harper's `LintKind` vocabulary to squisq's three proofing
@@ -195,4 +153,4 @@ declare function formatProofDictionary(words: readonly string[]): string | null;
195
153
  /** Read all proofing settings from a parsed frontmatter record. */
196
154
  declare function readProofingSettings(frontmatter: Record<string, unknown> | undefined): ProofingSettings;
197
155
 
198
- export { type BlankProtectedSpansOptions, type BlankedText, DEFAULT_PROOF_SETTINGS, type JoinedSegments, LINT_KIND_CATEGORIES, PROOF_DIALECTS, PROOF_FRONTMATTER_KEYS, PROOF_JOIN_SEPARATOR, type ProofCategory, type ProofDialect, type ProofFinding, type ProofRange, type ProofSuggestion, type ProofSuggestionKind, type ProofingSettings, type SegmentSpan, blankProtectedSpans, buildJoinedText, categorizeLintKind, dropMaskedFindings, formatProofDictionary, mapJoinedSpanToSegment, parseProofDictionary, readProofingSettings, resolveProofDialect };
156
+ export { type BlankProtectedSpansOptions, type BlankedText, DEFAULT_PROOF_SETTINGS, type JoinedSegments, LINT_KIND_CATEGORIES, PROOF_FRONTMATTER_KEYS, PROOF_JOIN_SEPARATOR, ProofCategory, ProofDialect, ProofRange, type ProofingSettings, type SegmentSpan, blankProtectedSpans, buildJoinedText, categorizeLintKind, dropMaskedFindings, formatProofDictionary, mapJoinedSpanToSegment, parseProofDictionary, readProofingSettings, resolveProofDialect };
@@ -20,6 +20,12 @@ interface BlockContentProfile {
20
20
  hasDate: boolean;
21
21
  hasNumberHighlight: boolean;
22
22
  wordCount: number;
23
+ /**
24
+ * True when a structural body node (list, table, quote, fence, etc.) has
25
+ * top-level siblings. Specialized templates generally consume only one
26
+ * structure; the complete-body template is the safe recommendation.
27
+ */
28
+ hasCompoundBody?: boolean;
23
29
  /**
24
30
  * True when the body is dominated by exactly one code fence whose content
25
31
  * is an ASCII box-and-line diagram (see `doc/asciiDiagram/detect.ts`).
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  profileBlockContents,
3
3
  recommendTemplatesForBlock
4
- } from "../chunk-PJRVODWW.js";
4
+ } from "../chunk-C3NAY5YP.js";
5
5
  import "../chunk-X7BNDUNI.js";
6
6
  export {
7
7
  profileBlockContents,
@@ -0,0 +1,141 @@
1
+ import { c as ProofFinding } from '../types-BQWu0gzi.js';
2
+
3
+ /**
4
+ * Plain-data types for the review pipeline.
5
+ *
6
+ * Review generalizes proofing. Spellcheck asks "is this word wrong?"; a
7
+ * reviewer may also ask "is this paragraph clear?", and the two differ in three
8
+ * ways the {@link ProofFinding} shape cannot express: a reviewer is slow enough
9
+ * that results must stream and be cancellable, it needs document structure
10
+ * rather than one flat string, and its suggestion is often a rewritten
11
+ * paragraph rather than a replaced word.
12
+ *
13
+ * `@bendyline/squisq/proof` is untouched and keeps working. A
14
+ * {@link ProofingProvider} is adapted into this pipeline by the editor, so
15
+ * there is one renderer rather than two.
16
+ */
17
+
18
+ /**
19
+ * How much a finding matters.
20
+ *
21
+ * Separate from the hue a provider draws in: severity orders findings within a
22
+ * provider, while the hue says which provider they came from. Conflating them
23
+ * is what makes a style hint and a spelling mistake indistinguishable.
24
+ */
25
+ type ReviewSeverity = 'info' | 'suggestion' | 'warning' | 'error';
26
+ /** How a suggestion is applied relative to the finding. */
27
+ type ReviewSuggestionKind = 'replace' | 'remove' | 'insertAfter' | 'replaceBlock';
28
+ interface ReviewSuggestion {
29
+ /** Replacement text. Empty for `remove`. */
30
+ text: string;
31
+ /**
32
+ * `replaceBlock` swaps the whole owning block rather than the finding's span.
33
+ * A model asked to improve a sentence rewrites the sentence; forcing that
34
+ * into a span replacement is what produces the mangled half-edits.
35
+ */
36
+ kind: ReviewSuggestionKind;
37
+ /** Button label, e.g. "Tighten". Falls back to a kind-derived default. */
38
+ label?: string;
39
+ }
40
+ /**
41
+ * One issue in a reviewed document.
42
+ *
43
+ * Offsets are UTF-16 code units into {@link ReviewRequest.source} — the same
44
+ * coordinate space as ProseMirror, Monaco and DOM Range.
45
+ */
46
+ interface ReviewFinding {
47
+ /** Unique within one pass of one provider. */
48
+ id: string;
49
+ /**
50
+ * Which provider produced this. Namespaces decorations and groups the panel,
51
+ * so two providers can report the same span without colliding.
52
+ */
53
+ source: string;
54
+ start: number;
55
+ end: number;
56
+ /**
57
+ * The block this finding is about.
58
+ *
59
+ * Present even when the span is exact, because a span goes stale as soon as
60
+ * the user types while the block does not — a finding that can still be
61
+ * navigated to is worth more than one that can only be discarded.
62
+ */
63
+ blockKey?: number;
64
+ severity: ReviewSeverity;
65
+ /** Provider-defined grouping, e.g. `spelling` or `clarity`. */
66
+ category: string;
67
+ /** One sentence. Shown inline. */
68
+ message: string;
69
+ /** The longer "why", shown on expand. A linter rarely has one; a model does. */
70
+ rationale?: string;
71
+ /** Text at `[start, end)` when reviewed — the staleness check before applying. */
72
+ originalText: string;
73
+ suggestions: ReviewSuggestion[];
74
+ }
75
+ /** One block handed to a provider. */
76
+ interface ReviewBlockInput {
77
+ /** Matches the editor's block key, so a finding can navigate back. */
78
+ key: number;
79
+ /** 1-based line where the block starts in `source`. */
80
+ startLine: number;
81
+ /** Nearest enclosing heading, for context. Null at the top of a document. */
82
+ heading: string | null;
83
+ /** Block text, with machine vocabulary already masked. */
84
+ text: string;
85
+ /** UTF-16 offset of `text` within {@link ReviewRequest.source}. */
86
+ offset: number;
87
+ }
88
+ /** Identifies the document under review. */
89
+ interface ReviewDocumentRef {
90
+ articleId: string;
91
+ fileName?: string;
92
+ }
93
+ interface ReviewRequest {
94
+ /** The whole document, for a provider that wants surrounding context. */
95
+ source: string;
96
+ blocks: readonly ReviewBlockInput[];
97
+ /**
98
+ * Blocks changed since this provider's last pass, when the editor knows.
99
+ *
100
+ * A hint, not a restriction: a cheap provider may ignore it and re-scan
101
+ * everything, while an expensive one can review only what moved. Absent on
102
+ * a first pass.
103
+ */
104
+ changedBlockKeys?: readonly number[];
105
+ language?: 'plaintext' | 'markdown';
106
+ documentRef: ReviewDocumentRef;
107
+ }
108
+ /**
109
+ * Progress from one provider pass.
110
+ *
111
+ * `findings` is additive and may arrive many times: a reviewer that takes
112
+ * seconds per block should show its first result immediately rather than
113
+ * holding everything until the last block returns.
114
+ */
115
+ type ReviewEvent = {
116
+ type: 'findings';
117
+ findings: readonly ReviewFinding[];
118
+ } | {
119
+ type: 'progress';
120
+ blockKey: number;
121
+ } | {
122
+ type: 'done';
123
+ } | {
124
+ type: 'error';
125
+ message: string;
126
+ };
127
+ /** The provider id the editor adapts harper under. */
128
+ declare const PROOFING_REVIEW_SOURCE = "harper";
129
+ /**
130
+ * Adapt one proofing finding into a review finding.
131
+ *
132
+ * `offset` shifts engine-relative offsets into document coordinates, for a
133
+ * provider that linted a block or a joined run rather than the whole source.
134
+ */
135
+ declare function proofFindingToReviewFinding(finding: ProofFinding, options?: {
136
+ source?: string;
137
+ offset?: number;
138
+ blockKey?: number;
139
+ }): ReviewFinding;
140
+
141
+ export { PROOFING_REVIEW_SOURCE, type ReviewBlockInput, type ReviewDocumentRef, type ReviewEvent, type ReviewFinding, type ReviewRequest, type ReviewSeverity, type ReviewSuggestion, type ReviewSuggestionKind, proofFindingToReviewFinding };
@@ -0,0 +1,29 @@
1
+ // src/review/types.ts
2
+ var PROOF_SEVERITY = Object.freeze({
3
+ spelling: "error",
4
+ grammar: "warning",
5
+ style: "suggestion"
6
+ });
7
+ var PROOFING_REVIEW_SOURCE = "harper";
8
+ function proofFindingToReviewFinding(finding, options = {}) {
9
+ const offset = options.offset ?? 0;
10
+ return {
11
+ id: finding.id,
12
+ source: options.source ?? PROOFING_REVIEW_SOURCE,
13
+ start: finding.start + offset,
14
+ end: finding.end + offset,
15
+ ...options.blockKey === void 0 ? {} : { blockKey: options.blockKey },
16
+ severity: PROOF_SEVERITY[finding.category],
17
+ category: finding.category,
18
+ message: finding.message,
19
+ originalText: finding.originalText,
20
+ suggestions: finding.suggestions.map((suggestion) => ({
21
+ text: suggestion.text,
22
+ kind: suggestion.kind
23
+ }))
24
+ };
25
+ }
26
+ export {
27
+ PROOFING_REVIEW_SOURCE,
28
+ proofFindingToReviewFinding
29
+ };
@@ -13,7 +13,7 @@ import {
13
13
  pipStyleVars,
14
14
  serializeTheme,
15
15
  validateDocSchema
16
- } from "../chunk-XV4SF2N5.js";
16
+ } from "../chunk-BUJ5RV2P.js";
17
17
  import {
18
18
  defaultPageStyle,
19
19
  getDocPlaybackDuration,
@@ -22,8 +22,10 @@ import {
22
22
  import {
23
23
  AVAILABLE_FONT_STACKS,
24
24
  DARK_SURFACE,
25
+ DEFAULT_DOC_FONT,
25
26
  DEFAULT_THEME,
26
27
  DEFAULT_THEME_ID,
28
+ DEFAULT_TITLE_FONT,
27
29
  FONT_FALLBACKS,
28
30
  FRONTMATTER_CUSTOM_TEMPLATES_KEY,
29
31
  FRONTMATTER_CUSTOM_THEMES_KEY,
@@ -48,21 +50,32 @@ import {
48
50
  PAGE_SHADOWS,
49
51
  THEMES,
50
52
  THEME_SCHEMA_VERSION,
53
+ VIEWPORT_PRESETS,
51
54
  applySurface,
52
55
  assertTheme,
53
56
  buildGoogleFontsUrl,
57
+ calculateFontScale,
54
58
  contrastRatio,
59
+ createTemplateContext,
55
60
  createTheme,
56
61
  createThemeRegistry,
57
62
  deriveScale,
58
63
  fontStack,
64
+ getAspectRatioString,
59
65
  getAvailableThemes,
60
66
  getFontStack,
67
+ getLayoutHints,
68
+ getSafeTextBounds,
61
69
  getThemeSummaries,
70
+ getTwoColumnPositions,
71
+ getViewport,
72
+ getViewportOrientation,
62
73
  guessFontFallback,
63
74
  hexHueDegrees,
64
75
  isCustomTemplateDefinition,
65
76
  isHex,
77
+ isPersistentLayerTemplate,
78
+ isTemplateBlock,
66
79
  matchFontFamily,
67
80
  oklchDarken,
68
81
  oklchLighten,
@@ -71,27 +84,12 @@ import {
71
84
  relativeLuminance,
72
85
  resolveFontFamily,
73
86
  resolveTheme,
87
+ scaledFontSize,
88
+ scaledFontSize2,
74
89
  validateCustomTemplateDefinition,
75
90
  validateTheme,
76
91
  withAlpha
77
- } from "../chunk-RXYKU6EX.js";
78
- import {
79
- DEFAULT_DOC_FONT,
80
- DEFAULT_TITLE_FONT,
81
- VIEWPORT_PRESETS,
82
- calculateFontScale,
83
- createTemplateContext,
84
- getAspectRatioString,
85
- getLayoutHints,
86
- getSafeTextBounds,
87
- getTwoColumnPositions,
88
- getViewport,
89
- getViewportOrientation,
90
- isPersistentLayerTemplate,
91
- isTemplateBlock,
92
- scaledFontSize,
93
- scaledFontSize2
94
- } from "../chunk-BAOV476U.js";
92
+ } from "../chunk-Y4D6TDZT.js";
95
93
  import {
96
94
  DEFAULT_TRANSITION_DURATION_SECONDS,
97
95
  TRANSITION_DIRECTIONS,
@@ -1,3 +1,6 @@
1
+ import { g as AudioSegment, h as AudioTimingData, n as CaptionTrack } from '../Doc-BkxT7G80.js';
2
+ import '../types-Be6sBUBx.js';
3
+
1
4
  /**
2
5
  * Narration timing estimation.
3
6
  *
@@ -105,4 +108,29 @@ interface NarrationTimeOptions {
105
108
  */
106
109
  declare function estimateNarrationTime(text: string, options?: NarrationTimeOptions): NarrationTimeEstimate;
107
110
 
108
- export { DEFAULT_WORDS_PER_SECOND, type NarrationTimeEstimate, type NarrationTimeOptions, type ReadingTimeEstimate, type ReadingTimeOptions, calculatePrefixDuration, countSpokenWords, estimateNarrationDuration, estimateNarrationTime, estimateReadingTime, estimateSpokenWordCount, estimateTimeFromText };
111
+ /**
112
+ * Caption Track Construction
113
+ *
114
+ * Converts narration segment text and optional word/bookmark timing into the
115
+ * canonical Doc CaptionTrack. Hosts retain responsibility for mapping their
116
+ * domain model and timing sidecars into CaptionSegmentSource records.
117
+ */
118
+
119
+ interface CaptionSegmentSource {
120
+ segment: AudioSegment;
121
+ text?: string | null;
122
+ spokenPrefix?: string;
123
+ timing?: AudioTimingData | null;
124
+ }
125
+ interface BuildCaptionTrackOptions {
126
+ version?: number;
127
+ generatedAt?: string;
128
+ targetWordsPerPhrase?: number;
129
+ minPhraseDuration?: number;
130
+ maxPhraseDuration?: number;
131
+ wordsPerSecond?: number;
132
+ closePhraseGaps?: boolean;
133
+ }
134
+ declare function buildCaptionTrack(sources: CaptionSegmentSource[], options?: BuildCaptionTrackOptions): CaptionTrack;
135
+
136
+ export { type BuildCaptionTrackOptions, type CaptionSegmentSource, DEFAULT_WORDS_PER_SECOND, type NarrationTimeEstimate, type NarrationTimeOptions, type ReadingTimeEstimate, type ReadingTimeOptions, buildCaptionTrack, calculatePrefixDuration, countSpokenWords, estimateNarrationDuration, estimateNarrationTime, estimateReadingTime, estimateSpokenWordCount, estimateTimeFromText };