@openpresentation/opf 0.16.0 → 0.17.0

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 +16 -2
  2. package/dist/{catalog-refs-_anZs-Qz.d.ts → catalog-refs-C4K4y-vh.d.ts} +1 -1
  3. package/dist/{catalog-schemas-BZCjgAxu.d.ts → catalog-schemas-g7RFQBdc.d.ts} +1 -1
  4. package/dist/catalog.d.ts +2 -2
  5. package/dist/catalog.js +3 -23712
  6. package/dist/{chart-data-BnNqgnC-.d.ts → chart-data-DTxdRRT1.d.ts} +1 -1
  7. package/dist/{chunk-FQSIIADJ.js → chunk-BIC3SWPK.js} +4 -4
  8. package/dist/{chunk-5PDN7BN6.js → chunk-CW7GEAV3.js} +151 -49
  9. package/dist/{chunk-NAWQR7MN.js → chunk-ESRYBYLY.js} +1 -1
  10. package/dist/chunk-IPW5BS3X.js +973 -0
  11. package/dist/{chunk-5UEUAW57.js → chunk-IS5H5JKH.js} +1 -1
  12. package/dist/{chunk-UM24JFUE.js → chunk-M4UR3NPN.js} +2 -2
  13. package/dist/{chunk-KINQFU6X.js → chunk-N4EVOFEA.js} +19 -12
  14. package/dist/{chunk-PX5AWL7Y.js → chunk-NLNYNBTS.js} +79 -10
  15. package/dist/{chunk-SMLMI6IZ.js → chunk-O263APNI.js} +1 -1
  16. package/dist/{chunk-BSYQDWT4.js → chunk-O2CX5NEH.js} +26 -14
  17. package/dist/{chunk-3XDRQYWZ.js → chunk-O3CVNJTL.js} +1 -1
  18. package/dist/{chunk-5TO6I3GB.js → chunk-PPROJP2E.js} +1 -1
  19. package/dist/{chunk-WEDGVC5W.js → chunk-RA64UQKI.js} +18 -42
  20. package/dist/{chunk-K4DQQIT4.js → chunk-TCD2FB2K.js} +5 -5
  21. package/dist/chunk-WCG3THTD.js +23712 -0
  22. package/dist/chunk-WWYWFVOI.js +793 -0
  23. package/dist/{chunk-6OR326EA.js → chunk-YT7FMQER.js} +1 -1
  24. package/dist/{composition-D4ADF5c-.d.ts → composition-BbZ_9C-c.d.ts} +152 -132
  25. package/dist/composition.d.ts +3 -3
  26. package/dist/composition.js +1 -1
  27. package/dist/conversion-SBpTOwdg.d.ts +444 -0
  28. package/dist/convert.d.ts +4 -4
  29. package/dist/convert.js +7 -7
  30. package/dist/data.d.ts +2 -2
  31. package/dist/data.js +2 -2
  32. package/dist/deck-report-Bx3naFlF.d.ts +40 -0
  33. package/dist/deck.d.ts +23 -53
  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 +29 -23
  38. package/dist/examples.d.ts +1 -1
  39. package/dist/examples.js +237 -237
  40. package/dist/{finding-CT_f_vbD.d.ts → finding-CDQ_wH8j.d.ts} +1 -1
  41. package/dist/format.js +2 -2
  42. package/dist/index.d.ts +42 -12
  43. package/dist/index.js +15 -807
  44. package/dist/markdown.d.ts +6 -6
  45. package/dist/markdown.js +7 -7
  46. package/dist/node-engine.d.ts +94 -0
  47. package/dist/node-engine.js +21 -0
  48. package/dist/node.d.ts +60 -0
  49. package/dist/node.js +54 -0
  50. package/dist/{pagination-DzZPFheM.d.ts → pagination-BhX4M48Y.d.ts} +21 -7
  51. package/dist/pagination.d.ts +4 -4
  52. package/dist/pagination.js +4 -4
  53. package/dist/patch.d.ts +1 -1
  54. package/dist/patch.js +4 -4
  55. package/dist/{presentation-COrFuj2g.d.ts → presentation-fb8CZmRq.d.ts} +12 -75
  56. package/dist/repo-readme.js +1 -1
  57. package/dist/schemas.js +1 -1
  58. package/dist/spec/catalogs/manifest.json +1 -1
  59. package/dist/spec/schemas/opf.schema.json +16 -37
  60. package/dist/types.d.ts +3 -3
  61. package/dist/{validation-types-HxIgJfKx.d.ts → validation-types-iZbXfES6.d.ts} +19 -8
  62. package/dist/validator.d.ts +8 -8
  63. package/dist/validator.js +3 -3
  64. package/dist/yaml.d.ts +6 -6
  65. package/dist/yaml.js +7 -7
  66. package/package.json +34 -1
