@openpresentation/opf 0.26.3 → 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 (39) hide show
  1. package/README.md +3 -1
  2. package/dist/browser.js +14 -11
  3. package/dist/{chunk-NJWI6MPT.js → chunk-CIWC7DRZ.js} +1985 -366
  4. package/dist/{chunk-7RY7QWWJ.js → chunk-DXTPLVAK.js} +1 -1
  5. package/dist/{chunk-54OV2WQC.js → chunk-EFMR32A5.js} +1 -1
  6. package/dist/{chunk-PXOXTJTN.js → chunk-HPEZCAYC.js} +1 -1
  7. package/dist/{chunk-2ZQBMZTZ.js → chunk-K5Q3LLYK.js} +2 -2
  8. package/dist/chunk-KPALXWX3.js +712 -0
  9. package/dist/{chunk-34LIUOT7.js → chunk-L7YEVQHP.js} +6 -6
  10. package/dist/chunk-MD3CJ5YJ.js +452 -0
  11. package/dist/{chunk-WASENX2R.js → chunk-MLH5LIGF.js} +29 -647
  12. package/dist/chunk-RYZPBJLB.js +4 -0
  13. package/dist/{chunk-FXNUM2PN.js → chunk-STIYINEL.js} +4 -4
  14. package/dist/{chunk-YVNFACTC.js → chunk-TAV5S2JG.js} +1 -1
  15. package/dist/{chunk-GLLR3AQ5.js → chunk-UFEWQDQI.js} +1 -1
  16. package/dist/chunk-UY6SQVR2.js +639 -0
  17. package/dist/{chunk-PB5X2VSV.js → chunk-WAZDP2WS.js} +12 -20
  18. package/dist/{conversion-BjsKgxBZ.d.ts → conversion-C7o2EpDb.d.ts} +2 -2
  19. package/dist/conversion-PMJWLHDV.js +21 -0
  20. package/dist/convert.js +5 -5
  21. package/dist/deck.js +9 -7
  22. package/dist/diff.js +2 -2
  23. package/dist/docs.js +3 -3
  24. package/dist/explain-JSuESV-Y.d.ts +71 -0
  25. package/dist/index.d.ts +3 -2
  26. package/dist/index.js +18 -15
  27. package/dist/markdown.js +7 -5
  28. package/dist/node-engine.d.ts +2 -2
  29. package/dist/node-engine.js +18 -15
  30. package/dist/pagination.js +2 -2
  31. package/dist/patch.js +1 -1
  32. package/dist/schema.js +1 -1
  33. package/dist/source.d.ts +184 -5
  34. package/dist/source.js +391 -11
  35. package/dist/validator.js +1 -1
  36. package/dist/yaml.js +5 -4
  37. package/package.json +5 -5
  38. package/dist/chunk-DEI2M2H6.js +0 -194
  39. package/dist/conversion-F4UCOGR7.js +0 -18
@@ -1,10 +1,11 @@
1
- import { NOT_CHECKED, Ctx } from './chunk-DEI2M2H6.js';
2
- import { same } from './chunk-PXOXTJTN.js';
3
- import { validate } from './chunk-NJWI6MPT.js';
1
+ import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
2
+ import { Ctx, describeYamlErrors } from './chunk-KPALXWX3.js';
3
+ import { same } from './chunk-HPEZCAYC.js';
4
+ import { validate } from './chunk-CIWC7DRZ.js';
4
5
  import { checkCatalogsOption } from './chunk-XRMV2GMB.js';
5
6
  import { sortPresentationKeys } from './chunk-EQ6S5SEZ.js';
6
7
  import { presentation } from './chunk-F4HFDP6I.js';
7
- import { Parser, parseDocument, isMap, Document, visit, isScalar, isAlias, isSeq } from 'yaml';
8
+ import { Parser, parseDocument, isMap, isSeq, Document, visit, isScalar, isAlias } from 'yaml';
8
9
 
9
10
  var MAX_ALIAS_COUNT = 100;
10
11
  var CORE_TAGS = new Set(["map", "seq", "str", "int", "float", "bool", "null"].map((name) => `tag:yaml.org,2002:${name}`));
@@ -58,16 +59,6 @@ function describeError(error) {
58
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." };
59
60
  }
60
61
  }
61
- function keyRangeAt(doc, start) {
62
- let found;
63
- visit(doc, {
64
- Pair(_key, pair) {
65
- const key = pair.key;
66
- if (!found && key?.range && key.range[0] === start) found = { start, end: key.range[1] };
67
- }
68
- });
69
- return found;
70
- }
71
62
  function readYamlDocument(source, aliases, rootKind = "mapping") {
72
63
  const bom = source.startsWith("\uFEFF") ? 1 : 0;
73
64
  const text = source.slice(bom);
@@ -90,20 +81,21 @@ function readYamlDocument(source, aliases, rootKind = "mapping") {
90
81
  findings,
91
82
  errors: findings.length
92
83
  });
93
- for (const error of [...doc.errors, ...doc.warnings.filter((warning) => warning.code === "TAG_RESOLVE_FAILED")]) {
94
- const described = describeError(error);
95
- const [start, end] = error.pos;
96
- 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) });
97
89
  }
98
90
  if (findings.length) return finish({});
99
91
  const root = doc.contents;
100
92
  if (root === null || !root.range) {
101
- 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) });
102
94
  return finish({});
103
95
  }
104
96
  const rootRange = { start: root.range[0], end: root.range[1] };
105
97
  if (rootKind === "mapping" && !isMap(root)) {
106
- 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);
107
99
  return finish({});
108
100
  }
109
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.3";
47
- readonly "@openpresentation/opf-pptx": "^0.26.3";
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-54OV2WQC.js';
2
- import { parseQuoteLines, parseCodeFence, splitWhen, parseListLine, levelsFromIndents, fenceCode } from './chunk-7RY7QWWJ.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-PXOXTJTN.js';
4
- export { OPFConversionError } from './chunk-PXOXTJTN.js';
5
- import './chunk-NJWI6MPT.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,10 +1,12 @@
1
- export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-FXNUM2PN.js';
2
- import './chunk-WASENX2R.js';
3
- import './chunk-7RY7QWWJ.js';
4
- import './chunk-PB5X2VSV.js';
5
- import './chunk-DEI2M2H6.js';
6
- import './chunk-PXOXTJTN.js';
7
- import './chunk-NJWI6MPT.js';
1
+ export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-STIYINEL.js';
2
+ import './chunk-UY6SQVR2.js';
3
+ import './chunk-WAZDP2WS.js';
4
+ import './chunk-RYZPBJLB.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';
8
10
  import './chunk-XRMV2GMB.js';
9
11
  import './chunk-EQ6S5SEZ.js';
10
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-YVNFACTC.js';
2
- import './chunk-NJWI6MPT.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';