@openpresentation/opf 0.31.0 → 0.32.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/README.md +1 -1
- package/dist/browser.js +18 -18
- package/dist/{chart-data-Ci9s_NDN.d.ts → chart-data-oIZQlFGi.d.ts} +4 -2
- package/dist/{chunk-UKWNHK62.js → chunk-2E6CDYL2.js} +23 -6
- package/dist/{chunk-HRKV43GC.js → chunk-BBVW5ZC2.js} +3 -3
- package/dist/{chunk-7UO6H32I.js → chunk-CLRYHWQN.js} +162 -22
- package/dist/chunk-DGS47ONG.js +1 -0
- package/dist/{chunk-F5QC7E2O.js → chunk-F7DN33UL.js} +28 -8
- package/dist/{chunk-KELC4K62.js → chunk-HKUV7NEN.js} +1 -1
- package/dist/{chunk-XG4JKFZ6.js → chunk-IT7FQKED.js} +6 -6
- package/dist/{chunk-SYCHWS7C.js → chunk-J63CIRIV.js} +4 -4
- package/dist/{chunk-5Q4IYLMW.js → chunk-LEF4X4KI.js} +274 -33
- package/dist/{chunk-5OMZW44K.js → chunk-NEJ32O7X.js} +1 -1
- package/dist/chunk-NVAJASOD.js +14764 -0
- package/dist/{chunk-XSCZZWYI.js → chunk-ONVFUVQ5.js} +99 -15
- package/dist/{chunk-M7YZU3DX.js → chunk-OXLA4HXQ.js} +615 -58
- package/dist/{chunk-P5E3FNYO.js → chunk-PB7ME64J.js} +1 -1
- package/dist/{chunk-ARFAQNOH.js → chunk-SW676APJ.js} +2 -2
- package/dist/{chunk-I6G32TB5.js → chunk-SZFO3MAJ.js} +5 -5
- package/dist/{chunk-W7KPMUJF.js → chunk-XFHXQCXL.js} +58 -5
- package/dist/{chunk-KOCXV7H3.js → chunk-XQO2CT6Q.js} +2 -2
- package/dist/{chunk-WHDOOLIO.js → chunk-YFJIIIOL.js} +3 -3
- package/dist/composition-Ds6WHyO7.d.ts +5620 -0
- package/dist/composition.d.ts +2 -2
- package/dist/composition.js +1 -1
- package/dist/conversion-5FUDQPED.js +24 -0
- package/dist/{conversion-Bh-skyMc.d.ts → conversion-CdzrTxib.d.ts} +56 -9
- package/dist/convert.d.ts +2 -2
- package/dist/convert.js +7 -7
- package/dist/data.d.ts +2 -2
- package/dist/data.js +2 -2
- package/dist/{deck-report-DQMsvyBI.d.ts → deck-report-CKDNQ2t4.d.ts} +2 -2
- package/dist/deck.d.ts +5 -5
- package/dist/deck.js +11 -11
- package/dist/diagram-engine-eager.js +6 -0
- package/dist/diagram-engine-lazy.js +2 -0
- package/dist/diff.js +4 -4
- package/dist/docs.js +25 -19
- package/dist/examples.js +4759 -995
- package/dist/format.js +2 -2
- package/dist/ids.js +4 -4
- package/dist/index.d.ts +15 -12
- package/dist/index.js +23 -22
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.js +8 -8
- package/dist/node-engine.d.ts +6 -6
- package/dist/node-engine.js +20 -20
- package/dist/{pagination-DyAKYpXu.d.ts → pagination-DRZ_JNFY.d.ts} +74 -4
- package/dist/pagination.d.ts +3 -3
- package/dist/pagination.js +4 -4
- package/dist/patch.js +3 -3
- package/dist/precompiled.js +2 -2
- package/dist/{presentation-8jLSTFqL.d.ts → presentation-DnD7mfmf.d.ts} +106 -27
- package/dist/repo-readme.js +1 -1
- package/dist/schema-engine-ajv.js +1 -1
- package/dist/schema-engine-precompiled.js +2 -2
- package/dist/schema.js +3 -3
- package/dist/schemas.d.ts +6 -0
- package/dist/schemas.js +1 -1
- package/dist/source.d.ts +4 -3
- package/dist/source.js +10 -10
- package/dist/spec/schemas/layout.schema.json +58 -8
- package/dist/spec/schemas/narrative.schema.json +2 -1
- package/dist/spec/schemas/opf.schema.json +122 -23
- package/dist/spec/schemas/theme.schema.json +9 -3
- package/dist/types.d.ts +69 -18
- package/dist/{validation-types-mNmfcY9A.d.ts → validation-types-DxyYPebs.d.ts} +1 -1
- package/dist/validator.d.ts +4 -4
- package/dist/validator.js +3 -3
- package/dist/yaml.d.ts +2 -2
- package/dist/yaml.js +7 -7
- package/package.json +15 -6
- package/dist/chunk-W3SEWSO5.js +0 -8043
- package/dist/chunk-ZROVYWGU.js +0 -1
- package/dist/composition-C-hd_Ci3.d.ts +0 -3207
- package/dist/conversion-7OPM5MMJ.js +0 -24
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defaultCatalogs } from './chunk-AQEAZDL2.js';
|
|
2
|
-
import { localAssetSources, OPFApiError, parseSlideSelection, OPFExportError, asApiError, OPFImportError } from './chunk-
|
|
3
|
-
import { paginate } from './chunk-
|
|
4
|
-
import { deckFormatOf, readDeckReport, stringify } from './chunk-
|
|
5
|
-
import { validate, OPFValidationError } from './chunk-
|
|
2
|
+
import { localAssetSources, OPFApiError, parseSlideSelection, OPFExportError, asApiError, OPFImportError } from './chunk-SZFO3MAJ.js';
|
|
3
|
+
import { paginate, continueOverfull } from './chunk-CLRYHWQN.js';
|
|
4
|
+
import { deckFormatOf, readDeckReport, stringify } from './chunk-J63CIRIV.js';
|
|
5
|
+
import { validate, OPFValidationError } from './chunk-OXLA4HXQ.js';
|
|
6
6
|
import { link, stat, readdir, lstat, readFile, open, unlink, mkdir, rename } from 'fs/promises';
|
|
7
7
|
import path6 from 'path';
|
|
8
8
|
import { readFileSync, statSync, realpathSync } from 'fs';
|
|
@@ -87,6 +87,12 @@ function createImageResolver(root, reporter, passDirectory = "pass --asset-dir")
|
|
|
87
87
|
if ("problem" in outcome && outcome.problem === "blocked") reporter.add("cli", { code: "asset-blocked", path: context.path, message: `Image "${shown(source)}" was not read: ${outcome.reason}` });
|
|
88
88
|
return null;
|
|
89
89
|
},
|
|
90
|
+
/** LH-145: the same data URI as `forSvg` for `measurePictures`, without reporting a file that cannot be read (the draw does). */
|
|
91
|
+
forMeasure: (source) => {
|
|
92
|
+
if (!source) return null;
|
|
93
|
+
const outcome = read(source);
|
|
94
|
+
return "image" in outcome ? `data:${outcome.image.mediaType};base64,${Buffer.from(outcome.image.bytes).toString("base64")}` : null;
|
|
95
|
+
},
|
|
90
96
|
/** opf-pptx: bytes and media type; null for URLs and references it handles itself. An unreadable local file throws asset-unresolved: opf-pptx before 0.24.1 stops the export, 0.24.1 and later leave the image out with a warning. */
|
|
91
97
|
forPptx: (source, context) => {
|
|
92
98
|
const outcome = read(source);
|
|
@@ -117,7 +123,7 @@ function localAssetProblems(deck, root) {
|
|
|
117
123
|
}
|
|
118
124
|
var RENDER_PACKAGE = "@openpresentation/opf-render";
|
|
119
125
|
var PPTX_PACKAGE = "@openpresentation/opf-pptx";
|
|
120
|
-
var PEER_RANGES = { [RENDER_PACKAGE]: "^0.
|
|
126
|
+
var PEER_RANGES = { [RENDER_PACKAGE]: "^0.32.1", [PPTX_PACKAGE]: "^0.32.1" };
|
|
121
127
|
var PPTX_TEXT_OPTIONS_FROM = "0.22.0";
|
|
122
128
|
var numbers = (version) => version.replace(/[-+].*$/, "").split(".").map((part) => Number.parseInt(part, 10) || 0);
|
|
123
129
|
function atLeast(version, minimum) {
|
|
@@ -129,6 +135,9 @@ function requirePptxOptions(pptx, options, flags = false) {
|
|
|
129
135
|
const asked = [options.bodyText === "native" ? flags ? "--body-text native" : 'bodyText: "native"' : void 0, options.slideNumbers ? flags ? "--slide-numbers" : "slideNumbers" : void 0].filter(Boolean);
|
|
130
136
|
if (asked.length && pptx.version !== "unknown" && !atLeast(pptx.version, PPTX_TEXT_OPTIONS_FROM))
|
|
131
137
|
throw new OPFApiError(`${asked.join(" and ")} needs ${pptx.name}@${PPTX_TEXT_OPTIONS_FROM} or later; ${pptx.version} is installed and would ignore it.`, "peer-too-old", { details: { package: pptx.name } });
|
|
138
|
+
const newer = [options.typefaces === "safe" ? flags ? "--typefaces safe" : 'typefaces: "safe"' : void 0, options.as === "images" ? flags ? "--as images" : 'as: "images"' : void 0].filter(Boolean);
|
|
139
|
+
if (newer.length && typeof pptx.module?.typefacesNotOfficeSafe !== "function")
|
|
140
|
+
throw new OPFApiError(`${newer.join(" and ")} needs a newer ${pptx.name}; ${pptx.version} is installed and would ignore it.`, "peer-too-old", { details: { package: pptx.name } });
|
|
132
141
|
}
|
|
133
142
|
var RENDER_EXTRAS = {
|
|
134
143
|
/** The faces of the office pack, which the CLI and `convert` always load (every format). */
|
|
@@ -451,15 +460,20 @@ var INFO = /* @__PURE__ */ new Set([
|
|
|
451
460
|
"font-substituted",
|
|
452
461
|
"pdf-font-embedded",
|
|
453
462
|
"pdf-font-fallback",
|
|
454
|
-
"
|
|
463
|
+
"export-lossy",
|
|
464
|
+
"typeface-not-office-safe",
|
|
465
|
+
"typeface-replaced",
|
|
455
466
|
"svg-sanitized",
|
|
456
467
|
"script-font-unavailable",
|
|
457
|
-
"media-provenance-omitted"
|
|
468
|
+
"media-provenance-omitted",
|
|
469
|
+
"picture-not-measured"
|
|
458
470
|
]);
|
|
459
471
|
var HELP = {
|
|
460
472
|
"text-overflow": "Shorten the text, or split the slide: add --paginate (measured with the same fonts) or run opf paginate.",
|
|
461
473
|
"small-cell": "Give the table more room or fewer columns, or run opf paginate.",
|
|
474
|
+
"slide-continued": "To keep one slide, shorten or remove blocks or choose a layout with more room. opf paginate writes the split into the deck; --keep-slides (paginate: false) draws the slide as written, overlapping.",
|
|
462
475
|
"unresolved-asset": "Embed the image as a data URI, or keep the file inside the deck folder (see --asset-dir). URLs are never fetched.",
|
|
476
|
+
"picture-not-measured": "Check that the picture is a PNG, JPEG, GIF, WebP or SVG, and that the optional sharp peer is installed (npm install sharp). Until then the scrim under text on it is sized for any picture from black to white, which always reads.",
|
|
463
477
|
"asset-blocked": "Move the file under the deck folder or pass --asset-dir <directory> that contains it.",
|
|
464
478
|
"script-font-not-installed": "Install the Noto script package named in the message next to the CLI, then run the command again.",
|
|
465
479
|
"font-glyph-fallback": "The chosen font lacks these characters; a bundled font draws them. Supply a font with --fonts to change that.",
|
|
@@ -472,6 +486,9 @@ var HELP = {
|
|
|
472
486
|
"date-needs-value": "Pass --date YYYY-MM-DD. The CLI never reads a clock, so output stays reproducible.",
|
|
473
487
|
"font-unavailable": "Pass --fonts with the font files, or choose a font the bundled pack covers (opf catalog fontSchemes).",
|
|
474
488
|
"missing-glyph": "Install the script font package named by script-font-not-installed, or supply a covering font with --fonts.",
|
|
489
|
+
"export-lossy": "The PowerPoint file draws this with its nearest native form (see feature and the message). Change the content if the difference matters, or export with --as images for an exact picture.",
|
|
490
|
+
"typeface-not-office-safe": 'Export with --typefaces safe (typefaces: "safe") to write Office-safe families and lay the text out with them, or install the fonts on the machines that open the file.',
|
|
491
|
+
"typeface-replaced": "Drop --typefaces safe to keep the selected families in the file.",
|
|
475
492
|
"duplicate-font-face": "A --fonts face repeats a bundled family, weight and style; remove it or rename the family."
|
|
476
493
|
};
|
|
477
494
|
var Reporter = class {
|
|
@@ -627,15 +644,19 @@ function resolveExportOptions(options) {
|
|
|
627
644
|
const format = oneOf("format", options.format, EXPORT_FORMATS);
|
|
628
645
|
if (!format) throw invalid("An export needs options.format: svg, png, pdf or pptx.");
|
|
629
646
|
if (options.raster !== void 0 && typeof options.raster !== "boolean") throw invalid("raster must be true or false.");
|
|
647
|
+
if (options.paginate !== void 0 && typeof options.paginate !== "boolean" && options.paginate !== "blocks") throw invalid('paginate must be true, false or "blocks".');
|
|
630
648
|
const charts = oneOf("charts", options.charts, ["auto", "native", "picture"]);
|
|
631
649
|
const provenance = oneOf("provenance", options.provenance, ["full", "references-only", "none"]);
|
|
632
650
|
const images = oneOf("images", options.images, ["compatible", "preserve"]);
|
|
633
651
|
const bodyText = oneOf("bodyText", options.bodyText, ["measured", "native"]);
|
|
634
652
|
const slideNumbers = oneOf("slideNumbers", options.slideNumbers, ["static", "live"]);
|
|
635
653
|
const text = oneOf("text", options.text, EXPORT_TEXT);
|
|
654
|
+
const typefaces = oneOf("typefaces", options.typefaces, ["selected", "safe"]);
|
|
655
|
+
const as = oneOf("as", options.as, ["native", "images"]);
|
|
636
656
|
if (options.raster && format !== "pdf") throw invalid("raster applies to format pdf.");
|
|
637
|
-
if ((charts !== void 0 || provenance !== void 0 || images !== void 0 || bodyText !== void 0 || slideNumbers !== void 0) && format !== "pptx") throw invalid("charts, provenance, images, bodyText and
|
|
638
|
-
if (
|
|
657
|
+
if ((charts !== void 0 || provenance !== void 0 || images !== void 0 || bodyText !== void 0 || slideNumbers !== void 0 || typefaces !== void 0 || as !== void 0) && format !== "pptx") throw invalid("charts, provenance, images, bodyText, slideNumbers, typefaces and as apply to format pptx.");
|
|
658
|
+
if (as === "images" && (charts !== void 0 || provenance !== void 0 || images !== void 0 || bodyText !== void 0 || slideNumbers !== void 0 || typefaces !== void 0)) throw invalid('charts, provenance, images, bodyText, slideNumbers and typefaces do not apply to as: "images", where each slide is one picture.');
|
|
659
|
+
if (options.scale !== void 0 && format !== "png" && format !== "pdf" && !(format === "pptx" && as === "images")) throw invalid('scale applies to format png (and raster pdf, and pptx with as: "images").');
|
|
639
660
|
if (options.includeHidden && format === "pptx") throw invalid("includeHidden applies to per-slide image and PDF output; the PPTX keeps a hidden slide as a hidden slide.");
|
|
640
661
|
if (options.slides !== void 0 && format === "pptx") throw invalid("slides is not available for pptx: the whole presentation is exported.");
|
|
641
662
|
if (text !== void 0 && format !== "svg") throw invalid("text applies to format svg.");
|
|
@@ -646,7 +667,7 @@ function resolveExportOptions(options) {
|
|
|
646
667
|
const { fonts, ...rest } = options;
|
|
647
668
|
if (fonts !== void 0 && typeof fonts !== "string" && !isHandle(fonts) && !(Array.isArray(fonts) && fonts.every((folder) => typeof folder === "string"))) throw invalid("fonts must be a fonts handle (loadFonts() of @openpresentation/opf-render/fonts-node), a folder of font files or a list of folders.");
|
|
648
669
|
const folders = typeof fonts === "string" ? [fonts] : Array.isArray(fonts) ? [...fonts] : [];
|
|
649
|
-
return { ...rest, format, text: text ?? "fonts", scale, ...isHandle(fonts) ? { fonts } : {}, fontFolders: folders };
|
|
670
|
+
return { ...rest, format, text: text ?? "fonts", scale, ...as === "images" ? { pictureScale: options.scale === void 0 ? 2 : scale } : {}, ...isHandle(fonts) ? { fonts } : {}, fontFolders: folders };
|
|
650
671
|
}
|
|
651
672
|
function assetRoot(directory, flags = false) {
|
|
652
673
|
if (directory === void 0) return void 0;
|
|
@@ -696,7 +717,8 @@ async function drawWith(presentation, handle, options, ctx, environment) {
|
|
|
696
717
|
...handle.registry?.scriptSelection ? { scripts: handle.registry.scriptSelection } : {}
|
|
697
718
|
});
|
|
698
719
|
let pagination;
|
|
699
|
-
|
|
720
|
+
let continued;
|
|
721
|
+
if (options.paginate === true) {
|
|
700
722
|
try {
|
|
701
723
|
const result = paginate(deck, { fonts: handle, catalogs });
|
|
702
724
|
deck = result.presentation;
|
|
@@ -705,7 +727,34 @@ async function drawWith(presentation, handle, options, ctx, environment) {
|
|
|
705
727
|
reportThrown(reporter, "render", error);
|
|
706
728
|
return { files: [], fonts: fontSummary(), skippedHidden: [], failure: failureOf(error) };
|
|
707
729
|
}
|
|
730
|
+
} else if (options.paginate !== false) {
|
|
731
|
+
const source = format === "pptx" ? "pptx" : "render";
|
|
732
|
+
try {
|
|
733
|
+
const result = continueOverfull(deck, { fonts: handle, catalogs, ...date ? { date } : {} });
|
|
734
|
+
if (result.continued.length) {
|
|
735
|
+
deck = result.presentation;
|
|
736
|
+
continued = result.continued.map((entry) => ({ slide: entry.sourceSlideIndex + 1, slides: entry.slideIndices.map((index) => index + 1), kind: entry.kind, blocks: entry.blocks.map((page) => page.length), units: entry.units }));
|
|
737
|
+
for (const entry of continued) {
|
|
738
|
+
const units = entry.units.reduce((sum, count) => sum + count, 0);
|
|
739
|
+
const blocks = entry.blocks.reduce((sum, count) => sum + count, 0);
|
|
740
|
+
const held = blocks === units ? `${units} ${entry.kind} blocks` : `${units} ${entry.kind} blocks with the ${blocks - units} blocks that follow them`;
|
|
741
|
+
reporter.add(source, {
|
|
742
|
+
code: "slide-continued",
|
|
743
|
+
path: `slides.${entry.slide - 1}`,
|
|
744
|
+
slides: entry.slides,
|
|
745
|
+
kind: entry.kind,
|
|
746
|
+
blocks: entry.blocks,
|
|
747
|
+
units: entry.units,
|
|
748
|
+
message: `Slide ${entry.slide} does not fit at the readability floor, so its ${held} are drawn on ${entry.slides.length} slides (${entry.slides.join(", ")}) with ${entry.units.join(", ")} ${entry.kind} blocks per slide, never splitting one; the deck has ${entry.slides.length - 1} more slide${entry.slides.length === 2 ? "" : "s"}.`
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
} catch (error) {
|
|
753
|
+
reportThrown(reporter, source, error);
|
|
754
|
+
return { files: [], fonts: fontSummary(), skippedHidden: [], failure: failureOf(error) };
|
|
755
|
+
}
|
|
708
756
|
}
|
|
757
|
+
const pictureLuminance = options.measurePictures === false ? void 0 : await measurePictureBackgrounds(renderer, deck, resolver, catalogs, reporter);
|
|
709
758
|
const slideCount = deck.slides?.length ?? 0;
|
|
710
759
|
const isHidden = (number) => deck.slides?.[number - 1]?.hidden === true;
|
|
711
760
|
const everySlide = Array.from({ length: slideCount }, (_, index) => index + 1);
|
|
@@ -716,11 +765,16 @@ async function drawWith(presentation, handle, options, ctx, environment) {
|
|
|
716
765
|
if (format !== "pptx" && !selected.length)
|
|
717
766
|
throw new OPFApiError(skippedHidden.length ? ctx.flags ? "Every slide is hidden. Use --include-hidden to write them, or --slides to name slides." : "Every slide is hidden. Use includeHidden to write them, or slides to name slides." : "The presentation has no slides.", skippedHidden.length ? "all-slides-hidden" : "no-slides");
|
|
718
767
|
const stem = deckStem(options.name === void 0 ? deck : { filename: options.name }, "-");
|
|
719
|
-
const run = (extra) => ({ fonts: fontSummary(), ...pagination ? { pagination } : {}, skippedHidden, ...extra });
|
|
768
|
+
const run = (extra) => ({ fonts: fontSummary(), ...pagination ? { pagination } : {}, ...continued ? { continued } : {}, skippedHidden, ...extra });
|
|
720
769
|
try {
|
|
721
770
|
if (format === "pptx") {
|
|
722
771
|
requirePptxOptions(pptx, options, ctx.flags);
|
|
723
772
|
const module = pptx.module;
|
|
773
|
+
const pictures = options.as === "images";
|
|
774
|
+
const slideRasterizer = async (picture, slide, size) => {
|
|
775
|
+
const svg = renderer.render.module.toSvg(picture, slide, { fonts: { textMeasurement: handle.textMeasurement, embeddedFonts: [] }, imageResolver: resolver.forSvg, onDiagnostic: (diagnostic) => reporter.add("render", diagnostic), catalogs, ...pictureLuminance ? { pictureLuminance } : {}, ...date ? { date } : {} });
|
|
776
|
+
return new Uint8Array(await renderer.render.module.toPng(svg, { fonts: handle, scale: size.scale }));
|
|
777
|
+
};
|
|
724
778
|
const bytes = await module.toPptx(deck, {
|
|
725
779
|
fonts: handle,
|
|
726
780
|
imageResolver: resolver.forPptx,
|
|
@@ -729,14 +783,29 @@ async function drawWith(presentation, handle, options, ctx, environment) {
|
|
|
729
783
|
svgRasterizer: async (svg, size) => new Uint8Array(await renderer.render.module.toPng(svg, { scale: size.scale, background: "rgba(0, 0, 0, 0)", fonts: size.text ? handle : NO_FONTS })),
|
|
730
784
|
onDiagnostic: (diagnostic) => reporter.add("pptx", diagnostic),
|
|
731
785
|
catalogs,
|
|
786
|
+
...pictureLuminance ? { pictureLuminance } : {},
|
|
732
787
|
// opf-pptx still names its option `chartex` and its picture choice `fallback`.
|
|
733
788
|
...options.charts ? { chartex: options.charts === "picture" ? "fallback" : options.charts } : {},
|
|
734
789
|
...options.provenance ? { provenance: options.provenance === "none" ? false : options.provenance } : {},
|
|
735
790
|
...options.images ? { imageFormat: options.images } : {},
|
|
736
791
|
...options.bodyText ? { bodyText: options.bodyText } : {},
|
|
737
792
|
...options.slideNumbers ? { slideNumberFields: options.slideNumbers } : {},
|
|
793
|
+
...options.typefaces ? { typefaces: options.typefaces } : {},
|
|
794
|
+
...pictures ? { as: "images", scale: options.pictureScale, slideRasterizer } : {},
|
|
738
795
|
...date ? { date } : {}
|
|
739
796
|
});
|
|
797
|
+
const unsafe = pictures || options.typefaces === "safe" || typeof module.typefacesNotOfficeSafe !== "function" ? [] : module.typefacesNotOfficeSafe(bytes);
|
|
798
|
+
if (unsafe.length)
|
|
799
|
+
reporter.add(
|
|
800
|
+
"pptx",
|
|
801
|
+
{
|
|
802
|
+
code: "typeface-not-office-safe",
|
|
803
|
+
path: "",
|
|
804
|
+
families: unsafe,
|
|
805
|
+
message: `The PPTX names ${unsafe.join(", ")}, which ${unsafe.length === 1 ? "is" : "are"} not on every Windows and macOS machine or not measured exactly by OPF. A viewer without ${unsafe.length === 1 ? "it" : "them"} substitutes another font, and lines can break differently from the preview.`
|
|
806
|
+
},
|
|
807
|
+
"info"
|
|
808
|
+
);
|
|
740
809
|
return run({ files: [{ name: `${stem}.pptx`, type: MEDIA2.pptx, bytes }], skippedHidden: [] });
|
|
741
810
|
}
|
|
742
811
|
const embedded = format === "svg" ? embeddedFor(handle, options.text) : [];
|
|
@@ -746,6 +815,7 @@ async function drawWith(presentation, handle, options, ctx, environment) {
|
|
|
746
815
|
imageResolver: resolver.forSvg,
|
|
747
816
|
onDiagnostic: (diagnostic) => reporter.add("render", diagnostic),
|
|
748
817
|
catalogs,
|
|
818
|
+
...pictureLuminance ? { pictureLuminance } : {},
|
|
749
819
|
...date ? { date } : {}
|
|
750
820
|
};
|
|
751
821
|
const svgs = [];
|
|
@@ -787,6 +857,17 @@ async function drawWith(presentation, handle, options, ctx, environment) {
|
|
|
787
857
|
return { files: [], fonts: fontSummary(), ...pagination ? { pagination } : {}, skippedHidden: [], failure: failureOf(error) };
|
|
788
858
|
}
|
|
789
859
|
}
|
|
860
|
+
async function measurePictureBackgrounds(renderer, deck, resolver, catalogs, reporter) {
|
|
861
|
+
const measure = renderer.render.module.measurePictures;
|
|
862
|
+
if (typeof measure !== "function") return void 0;
|
|
863
|
+
try {
|
|
864
|
+
const sampler = await measure.call(renderer.render.module, deck, { imageResolver: resolver.forMeasure, catalogs, onDiagnostic: (diagnostic) => reporter.add("render", diagnostic, "info") });
|
|
865
|
+
return sampler.measured ? sampler : void 0;
|
|
866
|
+
} catch (error) {
|
|
867
|
+
reporter.add("render", { code: "picture-not-measured", path: "", message: `The pictures could not be measured, so every scrim is sized for any picture: ${error instanceof Error ? error.message : String(error)}` }, "info");
|
|
868
|
+
return void 0;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
790
871
|
var failureOf = (error) => {
|
|
791
872
|
const failure = error;
|
|
792
873
|
return { code: typeof failure?.code === "string" ? failure.code : "failed", message: failure?.message ?? String(error) };
|
|
@@ -844,6 +925,7 @@ async function runPreparedExport(prepared, presentation, checked) {
|
|
|
844
925
|
fonts: run.fonts,
|
|
845
926
|
skippedHidden: run.skippedHidden,
|
|
846
927
|
...run.pagination ? { pagination: run.pagination } : {},
|
|
928
|
+
...run.continued ? { continued: run.continued } : {},
|
|
847
929
|
...run.pdf ? { pdf: run.pdf } : {},
|
|
848
930
|
...VERSIONS(renderer, pptx)
|
|
849
931
|
};
|
|
@@ -915,7 +997,7 @@ function targetOf(output, options, flags) {
|
|
|
915
997
|
checkOutputPattern(output, exported === "png" || exported === "svg");
|
|
916
998
|
return exported ? { kind: "export", format: exported, zip: false } : { kind: "deck", format: deck };
|
|
917
999
|
}
|
|
918
|
-
var EXPORT_ONLY = ["slides", "includeHidden", "paginate", "scale", "raster", "text", "charts", "provenance", "images", "bodyText", "slideNumbers", "date", "fonts", "assetDir"];
|
|
1000
|
+
var EXPORT_ONLY = ["slides", "includeHidden", "paginate", "scale", "raster", "text", "charts", "provenance", "images", "bodyText", "slideNumbers", "typefaces", "as", "date", "fonts", "assetDir"];
|
|
919
1001
|
var given = (value) => value !== void 0 && value !== false && !(Array.isArray(value) && value.length === 0);
|
|
920
1002
|
function checkApplicable(source, target, options, flags) {
|
|
921
1003
|
const name = (key) => flags ? `--${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}` : key;
|
|
@@ -928,8 +1010,10 @@ function checkApplicable(source, target, options, flags) {
|
|
|
928
1010
|
}
|
|
929
1011
|
const format = target.format;
|
|
930
1012
|
if (given(options.raster) && format !== "pdf") throw invalid2(`${name("raster")} applies to pdf output.`);
|
|
931
|
-
|
|
932
|
-
if (options.
|
|
1013
|
+
const pptxOnly = ["charts", "provenance", "images", "bodyText", "slideNumbers", "typefaces"].filter((key) => options[key] !== void 0);
|
|
1014
|
+
if ((pptxOnly.length || options.as !== void 0) && format !== "pptx") throw invalid2(`${names("charts", "provenance", "images", "bodyText", "slideNumbers", "typefaces", "as")} apply to pptx output.`);
|
|
1015
|
+
if (options.as === "images" && pptxOnly.length) throw invalid2(`${names(...pptxOnly)} ${pptxOnly.length === 1 ? "does" : "do"} not apply to ${flags ? "--as images" : 'as: "images"'}, where each slide is one picture.`);
|
|
1016
|
+
if (options.scale !== void 0 && format !== "png" && format !== "pdf" && !(format === "pptx" && options.as === "images")) throw invalid2(`${name("scale")} applies to png output (and raster pdf, and pptx ${flags ? "--as images" : 'with as: "images"'}).`);
|
|
933
1017
|
if (given(options.includeHidden) && format === "pptx") throw invalid2(`${name("includeHidden")} applies to per-slide image and PDF output; the PPTX keeps a hidden slide as a hidden slide.`);
|
|
934
1018
|
if (options.slides !== void 0 && format === "pptx") throw invalid2(`${name("slides")} is not available for pptx output: the whole presentation is exported.`);
|
|
935
1019
|
if (options.text !== void 0 && format !== "svg") throw invalid2(`${name("text")} applies to svg output.`);
|