@bendyline/squisq 2.13.10 → 2.13.12
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.
- package/dist/{Doc-DqYt_b2b.d.ts → Doc-BhvotZx_.d.ts} +48 -2
- package/dist/{ImageEditDoc-CXXiXVJ-.d.ts → ImageEditDoc-D8hYio6b.d.ts} +1 -1
- package/dist/{chunk-S76W65BB.js → chunk-5DFFVW75.js} +1 -1
- package/dist/{chunk-DOOUVVOM.js → chunk-7MS26OXD.js} +4 -0
- package/dist/{chunk-XDOSE5M3.js → chunk-C4SB3NN4.js} +1 -1
- package/dist/{chunk-FXQ7C2FF.js → chunk-CQSCYJQU.js} +1 -1
- package/dist/{chunk-SG3HXPMF.js → chunk-DBVCSVNV.js} +2 -1
- package/dist/{chunk-WK6LEZ3U.js → chunk-IFZZI4XY.js} +132 -11
- package/dist/{chunk-WNEH3BZP.js → chunk-JNUNNQ74.js} +3 -3
- package/dist/{chunk-KRMAEYNM.js → chunk-OUSEEUEC.js} +389 -217
- package/dist/{chunk-LWNT6M4N.js → chunk-QJQQO3K4.js} +1857 -386
- package/dist/{chunk-DIY3NBIS.js → chunk-SGNWO7OF.js} +22 -1
- package/dist/{chunk-GLWQTZ4C.js → chunk-XEQALK5B.js} +1 -1
- package/dist/doc/index.d.ts +124 -9
- package/dist/doc/index.js +19 -7
- package/dist/fence/index.d.ts +1 -1
- package/dist/generate/index.d.ts +1 -1
- package/dist/imageEdit/index.d.ts +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +23 -11
- package/dist/jsonForm/index.d.ts +1 -1
- package/dist/jsonForm/index.js +3 -3
- package/dist/markdown/index.js +3 -3
- package/dist/{materializePageSection-S2hxZ_lO.d.ts → materializePageSection-bLfqIy6j.d.ts} +1 -1
- package/dist/mediaEdit/index.d.ts +2 -2
- package/dist/narration/index.d.ts +1 -1
- package/dist/narration/index.js +5 -5
- package/dist/recommend/index.js +1 -1
- package/dist/schemas/index.d.ts +4 -4
- package/dist/schemas/index.js +2 -2
- package/dist/{themeLibrary-CFJbeItn.d.ts → themeLibrary-BIYE6aLw.d.ts} +1 -1
- package/dist/timing/index.d.ts +1 -1
- package/dist/transform/index.d.ts +23 -14
- package/dist/transform/index.js +6 -6
- package/package.json +1 -1
|
@@ -852,6 +852,11 @@ interface StatHighlightInput extends BaseTemplateBlock {
|
|
|
852
852
|
description: string;
|
|
853
853
|
/** Additional detail or context */
|
|
854
854
|
detail?: string;
|
|
855
|
+
/**
|
|
856
|
+
* Optional deck headline. With one, the slide takes the concept blocks'
|
|
857
|
+
* lockup: accent rule and headline above, the figure beside what it means.
|
|
858
|
+
*/
|
|
859
|
+
headline?: string;
|
|
855
860
|
/** Color scheme for the stat */
|
|
856
861
|
colorScheme?: ColorScheme;
|
|
857
862
|
/** Optional accent image to complement the text */
|
|
@@ -1076,6 +1081,36 @@ interface ListBlockInput extends BaseTemplateBlock {
|
|
|
1076
1081
|
/** Optional accent image */
|
|
1077
1082
|
accentImage?: AccentImage;
|
|
1078
1083
|
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Shared shape of the concept blocks (`cards`, `process`, `cycle`): a
|
|
1086
|
+
* headline over 2–6 related ideas, each `Label: detail` or plain text.
|
|
1087
|
+
*/
|
|
1088
|
+
interface ConceptBlockBase extends BaseTemplateBlock {
|
|
1089
|
+
/** The ideas, in order; `Label: detail` sets the label bold above its detail. */
|
|
1090
|
+
items: string[];
|
|
1091
|
+
/** Optional headline above the ideas */
|
|
1092
|
+
title?: string;
|
|
1093
|
+
/** Accent color scheme (default: the theme's highlight) */
|
|
1094
|
+
colorScheme?: ColorScheme;
|
|
1095
|
+
}
|
|
1096
|
+
/** Parallel ideas side by side as cards. */
|
|
1097
|
+
interface CardsBlockInput extends ConceptBlockBase {
|
|
1098
|
+
template: 'cards';
|
|
1099
|
+
/** Two ideas set against each other: two panels with a "vs" mark between them. */
|
|
1100
|
+
versus?: boolean;
|
|
1101
|
+
}
|
|
1102
|
+
/** An ordered process: numbered stages joined by arrows. */
|
|
1103
|
+
interface ProcessBlockInput extends ConceptBlockBase {
|
|
1104
|
+
template: 'process';
|
|
1105
|
+
}
|
|
1106
|
+
/** A cycle: stages on a ring, the last leading back to the first. */
|
|
1107
|
+
interface CycleBlockInput extends ConceptBlockBase {
|
|
1108
|
+
template: 'cycle';
|
|
1109
|
+
}
|
|
1110
|
+
/** Nested parts, innermost first: concentric rings, each part called out beside them. */
|
|
1111
|
+
interface LayersBlockInput extends ConceptBlockBase {
|
|
1112
|
+
template: 'layers';
|
|
1113
|
+
}
|
|
1079
1114
|
/**
|
|
1080
1115
|
* Tree block — renders a hierarchical filesystem-style treeview from an
|
|
1081
1116
|
* ASCII tree fence (file trees, dependency trees, outlines). The nested
|
|
@@ -1487,7 +1522,7 @@ type ChartTemplateInput = BarChartInput | ColumnChartInput | PieChartInput | Don
|
|
|
1487
1522
|
/**
|
|
1488
1523
|
* Union of all template block types.
|
|
1489
1524
|
*/
|
|
1490
|
-
type TemplateBlock = TitleBlockInput | SectionHeaderInput | BigTextInput | TranscriptBlockInput | ContentBlockInput | StatHighlightInput | QuoteBlockInput | FactCardInput | TwoColumnInput | DateEventInput | ImageWithCaptionInput | LeftFeatureInput | RightFeatureInput | TopFeatureInput | BottomFeatureInput | MediaOnlyInput | MapBlockInput | FullBleedQuoteInput | ListBlockInput | PhotoGridInput | DefinitionCardInput | ComparisonBarInput | PullQuoteInput | VideoWithCaptionInput | VideoPullQuoteInput | DataTableInput | BarChartInput | ColumnChartInput | PieChartInput | DonutChartInput | LineChartInput | AreaChartInput | ScatterChartInput | DiagramBlockInput | TreeBlockInput | TimelineBlockInput | DrawingBlockInput | RawLayersInput;
|
|
1525
|
+
type TemplateBlock = TitleBlockInput | SectionHeaderInput | BigTextInput | TranscriptBlockInput | ContentBlockInput | StatHighlightInput | QuoteBlockInput | FactCardInput | TwoColumnInput | DateEventInput | ImageWithCaptionInput | LeftFeatureInput | RightFeatureInput | TopFeatureInput | BottomFeatureInput | MediaOnlyInput | MapBlockInput | FullBleedQuoteInput | ListBlockInput | CardsBlockInput | ProcessBlockInput | CycleBlockInput | LayersBlockInput | PhotoGridInput | DefinitionCardInput | ComparisonBarInput | PullQuoteInput | VideoWithCaptionInput | VideoPullQuoteInput | DataTableInput | BarChartInput | ColumnChartInput | PieChartInput | DonutChartInput | LineChartInput | AreaChartInput | ScatterChartInput | DiagramBlockInput | TreeBlockInput | TimelineBlockInput | DrawingBlockInput | RawLayersInput;
|
|
1491
1526
|
/**
|
|
1492
1527
|
* A block can be either a raw Block or a TemplateBlock.
|
|
1493
1528
|
*/
|
|
@@ -2708,6 +2743,12 @@ interface BaseLayer {
|
|
|
2708
2743
|
position: Position;
|
|
2709
2744
|
/** Animation to apply */
|
|
2710
2745
|
animation?: Animation;
|
|
2746
|
+
/**
|
|
2747
|
+
* The build step this layer reveals with, when its block builds: layers
|
|
2748
|
+
* sharing an index (a card's shape and words) appear together, in index
|
|
2749
|
+
* order. Their text names the step (`blockBuildSteps`).
|
|
2750
|
+
*/
|
|
2751
|
+
buildStep?: number;
|
|
2711
2752
|
}
|
|
2712
2753
|
/**
|
|
2713
2754
|
* Photographic treatment applied to an image layer — a theme-level "grade"
|
|
@@ -3067,6 +3108,11 @@ interface TableLayer extends BaseLayer {
|
|
|
3067
3108
|
maxVisibleRows?: number;
|
|
3068
3109
|
/** Per-column alignment */
|
|
3069
3110
|
align?: (('left' | 'right' | 'center') | null)[];
|
|
3111
|
+
/**
|
|
3112
|
+
* Fit the layer's width: cells wrap and keep their own line breaks
|
|
3113
|
+
* instead of running on one line and scrolling sideways.
|
|
3114
|
+
*/
|
|
3115
|
+
wrap?: boolean;
|
|
3070
3116
|
/** Visual styling */
|
|
3071
3117
|
style: TableLayerStyle;
|
|
3072
3118
|
};
|
|
@@ -3486,4 +3532,4 @@ declare function getBlockAtTime(blocks: Block[], time: number): Block | null;
|
|
|
3486
3532
|
*/
|
|
3487
3533
|
declare function getCaptionAtTime(captions: CaptionTrack | undefined, time: number): CaptionPhrase | null;
|
|
3488
3534
|
|
|
3489
|
-
export { type
|
|
3535
|
+
export { type FactCardInput as $, type AccentImage as A, type BarChartInput as B, type CaptionPhrase as C, type CustomTemplateDefinition as D, type CustomTemplateLayer as E, type CustomTemplateValidationError as F, type CustomTemplateValidationResult as G, type CycleBlockInput as H, DARK_SURFACE as I, DEFAULT_DOC_FONT as J, DEFAULT_TITLE_FONT as K, type DataTableInput as L, type DateEventInput as M, type DeepPartial as N, type DefinitionCardInput as O, type DiagramBlockInput as P, type DiagramEdgeAnchor as Q, type DiagramTemplateEdge as R, type DiagramTemplateNode as S, type Doc as T, type DocBlock as U, type DocDiagnostic as V, type DonutChartInput as W, type DrawingBlockInput as X, FRONTMATTER_CUSTOM_TEMPLATES_KEY as Y, FRONTMATTER_CUSTOM_THEMES_KEY as Z, FRONTMATTER_MOTION_KEY as _, type AccentPosition as a, type PageVariant as a$, type FontFamily as a0, type FontFamilyKind as a1, type FullBleedQuoteInput as a2, type GradientBackgroundConfig as a3, type ImageBackgroundConfig as a4, type ImageLayer as a5, type ImageTreatment as a6, type ImageWithCaptionInput as a7, LIGHT_SURFACE as a8, type Layer as a9, PAGE_ACCENT_STRATEGIES as aA, PAGE_BACKGROUNDS as aB, PAGE_BACKGROUND_RHYTHMS as aC, PAGE_DESIGN_FAMILIES as aD, PAGE_DIVIDERS as aE, PAGE_EMPHASES as aF, PAGE_EYEBROWS as aG, PAGE_HEADING_CASES as aH, PAGE_HEADING_SCALES as aI, PAGE_HEADING_UNDERLINES as aJ, PAGE_HERO_STYLES as aK, PAGE_IMAGE_FRAMINGS as aL, PAGE_NUMERAL_STYLES as aM, PAGE_PATTERNS as aN, PAGE_QUOTE_MARKS as aO, PAGE_SECTION_KINDS as aP, PAGE_SECTION_SPACINGS as aQ, PAGE_SHADOWS as aR, PAGE_VARIANTS as aS, type PageAccentRotation as aT, type PageBackground as aU, type PageDesignFamily as aV, type PageEmphasis as aW, type PageHeadingTreatment as aX, type PageSectionKind as aY, type PageSectionOverride as aZ, type PageTokens as a_, type LayerRepeat as aa, type LayersBlockInput as ab, type LayoutHints as ac, type LeftFeatureInput as ad, type LineChartInput as ae, type LinearGradient as af, type ListBlockInput as ag, MOTION_PROFILES as ah, type MapBlockInput as ai, type MapLayer as aj, type MapMarker as ak, type MapTileStyle as al, type MarkerStyle as am, type MediaClip as an, type MediaCrop as ao, type MediaCut as ap, type MediaEdits as aq, type MediaOnlyInput as ar, type MediaScheduleOptions as as, type MermaidLayer as at, type MotionEntrance as au, type MotionOrigin as av, type MotionProfile as aw, type MotionProfileName as ax, type MotionSpec as ay, type MotionState as az, type AmbientGradientConfig as b, type TreeLayerStyle as b$, type PathLayer as b0, type PatternBackgroundConfig as b1, type PersistentLayer as b2, type PersistentLayerConfig as b3, type PersistentLayerTemplate as b4, type PersistentLayerTemplateConfig as b5, type PersistentLayerTemplateType as b6, type PhotoGridInput as b7, type PieChartInput as b8, type PipStyle as b9, type TemplateFunction as bA, type TemplateRegistry as bB, type TextFlow as bC, type TextLayer as bD, type TextParagraph as bE, type TextParagraphList 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 TopFeatureInput as bW, type TranscriptBlockInput as bX, type TreeBlockInput as bY, type TreeLayer as bZ, type TreeLayerItem as b_, type Position as ba, type PresentationSlideMark as bb, type ProcessBlockInput as bc, type ProgressIndicatorConfig as bd, type PromotedBodyAnnotation as be, type PullQuoteInput as bf, type QuoteBlockInput as bg, type RawLayersInput as bh, type RenderStyle as bi, type RightFeatureInput as bj, type ScatterChartInput as bk, type ScheduledClip as bl, type SectionHeaderInput as bm, type ShapeFilter as bn, type ShapeLayer as bo, type ShapePattern as bp, type SolidBackgroundConfig as bq, type StartBlockConfig as br, type StatHighlightInput as bs, type SurfaceScheme as bt, type SvgLayer as bu, THEME_SCHEMA_VERSION as bv, type TableLayer as bw, type TableLayerStyle as bx, type TemplateBlock as by, type TemplateContext as bz, type Animation as c, parseMediaFx as c$, type TreeTemplateItem as c0, type TwoColumnInput as c1, VIEWPORT_PRESETS as c2, type VideoEmbedLayer as c3, type VideoLayer as c4, type VideoPipPosition as c5, type VideoPipShape as c6, type VideoPipSize as c7, type VideoPlacement as c8, type VideoPresentation as c9, scaledFontSize$1 as cA, readFrontmatterMotion as cB, resolveMediaSchedule as cC, resolveMotionForDoc as cD, resolveMotionProfile as cE, scaledFontSize as cF, scheduleMediaClip as cG, validateCustomTemplateDefinition as cH, type MediaFxOpId as cI, type MediaFxChain as cJ, MEDIA_EDIT_PARAMS as cK, MEDIA_FX_ORDER as cL, MEDIA_FX_SPECS as cM, type MediaEditParamKey as cN, type MediaEditParamValues as cO, type MediaFxOp as cP, formatMediaNumber as cQ, hasRenderableFx as cR, mediaEditHtmlAttribute as cS, mediaEditValuesFromAttributes as cT, mediaEditValuesFromParams as cU, mediaRenderKey as cV, normalizeMediaCrop as cW, normalizeMediaCuts as cX, parseMediaCrop as cY, parseMediaCuts as cZ, parseMediaEdits as c_, type VideoPullQuoteInput as ca, type VideoWithCaptionInput as cb, type ViewportConfig as cc, type ViewportOrientation as cd, type ViewportPreset as ce, type VignetteConfig as cf, applySurface as cg, calculateDuration as ch, calculateFontScale as ci, createTemplateContext as cj, createTheme as ck, createThemeRegistry as cl, getAspectRatioString as cm, getBlockAtTime as cn, getCaptionAtTime as co, getDocPlaybackDuration as cp, getLayoutHints as cq, getSafeTextBounds as cr, getSegmentAtTime as cs, getTwoColumnPositions as ct, getViewport as cu, getViewportOrientation as cv, isCustomTemplateDefinition as cw, isMotionProfileName as cx, isPersistentLayerTemplate as cy, isTemplateBlock as cz, type AnimationType as d, serializeMediaCrop as d0, serializeMediaCuts as d1, serializeMediaEdits as d2, serializeMediaFx as d3, 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 BottomFeatureInput as n, type CaptionTrack as o, type CaptionWord as p, type CardsBlockInput as q, type ChartBaseFields as r, type ChartTemplateInput as s, type ColorScheme as t, type ColumnChartInput as u, type ComparisonBarInput as v, type ContentBlockInput as w, type CornerBrandingConfig as x, type CountUpSpec as y, type CreateTemplateContextOptions as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a5 as ImageLayer, bD as TextLayer, bo as ShapeLayer, b0 as PathLayer } from './Doc-BhvotZx_.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ImageEditDoc — JSON document describing a layered, editable image.
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
relativeLuminance,
|
|
16
16
|
resolveFontFamily,
|
|
17
17
|
withAlpha
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JNUNNQ74.js";
|
|
19
19
|
import {
|
|
20
20
|
SVG_ISLAND_LIMITS,
|
|
21
21
|
parseBuildSpec
|
|
@@ -216,6 +216,7 @@ function validateLayerContent(type, content, path, issues) {
|
|
|
216
216
|
optionalFiniteNumber(content, "maxVisibleRows", `${path}.maxVisibleRows`, issues, {
|
|
217
217
|
min: 1
|
|
218
218
|
});
|
|
219
|
+
optionalBoolean(content, "wrap", `${path}.wrap`, issues);
|
|
219
220
|
requiredRecord(content, "style", `${path}.style`, issues);
|
|
220
221
|
break;
|
|
221
222
|
case "tree":
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-HKHOFTGM.js";
|
|
4
4
|
import {
|
|
5
5
|
applySavedPresentation
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OUSEEUEC.js";
|
|
7
7
|
import {
|
|
8
8
|
SHAPE_NAMES,
|
|
9
9
|
buildChartData,
|
|
@@ -28,10 +28,11 @@ import {
|
|
|
28
28
|
placeLayersInRect,
|
|
29
29
|
readCustomThemesFromFrontmatter,
|
|
30
30
|
resolvePersistentLayers,
|
|
31
|
+
splitConceptItem,
|
|
31
32
|
templateRegistry,
|
|
32
33
|
writeCustomTemplatesToFrontmatter,
|
|
33
34
|
writeCustomThemesToFrontmatter
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-QJQQO3K4.js";
|
|
35
36
|
import {
|
|
36
37
|
ASCII_TREE_VOCAB,
|
|
37
38
|
ASCII_VOCAB,
|
|
@@ -54,7 +55,7 @@ import {
|
|
|
54
55
|
toCells,
|
|
55
56
|
toGrid,
|
|
56
57
|
traceBoxes
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-SGNWO7OF.js";
|
|
58
59
|
import {
|
|
59
60
|
iconMarker
|
|
60
61
|
} from "./chunk-7ZAAICW4.js";
|
|
@@ -78,7 +79,7 @@ import {
|
|
|
78
79
|
resolveFontFamily,
|
|
79
80
|
resolveTheme,
|
|
80
81
|
withAlpha
|
|
81
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-JNUNNQ74.js";
|
|
82
83
|
import {
|
|
83
84
|
createMediaTimeMap
|
|
84
85
|
} from "./chunk-JSGIWW35.js";
|
|
@@ -87,13 +88,13 @@ import {
|
|
|
87
88
|
} from "./chunk-L7QZORLB.js";
|
|
88
89
|
import {
|
|
89
90
|
parseMarkdown
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-C4SB3NN4.js";
|
|
91
92
|
import {
|
|
92
93
|
TABLE_FED_TEMPLATES,
|
|
93
94
|
TEMPLATE_ALIASES,
|
|
94
95
|
isContainerTemplate,
|
|
95
96
|
resolveTemplateName
|
|
96
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-7MS26OXD.js";
|
|
97
98
|
import {
|
|
98
99
|
KNOWN_BLOCK_META_KEYS,
|
|
99
100
|
coerceAnnotationValues,
|
|
@@ -1476,6 +1477,20 @@ var list = (input) => {
|
|
|
1476
1477
|
colorScheme: l.colorScheme
|
|
1477
1478
|
};
|
|
1478
1479
|
};
|
|
1480
|
+
var concept = (input) => {
|
|
1481
|
+
const c = input;
|
|
1482
|
+
return {
|
|
1483
|
+
kind: "item-list",
|
|
1484
|
+
slots: {
|
|
1485
|
+
title: c.title,
|
|
1486
|
+
items: (c.items ?? []).map((item) => {
|
|
1487
|
+
const { label, detail } = splitConceptItem(item);
|
|
1488
|
+
return label ? { title: label, body: detail } : { body: detail };
|
|
1489
|
+
})
|
|
1490
|
+
},
|
|
1491
|
+
colorScheme: c.colorScheme
|
|
1492
|
+
};
|
|
1493
|
+
};
|
|
1479
1494
|
var photoGrid = (input) => {
|
|
1480
1495
|
const p = input;
|
|
1481
1496
|
const images = p.images ?? [];
|
|
@@ -1648,6 +1663,10 @@ var sectionExtractors = {
|
|
|
1648
1663
|
map,
|
|
1649
1664
|
fullBleedQuote,
|
|
1650
1665
|
list,
|
|
1666
|
+
cards: concept,
|
|
1667
|
+
process: concept,
|
|
1668
|
+
cycle: concept,
|
|
1669
|
+
layers: concept,
|
|
1651
1670
|
photoGrid,
|
|
1652
1671
|
definitionCard,
|
|
1653
1672
|
comparisonBar,
|
|
@@ -4312,6 +4331,103 @@ function materializeFlashcards(doc, options = {}) {
|
|
|
4312
4331
|
};
|
|
4313
4332
|
}
|
|
4314
4333
|
|
|
4334
|
+
// src/narration/reanchor.ts
|
|
4335
|
+
var MIN_SHARED_WORDS = 0.9;
|
|
4336
|
+
var MAX_WORD_EDITS = 500;
|
|
4337
|
+
function words(text) {
|
|
4338
|
+
const found = [];
|
|
4339
|
+
const tokenRe = /\S+/g;
|
|
4340
|
+
let match;
|
|
4341
|
+
while ((match = tokenRe.exec(text)) !== null) {
|
|
4342
|
+
found.push({ text: match[0], start: match.index, end: match.index + match[0].length });
|
|
4343
|
+
}
|
|
4344
|
+
return found;
|
|
4345
|
+
}
|
|
4346
|
+
function sharedWords(a, b, maxEdits) {
|
|
4347
|
+
const n = a.length;
|
|
4348
|
+
const m = b.length;
|
|
4349
|
+
const max = Math.min(n + m, maxEdits);
|
|
4350
|
+
const mid = max + 1;
|
|
4351
|
+
const v = new Int32Array(2 * max + 3);
|
|
4352
|
+
const trace = [];
|
|
4353
|
+
for (let d = 0; d <= max; d++) {
|
|
4354
|
+
trace.push(v.slice(mid - d - 1, mid + d + 2));
|
|
4355
|
+
for (let k = -d; k <= d; k += 2) {
|
|
4356
|
+
let x = k === -d || k !== d && v[mid + k - 1] < v[mid + k + 1] ? v[mid + k + 1] : v[mid + k - 1] + 1;
|
|
4357
|
+
let y = x - k;
|
|
4358
|
+
while (x < n && y < m && a[x] === b[y]) {
|
|
4359
|
+
x++;
|
|
4360
|
+
y++;
|
|
4361
|
+
}
|
|
4362
|
+
v[mid + k] = x;
|
|
4363
|
+
if (x >= n && y >= m) return walkBack(trace, n, m);
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
return null;
|
|
4367
|
+
}
|
|
4368
|
+
function walkBack(trace, n, m) {
|
|
4369
|
+
const pairs = [];
|
|
4370
|
+
let x = n;
|
|
4371
|
+
let y = m;
|
|
4372
|
+
for (let d = trace.length - 1; d >= 0; d--) {
|
|
4373
|
+
const row = trace[d];
|
|
4374
|
+
const at = (k2) => row[k2 + d + 1];
|
|
4375
|
+
const k = x - y;
|
|
4376
|
+
const previous = k === -d || k !== d && at(k - 1) < at(k + 1) ? k + 1 : k - 1;
|
|
4377
|
+
const previousX = at(previous);
|
|
4378
|
+
const previousY = previousX - previous;
|
|
4379
|
+
while (x > previousX && y > previousY) {
|
|
4380
|
+
x--;
|
|
4381
|
+
y--;
|
|
4382
|
+
pairs.push([x, y]);
|
|
4383
|
+
}
|
|
4384
|
+
x = previousX;
|
|
4385
|
+
y = previousY;
|
|
4386
|
+
}
|
|
4387
|
+
return pairs.reverse();
|
|
4388
|
+
}
|
|
4389
|
+
function reanchorNarrationText(recorded, current) {
|
|
4390
|
+
if (recorded === current) return (offset) => offset;
|
|
4391
|
+
const from = words(recorded);
|
|
4392
|
+
const to = words(current);
|
|
4393
|
+
if (!from.length || !to.length) return null;
|
|
4394
|
+
const budget = Math.min(
|
|
4395
|
+
MAX_WORD_EDITS,
|
|
4396
|
+
Math.ceil((1 - MIN_SHARED_WORDS) * (from.length + to.length))
|
|
4397
|
+
);
|
|
4398
|
+
const fromText = from.map((word) => word.text);
|
|
4399
|
+
const toText = to.map((word) => word.text);
|
|
4400
|
+
let head = 0;
|
|
4401
|
+
while (head < from.length && head < to.length && fromText[head] === toText[head]) head++;
|
|
4402
|
+
let tail = 0;
|
|
4403
|
+
while (tail < from.length - head && tail < to.length - head && fromText[from.length - 1 - tail] === toText[to.length - 1 - tail])
|
|
4404
|
+
tail++;
|
|
4405
|
+
const middle = sharedWords(
|
|
4406
|
+
fromText.slice(head, from.length - tail),
|
|
4407
|
+
toText.slice(head, to.length - tail),
|
|
4408
|
+
budget
|
|
4409
|
+
);
|
|
4410
|
+
if (!middle) return null;
|
|
4411
|
+
const shared = head + middle.length + tail;
|
|
4412
|
+
if (shared < MIN_SHARED_WORDS * from.length || shared < MIN_SHARED_WORDS * to.length) return null;
|
|
4413
|
+
const target = new Int32Array(from.length).fill(-1);
|
|
4414
|
+
for (let i = 0; i < head; i++) target[i] = i;
|
|
4415
|
+
for (const [i, j] of middle) target[head + i] = head + j;
|
|
4416
|
+
for (let i = 1; i <= tail; i++) target[from.length - i] = to.length - i;
|
|
4417
|
+
return (offset) => {
|
|
4418
|
+
let low = 0;
|
|
4419
|
+
let high = from.length;
|
|
4420
|
+
while (low < high) {
|
|
4421
|
+
const probe = low + high >> 1;
|
|
4422
|
+
if (from[probe].end <= offset) low = probe + 1;
|
|
4423
|
+
else high = probe;
|
|
4424
|
+
}
|
|
4425
|
+
const j = low < from.length ? target[low] : -1;
|
|
4426
|
+
if (j < 0) return void 0;
|
|
4427
|
+
return to[j].start + Math.max(0, offset - from[low].start);
|
|
4428
|
+
};
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4315
4431
|
// src/doc/applyNarrationTiming.ts
|
|
4316
4432
|
var MIN_BLOCK_SIMILARITY = 0.5;
|
|
4317
4433
|
var MIN_V1_SCRIPT_SIMILARITY = 0.8;
|
|
@@ -4492,12 +4608,15 @@ async function applyNarrationTiming(doc, container) {
|
|
|
4492
4608
|
const blocks = retimeBlocks(doc.blocks, ctx);
|
|
4493
4609
|
const duration = Math.max(clip.startAt + playedDuration, ctx.cursor);
|
|
4494
4610
|
const captions = narrationCaptions(doc, clip, timing, timeMap, playedDuration);
|
|
4611
|
+
const currentText = buildNarrationScript(doc).sourceText;
|
|
4612
|
+
const reanchor = reanchorNarrationText(timing.sourceText, currentText);
|
|
4613
|
+
const mapOffset = reanchor ?? ((offset) => offset);
|
|
4495
4614
|
const retimed = {
|
|
4496
4615
|
...doc,
|
|
4497
4616
|
blocks,
|
|
4498
4617
|
duration,
|
|
4499
4618
|
presentationNarration: {
|
|
4500
|
-
sourceText: timing.sourceText,
|
|
4619
|
+
sourceText: reanchor ? currentText : timing.sourceText,
|
|
4501
4620
|
src: clip.src,
|
|
4502
4621
|
startTime: clip.startAt,
|
|
4503
4622
|
duration: playedDuration,
|
|
@@ -4508,11 +4627,13 @@ async function applyNarrationTiming(doc, container) {
|
|
|
4508
4627
|
// A slide shown inside a trimmed span appears where playback resumes.
|
|
4509
4628
|
slides: timing.slides?.flatMap((mark) => {
|
|
4510
4629
|
const time = timeMap ? timeMap.snapSourceToPlayed(mark.time) : mark.time;
|
|
4511
|
-
|
|
4630
|
+
const charOffset = mapOffset(mark.charOffset);
|
|
4631
|
+
return charOffset !== void 0 && time >= 0 && time <= playedDuration ? [{ charOffset, time: clip.startAt + time }] : [];
|
|
4512
4632
|
}),
|
|
4513
4633
|
bookmarks: timing.bookmarks.flatMap((bookmark) => {
|
|
4514
4634
|
const time = timeMap ? timeMap.sourceToPlayed(bookmark.time) : bookmark.time;
|
|
4515
|
-
|
|
4635
|
+
const charOffset = mapOffset(bookmark.charOffset);
|
|
4636
|
+
return charOffset !== void 0 && time !== null && time >= 0 && time <= playedDuration ? [{ ...bookmark, charOffset, time: clip.startAt + time }] : [];
|
|
4516
4637
|
})
|
|
4517
4638
|
},
|
|
4518
4639
|
...captions ? { captions } : {},
|
|
@@ -4541,8 +4662,8 @@ function parseTimingJson(data) {
|
|
|
4541
4662
|
}
|
|
4542
4663
|
}
|
|
4543
4664
|
function normalizeToWords(text) {
|
|
4544
|
-
const
|
|
4545
|
-
return new Set(
|
|
4665
|
+
const words2 = text.toLowerCase().replace(/[^\w\s]/g, " ").split(/\s+/).filter((w) => w.length > 2);
|
|
4666
|
+
return new Set(words2);
|
|
4546
4667
|
}
|
|
4547
4668
|
function scoreTextSimilarity(a, b) {
|
|
4548
4669
|
const wordsA = normalizeToWords(a);
|
|
@@ -1816,7 +1816,7 @@ var documentary_default = {
|
|
|
1816
1816
|
},
|
|
1817
1817
|
typography: {
|
|
1818
1818
|
bodyFont: {
|
|
1819
|
-
stackId: "
|
|
1819
|
+
stackId: "inter"
|
|
1820
1820
|
},
|
|
1821
1821
|
titleFont: {
|
|
1822
1822
|
stackId: "playfair"
|
|
@@ -2100,7 +2100,7 @@ var morning_light_default = {
|
|
|
2100
2100
|
},
|
|
2101
2101
|
typography: {
|
|
2102
2102
|
bodyFont: {
|
|
2103
|
-
stackId: "
|
|
2103
|
+
stackId: "dm-sans"
|
|
2104
2104
|
},
|
|
2105
2105
|
titleFont: {
|
|
2106
2106
|
stackId: "merriweather"
|
|
@@ -2638,7 +2638,7 @@ var warm_earth_default = {
|
|
|
2638
2638
|
warning: "#e53e3e"
|
|
2639
2639
|
},
|
|
2640
2640
|
typography: {
|
|
2641
|
-
bodyFont: { stackId: "
|
|
2641
|
+
bodyFont: { stackId: "dm-sans" },
|
|
2642
2642
|
titleFont: { stackId: "pt-serif" },
|
|
2643
2643
|
captionFont: { stackId: "pt-sans" },
|
|
2644
2644
|
captionCase: "as-written",
|