package/README.md CHANGED
@@ -49,6 +49,20 @@ console.log(Object.keys(saved.catalogs.default.themes)); // ["classic"]
49
49
  console.log(Object.keys(defaultCatalog.tones));
50
50
  ```
51
51
 
52
+ In Node, `@openpresentation/opf/node` adds files: `convert` turns one file into another (a deck to PDF, PNG, SVG or PPTX, a PowerPoint file to a deck, one deck form to another, or bytes with no output path), `open` reads a deck file or imports a `.pptx`, and `save` writes one. It re-exports the rest of core, so one namespace import covers an application:
53
+
54
+ ```ts
55
+ import * as opf from "@openpresentation/opf/node";
56
+
57
+ await opf.convert("deck.opf.md", "deck.pdf");
58
+ const deck = await opf.open("deck.opf.md");
59
+ deck.slides.push({ title: "Q4" });
60
+ await opf.save(deck, "deck.opf.md");
61
+ const { files } = await opf.convert(deck, { format: "pptx" }); // bytes, nothing written
62
+ ```
63
+
64
+ Drawing and PowerPoint go through the optional peers `@openpresentation/opf-render` and `@openpresentation/opf-pptx`, which `/node` loads the first time a call needs them; npm does not install them for you. `/node` is the only Node-only entry: the root and every other subpath run in a browser. See [OPF files in Node](../../docs/node.md).
65
+
52
66
  Use focused imports when you only need one surface:
53
67
 
54
68
  ```ts
@@ -59,7 +73,7 @@ import { validate, assertValid, validationRules } from "@openpresentation/opf/va
59
73
  import type { Presentation, Audience, Tone } from "@openpresentation/opf/types";
60
74
  ```
61
75
 
62
- The root entry holds the application-level API: schemas, catalog references and their resolution (`resolveReference`, `embed`, `copySlides`, `updateFromCatalog`), validation, variables, pagination, data helpers, font policy, `stats` and `resolveSlideContext`. It carries no catalog records: the pinned pptx.gallery snapshot is the opt-in `@openpresentation/opf/catalog` (`defaultCatalog`, display metadata and layout previews), and every entry point that resolves references takes `{ catalogs }`, the catalogs the host registered; the first one is the default for documents that omit `catalogs.default`. See [catalogs and the default catalog](../../docs/default-catalog.md).
76
+ The root entry holds the application-level API: schemas, catalog references and their resolution (`resolveReference`, `embed`, `copySlides`, `updateFromCatalog`), validation, variables, pagination, data helpers, font policy, `stats`, `resolveSlideContext` and `resolveSlideVariables`. Engines compose and draw `context.slide` from `resolveSlideContext(deck, index, { slideNumber, slideCount })`: the slide with the slide-scoped built-ins `{{slide.number}}`, `{{slide.section}}` and `{{deck.slideCount}}` substituted for the same numbers its `options` carry (`resolveSlideVariables(slide, { slideNumber, slideCount })` does that substitution alone). Header and footer text is substituted by `layoutFurniture`, which records each slide number in `FurnitureTextPart.fields`. See [templates and variables](../../docs/templates-and-variables.md#slide-scoped-built-ins). It carries no catalog records: the pinned pptx.gallery snapshot is the opt-in `@openpresentation/opf/catalog` (`defaultCatalog`, display metadata and layout previews), and every entry point that resolves references takes `{ catalogs }`, the catalogs the host registered; the first one is the default for documents that omit `catalogs.default`. See [catalogs and the default catalog](../../docs/default-catalog.md).
63
77
 
64
78
  The layout engine's names are not on the root. `composeSlide`, `fitText`, `layoutQuote` and the other `layoutX`/`fitX` functions, numbering, footnotes and citations, colour contrast, code syntax, pattern fills, metric trends, chart options, script fonts and text direction come from `@openpresentation/opf/composition`; the symbol-font tables come from `@openpresentation/opf/symbol-font-encodings`.
65
79
 
@@ -77,7 +91,7 @@ The layout engine's names are not on the root. `composeSlide`, `fitText`, `layou
77
91
 
