@openpresentation/opf 0.17.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 +4 -4
- package/dist/browser.js +38 -0
- package/dist/{catalog-refs-C4K4y-vh.d.ts → catalog-refs-BSfGELpt.d.ts} +1 -1
- package/dist/{catalog-schemas-g7RFQBdc.d.ts → catalog-schemas-CinPh5WA.d.ts} +1 -1
- package/dist/catalog.d.ts +2 -2
- package/dist/{chart-data-DTxdRRT1.d.ts → chart-data-BnNqgnC-.d.ts} +1 -1
- package/dist/{chunk-O2CX5NEH.js → chunk-64YSJZDH.js} +6 -5
- package/dist/{chunk-RA64UQKI.js → chunk-6WW2EDUW.js} +95 -71
- package/dist/{chunk-IS5H5JKH.js → chunk-CJPDTLGD.js} +1 -1
- package/dist/{chunk-BIC3SWPK.js → chunk-DBYZI75U.js} +30 -5
- package/dist/{chunk-NLNYNBTS.js → chunk-JT3QXA22.js} +25 -24
- package/dist/{chunk-YT7FMQER.js → chunk-JXVS7BJK.js} +1 -1
- package/dist/{chunk-IPW5BS3X.js → chunk-KXBZ6ZSB.js} +190 -172
- package/dist/{chunk-CW7GEAV3.js → chunk-MBU42S5Y.js} +291 -133
- package/dist/{chunk-TCD2FB2K.js → chunk-NS3VYB57.js} +5 -5
- package/dist/{chunk-WWYWFVOI.js → chunk-QLFWWHRF.js} +151 -25
- package/dist/{chunk-PPROJP2E.js → chunk-RAKEVM52.js} +1 -1
- package/dist/{chunk-ESRYBYLY.js → chunk-VCGRMNY2.js} +1 -1
- package/dist/{chunk-M4UR3NPN.js → chunk-YWXB4XAT.js} +2 -2
- package/dist/{chunk-O3CVNJTL.js → chunk-YZXTXX2D.js} +1 -1
- package/dist/{chunk-O263APNI.js → chunk-ZCFSDSUX.js} +3 -3
- package/dist/{chunk-N4EVOFEA.js → chunk-ZOHFLP3O.js} +4 -4
- package/dist/{composition-BbZ_9C-c.d.ts → composition-C-OoqvAr.d.ts} +80 -40
- package/dist/composition.d.ts +3 -3
- package/dist/composition.js +1 -1
- package/dist/{conversion-SBpTOwdg.d.ts → conversion-C5foedh6.d.ts} +96 -38
- package/dist/conversion-KGDVJM75.js +21 -0
- package/dist/convert.d.ts +4 -4
- package/dist/convert.js +7 -7
- package/dist/data.d.ts +7 -7
- package/dist/data.js +2 -2
- package/dist/{deck-report-Bx3naFlF.d.ts → deck-report-wszX7uo8.d.ts} +5 -5
- package/dist/deck.d.ts +8 -8
- package/dist/deck.js +10 -10
- package/dist/diff.d.ts +1 -1
- package/dist/diff.js +5 -5
- package/dist/docs.js +28 -28
- package/dist/examples.d.ts +1 -1
- package/dist/examples.js +181 -214
- package/dist/{finding-CDQ_wH8j.d.ts → finding-CT_f_vbD.d.ts} +1 -1
- package/dist/format.js +2 -2
- package/dist/index.d.ts +153 -20
- package/dist/index.js +62 -15
- package/dist/markdown.d.ts +12 -8
- package/dist/markdown.js +7 -7
- package/dist/node-engine.d.ts +37 -17
- package/dist/node-engine.js +39 -16
- package/dist/{pagination-BhX4M48Y.d.ts → pagination-BaUjDrTz.d.ts} +7 -4
- package/dist/pagination.d.ts +4 -4
- package/dist/pagination.js +4 -4
- package/dist/patch.d.ts +1 -1
- package/dist/patch.js +4 -4
- package/dist/{presentation-fb8CZmRq.d.ts → presentation-HondgJ3l.d.ts} +269 -382
- package/dist/repo-readme.js +1 -1
- package/dist/schemas.d.ts +4 -2
- package/dist/schemas.js +1 -1
- package/dist/spec/schemas/opf.schema.json +65 -70
- package/dist/types.d.ts +3 -3
- package/dist/{validation-types-iZbXfES6.d.ts → validation-types-PbGDrNUr.d.ts} +12 -7
- package/dist/validator.d.ts +8 -8
- package/dist/validator.js +3 -3
- package/dist/yaml.d.ts +6 -6
- package/dist/yaml.js +7 -7
- package/package.json +12 -10
- package/dist/node.d.ts +0 -60
- package/dist/node.js +0 -54
|
@@ -209,4 +209,4 @@ interface ValidationIssue {
|
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
export type {
|
|
212
|
+
export type { FindingReport as F, JsonPatchOperation as J, ValidationIssue as V, Finding as a, FindingLocation as b, FindingSeverity as c, FindingCategory as d, FindingFix as e, FindingFocus as f, FindingSuggestion as g };
|
package/dist/format.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { OPFFormatError, format, isFormatted, sortPresentationKeys } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { OPFFormatError, format, isFormatted, sortPresentationKeys } from './chunk-JXVS7BJK.js';
|
|
2
|
+
import './chunk-6WW2EDUW.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
export { SchemaEntry, SchemaName, audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './schemas.js';
|
|
2
|
-
|
|
3
|
-
export {
|
|
2
|
+
import { a2 as ConvertInput, a3 as ConvertOptions, a4 as ConvertResult, a5 as ConvertFormat, a6 as OpenOptions, a7 as SaveOptions, a8 as SaveResult } from './conversion-C5foedh6.js';
|
|
3
|
+
export { a9 as ConvertedFile, h as ExportFormat, F as FontsHandle, O as OPFApiError, n as OPFExportError, o as OPFImportError, S as SlideSelection, T as parseSlideSelection } from './conversion-C5foedh6.js';
|
|
4
|
+
import { validate as validate$1 } from './validator.js';
|
|
5
|
+
export { DEFAULT_CHART_PALETTE, DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, validateCatalogRecord, validationRules } from './validator.js';
|
|
6
|
+
import { R as ResolveVariablesOptions, h as VariableDiagnostic } from './validation-types-PbGDrNUr.js';
|
|
7
|
+
export { B as BuiltinVariableInfo, C as Contract, D as DEFAULT_VARIABLE_DATE_FORMAT, O as OPFVariableError, i as ResolveVariablesResult, j as VARIABLE_KINDS, d as ValidateFonts, a as ValidateOptions, e as ValidationCategory, f as ValidationChecks, V as ValidationReport, g as ValidationRuleCost, c as ValidationRuleInfo, b as ValidationThresholds, k as VariableDeclaration, l as VariableDiagnosticCode, m as VariableDiagnosticSeverity, n as VariableInfo, o as VariableKind, p as VariableUse, q as VariableUseForm, r as VariableValues, s as coerceVariableValue, t as formatVariableNumber, u as hasContentVariables, w as isTemplate, x as listBuiltinVariables, y as listVariables, z as resolveVariables, v as validationCategories, A as variableDeclarations } from './validation-types-PbGDrNUr.js';
|
|
8
|
+
export { a as CHART_TYPES, C as ComposeSlideOptions, E as ENGINE_DEFAULT_CHART_TYPES, b as ENGINE_DEFAULT_COLOR_SCHEME, c as ENGINE_DEFAULT_FONT_SCHEME, d as ENGINE_DEFAULT_THEME, e as FontFamilies, F as Fonts, f as LANGUAGES, g as LOGO_SHAPES, h as LanguageFamilyName, i as LanguageVocabulary, L as LayoutDiagnostic, j as LogoShape, k as LogoVariant, M as MeasureTextWidth, R as ResolveLogoOptions, l as ResolvedLogo, S as SOCIAL_PLATFORMS, m as SocialPlatformVocabulary, T as TextMeasurement, n as TextStyle, o as normalizeLanguageFamily } from './composition-C-OoqvAr.js';
|
|
4
9
|
export { SpecFileEntry, SpecFileKind, SpecFilePath, specFileEntries, specFileKinds, specFilePaths } from './spec-files.js';
|
|
5
|
-
import { P as Presentation } from './presentation-
|
|
10
|
+
import { P as Presentation } from './presentation-HondgJ3l.js';
|
|
6
11
|
export { Audience, ChartType, ColorScheme, FontScheme, Language, Layout, Narrative, Purpose, SocialPlatform, Theme, Tone } from './types.js';
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
export { C as CatalogDisplayKind, a as CatalogRecordKind, c as catalogDisplayKinds, b as catalogSchemaNames } from './catalog-schemas-
|
|
12
|
-
|
|
12
|
+
import { C as CatalogKind, U as UnresolvedReferenceDiagnostic, b as CatalogOptions, a as Catalog, R as RecordProvenance } from './catalog-refs-BSfGELpt.js';
|
|
13
|
+
export { c as CATALOG_GROUP_PATTERN, d as CATALOG_REFERENCE_PATTERN, e as CatalogRecordMap, f as CatalogRecords, g as CatalogReferenceSite, O as OPFCatalogsOptionError, h as OPFUnresolvedReferenceError, i as ResolvedReference, 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';
|
|
14
|
+
import { a as Finding, J as JsonPatchOperation } from './finding-CT_f_vbD.js';
|
|
15
|
+
export { d as FindingCategory, e as FindingFix, f as FindingFocus, b as FindingLocation, F as FindingReport, c as FindingSeverity, g as FindingSuggestion, V as ValidationIssue } from './finding-CT_f_vbD.js';
|
|
16
|
+
export { C as CatalogDisplayKind, a as CatalogRecordKind, c as catalogDisplayKinds, b as catalogSchemaNames } from './catalog-schemas-CinPh5WA.js';
|
|
17
|
+
import { p as paginate$1 } from './pagination-BaUjDrTz.js';
|
|
18
|
+
export { O as OPFPaginationError, a as PaginatedPage, c as PaginationMapping, d as PaginationOptions, e as PaginationResult, b as PresentationPaginationOptions, P as PresentationPaginationResult, S as SlideContext, f as SlideContextDiagnostic, g as SlideContextOptions, h as paginateSlide, r as resolveSlideContext } from './pagination-BaUjDrTz.js';
|
|
13
19
|
export { ApplyPatchOptions, OPFPatchError, OPFPatchValidationError, PatchResult, applyPatch } from './patch.js';
|
|
14
20
|
export { DiffOptions, MergeConflict, MergeOptions, MergeResult, PresentationDiff, diff, merge } from './diff.js';
|
|
15
21
|
export { FormatOptions, OPFFormatError, format } from './format.js';
|
|
16
22
|
export { FromMarkdownOptions, FromMarkdownResult, OPFMarkdownError, ToMarkdownOptions, ToMarkdownResult, fromMarkdown, toMarkdown } from './markdown.js';
|
|
17
23
|
export { StringifyOptions, parse, stringify } from './deck.js';
|
|
18
|
-
export { DataCell, DataImportOptions,
|
|
19
|
-
export {
|
|
24
|
+
export { DataCell, DataImportOptions, ImportedChart, ImportedChartData, ImportedChartType, ImportedTable, IngestOptions, OPFDataImportError, TabularData, ingest, parseTabularData } from './data.js';
|
|
25
|
+
export { I as ChartComboSeries, C as ChartMapping, a as ChartNumberFix, b as ChartNumberFixOperation, c as ChartNumberFixOptions, D as DataCellValue, d as DataColumn, e as DataDiagnostic, f as DataDiagnosticCode, g as DataResolveOptions, h as DataSourceRef, i as DataStyledCell, j as DataTableCell, k as DataTableHeader, l as DataTableValue, m as DataTextRun, n as Dataset, o as DatasetRef, R as ResolvedChartData, p as ResolvedTableData, q as chartNumber, r as datasetDiagnostics, 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, E as suggestChartNumberFix, F as tableCellDisplayValue, G as toExcelNumberFormat, H as unusedDatasets } from './chart-data-BnNqgnC-.js';
|
|
20
26
|
export { FONT_POLICY, FontAvailability, FontAvailabilityCode, FontAvailabilityDiagnostic, FontLicenseClass, FontPolicyDecision, FontPolicyEntry, FontPolicyTable, FontReplacement, FontReplacementCompatibility, FontReplacementMeasurement, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './font-policy.js';
|
|
21
|
-
export {
|
|
27
|
+
export { a as DECK_FORMATS, D as DeckFormat, P as ParseOptions, d as deckFormatOf } from './deck-report-wszX7uo8.js';
|
|
22
28
|
import './json-BFSdESOE.js';
|
|
23
29
|
|
|
24
30
|
/**
|
|
@@ -28,6 +34,9 @@ import './json-BFSdESOE.js';
|
|
|
28
34
|
* `resolveVariables` leaves them as written (with an escaped `\{{slide.number}}` kept escaped) and they resolve
|
|
29
35
|
* here, per output slide: `resolveSlideVariables` for a slide's own strings and `substituteSlideTokens` for
|
|
30
36
|
* header and footer text, which `layoutFurniture` substitutes so it can mark each slide number as a live field.
|
|
37
|
+
* The organization logo references (`var:organization.logo.icon`, RR-71) are slide-scoped too, because the
|
|
38
|
+
* `onLight`/`onDark` choice follows each slide's background: `resolveSlideVariables` resolves them in a slide's own
|
|
39
|
+
* fields when it is given the presentation, and `layoutFurniture` in zone images.
|
|
31
40
|
* Pure: no clock, locale or I/O. See docs/templates-and-variables.md.
|
|
32
41
|
*/
|
|
33
42
|
/** The slide-scoped built-in names, in picker order. */
|
|
@@ -41,13 +50,22 @@ type SlideScopedBuiltin = (typeof SLIDE_SCOPED_BUILTINS)[number];
|
|
|
41
50
|
* text when it has none). The slide's own `design.header` and `design.footer` are left as written:
|
|
42
51
|
* `layoutFurniture` substitutes header and footer text itself and marks each slide number as a live field.
|
|
43
52
|
*
|
|
44
|
-
*
|
|
45
|
-
* `
|
|
46
|
-
*
|
|
53
|
+
* With `presentation` (RR-71) it also resolves the slide-scoped logo references, a whole string
|
|
54
|
+
* `var:organization.logo[.<shape>]` or `var:organization.<id>.logo[.<shape>]` in any field (an image block, the slide
|
|
55
|
+
* `image`), to the organization's asset for this slide's background (`darkBackground`, the host's luminance test:
|
|
56
|
+
* `onDark` first, else `onLight`); a reference whose organization has no logo is omitted, like an unfilled optional
|
|
57
|
+
* variable, and an unknown one stays as written (validation reports it). The slide's own `design.logo` is left for
|
|
58
|
+
* `resolveLogo`, and zone images for `layoutFurniture`.
|
|
59
|
+
*
|
|
60
|
+
* Engines call it on each output slide after pagination, with the same `slideNumber`, `slideCount` and
|
|
61
|
+
* `darkBackground` they pass to `composeSlide`, and compose and draw the result; `resolveSlideContext` returns it as
|
|
62
|
+
* `slide`. Returns the input object itself when nothing changes; never mutates it.
|
|
47
63
|
*/
|
|
48
64
|
declare function resolveSlideVariables<T>(slide: T, values: {
|
|
49
65
|
slideNumber: number;
|
|
50
66
|
slideCount?: number;
|
|
67
|
+
presentation?: unknown;
|
|
68
|
+
darkBackground?: boolean;
|
|
51
69
|
}): T;
|
|
52
70
|
|
|
53
71
|
/** Whether two records have the same content once embedded (`$schema`, `id` and `x-*` ignored). */
|
|
@@ -72,7 +90,7 @@ interface EmbedResult {
|
|
|
72
90
|
* embedded under `catalogs.default` (whose `source` is set to that catalog's). Records already embedded are kept as
|
|
73
91
|
* they are; catalog display metadata (`x-*`), `$schema` and `id` are stripped from the copies. Idempotent.
|
|
74
92
|
*/
|
|
75
|
-
declare function embed(document: unknown, options?: CatalogOptions): EmbedResult;
|
|
93
|
+
declare function embed$1(document: unknown, options?: CatalogOptions): EmbedResult;
|
|
76
94
|
/** A copied record that did not keep its reference. */
|
|
77
95
|
interface CopiedRecordRename {
|
|
78
96
|
kind: CatalogKind;
|
|
@@ -280,7 +298,7 @@ interface HeaderFooterFact {
|
|
|
280
298
|
/** The deck sets it to `false`. */
|
|
281
299
|
suppressed: boolean;
|
|
282
300
|
zones: string[];
|
|
283
|
-
/** Fields set in any zone:
|
|
301
|
+
/** Fields set in any zone: image, text, socials, date. */
|
|
284
302
|
fields: string[];
|
|
285
303
|
}
|
|
286
304
|
interface TableFact {
|
|
@@ -433,7 +451,7 @@ interface PresentationStats {
|
|
|
433
451
|
decorative: number;
|
|
434
452
|
missingAlt: number;
|
|
435
453
|
};
|
|
436
|
-
/** Logo images:
|
|
454
|
+
/** Logo images: every asset of every organization's logo (each shape, and each of onLight and onDark). */
|
|
437
455
|
logos: number;
|
|
438
456
|
watermarks: {
|
|
439
457
|
deck: boolean;
|
|
@@ -551,6 +569,121 @@ interface StatsOptions extends CatalogOptions {
|
|
|
551
569
|
/** Speaking pace for the notes estimate. Default 130. */
|
|
552
570
|
wordsPerMinute?: number;
|
|
553
571
|
}
|
|
554
|
-
declare function stats(presentation: unknown, options?: StatsOptions): PresentationStats;
|
|
572
|
+
declare function stats$1(presentation: unknown, options?: StatsOptions): PresentationStats;
|
|
573
|
+
|
|
574
|
+
interface EditOptions {
|
|
575
|
+
/** The catalogs the result's references resolve in. In Node the default catalog when omitted, as `opf edit` registers it; in the browser build none. */
|
|
576
|
+
catalogs?: readonly Catalog[];
|
|
577
|
+
/** `false` skips the check of the result (work in progress). Default true. */
|
|
578
|
+
validate?: boolean;
|
|
579
|
+
}
|
|
580
|
+
interface EditResult {
|
|
581
|
+
/** The patched deck (a copy). */
|
|
582
|
+
presentation: Presentation;
|
|
583
|
+
/** The warnings and notes of the format and references check (errors throw). */
|
|
584
|
+
findings: Finding[];
|
|
585
|
+
/** The patch that restores the input. */
|
|
586
|
+
inverse: JsonPatchOperation[];
|
|
587
|
+
}
|
|
588
|
+
/** Apply a JSON Patch (`add`, `remove`, `replace`, `move`, `copy`, `test`) to a deck and check the result's format and references. */
|
|
589
|
+
declare function edit$1(deck: unknown, patch: unknown, options?: EditOptions): EditResult;
|
|
590
|
+
|
|
591
|
+
/** The values of one deck, keyed by variable id. */
|
|
592
|
+
type FillRecord = Record<string, unknown>;
|
|
593
|
+
interface FillOptions extends Pick<ResolveVariablesOptions, "partial" | "examples"> {
|
|
594
|
+
/** The form of text data: `csv`, `tsv` or `json`. Omitted: `json` when the text starts with `{` or `[`, else `csv`. */
|
|
595
|
+
format?: "csv" | "tsv" | "json";
|
|
596
|
+
/** CSV: the field separator (default `,`; TSV uses a tab). */
|
|
597
|
+
delimiter?: string;
|
|
598
|
+
/** CSV and TSV: the first row names the columns (default true). */
|
|
599
|
+
header?: boolean;
|
|
600
|
+
/** Join the decks into one: the first deck's fields, then the slides of every deck in order (a repeated slide id gets the record number). */
|
|
601
|
+
combine?: boolean;
|
|
602
|
+
}
|
|
603
|
+
interface FilledDeck {
|
|
604
|
+
/** The record's position, from 1. */
|
|
605
|
+
index: number;
|
|
606
|
+
record: FillRecord;
|
|
607
|
+
presentation: Record<string, unknown>;
|
|
608
|
+
diagnostics: VariableDiagnostic[];
|
|
609
|
+
/** The variables that kept no value. */
|
|
610
|
+
unfilled: string[];
|
|
611
|
+
complete: boolean;
|
|
612
|
+
}
|
|
613
|
+
interface FillResult {
|
|
614
|
+
/** One deck per record, in order. */
|
|
615
|
+
decks: FilledDeck[];
|
|
616
|
+
/** With `combine`: the one deck. */
|
|
617
|
+
presentation?: Record<string, unknown>;
|
|
618
|
+
/** Every deck has a value for every variable. */
|
|
619
|
+
complete: boolean;
|
|
620
|
+
unfilled: string[];
|
|
621
|
+
/** The warnings and errors of every deck, one entry per code, variable and path, with the records it hit. An `error` (a required variable with no value, unless `partial`) means the deck is not usable as it is. */
|
|
622
|
+
diagnostics: (VariableDiagnostic & {
|
|
623
|
+
records: number[];
|
|
624
|
+
})[];
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* The records of text data. JSON keeps rich values (text runs, lists, image objects): an object is one record and an array of
|
|
628
|
+
* objects one record each. CSV, TSV and tabular JSON (`{ columns, rows }` or a row matrix) give one record per row, keyed by the
|
|
629
|
+
* header, with blank cells left unprovided. Throws `OPFDataImportError` for data that has no records.
|
|
630
|
+
*/
|
|
631
|
+
declare function fillRecords(raw: string, options?: Pick<FillOptions, "format" | "delimiter" | "header">): FillRecord[];
|
|
632
|
+
/**
|
|
633
|
+
* Fill a template: `data` is text (CSV, TSV or JSON), one record or a list of records; omitted, one deck is filled from the
|
|
634
|
+
* variables' own values (and their examples with `examples`). Each deck is the template resolved with one record
|
|
635
|
+
* (`resolveVariables`), no longer marked as a template. Throws `OPFDataImportError` for data without records and a `TypeError`
|
|
636
|
+
* for a template that is not an object.
|
|
637
|
+
*/
|
|
638
|
+
declare function fill(template: unknown, data?: string | FillRecord | readonly FillRecord[], options?: FillOptions): FillResult;
|
|
639
|
+
|
|
640
|
+
/** `validate` with the default catalog registered when `catalogs` is omitted, as `opf validate` does. */
|
|
641
|
+
declare const validate: typeof validate$1;
|
|
642
|
+
/** `stats` with the default catalog registered when `catalogs` is omitted, as `opf stats` does. */
|
|
643
|
+
declare const stats: typeof stats$1;
|
|
644
|
+
/** `paginate` with the default catalog registered when `catalogs` is omitted, as `opf paginate` does. Pass `fonts` (opf-render's `loadFonts()`) for measured page breaks. */
|
|
645
|
+
declare const paginate: typeof paginate$1;
|
|
646
|
+
/** `embed` with the default catalog registered when `catalogs` is omitted, as `opf embed` does. */
|
|
647
|
+
declare const embed: typeof embed$1;
|
|
648
|
+
/** `edit` with the default catalog registered for the check when `catalogs` is omitted, as `opf edit` does. */
|
|
649
|
+
declare const edit: typeof edit$1;
|
|
650
|
+
/**
|
|
651
|
+
* Convert a file, a deck or the bytes of a `.pptx` file. With an `output` path the format comes from its extension and the
|
|
652
|
+
* files are written: `.pdf`, `.pptx`, `.png` and `.svg` are exported (one PNG or SVG per slide, `slides/deck.png` giving
|
|
653
|
+
* `slides/deck-001.png`, ...; one selected slide is written to `output` itself), `.zip` is one archive of the slides (`format`
|
|
654
|
+
* `png`, the default, or `svg`), and `.opf.md`, `.yaml`/`.yml` or `.json` writes the deck in that form. Without an output path,
|
|
655
|
+
* pass `{ format }`: nothing is written and the files come back with their names and bytes.
|
|
656
|
+
*
|
|
657
|
+
* A `.pptx` input is imported first. Local images resolve next to the input file unless `assetDir` says otherwise; URLs are
|
|
658
|
+
* never fetched. Everything is produced before anything is written, and each file is written atomically, replacing an existing
|
|
659
|
+
* output (`overwrite: false` refuses one with `output-exists`, as the commands do without `--force`). Throws `OPFApiError` for the request and the files (`invalid-option`, `input-not-found`,
|
|
660
|
+
* `input-unreadable`, `invalid-presentation`, `output-exists`, `output-not-file`, `output-unwritable`), `OPFImportError` for the
|
|
661
|
+
* import step and `OPFExportError` for the export step (`peer-not-installed`, `peer-too-old`, `peer-load-failed`,
|
|
662
|
+
* `invalid-presentation`, `no-slides`, `all-slides-hidden`, `export-failed`, `import-failed`).
|
|
663
|
+
*
|
|
664
|
+
* Node only (also Bun and Deno): the browser build of the root rejects with `OPFApiError` `node-only`.
|
|
665
|
+
*/
|
|
666
|
+
declare function convert(input: ConvertInput, output: string, options?: ConvertOptions): Promise<ConvertResult>;
|
|
667
|
+
declare function convert(input: ConvertInput, options: ConvertOptions & {
|
|
668
|
+
format: ConvertFormat;
|
|
669
|
+
}): Promise<ConvertResult>;
|
|
670
|
+
/**
|
|
671
|
+
* Open a deck: a `.opf.md`, `.yaml`/`.yml` or `.json` file (the form named by the extension), or a PowerPoint file (a `.pptx`
|
|
672
|
+
* path or its bytes), imported. Returns the presentation. A deck file that fails the format and references check throws
|
|
673
|
+
* `OPFValidationError` (its findings located by line and column in the file); a PowerPoint file that cannot be imported throws
|
|
674
|
+
* `OPFImportError`; a missing file throws `OPFApiError` `input-not-found`. Warnings are not returned: `validate` reports them,
|
|
675
|
+
* and `convert("deck.pptx", "deck.opf.yaml")` returns what an import could not keep.
|
|
676
|
+
*
|
|
677
|
+
* Node only (also Bun and Deno): the browser build of the root rejects with `OPFApiError` `node-only`.
|
|
678
|
+
*/
|
|
679
|
+
declare function open(input: string | Uint8Array | ArrayBuffer, options?: OpenOptions): Promise<Presentation>;
|
|
680
|
+
/**
|
|
681
|
+
* Save a deck in the form its file name names (`.opf.md`, `.yaml`/`.yml` or `.json`), atomically, creating folders, replacing
|
|
682
|
+
* the file. It is checked for format and references first and an invalid deck is refused with `OPFValidationError`;
|
|
683
|
+
* `validate: false` writes work in progress, as an editor's autosave does. Returns `{ path, format }`.
|
|
684
|
+
*
|
|
685
|
+
* Node only (also Bun and Deno): the browser build of the root rejects with `OPFApiError` `node-only`.
|
|
686
|
+
*/
|
|
687
|
+
declare function save(deck: Presentation, path: string, options?: SaveOptions): Promise<SaveResult>;
|
|
555
688
|
|
|
556
|
-
export { Catalog, CatalogKind, CatalogOptions, type CatalogPatchOperation, type CatalogRecordChange, type CatalogRef, type CatalogUpdate, type CopiedRecordRename, type CopySlidesResult, type DatasetFact, type EmbedResult, type EmbeddedRecord, type HeaderFooterFact, type MoveToCustomErrorCode, type MoveToCustomPatchOperation, type MoveToCustomResult, type MovedRecord, OPFMoveToCustomError, Presentation, type PresentationStats, RecordProvenance, type ReferenceFact, type ResolvedDesignRecords, SLIDE_SCOPED_BUILTINS, type SlideScopedBuiltin, type SlideSizeFact, type SlideStats, type StatsOptions, type StatsSlideRef, type TableFact, UnresolvedReferenceDiagnostic, copySlides, embed, moveToCustom, resolveDesignRecords, resolveFontScheme, resolveSlideVariables, sameRecord, stats, updateFromCatalog };
|
|
689
|
+
export { Catalog, CatalogKind, CatalogOptions, type CatalogPatchOperation, type CatalogRecordChange, type CatalogRef, type CatalogUpdate, ConvertFormat, ConvertInput, ConvertOptions, ConvertResult, type CopiedRecordRename, type CopySlidesResult, type DatasetFact, type EditOptions, type EditResult, type EmbedResult, type EmbeddedRecord, type FillOptions, type FillRecord, type FillResult, type FilledDeck, Finding, type HeaderFooterFact, JsonPatchOperation, type MoveToCustomErrorCode, type MoveToCustomPatchOperation, type MoveToCustomResult, type MovedRecord, OPFMoveToCustomError, OpenOptions, Presentation, type PresentationStats, RecordProvenance, type ReferenceFact, ResolveVariablesOptions, type ResolvedDesignRecords, SLIDE_SCOPED_BUILTINS, SaveOptions, SaveResult, type SlideScopedBuiltin, type SlideSizeFact, type SlideStats, type StatsOptions, type StatsSlideRef, type TableFact, UnresolvedReferenceDiagnostic, VariableDiagnostic, convert, copySlides, edit, embed, fill, fillRecords, moveToCustom, open, paginate, resolveDesignRecords, resolveFontScheme, resolveSlideVariables, sameRecord, save, stats, updateFromCatalog, validate };
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
import { stats, embed, edit, OPFApiError, asApiError } from './chunk-QLFWWHRF.js';
|
|
2
|
+
export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, fill, fillRecords, moveToCustom, parseSlideSelection, sameRecord, updateFromCatalog } from './chunk-QLFWWHRF.js';
|
|
2
3
|
export { specFileEntries, specFileKinds, specFilePaths } from './chunk-HXHOZ7AH.js';
|
|
3
|
-
export { OPFDataImportError,
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
import './chunk-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
export { OPFDataImportError, ingest, parseTabularData } from './chunk-ZCFSDSUX.js';
|
|
5
|
+
import { defaultCatalog } from './chunk-WCG3THTD.js';
|
|
6
|
+
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-ZOHFLP3O.js';
|
|
7
|
+
export { fromMarkdown, toMarkdown } from './chunk-DBYZI75U.js';
|
|
8
|
+
import './chunk-NS3VYB57.js';
|
|
9
|
+
export { OPFMarkdownError } from './chunk-CJPDTLGD.js';
|
|
10
|
+
export { diff, merge } from './chunk-YWXB4XAT.js';
|
|
11
|
+
export { OPFPatchError, OPFPatchValidationError, applyPatch } from './chunk-YZXTXX2D.js';
|
|
12
|
+
export { OPFFormatError, format } from './chunk-JXVS7BJK.js';
|
|
13
|
+
import { paginate } from './chunk-64YSJZDH.js';
|
|
14
|
+
export { OPFPaginationError, paginateSlide } from './chunk-64YSJZDH.js';
|
|
15
|
+
import './chunk-VCGRMNY2.js';
|
|
16
|
+
import './chunk-RAKEVM52.js';
|
|
17
|
+
import { validate, OPFValidationError } from './chunk-JT3QXA22.js';
|
|
18
|
+
export { DEFAULT_CHART_PALETTE, DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, resolveSlideContext, validateCatalogRecord, validationCategories, validationRules } from './chunk-JT3QXA22.js';
|
|
19
|
+
export { CHART_TYPES, DEFAULT_VARIABLE_DATE_FORMAT, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, LANGUAGES, LOGO_SHAPES, OPFVariableError, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, VARIABLE_KINDS, chartNumber, coerceVariableValue, datasetDiagnostics, formatDataNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isTemplate, isXYChartType, listBuiltinVariables, listVariables, normalizeLanguageFamily, numberFormatError, resolveChartData, resolveDesignRecords, resolveFontScheme, resolveSlideVariables, resolveTableData, resolveVariables, suggestChartNumberFix, tableCellDisplayValue, toExcelNumberFormat, unusedDatasets, variableDeclarations } from './chunk-MBU42S5Y.js';
|
|
16
20
|
export { catalogDisplayKinds, catalogSchemaNames } from './chunk-TRDXRRQK.js';
|
|
17
21
|
export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, OPFCatalogsOptionError, OPFUnresolvedReferenceError, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, parseReference, resolveReference, unresolvedReference } from './chunk-SPFV27O5.js';
|
|
18
|
-
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-
|
|
22
|
+
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-6WW2EDUW.js';
|
|
19
23
|
export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-WXSPETQ6.js';
|
|
24
|
+
|
|
25
|
+
// src/index.ts
|
|
26
|
+
var DEFAULT_CATALOGS = [defaultCatalog];
|
|
27
|
+
var withDefaultCatalog = (options) => {
|
|
28
|
+
if (options === void 0) return { catalogs: DEFAULT_CATALOGS };
|
|
29
|
+
if (options === null || typeof options !== "object" || Array.isArray(options) || options.catalogs !== void 0) return options;
|
|
30
|
+
return { ...options, catalogs: DEFAULT_CATALOGS };
|
|
31
|
+
};
|
|
32
|
+
var validate2 = (input, options) => validate(input, withDefaultCatalog(options));
|
|
33
|
+
var stats2 = (presentation2, options) => stats(presentation2, withDefaultCatalog(options));
|
|
34
|
+
var paginate2 = (input, options) => paginate(input, withDefaultCatalog(options));
|
|
35
|
+
var embed2 = (document, options) => embed(document, withDefaultCatalog(options));
|
|
36
|
+
var edit2 = (deck, patch, options) => edit(deck, patch, withDefaultCatalog(options));
|
|
37
|
+
var engine = () => import('./conversion-KGDVJM75.js');
|
|
38
|
+
var rethrow = (error, fallback) => {
|
|
39
|
+
if (error instanceof OPFValidationError) throw error;
|
|
40
|
+
throw asApiError(OPFApiError, error, fallback);
|
|
41
|
+
};
|
|
42
|
+
async function convert(input, output, options = {}) {
|
|
43
|
+
try {
|
|
44
|
+
if (output !== null && typeof output === "object") return await (await engine()).convertFiles(input, void 0, output);
|
|
45
|
+
if (typeof output !== "string") throw new OPFApiError("convert takes an output file path, or options with a format.", "invalid-option");
|
|
46
|
+
return await (await engine()).convertFiles(input, output, options);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return rethrow(error, "convert-failed");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function open(input, options = {}) {
|
|
52
|
+
try {
|
|
53
|
+
return await (await engine()).openDeck(input, options);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return rethrow(error, "input-unreadable");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function save(deck, path, options = {}) {
|
|
59
|
+
try {
|
|
60
|
+
return await (await engine()).saveDeck(deck, path, options);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
return rethrow(error, "output-unwritable");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { convert, edit2 as edit, embed2 as embed, open, paginate2 as paginate, save, stats2 as stats, validate2 as validate };
|
package/dist/markdown.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as Presentation } from './presentation-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import './composition-
|
|
6
|
-
import './chart-data-
|
|
1
|
+
import { a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
2
|
+
import { P as Presentation } from './presentation-HondgJ3l.js';
|
|
3
|
+
import { a as Finding, b as FindingLocation } from './finding-CT_f_vbD.js';
|
|
4
|
+
import { a as ValidateOptions, V as ValidationReport } from './validation-types-PbGDrNUr.js';
|
|
5
|
+
import './composition-C-OoqvAr.js';
|
|
6
|
+
import './chart-data-BnNqgnC-.js';
|
|
7
7
|
import './json-BFSdESOE.js';
|
|
8
8
|
|
|
9
9
|
interface EmbeddedPart {
|
|
@@ -20,8 +20,12 @@ declare class OPFMarkdownError extends Error {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface ParseOptions {
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* How the Markdown is cut into slides. `auto` (the default): by `---` lines, and an outline (no `---` line, and two or more `# `
|
|
25
|
+
* headings outside fences, comments and notes) by its headings. `rules`: by `---` lines only, so a second `# ` heading on a slide is a second title.
|
|
26
|
+
* `headings`: a `# ` heading also starts a new slide (outline input).
|
|
27
|
+
*/
|
|
28
|
+
split?: "auto" | "rules" | "headings";
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
/**
|
package/dist/markdown.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { fromMarkdown, toMarkdown } from './chunk-
|
|
2
|
-
export { OPFMarkdownError } from './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
1
|
+
export { fromMarkdown, toMarkdown } from './chunk-DBYZI75U.js';
|
|
2
|
+
export { OPFMarkdownError } from './chunk-CJPDTLGD.js';
|
|
3
|
+
import './chunk-VCGRMNY2.js';
|
|
4
|
+
import './chunk-RAKEVM52.js';
|
|
5
|
+
import './chunk-JT3QXA22.js';
|
|
6
|
+
import './chunk-MBU42S5Y.js';
|
|
7
7
|
import './chunk-TRDXRRQK.js';
|
|
8
8
|
import './chunk-SPFV27O5.js';
|
|
9
|
-
import './chunk-
|
|
9
|
+
import './chunk-6WW2EDUW.js';
|
package/dist/node-engine.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
export { b as DeckReport, c as DeckReportOptions, r as readDeckReport } from './deck-report-
|
|
2
|
-
import { F as FontsHandle,
|
|
3
|
-
export {
|
|
4
|
-
import './catalog-refs-
|
|
5
|
-
import './
|
|
6
|
-
import './
|
|
7
|
-
import './
|
|
8
|
-
import './
|
|
9
|
-
import './
|
|
1
|
+
export { b as DeckReport, c as DeckReportOptions, r as readDeckReport } from './deck-report-wszX7uo8.js';
|
|
2
|
+
import { F as FontsHandle, E as EmbeddedFace, R as Renderer, a as Reporter, P as Peer, b as PptxModule, O as OPFApiError } from './conversion-C5foedh6.js';
|
|
3
|
+
export { C as ConversionPlan, D as Diagnostic, c as EXPORT_FORMATS, d as EXPORT_TEXT, e as ExportContext, f as ExportFile, g as ExportFontSummary, h as ExportFormat, i as ExportOptions, j as ExportResult, k as ExportRun, l as ExportText, I as ImportOptions, m as ImportResult, n as OPFExportError, o as OPFImportError, p as PEER_RANGES, q as PPTX_PACKAGE, r as PreparedExport, s as RENDER_EXTRAS, t as RENDER_PACKAGE, u as ReportFinding, v as ResolvedExportOptions, S as SlideSelection, w as Source, V as VERSIONS, x as asApiError, y as checkDate, z as checkOptions, A as checkRenamedOptions, B as checkScale, G as deckFileFormat, H as exportFormatOf, J as finishReport, K as importPresentation, L as loadPptx, M as loadRenderer, N as locatePackage, Q as missingPeerFrom, T as parseSlideSelection, U as planConversion, W as prepareExport, X as reaches, Y as readInput, Z as reportThrown, _ as resolveExportOptions, $ as runExport, a0 as runPreparedExport, a1 as writePlanned } from './conversion-C5foedh6.js';
|
|
4
|
+
import { a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
5
|
+
import { P as PresentationPaginationResult } from './pagination-BaUjDrTz.js';
|
|
6
|
+
import './presentation-HondgJ3l.js';
|
|
7
|
+
import './validation-types-PbGDrNUr.js';
|
|
8
|
+
import './composition-C-OoqvAr.js';
|
|
9
|
+
import './chart-data-BnNqgnC-.js';
|
|
10
|
+
import './finding-CT_f_vbD.js';
|
|
10
11
|
import './json-BFSdESOE.js';
|
|
11
12
|
|
|
12
|
-
/** `1,3-5`, `2-` (to the end) and `-3` (from the start), one-based, in ascending order without repeats. */
|
|
13
|
-
declare function parseSlideSelection(spec: string, total: number, label?: string): number[];
|
|
14
13
|
/** `deck.opf.json` and `deck.pptx` both give `deck`; stdin gives `deck`. */
|
|
15
14
|
declare function stemOf(input: string): string;
|
|
16
15
|
/**
|
|
@@ -36,7 +35,7 @@ declare function pointerOf(location: string): string;
|
|
|
36
35
|
interface PreparedFonts {
|
|
37
36
|
/** The fonts handle of opf-render `loadFonts()`: passed as `{ fonts }` to every deck-level call. */
|
|
38
37
|
handle: FontsHandle;
|
|
39
|
-
/** Absolute paths of the --
|
|
38
|
+
/** Absolute paths of the --fonts files, in load order. */
|
|
40
39
|
userFonts: string[];
|
|
41
40
|
}
|
|
42
41
|
/** Font files directly inside each directory (no recursion), sorted by name so the load order is the same everywhere. */
|
|
@@ -44,7 +43,7 @@ declare function listFontDirectories(directories: string[], label?: string): Pro
|
|
|
44
43
|
/**
|
|
45
44
|
* The office pack (Carlito, Intos, the open families font schemes select and the open replacements the font policy
|
|
46
45
|
* routes to, with lazy faces loaded on demand), visual substitution, and Noto script packages for the scripts the
|
|
47
|
-
* deck's text draws when they are installed. `faces` are the --
|
|
46
|
+
* deck's text draws when they are installed. `faces` are the --fonts files, loaded first.
|
|
48
47
|
*/
|
|
49
48
|
declare function prepareFonts(renderer: Renderer, presentation: unknown, userFonts: string[], reporter: Reporter, embedScriptFonts?: boolean): Promise<PreparedFonts>;
|
|
50
49
|
/** A fonts handle lent to one export. `release` returns it; until then no other export uses the shared handle. */
|
|
@@ -61,10 +60,11 @@ interface FontsLease {
|
|
|
61
60
|
*/
|
|
62
61
|
declare function leaseSharedFonts(renderer: Renderer, presentation: unknown, userFonts: string[], reporter: Reporter, embedScriptFonts?: boolean): Promise<FontsLease | undefined>;
|
|
63
62
|
/**
|
|
64
|
-
* Faces an SVG should carry
|
|
65
|
-
* text names its family
|
|
63
|
+
* Faces an SVG should carry for `text`. `"fonts"` (the default) marks every face `embed: "used"`, so the renderer embeds a face only
|
|
64
|
+
* when the slide's text names its family and a slide in one family ships kilobytes of font rather than the whole pack. `"system"`
|
|
65
|
+
* embeds none, and `"paths"` draws the text as outlines from the fonts handle itself, so it has no faces to list.
|
|
66
66
|
*/
|
|
67
|
-
declare function embeddedFor(handle: FontsHandle,
|
|
67
|
+
declare function embeddedFor(handle: FontsHandle, text?: "fonts" | "system" | "paths"): (EmbeddedFace & {
|
|
68
68
|
embed?: "used";
|
|
69
69
|
})[];
|
|
70
70
|
|
|
@@ -91,4 +91,24 @@ declare function createZip(entries: {
|
|
|
91
91
|
bytes: Uint8Array;
|
|
92
92
|
}[]): Uint8Array;
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
interface PaginateDeckOptions {
|
|
95
|
+
/** Folders of `.ttf` and `.otf` files, loaded before the bundled pack (as `--fonts`). They need opf-render. */
|
|
96
|
+
fontFolders?: readonly string[];
|
|
97
|
+
catalogs?: readonly Catalog[];
|
|
98
|
+
/** Receives the font diagnostics. */
|
|
99
|
+
reporter: Reporter;
|
|
100
|
+
/** Name options as the command's flags in messages. */
|
|
101
|
+
flags?: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface PaginatedDeck {
|
|
104
|
+
result: PresentationPaginationResult;
|
|
105
|
+
/** Why the layout is estimated: the missing or too old peer (`peer-not-installed`, `peer-too-old`) that measuring needs. */
|
|
106
|
+
estimated?: OPFApiError;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Paginate with measured text when opf-render and its fonts load, else with core's estimate (and `estimated` saying why). With
|
|
110
|
+
* `fontFolders` the fonts are required, so a missing renderer throws. Throws `OPFPaginationError` when content cannot fit.
|
|
111
|
+
*/
|
|
112
|
+
declare function paginateDeck(deck: unknown, options: PaginateDeckOptions): Promise<PaginatedDeck>;
|
|
113
|
+
|
|
114
|
+
export { FontsHandle, type ImportRun, OPFApiError, type PaginateDeckOptions, type PaginatedDeck, Peer, type PlannedFile, PptxModule, Renderer, Reporter, checkDestinations, createZip, deckStem, embeddedFor, leaseSharedFonts, listFontDirectories, paginateDeck, pointerOf, prepareFonts, runImport, stemOf, writeFiles };
|
package/dist/node-engine.js
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { DEFAULT_CATALOGS, loadRenderer, listFontDirectories, leaseSharedFonts, prepareFonts } from './chunk-KXBZ6ZSB.js';
|
|
2
|
+
export { EXPORT_FORMATS, EXPORT_TEXT, PEER_RANGES, PPTX_PACKAGE, RENDER_EXTRAS, RENDER_PACKAGE, Reporter, VERSIONS, checkDate, checkDestinations, checkOptions, checkRenamedOptions, checkScale, createZip, deckFileFormat, deckStem, embeddedFor, exportFormatOf, finishReport, importPresentation, leaseSharedFonts, listFontDirectories, loadPptx, loadRenderer, locatePackage, missingPeerFrom, planConversion, pointerOf, prepareExport, prepareFonts, reaches, readInput, reportThrown, resolveExportOptions, runExport, runImport, runPreparedExport, stemOf, writeFiles, writePlanned } from './chunk-KXBZ6ZSB.js';
|
|
3
|
+
import { OPFApiError } from './chunk-QLFWWHRF.js';
|
|
4
|
+
export { OPFApiError, OPFExportError, OPFImportError, asApiError, parseSlideSelection } from './chunk-QLFWWHRF.js';
|
|
3
5
|
import './chunk-HXHOZ7AH.js';
|
|
4
|
-
import './chunk-
|
|
6
|
+
import './chunk-ZCFSDSUX.js';
|
|
5
7
|
import './chunk-WCG3THTD.js';
|
|
6
|
-
export { readDeckReport } from './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
17
|
-
import './chunk-
|
|
8
|
+
export { readDeckReport } from './chunk-ZOHFLP3O.js';
|
|
9
|
+
import './chunk-DBYZI75U.js';
|
|
10
|
+
import './chunk-NS3VYB57.js';
|
|
11
|
+
import './chunk-CJPDTLGD.js';
|
|
12
|
+
import './chunk-YWXB4XAT.js';
|
|
13
|
+
import './chunk-YZXTXX2D.js';
|
|
14
|
+
import './chunk-JXVS7BJK.js';
|
|
15
|
+
import { paginate } from './chunk-64YSJZDH.js';
|
|
16
|
+
import './chunk-VCGRMNY2.js';
|
|
17
|
+
import './chunk-RAKEVM52.js';
|
|
18
|
+
import './chunk-JT3QXA22.js';
|
|
19
|
+
import './chunk-MBU42S5Y.js';
|
|
18
20
|
import './chunk-TRDXRRQK.js';
|
|
19
21
|
import './chunk-SPFV27O5.js';
|
|
20
|
-
import './chunk-
|
|
22
|
+
import './chunk-6WW2EDUW.js';
|
|
21
23
|
import './chunk-WXSPETQ6.js';
|
|
24
|
+
|
|
25
|
+
// src/node/paginate.ts
|
|
26
|
+
async function paginateDeck(deck, options) {
|
|
27
|
+
const catalogs = options.catalogs ?? DEFAULT_CATALOGS;
|
|
28
|
+
const folders = options.fontFolders ?? [];
|
|
29
|
+
let lease;
|
|
30
|
+
try {
|
|
31
|
+
const renderer = await loadRenderer();
|
|
32
|
+
const userFonts = await listFontDirectories([...folders], options.flags ? "--fonts" : "fonts");
|
|
33
|
+
lease = await leaseSharedFonts(renderer, deck, userFonts, options.reporter);
|
|
34
|
+
const handle = lease?.handle ?? (await prepareFonts(renderer, deck, userFonts, options.reporter)).handle;
|
|
35
|
+
return { result: paginate(deck, { fonts: handle, catalogs }) };
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (error instanceof OPFApiError && (error.code === "peer-not-installed" || error.code === "peer-too-old") && !folders.length) return { result: paginate(deck, { catalogs }), estimated: error };
|
|
38
|
+
throw error;
|
|
39
|
+
} finally {
|
|
40
|
+
lease?.release();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { paginateDeck };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { U as UnresolvedReferenceDiagnostic, R as RecordProvenance,
|
|
1
|
+
import { C as ComposeSlideOptions, F as Fonts, L as LayoutDiagnostic } from './composition-C-OoqvAr.js';
|
|
2
|
+
import { U as UnresolvedReferenceDiagnostic, R as RecordProvenance, b as CatalogOptions, a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* One slide's composition context: the layout, canvas, theme and font families that `composeSlide` needs,
|
|
@@ -25,7 +25,8 @@ interface SlideContextOptions extends CatalogOptions {
|
|
|
25
25
|
interface SlideContext {
|
|
26
26
|
/**
|
|
27
27
|
* The slide to compose and draw: slide `index` with `{{slide.number}}`, `{{slide.section}}` and
|
|
28
|
-
* `{{deck.slideCount}}` substituted (`resolveSlideVariables`) for `options.slideNumber` and `options.slideCount
|
|
28
|
+
* `{{deck.slideCount}}` substituted (`resolveSlideVariables`) for `options.slideNumber` and `options.slideCount`, and its
|
|
29
|
+
* logo references (`var:organization.logo.icon` in an image field) resolved for `options.darkBackground`.
|
|
29
30
|
* Its own header and footer text keeps the tokens: `layoutFurniture` substitutes them and marks each slide number
|
|
30
31
|
* as a live field. The source slide object itself when it carries no slide-scoped token.
|
|
31
32
|
*/
|
|
@@ -126,8 +127,10 @@ interface PresentationPaginationResult {
|
|
|
126
127
|
pages: (PaginatedPage & {
|
|
127
128
|
sourceSlideIndex: number;
|
|
128
129
|
})[];
|
|
130
|
+
/** How the page breaks were chosen: `measured` with the `fonts` handle's text measurement, `estimated` with core's portable estimate (no `fonts`). */
|
|
131
|
+
layout: 'measured' | 'estimated';
|
|
129
132
|
}
|
|
130
133
|
/** Resolve the slides' references (the document's catalogs groups, then the registered catalogs) and paginate a complete presentation without mutating it. */
|
|
131
134
|
declare function paginate(input: unknown, options?: PresentationPaginationOptions): PresentationPaginationResult;
|
|
132
135
|
|
|
133
|
-
export { OPFPaginationError as O, type
|
|
136
|
+
export { OPFPaginationError as O, type PresentationPaginationResult as P, type SlideContext as S, type PaginatedPage as a, type PresentationPaginationOptions as b, type PaginationMapping as c, type PaginationOptions as d, type PaginationResult as e, type SlideContextDiagnostic as f, type SlideContextOptions as g, paginateSlide as h, paginate as p, resolveSlideContext as r };
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './composition-
|
|
2
|
-
import './catalog-refs-
|
|
3
|
-
export { O as OPFPaginationError,
|
|
4
|
-
import './chart-data-
|
|
1
|
+
import './composition-C-OoqvAr.js';
|
|
2
|
+
import './catalog-refs-BSfGELpt.js';
|
|
3
|
+
export { O as OPFPaginationError, a as PaginatedPage, c as PaginationMapping, d as PaginationOptions, e as PaginationResult, b as PresentationPaginationOptions, P as PresentationPaginationResult, p as paginate, h as paginateSlide } from './pagination-BaUjDrTz.js';
|
|
4
|
+
import './chart-data-BnNqgnC-.js';
|
package/dist/pagination.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { OPFPaginationError, paginate, paginateSlide } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { OPFPaginationError, paginate, paginateSlide } from './chunk-64YSJZDH.js';
|
|
2
|
+
import './chunk-JT3QXA22.js';
|
|
3
|
+
import './chunk-MBU42S5Y.js';
|
|
4
4
|
import './chunk-TRDXRRQK.js';
|
|
5
5
|
import './chunk-SPFV27O5.js';
|
|
6
|
-
import './chunk-
|
|
6
|
+
import './chunk-6WW2EDUW.js';
|
package/dist/patch.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as FindingReport, a as Finding, J as JsonPatchOperation } from './finding-CT_f_vbD.js';
|
|
2
2
|
|
|
3
3
|
type JsonPointer = string;
|
|
4
4
|
type PatchErrorCode = "invalid-patch" | "invalid-patch-operation" | "unsupported-patch-operation" | "invalid-json-pointer" | "patch-path-missing" | "patch-parent-missing" | "invalid-array-index" | "patch-test-failed" | "patch-invalid-move" | "patch-root-remove" | "patch-invalid-document";
|