@openpresentation/opf 0.11.4 → 0.12.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 (74) hide show
  1. package/README.md +16 -0
  2. package/dist/audit.d.ts +156 -0
  3. package/dist/audit.js +7 -0
  4. package/dist/{catalogs-CUClB3nl.d.ts → catalogs-BnI7JKcn.d.ts} +3 -3
  5. package/dist/catalogs.d.ts +2 -2
  6. package/dist/catalogs.js +2 -1
  7. package/dist/{chunk-KJKASEPE.js → chunk-4LAM3N6S.js} +753 -42
  8. package/dist/chunk-6LZK2IZB.js +1690 -0
  9. package/dist/{chunk-NSVVQ52O.js → chunk-AUM5MXBR.js} +8 -6
  10. package/dist/{chunk-AEUSVEUY.js → chunk-E34DJ5LL.js} +50 -14
  11. package/dist/chunk-FYLJVF7X.js +18448 -0
  12. package/dist/{chunk-HJL64ETN.js → chunk-GJKJL4YY.js} +14 -0
  13. package/dist/{chunk-3H2U7FDR.js → chunk-HOBSL7AJ.js} +1867 -247
  14. package/dist/chunk-JKVKYVWL.js +1332 -0
  15. package/dist/{chunk-3OJN7QAW.js → chunk-MWPMJE6P.js} +18 -4
  16. package/dist/chunk-RUC7L5DJ.js +261 -0
  17. package/dist/chunk-S5W34SIJ.js +1 -0
  18. package/dist/chunk-V2537ENL.js +198 -0
  19. package/dist/{chunk-RXNFDGPC.js → chunk-WXSPETQ6.js} +311 -40
  20. package/dist/{composition-Dl-d9FRj.d.ts → composition-DWbCiMwF.d.ts} +559 -10
  21. package/dist/composition.d.ts +1 -1
  22. package/dist/composition.js +2 -1
  23. package/dist/convert.d.ts +261 -0
  24. package/dist/convert.js +1107 -0
  25. package/dist/diff.d.ts +145 -0
  26. package/dist/diff.js +604 -0
  27. package/dist/docs.js +72 -18
  28. package/dist/examples.d.ts +1 -1
  29. package/dist/examples.js +112 -112
  30. package/dist/font-policy.d.ts +15 -0
  31. package/dist/font-policy.js +1 -1
  32. package/dist/format.d.ts +20 -0
  33. package/dist/format.js +83 -0
  34. package/dist/index.d.ts +173 -24
  35. package/dist/index.js +926 -262
  36. package/dist/lint.d.ts +4 -4
  37. package/dist/lint.js +6 -5
  38. package/dist/markdown.d.ts +74 -0
  39. package/dist/markdown.js +1941 -0
  40. package/dist/pagination.d.ts +1 -1
  41. package/dist/pagination.js +6 -5
  42. package/dist/patch.d.ts +99 -0
  43. package/dist/patch.js +6 -0
  44. package/dist/{presentation-j5PVrqfV.d.ts → presentation-DcF-MZcz.d.ts} +452 -17
  45. package/dist/repo-readme.js +1 -1
  46. package/dist/{schemas-X_NniU4A.d.ts → schemas-BSjlG8-R.d.ts} +28 -0
  47. package/dist/schemas.d.ts +1 -1
  48. package/dist/schemas.js +1 -1
  49. package/dist/spec/catalogs/audiences/customers.json +5 -1
  50. package/dist/spec/catalogs/audiences/executives.json +5 -1
  51. package/dist/spec/catalogs/audiences/index.json +20 -8
  52. package/dist/spec/catalogs/audiences/investors.json +5 -1
  53. package/dist/spec/catalogs/audiences/marketing-team.json +5 -1
  54. package/dist/spec/catalogs/audiences/regulators.json +5 -1
  55. package/dist/spec/catalogs/audiences/sales-team.json +5 -1
  56. package/dist/spec/catalogs/manifest.json +2 -2
  57. package/dist/spec/reference/engine-defaults.json +1 -1
  58. package/dist/spec/reference/font-policy.json +311 -40
  59. package/dist/spec/reference/font-policy.schema.json +40 -0
  60. package/dist/spec/reference/symbol-font-encodings.json +18354 -0
  61. package/dist/spec/reference/symbol-font-encodings.schema.json +156 -0
  62. package/dist/spec/schemas/audience.schema.json +7 -7
  63. package/dist/spec/schemas/narrative.schema.json +1 -1
  64. package/dist/spec/schemas/opf.schema.json +597 -28
  65. package/dist/spec-files.d.ts +1 -1
  66. package/dist/spec-files.js +1 -1
  67. package/dist/symbol-font-encodings.d.ts +128 -0
  68. package/dist/symbol-font-encodings.js +1 -0
  69. package/dist/types.d.ts +4 -4
  70. package/dist/validator-DfG9yxba.d.ts +172 -0
  71. package/dist/validator.d.ts +4 -36
  72. package/dist/validator.js +5 -4
  73. package/package.json +32 -3
  74. package/dist/chunk-FDCWQHWO.js +0 -1366
package/dist/lint.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { C as CatalogKind } from './catalogs-CUClB3nl.js';
2
- import { ValidationIssue } from './validator.js';
3
- import { J as JsonPrimitive } from './schemas-X_NniU4A.js';
4
- import './presentation-j5PVrqfV.js';
1
+ import { C as CatalogKind } from './catalogs-BnI7JKcn.js';
2
+ import { V as ValidationIssue } from './validator-DfG9yxba.js';
3
+ import { J as JsonPrimitive } from './schemas-BSjlG8-R.js';
4
+ import './presentation-DcF-MZcz.js';
5
5
 
