@openpresentation/opf 0.33.0 → 0.34.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 (93) hide show
  1. package/README.md +3 -3
  2. package/dist/browser.js +20 -19
  3. package/dist/catalog-refs-CoIrOdAw.d.ts +937 -0
  4. package/dist/{catalog-schemas-CQTM-G8p.d.ts → catalog-schemas-FjLRPtjB.d.ts} +1 -1
  5. package/dist/{chart-data-oIZQlFGi.d.ts → chart-data-B_k-WTex.d.ts} +7 -4
  6. package/dist/{chunk-XIOC6N5P.js → chunk-244OPLAV.js} +1 -1
  7. package/dist/{chunk-KVHNDHVS.js → chunk-2B6GLT2O.js} +1 -1
  8. package/dist/{chunk-VMBLNCX2.js → chunk-6PMXVP5G.js} +117 -30
  9. package/dist/{chunk-BI4ERFAA.js → chunk-AAWHOCXS.js} +48 -13
  10. package/dist/{chunk-QD6DPS7X.js → chunk-ABA2D6X5.js} +2 -2
  11. package/dist/{chunk-UK3J6FSU.js → chunk-AEHDXNZX.js} +862 -269
  12. package/dist/{chunk-DAS75LGR.js → chunk-AGYPRTEC.js} +4 -4
  13. package/dist/chunk-BLCDUM7B.js +7 -0
  14. package/dist/{chunk-OPVJLL7H.js → chunk-CJVKOJ6B.js} +11841 -8687
  15. package/dist/{chunk-Y557TYML.js → chunk-CQXBGZQP.js} +19 -16
  16. package/dist/{chunk-VKEYV3ZK.js → chunk-FCSYIBVR.js} +2 -2
  17. package/dist/{chunk-PJSPHHRK.js → chunk-FK5XG742.js} +3 -16
  18. package/dist/{chunk-R6C6BQOG.js → chunk-HHVQ2SDT.js} +1 -1
  19. package/dist/{chunk-ABWEUXLV.js → chunk-L3MCLD3X.js} +117 -21
  20. package/dist/{chunk-QF5RSRXU.js → chunk-LCT5ZV3Q.js} +750 -199
  21. package/dist/{chunk-E7WQHMCL.js → chunk-MAFJ5O2D.js} +16 -14
  22. package/dist/{chunk-XANW7MB7.js → chunk-MUILZGRY.js} +4 -4
  23. package/dist/chunk-NLJFNCZ4.js +1560 -0
  24. package/dist/{chunk-VSBZC2PR.js → chunk-SR6T4LKI.js} +3 -3
  25. package/dist/chunk-UJZN2ZH6.js +1 -0
  26. package/dist/{chunk-IJXKVM4W.js → chunk-VDZXNNZF.js} +1 -1
  27. package/dist/{chunk-YYT6N7AI.js → chunk-WCPDN7AY.js} +1 -1
  28. package/dist/{chunk-S5QRGMUQ.js → chunk-X72WPTST.js} +6 -6
  29. package/dist/{chunk-INIMUBSE.js → chunk-XJUMFH33.js} +1 -1
  30. package/dist/{chunk-YS333HLA.js → chunk-XLSWZSQS.js} +2 -2
  31. package/dist/{composition-zMiIgzip.d.ts → composition-CvtvgBDE.d.ts} +1360 -1531
  32. package/dist/composition.d.ts +3 -3
  33. package/dist/composition.js +2 -1
  34. package/dist/conversion-CSQ5EHD2.js +25 -0
  35. package/dist/{conversion-mNth9XKm.d.ts → conversion-CyNRlWGw.d.ts} +25 -7
  36. package/dist/convert.d.ts +4 -4
  37. package/dist/convert.js +15 -11
  38. package/dist/data.d.ts +2 -2
  39. package/dist/data.js +3 -2
  40. package/dist/{deck-report-BSlRiR0_.d.ts → deck-report-BVlQZ42f.d.ts} +3 -3
  41. package/dist/deck.d.ts +6 -6
  42. package/dist/deck.js +12 -11
  43. package/dist/diagram-engine-eager.js +5 -1
  44. package/dist/diagram-engine-lazy.js +13 -0
  45. package/dist/diagram-plantuml-XRZ6VAOL.js +3 -0
  46. package/dist/diff.js +5 -4
  47. package/dist/docs.js +65 -53
  48. package/dist/examples.js +4070 -1083
  49. package/dist/font-policy.js +1 -1
  50. package/dist/format.js +2 -2
  51. package/dist/ids.js +5 -4
  52. package/dist/index.d.ts +18 -16
  53. package/dist/index.js +35 -24
  54. package/dist/markdown.d.ts +2 -2
  55. package/dist/markdown.js +9 -8
  56. package/dist/node-engine.d.ts +43 -11
  57. package/dist/node-engine.js +45 -26
  58. package/dist/{pagination-CYzNMazO.d.ts → pagination-CZQQYk7L.d.ts} +4 -3
  59. package/dist/pagination.d.ts +4 -4
  60. package/dist/pagination.js +5 -4
  61. package/dist/patch.js +4 -3
  62. package/dist/precompiled.js +2 -2
  63. package/dist/{presentation-CXhfpB_z.d.ts → presentation-s9262acV.d.ts} +357 -230
  64. package/dist/repo-readme.js +1 -1
  65. package/dist/schema-engine-ajv.js +1 -1
  66. package/dist/schema-engine-precompiled.js +2 -2
  67. package/dist/schema.d.ts +3 -3
  68. package/dist/schema.js +4 -3
  69. package/dist/schemas.d.ts +16 -0
  70. package/dist/schemas.js +1 -1
  71. package/dist/shape-engine-eager.js +2 -2
  72. package/dist/shape-engine-lazy.js +1 -1
  73. package/dist/{shape-engine-module-BK7JNEUV.js → shape-engine-module-N74FCHGY.js} +2 -2
  74. package/dist/shape-geometry.js +1 -1
  75. package/dist/source.d.ts +10 -5
  76. package/dist/source.js +11 -10
  77. package/dist/spec/reference/engine-vocabularies.json +135 -0
  78. package/dist/spec/reference/font-policy.json +3 -16
  79. package/dist/spec/reference/preset-geometry.json +3 -3
  80. package/dist/spec/schemas/icon-set.schema.json +1 -1
  81. package/dist/spec/schemas/layout.schema.json +71 -25
  82. package/dist/spec/schemas/opf.schema.json +540 -168
  83. package/dist/spec/schemas/theme.schema.json +11 -5
  84. package/dist/types.d.ts +81 -73
  85. package/dist/{validation-types-COwTel3H.d.ts → validation-types-CYbsUuZ9.d.ts} +8 -5
  86. package/dist/validator.d.ts +34 -7
  87. package/dist/validator.js +4 -3
  88. package/dist/yaml.d.ts +2 -2
  89. package/dist/yaml.js +8 -7
  90. package/package.json +6 -6
  91. package/dist/catalog-refs-B_0_vZg0.d.ts +0 -134
  92. package/dist/chunk-ZXOIGUHX.js +0 -1
  93. package/dist/conversion-POHRAMSN.js +0 -24
