@openpresentation/opf 0.26.0 → 0.26.2

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 (58) hide show
  1. package/README.md +4 -0
  2. package/dist/browser.js +14 -15
  3. package/dist/{catalog-refs-CSHevLn1.d.ts → catalog-refs-BSfGELpt.d.ts} +1 -1
  4. package/dist/catalog-schemas-DoxA2BgY.d.ts +19 -0
  5. package/dist/{chunk-F7USLFZE.js → chunk-5VJCLUUA.js} +6 -6
  6. package/dist/{chunk-GS37EBPQ.js → chunk-6JAFSZVL.js} +1 -1
  7. package/dist/{chunk-F5ABHDUX.js → chunk-7YZ72FRP.js} +5 -5
  8. package/dist/{chunk-IWFXFWGD.js → chunk-CRCOQ4K2.js} +1 -1
  9. package/dist/{chunk-EQ6S5SEZ.js → chunk-JI3PHXPJ.js} +1 -1
  10. package/dist/{chunk-FITOGMR3.js → chunk-L65YNP4J.js} +1 -1
  11. package/dist/{chunk-X7RANZWP.js → chunk-LN2ASLMF.js} +1 -1
  12. package/dist/{chunk-P7S3ORB4.js → chunk-LUQYSUXS.js} +1790 -69
  13. package/dist/{chunk-F4HFDP6I.js → chunk-N6CNJCIF.js} +18 -0
  14. package/dist/{chunk-3OE6PZIC.js → chunk-NWO6HT4F.js} +4 -4
  15. package/dist/{chunk-LU6XM5JQ.js → chunk-O2ST5ZKL.js} +1 -1
  16. package/dist/{chunk-WW62PPYV.js → chunk-OFWBICDO.js} +1 -2
  17. package/dist/{chunk-MJ57RSYO.js → chunk-Q6KMKTEH.js} +4 -4
  18. package/dist/{chunk-IC6OPLMU.js → chunk-XFK4KPKK.js} +2 -2
  19. package/dist/{composition-Daqvi-GV.d.ts → composition-DIftf6iP.d.ts} +1 -1
  20. package/dist/composition.d.ts +2 -2
  21. package/dist/conversion-BKCKBECG.js +18 -0
  22. package/dist/{conversion-DyR-2OkM.d.ts → conversion-CX_I6Vna.d.ts} +5 -5
  23. package/dist/convert.d.ts +3 -3
  24. package/dist/convert.js +6 -6
  25. package/dist/{deck-report-DHaboWbM.d.ts → deck-report-5vwMGcQz.d.ts} +2 -2
  26. package/dist/deck.d.ts +5 -5
  27. package/dist/deck.js +9 -9
  28. package/dist/diff.js +3 -4
  29. package/dist/docs.js +5 -5
  30. package/dist/format.js +2 -2
  31. package/dist/index.d.ts +13 -12
  32. package/dist/index.js +18 -19
  33. package/dist/markdown.d.ts +3 -3
  34. package/dist/markdown.js +6 -6
  35. package/dist/node-engine.d.ts +7 -7
  36. package/dist/node-engine.js +18 -19
  37. package/dist/{pagination-R8YFwVj7.d.ts → pagination-D_kJe4jH.d.ts} +2 -2
  38. package/dist/pagination.d.ts +3 -3
  39. package/dist/pagination.js +3 -3
  40. package/dist/patch.js +2 -3
  41. package/dist/repo-readme.js +1 -1
  42. package/dist/schema.d.ts +151 -0
  43. package/dist/schema.js +3 -0
  44. package/dist/schemas.js +1 -1
  45. package/dist/source.d.ts +97 -0
  46. package/dist/source.js +90 -0
  47. package/dist/spec/schemas/opf.schema.json +16 -0
  48. package/dist/spec/schemas/theme.schema.json +2 -0
  49. package/dist/types.d.ts +1 -1
  50. package/dist/{validation-types-JW8e06ee.d.ts → validation-types-3ARvTsB0.d.ts} +2 -2
  51. package/dist/validator.d.ts +54 -6
  52. package/dist/validator.js +2 -2
  53. package/dist/yaml.d.ts +3 -3
  54. package/dist/yaml.js +6 -6
  55. package/package.json +13 -5
  56. package/dist/chunk-IY5SCRTV.js +0 -261
  57. package/dist/conversion-ZPBLP2K6.js +0 -19
  58. package/dist/validator-Dym2zYVK.d.ts +0 -67
