@openpresentation/opf 0.31.0 → 0.32.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 (76) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.js +18 -18
  3. package/dist/{chart-data-Ci9s_NDN.d.ts → chart-data-oIZQlFGi.d.ts} +4 -2
  4. package/dist/{chunk-UKWNHK62.js → chunk-2E6CDYL2.js} +23 -6
  5. package/dist/{chunk-HRKV43GC.js → chunk-BBVW5ZC2.js} +3 -3
  6. package/dist/{chunk-7UO6H32I.js → chunk-CLRYHWQN.js} +162 -22
  7. package/dist/chunk-DGS47ONG.js +1 -0
  8. package/dist/{chunk-F5QC7E2O.js → chunk-F7DN33UL.js} +28 -8
  9. package/dist/{chunk-KELC4K62.js → chunk-HKUV7NEN.js} +1 -1
  10. package/dist/{chunk-XG4JKFZ6.js → chunk-IT7FQKED.js} +6 -6
  11. package/dist/{chunk-SYCHWS7C.js → chunk-J63CIRIV.js} +4 -4
  12. package/dist/{chunk-5Q4IYLMW.js → chunk-LEF4X4KI.js} +274 -33
  13. package/dist/{chunk-5OMZW44K.js → chunk-NEJ32O7X.js} +1 -1
  14. package/dist/chunk-NVAJASOD.js +14764 -0
  15. package/dist/{chunk-XSCZZWYI.js → chunk-ONVFUVQ5.js} +99 -15
  16. package/dist/{chunk-M7YZU3DX.js → chunk-OXLA4HXQ.js} +615 -58
  17. package/dist/{chunk-P5E3FNYO.js → chunk-PB7ME64J.js} +1 -1
  18. package/dist/{chunk-ARFAQNOH.js → chunk-SW676APJ.js} +2 -2
  19. package/dist/{chunk-I6G32TB5.js → chunk-SZFO3MAJ.js} +5 -5
  20. package/dist/{chunk-W7KPMUJF.js → chunk-XFHXQCXL.js} +58 -5
  21. package/dist/{chunk-KOCXV7H3.js → chunk-XQO2CT6Q.js} +2 -2
  22. package/dist/{chunk-WHDOOLIO.js → chunk-YFJIIIOL.js} +3 -3
  23. package/dist/composition-Ds6WHyO7.d.ts +5620 -0
  24. package/dist/composition.d.ts +2 -2
  25. package/dist/composition.js +1 -1
  26. package/dist/conversion-5FUDQPED.js +24 -0
  27. package/dist/{conversion-Bh-skyMc.d.ts → conversion-CdzrTxib.d.ts} +56 -9
  28. package/dist/convert.d.ts +2 -2
  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-DQMsvyBI.d.ts → deck-report-CKDNQ2t4.d.ts} +2 -2
  33. package/dist/deck.d.ts +5 -5
  34. package/dist/deck.js +11 -11
  35. package/dist/diagram-engine-eager.js +6 -0
  36. package/dist/diagram-engine-lazy.js +2 -0
  37. package/dist/diff.js +4 -4
  38. package/dist/docs.js +25 -19
  39. package/dist/examples.js +4759 -995
  40. package/dist/format.js +2 -2
  41. package/dist/ids.js +4 -4
  42. package/dist/index.d.ts +15 -12
  43. package/dist/index.js +23 -22
  44. package/dist/markdown.d.ts +2 -2
  45. package/dist/markdown.js +8 -8
  46. package/dist/node-engine.d.ts +6 -6
  47. package/dist/node-engine.js +20 -20
  48. package/dist/{pagination-DyAKYpXu.d.ts → pagination-DRZ_JNFY.d.ts} +74 -4
  49. package/dist/pagination.d.ts +3 -3
  50. package/dist/pagination.js +4 -4
  51. package/dist/patch.js +3 -3
  52. package/dist/precompiled.js +2 -2
  53. package/dist/{presentation-8jLSTFqL.d.ts → presentation-DnD7mfmf.d.ts} +106 -27
  54. package/dist/repo-readme.js +1 -1
  55. package/dist/schema-engine-ajv.js +1 -1
  56. package/dist/schema-engine-precompiled.js +2 -2
  57. package/dist/schema.js +3 -3
  58. package/dist/schemas.d.ts +6 -0
  59. package/dist/schemas.js +1 -1
  60. package/dist/source.d.ts +4 -3
  61. package/dist/source.js +10 -10
  62. package/dist/spec/schemas/layout.schema.json +58 -8
  63. package/dist/spec/schemas/narrative.schema.json +2 -1
  64. package/dist/spec/schemas/opf.schema.json +122 -23
  65. package/dist/spec/schemas/theme.schema.json +9 -3
  66. package/dist/types.d.ts +69 -18
  67. package/dist/{validation-types-mNmfcY9A.d.ts → validation-types-DxyYPebs.d.ts} +1 -1
  68. package/dist/validator.d.ts +4 -4
  69. package/dist/validator.js +3 -3
  70. package/dist/yaml.d.ts +2 -2
  71. package/dist/yaml.js +7 -7
  72. package/package.json +15 -6
  73. package/dist/chunk-W3SEWSO5.js +0 -8043
  74. package/dist/chunk-ZROVYWGU.js +0 -1
  75. package/dist/composition-C-hd_Ci3.d.ts +0 -3207
  76. package/dist/conversion-7OPM5MMJ.js +0 -24
