@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.
Files changed (66) hide show
  1. package/README.md +4 -4
  2. package/dist/browser.js +38 -0
  3. package/dist/{catalog-refs-C4K4y-vh.d.ts → catalog-refs-BSfGELpt.d.ts} +1 -1
  4. package/dist/{catalog-schemas-g7RFQBdc.d.ts → catalog-schemas-CinPh5WA.d.ts} +1 -1
  5. package/dist/catalog.d.ts +2 -2
  6. package/dist/{chart-data-DTxdRRT1.d.ts → chart-data-BnNqgnC-.d.ts} +1 -1
  7. package/dist/{chunk-O2CX5NEH.js → chunk-64YSJZDH.js} +6 -5
  8. package/dist/{chunk-RA64UQKI.js → chunk-6WW2EDUW.js} +95 -71
  9. package/dist/{chunk-IS5H5JKH.js → chunk-CJPDTLGD.js} +1 -1
  10. package/dist/{chunk-BIC3SWPK.js → chunk-DBYZI75U.js} +30 -5
  11. package/dist/{chunk-NLNYNBTS.js → chunk-JT3QXA22.js} +25 -24
  12. package/dist/{chunk-YT7FMQER.js → chunk-JXVS7BJK.js} +1 -1
  13. package/dist/{chunk-IPW5BS3X.js → chunk-KXBZ6ZSB.js} +190 -172
  14. package/dist/{chunk-CW7GEAV3.js → chunk-MBU42S5Y.js} +291 -133
  15. package/dist/{chunk-TCD2FB2K.js → chunk-NS3VYB57.js} +5 -5
  16. package/dist/{chunk-WWYWFVOI.js → chunk-QLFWWHRF.js} +151 -25
  17. package/dist/{chunk-PPROJP2E.js → chunk-RAKEVM52.js} +1 -1
  18. package/dist/{chunk-ESRYBYLY.js → chunk-VCGRMNY2.js} +1 -1
  19. package/dist/{chunk-M4UR3NPN.js → chunk-YWXB4XAT.js} +2 -2
  20. package/dist/{chunk-O3CVNJTL.js → chunk-YZXTXX2D.js} +1 -1
  21. package/dist/{chunk-O263APNI.js → chunk-ZCFSDSUX.js} +3 -3
  22. package/dist/{chunk-N4EVOFEA.js → chunk-ZOHFLP3O.js} +4 -4
  23. package/dist/{composition-BbZ_9C-c.d.ts → composition-C-OoqvAr.d.ts} +80 -40
  24. package/dist/composition.d.ts +3 -3
  25. package/dist/composition.js +1 -1
  26. package/dist/{conversion-SBpTOwdg.d.ts → conversion-C5foedh6.d.ts} +96 -38
  27. package/dist/conversion-KGDVJM75.js +21 -0
  28. package/dist/convert.d.ts +4 -4
  29. package/dist/convert.js +7 -7
  30. package/dist/data.d.ts +7 -7
  31. package/dist/data.js +2 -2
  32. package/dist/{deck-report-Bx3naFlF.d.ts → deck-report-wszX7uo8.d.ts} +5 -5
  33. package/dist/deck.d.ts +8 -8
  34. package/dist/deck.js +10 -10
  35. package/dist/diff.d.ts +1 -1
  36. package/dist/diff.js +5 -5
  37. package/dist/docs.js +28 -28
  38. package/dist/examples.d.ts +1 -1
  39. package/dist/examples.js +181 -214
  40. package/dist/{finding-CDQ_wH8j.d.ts → finding-CT_f_vbD.d.ts} +1 -1
  41. package/dist/format.js +2 -2
  42. package/dist/index.d.ts +153 -20
  43. package/dist/index.js +62 -15
  44. package/dist/markdown.d.ts +12 -8
  45. package/dist/markdown.js +7 -7
  46. package/dist/node-engine.d.ts +37 -17
  47. package/dist/node-engine.js +39 -16
  48. package/dist/{pagination-BhX4M48Y.d.ts → pagination-BaUjDrTz.d.ts} +7 -4
  49. package/dist/pagination.d.ts +4 -4
  50. package/dist/pagination.js +4 -4
  51. package/dist/patch.d.ts +1 -1
  52. package/dist/patch.js +4 -4
  53. package/dist/{presentation-fb8CZmRq.d.ts → presentation-HondgJ3l.d.ts} +269 -382
  54. package/dist/repo-readme.js +1 -1
  55. package/dist/schemas.d.ts +4 -2
  56. package/dist/schemas.js +1 -1
  57. package/dist/spec/schemas/opf.schema.json +65 -70
  58. package/dist/types.d.ts +3 -3
  59. package/dist/{validation-types-iZbXfES6.d.ts → validation-types-PbGDrNUr.d.ts} +12 -7
  60. package/dist/validator.d.ts +8 -8
  61. package/dist/validator.js +3 -3
  62. package/dist/yaml.d.ts +6 -6
  63. package/dist/yaml.js +7 -7
  64. package/package.json +12 -10
  65. package/dist/node.d.ts +0 -60
  66. package/dist/node.js +0 -54