package/dist/source.js ADDED
@@ -0,0 +1,90 @@
1
+ import { createLocator, parsePointer } from './chunk-LUQYSUXS.js';
2
+ export { analyzeJsonSyntax, applyTextEdits } from './chunk-LUQYSUXS.js';
3
+ import './chunk-XRMV2GMB.js';
4
+ import './chunk-N6CNJCIF.js';
5
+ import { findNodeAtOffset, getNodePath, parseTree } from 'jsonc-parser';
6
+
7
+ var isJson = (format) => format === "json";
8
+ var parseText = (text) => parseTree(text.startsWith("\uFEFF") ? ` ${text.slice(1)}` : text, [], { allowTrailingComma: true, allowEmptyContent: true, disallowComments: false });
9
+ function segmentsOf(pointer) {
10
+ if (Array.isArray(pointer)) return pointer.map(String);
11
+ if (typeof pointer !== "string") return void 0;
12
+ try {
13
+ return parsePointer(pointer);
14
+ } catch {
15
+ return void 0;
16
+ }
17
+ }
18
+ function member(node, segment) {
19
+ if (node.type === "array") return /^(?:0|[1-9][0-9]*)$/.test(segment) ? node.children?.[Number(segment)] : void 0;
20
+ if (node.type === "object") return node.children?.find((property) => property.children?.[0]?.value === segment);
21
+ return void 0;
22
+ }
23
+ function partOf(value, property, part) {
24
+ const key = property?.children?.[0];
25
+ const keyAndColon = key ? { offset: key.offset, length: (property?.colonOffset !== void 0 ? property.colonOffset + 1 : key.offset + key.length) - key.offset } : void 0;
26
+ switch (part) {
27
+ case "value":
28
+ return value ? { offset: value.offset, length: value.length } : keyAndColon;
29
+ case "open":
30
+ return value ? { offset: value.offset, length: Math.min(1, value.length) } : keyAndColon;
31
+ case "key":
32
+ return key ? { offset: key.offset, length: key.length } : void 0;
33
+ case "colon":
34
+ return keyAndColon;
35
+ case "entry":
36
+ return key ? { offset: key.offset, length: (value ? value.offset + value.length : keyAndColon ? keyAndColon.offset + keyAndColon.length : key.offset + key.length) - key.offset } : void 0;
37
+ }
38
+ }
39
+ function locate(text, format, pointer, options = {}) {
40
+ if (!isJson(format)) return void 0;
41
+ const segments = segmentsOf(pointer);
42
+ const root = segments ? parseText(text) : void 0;
43
+ if (!segments || !root) return void 0;
44
+ const part = options.part ?? "value";
45
+ const place = createLocator(text);
46
+ let value = root;
47
+ let property;
48
+ let depth = 0;
49
+ for (const segment of segments) {
50
+ const next = value ? member(value, segment) : void 0;
51
+ if (!value || !next) break;
52
+ if (value.type === "object") {
53
+ property = next;
54
+ value = next.children?.[1];
55
+ } else {
56
+ property = void 0;
57
+ value = next;
58
+ }
59
+ depth++;
60
+ }
61
+ const exact = depth === segments.length;
62
+ const found = partOf(value, property, part) ?? partOf(value, property, "value");
63
+ if (!found) return void 0;
64
+ return { ...place(found.offset, found.length), ...exact ? {} : { exact: false } };
65
+ }
66
+ function pathAt(text, format, offset) {
67
+ if (!isJson(format)) return void 0;
68
+ const root = parseText(text);
69
+ const place = createLocator(text);
70
+ const none = { path: [], part: "none" };
71
+ if (!root || offset < root.offset || offset > root.offset + root.length) return none;
72
+ const node = findNodeAtOffset(root, offset, true);
73
+ if (!node) return none;
74
+ const range = (target) => place(target.offset, target.length);
75
+ const parent = node.parent;
76
+ if (node.type === "string" && parent?.type === "property" && parent.children?.[0] === node) return { path: getNodePath(node), part: "key", range: range(node) };
77
+ if (node.type === "property") {
78
+ const key = node.children?.[0];
79
+ return { path: key ? [...getNodePath(node), String(key.value)] : getNodePath(node), part: "between", range: range(node) };
80
+ }
81
+ if (node.type === "object" || node.type === "array") {
82
+ const onOpen = offset <= node.offset;
83
+ const onClose = offset >= node.offset + node.length && /[}\]]$/.test(text.slice(node.offset, node.offset + node.length));
84
+ const path = getNodePath(node);
85
+ return onOpen || onClose ? { path, part: "value", range: range(node) } : { path, part: "between", range: range(node) };
86
+ }
87
+ return { path: getNodePath(node), part: "value", range: range(node) };
88
+ }
89
+
90
+ export { locate, pathAt };
@@ -62,12 +62,14 @@
62
62
  "examples": ["Bob Lee", ["Bob Lee", "Carla Diaz"]]