@@ -1,10 +1,10 @@
1
1
  import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
2
- import { readMarkdown, parseSlideText, escapeInline, serializeRuns } from './chunk-Y557TYML.js';
3
- import { fenceCode } from './chunk-KVHNDHVS.js';
4
- import { OPFMarkdownError, writeYaml, Ctx, readYamlMapping, csvField, scalarText } from './chunk-QD6DPS7X.js';
5
- import { same, isRecord, runText, isPlainRun, FORMATTING } from './chunk-VKEYV3ZK.js';
6
- import { validate } from './chunk-UK3J6FSU.js';
7
- import { checkCatalogsOption } from './chunk-OPVJLL7H.js';
2
+ import { readMarkdown, parseSlideText, escapeInline, serializeRuns } from './chunk-CQXBGZQP.js';
3
+ import { fenceCode } from './chunk-2B6GLT2O.js';
4
+ import { OPFMarkdownError, writeYaml, Ctx, readYamlMapping, csvField, scalarText } from './chunk-ABA2D6X5.js';
5
+ import { same, isRecord, runText, isPlainRun, FORMATTING } from './chunk-FCSYIBVR.js';
6
+ import { validate } from './chunk-AEHDXNZX.js';
7
+ import { checkCatalogsOption } from './chunk-CJVKOJ6B.js';
8
8
 