package/dist/node.d.ts DELETED
@@ -1,60 +0,0 @@
1
- export { SchemaEntry, SchemaName, audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './schemas.js';
2
- export { DEFAULT_CHART_PALETTE, DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, validate, validateCatalogRecord, validationRules } from './validator.js';
3
- export { B as BuiltinVariableInfo, C as Contract, D as DEFAULT_VARIABLE_DATE_FORMAT, O as OPFVariableError, R as ResolveVariablesOptions, a as ResolveVariablesResult, V as VARIABLE_KINDS, b as ValidateFonts, c as ValidateOptions, d as ValidationCategory, e as ValidationChecks, f as ValidationReport, g as ValidationRuleCost, h as ValidationRuleInfo, i as ValidationThresholds, j as VariableDeclaration, k as VariableDiagnostic, 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, v as isTemplate, w as listBuiltinVariables, x as listVariables, y as resolveVariables, z as validationCategories, A as variableDeclarations } from './validation-types-iZbXfES6.js';
4
- export { CatalogPatchOperation, CatalogRecordChange, CatalogRef, CatalogUpdate, CopiedRecordRename, CopySlidesResult, DatasetFact, EmbedResult, EmbeddedRecord, HeaderFooterFact, MoveToCustomErrorCode, MoveToCustomPatchOperation, MoveToCustomResult, MovedRecord, OPFMoveToCustomError, PresentationStats, ReferenceFact, ResolvedDesignRecords, SLIDE_SCOPED_BUILTINS, SlideScopedBuiltin, SlideSizeFact, SlideStats, StatsOptions, StatsSlideRef, TableFact, copySlides, embed, moveToCustom, resolveDesignRecords, resolveFontScheme, resolveSlideVariables, sameRecord, stats, updateFromCatalog } from './index.js';
5
- export { SpecFileEntry, SpecFileKind, SpecFilePath, specFileEntries, specFileKinds, specFilePaths } from './spec-files.js';
6
- import { P as Presentation } from './presentation-fb8CZmRq.js';
7
- export { Audience, ChartType, ColorScheme, FontScheme, Language, Layout, Narrative, Purpose, SocialPlatform, Theme, Tone } from './types.js';
8
- export { C as CATALOG_GROUP_PATTERN, a as CATALOG_REFERENCE_PATTERN, b as Catalog, c as CatalogKind, d as CatalogOptions, e as CatalogRecordMap, 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-C4K4y-vh.js';
9
- export { F as Finding, a as FindingCategory, b as FindingFix, c as FindingFocus, d as FindingLocation, e as FindingReport, f as FindingSeverity, g as FindingSuggestion, J as JsonPatchOperation, V as ValidationIssue } from './finding-CDQ_wH8j.js';
10
- export { C as CHART_TYPES, a 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, F as FontFamilies, e as Fonts, L as LANGUAGES, f as LanguageFamilyName, g as LanguageVocabulary, h as LayoutDiagnostic, M as MeasureTextWidth, S as SOCIAL_PLATFORMS, i as SocialPlatformVocabulary, T as TextMeasurement, j as TextStyle, n as normalizeLanguageFamily } from './composition-BbZ_9C-c.js';
11
- export { C as CatalogDisplayKind, a as CatalogRecordKind, c as catalogDisplayKinds, b as catalogSchemaNames } from './catalog-schemas-g7RFQBdc.js';
12
- export { O as OPFPaginationError, P as PaginatedPage, a as PaginationMapping, b as PaginationOptions, c as PaginationResult, d as PresentationPaginationOptions, e as PresentationPaginationResult, S as SlideContext, f as SlideContextDiagnostic, g as SlideContextOptions, p as paginate, h as paginateSlide, r as resolveSlideContext } from './pagination-BhX4M48Y.js';
13
- export { ApplyPatchOptions, OPFPatchError, OPFPatchValidationError, PatchResult, applyPatch } from './patch.js';
14
- export { DiffOptions, MergeConflict, MergeOptions, MergeResult, PresentationDiff, diff, merge } from './diff.js';
15
- export { FormatOptions, OPFFormatError, format } from './format.js';
16
- export { FromMarkdownOptions, FromMarkdownResult, OPFMarkdownError, ToMarkdownOptions, ToMarkdownResult, fromMarkdown, toMarkdown } from './markdown.js';
17
- export { StringifyOptions, parse, stringify } from './deck.js';
18
- export { DataCell, DataImportOptions, ImportDataOptions, ImportedChart, ImportedChartData, ImportedChartType, ImportedTable, OPFDataImportError, TabularData, importData, parseTabularData } from './data.js';
19
- export { C as ChartComboSeries, a as ChartMapping, b as ChartNumberFix, c as ChartNumberFixOperation, d as ChartNumberFixOptions, D as DataCellValue, e as DataColumn, f as DataDiagnostic, g as DataDiagnosticCode, h as DataResolveOptions, i as DataSourceRef, j as DataStyledCell, k as DataTableCell, l as DataTableHeader, m as DataTableValue, n as DataTextRun, o as Dataset, p as DatasetRef, R as ResolvedChartData, q as ResolvedTableData, r as chartNumber, s as datasetDiagnostics, t as formatDataNumber, u as fromExcelNumberFormat, v as inlineChartData, w as inlineDatasets, x as inlineTableData, y as isDatasetRef, z as isXYChartType, A as numberFormatError, B as resolveChartData, E as resolveTableData, F as suggestChartNumberFix, G as tableCellDisplayValue, H as toExcelNumberFormat, I as unusedDatasets } from './chart-data-DTxdRRT1.js';
20
- export { FONT_POLICY, FontAvailability, FontAvailabilityCode, FontAvailabilityDiagnostic, FontLicenseClass, FontPolicyDecision, FontPolicyEntry, FontPolicyTable, FontReplacement, FontReplacementCompatibility, FontReplacementMeasurement, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './font-policy.js';
21
- import { C as ConvertInput, a as ConvertOptions, b as ConvertResult, c as ConvertFormat, O as OpenOptions, S as SaveOptions, d as SaveResult } from './conversion-SBpTOwdg.js';
22
- export { e as ConvertedFile, E as ExportFormat, F as FontsHandle, f as OPFApiError, g as OPFExportError, h as OPFImportError } from './conversion-SBpTOwdg.js';
23
- export { defaultCatalog } from './catalog.js';
24
- export { D as DECK_FORMATS, a as DeckFormat, P as ParseOptions, d as deckFormatOf } from './deck-report-Bx3naFlF.js';
25
- import './json-BFSdESOE.js';
26
-
27
- /**
28
- * Convert a file, a deck or the bytes of a `.pptx` file. With an `output` path the format comes from its extension and the
29
- * files are written: `.pdf`, `.pptx`, `.png` and `.svg` are exported (one PNG or SVG per slide, `slides/deck.png` giving
30
- * `slides/deck-001.png`, ...; one selected slide is written to `output` itself), `.zip` is one archive of the slides (`format`
31
- * `png`, the default, or `svg`), and `.opf.md`, `.yaml`/`.yml` or `.json` writes the deck in that form. Without an output path,
32
- * pass `{ format }`: nothing is written and the files come back with their names and bytes.
33
- *
34
- * A `.pptx` input is imported first. Local images resolve next to the input file unless `assetDir` says otherwise; URLs are
35
- * never fetched. Everything is produced before anything is written, and each file is written atomically, replacing an existing
36
- * 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`,
37
- * `input-unreadable`, `invalid-presentation`, `output-exists`, `output-not-file`, `output-unwritable`), `OPFImportError` for the
38
- * import step and `OPFExportError` for the export step (`peer-not-installed`, `peer-too-old`, `peer-load-failed`,
39
- * `invalid-presentation`, `no-slides`, `all-slides-hidden`, `export-failed`, `import-failed`).
40
- */
41
- declare function convert(input: ConvertInput, output: string, options?: ConvertOptions): Promise<ConvertResult>;
42
- declare function convert(input: ConvertInput, options: ConvertOptions & {
43
- format: ConvertFormat;
44
- }): Promise<ConvertResult>;
45
- /**
46
- * Open a deck: a `.opf.md`, `.yaml`/`.yml` or `.json` file (the form named by the extension), or a PowerPoint file (a `.pptx`
47
- * path or its bytes), imported. Returns the presentation. A deck file that fails the format and references check throws
48
- * `OPFValidationError` (its findings located by line and column in the file); a PowerPoint file that cannot be imported throws
49
- * `OPFImportError`; a missing file throws `OPFApiError` `input-not-found`. Warnings are not returned: `validate` reports them,
50
- * and `convert("deck.pptx", "deck.opf.yaml")` returns what an import could not keep.
51
- */
52
- declare function open(input: string | Uint8Array | ArrayBuffer, options?: OpenOptions): Promise<Presentation>;
53
- /**
54
- * Save a deck in the form its file name names (`.opf.md`, `.yaml`/`.yml` or `.json`), atomically, creating folders, replacing
55
- * the file. It is checked for format and references first and an invalid deck is refused with `OPFValidationError`;
56
- * `validate: false` writes work in progress, as an editor's autosave does. Returns `{ path, format }`.
57
- */
58
- declare function save(deck: Presentation, path: string, options?: SaveOptions): Promise<SaveResult>;
59
-
60
- export { ConvertFormat, ConvertInput, ConvertOptions, ConvertResult, OpenOptions, Presentation, SaveOptions, SaveResult, convert, open, save };
package/dist/node.js DELETED
@@ -1,54 +0,0 @@
1
- import { convertFiles, OPFApiError, openDeck, saveDeck, asApiError } from './chunk-IPW5BS3X.js';
2
- export { OPFApiError, OPFExportError, OPFImportError } from './chunk-IPW5BS3X.js';
3
- export { OPFMoveToCustomError, copySlides, embed, moveToCustom, sameRecord, stats, updateFromCatalog } from './chunk-WWYWFVOI.js';
4
- export { specFileEntries, specFileKinds, specFilePaths } from './chunk-HXHOZ7AH.js';
5
- export { OPFDataImportError, importData, parseTabularData } from './chunk-O263APNI.js';
6
- export { defaultCatalog } from './chunk-WCG3THTD.js';
7
- export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-N4EVOFEA.js';
8
- export { fromMarkdown, toMarkdown } from './chunk-BIC3SWPK.js';
9
- import './chunk-TCD2FB2K.js';
10
- export { OPFMarkdownError } from './chunk-IS5H5JKH.js';
11
- export { diff, merge } from './chunk-M4UR3NPN.js';
12
- export { OPFPatchError, OPFPatchValidationError, applyPatch } from './chunk-O3CVNJTL.js';
13
- export { OPFFormatError, format } from './chunk-YT7FMQER.js';
14
- export { OPFPaginationError, paginate, paginateSlide } from './chunk-O2CX5NEH.js';
15
- import './chunk-ESRYBYLY.js';
16
- import './chunk-PPROJP2E.js';
17
- import { OPFValidationError } from './chunk-NLNYNBTS.js';
18
- export { DEFAULT_CHART_PALETTE, DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, resolveSlideContext, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-NLNYNBTS.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, 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-CW7GEAV3.js';
20
- export { catalogDisplayKinds, catalogSchemaNames } from './chunk-TRDXRRQK.js';
21
- export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, OPFCatalogsOptionError, OPFUnresolvedReferenceError, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, parseReference, resolveReference, unresolvedReference } from './chunk-SPFV27O5.js';
22
- export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-RA64UQKI.js';
23
- export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-WXSPETQ6.js';
24
-
25
- // src/node.ts
26
- var rethrow = (error, fallback) => {
27
- if (error instanceof OPFValidationError) throw error;
28
- throw asApiError(OPFApiError, error, fallback);
29
- };
30
- async function convert(input, output, options = {}) {
31
- try {
32
- if (output !== null && typeof output === "object") return await convertFiles(input, void 0, output);
33
- if (typeof output !== "string") throw new OPFApiError("convert takes an output file path, or options with a format.", "invalid-option");
34
- return await convertFiles(input, output, options);
35
- } catch (error) {
36
- return rethrow(error, "convert-failed");
37
- }
38
- }
39
- async function open(input, options = {}) {
40
- try {
41
- return await openDeck(input, options);
42
- } catch (error) {
43
- return rethrow(error, "input-unreadable");
44
- }
45
- }
46
- async function save(deck, path, options = {}) {
47
- try {
48
- return await saveDeck(deck, path, options);
49
- } catch (error) {
50
- return rethrow(error, "output-unwritable");
51
- }
52
- }
53
-
54
- export { convert, open, save };