63
63
  },
64
64
  "audience": {
65
+ "x-opf-catalog": "audiences",
65
66
  "oneOf": [
66
67
  { "type": "string" },
67
68
  { "$ref": "#/$defs/Audience" },
68
69
  {
69
70
  "type": "array",
70
71
  "items": {
72
+ "x-opf-catalog": "audiences",
71
73
  "oneOf": [
72
74
  { "type": "string" },
73
75
  { "$ref": "#/$defs/Audience" }
@@ -96,6 +98,7 @@
96
98
  ]
97
99
  },
98
100
  "purpose": {
101
+ "x-opf-catalog": "purposes",
99
102
  "oneOf": [
100
103
  { "type": "string" },
101
104
  { "$ref": "#/$defs/Purpose" }
@@ -124,6 +127,7 @@
124
127
  ]
125
128
  },
126
129
  "tone": {
130
+ "x-opf-catalog": "tones",
127
131
  "oneOf": [{ "$ref": "#/$defs/CatalogReference" }, { "$ref": "#/$defs/Tone" }],
128
132
  "description": "Desired tone for the presentation. Accepts either:\n- A tones reference: a bare id ('formal') or 'name:id' for a record of a named catalogs group.\n- An inline Tone object for custom tone metadata or overrides on a referenced record. Object form has the fields of https://openpresentation.org/schema/opf-tone/v1.\n\nA reference resolves like every content reference (see catalogs); one that resolves nowhere is the warning opf/unresolved-reference. Nothing is drawn from the tone.",
129
133
  "examples": [
@@ -181,6 +185,7 @@
181
185
  "default": false
182
186
  },
183
187
  "narrative": {
188
+ "x-opf-catalog": "narratives",
184
189
  "$ref": "#/$defs/CatalogReference",
185
190
  "description": "The deck's narrative plan, by reference: a bare narratives id ('classic-story') or 'name:id' for a record of a named catalogs group ('acme:founder-pitch'). The deck holds only this pointer; the plan (the arc, its beats and what each beat must do) lives in the record, which has the fields of https://openpresentation.org/schema/opf-narrative/v1. A narrative the document defines itself is a record in catalogs.custom.narratives, referenced here by its key.\n\nSlides link themselves to beats with slides[].beat. Core validate warns about a slides[].beat id the resolved narrative does not define and about a root 'duration' outside its 'duration' range, and reports a beat that no slide references. The preview and the PPTX export draw nothing from the narrative; opf-pptx stores the reference for round-trip.\n\nThe reference resolves like every content reference (see catalogs); one that resolves nowhere is the warning opf/unresolved-reference, never an error.\n\nDeck-level concerns that are not part of the storyline (audience, tone, takeaway, duration) live as siblings on the presentation root.",
186
191
  "examples": ["classic-story", "problem-solution", "scqa", "pitch-deck", "acme:founder-pitch"]
@@ -277,6 +282,7 @@
277
282
  ],
278
283
  "properties": {
279
284
  "id": {
285
+ "x-opf-catalog": "audiences",
280
286
  "$ref": "#/$defs/CatalogReference",
281
287
  "description": "Optional audiences reference (a bare id or 'name:id') resolved before applying the inline overrides.",
282
288
  "examples": ["executive", "board", "engineering-team"]
@@ -339,6 +345,7 @@
339
345
  ],
340
346
  "properties": {
341
347
  "id": {
348
+ "x-opf-catalog": "purposes",
342
349
  "$ref": "#/$defs/CatalogReference",
343
350
  "description": "Optional purposes reference (a bare id or 'name:id') resolved before applying the inline overrides.",
344
351
  "examples": ["inform", "decide", "align", "persuade", "educate"]
@@ -418,10 +425,12 @@
418
425
  "examples": ["Latn", "Cyrl", "Grek", "Arab", "Hebr", "Jpan", "Kore", "Hans", "Hant", "Deva", "Thai"]
419
426
  },
420
427
  "fontScheme": {
428
+ "x-opf-catalog": "fontSchemes",
421
429
  "$ref": "#/$defs/CatalogReference",
422
430
  "description": "Font-scheme reference (a bare id or 'name:id') for this language's script slot when targeting PowerPoint output. Its major/minor families fill the language's script slot (eastAsian or complexScript, chosen by 'script') unless the effective design font scheme sets that slot itself; the latin slot always follows the design font scheme. Without it, engines use the default script fonts of their language vocabulary."
423
431
  },
424
432
  "googleFontScheme": {
433
+ "x-opf-catalog": "fontSchemes",
425
434
  "$ref": "#/$defs/CatalogReference",
426
435
  "description": "Font-scheme reference (a bare id or 'name:id') used in place of 'fontScheme' when resolving script fonts for Google Slides output."
427
436
  },
@@ -449,6 +458,7 @@
449
458
  ],
450
459
  "properties": {
451
460
  "id": {
461
+ "x-opf-catalog": "tones",
452
462
  "$ref": "#/$defs/CatalogReference",
453
463
  "description": "Optional tones reference (a bare id or 'name:id') resolved before applying the inline overrides.",
454
464
  "examples": ["formal", "casual", "technical", "persuasive"]
@@ -648,11 +658,13 @@
648
658
  "description": "Visual design system applied to the presentation; individual slides may override fields via Slide.design.",
649
659
  "properties": {
650
660
  "theme": {
661
+ "x-opf-catalog": "themes",
651
662
  "$ref": "#/$defs/CatalogReference",
652
663
  "description": "Theme for the deck: a themes reference, a bare id ('minimal') or 'name:id' ('acme:brand'). The theme supplies the default colour scheme, font scheme, background and dimensions; design.colorScheme, design.fontScheme, design.background and design.dimensions override it field by field. A reference that resolves nowhere is the warning opf/unresolved-reference and engines use the engine default theme.",
653
664
  "examples": ["minimal", "classic", "bold", "acme:brand"]
654
665
  },
655
666
  "colorScheme": {
667
+ "x-opf-catalog": "colorSchemes",
656
668
  "oneOf": [
657
669
  { "type": "string" },
658
670
  { "$ref": "#/$defs/ColorScheme" }
@@ -666,6 +678,7 @@
666
678
  ]
667
679
  },
668
680
  "fontScheme": {
681
+ "x-opf-catalog": "fontSchemes",
669
682
  "oneOf": [
670
683
  { "type": "string" },
671
684
  { "$ref": "#/$defs/FontScheme" }
@@ -785,6 +798,7 @@
785
798
  "description": "Color palette used by the design system. Every slot and role is a hex color ('#RGB', '#RRGGBB' or '#RRGGBBAA'); a color-scheme name or a 'var:<id>' reference is not valid here, because those resolve through the scheme. The slot fields (accent1-accent6, dark1, dark2, light1, light2, hyperlink, followedHyperlink) mirror color-scheme.schema.json (https://openpresentation.org/schema/opf-color-scheme/v1) so library records and inline OPF overrides are interchangeable on those fields.\n\nTwo parallel models are supported and may be mixed:\n- OOXML slots - the 12-slot PowerPoint theme model that round-trips directly to OOXML. Use these for full control over the palette as PowerPoint sees it.\n- Abstract roles (primary, secondary, accent, background, surface, text, textSecondary) - OPF-specific semantic aliases the engine maps onto the OOXML slots. Convenient for inline overrides without thinking in slot numbers; not part of the catalog record schema.\n\nIn design.colorScheme, 'id' resolves a colorSchemes record as the base; slot and role overrides on the same object take precedence over the resolved scheme. The string form of design.colorScheme is equivalent to setting only 'id'.",
786
799
  "properties": {
787
800
  "id": {
801
+ "x-opf-catalog": "colorSchemes",
788
802
  "$ref": "#/$defs/CatalogReference",
789
803
  "description": "Colour-scheme reference (a bare id or 'name:id') resolved as the base; slot and role overrides on the surrounding ColorScheme object take precedence over the resolved scheme.",
790
804
  "examples": ["cool-horizon", "boost", "burnt-orange", "ocean-depth", "corporate-blue"]
@@ -891,6 +905,7 @@
891
905
  "description": "Typography selections used by the design system. The pair fields (major, minor) and refinement fields (type, app, languageFamily) mirror font-scheme.schema.json (https://openpresentation.org/schema/opf-font-scheme/v1) so library records and inline OPF overrides are interchangeable on those fields.\n\nTwo parallel models are supported and may be mixed:\n- OOXML pairs (major, minor) - heading and body family names that round-trip directly to PowerPoint majorFont/minorFont entries.\n- Abstract roles (heading, body, accent, code) - OPF-specific font family names the engine maps onto the OOXML pair when serializing. Convenient for inline overrides and for adding accent/code roles that don't have a direct OOXML slot. Catalog records may also carry 'code' (for example the consolas and courier-new records); heading, body and accent are not part of the catalog record schema. A role is a family name only: weight, style and tracking come from the text styles, and PowerPoint has no numeric weight.\n\nIn design.fontScheme, 'id' resolves a fontSchemes record as the base; pair and role overrides on the same object take precedence over the resolved scheme. The string form of design.fontScheme is equivalent to setting only 'id'.",
892
906
  "properties": {
893
907
  "id": {
908
+ "x-opf-catalog": "fontSchemes",
894
909
  "$ref": "#/$defs/CatalogReference",
895
910
  "description": "Font-scheme reference (a bare id or 'name:id') resolved as the base; field overrides on the surrounding FontScheme object take precedence over the resolved scheme.",
896
911
  "examples": ["aptos", "tenorite", "seaford", "noto-sans", "modern-sans", "classic-serif"]
@@ -1937,6 +1952,7 @@
1937
1952
  "description": "Optional reference to one or more beats of the deck's narrative (each value is the id of a beat in the narrative record that the root 'narrative' resolves to). A single string declares the slide's primary beat; an array declares that one slide covers multiple beats. Declares the slide's role in the story arc; does not constrain ordering or structure. Core validate warns about a beat id the resolved narrative does not define, and reports a beat that no slide references. Slides without a beat are valid; multiple slides may share a beat."
1938
1953
  },
1939
1954
  "layout": {
1955
+ "x-opf-catalog": "layouts",
1940
1956
  "$ref": "#/$defs/CatalogReference",
1941
1957
  "description": "Optional layout: a layouts reference, a bare id ('pillars') or 'name:id' ('acme:hero'), or 'auto'. When omitted or 'auto', the slide is composed with no layout record: engines arrange title, subtitle, tag and content automatically, a slide with no body payload is a cover (vertically centered), and design hints apply; there is no finding. 'auto' is reserved, so no catalog may define a layout of that id, and opf format drops it. A layout is a grid template (layout.schema.json): the slide's content stays flat and binds to the layout's regions by reading order, role and kind, a block may pin itself to a region with 'region', and an empty region collapses. A reference that resolves nowhere is the warning opf/unresolved-reference (and the 'unresolved-reference' diagnostic of resolveSlideContext), the slide composes automatically, and a strict export fails. A layout id of the 0.18 default catalog that 0.19 no longer has is such a reference: 0.19 has no migration path for layouts. A layout never changes what a slide contains, and engines never substitute a different layout.",
1942
1958
  "examples": ["cover", "pillars", "chart-beside", "auto", "acme:hero"]
@@ -50,12 +50,14 @@
50
50
  ]
51
51
  },
52
52
  "colorScheme": {
53
+ "x-opf-catalog": "colorSchemes",
53
54
  "type": "string",
54
55
  "pattern": "^(?:[a-z][a-z0-9-]*:)?[a-z][a-z0-9-]*$",
55
56
  "description": "The theme's default colour scheme: a reference (a bare id or 'name:id') resolved like design.colorScheme, but in the theme's own catalogs group first.",
56
57
  "examples": ["cool-horizon", "boost", "burnt-orange"]
57
58
  },
58
59
  "fontScheme": {
60
+ "x-opf-catalog": "fontSchemes",
59
61
  "type": "string",
60
62
  "pattern": "^(?:[a-z][a-z0-9-]*:)?[a-z][a-z0-9-]*$",
61
63
  "description": "The theme's default font scheme: a reference (a bare id or 'name:id') resolved like design.fontScheme, but in the theme's own catalogs group first.",
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { P as Presentation } from './presentation-Bwo8Ko6D.js';
2
- export { b as CatalogKind } from './catalog-refs-CSHevLn1.js';
2
+ export { C as CatalogKind } from './catalog-refs-BSfGELpt.js';
3
3
  export { SchemaName } from './schemas.js';
4
4
  export { a as Finding, d as FindingCategory, e as FindingFix, f as FindingFocus, b as FindingLocation, F as FindingReport, c as FindingSeverity, g as FindingSuggestion, J as JsonPatchOperation, V as ValidationIssue } from './finding-l9dlQ2NF.js';
5
5
  import './json-BFSdESOE.js';
@@ -1,5 +1,5 @@
1
- import { C as Catalog } from './catalog-refs-CSHevLn1.js';
2
- import { T as TextMeasurement } from './composition-Daqvi-GV.js';
1
+ import { a as Catalog } from './catalog-refs-BSfGELpt.js';
2
+ import { T as TextMeasurement } from './composition-DIftf6iP.js';
3
3
  import { c as FindingSeverity, F as FindingReport } from './finding-l9dlQ2NF.js';
4
4
  import { J as JsonPrimitive } from './json-BFSdESOE.js';
5
5
 
@@ -1,9 +1,57 @@
1
- export { D as DEFAULT_VALIDATION_THRESHOLDS, O as OPFValidationError, c as assertValid, d as assertValidCatalogRecord, g as findValidationRule, p as promotedRegionKeys, v as validate, h as validateCatalogRecord, i as validationRules } from './validator-Dym2zYVK.js';
2
- import './finding-l9dlQ2NF.js';
3
- import './presentation-Bwo8Ko6D.js';
4
- export { C as Contract, d as ValidateFonts, a as ValidateOptions, e as ValidationCategory, f as ValidationChecks, V as ValidationReport, g as ValidationRuleCost, c as ValidationRuleInfo, b as ValidationThresholds, v as validationCategories } from './validation-types-JW8e06ee.js';
5
- import './catalog-refs-CSHevLn1.js';
1
+ import { C as CatalogRecordKind } from './catalog-schemas-DoxA2BgY.js';
2
+ import { a as Finding } from './finding-l9dlQ2NF.js';
3
+ import { P as Presentation } from './presentation-Bwo8Ko6D.js';
4
+ import { b as ValidationThresholds, c as ValidationRuleInfo, V as ValidationReport, a as ValidateOptions } from './validation-types-3ARvTsB0.js';
5
+ export { C as Contract, d as ValidateFonts, e as ValidationCategory, f as ValidationChecks, g as ValidationRuleCost, v as validationCategories } from './validation-types-3ARvTsB0.js';
6
+ import './catalog-refs-BSfGELpt.js';
6
7
  import './schemas.js';
7
8
  import './json-BFSdESOE.js';
8
- import './composition-Daqvi-GV.js';
9
+ import './composition-DIftf6iP.js';
9
10
  import './chart-data-BnNqgnC-.js';
11
+
12
+ /**
13
+ * The rule registry: every rule `validate` can report, with its category, default severity, cost, rationale and the
14
+ * standard it follows. The format, references and policy rules are produced by the schema and reference checks; the
15
+ * accessibility, layout and content rules are implemented in `rules-*.ts`. Each rule has a stable `opf/<name>` id.
16
+ */
17
+ declare const DEFAULT_VALIDATION_THRESHOLDS: Readonly<ValidationThresholds>;
18
+ /**
19
+ * Every rule `validate` can report, with its category, default severity, cost, rationale and approximations, ordered by
20
+ * category (format, references, policy, accessibility, layout, content) and, within one, in report order.
21
+ */
22
+ declare const validationRules: readonly ValidationRuleInfo[];
23
+ /** The rule a full id (`opf/text-contrast`) or bare name (`text-contrast`) names, or undefined. */
24
+ declare function findValidationRule(name: string): ValidationRuleInfo | undefined;
25
+
26
+ declare const promotedRegionKeys: readonly ["left", "center", "right", "left+center", "center+right", "left+center+right", "top", "middle", "bottom", "top+middle", "middle+bottom", "top+middle+bottom", "top:left", "top:center", "top:right", "top:left+center", "top:center+right", "top:left+center+right", "middle:left", "middle:center", "middle:right", "middle:left+center", "middle:center+right", "middle:left+center+right", "bottom:left", "bottom:center", "bottom:right", "bottom:left+center", "bottom:center+right", "bottom:left+center+right", "top+middle:left", "top+middle:center", "top+middle:right", "top+middle:left+center", "top+middle:center+right", "top+middle:left+center+right", "middle+bottom:left", "middle+bottom:center", "middle+bottom:right", "middle+bottom:left+center", "middle+bottom:center+right", "middle+bottom:left+center+right", "top+middle+bottom:left", "top+middle+bottom:center", "top+middle+bottom:right", "top+middle+bottom:left+center", "top+middle+bottom:center+right", "top+middle+bottom:left+center+right"];
27
+
28
+ declare class OPFValidationError extends Error {
29
+ /** The full report that failed. */
30
+ readonly report: ValidationReport;
31
+ /** The error-severity findings of the report. */
32
+ readonly findings: Finding[];
33
+ constructor(report: ValidationReport);
34
+ }
35
+ /**
36
+ * Check a presentation. `input` is a parsed presentation (an object) or the text of one, which is read as strict JSON and nothing
37
+ * else: syntax errors and duplicate keys come back with line and column, and findings carry the range of the value they are
38
+ * about. YAML and Markdown go through `fromYaml` and `fromMarkdown`, which call this for you.
39
+ *
40
+ * Never throws for a bad document, only for bad options (a `TypeError` naming the unknown rule, threshold or option, so a
41
+ * typo cannot silently disable a check).
42
+ */
43
+ declare function validate(input: unknown, options?: ValidateOptions): ValidationReport;
44
+ /**
45
+ * Throw `OPFValidationError` (carrying the `report`) unless `validate(value, options)` is valid; afterwards TypeScript
46
+ * knows `value` is a `Presentation`. It takes a parsed value, not text. Pass `{ only: ['format'] }` for the cheap check.
47
+ */
48
+ declare function assertValid(value: unknown, options?: ValidateOptions): asserts value is Presentation;
49
+ /**
50
+ * Check one published catalog record file (an audience, theme, layout, font scheme, chart type and so on) against its
51
+ * companion schema, `$schema` and `id` included. The report has the same shape as `validate`'s; every finding is `format`.
52
+ * A record a document embeds is checked by `validate`, keyed by its id and without `$schema`.
53
+ */
54
+ declare function validateCatalogRecord(kind: CatalogRecordKind, value: unknown): ValidationReport;
55
+ declare function assertValidCatalogRecord(kind: CatalogRecordKind, value: unknown): void;
56
+
57
+ export { DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, ValidateOptions, ValidationReport, ValidationRuleInfo, ValidationThresholds, assertValid, assertValidCatalogRecord, findValidationRule, promotedRegionKeys, validate, validateCatalogRecord, validationRules };
package/dist/validator.js CHANGED
@@ -1,3 +1,3 @@
1
- export { DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-P7S3ORB4.js';
1
+ export { DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-LUQYSUXS.js';
2
2
  export { promotedRegionKeys } from './chunk-XRMV2GMB.js';
3
- import './chunk-F4HFDP6I.js';
3
+ import './chunk-N6CNJCIF.js';
package/dist/yaml.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { C as Catalog } from './catalog-refs-CSHevLn1.js';
1
+ import { a as Catalog } from './catalog-refs-BSfGELpt.js';
2
2
  import { P as Presentation } from './presentation-Bwo8Ko6D.js';
3
- import { a as ValidateOptions, V as ValidationReport } from './validation-types-JW8e06ee.js';
3
+ import { a as ValidateOptions, V as ValidationReport } from './validation-types-3ARvTsB0.js';
4
4
  import { a as Finding, b as FindingLocation } from './finding-l9dlQ2NF.js';
5
- import './composition-Daqvi-GV.js';
5
+ import './composition-DIftf6iP.js';
6
6
  import './chart-data-BnNqgnC-.js';
7
7
  import './json-BFSdESOE.js';
8
8
 
package/dist/yaml.js CHANGED
@@ -1,7 +1,7 @@
1
- export { OPFYamlError, YAML_SCHEMA_URL, fromYaml, parseYamlData, scanYamlComments, toYaml } from './chunk-F5ABHDUX.js';
2
- import './chunk-GS37EBPQ.js';
3
- import './chunk-EQ6S5SEZ.js';
4
- import './chunk-LU6XM5JQ.js';
5
- import './chunk-P7S3ORB4.js';
1
+ export { OPFYamlError, YAML_SCHEMA_URL, fromYaml, parseYamlData, scanYamlComments, toYaml } from './chunk-7YZ72FRP.js';
2
+ import './chunk-6JAFSZVL.js';
3
+ import './chunk-O2ST5ZKL.js';
4
+ import './chunk-LUQYSUXS.js';
6
5
  import './chunk-XRMV2GMB.js';
7
- import './chunk-F4HFDP6I.js';
6
+ import './chunk-JI3PHXPJ.js';
7
+ import './chunk-N6CNJCIF.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpresentation/opf",
3
- "version": "0.26.0",
3
+ "version": "0.26.2",
4
4
  "description": "Canonical Open Presentation Format schemas, TypeScript types, local validation and composition; in Node, the file API and the CLI defaults register the pptx.gallery catalog of @openpresentation/gallery.",
5
5
  "license": "MIT",
6
6
  "author": "Open Presentation",
@@ -102,6 +102,14 @@
102
102
  "types": "./dist/yaml.d.ts",
103
103
  "import": "./dist/yaml.js"
104
104
  },
105
+ "./schema": {
106
+ "types": "./dist/schema.d.ts",
107
+ "import": "./dist/schema.js"
108
+ },
109
+ "./source": {
110
+ "types": "./dist/source.d.ts",
111
+ "import": "./dist/source.js"
112
+ },
105
113
  "./patch": {
106
114
  "types": "./dist/patch.d.ts",
107
115
  "import": "./dist/patch.js"
@@ -137,7 +145,7 @@
137
145
  "ajv-formats": "^3.0.1",
138
146
  "jsonc-parser": "3.3.1",
139
147
  "yaml": "^2.9.1",
140
- "@openpresentation/gallery": "^0.26.0"
148
+ "@openpresentation/gallery": "^0.26.2"
141
149
  },
142
150
  "devDependencies": {
143
151
  "@expo-google-fonts/arimo": "0.4.3",
@@ -157,8 +165,8 @@
157
165
  "typescript": "~5.9.3"
158
166
  },
159
167
  "peerDependencies": {
160
- "@openpresentation/opf-pptx": "^0.26.0",
161
- "@openpresentation/opf-render": "^0.26.0"
168
+ "@openpresentation/opf-pptx": "^0.26.2",
169
+ "@openpresentation/opf-render": "^0.26.2"
162
170
  },
163
171
  "peerDependenciesMeta": {
164
172
  "@openpresentation/opf-pptx": {
@@ -178,5 +186,5 @@
178
186
  "test:packed": "node test/packed-install-smoke.mjs",
179
187
  "pack:dry-run": "pnpm run build:deps && pnpm run build && npm pack --dry-run --cache /tmp/opf-npm-cache"
180
188
  },
181
- "gitHead": "ae4ddd76e40b5778c1fdc255e4e3b24334748d7e"
189
+ "gitHead": "0440759ebddc9ea01fdf52c88a0406e21c955375"
182
190
  }