@openpresentation/opf 0.26.4 → 0.26.5

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 (38) hide show
  1. package/README.md +2 -0
  2. package/dist/browser.js +13 -12
  3. package/dist/{chunk-XFOOKVRI.js → chunk-CIWC7DRZ.js} +1977 -373
  4. package/dist/{chunk-O6BY3AU2.js → chunk-DXTPLVAK.js} +1 -1
  5. package/dist/{chunk-QH2W6HIM.js → chunk-EFMR32A5.js} +1 -1
  6. package/dist/{chunk-6NBTZYYD.js → chunk-HPEZCAYC.js} +1 -1
  7. package/dist/{chunk-ZSZDVIDV.js → chunk-K5Q3LLYK.js} +2 -2
  8. package/dist/chunk-KPALXWX3.js +712 -0
  9. package/dist/{chunk-6IXSHIAL.js → chunk-L7YEVQHP.js} +6 -6
  10. package/dist/chunk-MD3CJ5YJ.js +452 -0
  11. package/dist/{chunk-MN7DRK57.js → chunk-MLH5LIGF.js} +11 -21
  12. package/dist/{chunk-EDCRBTJF.js → chunk-STIYINEL.js} +3 -3
  13. package/dist/{chunk-H5QC3X3K.js → chunk-TAV5S2JG.js} +1 -1
  14. package/dist/{chunk-NZLW6FBQ.js → chunk-UFEWQDQI.js} +1 -1
  15. package/dist/{chunk-GWJBZ4LC.js → chunk-UY6SQVR2.js} +5 -5
  16. package/dist/{chunk-PIO73BQ6.js → chunk-WAZDP2WS.js} +11 -20
  17. package/dist/{conversion-DSafOGzh.d.ts → conversion-C7o2EpDb.d.ts} +2 -2
  18. package/dist/conversion-PMJWLHDV.js +21 -0
  19. package/dist/convert.js +5 -5
  20. package/dist/deck.js +8 -8
  21. package/dist/diff.js +2 -2
  22. package/dist/docs.js +3 -3
  23. package/dist/explain-JSuESV-Y.d.ts +71 -0
  24. package/dist/index.d.ts +3 -2
  25. package/dist/index.js +17 -16
  26. package/dist/markdown.js +6 -6
  27. package/dist/node-engine.d.ts +2 -2
  28. package/dist/node-engine.js +17 -16
  29. package/dist/pagination.js +2 -2
  30. package/dist/patch.js +1 -1
  31. package/dist/schema.js +1 -1
  32. package/dist/source.d.ts +83 -2
  33. package/dist/source.js +10 -9
  34. package/dist/validator.js +1 -1
  35. package/dist/yaml.js +4 -4
  36. package/package.json +5 -5
  37. package/dist/chunk-QAEBYDKY.js +0 -192
  38. package/dist/conversion-QIAJM6DQ.js +0 -20
@@ -1,11 +1,11 @@
1
1
  import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
2
- import { Ctx } from './chunk-QAEBYDKY.js';
3
- import { same } from './chunk-6NBTZYYD.js';
4
- import { validate } from './chunk-XFOOKVRI.js';
2
+ import { Ctx, describeYamlErrors } from './chunk-KPALXWX3.js';
3
+ import { same } from './chunk-HPEZCAYC.js';
4
+ import { validate } from './chunk-CIWC7DRZ.js';
5
5
  import { checkCatalogsOption } from './chunk-XRMV2GMB.js';
6
6
  import { sortPresentationKeys } from './chunk-EQ6S5SEZ.js';
7
7
  import { presentation } from './chunk-F4HFDP6I.js';
8
- import { Parser, parseDocument, isMap, Document, visit, isScalar, isAlias, isSeq } from 'yaml';
8
+ import { Parser, parseDocument, isMap, isSeq, Document, visit, isScalar, isAlias } from 'yaml';
9
9
 
10
10
  var MAX_ALIAS_COUNT = 100;
11
11
  var CORE_TAGS = new Set(["map", "seq", "str", "int", "float", "bool", "null"].map((name) => `tag:yaml.org,2002:${name}`));
@@ -59,16 +59,6 @@ function describeError(error) {
59
59
  return { rule: "syntax", message: `YAML: ${text}`, help: "Fix the YAML syntax at this position. An OPF file holds JSON-compatible YAML 1.2: mappings, sequences and scalars." };
60
60
  }