9
9
  // src/markdown/canon.ts
10
10
  var FORMAT_KEYS = FORMATTING;
@@ -109,9 +109,10 @@ function canonDiagram(value) {
109
109
  const source = typeof value === "string" ? value : isRecord(value) ? value.source : void 0;
110
110
  if (typeof source !== "string" || !source.trim() || source.includes("\r") || /^[ \t]*\n|\n[ \t]*$/.test(source)) return void 0;
111
111
  if (typeof value === "string") return value;
112
- if (!isRecord(value) || !only(value, ["source", "syntax", "alt"]) || value.syntax !== void 0 && value.syntax !== "mermaid") return void 0;
112
+ if (!isRecord(value) || !only(value, ["source", "syntax", "alt"]) || value.syntax !== void 0 && value.syntax !== "mermaid" && value.syntax !== "dot" && value.syntax !== "plantuml") return void 0;
113
113
  if (value.alt !== void 0 && typeof value.alt !== "string") return void 0;
114
- return value.alt === void 0 ? source : { source, alt: value.alt };
114
+ if (value.alt === void 0 && (value.syntax === void 0 || value.syntax === "mermaid")) return source;
115
+ return { source, ...value.syntax === "dot" || value.syntax === "plantuml" ? { syntax: value.syntax } : {}, ...value.alt === void 0 ? {} : { alt: value.alt } };
115
116
  }
