@openpresentation/opf 0.16.0 → 0.18.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 +16 -2
- package/dist/browser.js +38 -0
- package/dist/{catalog-refs-_anZs-Qz.d.ts → catalog-refs-BSfGELpt.d.ts} +1 -1
- package/dist/{catalog-schemas-BZCjgAxu.d.ts → catalog-schemas-CinPh5WA.d.ts} +1 -1
- package/dist/catalog.d.ts +2 -2
- package/dist/catalog.js +3 -23712
- package/dist/{chunk-BSYQDWT4.js → chunk-64YSJZDH.js} +28 -15
- package/dist/{chunk-WEDGVC5W.js → chunk-6WW2EDUW.js} +108 -108
- package/dist/{chunk-5UEUAW57.js → chunk-CJPDTLGD.js} +1 -1
- package/dist/{chunk-FQSIIADJ.js → chunk-DBYZI75U.js} +30 -5
- package/dist/{chunk-PX5AWL7Y.js → chunk-JT3QXA22.js} +99 -29
- package/dist/{chunk-6OR326EA.js → chunk-JXVS7BJK.js} +1 -1
- package/dist/chunk-KXBZ6ZSB.js +991 -0
- package/dist/{chunk-5PDN7BN6.js → chunk-MBU42S5Y.js} +427 -167
- package/dist/{chunk-K4DQQIT4.js → chunk-NS3VYB57.js} +5 -5
- package/dist/chunk-QLFWWHRF.js +919 -0
- package/dist/{chunk-5TO6I3GB.js → chunk-RAKEVM52.js} +1 -1
- package/dist/{chunk-NAWQR7MN.js → chunk-VCGRMNY2.js} +1 -1
- package/dist/chunk-WCG3THTD.js +23712 -0
- package/dist/{chunk-UM24JFUE.js → chunk-YWXB4XAT.js} +2 -2
- package/dist/{chunk-3XDRQYWZ.js → chunk-YZXTXX2D.js} +1 -1
- package/dist/{chunk-SMLMI6IZ.js → chunk-ZCFSDSUX.js} +3 -3
- package/dist/{chunk-KINQFU6X.js → chunk-ZOHFLP3O.js} +19 -12
- package/dist/{composition-D4ADF5c-.d.ts → composition-C-OoqvAr.d.ts} +227 -167
- package/dist/composition.d.ts +2 -2
- package/dist/composition.js +1 -1
- package/dist/conversion-C5foedh6.d.ts +502 -0
- package/dist/conversion-KGDVJM75.js +21 -0
- package/dist/convert.d.ts +3 -3
- package/dist/convert.js +7 -7
- package/dist/data.d.ts +6 -6
- package/dist/data.js +2 -2
- package/dist/deck-report-wszX7uo8.d.ts +40 -0
- package/dist/deck.d.ts +21 -51
- package/dist/deck.js +10 -10
- package/dist/diff.js +5 -5
- package/dist/docs.js +33 -27
- package/dist/examples.d.ts +1 -1
- package/dist/examples.js +418 -451
- package/dist/format.js +2 -2
- package/dist/index.d.ts +179 -16
- package/dist/index.js +51 -796
- package/dist/markdown.d.ts +10 -6
- package/dist/markdown.js +7 -7
- package/dist/node-engine.d.ts +114 -0
- package/dist/node-engine.js +44 -0
- package/dist/{pagination-DzZPFheM.d.ts → pagination-BaUjDrTz.d.ts} +25 -8
- package/dist/pagination.d.ts +3 -3
- package/dist/pagination.js +4 -4
- package/dist/patch.js +4 -4
- package/dist/{presentation-COrFuj2g.d.ts → presentation-HondgJ3l.d.ts} +278 -454
- package/dist/repo-readme.js +1 -1
- package/dist/schemas.d.ts +4 -2
- package/dist/schemas.js +1 -1
- package/dist/spec/catalogs/manifest.json +1 -1
- package/dist/spec/schemas/opf.schema.json +74 -100
- package/dist/types.d.ts +2 -2
- package/dist/{validation-types-HxIgJfKx.d.ts → validation-types-PbGDrNUr.d.ts} +23 -7
- package/dist/validator.d.ts +6 -6
- package/dist/validator.js +3 -3
- package/dist/yaml.d.ts +4 -4
- package/dist/yaml.js +7 -7
- package/package.json +37 -2
package/dist/composition.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AnnotatedRun,
|
|
2
|
-
export { d as CATALOG_REFERENCE_PATTERN,
|
|
1
|
+
export { A as AnnotatedRun, p as AnnotationFitter, q as AnnotationLayoutOptions, B as BackgroundImageFit, r as CAPTIONABLE_FIELDS, s as CAPTION_FONT_RATIO, t as CAPTION_MAX_RATIO, u as CHART_HIGHLIGHT_MUTED_MIN_CONTRAST, v as CHART_HIGHLIGHT_MUTED_MIX, w as CHART_SERIES_MIN_DIFFERENCE, x as CHART_SERIES_MIN_LIGHTNESS_STEP, a as CHART_TYPES, y as CITATION_MARKER_RAISE, z as CITATION_MARKER_SCALE, D as CODE_HIGHLIGHT_LANGUAGES, G as CODE_HIGHLIGHT_MAX_LENGTH, H as CODE_PANEL_BACKGROUND, I as CODE_PANEL_FOREGROUND, J as CODE_SYNTAX_MIN_CONTRAST, K as Caption, N as CaptionAlignment, O as CaptionObject, P as CaptionPosition, Q as CaptionSettings, U as ChartHighlightMarks, V as ChartLabelContent, W as ChartLabelPosition, X as ChartLegendPosition, Y as ChartOptionDiagnostic, Z as ChartOptionKind, _ as ChartOptionSupport, $ as ChartOptionTarget, a0 as CitationMarker, a1 as CitationNote, a2 as CodeContent, a3 as CodeHighlightBand, a4 as CodeHighlightColors, a5 as CodeHighlightEntry, a6 as CodeHighlightIssue, a7 as CodeHighlightLines, a8 as CodeLayout, a9 as CodeLayoutDiagnostic, aa as CodeLayoutOptions, ab as CodeLineSegment, ac as CodeLineSource, ad as CodeRun, ae as CodeSyntaxPalette, af as CodeSyntaxPaletteOptions, ag as CodeSyntaxPaletteTheme, ah as CodeTextFit, ai as CodeTextPart, aj as CodeToken, ak as CodeTokenKind, C as ComposeSlideOptions, al as ComposedBackgroundImage, am as ComposedCaption, an as ComposedFlow, ao as ComposedFootnoteEntry, ap as ComposedFootnotes, aq as ComposedGroup, ar as ComposedImage, as as ComposedItem, at as ComposedLogo, au as ComposedOverlay, av as ComposedPlacement, aw as ComposedSlot, ax as Composition, ay as CompositionCandidate, az as CompositionDecision, aA as CompositionExplanation, aB as CompositionPenalties, aC as CompositionTrack, aD as DARK_BACKGROUND_LUMINANCE, aE as DEFAULT_CHART_LABEL_SEPARATOR, aF as DEFAULT_FURNITURE_DATE_FORMAT, aG as DESIGN_HINT_KEYS, aH as DeckCitations, aI as DesignHintKey, aJ as DesignHintSource, aK as DesignHints, E as ENGINE_DEFAULT_CHART_TYPES, b as ENGINE_DEFAULT_COLOR_SCHEME, c as ENGINE_DEFAULT_FONT_SCHEME, d as ENGINE_DEFAULT_THEME, aL as FONT_SIZE_GRID_PER_PX, aM as FOOTNOTE_MAX_RATIO, aN as FURNITURE_GAP, aO as FURNITURE_IMAGE_SHARE, aP as FontFaceSelection, e as FontFamilies, F as Fonts, aQ as FootnoteLayoutOptions, aR as FurnitureField, aS as FurnitureImagePart, aT as FurnitureLayout, aU as FurniturePart, aV as FurniturePartBase, aW as FurnitureSocialLink, aX as FurnitureTextExtras, aY as FurnitureTextPart, aZ as ImageEdge, a_ as ImageFit, a$ as ImageFitPlacement, b0 as ImageFocus, b1 as ImageShape, f as LANGUAGES, b2 as LAYOUT_BODY_KINDS, g as LOGO_SHAPES, i as LanguageVocabulary, b3 as LayoutBodyKind, b4 as LayoutBox, b5 as LayoutContent, L as LayoutDiagnostic, b6 as LayoutLeaf, b7 as LayoutSlot, b8 as ListBulletImage, b9 as ListEntryLayout, ba as ListFit, bb as ListFitOptions, bc as ListNumber, bd as ListText, be as ListValue, j as LogoShape, k as LogoVariant, bf as MAX_COMPOSITION_DEPTH, bg as MAX_NUMBERING_LEVELS, bh as MAX_NUMBERING_VALUE, bi as MAX_PLACEHOLDER_GROUP_DEPTH, bj as MAX_ROMAN_VALUE, bk as METRIC_TREND_MIN_CONTRAST, bl as METRIC_TREND_SHAPES, M as MeasureTextWidth, bm as MetricContent, bn as MetricLayout, bo as MetricLayoutDiagnostic, bp as MetricLayoutOptions, bq as MetricSentiment, br as MetricTextPart, bs as MetricTextSource, bt as MetricTrend, bu as MetricTrendColorOptions, bv as MetricTrendMark, bw as NUMBERING_STYLES, bx as NUMBERING_SUFFIXES, by as Numbering, bz as NumberingInput, bA as NumberingStyleName, bB as NumberingSuffix, bC as OPFCompositionError, bD as PATTERN_PRESETS, bE as PATTERN_PRESET_ALIASES, bF as PATTERN_TILE_SIZE, bG as PICTURE_BULLET_SCALE, bH as PhysicalAlignment, bI as QuoteContent, bJ as QuoteLayout, bK as QuoteLayoutDiagnostic, bL as QuoteLayoutOptions, bM as QuotePhoto, bN as QuoteTextPart, bO as QuoteTextSource, bP as ReadingBox, bQ as Reference, bR as ReferencesSlideOptions, bS as ResolveColorRefOptions, bT as ResolveColorRefRoles, bU as ResolveColorRolesOptions, bV as ResolveDesignHintsOptions, R as ResolveLogoOptions, bW as ResolveScriptFontsOptions, bX as ResolvedChartDataLabels, bY as ResolvedChartHighlight, bZ as ResolvedChartOptions, b_ as ResolvedColorRoles, b$ as ResolvedDesignHints, l as ResolvedLogo, c0 as ResolvedNumbering, c1 as ResolvedScriptFonts, c2 as RichText, c3 as RichTextFit, c4 as RichTextFragment, c5 as RichTextLine, c6 as RichTextOptions, c7 as RichTextRun, S as SOCIAL_PLATFORMS, c8 as SURFACE_ALT_MIN_CONTRAST, c9 as SURFACE_ALT_MIX, ca as ScriptFontApp, cb as ScriptFontSlots, cc as ScriptFontSource, cd as ScriptFontSupplement, ce as ScriptMeasurementProfile, cf as ScriptRole, cg as SlideCitations, ch as SlideComposition, m as SocialPlatformVocabulary, ci as SocialProfile, cj as SourceTextFit, ck as TIMELINE_OUTLINE_MIN_CONTRAST, cl as TIMELINE_STATUSES, cm as TIMELINE_TEXT_MIN_CONTRAST, cn as TableBorder, co as TableCellLayout, cp as TableCellStyle, cq as TableGrid, cr as TableGridCell, cs as TableGridIssue, ct as TableLayout, cu as TableLayoutOptions, cv as TableRowLayout, cw as TextDirection, cx as TextFit, cy as TextLineInk, cz as TextLineSegment, cA as TextLineSource, T as TextMeasurement, cB as TextPlacement, cC as TextPlacementLine, n as TextStyle, cD as TimelineContent, cE as TimelineEvent, cF as TimelineLayout, cG as TimelineLayoutDiagnostic, cH as TimelineLayoutOptions, cI as TimelineMarkerShape, cJ as TimelineStatus, cK as TimelineStatusColors, cL as TimelineTextPart, cM as WatermarkTextLayout, cN as WatermarkTextOptions, cO as annotationText, cP as captionSettings, cQ as chartColorForFill, cR as chartHighlightColors, cS as chartHighlightMarks, cT as chartLabelText, cU as chartOptionSupport, cV as chartOptionTarget, cW as chartPaletteForFill, cX as chartPrimaryLayout, cY as citationMarkerText, cZ as codeHighlightBands, c_ as codeHighlightColors, c$ as codeHighlightLines, d0 as codeLineNumbers, d1 as codeLineRuns, d2 as codeSyntaxPalette, d3 as codeSyntaxPaletteForScheme, d4 as collectCitations, d5 as colorContrast, d6 as composeSlide, d7 as defaultSlideBackground, d8 as fitImage, d9 as fitList, da as fitRichText, db as fitText, dc as formatChartLabelNumber, dd as formatChartLabelPercent, de as formatFurnitureDate, df as formatListNumber, dg as hasPlaceholderGroups, dh as imageBackground, di as imageShape, dj as intrinsicImageAspect, dk as intrinsicImageSize, dl as isDarkColor, dm as isPlaceholderGroup, dn as layoutCaption, dp as layoutCode, dq as layoutContent, dr as layoutFootnotes, ds as layoutFurniture, dt as layoutLeaves, du as layoutMetric, dv as layoutQuote, dw as layoutSlots, dx as layoutStructure, dy as layoutTable, dz as layoutTimeline, dA as layoutWatermark, dB as listNumbers, dC as measureText, dD as measureTextOutline, dE as metricTrendColor, dF as metricTrendMark, dG as metricTrendPoints, dH as normalizeHexColor, dI as numberingAtLevel, dJ as numberingStyleDraws, dK as paragraphDirection, dL as paragraphDirectionAt, dM as patternBitmap, dN as patternRuns, dO as physicalAlignment, dP as placeTextLines, dQ as referencesSlide, dR as resolveCanvasDimensions, dS as resolveChartOptions, dT as resolveCodeLanguage, dU as resolveColorRef, dV as resolveColorRoles, dW as resolveDesignHints, dX as resolveFontFamilies, dY as resolveLogo, dZ as resolveNumbering, d_ as resolvePatternPreset, d$ as resolveScriptFonts, e0 as resolveSlideDirection, e1 as resolveSocialProfile, e2 as resolveTextStyle, e3 as scriptFontRole, e4 as sliceNumberedItems, e5 as slideCitations, e6 as snapFontSizeDown, e7 as snapFontSizeUp, e8 as surfaceAltColor, e9 as tableGrid, ea as tableRowBoundaries, eb as textColorForFill, ec as textWidthMeasurer, ed as timelineMarkerShapes, ee as timelineTextColor, ef as tokenizeCode, eg as visualReadingOrder, eh as walkCitationRuns, ei as wrapText } from './composition-C-OoqvAr.js';
|
|
2
|
+
export { d as CATALOG_REFERENCE_PATTERN, a as Catalog, C as CatalogKind, b as CatalogOptions, f as CatalogRecords, g as CatalogReferenceSite, O as OPFCatalogsOptionError, h as OPFUnresolvedReferenceError, R as RecordProvenance, i as ResolvedReference, U as UnresolvedReferenceDiagnostic, j as catalogGroupSource, k as catalogKinds, l as catalogRecords, m as catalogReferenceSites, p as parseReference, r as resolveReference, u as unresolvedReference } from './catalog-refs-BSfGELpt.js';
|
|
3
3
|
export { I as ChartComboSeries, C as ChartMapping, D as DataCellValue, d as DataColumn, e as DataDiagnostic, h as DataSourceRef, j as DataTableCell, k as DataTableHeader, n as Dataset, o as DatasetRef, R as ResolvedChartData, p as ResolvedTableData, q as chartNumber, s as formatDataNumber, t as fromExcelNumberFormat, u as inlineChartData, v as inlineDatasets, w as inlineTableData, x as isDatasetRef, y as isXYChartType, z as numberFormatError, A as resolveChartData, B as resolveTableData, F as tableCellDisplayValue, G as toExcelNumberFormat } from './chart-data-BnNqgnC-.js';
|
package/dist/composition.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CAPTIONABLE_FIELDS, CAPTION_FONT_RATIO, CAPTION_MAX_RATIO, CHART_HIGHLIGHT_MUTED_MIN_CONTRAST, CHART_HIGHLIGHT_MUTED_MIX, CHART_SERIES_MIN_DIFFERENCE, CHART_SERIES_MIN_LIGHTNESS_STEP, CHART_TYPES, CITATION_MARKER_RAISE, CITATION_MARKER_SCALE, CODE_HIGHLIGHT_LANGUAGES, CODE_HIGHLIGHT_MAX_LENGTH, CODE_PANEL_BACKGROUND, CODE_PANEL_FOREGROUND, CODE_SYNTAX_MIN_CONTRAST, DARK_BACKGROUND_LUMINANCE, DEFAULT_CHART_LABEL_SEPARATOR, DEFAULT_FURNITURE_DATE_FORMAT,
|
|
1
|
+
export { CAPTIONABLE_FIELDS, CAPTION_FONT_RATIO, CAPTION_MAX_RATIO, CHART_HIGHLIGHT_MUTED_MIN_CONTRAST, CHART_HIGHLIGHT_MUTED_MIX, CHART_SERIES_MIN_DIFFERENCE, CHART_SERIES_MIN_LIGHTNESS_STEP, CHART_TYPES, CITATION_MARKER_RAISE, CITATION_MARKER_SCALE, CODE_HIGHLIGHT_LANGUAGES, CODE_HIGHLIGHT_MAX_LENGTH, CODE_PANEL_BACKGROUND, CODE_PANEL_FOREGROUND, CODE_SYNTAX_MIN_CONTRAST, DARK_BACKGROUND_LUMINANCE, DEFAULT_CHART_LABEL_SEPARATOR, DEFAULT_FURNITURE_DATE_FORMAT, DESIGN_HINT_KEYS, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, FONT_SIZE_GRID_PER_PX, FOOTNOTE_MAX_RATIO, FURNITURE_GAP, FURNITURE_IMAGE_SHARE, LANGUAGES, LAYOUT_BODY_KINDS, LOGO_SHAPES, MAX_COMPOSITION_DEPTH, MAX_NUMBERING_LEVELS, MAX_NUMBERING_VALUE, MAX_PLACEHOLDER_GROUP_DEPTH, MAX_ROMAN_VALUE, METRIC_TREND_MIN_CONTRAST, METRIC_TREND_SHAPES, NUMBERING_STYLES, NUMBERING_SUFFIXES, OPFCompositionError, PATTERN_PRESETS, PATTERN_PRESET_ALIASES, PATTERN_TILE_SIZE, PICTURE_BULLET_SCALE, SOCIAL_PLATFORMS, SURFACE_ALT_MIN_CONTRAST, SURFACE_ALT_MIX, TIMELINE_OUTLINE_MIN_CONTRAST, TIMELINE_STATUSES, TIMELINE_TEXT_MIN_CONTRAST, annotationText, captionSettings, chartColorForFill, chartHighlightColors, chartHighlightMarks, chartLabelText, chartNumber, chartOptionSupport, chartOptionTarget, chartPaletteForFill, chartPrimaryLayout, citationMarkerText, codeHighlightBands, codeHighlightColors, codeHighlightLines, codeLineNumbers, codeLineRuns, codeSyntaxPalette, codeSyntaxPaletteForScheme, collectCitations, colorContrast, composeSlide, defaultSlideBackground, fitImage, fitList, fitRichText, fitText, formatChartLabelNumber, formatChartLabelPercent, formatDataNumber, formatFurnitureDate, formatListNumber, fromExcelNumberFormat, hasPlaceholderGroups, imageBackground, imageShape, inlineChartData, inlineDatasets, inlineTableData, intrinsicImageAspect, intrinsicImageSize, isDarkColor, isDatasetRef, isPlaceholderGroup, isXYChartType, layoutCaption, layoutCode, layoutContent, layoutFootnotes, layoutFurniture, layoutLeaves, layoutMetric, layoutQuote, layoutSlots, layoutStructure, layoutTable, layoutTimeline, layoutWatermark, listNumbers, measureText, measureTextOutline, metricTrendColor, metricTrendMark, metricTrendPoints, normalizeHexColor, numberFormatError, numberingAtLevel, numberingStyleDraws, paragraphDirection, paragraphDirectionAt, patternBitmap, patternRuns, physicalAlignment, placeTextLines, referencesSlide, resolveCanvasDimensions, resolveChartData, resolveChartOptions, resolveCodeLanguage, resolveColorRef, resolveColorRoles, resolveDesignHints, resolveFontFamilies, resolveLogo, resolveNumbering, resolvePatternPreset, resolveScriptFonts, resolveSlideDirection, resolveSocialProfile, resolveTableData, resolveTextStyle, scriptFontRole, sliceNumberedItems, slideCitations, snapFontSizeDown, snapFontSizeUp, surfaceAltColor, tableCellDisplayValue, tableGrid, tableRowBoundaries, textColorForFill, textWidthMeasurer, timelineMarkerShapes, timelineTextColor, toExcelNumberFormat, tokenizeCode, visualReadingOrder, walkCitationRuns, wrapText } from './chunk-MBU42S5Y.js';
|
|
2
2
|
export { CATALOG_REFERENCE_PATTERN, OPFCatalogsOptionError, OPFUnresolvedReferenceError, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, parseReference, resolveReference, unresolvedReference } from './chunk-SPFV27O5.js';
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import { D as DeckFormat } from './deck-report-wszX7uo8.js';
|
|
2
|
+
import { a as Finding, c as FindingSeverity } from './finding-CT_f_vbD.js';
|
|
3
|
+
import { P as Presentation } from './presentation-HondgJ3l.js';
|
|
4
|
+
import { V as ValidationReport, f as ValidationChecks, a as ValidateOptions } from './validation-types-PbGDrNUr.js';
|
|
5
|
+
import { a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
6
|
+
|
|
7
|
+
/** The base class: thrown for the request and the files (`node-only` in the browser build, `invalid-option`, `input-not-found`, `input-unreadable`, `invalid-presentation`, `output-exists`, `output-not-file`, `output-unwritable`). */
|
|
8
|
+
declare class OPFApiError extends Error {
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly details: Record<string, unknown>;
|
|
11
|
+
readonly findings: Finding[];
|
|
12
|
+
constructor(message: string, code: string, extra?: {
|
|
13
|
+
details?: Record<string, unknown>;
|
|
14
|
+
findings?: Finding[];
|
|
15
|
+
cause?: unknown;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** Thrown by the export step of `convert`: `peer-not-installed`, `peer-too-old`, `peer-load-failed`, `invalid-option`, `invalid-presentation`, `no-slides`, `all-slides-hidden`, `font-failed`, `export-failed`. */
|
|
19
|
+
declare class OPFExportError extends OPFApiError {
|
|
20
|
+
}
|
|
21
|
+
/** Thrown by the import step of `convert` and by `open` for a PowerPoint file: `peer-not-installed`, `peer-too-old`, `peer-load-failed`, `invalid-option`, `invalid-presentation`, `import-failed`. */
|
|
22
|
+
declare class OPFImportError extends OPFApiError {
|
|
23
|
+
}
|
|
24
|
+
/** The error as `Class`, whatever was thrown below: an error of that class is returned as it is, another API error keeps its code, details and findings. */
|
|
25
|
+
declare function asApiError<T extends OPFApiError>(Class: new (message: string, code: string, extra?: {
|
|
26
|
+
details?: Record<string, unknown>;
|
|
27
|
+
findings?: Finding[];
|
|
28
|
+
cause?: unknown;
|
|
29
|
+
}) => T, error: unknown, fallbackCode: string): T;
|
|
30
|
+
|
|
31
|
+
/** A slide selection: one slide number, a list of them, or text such as `"1,3-5"`, `"2-"` (to the end) or `"-3"` (from the start). Slides count from 1. */
|
|
32
|
+
type SlideSelection = number | string | readonly number[];
|
|
33
|
+
/**
|
|
34
|
+
* The slide numbers a selection names in a presentation of `total` slides: one-based, ascending, without repeats. A number or a
|
|
35
|
+
* list of numbers names those slides; text names slides and ranges, separated by commas: `"1,3-5"`, `"2-"` (from 2 to the end)
|
|
36
|
+
* and `"-3"` (from the start to 3). Throws `OPFApiError` `no-slides` when `total` is 0, and `invalid-option` for a malformed
|
|
37
|
+
* selection, a number that is not a whole number from 1, a reversed range or a slide past the end. `label` names the option in
|
|
38
|
+
* the message (`"slides"`; the opf CLI passes `"--slides"`).
|
|
39
|
+
*/
|
|
40
|
+
declare function parseSlideSelection(selection: SlideSelection, total: number, label?: string): number[];
|
|
41
|
+
|
|
42
|
+
declare const RENDER_PACKAGE = "@openpresentation/opf-render";
|
|
43
|
+
declare const PPTX_PACKAGE = "@openpresentation/opf-pptx";
|
|
44
|
+
/** Peer ranges. The CLI checks the features it calls rather than the version, so a newer release in range keeps working. */
|
|
45
|
+
declare const PEER_RANGES: {
|
|
46
|
+
readonly "@openpresentation/opf-render": "^0.18.0";
|
|
47
|
+
readonly "@openpresentation/opf-pptx": "^0.18.0";
|
|
48
|
+
};
|
|
49
|
+
interface Diagnostic {
|
|
50
|
+
code: string;
|
|
51
|
+
path?: string;
|
|
52
|
+
message: string;
|
|
53
|
+
[detail: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
interface EmbeddedFace {
|
|
56
|
+
family: string;
|
|
57
|
+
weight: number;
|
|
58
|
+
italic?: boolean;
|
|
59
|
+
dataUrl: string;
|
|
60
|
+
}
|
|
61
|
+
/** What the renderer's deck-level functions read from `{ fonts }` (opf-render `RenderFonts`). */
|
|
62
|
+
interface RenderFonts {
|
|
63
|
+
textMeasurement?: unknown;
|
|
64
|
+
embeddedFonts?: readonly EmbeddedFace[];
|
|
65
|
+
fontFiles?: readonly string[];
|
|
66
|
+
useBundledFonts?: boolean;
|
|
67
|
+
loadSystemFonts?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface FontRegistry {
|
|
70
|
+
scriptSelection?: {
|
|
71
|
+
detected: string[];
|
|
72
|
+
scripts: string[];
|
|
73
|
+
unavailable: string[];
|
|
74
|
+
packages?: string[];
|
|
75
|
+
notInstalled?: string[];
|
|
76
|
+
uncovered?: string[];
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** The handle `loadFonts()` of opf-render `/fonts-node` returns: pass it as `{ fonts }` to every deck-level call. */
|
|
80
|
+
interface FontsHandle extends RenderFonts {
|
|
81
|
+
textMeasurement: unknown;
|
|
82
|
+
embeddedFonts: EmbeddedFace[];
|
|
83
|
+
fontFiles: string[];
|
|
84
|
+
useBundledFonts: false;
|
|
85
|
+
loadSystemFonts: false;
|
|
86
|
+
registry: FontRegistry;
|
|
87
|
+
substitutions: {
|
|
88
|
+
requestedFamily: string;
|
|
89
|
+
resolvedFamily: string;
|
|
90
|
+
compatibility: string;
|
|
91
|
+
substitute: boolean;
|
|
92
|
+
}[];
|
|
93
|
+
}
|
|
94
|
+
/** The engines of opf-render 0.18 (RR-73). Slides count from 1; a number gives one SVG, a selection a list. */
|
|
95
|
+
interface RenderModule {
|
|
96
|
+
/** One slide of the deck as SVG; slides count from 1. */
|
|
97
|
+
toSvg(presentation: unknown, slide: number, options?: Record<string, unknown>): string;
|
|
98
|
+
/** One SVG slide as PNG. */
|
|
99
|
+
toPng(svg: string, options?: Record<string, unknown>): Promise<Uint8Array>;
|
|
100
|
+
/** SVG slides as one PDF, a page each. */
|
|
101
|
+
toPdf(svgs: string[], options?: Record<string, unknown>): Promise<Uint8Array>;
|
|
102
|
+
}
|
|
103
|
+
interface FontsNodeModule {
|
|
104
|
+
loadFonts(options?: Record<string, unknown>): Promise<FontsHandle>;
|
|
105
|
+
}
|
|
106
|
+
interface PptxModule {
|
|
107
|
+
toPptx(presentation: unknown, options?: Record<string, unknown>): Promise<Uint8Array>;
|
|
108
|
+
/** Without `signals` the presentation itself; with `signals: true`, `{ presentation, signals }`. */
|
|
109
|
+
fromPptx(input: Uint8Array, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
110
|
+
}
|
|
111
|
+
interface Peer<T> {
|
|
112
|
+
module: T;
|
|
113
|
+
version: string;
|
|
114
|
+
name: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* What the renderer needs besides itself (RR-63): its converters and every font package are optional peers of opf-render, so a host
|
|
118
|
+
* installs only the ones its outputs use. The versions are the ones the renderer is tested with (its `peerDependencies`).
|
|
119
|
+
*/
|
|
120
|
+
declare const RENDER_EXTRAS: {
|
|
121
|
+
/** The faces of the office pack, which the CLI and `convert` always load (every format). */
|
|
122
|
+
readonly fonts: readonly ["@expo-google-fonts/roboto@0.4.3", "@expo-google-fonts/roboto-mono@0.4.2", "@expo-google-fonts/caladea@0.4.2", "@expo-google-fonts/arimo@0.4.3", "@expo-google-fonts/tinos@0.4.2", "@expo-google-fonts/cousine@0.4.3", "@expo-google-fonts/gelasio@0.4.1", "@expo-google-fonts/noto-sans@0.4.2"];
|
|
123
|
+
/** PNG output (and raster fallbacks): the SVG rasterizer, and sharp for WebP and rotated JPEG pictures. */
|
|
124
|
+
readonly png: readonly ["@resvg/resvg-js@^2.6.2", "sharp@^0.35.5"];
|
|
125
|
+
/** PDF: vector mode (the default) needs nothing for text; raster mode needs pdf-lib; pictures in a vector PDF need sharp. */
|
|
126
|
+
readonly pdfRaster: readonly ["pdf-lib@^1.17.1"];
|
|
127
|
+
readonly pdfPictures: readonly ["sharp@^0.35.5"];
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* A package as the engine would find it (RR-75, `opf doctor`): its manifest resolved from core's location, then the working
|
|
131
|
+
* directory, then `from` (a file inside another package, for the optional peers opf-render loads itself). Undefined when it is
|
|
132
|
+
* not installed. Nothing is loaded.
|
|
133
|
+
*/
|
|
134
|
+
declare function locatePackage(name: string, from?: string): {
|
|
135
|
+
manifest: string;
|
|
136
|
+
version: string;
|
|
137
|
+
} | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* The missing-peer error for a renderer failure that says a package it loads lazily is absent (RR-63): `converter-missing` (pdf-lib,
|
|
140
|
+
* @resvg/resvg-js, sharp) or `font-resource-unavailable` naming font packages. The renderer's message, with its install command, is kept;
|
|
141
|
+
* `details` has `package` (or `packages`), `range`, `install` and `purpose` where the renderer gave them. A converter that is installed but
|
|
142
|
+
* did not load is `peer-load-failed`. Undefined for any other error.
|
|
143
|
+
*/
|
|
144
|
+
declare function missingPeerFrom(error: unknown): OPFApiError | undefined;
|
|
145
|
+
interface Renderer {
|
|
146
|
+
render: Peer<RenderModule>;
|
|
147
|
+
fonts: FontsNodeModule;
|
|
148
|
+
}
|
|
149
|
+
declare function loadRenderer(): Promise<Renderer>;
|
|
150
|
+
declare function loadPptx(): Promise<Peer<PptxModule>>;
|
|
151
|
+
|
|
152
|
+
/** True when any finding is at or above the level (the `--fail-on` rule). */
|
|
153
|
+
declare const reaches: (findings: readonly {
|
|
154
|
+
severity: FindingSeverity;
|
|
155
|
+
}[], level: FindingSeverity) => boolean;
|
|
156
|
+
type Source = "render" | "pptx" | "pdf" | "fonts" | "import" | "cli";
|
|
157
|
+
/** A finding of the shared format, with the library's details (font family, package, ...) alongside. */
|
|
158
|
+
interface ReportFinding extends Finding {
|
|
159
|
+
[detail: string]: unknown;
|
|
160
|
+
}
|
|
161
|
+
declare class Reporter {
|
|
162
|
+
readonly findings: ReportFinding[];
|
|
163
|
+
private readonly seen;
|
|
164
|
+
constructor(initial?: readonly Finding[]);
|
|
165
|
+
/** Add a library diagnostic (`code`, `path`, `message` and details). Identical entries are kept once. */
|
|
166
|
+
add(source: Source, diagnostic: Diagnostic, severity?: FindingSeverity): void;
|
|
167
|
+
/** Add a finding as the library made it (the `findings` of a thrown OPFRenderError, OPFPptxError or core validation error). Identical entries are kept once. */
|
|
168
|
+
addFinding(finding: Finding): void;
|
|
169
|
+
error(source: Source, code: string, message: string, where?: string, details?: Record<string, unknown>): void;
|
|
170
|
+
get counts(): Record<FindingSeverity, number>;
|
|
171
|
+
get failed(): boolean;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Convert a thrown library error into the report. An error that carries `findings` (the error findings of the format check,
|
|
175
|
+
* on OPFRenderError, OPFPptxError and core's OPFValidationError) is reported as those findings; any other error becomes one
|
|
176
|
+
* diagnostic that keeps its code and the path it names.
|
|
177
|
+
*/
|
|
178
|
+
declare function reportThrown(reporter: Reporter, source: Source, error: unknown): void;
|
|
179
|
+
declare function finishReport(base: Pick<ValidationReport, "valid" | "schemaValid" | "checks">, reporter: Reporter, failOn: FindingSeverity): {
|
|
180
|
+
ok: boolean;
|
|
181
|
+
valid: boolean;
|
|
182
|
+
schemaValid: boolean | null;
|
|
183
|
+
findings: ReportFinding[];
|
|
184
|
+
counts: Record<FindingSeverity, number>;
|
|
185
|
+
checks: ValidationChecks;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
type ExportFormat = "svg" | "png" | "pdf" | "pptx";
|
|
189
|
+
declare const EXPORT_FORMATS: readonly ExportFormat[];
|
|
190
|
+
/** How an SVG carries its text (RR-74): the faces the slide uses embedded (`fonts`, the default), none (`system`) or glyph outlines (`paths`). */
|
|
191
|
+
type ExportText = "fonts" | "system" | "paths";
|
|
192
|
+
declare const EXPORT_TEXT: readonly ExportText[];
|
|
193
|
+
interface ExportOptions {
|
|
194
|
+
/** What to write. `svg` and `png` give one file per slide (or one zip), `pdf` and `pptx` one file. */
|
|
195
|
+
format: ExportFormat;
|
|
196
|
+
/**
|
|
197
|
+
* The fonts: a prepared handle (`loadFonts()` of `@openpresentation/opf-render/fonts-node`), reused across calls, or a folder or
|
|
198
|
+
* folders of `.ttf` and `.otf` files to load before the bundled pack (not recursive). Omitted: the bundled open font pack.
|
|
199
|
+
*/
|
|
200
|
+
fonts?: FontsHandle | string | readonly string[];
|
|
201
|
+
/** The catalogs the presentation's references resolve in. Omitted: core's default catalog. */
|
|
202
|
+
catalogs?: readonly Catalog[];
|
|
203
|
+
/** The slides to write, one-based: a number, numbers or a selection such as `"1,3-5"` (`parseSlideSelection`). Omitted: every slide that is not hidden. Not for `pptx`. */
|
|
204
|
+
slides?: SlideSelection;
|
|
205
|
+
/** Write hidden slides too (`svg`, `png`, `pdf`). */
|
|
206
|
+
includeHidden?: boolean;
|
|
207
|
+
/** Split overflowing slides with the same fonts before drawing, as `opf paginate` does. */
|
|
208
|
+
paginate?: boolean;
|
|
209
|
+
/** Pixel scale of `png` and of a raster `pdf` (0.1 to 8; 1 draws the 1280 x 720 reference slide at 1280 x 720 pixels). */
|
|
210
|
+
scale?: number;
|
|
211
|
+
/** `pdf`: draw each slide as a picture (`true`) instead of selectable vector text (the default). */
|
|
212
|
+
raster?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* `svg`: how the text is carried. `fonts` (the default) embeds the faces the slide's text uses; `system` embeds none, for a page that
|
|
215
|
+
* already has the fonts; `paths` draws the text as glyph outlines, so the file needs no font.
|
|
216
|
+
*/
|
|
217
|
+
text?: ExportText;
|
|
218
|
+
/** `pptx`: native charts (`native`), pictures (`picture`) or opf-pptx's choice (`auto`, the default). */
|
|
219
|
+
charts?: "auto" | "native" | "picture";
|
|
220
|
+
/** `pptx`: what the file records about where media came from. */
|
|
221
|
+
provenance?: "full" | "references-only" | "none";
|
|
222
|
+
/** `pptx`: keep images as they are (`preserve`) or convert them for older PowerPoint (`compatible`). */
|
|
223
|
+
images?: "compatible" | "preserve";
|
|
224
|
+
/** `YYYY-MM-DD`, for date fields that show today's date. Nothing reads a clock: without it such a field reports `date-needs-value`. */
|
|
225
|
+
date?: string;
|
|
226
|
+
/** The directory a presentation's relative image paths resolve against. Omitted: no local file is read (data URIs and remote references work as the engines handle them). */
|
|
227
|
+
assetDir?: string;
|
|
228
|
+
/** `svg` and `png`: one zip of the slides instead of one file per slide. */
|
|
229
|
+
zip?: boolean;
|
|
230
|
+
/** The base name of the files (`name-001.png` for slide 1, `name.pdf`). Omitted: the presentation's `filename`, else its slugified `name`, else `deck`. */
|
|
231
|
+
name?: string;
|
|
232
|
+
}
|
|
233
|
+
interface ExportFile {
|
|
234
|
+
/** The file name: `options.name`, else the presentation's `filename`, else its slugified `name`, else `deck`, then `-001.png` for slide 1 and so on. */
|
|
235
|
+
name: string;
|
|
236
|
+
/** The media type. */
|
|
237
|
+
type: string;
|
|
238
|
+
bytes: Uint8Array;
|
|
239
|
+
/** `svg` and `png`: the slide number (one-based) and its id. */
|
|
240
|
+
slide?: number;
|
|
241
|
+
id?: string;
|
|
242
|
+
/** `svg` and `png`: the picture's size in pixels. */
|
|
243
|
+
width?: number;
|
|
244
|
+
height?: number;
|
|
245
|
+
/** `pdf`: the number of pages and the slide numbers they show. */
|
|
246
|
+
pages?: number;
|
|
247
|
+
slides?: number[];
|
|
248
|
+
/** `zip`: the names of the entries. */
|
|
249
|
+
entries?: string[];
|
|
250
|
+
}
|
|
251
|
+
interface ExportFontSummary {
|
|
252
|
+
pack: "office";
|
|
253
|
+
substitutionPolicy: "visual";
|
|
254
|
+
/** The `fonts` folder files, in load order. */
|
|
255
|
+
userFonts: string[];
|
|
256
|
+
substitutions: {
|
|
257
|
+
requested: string;
|
|
258
|
+
resolved: string;
|
|
259
|
+
compatibility: string;
|
|
260
|
+
}[];
|
|
261
|
+
scripts?: unknown;
|
|
262
|
+
}
|
|
263
|
+
interface ExportRun {
|
|
264
|
+
files: ExportFile[];
|
|
265
|
+
fonts?: ExportFontSummary;
|
|
266
|
+
pagination?: {
|
|
267
|
+
pages: unknown;
|
|
268
|
+
};
|
|
269
|
+
pdf?: {
|
|
270
|
+
mode: "vector" | "raster";
|
|
271
|
+
};
|
|
272
|
+
skippedHidden: number[];
|
|
273
|
+
/** Set when drawing or paginating threw: the reporter holds the error finding and `files` is empty. */
|
|
274
|
+
failure?: {
|
|
275
|
+
code: string;
|
|
276
|
+
message: string;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/** What a caller that has already done some of the work passes in, so the engine does not repeat it. */
|
|
280
|
+
interface ExportContext {
|
|
281
|
+
reporter: Reporter;
|
|
282
|
+
renderer?: Renderer;
|
|
283
|
+
pptx?: Peer<PptxModule>;
|
|
284
|
+
/** Absolute font file paths already listed from the `fonts` folders. */
|
|
285
|
+
userFonts?: string[];
|
|
286
|
+
/** Name options as the command line does (`--slides`, `--fonts`, `--asset-dir`) in the messages of errors the engine throws. */
|
|
287
|
+
flags?: boolean;
|
|
288
|
+
}
|
|
289
|
+
/** `YYYY-MM-DD` and a real calendar date, or undefined. `label` names the option in the message (`--date` for the command, `date` for the function). */
|
|
290
|
+
declare function checkDate(value: unknown, label?: string): string | undefined;
|
|
291
|
+
/** A scale from 0.1 to 8, 1 when absent. */
|
|
292
|
+
declare function checkScale(value: unknown, label?: string): number;
|
|
293
|
+
/** Throws `invalid-option` when `options` uses a name 0.18 renamed. */
|
|
294
|
+
declare function checkRenamedOptions(options: object): void;
|
|
295
|
+
/** The options of a call as the engine reads them: checked, with defaults, and `fonts` split into the handle or the folders. */
|
|
296
|
+
interface ResolvedExportOptions extends Omit<ExportOptions, "fonts" | "text" | "scale"> {
|
|
297
|
+
format: ExportFormat;
|
|
298
|
+
text: ExportText;
|
|
299
|
+
scale: number;
|
|
300
|
+
/** `fonts`, when it is a prepared handle. */
|
|
301
|
+
fonts?: FontsHandle;
|
|
302
|
+
/** `fonts`, when it names folders. */
|
|
303
|
+
fontFolders: string[];
|
|
304
|
+
}
|
|
305
|
+
/** The options of a call, checked against each other. Throws `invalid-option` (an OPFApiError) for a value out of range or an option that does not apply to the format. */
|
|
306
|
+
declare function resolveExportOptions(options: ExportOptions): ResolvedExportOptions;
|
|
307
|
+
/**
|
|
308
|
+
* Draw a presentation that has already passed the format and references check (`ctx.reporter` holds that check's findings).
|
|
309
|
+
* Diagnostics from fonts, layout, the SVG, PDF and PPTX writers are added to `ctx.reporter`. Throws an `OPFApiError` for an
|
|
310
|
+
* option, a missing or old peer, a font directory or a selection that names no slide; a failure while drawing is returned in
|
|
311
|
+
* `failure` after the reporter has the error finding.
|
|
312
|
+
*/
|
|
313
|
+
declare function runExport(presentation: unknown, options: ResolvedExportOptions, ctx: ExportContext): Promise<ExportRun>;
|
|
314
|
+
declare const VERSIONS: (renderer: Renderer, pptx?: Peer<PptxModule>) => {
|
|
315
|
+
pptx?: {
|
|
316
|
+
package: string;
|
|
317
|
+
version: string;
|
|
318
|
+
} | undefined;
|
|
319
|
+
renderer: {
|
|
320
|
+
package: string;
|
|
321
|
+
version: string;
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/** The check a presentation passes before it is exported or after it is imported: format and references, so a contrast warning never blocks a write. */
|
|
326
|
+
declare const checkOptions: (catalogs: readonly Catalog[] | undefined) => ValidateOptions;
|
|
327
|
+
interface ExportResult {
|
|
328
|
+
/** The files, in slide order: one per slide for `svg` and `png`, otherwise one. */
|
|
329
|
+
files: ExportFile[];
|
|
330
|
+
/** The findings of the format and references check (warnings and notes; errors throw) and the diagnostics of the engines: fonts, layout, SVG, PDF and PPTX, each with a `render/`, `pptx/`, `pdf/`, `fonts/` or `cli/` rule prefix. */
|
|
331
|
+
findings: Finding[];
|
|
332
|
+
/** The bundled fonts and font files used, and the substitutions made. */
|
|
333
|
+
fonts: ExportFontSummary;
|
|
334
|
+
/** Slide numbers left out because they are hidden (`svg`, `png`, `pdf` without `includeHidden` or `slides`). */
|
|
335
|
+
skippedHidden: number[];
|
|
336
|
+
/** With `paginate`: the pages the slides were split into. */
|
|
337
|
+
pagination?: {
|
|
338
|
+
pages: unknown;
|
|
339
|
+
};
|
|
340
|
+
/** `pdf`: the mode used. */
|
|
341
|
+
pdf?: {
|
|
342
|
+
mode: "vector" | "raster";
|
|
343
|
+
};
|
|
344
|
+
/** The engines that drew the files. */
|
|
345
|
+
renderer: {
|
|
346
|
+
package: string;
|
|
347
|
+
version: string;
|
|
348
|
+
};
|
|
349
|
+
pptx?: {
|
|
350
|
+
package: string;
|
|
351
|
+
version: string;
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
interface ImportOptions {
|
|
355
|
+
/** The catalogs the imported presentation's references resolve in. Omitted: core's default catalog. */
|
|
356
|
+
catalogs?: readonly Catalog[];
|
|
357
|
+
/** Also return the raw per-shape layout and style signals of the file (`signals`). */
|
|
358
|
+
signals?: boolean;
|
|
359
|
+
}
|
|
360
|
+
interface ImportResult {
|
|
361
|
+
/** The presentation. It passed the format and references check. */
|
|
362
|
+
presentation: Presentation;
|
|
363
|
+
/** What the conversion could not keep or had to change, and the findings of the check. */
|
|
364
|
+
findings: Finding[];
|
|
365
|
+
/** With `signals: true`. */
|
|
366
|
+
signals?: {
|
|
367
|
+
version?: number;
|
|
368
|
+
};
|
|
369
|
+
/** The importer that read the file. */
|
|
370
|
+
pptx: {
|
|
371
|
+
package: string;
|
|
372
|
+
version: string;
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/** An export whose options are checked and whose engines and font files are loaded, before any document is read. */
|
|
376
|
+
interface PreparedExport {
|
|
377
|
+
options: ResolvedExportOptions;
|
|
378
|
+
renderer: Renderer;
|
|
379
|
+
pptx?: Peer<PptxModule>;
|
|
380
|
+
userFonts: string[];
|
|
381
|
+
/** Name options as the command's flags (`--slides`, `--fonts`, `--asset-dir`) in messages. */
|
|
382
|
+
flags: boolean;
|
|
383
|
+
}
|
|
384
|
+
/** Check the options, then load the engines and list the font directories, so a missing install is reported before the document is looked at. */
|
|
385
|
+
declare function prepareExport(options: ExportOptions, flags?: boolean): Promise<PreparedExport>;
|
|
386
|
+
/**
|
|
387
|
+
* Draw a presentation. Without `checked` it is checked first (`invalid-presentation` when it fails); with `checked`, the findings
|
|
388
|
+
* of a check already made (located in the text it was read from, or the findings of an import) start the report instead.
|
|
389
|
+
*/
|
|
390
|
+
declare function runPreparedExport(prepared: PreparedExport, presentation: Presentation, checked?: readonly Finding[]): Promise<ExportResult>;
|
|
391
|
+
/** Read a PowerPoint file and check the presentation (`import-failed`, `invalid-presentation`). `check` is the report of that check. */
|
|
392
|
+
declare function importPresentation(bytes: Uint8Array, options: ImportOptions, loaded?: Peer<PptxModule>): Promise<{
|
|
393
|
+
result: ImportResult;
|
|
394
|
+
check: ValidationReport;
|
|
395
|
+
}>;
|
|
396
|
+
|
|
397
|
+
/** What `convert` makes: an export format, or a deck form. */
|
|
398
|
+
type ConvertFormat = ExportFormat | DeckFormat;
|
|
399
|
+
/** What `convert` reads: a file path (`.pptx`, `.opf.md`, `.yaml`/`.yml`, `.json`), a deck, or the bytes of a `.pptx` file. */
|
|
400
|
+
type ConvertInput = string | Presentation | Uint8Array | ArrayBuffer;
|
|
401
|
+
interface ConvertOptions extends Omit<ExportOptions, "format"> {
|
|
402
|
+
/**
|
|
403
|
+
* What to make. With an output path the path's extension names it, and `format` is needed only for a `.zip` (the slides in
|
|
404
|
+
* it: `png`, the default, or `svg`); a `format` that disagrees with the extension is refused. Without an output path it is
|
|
405
|
+
* required: `pdf`, `pptx`, `png`, `svg`, `json`, `yaml` or `markdown`.
|
|
406
|
+
*/
|
|
407
|
+
format?: ConvertFormat;
|
|
408
|
+
/** Without an output path: one archive of the slides (`png`, `svg`) instead of one file per slide. With an output path, a `.zip` path makes the archive and this option is refused. */
|
|
409
|
+
zip?: boolean;
|
|
410
|
+
/** Without an output path: the base name of the returned files (`name-001.png`, `name.pdf`). Omitted: the deck's `filename`, else its `name`, else the input file's stem. With an output path, the path names the file and this option is refused. */
|
|
411
|
+
name?: string;
|
|
412
|
+
/** A `.pptx` input: also return the raw per-shape layout and style signals of the file (`signals` in the result). */
|
|
413
|
+
signals?: boolean;
|
|
414
|
+
/**
|
|
415
|
+
* Replace outputs that exist (the default, as `save` and `fs.writeFile` do), atomically. `false` refuses: an existing output
|
|
416
|
+
* rejects with `output-exists` before anything is written, the rule the opf commands apply without `--force`. A symlink, a
|
|
417
|
+
* directory or another non-regular file is never replaced (`output-not-file`).
|
|
418
|
+
*/
|
|
419
|
+
overwrite?: boolean;
|
|
420
|
+
}
|
|
421
|
+
interface ConvertedFile {
|
|
422
|
+
/** The file name: the output's base name, or without an output path the deck's `filename`, else its slugified `name`, else the input file's stem, then `-001.png` for slide 1 and so on. */
|
|
423
|
+
name: string;
|
|
424
|
+
/** With an output path, the file written: the path itself, or for one file per slide the path's folder and stem plus the slide number (`slides/deck-001.png`). */
|
|
425
|
+
path?: string;
|
|
426
|
+
/** The media type. */
|
|
427
|
+
type: string;
|
|
428
|
+
bytes: Uint8Array;
|
|
429
|
+
/** `png` and `svg`: the slide number (one-based), its id and the picture's size in pixels. */
|
|
430
|
+
slide?: number;
|
|
431
|
+
id?: string;
|
|
432
|
+
width?: number;
|
|
433
|
+
height?: number;
|
|
434
|
+
/** `pdf`: the number of pages and the slide numbers they show. */
|
|
435
|
+
pages?: number;
|
|
436
|
+
slides?: number[];
|
|
437
|
+
/** `zip`: the names of the entries. */
|
|
438
|
+
entries?: string[];
|
|
439
|
+
}
|
|
440
|
+
interface ConvertResult {
|
|
441
|
+
/** The files, in slide order: written when an output path was given, otherwise only returned. */
|
|
442
|
+
files: ConvertedFile[];
|
|
443
|
+
/** The findings of every step: the import (`import/` rules), the format and references check, and the export engines (`render/`, `pptx/`, `pdf/`, `fonts/`, `cli/`). Errors throw instead. */
|
|
444
|
+
findings: Finding[];
|
|
445
|
+
/** With `signals: true` and a `.pptx` input. */
|
|
446
|
+
signals?: {
|
|
447
|
+
version?: number;
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
interface OpenOptions {
|
|
451
|
+
/** The catalogs the deck's references resolve in. Omitted: the default catalog. */
|
|
452
|
+
catalogs?: ExportOptions["catalogs"];
|
|
453
|
+
}
|
|
454
|
+
interface SaveOptions {
|
|
455
|
+
/** Check format and references first and refuse an invalid deck (`OPFValidationError`). Default true; `false` writes work in progress, as an editor's autosave does. */
|
|
456
|
+
validate?: boolean;
|
|
457
|
+
/** The catalogs the deck's references resolve in. Omitted: the default catalog. */
|
|
458
|
+
catalogs?: ExportOptions["catalogs"];
|
|
459
|
+
/** YAML: start with a `# yaml-language-server: $schema=...` line so editors validate the file. */
|
|
460
|
+
schemaComment?: boolean;
|
|
461
|
+
}
|
|
462
|
+
interface SaveResult {
|
|
463
|
+
/** The file, as it was given. */
|
|
464
|
+
path: string;
|
|
465
|
+
/** The form written, from the file name. */
|
|
466
|
+
format: DeckFormat;
|
|
467
|
+
}
|
|
468
|
+
/** A planned conversion: everything `convert` would write, and what `opf convert` reports about it. */
|
|
469
|
+
interface ConversionPlan {
|
|
470
|
+
files: ConvertedFile[];
|
|
471
|
+
findings: Finding[];
|
|
472
|
+
/** The format and references check of the deck that was drawn or written. */
|
|
473
|
+
check: Pick<ValidationReport, "valid" | "schemaValid" | "checks">;
|
|
474
|
+
format: ConvertFormat;
|
|
475
|
+
zip: boolean;
|
|
476
|
+
input?: {
|
|
477
|
+
file: string;
|
|
478
|
+
bytes: Uint8Array;
|
|
479
|
+
};
|
|
480
|
+
exported?: ExportResult;
|
|
481
|
+
imported?: ImportResult;
|
|
482
|
+
}
|
|
483
|
+
/** The deck form a file name stands for (core's `deckFormatOf`: `.opf.md`, `.yaml`, `.yml`), or JSON for `.json`; undefined for any other name. A plain `.md` file is not a deck. */
|
|
484
|
+
declare function deckFileFormat(file: string): DeckFormat | undefined;
|
|
485
|
+
/** The export format a file name stands for (`.pdf`, `.pptx`, `.png`, `.svg`, any case), else undefined. `opf convert` reads its output name with this rule. */
|
|
486
|
+
declare function exportFormatOf(file: string): ExportFormat | undefined;
|
|
487
|
+
/** Read an input file: `input-not-found` when there is none, `input-unreadable` for any other failure. */
|
|
488
|
+
declare function readInput(file: string): Promise<Uint8Array>;
|
|
489
|
+
/**
|
|
490
|
+
* Plan a conversion: check the request, read the input, then import, check, export or serialize. Nothing is written. Throws
|
|
491
|
+
* `OPFApiError` for the request and the files (`invalid-option`, `input-not-found`, `input-unreadable`, and
|
|
492
|
+
* `invalid-presentation` for a deck written as a deck), `OPFImportError` for the import step and `OPFExportError` for the export
|
|
493
|
+
* step (`invalid-presentation` included). `flags` names options as the command's flags in messages.
|
|
494
|
+
*/
|
|
495
|
+
declare function planConversion(input: ConvertInput, output: string | undefined, options?: ConvertOptions, flags?: boolean): Promise<ConversionPlan>;
|
|
496
|
+
/**
|
|
497
|
+
* Write planned files atomically (temporary sibling, then rename), creating folders. `overwrite` false refuses an existing output
|
|
498
|
+
* (`output-exists`): the opf commands pass it unless `--force`; `convert` passes its `overwrite` option, true by default.
|
|
499
|
+
*/
|
|
500
|
+
declare function writePlanned(files: readonly ConvertedFile[], overwrite: boolean, flags?: boolean): Promise<void>;
|
|
501
|
+
|
|
502
|
+
export { runExport as $, checkRenamedOptions as A, checkScale as B, type ConversionPlan as C, type Diagnostic as D, type EmbeddedFace as E, type FontsHandle as F, deckFileFormat as G, exportFormatOf as H, type ImportOptions as I, finishReport as J, importPresentation as K, loadPptx as L, loadRenderer as M, locatePackage as N, OPFApiError as O, type Peer as P, missingPeerFrom as Q, type Renderer as R, type SlideSelection as S, parseSlideSelection as T, planConversion as U, VERSIONS as V, prepareExport as W, reaches as X, readInput as Y, reportThrown as Z, resolveExportOptions as _, Reporter as a, runPreparedExport as a0, writePlanned as a1, type ConvertInput as a2, type ConvertOptions as a3, type ConvertResult as a4, type ConvertFormat as a5, type OpenOptions as a6, type SaveOptions as a7, type SaveResult as a8, type ConvertedFile as a9, type PptxModule as b, EXPORT_FORMATS as c, EXPORT_TEXT as d, type ExportContext as e, type ExportFile as f, type ExportFontSummary as g, type ExportFormat as h, type ExportOptions as i, type ExportResult as j, type ExportRun as k, type ExportText as l, type ImportResult as m, OPFExportError as n, OPFImportError as o, PEER_RANGES as p, PPTX_PACKAGE as q, type PreparedExport as r, RENDER_EXTRAS as s, RENDER_PACKAGE as t, type ReportFinding as u, type ResolvedExportOptions as v, type Source as w, asApiError as x, checkDate as y, checkOptions as z };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { convertFiles, deckFileFormat, exportFormatOf, openDeck, planConversion, readInput, saveDeck, writePlanned } from './chunk-KXBZ6ZSB.js';
|
|
2
|
+
import './chunk-QLFWWHRF.js';
|
|
3
|
+
import './chunk-HXHOZ7AH.js';
|
|
4
|
+
import './chunk-ZCFSDSUX.js';
|
|
5
|
+
import './chunk-WCG3THTD.js';
|
|
6
|
+
import './chunk-ZOHFLP3O.js';
|
|
7
|
+
import './chunk-DBYZI75U.js';
|
|
8
|
+
import './chunk-NS3VYB57.js';
|
|
9
|
+
import './chunk-CJPDTLGD.js';
|
|
10
|
+
import './chunk-YWXB4XAT.js';
|
|
11
|
+
import './chunk-YZXTXX2D.js';
|
|
12
|
+
import './chunk-JXVS7BJK.js';
|
|
13
|
+
import './chunk-64YSJZDH.js';
|
|
14
|
+
import './chunk-VCGRMNY2.js';
|
|
15
|
+
import './chunk-RAKEVM52.js';
|
|
16
|
+
import './chunk-JT3QXA22.js';
|
|
17
|
+
import './chunk-MBU42S5Y.js';
|
|
18
|
+
import './chunk-TRDXRRQK.js';
|
|
19
|
+
import './chunk-SPFV27O5.js';
|
|
20
|
+
import './chunk-6WW2EDUW.js';
|
|
21
|
+
import './chunk-WXSPETQ6.js';
|
package/dist/convert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import './composition-
|
|
3
|
-
import './catalog-refs-
|
|
1
|
+
import { a as PaginatedPage, b as PresentationPaginationOptions } from './pagination-BaUjDrTz.js';
|
|
2
|
+
import './composition-C-OoqvAr.js';
|
|
3
|
+
import './catalog-refs-BSfGELpt.js';
|
|
4
4
|
import './chart-data-BnNqgnC-.js';
|
|
5
5
|
|
|
6
6
|
type Json = any;
|
package/dist/convert.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { paginate, OPFPaginationError } from './chunk-
|
|
2
|
-
import { parseQuoteLines, parseCodeFence, splitWhen, parseListLine, levelsFromIndents, fenceCode } from './chunk-
|
|
3
|
-
import { CONTENT_KEYS, isRecord, contentKeysOf, refuse, clone, Loss, isSlideLike, assertValidOwner, report, OPFConversionError, plainOf, assertValidOutput, same, splitRuns, runsOf, lineIsPlain, linePlain, concatText, lineValue, joinLines, hasFormatting } from './chunk-
|
|
4
|
-
export { OPFConversionError } from './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import { promotedRegionKeys, isDatasetRef, inlineTableData, visitContentPayloads, chartNumber } from './chunk-
|
|
1
|
+
import { paginate, OPFPaginationError } from './chunk-64YSJZDH.js';
|
|
2
|
+
import { parseQuoteLines, parseCodeFence, splitWhen, parseListLine, levelsFromIndents, fenceCode } from './chunk-VCGRMNY2.js';
|
|
3
|
+
import { CONTENT_KEYS, isRecord, contentKeysOf, refuse, clone, Loss, isSlideLike, assertValidOwner, report, OPFConversionError, plainOf, assertValidOutput, same, splitRuns, runsOf, lineIsPlain, linePlain, concatText, lineValue, joinLines, hasFormatting } from './chunk-RAKEVM52.js';
|
|
4
|
+
export { OPFConversionError } from './chunk-RAKEVM52.js';
|
|
5
|
+
import './chunk-JT3QXA22.js';
|
|
6
|
+
import { promotedRegionKeys, isDatasetRef, inlineTableData, visitContentPayloads, chartNumber } from './chunk-MBU42S5Y.js';
|
|
7
7
|
import './chunk-TRDXRRQK.js';
|
|
8
8
|
import './chunk-SPFV27O5.js';
|
|
9
|
-
import './chunk-
|
|
9
|
+
import './chunk-6WW2EDUW.js';
|
|
10
10
|
|
|
11
11
|
// src/convert/tables.ts
|
|
12
12
|
function cellOf(raw) {
|