@openpresentation/opf 0.2.1 → 0.2.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.
@@ -62,16 +62,23 @@
62
62
  "examples": ["Bob Lee", ["Bob Lee", "Carla Diaz"]]
63
63
  },
64
64
  "audience": {
65
- "type": "array",
66
- "items": {
67
- "oneOf": [
68
- { "type": "string" },
69
- { "$ref": "#/$defs/Audience" }
70
- ]
71
- },
72
- "minItems": 1,
73
- "description": "Intended audiences for the presentation. Each item accepts either:\n- A string shorthand: free-form description ('Series B investors'), an audiences catalog id ('executives'), an HTTPS URL, or a 'pkg:' reference.\n- An inline Audience object for custom audience metadata or catalog-backed overrides. Object form mirrors https://openpresentation.org/schema/opf-audience/v1 without '$schema'.\n\nResolution order for catalog ids and references: inline catalogs.audiences.records[] → catalogs.audiences.source → default catalog at https://www.pptx.gallery/audiences.",
65
+ "oneOf": [
66
+ { "type": "string" },
67
+ {
68
+ "type": "array",
69
+ "items": {
70
+ "oneOf": [
71
+ { "type": "string" },
72
+ { "$ref": "#/$defs/Audience" }
73
+ ]
74
+ },
75
+ "minItems": 1
76
+ }
77
+ ],
78
+ "description": "Intended audiences for the presentation. Accepts either:\n- A single string shorthand: free-form description ('Series B investors'), an audiences catalog id ('executives'), an HTTPS URL, or a 'pkg:' reference.\n- An array of string shorthands and/or inline Audience objects for custom audience metadata or catalog-backed overrides. Object form mirrors https://openpresentation.org/schema/opf-audience/v1 without '$schema'.\n\nResolution order for catalog ids and references: inline catalogs.audiences.records[] → catalogs.audiences.source → default catalog at https://www.pptx.gallery/audiences.",
74
79
  "examples": [
80
+ "executives",
81
+ "Biology Students and Wildlife Enthusiasts",
75
82
  ["executives"],
76
83
  ["board", "c-suite"],
77
84
  ["Series B investors", "https://acme.com/decks/audiences/acme-board.json"],
@@ -1586,7 +1593,7 @@
1586
1593
  "items": {
1587
1594
  "type": "array",
1588
1595
  "items": { "$ref": "#/$defs/ListItem" },
1589
- "description": "Full-slide generic list payload. Presence of this field infers type 'list'."
1596
+ "description": "Full-slide generic list payload. Presence of this field infers type 'list'. At slide root, multiple content payload kinds with no explicit type, blocks, or regions are accepted as shorthand for layout-agnostic blocks."
1590
1597
  },
1591
1598
  "bullets": {
1592
1599
  "type": "array",
@@ -1638,7 +1645,7 @@
1638
1645
  "blocks": {
1639
1646
  "type": "array",
1640
1647
  "items": { "$ref": "#/$defs/ContentPayload" },
1641
- "description": "Layout-agnostic content blocks rendered together as a composed payload when exact placement is unspecified."
1648
+ "description": "Layout-agnostic content blocks rendered together as a composed payload when exact placement is unspecified. At slide root, multiple content payload kinds with no explicit type, blocks, or regions are accepted as shorthand for equivalent blocks."
1642
1649
  },
1643
1650
  "design": {
1644
1651
  "$ref": "#/$defs/Design",
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { P as Presentation, V as ValidationIssue, a as ValidationResult } from './validator-D7WwzKyx.js';
1
+ export { P as Presentation, V as ValidationIssue, a as ValidationResult } from './validator-MwlR2F56.js';
2
2
  export { CatalogKind } from './catalogs.js';
3
3
  export { SchemaName } from './schemas.js';
4
4
 
@@ -550,15 +550,13 @@ interface Presentation {
550
550
  */
551
551
  author?: (string | [string, ...(string)[]]);
552
552
  /**
553
- * Intended audiences for the presentation. Each item accepts either:
554
- * - A string shorthand: free-form description ('Series B investors'), an audiences catalog id ('executives'), an HTTPS URL, or a 'pkg:' reference.
555
- * - An inline Audience object for custom audience metadata or catalog-backed overrides. Object form mirrors https://openpresentation.org/schema/opf-audience/v1 without '$schema'.
553
+ * Intended audiences for the presentation. Accepts either:
554
+ * - A single string shorthand: free-form description ('Series B investors'), an audiences catalog id ('executives'), an HTTPS URL, or a 'pkg:' reference.
555
+ * - An array of string shorthands and/or inline Audience objects for custom audience metadata or catalog-backed overrides. Object form mirrors https://openpresentation.org/schema/opf-audience/v1 without '$schema'.
556
556
  *
557
557
  * Resolution order for catalog ids and references: inline catalogs.audiences.records[] → catalogs.audiences.source → default catalog at https://www.pptx.gallery/audiences.
558
- *
559
- * @minItems 1
560
558
  */
561
- audience?: [(string | Audience), ...((string | Audience))[]];
559
+ audience?: (string | [(string | Audience), ...((string | Audience))[]]);
562
560
  /**
563
561
  * Primary goal of the presentation. Accepts either:
564
562
  * - A string shorthand: free-form goal ('Raise a Series B round of $30M'), a purposes catalog id ('decide', 'align'), an HTTPS URL, or a 'pkg:' reference.
@@ -2022,7 +2020,7 @@ interface Slide {
2022
2020
  */
2023
2021
  text?: (string | TextRun[]);
2024
2022
  /**
2025
- * Full-slide generic list payload. Presence of this field infers type 'list'.
2023
+ * Full-slide generic list payload. Presence of this field infers type 'list'. At slide root, multiple content payload kinds with no explicit type, blocks, or regions are accepted as shorthand for layout-agnostic blocks.
2026
2024
  */
2027
2025
  items?: ListItem[];
2028
2026
  /**
@@ -2121,7 +2119,7 @@ interface Slide {
2121
2119
  events: [TimelineEvent, ...(TimelineEvent)[]];
2122
2120
  });
2123
2121
  /**
2124
- * Layout-agnostic content blocks rendered together as a composed payload when exact placement is unspecified.
2122
+ * Layout-agnostic content blocks rendered together as a composed payload when exact placement is unspecified. At slide root, multiple content payload kinds with no explicit type, blocks, or regions are accepted as shorthand for equivalent blocks.
2125
2123
  */
2126
2124
  blocks?: ContentPayload[];
2127
2125
  design?: Design1;
@@ -1,3 +1,3 @@
1
1
  import './catalogs.js';
2
- export { O as OPFValidationError, S as SchemaOrKind, V as ValidationIssue, a as ValidationResult, b as assertValid, c as assertValidCatalogRecord, d as assertValidPresentation, v as validate, e as validateCatalogRecord, f as validatePresentation } from './validator-D7WwzKyx.js';
2
+ export { O as OPFValidationError, S as SchemaOrKind, V as ValidationIssue, a as ValidationResult, b as assertValid, c as assertValidCatalogRecord, d as assertValidPresentation, v as validate, e as validateCatalogRecord, f as validatePresentation } from './validator-MwlR2F56.js';
3
3
  import './schemas.js';
package/dist/validator.js CHANGED
@@ -110,20 +110,29 @@ var presentation = {
110
110
  ]
111
111
  },
112
112
  "audience": {
113
- "type": "array",
114
- "items": {
115
- "oneOf": [
116
- {
117
- "type": "string"
113
+ "oneOf": [
114
+ {
115
+ "type": "string"
116
+ },
117
+ {
118
+ "type": "array",
119
+ "items": {
120
+ "oneOf": [
121
+ {
122
+ "type": "string"
123
+ },
124
+ {
125
+ "$ref": "#/$defs/Audience"
126
+ }
127
+ ]
118
128
  },
119
- {
120
- "$ref": "#/$defs/Audience"
121
- }
122
- ]
123
- },
124
- "minItems": 1,
125
- "description": "Intended audiences for the presentation. Each item accepts either:\n- A string shorthand: free-form description ('Series B investors'), an audiences catalog id ('executives'), an HTTPS URL, or a 'pkg:' reference.\n- An inline Audience object for custom audience metadata or catalog-backed overrides. Object form mirrors https://openpresentation.org/schema/opf-audience/v1 without '$schema'.\n\nResolution order for catalog ids and references: inline catalogs.audiences.records[] \u2192 catalogs.audiences.source \u2192 default catalog at https://www.pptx.gallery/audiences.",
129
+ "minItems": 1
130
+ }
131
+ ],
132
+ "description": "Intended audiences for the presentation. Accepts either:\n- A single string shorthand: free-form description ('Series B investors'), an audiences catalog id ('executives'), an HTTPS URL, or a 'pkg:' reference.\n- An array of string shorthands and/or inline Audience objects for custom audience metadata or catalog-backed overrides. Object form mirrors https://openpresentation.org/schema/opf-audience/v1 without '$schema'.\n\nResolution order for catalog ids and references: inline catalogs.audiences.records[] \u2192 catalogs.audiences.source \u2192 default catalog at https://www.pptx.gallery/audiences.",
126
133
  "examples": [
134
+ "executives",
135
+ "Biology Students and Wildlife Enthusiasts",
127
136
  [
128
137
  "executives"
129
138
  ],
@@ -2478,7 +2487,7 @@ Resolution order: inline catalogs.fontSchemes.records[] -> catalogs.fontSchemes.
2478
2487
  "items": {
2479
2488
  "$ref": "#/$defs/ListItem"
2480
2489
  },
2481
- "description": "Full-slide generic list payload. Presence of this field infers type 'list'."
2490
+ "description": "Full-slide generic list payload. Presence of this field infers type 'list'. At slide root, multiple content payload kinds with no explicit type, blocks, or regions are accepted as shorthand for layout-agnostic blocks."
2482
2491
  },
2483
2492
  "bullets": {
2484
2493
  "type": "array",
@@ -2548,7 +2557,7 @@ Resolution order: inline catalogs.fontSchemes.records[] -> catalogs.fontSchemes.
2548
2557
  "items": {
2549
2558
  "$ref": "#/$defs/ContentPayload"
2550
2559
  },
2551
- "description": "Layout-agnostic content blocks rendered together as a composed payload when exact placement is unspecified."
2560
+ "description": "Layout-agnostic content blocks rendered together as a composed payload when exact placement is unspecified. At slide root, multiple content payload kinds with no explicit type, blocks, or regions are accepted as shorthand for equivalent blocks."
2552
2561
  },
2553
2562
  "design": {
2554
2563
  "$ref": "#/$defs/Design",
@@ -6484,6 +6493,12 @@ function inferredKinds(value) {
6484
6493
  if (hasOwn(value, "timeline")) kinds.push("timeline");
6485
6494
  return kinds;
6486
6495
  }
6496
+ function isImplicitBlocksComposition(value, inferred, options) {
6497
+ if (options.allowBlocks !== true || hasOwn(value, "blocks")) {
6498
+ return false;
6499
+ }
6500
+ return inferred.length > 1;
6501
+ }
6487
6502
  function validateContentPayload(value, path, options = {}) {
6488
6503
  const issues = [];
6489
6504
  const explicitType = value.type;
@@ -6510,6 +6525,9 @@ function validateContentPayload(value, path, options = {}) {
6510
6525
  return issues;
6511
6526
  }
6512
6527
  if (!kind && inferred.length > 1) {
6528
+ if (isImplicitBlocksComposition(value, inferred, options)) {
6529
+ return issues;
6530
+ }
6513
6531
  issues.push(semanticIssue(path, "content payload mixes fields from incompatible content types", {
6514
6532
  inferredTypes: inferred
6515
6533
  }));