116
117
  function canonMetric(value) {
117
118
  if (typeof value === "string" || typeof value === "number") return value;
@@ -230,9 +231,9 @@ function canonContent(key, value) {
230
231
  var CONTENT = ["text", "items", "bullets", "image", "video", "chart", "table", "code", "metric", "quote", "timeline", "diagram"];
231
232
  var isContent = (key) => CONTENT.includes(key);
232
233
  var ROWS = "(?:top|middle|bottom|top\\+middle|middle\\+bottom|top\\+middle\\+bottom)";
233
- var COLUMNS = "(?:left|center|right|left\\+center|center\\+right|left\\+center\\+right)";
234
+ var COLUMNS = "(?:start|center|end|start\\+center|center\\+end|start\\+center\\+end)";
234
235
  var REGION = new RegExp(`^(?:${ROWS}(?::${COLUMNS})?|${COLUMNS})$`);
235
- var NATIVE_SLIDE = /* @__PURE__ */ new Set(["id", "type", "layout", "section", "tag", "hidden", "beat", "title", "subtitle", "notes", "blocks", ...CONTENT]);
236
+ var NATIVE_SLIDE = /* @__PURE__ */ new Set(["id", "type", "layout", "section", "tag", "hidden", "beat", "language", "title", "subtitle", "notes", "blocks", ...CONTENT]);
236
237
  function fenceFor(body, char = "`") {
237
238
  let longest = 2;
238
239
  for (const line of body) for (const run of line.matchAll(char === "`" ? /`+/g : /~+/g)) longest = Math.max(longest, run[0].length);
@@ -327,6 +328,7 @@ function timelineLines(timeline) {
327
328
  const info = ["timeline", ...["name", "description"].filter((key) => meta[key] !== void 0).map((key) => `${key}=${JSON.stringify(meta[key])}`)].join(" ");
328
329
  const body = [];
329
330
  for (const event of events) {
331
+ if (event.duration !== void 0) return void 0;
330
332
  for (const key of ["when", "what", "description"]) if (typeof event[key] === "string" && (/[\r\n]/.test(event[key]) || event[key] !== event[key].trim() || event[key] === "")) return void 0;
331
333
  const line = event.when === void 0 ? event.what : `${event.when} \u2014 ${event.what}`;
332
334
  if (event.status === void 0 && /^\[[x> ]\]\s+\S/.test(line)) return void 0;
@@ -337,11 +339,11 @@ function timelineLines(timeline) {
337
339
  }
338
340
  function diagramLines(diagram) {
339
341
  const value = typeof diagram === "string" ? { source: diagram } : diagram;
340
- const source = value.source, alt = value.alt;
342
+ const source = value.source, alt = value.alt, syntax = value.syntax === "dot" || value.syntax === "plantuml" ? value.syntax : "mermaid";
341
343
  if (alt !== void 0 && (alt.includes("`") || /[\r\n]/.test(alt))) return void 0;
342
344
  const longest = Math.max(2, ...[...source.matchAll(/`+/g)].map((match) => match[0].length));
343
345
  const fence = "`".repeat(longest + 1);
344
- return [`${fence}mermaid${alt === void 0 ? "" : ` alt=${JSON.stringify(alt)}`}`, ...source.split("\n"), fence];
346
+ return [`${fence}${syntax}${alt === void 0 ? "" : ` alt=${JSON.stringify(alt)}`}`, ...source.split("\n"), fence];
345
347
  }
346
348
  function metricLines(metric) {
347
349
  const value = typeof metric === "object" ? metric : { value: metric };
@@ -395,7 +397,7 @@ function nativeLines(key, canon, marker) {
395
397
  case "code": {
396
398
  const code = typeof canon === "string" ? { source: canon } : canon;
397
399
  const language = code.language;
398
- if (language !== void 0 && (!/^[A-Za-z0-9_+#.-]+$/.test(language) || ["chart", "metric", "timeline", "mermaid", "opf-slide", "opf-block"].includes(language))) return void 0;
400
+ if (language !== void 0 && (!/^[A-Za-z0-9_+#.-]+$/.test(language) || ["chart", "metric", "timeline", "mermaid", "dot", "plantuml", "opf-slide", "opf-block"].includes(language))) return void 0;
399
401
  return fenceCode(code.source, language, code.filename);
400
402
  }
401
403
  case "metric":
@@ -458,7 +460,7 @@ function emitSlide(slide, index, mode) {
458
460
  } else loss.push({ path: where, message: reason });
459
461
  };
460
462
  const options = [];
461
- const optionFields = [["id", slide.id], ["type", slide.type], ["beat", slide.beat], ["layout", slide.layout], ["section", slide.section], ["tag", slide.tag]];
463
+ const optionFields = [["id", slide.id], ["type", slide.type], ["beat", slide.beat], ["layout", slide.layout], ["section", slide.section], ["tag", slide.tag], ["language", slide.language]];
462
464
  const failed = [];
463
465
  for (const [key, value] of optionFields) {
464
466
  if (value === void 0) continue;
@@ -1,8 +1,8 @@
1
- import { fromMarkdown, toMarkdown } from './chunk-E7WQHMCL.js';
2
- import { fromYaml, toYaml } from './chunk-S5QRGMUQ.js';
1
+ import { fromMarkdown, toMarkdown } from './chunk-MAFJ5O2D.js';
2
+ import { fromYaml, toYaml } from './chunk-X72WPTST.js';
3
3
  import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
4
- import { parseSource, validate, OPFValidationError } from './chunk-UK3J6FSU.js';
5
- import { checkCatalogsOption } from './chunk-OPVJLL7H.js';
4
+ import { parseSource, validate, OPFValidationError } from './chunk-AEHDXNZX.js';
5
+ import { checkCatalogsOption } from './chunk-CJVKOJ6B.js';
6
6
 
7
7
  // src/deck-report.ts
8
8
  var DECK_FORMATS = ["json", "yaml", "markdown"];