@@ -1,10 +1,10 @@
1
1
  import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
2
- import { readMarkdown, parseSlideText, escapeInline, serializeRuns } from './chunk-UKWNHK62.js';
3
- import { fenceCode } from './chunk-5OMZW44K.js';
4
- import { OPFMarkdownError, writeYaml, Ctx, readYamlMapping, csvField, scalarText } from './chunk-HRKV43GC.js';
5
- import { same, isRecord, runText, isPlainRun, FORMATTING } from './chunk-KOCXV7H3.js';
6
- import { validate } from './chunk-M7YZU3DX.js';
7
- import { checkCatalogsOption } from './chunk-W3SEWSO5.js';
2
+ import { readMarkdown, parseSlideText, escapeInline, serializeRuns } from './chunk-2E6CDYL2.js';
3
+ import { fenceCode } from './chunk-NEJ32O7X.js';
4
+ import { OPFMarkdownError, writeYaml, Ctx, readYamlMapping, csvField, scalarText } from './chunk-BBVW5ZC2.js';
5
+ import { same, isRecord, runText, isPlainRun, FORMATTING } from './chunk-XQO2CT6Q.js';
6
+ import { validate } from './chunk-OXLA4HXQ.js';
7
+ import { checkCatalogsOption } from './chunk-NVAJASOD.js';
8
8
 
9
9
  // src/markdown/canon.ts
10
10
  var FORMAT_KEYS = FORMATTING;
@@ -105,6 +105,14 @@ function canonCode(value) {
105
105
  if (value.filename !== void 0) out.filename = value.filename;
106
106
  return out;
107
107
  }
108
+ function canonDiagram(value) {
109
+ const source = typeof value === "string" ? value : isRecord(value) ? value.source : void 0;
110
+ if (typeof source !== "string" || !source.trim() || source.includes("\r") || /^[ \t]*\n|\n[ \t]*$/.test(source)) return void 0;
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;
113
+ if (value.alt !== void 0 && typeof value.alt !== "string") return void 0;
114
+ return value.alt === void 0 ? source : { source, alt: value.alt };
115
+ }
108
116
  function canonMetric(value) {
109
117
  if (typeof value === "string" || typeof value === "number") return value;
110
118
  if (!isRecord(value) || !only(value, ["value", "label", "description", "unit", "delta", "trend", "sentiment"])) return void 0;
@@ -211,13 +219,15 @@ function canonContent(key, value) {
211
219
  return canonChart(value);
212
220
  case "timeline":
213
221
  return canonTimeline(value);
222
+ case "diagram":
223
+ return canonDiagram(value);
214
224
  default:
215
225
  return void 0;
216
226
  }
217
227
  }
218
228
 
219
229
  // src/markdown/emit.ts
220
- var CONTENT = ["text", "items", "bullets", "image", "video", "chart", "table", "code", "metric", "quote", "timeline"];
230
+ var CONTENT = ["text", "items", "bullets", "image", "video", "chart", "table", "code", "metric", "quote", "timeline", "diagram"];
221
231
  var isContent = (key) => CONTENT.includes(key);
222
232
  var ROWS = "(?:top|middle|bottom|top\\+middle|middle\\+bottom|top\\+middle\\+bottom)";
223
233
  var COLUMNS = "(?:left|center|right|left\\+center|center\\+right|left\\+center\\+right)";