78
92
  ### Reading and writing a deck in any form
79
93
 
80
- `readDeck(text, { format, filename, catalogs, validate })` and `writeDeck(presentation, { format | filename })` (the root and `@openpresentation/opf/deck`) read and write a deck as JSON (canonical), YAML or Markdown. The format is the `format` option, else the file name (`.opf.md` is Markdown, `.yaml` and `.yml` are YAML, anything else JSON; a plain `.md` is not a deck), and never the content. `readDeck` returns `{ presentation, format, valid, findings, counts, schemaValid, checks }`: the `validate` report of the deck, with every finding located in the text that was read (`opf/json-syntax`, `yaml/<rule>` or `markdown/<rule>` for syntax errors) and no exception for malformed content. It runs in a browser.
94
+ `parse(text, { format, filename, catalogs })` and `stringify(presentation, { format | filename })` (the root and `@openpresentation/opf/deck`) read and write a deck as JSON (canonical), YAML or Markdown. The format is the `format` option, else the file name (`.opf.md` is Markdown, `.yaml` and `.yml` are YAML, anything else JSON; a plain `.md` is not a deck), and never the content. `parse` returns the presentation and throws `OPFValidationError` for a syntax, schema or reference error; the error's `report.findings` are located by line and column in the text (`opf/json-syntax`, `yaml/<rule>` or `markdown/<rule>` for syntax errors). Warnings do not throw: `validate(text)` returns the full report. Both run in a browser; files are `/node`'s job (below).
81
95
 
82
96
  ### OPF as YAML
83
97
 
@@ -125,4 +125,4 @@ declare function catalogReferenceSites(document: unknown, options?: {
125
125
  /** Records a picker can offer for `kind`: the document's embedded records, then those of the registered catalogs its groups name, with the reference to write for each. */
126
126
  declare function catalogRecords(document: unknown, kind: CatalogKind, options?: CatalogOptions): ResolvedReference[];
127
127
 
128
- export { type Catalog as C, OPFCatalogsOptionError as O, type RecordProvenance as R, type UnresolvedReferenceDiagnostic as U, type CatalogKind as a, type CatalogOptions as b, CATALOG_GROUP_PATTERN as c, CATALOG_REFERENCE_PATTERN as d, type CatalogRecordMap as e, type CatalogRecords as f, type CatalogReferenceSite as g, OPFUnresolvedReferenceError as h, type ResolvedReference as i, catalogGroupSource as j, catalogKinds as k, catalogRecords as l, catalogReferenceSites as m, parseReference as p, resolveReference as r, unresolvedReference as u };
128
+ export { CATALOG_GROUP_PATTERN as C, OPFCatalogsOptionError as O, type RecordProvenance as R, type UnresolvedReferenceDiagnostic as U, CATALOG_REFERENCE_PATTERN as a, type Catalog as b, type CatalogKind as c, type CatalogOptions as d, type CatalogRecordMap as e, type CatalogRecords as f, type CatalogReferenceSite as g, OPFUnresolvedReferenceError as h, type ResolvedReference as i, catalogGroupSource as j, catalogKinds as k, catalogRecords as l, catalogReferenceSites as m, parseReference as p, resolveReference as r, unresolvedReference as u };
@@ -1,4 +1,4 @@
1
- import { a as CatalogKind } from './catalog-refs-_anZs-Qz.js';
1
+ import { c as CatalogKind } from './catalog-refs-C4K4y-vh.js';
2
2
  import { SchemaName } from './schemas.js';
3
3
 
4
4
  /** Kinds of catalog display metadata: published by catalogs for pickers, never referenced by documents. */
package/dist/catalog.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Catalog } from './catalog-refs-_anZs-Qz.js';
2
- import { C as CatalogDisplayKind } from './catalog-schemas-BZCjgAxu.js';
1
+ import { b as Catalog } from './catalog-refs-C4K4y-vh.js';
2
+ import { C as CatalogDisplayKind } from './catalog-schemas-g7RFQBdc.js';
3
3
  import './schemas.js';
4
4
  import './json-BFSdESOE.js';
5
5