@bendyline/squisq-formats 2.3.2 → 2.3.3
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.
|
@@ -575,9 +575,10 @@ function buildLayerTextShape(layer, shapeId, maxBottom) {
|
|
|
575
575
|
1,
|
|
576
576
|
rawLines.reduce((count, line) => count + Math.max(1, Math.ceil(line.length / charsPerLine)), 0)
|
|
577
577
|
);
|
|
578
|
+
const officeFontMetricSlack = fittedFontSize * 0.8;
|
|
578
579
|
const estimatedHeight = Math.max(
|
|
579
|
-
fittedFontSize * (style.lineHeight ?? 1.4) * wrappedLineCount + padding * 2,
|
|
580
|
-
fittedFontSize
|
|
580
|
+
fittedFontSize * (style.lineHeight ?? 1.4) * wrappedLineCount + officeFontMetricSlack + padding * 2,
|
|
581
|
+
fittedFontSize + officeFontMetricSlack + padding * 2
|
|
581
582
|
);
|
|
582
583
|
const resolvedRect = resolveLayerRect(layer.position, boxWidth, estimatedHeight);
|
|
583
584
|
const safeBottom = Math.min(1060, maxBottom ?? 1060);
|
|
@@ -295,6 +295,7 @@ function pptxImportOptionsFrom(options) {
|
|
|
295
295
|
function defaultFormats() {
|
|
296
296
|
const md = {
|
|
297
297
|
id: "md",
|
|
298
|
+
templateAnnotationHandling: "preserved",
|
|
298
299
|
label: "Markdown",
|
|
299
300
|
mimeType: MIME.md,
|
|
300
301
|
extensions: [".md", ".markdown"],
|
|
@@ -320,6 +321,7 @@ function defaultFormats() {
|
|
|
320
321
|
};
|
|
321
322
|
const docx = {
|
|
322
323
|
id: "docx",
|
|
324
|
+
templateAnnotationHandling: "ignored",
|
|
323
325
|
label: "Word (DOCX)",
|
|
324
326
|
mimeType: MIME.docx,
|
|
325
327
|
extensions: [".docx"],
|
|
@@ -349,6 +351,7 @@ function defaultFormats() {
|
|
|
349
351
|
};
|
|
350
352
|
const pdf = {
|
|
351
353
|
id: "pdf",
|
|
354
|
+
templateAnnotationHandling: "ignored",
|
|
352
355
|
label: "PDF",
|
|
353
356
|
mimeType: MIME.pdf,
|
|
354
357
|
extensions: [".pdf"],
|
|
@@ -380,6 +383,7 @@ function defaultFormats() {
|
|
|
380
383
|
};
|
|
381
384
|
const pptx = {
|
|
382
385
|
id: "pptx",
|
|
386
|
+
templateAnnotationHandling: "rendered",
|
|
383
387
|
label: "PowerPoint (PPTX)",
|
|
384
388
|
mimeType: MIME.pptx,
|
|
385
389
|
extensions: [".pptx"],
|
|
@@ -409,6 +413,7 @@ function defaultFormats() {
|
|
|
409
413
|
};
|
|
410
414
|
const xlsx = {
|
|
411
415
|
id: "xlsx",
|
|
416
|
+
templateAnnotationHandling: "ignored",
|
|
412
417
|
label: "Excel (XLSX)",
|
|
413
418
|
mimeType: MIME.xlsx,
|
|
414
419
|
extensions: [".xlsx"],
|
|
@@ -432,6 +437,7 @@ function defaultFormats() {
|
|
|
432
437
|
};
|
|
433
438
|
const csv = {
|
|
434
439
|
id: "csv",
|
|
440
|
+
templateAnnotationHandling: "ignored",
|
|
435
441
|
label: "CSV",
|
|
436
442
|
mimeType: MIME.csv,
|
|
437
443
|
extensions: [".csv"],
|
|
@@ -456,6 +462,7 @@ function defaultFormats() {
|
|
|
456
462
|
};
|
|
457
463
|
const html = {
|
|
458
464
|
id: "html",
|
|
465
|
+
templateAnnotationHandling: "rendered",
|
|
459
466
|
label: "HTML (single file)",
|
|
460
467
|
mimeType: MIME.html,
|
|
461
468
|
extensions: [".html", ".htm"],
|
|
@@ -485,6 +492,7 @@ function defaultFormats() {
|
|
|
485
492
|
};
|
|
486
493
|
const htmlzip = {
|
|
487
494
|
id: "htmlzip",
|
|
495
|
+
templateAnnotationHandling: "rendered",
|
|
488
496
|
label: "HTML (ZIP archive)",
|
|
489
497
|
mimeType: MIME.zip,
|
|
490
498
|
extensions: [".html.zip"],
|
|
@@ -508,6 +516,7 @@ function defaultFormats() {
|
|
|
508
516
|
};
|
|
509
517
|
const epub = {
|
|
510
518
|
id: "epub",
|
|
519
|
+
templateAnnotationHandling: "ignored",
|
|
511
520
|
label: "EPUB",
|
|
512
521
|
mimeType: MIME.epub,
|
|
513
522
|
extensions: [".epub"],
|
|
@@ -529,6 +538,7 @@ function defaultFormats() {
|
|
|
529
538
|
};
|
|
530
539
|
const dbk = {
|
|
531
540
|
id: "dbk",
|
|
541
|
+
templateAnnotationHandling: "preserved",
|
|
532
542
|
label: "Squisq container (DBK)",
|
|
533
543
|
mimeType: MIME.zip,
|
|
534
544
|
extensions: [".dbk", ".zip"],
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
defaultRegistry,
|
|
12
12
|
prepareConversion,
|
|
13
13
|
resolveConversionLimits
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YLDQWCHS.js";
|
|
15
15
|
import {
|
|
16
16
|
inferThemeFromFile
|
|
17
17
|
} from "./chunk-6S6GU3ZG.js";
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
markdownDocToPptx,
|
|
34
34
|
pptxToDoc,
|
|
35
35
|
pptxToMarkdownDoc
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-C22NYDN2.js";
|
|
37
37
|
import "./chunk-TAAENIRB.js";
|
|
38
38
|
import "./chunk-GX7RAUME.js";
|
|
39
39
|
import {
|
package/dist/pptx/index.js
CHANGED
package/dist/registry/index.d.ts
CHANGED
|
@@ -123,12 +123,21 @@ type PreparedExportOptions = Pick<ConvertOptions, 'signal' | 'title' | 'resolveP
|
|
|
123
123
|
interface PreparedConversion {
|
|
124
124
|
convert(to: FormatId, options?: PreparedExportOptions): Promise<ConversionResult>;
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* How a format's exporter treats Squisq template annotations: `rendered`
|
|
128
|
+
* materializes template visuals into the output, `preserved` keeps annotations
|
|
129
|
+
* intact for round-tripping, and `ignored` flattens blocks to semantic content
|
|
130
|
+
* so annotations have no effect on the exported result.
|
|
131
|
+
*/
|
|
132
|
+
type TemplateAnnotationHandling = 'rendered' | 'preserved' | 'ignored';
|
|
126
133
|
/** Describes how a single format imports to / exports from the squisq model. */
|
|
127
134
|
interface FormatDefinition {
|
|
128
135
|
id: FormatId;
|
|
129
136
|
label: string;
|
|
130
137
|
mimeType: string;
|
|
131
138
|
extensions: readonly string[];
|
|
139
|
+
/** Exporter treatment of template annotations. Absent means unspecified. */
|
|
140
|
+
templateAnnotationHandling?: TemplateAnnotationHandling;
|
|
132
141
|
/** Import raw bytes to a MarkdownDocument. */
|
|
133
142
|
importDoc?(data: ArrayBuffer, options: ConvertOptions): Promise<MarkdownDocument>;
|
|
134
143
|
/** Import raw bytes to a ContentContainer (markdown + extracted media). */
|
package/dist/registry/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq-formats",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Document format converters — DOCX, PDF, OOXML import/export",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"dependencies": {
|
|
108
108
|
"@pdf-lib/upng": "1.0.1",
|
|
109
109
|
"@xmldom/xmldom": "0.9.10",
|
|
110
|
-
"@bendyline/squisq": "2.3.
|
|
110
|
+
"@bendyline/squisq": "2.3.3",
|
|
111
111
|
"jszip": "3.10.1",
|
|
112
112
|
"pdf-lib": "1.17.1",
|
|
113
113
|
"pdfjs-dist": "4.10.38"
|