61
61
  }
62
- function keyRangeAt(doc, start) {
63
- let found;
64
- visit(doc, {
65
- Pair(_key, pair) {
66
- const key = pair.key;
67
- if (!found && key?.range && key.range[0] === start) found = { start, end: key.range[1] };
68
- }
69
- });
70
- return found;
71
- }
72
62
  function readYamlDocument(source, aliases, rootKind = "mapping") {
73
63
  const bom = source.startsWith("\uFEFF") ? 1 : 0;
74
64
  const text = source.slice(bom);
@@ -91,20 +81,21 @@ function readYamlDocument(source, aliases, rootKind = "mapping") {
91
81
  findings,
92
82
  errors: findings.length
93
83
  });
94
- for (const error of [...doc.errors, ...doc.warnings.filter((warning) => warning.code === "TAG_RESOLVE_FAILED")]) {
95
- const described = describeError(error);
96
- const [start, end] = error.pos;
97
- add(described.rule, described.message, described.help, (error.code === "DUPLICATE_KEY" ? keyRangeAt(doc, start) : void 0) ?? { start, end: Math.max(start, end) });
84
+ for (const problem of describeYamlErrors(text, doc, doc.errors)) add(problem.rule, problem.message, problem.help, { start: problem.start, end: problem.end });
85
+ for (const warning of doc.warnings.filter((entry) => entry.code === "TAG_RESOLVE_FAILED")) {
86
+ const described = describeError(warning);
87
+ const [start, end] = warning.pos;
88
+ add(described.rule, described.message, described.help, { start, end: Math.max(start, end) });
98
89
  }
99
90
  if (findings.length) return finish({});
100
91
  const root = doc.contents;
101
92
  if (root === null || !root.range) {
102
- add("empty", "The input holds no YAML document.", "An OPF file is one YAML mapping: write the deck properties (name, slides, ...) as key: value lines.", { start: 0, end: Math.min(1, text.length) });
93
+ add("empty", "The document is empty (or everything in it is a comment).", "Write `slides:` and at least one `- title:` line.", { start: 0, end: Math.min(1, text.length) });
103
94
  return finish({});
104
95
  }
105
96
  const rootRange = { start: root.range[0], end: root.range[1] };
106
97
  if (rootKind === "mapping" && !isMap(root)) {
107
- add("not-mapping", "The document is not a mapping.", "An OPF deck is a YAML mapping of keys and values (name:, slides:, ...), not a list or a single value.", rootRange);
98
+ add("not-mapping", `The top level must be \`key: value\` lines, but this is ${isSeq(root) ? "a list" : "plain text"}.`, isSeq(root) ? "Put the list under `slides:`." : "Start with `name:` and `slides:` lines.", rootRange);
108
99
  return finish({});
109
100
  }
110
101
  checkTree({ doc, text, aliases, add }, root, [], []);
@@ -43,8 +43,8 @@ declare const RENDER_PACKAGE = "@openpresentation/opf-render";
43
43
  declare const PPTX_PACKAGE = "@openpresentation/opf-pptx";
44
44
  /** Peer ranges. The CLI checks the features it calls rather than the version, so a newer release in range keeps working. */
45
45
  declare const PEER_RANGES: {
46
- readonly "@openpresentation/opf-render": "^0.26.4";
47
- readonly "@openpresentation/opf-pptx": "^0.26.4";
46
+ readonly "@openpresentation/opf-render": "^0.26.5";
47
+ readonly "@openpresentation/opf-pptx": "^0.26.5";
48
48
  };
49
49
  interface Diagnostic {
50
50
  code: string;
@@ -0,0 +1,21 @@
1
+ export { convertFiles, deckFileFormat, exportFormatOf, openDeck, planConversion, readInput, saveDeck, writePlanned } from './chunk-L7YEVQHP.js';
2
+ import './chunk-K5Q3LLYK.js';
3
+ import './chunk-UFEWQDQI.js';
4
+ import './chunk-UJSAR6GF.js';
5
+ import './chunk-PJSPHHRK.js';
6
+ import './chunk-TKQ2VFV5.js';
7
+ import './chunk-EFMR32A5.js';
8
+ import './chunk-STIYINEL.js';
9
+ import './chunk-UY6SQVR2.js';
10
+ import './chunk-WAZDP2WS.js';
11
+ import './chunk-RYZPBJLB.js';
12
+ import './chunk-MD3CJ5YJ.js';
13
+ import './chunk-MLH5LIGF.js';
14
+ import './chunk-DXTPLVAK.js';
15
+ import './chunk-KPALXWX3.js';
16
+ import './chunk-HPEZCAYC.js';
17
+ import './chunk-TAV5S2JG.js';
18
+ import './chunk-CIWC7DRZ.js';
19
+ import './chunk-XRMV2GMB.js';
20
+ import './chunk-EQ6S5SEZ.js';
21
+ import './chunk-F4HFDP6I.js';
package/dist/convert.js CHANGED
@@ -1,8 +1,8 @@
1
- import { paginate, OPFPaginationError } from './chunk-QH2W6HIM.js';
2
- import { parseQuoteLines, parseCodeFence, splitWhen, parseListLine, levelsFromIndents, fenceCode } from './chunk-O6BY3AU2.js';
3
- import { CONTENT_KEYS, isRecord, contentKeysOf, refuse, clone, Loss, isSlideLike, assertValidOwner, report, OPFConversionError, plainOf, assertValidOutput, same, splitRuns, runsOf, lineIsPlain, linePlain, concatText, lineValue, joinLines, hasFormatting } from './chunk-6NBTZYYD.js';
4
- export { OPFConversionError } from './chunk-6NBTZYYD.js';
5
- import './chunk-XFOOKVRI.js';
1
+ import { paginate, OPFPaginationError } from './chunk-EFMR32A5.js';
2
+ import { parseQuoteLines, parseCodeFence, splitWhen, parseListLine, levelsFromIndents, fenceCode } from './chunk-DXTPLVAK.js';
3
+ import { CONTENT_KEYS, isRecord, contentKeysOf, refuse, clone, Loss, isSlideLike, assertValidOwner, report, OPFConversionError, plainOf, assertValidOutput, same, splitRuns, runsOf, lineIsPlain, linePlain, concatText, lineValue, joinLines, hasFormatting } from './chunk-HPEZCAYC.js';
4
+ export { OPFConversionError } from './chunk-HPEZCAYC.js';
5
+ import './chunk-CIWC7DRZ.js';
6
6
  import { promotedRegionKeys, isDatasetRef, inlineTableData, visitContentPayloads, chartNumber } from './chunk-XRMV2GMB.js';
7
7
  import './chunk-F4HFDP6I.js';
8
8
 
package/dist/deck.js CHANGED
@@ -1,12 +1,12 @@
1
- export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-EDCRBTJF.js';
2
- import './chunk-GWJBZ4LC.js';
3
- import './chunk-PIO73BQ6.js';
1
+ export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-STIYINEL.js';
2
+ import './chunk-UY6SQVR2.js';
3
+ import './chunk-WAZDP2WS.js';
4
4
  import './chunk-RYZPBJLB.js';
5
- import './chunk-MN7DRK57.js';
6
- import './chunk-O6BY3AU2.js';
7
- import './chunk-QAEBYDKY.js';
8
- import './chunk-6NBTZYYD.js';
9
- import './chunk-XFOOKVRI.js';
5
+ import './chunk-MLH5LIGF.js';
6
+ import './chunk-DXTPLVAK.js';
7
+ import './chunk-KPALXWX3.js';
8
+ import './chunk-HPEZCAYC.js';
9
+ import './chunk-CIWC7DRZ.js';
10
10
  import './chunk-XRMV2GMB.js';
11
11
  import './chunk-EQ6S5SEZ.js';
12
12
  import './chunk-F4HFDP6I.js';
package/dist/diff.js CHANGED
@@ -1,4 +1,4 @@
1
- export { categoryOf, describeValue, diff, formatDiffReport, matchArrays, merge, similarity } from './chunk-H5QC3X3K.js';
2
- import './chunk-XFOOKVRI.js';
1
+ export { categoryOf, describeValue, diff, formatDiffReport, matchArrays, merge, similarity } from './chunk-TAV5S2JG.js';
2
+ import './chunk-CIWC7DRZ.js';
3
3
  import './chunk-XRMV2GMB.js';
4
4
  import './chunk-F4HFDP6I.js';