@@ -325,6 +335,14 @@ function timelineLines(timeline) {
325
335
  }
326
336
  return fenced(info, body);
327
337
  }
338
+ function diagramLines(diagram) {
339
+ const value = typeof diagram === "string" ? { source: diagram } : diagram;
340
+ const source = value.source, alt = value.alt;
341
+ if (alt !== void 0 && (alt.includes("`") || /[\r\n]/.test(alt))) return void 0;
342
+ const longest = Math.max(2, ...[...source.matchAll(/`+/g)].map((match) => match[0].length));
343
+ const fence = "`".repeat(longest + 1);
344
+ return [`${fence}mermaid${alt === void 0 ? "" : ` alt=${JSON.stringify(alt)}`}`, ...source.split("\n"), fence];
345
+ }
328
346
  function metricLines(metric) {
329
347
  const value = typeof metric === "object" ? metric : { value: metric };
330
348
  const body = [];
@@ -377,7 +395,7 @@ function nativeLines(key, canon, marker) {
377
395
  case "code": {
378
396
  const code = typeof canon === "string" ? { source: canon } : canon;
379
397
  const language = code.language;
380
- if (language !== void 0 && (!/^[A-Za-z0-9_+#.-]+$/.test(language) || ["chart", "metric", "timeline", "opf-slide", "opf-block"].includes(language))) return void 0;
398
+ if (language !== void 0 && (!/^[A-Za-z0-9_+#.-]+$/.test(language) || ["chart", "metric", "timeline", "mermaid", "opf-slide", "opf-block"].includes(language))) return void 0;
381
399
  return fenceCode(code.source, language, code.filename);
382
400
  }
383
401
  case "metric":
@@ -389,6 +407,8 @@ function nativeLines(key, canon, marker) {
389
407
  return tableLines(canon);
390
408
  case "timeline":
391
409
  return timelineLines(canon);
410
+ case "diagram":
411
+ return diagramLines(canon);
392
412
  default:
393
413
  return void 0;
394
414
  }
@@ -1,4 +1,4 @@
1
- import { presentation } from './chunk-5Q4IYLMW.js';
1
+ import { presentation } from './chunk-LEF4X4KI.js';
2
2
 
3
3
  // src/format.ts
4
4
  var OPFFormatError = class extends Error {
@@ -1,10 +1,10 @@
1
- import { sortPresentationKeys } from './chunk-KELC4K62.js';
1
+ import { sortPresentationKeys } from './chunk-HKUV7NEN.js';
2
2
  import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
3
- import { Ctx, describeYamlErrors } from './chunk-HRKV43GC.js';
4
- import { same } from './chunk-KOCXV7H3.js';
5
- import { validate } from './chunk-M7YZU3DX.js';
6
- import { presentation } from './chunk-5Q4IYLMW.js';
7
- import { checkCatalogsOption } from './chunk-W3SEWSO5.js';
3
+ import { Ctx, describeYamlErrors } from './chunk-BBVW5ZC2.js';
4
+ import { same } from './chunk-XQO2CT6Q.js';
5
+ import { validate } from './chunk-OXLA4HXQ.js';
6
+ import { presentation } from './chunk-LEF4X4KI.js';
7
+ import { checkCatalogsOption } from './chunk-NVAJASOD.js';
8
8
  import { Parser, parseDocument, isMap, isSeq, Document, visit, isScalar, isAlias } from 'yaml';
9
9
 
10
10
  var MAX_ALIAS_COUNT = 100;
@@ -1,8 +1,8 @@
1
- import { fromMarkdown, toMarkdown } from './chunk-F5QC7E2O.js';
2
- import { fromYaml, toYaml } from './chunk-XG4JKFZ6.js';
1
+ import { fromMarkdown, toMarkdown } from './chunk-F7DN33UL.js';
2
+ import { fromYaml, toYaml } from './chunk-IT7FQKED.js';
3
3
  import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
4
- import { parseSource, validate, OPFValidationError } from './chunk-M7YZU3DX.js';
5
- import { checkCatalogsOption } from './chunk-W3SEWSO5.js';
4
+ import { parseSource, validate, OPFValidationError } from './chunk-OXLA4HXQ.js';
5
+ import { checkCatalogsOption } from './chunk-NVAJASOD.js';
6
6
 
7
7
  // src/deck-report.ts
8
8
  var DECK_FORMATS = ["json", "yaml", "markdown"];