@bendyline/squisq 1.0.1 → 1.1.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.
- package/dist/ContentContainer-DNx460y8.d.ts +88 -0
- package/dist/{Doc-1hmT1LZl.d.ts → Doc-Cvt2lyzn.d.ts} +56 -4
- package/dist/MediaProvider-wpSe21B3.d.ts +66 -0
- package/dist/__tests__/contentContainer.test.d.ts +2 -0
- package/dist/__tests__/contentContainer.test.d.ts.map +1 -0
- package/dist/__tests__/contentContainer.test.js +234 -0
- package/dist/__tests__/contentContainer.test.js.map +1 -0
- package/dist/__tests__/markdownToDoc.test.js +75 -0
- package/dist/__tests__/markdownToDoc.test.js.map +1 -1
- package/dist/{chunk-PJ7AODIM.js → chunk-3WBJAZZ5.js} +394 -52
- package/dist/chunk-3WBJAZZ5.js.map +1 -0
- package/dist/chunk-4CRBS35L.js +292 -0
- package/dist/chunk-4CRBS35L.js.map +1 -0
- package/dist/{chunk-6YJPI6VI.js → chunk-4X3JQXNM.js} +1 -1
- package/dist/{chunk-S4F2RY37.js → chunk-CORGFIFU.js} +1 -1
- package/dist/chunk-CORGFIFU.js.map +1 -0
- package/dist/chunk-DNJKBAI7.js +1 -0
- package/dist/chunk-DNJKBAI7.js.map +1 -0
- package/dist/{chunk-VP5SZTZ2.js → chunk-MIBRIRGJ.js} +2 -139
- package/dist/chunk-MIBRIRGJ.js.map +1 -0
- package/dist/{chunk-URU6QMLY.js → chunk-NJLL5XYC.js} +15 -8
- package/dist/chunk-NJLL5XYC.js.map +1 -0
- package/dist/chunk-OFU53HI7.js +165 -0
- package/dist/chunk-OFU53HI7.js.map +1 -0
- package/dist/chunk-TSG2OSE6.js +145 -0
- package/dist/chunk-TSG2OSE6.js.map +1 -0
- package/dist/{chunk-O5HCIUAD.js → chunk-TVPKD76V.js} +81 -187
- package/dist/chunk-TVPKD76V.js.map +1 -0
- package/dist/contentExtractor-BNfVJV2U.d.ts +113 -0
- package/dist/doc/audioMapping.d.ts +36 -0
- package/dist/doc/audioMapping.d.ts.map +1 -0
- package/dist/doc/audioMapping.js +279 -0
- package/dist/doc/audioMapping.js.map +1 -0
- package/dist/doc/index.d.ts +1 -0
- package/dist/doc/index.d.ts.map +1 -1
- package/dist/doc/index.js +1 -0
- package/dist/doc/index.js.map +1 -1
- package/dist/doc/markdownToDoc.d.ts.map +1 -1
- package/dist/doc/markdownToDoc.js +126 -1
- package/dist/doc/markdownToDoc.js.map +1 -1
- package/dist/doc/templates/comparisonBar.d.ts.map +1 -1
- package/dist/doc/templates/comparisonBar.js +23 -5
- package/dist/doc/templates/comparisonBar.js.map +1 -1
- package/dist/doc/templates/coverBlock.d.ts.map +1 -1
- package/dist/doc/templates/coverBlock.js +3 -0
- package/dist/doc/templates/coverBlock.js.map +1 -1
- package/dist/doc/templates/dateEvent.d.ts.map +1 -1
- package/dist/doc/templates/dateEvent.js +4 -0
- package/dist/doc/templates/dateEvent.js.map +1 -1
- package/dist/doc/templates/definitionCard.d.ts.map +1 -1
- package/dist/doc/templates/definitionCard.js +4 -1
- package/dist/doc/templates/definitionCard.js.map +1 -1
- package/dist/doc/templates/factCard.d.ts.map +1 -1
- package/dist/doc/templates/factCard.js +4 -0
- package/dist/doc/templates/factCard.js.map +1 -1
- package/dist/doc/templates/fullBleedQuote.d.ts.map +1 -1
- package/dist/doc/templates/fullBleedQuote.js +2 -1
- package/dist/doc/templates/fullBleedQuote.js.map +1 -1
- package/dist/doc/templates/imageWithCaption.d.ts.map +1 -1
- package/dist/doc/templates/imageWithCaption.js +4 -0
- package/dist/doc/templates/imageWithCaption.js.map +1 -1
- package/dist/doc/templates/listBlock.d.ts.map +1 -1
- package/dist/doc/templates/listBlock.js +3 -0
- package/dist/doc/templates/listBlock.js.map +1 -1
- package/dist/doc/templates/mapBlock.d.ts.map +1 -1
- package/dist/doc/templates/mapBlock.js +3 -0
- package/dist/doc/templates/mapBlock.js.map +1 -1
- package/dist/doc/templates/photoGrid.d.ts.map +1 -1
- package/dist/doc/templates/photoGrid.js +3 -0
- package/dist/doc/templates/photoGrid.js.map +1 -1
- package/dist/doc/templates/pullQuote.d.ts.map +1 -1
- package/dist/doc/templates/pullQuote.js +4 -0
- package/dist/doc/templates/pullQuote.js.map +1 -1
- package/dist/doc/templates/quoteBlock.d.ts.map +1 -1
- package/dist/doc/templates/quoteBlock.js +4 -0
- package/dist/doc/templates/quoteBlock.js.map +1 -1
- package/dist/doc/templates/sectionHeader.d.ts.map +1 -1
- package/dist/doc/templates/sectionHeader.js +3 -2
- package/dist/doc/templates/sectionHeader.js.map +1 -1
- package/dist/doc/templates/statHighlight.d.ts.map +1 -1
- package/dist/doc/templates/statHighlight.js +4 -1
- package/dist/doc/templates/statHighlight.js.map +1 -1
- package/dist/doc/templates/titleBlock.d.ts.map +1 -1
- package/dist/doc/templates/titleBlock.js +3 -0
- package/dist/doc/templates/titleBlock.js.map +1 -1
- package/dist/doc/templates/twoColumn.d.ts.map +1 -1
- package/dist/doc/templates/twoColumn.js +7 -1
- package/dist/doc/templates/twoColumn.js.map +1 -1
- package/dist/doc/templates/videoPullQuote.d.ts.map +1 -1
- package/dist/doc/templates/videoPullQuote.js +4 -0
- package/dist/doc/templates/videoPullQuote.js.map +1 -1
- package/dist/doc/templates/videoWithCaption.d.ts.map +1 -1
- package/dist/doc/templates/videoWithCaption.js +3 -0
- package/dist/doc/templates/videoWithCaption.js.map +1 -1
- package/dist/doc/utils/themeUtils.d.ts +9 -0
- package/dist/doc/utils/themeUtils.d.ts.map +1 -1
- package/dist/doc/utils/themeUtils.js +26 -0
- package/dist/doc/utils/themeUtils.js.map +1 -1
- package/dist/markdown/convert.d.ts.map +1 -1
- package/dist/markdown/convert.js +16 -7
- package/dist/markdown/convert.js.map +1 -1
- package/dist/markdown/types.d.ts +4 -2
- package/dist/markdown/types.d.ts.map +1 -1
- package/dist/schemas/BlockTemplates.d.ts +2 -2
- package/dist/schemas/BlockTemplates.d.ts.map +1 -1
- package/dist/schemas/BlockTemplates.js +2 -2
- package/dist/schemas/BlockTemplates.js.map +1 -1
- package/dist/schemas/Doc.d.ts +52 -0
- package/dist/schemas/Doc.d.ts.map +1 -1
- package/dist/schemas/Doc.js.map +1 -1
- package/dist/schemas/themeLibrary.d.ts +2 -2
- package/dist/schemas/themeLibrary.d.ts.map +1 -1
- package/dist/schemas/themeLibrary.js +91 -26
- package/dist/schemas/themeLibrary.js.map +1 -1
- package/dist/storage/ContentContainer.d.ts +87 -0
- package/dist/storage/ContentContainer.d.ts.map +1 -0
- package/dist/storage/ContentContainer.js +122 -0
- package/dist/storage/ContentContainer.js.map +1 -0
- package/dist/storage/MediaProviderFromContainer.d.ts +21 -0
- package/dist/storage/MediaProviderFromContainer.d.ts.map +1 -0
- package/dist/storage/MediaProviderFromContainer.js +79 -0
- package/dist/storage/MediaProviderFromContainer.js.map +1 -0
- package/dist/storage/index.d.ts +3 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/story/index.d.ts +50 -5
- package/dist/story/index.js +15 -5
- package/dist/{themeLibrary-DR1VRo-8.d.ts → themeLibrary-VOHfPzRB.d.ts} +3 -3
- package/dist/transform/applyTransform.d.ts +22 -0
- package/dist/transform/applyTransform.d.ts.map +1 -0
- package/dist/transform/applyTransform.js +68 -0
- package/dist/transform/applyTransform.js.map +1 -0
- package/dist/transform/blockAnalyzer.d.ts +48 -0
- package/dist/transform/blockAnalyzer.d.ts.map +1 -0
- package/dist/transform/blockAnalyzer.js +135 -0
- package/dist/transform/blockAnalyzer.js.map +1 -0
- package/dist/transform/index.d.ts +6 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +4 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/registry.d.ts +19 -0
- package/dist/transform/registry.d.ts.map +1 -0
- package/dist/transform/registry.js +41 -0
- package/dist/transform/registry.js.map +1 -0
- package/dist/transform/styles/dataDriven.d.ts +4 -0
- package/dist/transform/styles/dataDriven.d.ts.map +1 -0
- package/dist/transform/styles/dataDriven.js +15 -0
- package/dist/transform/styles/dataDriven.js.map +1 -0
- package/dist/transform/styles/documentary.d.ts +4 -0
- package/dist/transform/styles/documentary.d.ts.map +1 -0
- package/dist/transform/styles/documentary.js +15 -0
- package/dist/transform/styles/documentary.js.map +1 -0
- package/dist/transform/styles/index.d.ts +6 -0
- package/dist/transform/styles/index.d.ts.map +1 -0
- package/dist/transform/styles/index.js +6 -0
- package/dist/transform/styles/index.js.map +1 -0
- package/dist/transform/styles/magazine.d.ts +4 -0
- package/dist/transform/styles/magazine.d.ts.map +1 -0
- package/dist/transform/styles/magazine.js +15 -0
- package/dist/transform/styles/magazine.js.map +1 -0
- package/dist/transform/styles/minimal.d.ts +4 -0
- package/dist/transform/styles/minimal.d.ts.map +1 -0
- package/dist/transform/styles/minimal.js +15 -0
- package/dist/transform/styles/minimal.js.map +1 -0
- package/dist/transform/styles/narrative.d.ts +4 -0
- package/dist/transform/styles/narrative.d.ts.map +1 -0
- package/dist/transform/styles/narrative.js +15 -0
- package/dist/transform/styles/narrative.js.map +1 -0
- package/dist/transform/templateSelector.d.ts +30 -0
- package/dist/transform/templateSelector.d.ts.map +1 -0
- package/dist/transform/templateSelector.js +218 -0
- package/dist/transform/templateSelector.js.map +1 -0
- package/dist/transform/timingAllocator.d.ts +21 -0
- package/dist/transform/timingAllocator.d.ts.map +1 -0
- package/dist/transform/timingAllocator.js +111 -0
- package/dist/transform/timingAllocator.js.map +1 -0
- package/dist/transform/types.d.ts +86 -0
- package/dist/transform/types.d.ts.map +1 -0
- package/dist/transform/types.js +9 -0
- package/dist/transform/types.js.map +1 -0
- package/dist/{types-DHiv_Pnm.d.ts → types-DYAzisMG.d.ts} +4 -2
- package/package.json +6 -1
- package/src/__tests__/contentContainer.test.ts +282 -0
- package/src/__tests__/markdownToDoc.test.ts +96 -0
- package/src/doc/audioMapping.ts +346 -0
- package/src/doc/index.ts +1 -0
- package/src/doc/markdownToDoc.ts +136 -2
- package/src/doc/templates/comparisonBar.ts +23 -5
- package/src/doc/templates/coverBlock.ts +3 -0
- package/src/doc/templates/dateEvent.ts +4 -0
- package/src/doc/templates/definitionCard.ts +4 -1
- package/src/doc/templates/factCard.ts +4 -0
- package/src/doc/templates/fullBleedQuote.ts +2 -1
- package/src/doc/templates/imageWithCaption.ts +4 -0
- package/src/doc/templates/listBlock.ts +3 -0
- package/src/doc/templates/mapBlock.ts +3 -0
- package/src/doc/templates/photoGrid.ts +3 -0
- package/src/doc/templates/pullQuote.ts +4 -0
- package/src/doc/templates/quoteBlock.ts +4 -0
- package/src/doc/templates/sectionHeader.ts +3 -2
- package/src/doc/templates/statHighlight.ts +4 -1
- package/src/doc/templates/titleBlock.ts +3 -0
- package/src/doc/templates/twoColumn.ts +7 -1
- package/src/doc/templates/videoPullQuote.ts +4 -0
- package/src/doc/templates/videoWithCaption.ts +3 -0
- package/src/doc/utils/themeUtils.ts +29 -0
- package/src/markdown/convert.ts +17 -7
- package/src/markdown/types.ts +4 -2
- package/src/schemas/BlockTemplates.ts +2 -2
- package/src/schemas/Doc.ts +60 -0
- package/src/schemas/themeLibrary.ts +95 -26
- package/src/storage/ContentContainer.ts +200 -0
- package/src/storage/MediaProviderFromContainer.ts +92 -0
- package/src/storage/index.ts +3 -0
- package/src/transform/applyTransform.ts +83 -0
- package/src/transform/blockAnalyzer.ts +181 -0
- package/src/transform/index.ts +20 -0
- package/src/transform/registry.ts +47 -0
- package/src/transform/styles/dataDriven.ts +16 -0
- package/src/transform/styles/documentary.ts +16 -0
- package/src/transform/styles/index.ts +5 -0
- package/src/transform/styles/magazine.ts +16 -0
- package/src/transform/styles/minimal.ts +16 -0
- package/src/transform/styles/narrative.ts +16 -0
- package/src/transform/templateSelector.ts +294 -0
- package/src/transform/timingAllocator.ts +126 -0
- package/src/transform/types.ts +105 -0
- package/dist/chunk-O5HCIUAD.js.map +0 -1
- package/dist/chunk-PJ7AODIM.js.map +0 -1
- package/dist/chunk-S4F2RY37.js.map +0 -1
- package/dist/chunk-URU6QMLY.js.map +0 -1
- package/dist/chunk-VJN7UB2Z.js +0 -145
- package/dist/chunk-VJN7UB2Z.js.map +0 -1
- package/dist/chunk-VP5SZTZ2.js.map +0 -1
- /package/dist/{chunk-6YJPI6VI.js.map → chunk-4X3JQXNM.js.map} +0 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Analyzer
|
|
3
|
+
*
|
|
4
|
+
* Walks Doc blocks, extracts plain text from their markdown contents,
|
|
5
|
+
* and runs the content extractor on each block to identify stats, dates,
|
|
6
|
+
* quotes, etc. that can be promoted to visual template blocks.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Block } from '../schemas/Doc.js';
|
|
10
|
+
import type { MarkdownBlockNode, MarkdownNode } from '../markdown/types.js';
|
|
11
|
+
import type { ExtractedElement, ExtractionOptions } from '../generate/contentExtractor.js';
|
|
12
|
+
import type { TransformImage } from './types.js';
|
|
13
|
+
import { extractContent, stripMarkdown } from '../generate/contentExtractor.js';
|
|
14
|
+
import { extractPlainText, getChildren } from '../markdown/utils.js';
|
|
15
|
+
|
|
16
|
+
/** An image found in a block's markdown contents. */
|
|
17
|
+
export interface BlockImage {
|
|
18
|
+
/** Image URL (relative or absolute). */
|
|
19
|
+
src: string;
|
|
20
|
+
/** Alt text. */
|
|
21
|
+
alt: string;
|
|
22
|
+
/** Index of the source block in the analyzed array. */
|
|
23
|
+
sourceBlockIndex: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A block enriched with extraction analysis. */
|
|
27
|
+
export interface AnalyzedBlock {
|
|
28
|
+
/** The original block. */
|
|
29
|
+
block: Block;
|
|
30
|
+
/** Plain text extracted from the block's contents. */
|
|
31
|
+
plainText: string;
|
|
32
|
+
/** Content extractions found in the block's text. */
|
|
33
|
+
extractions: ExtractedElement[];
|
|
34
|
+
/** Whether this block has child blocks. */
|
|
35
|
+
hasChildren: boolean;
|
|
36
|
+
/** Word count of the block's body text. */
|
|
37
|
+
bodyWordCount: number;
|
|
38
|
+
/** Images found in this block's markdown contents. */
|
|
39
|
+
images: BlockImage[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Extract plain text from an array of MarkdownBlockNodes.
|
|
44
|
+
*/
|
|
45
|
+
function contentsToPlainText(contents: MarkdownBlockNode[]): string {
|
|
46
|
+
return contents.map((node) => extractPlainText(node)).join('\n');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Recursively walk a markdown node tree and collect all images.
|
|
51
|
+
*/
|
|
52
|
+
function collectImages(node: MarkdownNode): Array<{ src: string; alt: string }> {
|
|
53
|
+
const results: Array<{ src: string; alt: string }> = [];
|
|
54
|
+
|
|
55
|
+
if ('type' in node && node.type === 'image' && 'url' in node) {
|
|
56
|
+
const img = node as { url: string; alt?: string };
|
|
57
|
+
if (img.url) {
|
|
58
|
+
results.push({ src: img.url, alt: img.alt ?? '' });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
for (const child of getChildren(node)) {
|
|
63
|
+
results.push(...collectImages(child));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return results;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Extract images from a block's markdown contents.
|
|
71
|
+
*/
|
|
72
|
+
function extractBlockImages(block: Block, blockIndex: number): BlockImage[] {
|
|
73
|
+
if (!block.contents || block.contents.length === 0) return [];
|
|
74
|
+
|
|
75
|
+
const images: BlockImage[] = [];
|
|
76
|
+
for (const node of block.contents) {
|
|
77
|
+
for (const img of collectImages(node)) {
|
|
78
|
+
images.push({ ...img, sourceBlockIndex: blockIndex });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return images;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Collect all unique images from all blocks in a Doc.
|
|
86
|
+
* Returns them as TransformImages for use in the transform pipeline.
|
|
87
|
+
*/
|
|
88
|
+
export function extractDocImages(blocks: Block[]): TransformImage[] {
|
|
89
|
+
const seen = new Set<string>();
|
|
90
|
+
const images: TransformImage[] = [];
|
|
91
|
+
|
|
92
|
+
function walk(blockList: Block[]): void {
|
|
93
|
+
for (const block of blockList) {
|
|
94
|
+
if (block.contents) {
|
|
95
|
+
for (const node of block.contents) {
|
|
96
|
+
for (const img of collectImages(node)) {
|
|
97
|
+
if (!seen.has(img.src)) {
|
|
98
|
+
seen.add(img.src);
|
|
99
|
+
images.push({ src: img.src, alt: img.alt });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (block.children) {
|
|
105
|
+
walk(block.children);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
walk(blocks);
|
|
111
|
+
return images;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Collect leaf blocks from a nested block tree.
|
|
116
|
+
* Only returns blocks that have their own `contents` but no children,
|
|
117
|
+
* preventing parent blocks from duplicating text that also appears
|
|
118
|
+
* in their children. Parent-only blocks (with a title but no body
|
|
119
|
+
* content) are included as structural placeholders.
|
|
120
|
+
*/
|
|
121
|
+
function collectLeafBlocks(blocks: Block[]): Block[] {
|
|
122
|
+
const result: Block[] = [];
|
|
123
|
+
for (const block of blocks) {
|
|
124
|
+
if (block.children && block.children.length > 0) {
|
|
125
|
+
// Parent block — only include it as a structural marker
|
|
126
|
+
// (title only, no body extraction) if it has no contents of its own.
|
|
127
|
+
// Then recurse into children for the actual content.
|
|
128
|
+
if (!block.contents || block.contents.length === 0) {
|
|
129
|
+
result.push(block);
|
|
130
|
+
}
|
|
131
|
+
result.push(...collectLeafBlocks(block.children));
|
|
132
|
+
} else {
|
|
133
|
+
// Leaf block — include for content analysis
|
|
134
|
+
result.push(block);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Analyze all blocks in a Doc, extracting text and running content extraction.
|
|
142
|
+
*
|
|
143
|
+
* @param blocks - The Doc's block array (may be nested via children).
|
|
144
|
+
* @param options - Extraction options (minConfidence, types filter).
|
|
145
|
+
* @returns Analyzed blocks with extractions, in flattened order.
|
|
146
|
+
*/
|
|
147
|
+
export function analyzeBlocks(blocks: Block[], options?: ExtractionOptions): AnalyzedBlock[] {
|
|
148
|
+
const flat = collectLeafBlocks(blocks);
|
|
149
|
+
const results: AnalyzedBlock[] = [];
|
|
150
|
+
|
|
151
|
+
for (const block of flat) {
|
|
152
|
+
let plainText = '';
|
|
153
|
+
|
|
154
|
+
if (block.contents && block.contents.length > 0) {
|
|
155
|
+
plainText = contentsToPlainText(block.contents);
|
|
156
|
+
} else if (block.title) {
|
|
157
|
+
plainText = block.title;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Strip any remaining markdown syntax
|
|
161
|
+
const stripped = stripMarkdown(plainText);
|
|
162
|
+
const bodyWordCount = stripped.split(/\s+/).filter((w) => w.length > 0).length;
|
|
163
|
+
|
|
164
|
+
// Run content extraction
|
|
165
|
+
const extraction = extractContent(stripped, options);
|
|
166
|
+
|
|
167
|
+
// Extract images from markdown contents
|
|
168
|
+
const images = extractBlockImages(block, results.length);
|
|
169
|
+
|
|
170
|
+
results.push({
|
|
171
|
+
block,
|
|
172
|
+
plainText: stripped,
|
|
173
|
+
extractions: extraction.elements,
|
|
174
|
+
hasChildren: !!(block.children && block.children.length > 0),
|
|
175
|
+
bodyWordCount,
|
|
176
|
+
images,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return results;
|
|
181
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { applyTransform } from './applyTransform.js';
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
resolveTransformStyle,
|
|
5
|
+
getTransformStyleIds,
|
|
6
|
+
getTransformStyleSummaries,
|
|
7
|
+
DEFAULT_TRANSFORM_STYLE_ID,
|
|
8
|
+
} from './registry.js';
|
|
9
|
+
|
|
10
|
+
export type {
|
|
11
|
+
TransformStyleId,
|
|
12
|
+
TransformStyleSummary,
|
|
13
|
+
TransformStyleConfig,
|
|
14
|
+
TransformImage,
|
|
15
|
+
TransformOptions,
|
|
16
|
+
TransformResult,
|
|
17
|
+
} from './types.js';
|
|
18
|
+
|
|
19
|
+
export type { AnalyzedBlock, BlockImage } from './blockAnalyzer.js';
|
|
20
|
+
export { analyzeBlocks, extractDocImages } from './blockAnalyzer.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform Style Registry
|
|
3
|
+
*
|
|
4
|
+
* Central registry of built-in transform styles. Follows the same pattern
|
|
5
|
+
* as themeLibrary.ts — a record of configs with lookup/summary helpers.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { TransformStyleConfig, TransformStyleSummary } from './types.js';
|
|
9
|
+
import { documentaryStyle } from './styles/documentary.js';
|
|
10
|
+
import { magazineStyle } from './styles/magazine.js';
|
|
11
|
+
import { dataDrivenStyle } from './styles/dataDriven.js';
|
|
12
|
+
import { narrativeStyle } from './styles/narrative.js';
|
|
13
|
+
import { minimalStyle } from './styles/minimal.js';
|
|
14
|
+
|
|
15
|
+
/** All registered transform styles, keyed by id. */
|
|
16
|
+
const TRANSFORM_STYLES: Record<string, TransformStyleConfig> = {
|
|
17
|
+
[documentaryStyle.id]: documentaryStyle,
|
|
18
|
+
[magazineStyle.id]: magazineStyle,
|
|
19
|
+
[dataDrivenStyle.id]: dataDrivenStyle,
|
|
20
|
+
[narrativeStyle.id]: narrativeStyle,
|
|
21
|
+
[minimalStyle.id]: minimalStyle,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** Default style used when no id is provided. */
|
|
25
|
+
export const DEFAULT_TRANSFORM_STYLE_ID = 'documentary';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Resolve a transform style by id.
|
|
29
|
+
* Returns the default style if the id is not found.
|
|
30
|
+
*/
|
|
31
|
+
export function resolveTransformStyle(id: string): TransformStyleConfig {
|
|
32
|
+
return TRANSFORM_STYLES[id] ?? TRANSFORM_STYLES[DEFAULT_TRANSFORM_STYLE_ID];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Get all registered style ids. */
|
|
36
|
+
export function getTransformStyleIds(): string[] {
|
|
37
|
+
return Object.keys(TRANSFORM_STYLES);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Get summary info for all styles (for UI dropdowns). */
|
|
41
|
+
export function getTransformStyleSummaries(): TransformStyleSummary[] {
|
|
42
|
+
return Object.values(TRANSFORM_STYLES).map(({ id, name, description }) => ({
|
|
43
|
+
id,
|
|
44
|
+
name,
|
|
45
|
+
description,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TransformStyleConfig } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/** Numbers-forward — aggressively extracts stats, comparisons, and dates. */
|
|
4
|
+
export const dataDrivenStyle: TransformStyleConfig = {
|
|
5
|
+
id: 'data-driven',
|
|
6
|
+
name: 'Data-Driven',
|
|
7
|
+
description: 'Aggressively highlights statistics, comparisons, and timelines',
|
|
8
|
+
minConfidence: 0.3,
|
|
9
|
+
transformRatio: 0.8,
|
|
10
|
+
preferredTypes: ['stat', 'comparison', 'date', 'list', 'fact'],
|
|
11
|
+
colorSchemes: ['blue', 'orange', 'green', 'purple', 'red'],
|
|
12
|
+
insertSectionHeaders: true,
|
|
13
|
+
interleaveImages: false,
|
|
14
|
+
blocksPerSection: { min: 2, max: 6 },
|
|
15
|
+
transitionStyle: 'cut',
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TransformStyleConfig } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/** Conservative style — sparse highlights, preserves most text as-is. */
|
|
4
|
+
export const documentaryStyle: TransformStyleConfig = {
|
|
5
|
+
id: 'documentary',
|
|
6
|
+
name: 'Documentary',
|
|
7
|
+
description: 'Conservative — highlights only the strongest stats, dates, and quotes',
|
|
8
|
+
minConfidence: 0.5,
|
|
9
|
+
transformRatio: 0.3,
|
|
10
|
+
preferredTypes: ['stat', 'date', 'quote', 'fact'],
|
|
11
|
+
colorSchemes: ['blue', 'green', 'purple'],
|
|
12
|
+
insertSectionHeaders: false,
|
|
13
|
+
interleaveImages: true,
|
|
14
|
+
blocksPerSection: { min: 1, max: 3 },
|
|
15
|
+
transitionStyle: 'fade',
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TransformStyleConfig } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/** Visual variety — pull quotes, definitions, image-heavy layout. */
|
|
4
|
+
export const magazineStyle: TransformStyleConfig = {
|
|
5
|
+
id: 'magazine',
|
|
6
|
+
name: 'Magazine',
|
|
7
|
+
description: 'Visual variety with pull quotes, facts, and rich image layouts',
|
|
8
|
+
minConfidence: 0.4,
|
|
9
|
+
transformRatio: 0.6,
|
|
10
|
+
preferredTypes: ['quote', 'fact', 'list', 'definition', 'stat', 'impactLine'],
|
|
11
|
+
colorSchemes: ['blue', 'green', 'purple', 'orange', 'red'],
|
|
12
|
+
insertSectionHeaders: true,
|
|
13
|
+
interleaveImages: true,
|
|
14
|
+
blocksPerSection: { min: 2, max: 5 },
|
|
15
|
+
transitionStyle: 'dissolve',
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TransformStyleConfig } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/** Light touch — only the highest-confidence items get transformed. */
|
|
4
|
+
export const minimalStyle: TransformStyleConfig = {
|
|
5
|
+
id: 'minimal',
|
|
6
|
+
name: 'Minimal',
|
|
7
|
+
description: 'Light touch — only the strongest highlights, mostly text',
|
|
8
|
+
minConfidence: 0.6,
|
|
9
|
+
transformRatio: 0.2,
|
|
10
|
+
preferredTypes: ['stat', 'quote'],
|
|
11
|
+
colorSchemes: ['blue', 'green'],
|
|
12
|
+
insertSectionHeaders: false,
|
|
13
|
+
interleaveImages: false,
|
|
14
|
+
blocksPerSection: { min: 1, max: 2 },
|
|
15
|
+
transitionStyle: 'fade',
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TransformStyleConfig } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/** Timeline-focused — emphasizes dates, quotes, and story arc. */
|
|
4
|
+
export const narrativeStyle: TransformStyleConfig = {
|
|
5
|
+
id: 'narrative',
|
|
6
|
+
name: 'Narrative',
|
|
7
|
+
description: 'Story-driven with timeline events, quotes, and impact moments',
|
|
8
|
+
minConfidence: 0.4,
|
|
9
|
+
transformRatio: 0.5,
|
|
10
|
+
preferredTypes: ['date', 'quote', 'impactLine', 'fact', 'stat'],
|
|
11
|
+
colorSchemes: ['blue', 'purple', 'green'],
|
|
12
|
+
insertSectionHeaders: true,
|
|
13
|
+
interleaveImages: true,
|
|
14
|
+
blocksPerSection: { min: 1, max: 4 },
|
|
15
|
+
transitionStyle: 'fade',
|
|
16
|
+
};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Selector
|
|
3
|
+
*
|
|
4
|
+
* Selects which extracted elements to promote to visual template blocks
|
|
5
|
+
* and handles color scheme rotation, image interleaving, and template
|
|
6
|
+
* variety. Ported and generalized from qualla-internal's TemplateSelector.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Block } from '../schemas/Doc.js';
|
|
10
|
+
import type {
|
|
11
|
+
TemplateBlock,
|
|
12
|
+
AccentImage,
|
|
13
|
+
AccentPosition,
|
|
14
|
+
ImageWithCaptionInput,
|
|
15
|
+
SectionHeaderInput,
|
|
16
|
+
} from '../schemas/BlockTemplates.js';
|
|
17
|
+
import type { ExtractedElement } from '../generate/contentExtractor.js';
|
|
18
|
+
import type { TransformStyleConfig, TransformImage } from './types.js';
|
|
19
|
+
import type { AnalyzedBlock } from './blockAnalyzer.js';
|
|
20
|
+
import { mapElementToBlock } from '../generate/templateMapper.js';
|
|
21
|
+
import { SeededRandom } from '../random/SeededRandom.js';
|
|
22
|
+
|
|
23
|
+
/** Accent positions to rotate through. */
|
|
24
|
+
const ACCENT_POSITIONS: AccentPosition[] = [
|
|
25
|
+
'left-strip',
|
|
26
|
+
'right-strip',
|
|
27
|
+
'bottom-strip',
|
|
28
|
+
'corner-inset',
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
/** Ambient motions to rotate on image blocks. */
|
|
32
|
+
const AMBIENT_MOTIONS: Array<'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight'> = [
|
|
33
|
+
'zoomIn',
|
|
34
|
+
'zoomOut',
|
|
35
|
+
'panLeft',
|
|
36
|
+
'panRight',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/** A selected element paired with its source block. */
|
|
40
|
+
interface SelectedExtraction {
|
|
41
|
+
element: ExtractedElement;
|
|
42
|
+
sourceBlock: Block;
|
|
43
|
+
/** Index in the original analyzed blocks array. */
|
|
44
|
+
sourceIndex: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Result of template selection. */
|
|
48
|
+
export interface SelectionResult {
|
|
49
|
+
/** Replacement blocks: a mix of original blocks and new template blocks. */
|
|
50
|
+
blocks: Array<Block | TemplateBlock>;
|
|
51
|
+
/** How many blocks were transformed. */
|
|
52
|
+
transformedCount: number;
|
|
53
|
+
/** How many blocks were inserted (images, section headers). */
|
|
54
|
+
insertedCount: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Select extractions and build a transformed block sequence.
|
|
59
|
+
*
|
|
60
|
+
* @param analyzed - Analyzed blocks from blockAnalyzer.
|
|
61
|
+
* @param config - The transform style configuration.
|
|
62
|
+
* @param images - Available images for interleaving.
|
|
63
|
+
* @param seed - Random seed for deterministic output.
|
|
64
|
+
*/
|
|
65
|
+
export function selectAndBuild(
|
|
66
|
+
analyzed: AnalyzedBlock[],
|
|
67
|
+
config: TransformStyleConfig,
|
|
68
|
+
images: TransformImage[],
|
|
69
|
+
seed: number,
|
|
70
|
+
): SelectionResult {
|
|
71
|
+
const rng = new SeededRandom(seed);
|
|
72
|
+
|
|
73
|
+
// 1. Collect all extractions across all blocks, filtered by config
|
|
74
|
+
const candidates = collectCandidates(analyzed, config);
|
|
75
|
+
|
|
76
|
+
// 2. Determine how many blocks to transform
|
|
77
|
+
const maxTransforms = Math.max(1, Math.floor(analyzed.length * config.transformRatio));
|
|
78
|
+
const selected = candidates.slice(0, maxTransforms);
|
|
79
|
+
|
|
80
|
+
// 3. Build the output block sequence
|
|
81
|
+
const result = buildBlockSequence(analyzed, selected, config, images, rng);
|
|
82
|
+
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Collect candidate extractions from all analyzed blocks, sorted by
|
|
88
|
+
* a combined score of confidence and type preference.
|
|
89
|
+
*/
|
|
90
|
+
function collectCandidates(
|
|
91
|
+
analyzed: AnalyzedBlock[],
|
|
92
|
+
config: TransformStyleConfig,
|
|
93
|
+
): SelectedExtraction[] {
|
|
94
|
+
const candidates: SelectedExtraction[] = [];
|
|
95
|
+
|
|
96
|
+
for (let i = 0; i < analyzed.length; i++) {
|
|
97
|
+
const ab = analyzed[i];
|
|
98
|
+
// Skip blocks with no meaningful text
|
|
99
|
+
if (ab.bodyWordCount < 5) continue;
|
|
100
|
+
|
|
101
|
+
for (const element of ab.extractions) {
|
|
102
|
+
if (element.confidence < config.minConfidence) continue;
|
|
103
|
+
|
|
104
|
+
candidates.push({
|
|
105
|
+
element,
|
|
106
|
+
sourceBlock: ab.block,
|
|
107
|
+
sourceIndex: i,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Sort by: preferred type rank (lower = better), then confidence (higher = better)
|
|
113
|
+
const typeRank = new Map(config.preferredTypes.map((t, i) => [t, i]));
|
|
114
|
+
const maxRank = config.preferredTypes.length;
|
|
115
|
+
|
|
116
|
+
candidates.sort((a, b) => {
|
|
117
|
+
const rankA = typeRank.get(a.element.type) ?? maxRank;
|
|
118
|
+
const rankB = typeRank.get(b.element.type) ?? maxRank;
|
|
119
|
+
if (rankA !== rankB) return rankA - rankB;
|
|
120
|
+
return b.element.confidence - a.element.confidence;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Deduplicate: if the same extracted text appears multiple times
|
|
124
|
+
// (e.g., from overlapping parent/child blocks), keep only the
|
|
125
|
+
// highest-ranked occurrence.
|
|
126
|
+
const seenTexts = new Set<string>();
|
|
127
|
+
const deduplicated: SelectedExtraction[] = [];
|
|
128
|
+
for (const candidate of candidates) {
|
|
129
|
+
const key = candidate.element.text.trim().toLowerCase();
|
|
130
|
+
if (seenTexts.has(key)) continue;
|
|
131
|
+
seenTexts.add(key);
|
|
132
|
+
deduplicated.push(candidate);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return deduplicated;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Build the output block sequence, replacing source blocks with template
|
|
140
|
+
* blocks where extractions were selected, and interleaving images.
|
|
141
|
+
*/
|
|
142
|
+
function buildBlockSequence(
|
|
143
|
+
analyzed: AnalyzedBlock[],
|
|
144
|
+
selected: SelectedExtraction[],
|
|
145
|
+
config: TransformStyleConfig,
|
|
146
|
+
images: TransformImage[],
|
|
147
|
+
rng: SeededRandom,
|
|
148
|
+
): SelectionResult {
|
|
149
|
+
// Map: sourceIndex → list of selected extractions for that block
|
|
150
|
+
const blockExtractions = new Map<number, SelectedExtraction[]>();
|
|
151
|
+
for (const sel of selected) {
|
|
152
|
+
const list = blockExtractions.get(sel.sourceIndex) ?? [];
|
|
153
|
+
list.push(sel);
|
|
154
|
+
blockExtractions.set(sel.sourceIndex, list);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Limit extractions per block: cap at blocksPerSection.max and ensure
|
|
158
|
+
// template type variety within each block (no two same-type extractions).
|
|
159
|
+
for (const [idx, list] of blockExtractions) {
|
|
160
|
+
const diverse: SelectedExtraction[] = [];
|
|
161
|
+
const usedTypes = new Set<string>();
|
|
162
|
+
for (const sel of list) {
|
|
163
|
+
if (usedTypes.has(sel.element.type)) continue;
|
|
164
|
+
usedTypes.add(sel.element.type);
|
|
165
|
+
diverse.push(sel);
|
|
166
|
+
if (diverse.length >= config.blocksPerSection.max) break;
|
|
167
|
+
}
|
|
168
|
+
blockExtractions.set(idx, diverse);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const blocks: Array<Block | TemplateBlock> = [];
|
|
172
|
+
let transformedCount = 0;
|
|
173
|
+
let insertedCount = 0;
|
|
174
|
+
let colorIndex = 0;
|
|
175
|
+
let blockIdCounter = 0;
|
|
176
|
+
let imageIndex = 0;
|
|
177
|
+
let accentPositionIndex = 0;
|
|
178
|
+
let elementsSinceImage = 0;
|
|
179
|
+
let prevTemplateType = '';
|
|
180
|
+
|
|
181
|
+
// Calculate image interleaving interval
|
|
182
|
+
const totalTransformed = Array.from(blockExtractions.values()).reduce(
|
|
183
|
+
(sum, list) => sum + list.length,
|
|
184
|
+
0,
|
|
185
|
+
);
|
|
186
|
+
const imageInterval =
|
|
187
|
+
config.interleaveImages && images.length > 0 && totalTransformed > 0
|
|
188
|
+
? Math.max(2, Math.floor(totalTransformed / (images.length + 1)))
|
|
189
|
+
: Infinity;
|
|
190
|
+
|
|
191
|
+
for (let i = 0; i < analyzed.length; i++) {
|
|
192
|
+
const ab = analyzed[i];
|
|
193
|
+
const extractions = blockExtractions.get(i);
|
|
194
|
+
|
|
195
|
+
if (!extractions || extractions.length === 0) {
|
|
196
|
+
// Keep the original block unchanged
|
|
197
|
+
blocks.push(ab.block);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Insert section header before a group of transformed blocks (if enabled)
|
|
202
|
+
if (config.insertSectionHeaders && ab.block.title) {
|
|
203
|
+
const headerBlock: SectionHeaderInput = {
|
|
204
|
+
template: 'sectionHeader',
|
|
205
|
+
id: `transform-header-${blockIdCounter++}`,
|
|
206
|
+
duration: ab.block.duration > 0 ? Math.min(3, ab.block.duration * 0.2) : 3,
|
|
207
|
+
audioSegment: ab.block.audioSegment,
|
|
208
|
+
title: ab.block.title,
|
|
209
|
+
colorScheme: config.colorSchemes[colorIndex % config.colorSchemes.length],
|
|
210
|
+
};
|
|
211
|
+
blocks.push(headerBlock);
|
|
212
|
+
insertedCount++;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Convert each selected extraction to a template block.
|
|
216
|
+
// Track the last template used globally (not just within this block)
|
|
217
|
+
// to avoid consecutive same-template slides across the entire output.
|
|
218
|
+
for (const sel of extractions) {
|
|
219
|
+
const colorScheme = config.colorSchemes[colorIndex % config.colorSchemes.length];
|
|
220
|
+
|
|
221
|
+
// Build accent image if we have images in the pool
|
|
222
|
+
let accentImage: AccentImage | undefined;
|
|
223
|
+
if (images.length > 0 && config.interleaveImages) {
|
|
224
|
+
const img = images[imageIndex % images.length];
|
|
225
|
+
accentImage = {
|
|
226
|
+
src: img.src,
|
|
227
|
+
alt: img.alt ?? '',
|
|
228
|
+
position: ACCENT_POSITIONS[accentPositionIndex % ACCENT_POSITIONS.length],
|
|
229
|
+
ambientMotion: rng.pick(AMBIENT_MOTIONS) ?? 'zoomIn',
|
|
230
|
+
credit: img.credit,
|
|
231
|
+
license: img.license,
|
|
232
|
+
};
|
|
233
|
+
accentPositionIndex++;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const templateBlock = mapElementToBlock(sel.element, {
|
|
237
|
+
id: `transform-${blockIdCounter++}`,
|
|
238
|
+
duration: ab.block.duration > 0 ? ab.block.duration / extractions.length : 6,
|
|
239
|
+
audioSegment: ab.block.audioSegment,
|
|
240
|
+
colorScheme,
|
|
241
|
+
accentImage,
|
|
242
|
+
sourceStartTime: sel.element.sourcePosition,
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// Apply transition based on style
|
|
246
|
+
if (config.transitionStyle !== 'cut') {
|
|
247
|
+
(
|
|
248
|
+
templateBlock as TemplateBlock & { transition?: { type: string; duration: number } }
|
|
249
|
+
).transition = {
|
|
250
|
+
type:
|
|
251
|
+
config.transitionStyle === 'mixed'
|
|
252
|
+
? (rng.pick(['fade', 'dissolve']) ?? 'fade')
|
|
253
|
+
: config.transitionStyle,
|
|
254
|
+
duration: 0.5,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Avoid consecutive same-template blocks by bumping color for variety
|
|
259
|
+
if (templateBlock.template === prevTemplateType) {
|
|
260
|
+
colorIndex++;
|
|
261
|
+
}
|
|
262
|
+
prevTemplateType = templateBlock.template;
|
|
263
|
+
|
|
264
|
+
blocks.push(templateBlock);
|
|
265
|
+
transformedCount++;
|
|
266
|
+
colorIndex++;
|
|
267
|
+
elementsSinceImage++;
|
|
268
|
+
|
|
269
|
+
// Interleave standalone image at intervals
|
|
270
|
+
if (
|
|
271
|
+
config.interleaveImages &&
|
|
272
|
+
imageIndex < images.length &&
|
|
273
|
+
elementsSinceImage >= imageInterval
|
|
274
|
+
) {
|
|
275
|
+
const img = images[imageIndex];
|
|
276
|
+
const imageBlock: ImageWithCaptionInput = {
|
|
277
|
+
template: 'imageWithCaption',
|
|
278
|
+
id: `transform-img-${blockIdCounter++}`,
|
|
279
|
+
duration: 4,
|
|
280
|
+
audioSegment: ab.block.audioSegment,
|
|
281
|
+
imageSrc: img.src,
|
|
282
|
+
imageAlt: img.alt ?? '',
|
|
283
|
+
ambientMotion: rng.pick(AMBIENT_MOTIONS) ?? 'zoomIn',
|
|
284
|
+
};
|
|
285
|
+
blocks.push(imageBlock);
|
|
286
|
+
imageIndex++;
|
|
287
|
+
insertedCount++;
|
|
288
|
+
elementsSinceImage = 0;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return { blocks, transformedCount, insertedCount };
|
|
294
|
+
}
|