6
6
  type LintSeverity = 'error' | 'warning' | 'info';
7
7
  interface LintLocation {
package/dist/lint.js CHANGED
@@ -1,5 +1,6 @@
1
- export { lintPresentation, lintSource } from './chunk-3OJN7QAW.js';
2
- import './chunk-FDCWQHWO.js';
3
- import './chunk-3H2U7FDR.js';
4
- import './chunk-KJKASEPE.js';
5
- import './chunk-AEUSVEUY.js';
1
+ export { lintPresentation, lintSource } from './chunk-MWPMJE6P.js';
2
+ import './chunk-JKVKYVWL.js';
3
+ import './chunk-HOBSL7AJ.js';
4
+ import './chunk-S5W34SIJ.js';
5
+ import './chunk-E34DJ5LL.js';
6
+ import './chunk-4LAM3N6S.js';
@@ -0,0 +1,74 @@
1
+ import { LintDiagnostic, LintLocation, LintSeverity } from './lint.js';
2
+ import { P as Presentation } from './presentation-DcF-MZcz.js';
3
+ import './catalogs-BnI7JKcn.js';
4
+ import './schemas-BSjlG8-R.js';
5
+ import './validator-DfG9yxba.js';
6
+
7
+ interface EmbeddedPart {
8
+ /** JSON Pointer into the OPF document. */
9
+ path: string;
10
+ reason: string;
11
+ }
12
+
13
+ /** A diagnostic in the shape of `@openpresentation/opf/lint`, with the source range always present. */
14
+ type MarkdownDiagnostic = LintDiagnostic & {
15
+ location: LintLocation;
16
+ };
17
+ /** Raised by `opfToMarkdown` for a document it cannot convert: `invalid-document` (does not validate as OPF) or `not-representable` (a value that no Markdown or YAML form can carry exactly). */
18
+ declare class OPFMarkdownError extends Error {
19
+ readonly code: "invalid-document" | "not-representable";
20
+ readonly details: Record<string, unknown>;
21
+ constructor(code: "invalid-document" | "not-representable", message: string, details?: Record<string, unknown>);
22
+ }
23
+
24
+ interface ParseOptions {
25
+ /** `rules` (default): slides are separated by `---` lines. `headings`: a `# ` heading also starts a new slide (outline input). */
26
+ split?: "rules" | "headings";
27
+ }
28
+
29
+ interface MarkdownToOpfOptions extends ParseOptions {
30
+ /** Deck properties used when the front matter does not set them (for example `{ name: "Title" }`). The front matter wins. */
31
+ defaults?: Record<string, unknown>;
32
+ /** Run the OPF lint over the result and map its findings to Markdown line and column (default true). */
33
+ validate?: boolean;
34
+ }
35
+ interface MarkdownToOpfResult {
36
+ /** The converted deck. Always an object; when `valid` is false it is a best effort that does not validate. */
37
+ document: Presentation;
38
+ /** True when there are no errors (Markdown syntax errors and OPF validation errors both count). */
39
+ valid: boolean;
40
+ /** Lint-shaped diagnostics, in source order, each with `location` (UTF-16 offset and length, one-based line and column). */
41
+ diagnostics: MarkdownDiagnostic[];
42
+ counts: Record<LintSeverity, number>;
43
+ }
44
+ /** Convert Markdown in the OPF dialect to an OPF document. Never throws for malformed content; read `valid` and `diagnostics`. */
45
+ declare function markdownToOpf(markdown: string, options?: MarkdownToOpfOptions): MarkdownToOpfResult;
46
+ interface OpfToMarkdownOptions {
47
+ /**
48
+ * What to do with a part that has no Markdown syntax (a design, region keys, a styled table cell, a nested group).
49
+ * `embed` (default) writes it as YAML in an `opf-slide` or `opf-block` fence so nothing is lost; `drop` leaves it out
50
+ * and reports it in `loss`, for Markdown meant to be read rather than converted back.
51
+ */
52
+ unsupported?: "embed" | "drop";
53
+ }
54
+ interface OpfToMarkdownResult {
55
+ markdown: string;
56
+ report: {
57
+ /** True when everything in the document is in the Markdown (natively or embedded). False only in `drop` mode, when `loss` is not empty. */
58
+ lossless: boolean;
59
+ /** True when nothing needed embedding or dropping: the Markdown is plain dialect syntax throughout. */
60
+ native: boolean;
61
+ /** Parts written as YAML because the dialect has no syntax for them (`embed` mode), with a JSON Pointer and the reason. */
62
+ embedded: EmbeddedPart[];
63
+ /** Parts left out (`drop` mode), as `<JSON Pointer>: <reason>`. Empty when lossless. */
64
+ loss: string[];
65
+ };
66
+ }
67
+ /**
68
+ * Convert an OPF document to Markdown in the dialect. For a document the dialect fully expresses,
69
+ * `markdownToOpf(opfToMarkdown(doc).markdown).document` is the same deck; the Markdown it writes converts back to
70
+ * itself byte for byte. Throws `OPFMarkdownError` (`invalid-document`) when the input is not valid OPF.
71
+ */
72
+ declare function opfToMarkdown(document: unknown, options?: OpfToMarkdownOptions): OpfToMarkdownResult;
73
+
74
+ export { type EmbeddedPart, type MarkdownDiagnostic, type MarkdownToOpfOptions, type MarkdownToOpfResult, OPFMarkdownError, type OpfToMarkdownOptions, type OpfToMarkdownResult, markdownToOpf, opfToMarkdown };