@openpresentation/opf 0.26.2 → 0.26.4

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 (43) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.js +15 -13
  3. package/dist/{chunk-5VJCLUUA.js → chunk-6IXSHIAL.js} +6 -6
  4. package/dist/{chunk-O2ST5ZKL.js → chunk-6NBTZYYD.js} +1 -1
  5. package/dist/{chunk-NWO6HT4F.js → chunk-EDCRBTJF.js} +4 -4
  6. package/dist/{chunk-JI3PHXPJ.js → chunk-EQ6S5SEZ.js} +1 -1
  7. package/dist/{chunk-N6CNJCIF.js → chunk-F4HFDP6I.js} +0 -18
  8. package/dist/chunk-GWJBZ4LC.js +639 -0
  9. package/dist/{chunk-LN2ASLMF.js → chunk-H5QC3X3K.js} +1 -1
  10. package/dist/{chunk-Q6KMKTEH.js → chunk-MN7DRK57.js} +40 -648
  11. package/dist/{chunk-OFWBICDO.js → chunk-NZLW6FBQ.js} +1 -1
  12. package/dist/{chunk-CRCOQ4K2.js → chunk-O6BY3AU2.js} +1 -1
  13. package/dist/{chunk-7YZ72FRP.js → chunk-PIO73BQ6.js} +6 -5
  14. package/dist/{chunk-6JAFSZVL.js → chunk-QAEBYDKY.js} +2 -4
  15. package/dist/{chunk-L65YNP4J.js → chunk-QH2W6HIM.js} +1 -1
  16. package/dist/chunk-RYZPBJLB.js +4 -0
  17. package/dist/{chunk-LUQYSUXS.js → chunk-XFOOKVRI.js} +57 -4
  18. package/dist/{chunk-XFK4KPKK.js → chunk-ZSZDVIDV.js} +2 -2
  19. package/dist/{conversion-CX_I6Vna.d.ts → conversion-DSafOGzh.d.ts} +2 -2
  20. package/dist/conversion-QIAJM6DQ.js +20 -0
  21. package/dist/convert.js +6 -6
  22. package/dist/deck.js +11 -9
  23. package/dist/diff.js +3 -3
  24. package/dist/docs.js +3 -3
  25. package/dist/format.js +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +19 -17
  28. package/dist/markdown.js +8 -6
  29. package/dist/node-engine.d.ts +2 -2
  30. package/dist/node-engine.js +19 -17
  31. package/dist/pagination.js +3 -3
  32. package/dist/patch.js +2 -2
  33. package/dist/schema.d.ts +18 -4
  34. package/dist/schema.js +2 -2
  35. package/dist/schemas.js +1 -1
  36. package/dist/source.d.ts +102 -4
  37. package/dist/source.js +389 -10
  38. package/dist/spec/schemas/opf.schema.json +0 -16
  39. package/dist/spec/schemas/theme.schema.json +0 -2
  40. package/dist/validator.js +2 -2
  41. package/dist/yaml.js +7 -6
  42. package/package.json +5 -5
  43. package/dist/conversion-BKCKBECG.js +0 -18
@@ -1,5 +1,5 @@
1
1
  import { OPFDataImportError, parseTabularData } from './chunk-TKQ2VFV5.js';
2
- import { applyPatchWithInverse, validate, OPFValidationError } from './chunk-LUQYSUXS.js';
2
+ import { applyPatchWithInverse, validate, OPFValidationError } from './chunk-XFOOKVRI.js';
3
3
  import { embeddedCopy, checkCatalogsOption, catalogReferenceSites, parseReference, catalogGroupDeclared, resolveReference, dottedPath, unresolvedReference, recordReferenceSites, catalogGroupSource, registeredCatalog, catalogKinds, CATALOG_GROUP_PATTERN, isRecord, visitContentPayloads, annotationText, listVariables, resolveVariables, LOGO_SHAPES, resolveDesignRecords, resolveFontFamilies, resolveCanvasDimensions, imageBackground } from './chunk-XRMV2GMB.js';
4
4
 
5
5
  // src/api-errors.ts
@@ -1,4 +1,4 @@
1
- import { runText } from './chunk-O2ST5ZKL.js';
1
+ import { runText } from './chunk-6NBTZYYD.js';
2
2
 
3
3
  // src/convert/text-lines.ts
4
4
  var LIST_PREFIX = /^([ \t]*)(?:([-*•+]|\d{1,3}[.)])[ \t]+)?/;
@@ -1,9 +1,10 @@
1
- import { NOT_CHECKED, Ctx } from './chunk-6JAFSZVL.js';
2
- import { same } from './chunk-O2ST5ZKL.js';
3
- import { validate } from './chunk-LUQYSUXS.js';
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';
4
5
  import { checkCatalogsOption } from './chunk-XRMV2GMB.js';
5
- import { sortPresentationKeys } from './chunk-JI3PHXPJ.js';
6
- import { presentation } from './chunk-N6CNJCIF.js';
6
+ import { sortPresentationKeys } from './chunk-EQ6S5SEZ.js';
7
+ import { presentation } from './chunk-F4HFDP6I.js';
7
8
  import { Parser, parseDocument, isMap, Document, visit, isScalar, isAlias, isSeq } from 'yaml';
8
9
 
9
10
  var MAX_ALIAS_COUNT = 100;
@@ -1,8 +1,6 @@
1
- import { isRecord, same } from './chunk-O2ST5ZKL.js';
1
+ import { isRecord, same } from './chunk-6NBTZYYD.js';
2
2
  import { parseDocument, YAMLMap, Scalar, stringify } from 'yaml';
3
3
 
4
- // src/not-checked.ts
5
- var NOT_CHECKED = { syntax: "checked", schema: "not-run", references: "not-run", policy: "not-run", accessibility: "not-run", content: "not-run", layout: "not-run", backgroundPixels: "not-read", imageBytes: "embedded-only", nativeExport: "not-checked" };
6
4
  function splitLines(source) {
7
5
  const lines = [];
8
6
  let start = 0;
@@ -191,4 +189,4 @@ var OPFMarkdownError = class extends Error {
191
189
  }
192
190
  };
193
191
 
194
- export { Ctx, DECIMAL, NOT_CHECKED, OPFMarkdownError, csvField, lineRange, readCsv, readYamlMapping, scalarText, splitLines, writeYaml };
192
+ export { Ctx, DECIMAL, OPFMarkdownError, csvField, lineRange, readCsv, readYamlMapping, scalarText, splitLines, writeYaml };
@@ -1,4 +1,4 @@
1
- import { assertValid, resolveSlideScriptMeasurement, resolveSlideContext } from './chunk-LUQYSUXS.js';
1
+ import { assertValid, resolveSlideScriptMeasurement, resolveSlideContext } from './chunk-XFOOKVRI.js';
2
2
  import { resolveSlideVariables, checkCatalogsOption, usesSlideBuiltin, composeSlide, codeHighlightSlice, tableRowBoundaries, visitContentPayloads, regionAccepts, slideTokenSpans, sliceNumberedItems } from './chunk-XRMV2GMB.js';
3
3
 
4
4
  // src/pagination.ts
@@ -0,0 +1,4 @@
1
+ // src/not-checked.ts
2
+ var NOT_CHECKED = { syntax: "checked", schema: "not-run", references: "not-run", policy: "not-run", accessibility: "not-run", content: "not-run", layout: "not-run", backgroundPixels: "not-read", imageBytes: "embedded-only", nativeExport: "not-checked" };
3
+
4
+ export { NOT_CHECKED };
@@ -1,5 +1,5 @@
1
1
  import { promotedRegionKeys, VARIABLE_KINDS, resolveChartData, chartPaletteForFill, chartSeriesPalette, normalizeHexColor, resolveChartColors, colorContrast, imageBackground, tableGrid, timelineTextColor, LOGO_SHAPES, visitContentPayloads, readingRows, visualReadingOrder, intrinsicImageSize, resolveReference, textWidthMeasurer, resolveColorRef, resolveDesignRecords, resolveFontFamilies, checkCatalogsOption, provenanceOf, unresolvedReference, OPFUnresolvedReferenceError, resolveColorRoles, resolveCanvasDimensions, resolveSlideVariables, normalizeColorVariant, isRecord, hasContentVariables, isTemplate, instantiateForValidation, layoutTemplateIssues, resolveScriptFonts, defaultSlideBackground, catalogReferenceSites, parseReference, catalogGroupDeclared, pointerPath, unusedDatasets, MAX_COMPOSITION_DEPTH, datasetDiagnostics, pathFor, catalogRecords, collectCitations, numberingFindings, walkCitationRuns, resolveTableData, resolveChartOptions, chartOptionTarget, codeHighlightLines, chartNumberFixesByCell, catalogKinds, catalogGroupSource, registeredCatalog, OPFCompositionError, composeSlide } from './chunk-XRMV2GMB.js';
2
- import { schemas, schemaEntries } from './chunk-N6CNJCIF.js';
2
+ import { schemas, schemaEntries } from './chunk-F4HFDP6I.js';
3
3
  import Ajv2020 from 'ajv/dist/2020.js';
4
4
  import addFormats from 'ajv-formats';
5
5
  import { parseTree, printParseErrorCode, getNodePath } from 'jsonc-parser';
@@ -3755,10 +3755,35 @@ function invertPatch(document, patch) {
3755
3755
  return applyPatchWithInverse(document, patch).inverse;
3756
3756
  }
3757
3757
 
3758
+ // src/schema-catalog-kinds.ts
3759
+ var schemaCatalogKinds = {
3760
+ "presentation#/properties/audience": "audiences",
3761
+ "presentation#/properties/audience/oneOf/2/items": "audiences",
3762
+ "presentation#/properties/purpose": "purposes",
3763
+ "presentation#/properties/tone": "tones",
3764
+ "presentation#/properties/narrative": "narratives",
3765
+ "presentation#/$defs/Audience/properties/id": "audiences",
3766
+ "presentation#/$defs/Purpose/properties/id": "purposes",
3767
+ "presentation#/$defs/Language/properties/fontScheme": "fontSchemes",
3768
+ "presentation#/$defs/Language/properties/googleFontScheme": "fontSchemes",
3769
+ "presentation#/$defs/Tone/properties/id": "tones",
3770
+ "presentation#/$defs/Design/properties/theme": "themes",
3771
+ "presentation#/$defs/Design/properties/colorScheme": "colorSchemes",
3772
+ "presentation#/$defs/Design/properties/fontScheme": "fontSchemes",
3773
+ "presentation#/$defs/ColorScheme/properties/id": "colorSchemes",
3774
+ "presentation#/$defs/FontScheme/properties/id": "fontSchemes",
3775
+ "presentation#/$defs/Slide/properties/layout": "layouts",
3776
+ "theme#/properties/colorScheme": "colorSchemes",
3777
+ "theme#/properties/fontScheme": "fontSchemes"
3778
+ };
3779
+
3758
3780
  // src/schema-navigation.ts
3759
3781
  var own3 = (object2, key2) => object2 !== null && typeof object2 === "object" && Object.hasOwn(object2, key2);
3760
3782
  var documents = new Map(Object.values(schemas).map((schema) => [schema.$id, schema]));
3761
3783
  var presentationSchema = schemas.presentation;
3784
+ var CATALOG_KIND = /* @__PURE__ */ Symbol.for("@openpresentation/opf:catalog-kind");
3785
+ var catalogKindOfNode = /* @__PURE__ */ new WeakMap();
3786
+ var kindOfNode = (node) => catalogKindOfNode.get(node) ?? node[CATALOG_KIND];
3762
3787
  function splitOpfPath(path) {
3763
3788
  if (Array.isArray(path)) return path.map((segment) => String(segment));
3764
3789
  if (typeof path !== "string") throw new TypeError("An OPF path must be a string or an array of segments.");
@@ -3774,10 +3799,18 @@ function readSchemaPointer(target, pointer4) {
3774
3799
  }
3775
3800
  return current;
3776
3801
  }
3802
+ for (const [key2, kind] of Object.entries(schemaCatalogKinds)) {
3803
+ const [name = "", pointer4 = ""] = key2.split("#");
3804
+ const node = readSchemaPointer(schemas[name], pointer4);
3805
+ if (node === void 0 || node === null || typeof node !== "object") throw new Error(`schemaCatalogKinds: ${key2} is not a schema node.`);
3806
+ catalogKindOfNode.set(node, kind);
3807
+ }
3777
3808
  function absolutize(schema, id) {
3778
3809
  if (Array.isArray(schema)) return schema.map((item) => absolutize(item, id));
3779
3810
  if (schema === null || typeof schema !== "object") return schema;
3780
3811
  const copy = {};
3812
+ const kind = kindOfNode(schema);
3813
+ if (kind !== void 0) copy[CATALOG_KIND] = kind;
3781
3814
  for (const [key2, value] of Object.entries(schema)) copy[key2] = key2 === "$ref" && typeof value === "string" && value.startsWith("#") ? `${id}${value}` : absolutize(value, id);
3782
3815
  return copy;
3783
3816
  }
@@ -3797,6 +3830,11 @@ function mergeAllOf(schema, root, seen) {
3797
3830
  return merged;
3798
3831
  }
3799
3832
  function resolveSchema(schema, root = presentationSchema, seen = /* @__PURE__ */ new Set()) {
3833
+ const resolved = resolveNode(schema, root, seen);
3834
+ const kind = schema && typeof schema === "object" ? kindOfNode(schema) : void 0;
3835
+ return kind === void 0 ? resolved : { ...resolved, [CATALOG_KIND]: kind };
3836
+ }
3837
+ function resolveNode(schema, root, seen) {
3800
3838
  if (!schema || typeof schema !== "object") return {};
3801
3839
  if (!schema.$ref) return mergeAllOf(schema, root, seen);
3802
3840
  const ref = schema.$ref;
@@ -3998,8 +4036,8 @@ function enumValues(variants, inherited) {
3998
4036
  }
3999
4037
  function catalogKindOf(schema, variants = []) {
4000
4038
  for (const candidate of [schema, ...variants]) {
4001
- const kind = candidate["x-opf-catalog"];
4002
- if (typeof kind === "string" && own3(catalogSchemaNames, kind)) return kind;
4039
+ const kind = kindOfNode(candidate);
4040
+ if (kind !== void 0 && own3(catalogSchemaNames, kind)) return kind;
4003
4041
  }
4004
4042
  return void 0;
4005
4043
  }
@@ -4197,6 +4235,21 @@ function applyTextEdits(text, edits) {
4197
4235
  }
4198
4236
  return result + text.slice(cursor);
4199
4237
  }
4238
+ function rememberByText(read, size = 2) {
4239
+ const kept = [];
4240
+ return (text) => {
4241
+ const at2 = kept.findIndex((entry) => entry.text === text);
4242
+ if (at2 >= 0) {
4243
+ const [entry] = kept.splice(at2, 1);
4244
+ kept.unshift(entry);
4245
+ return entry.value;
4246
+ }
4247
+ const value = read(text);
4248
+ kept.unshift({ text, value });
4249
+ if (kept.length > size) kept.pop();
4250
+ return value;
4251
+ };
4252
+ }
4200
4253
 
4201
4254
  // src/json-syntax.ts
4202
4255
  var WORD = /[\p{L}\p{N}_$.+\-%]/u;
@@ -5767,4 +5820,4 @@ function assertValidCatalogRecord(kind, value) {
5767
5820
  if (!report2.valid) throw new OPFValidationError(report2);
5768
5821
  }
5769
5822
 
5770
- export { CATALOG_SCHEMA, COMMON_KEYS, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchValidationError, OPFValidationError, UNRANKED_PRIORITY, activeSchema, analyzeJsonSyntax, applyPatch, applyPatchWithInverse, applyTextEdits, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogKindAt, catalogSchemaNames, createLocator, createSchemaValue, describeField, escapePointerToken, findValidationRule, formatPointer, getAtPointer, hasPointer, invertPatch, isPromotedRegionKey, jsonEqual, listSchemaFields, normalizePatch, parsePointer, parseSource, pointerFromPath, readPointer, resolveSchema, resolveSlideContext, resolveSlideScriptMeasurement, schemaAtPath, schemaLabel, schemaType, schemaVariants, splitOpfPath, splitPointer2 as splitPointer, unescapePointerToken, validate, validateCatalogRecord, validationCategories, validationRules };
5823
+ export { CATALOG_SCHEMA, COMMON_KEYS, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchValidationError, OPFValidationError, UNRANKED_PRIORITY, activeSchema, analyzeJsonSyntax, applyPatch, applyPatchWithInverse, applyTextEdits, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogKindAt, catalogSchemaNames, createLocator, createSchemaValue, describeField, escapePointerToken, findValidationRule, formatPointer, getAtPointer, hasPointer, invertPatch, isPromotedRegionKey, jsonEqual, listSchemaFields, normalizePatch, parsePointer, parseSource, pointerFromPath, readPointer, rememberByText, resolveSchema, resolveSlideContext, resolveSlideScriptMeasurement, schemaAtPath, schemaCatalogKinds, schemaLabel, schemaType, schemaVariants, splitOpfPath, splitPointer2 as splitPointer, unescapePointerToken, validate, validateCatalogRecord, validationCategories, validationRules };
@@ -1,5 +1,5 @@
1
- import { OPFApiError } from './chunk-OFWBICDO.js';
2
- import { CATALOG_SCHEMA } from './chunk-LUQYSUXS.js';
1
+ import { OPFApiError } from './chunk-NZLW6FBQ.js';
2
+ import { CATALOG_SCHEMA } from './chunk-XFOOKVRI.js';
3
3
  import { CATALOG_SCHEMA as CATALOG_SCHEMA$1, gallery } from '@openpresentation/gallery';
4
4
 
5
5
  function galleryMismatch(declared, reads = CATALOG_SCHEMA) {
@@ -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.2";
47
- readonly "@openpresentation/opf-pptx": "^0.26.2";
46
+ readonly "@openpresentation/opf-render": "^0.26.4";
47
+ readonly "@openpresentation/opf-pptx": "^0.26.4";
48
48
  };
49
49
  interface Diagnostic {
50
50
  code: string;
@@ -0,0 +1,20 @@
1
+ export { convertFiles, deckFileFormat, exportFormatOf, openDeck, planConversion, readInput, saveDeck, writePlanned } from './chunk-6IXSHIAL.js';
2
+ import './chunk-ZSZDVIDV.js';
3
+ import './chunk-NZLW6FBQ.js';
4
+ import './chunk-UJSAR6GF.js';
5
+ import './chunk-PJSPHHRK.js';
6
+ import './chunk-TKQ2VFV5.js';
7
+ import './chunk-QH2W6HIM.js';
8
+ import './chunk-EDCRBTJF.js';
9
+ import './chunk-GWJBZ4LC.js';
10
+ import './chunk-PIO73BQ6.js';
11
+ import './chunk-RYZPBJLB.js';
12
+ import './chunk-MN7DRK57.js';
13
+ import './chunk-O6BY3AU2.js';
14
+ import './chunk-QAEBYDKY.js';
15
+ import './chunk-6NBTZYYD.js';
16
+ import './chunk-H5QC3X3K.js';
17
+ import './chunk-XFOOKVRI.js';
18
+ import './chunk-XRMV2GMB.js';
19
+ import './chunk-EQ6S5SEZ.js';
20
+ import './chunk-F4HFDP6I.js';
package/dist/convert.js CHANGED
@@ -1,10 +1,10 @@
1
- import { paginate, OPFPaginationError } from './chunk-L65YNP4J.js';
2
- import { parseQuoteLines, parseCodeFence, splitWhen, parseListLine, levelsFromIndents, fenceCode } from './chunk-CRCOQ4K2.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-O2ST5ZKL.js';
4
- export { OPFConversionError } from './chunk-O2ST5ZKL.js';
5
- import './chunk-LUQYSUXS.js';
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';
6
6
  import { promotedRegionKeys, isDatasetRef, inlineTableData, visitContentPayloads, chartNumber } from './chunk-XRMV2GMB.js';
7
- import './chunk-N6CNJCIF.js';
7
+ import './chunk-F4HFDP6I.js';
8
8
 
9
9
  // src/convert/tables.ts
10
10
  function cellOf(raw) {
package/dist/deck.js CHANGED
@@ -1,10 +1,12 @@
1
- export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-NWO6HT4F.js';
2
- import './chunk-Q6KMKTEH.js';
3
- import './chunk-CRCOQ4K2.js';
4
- import './chunk-7YZ72FRP.js';
5
- import './chunk-6JAFSZVL.js';
6
- import './chunk-O2ST5ZKL.js';
7
- import './chunk-LUQYSUXS.js';
1
+ export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-EDCRBTJF.js';
2
+ import './chunk-GWJBZ4LC.js';
3
+ import './chunk-PIO73BQ6.js';
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';
8
10
  import './chunk-XRMV2GMB.js';
9
- import './chunk-JI3PHXPJ.js';
10
- import './chunk-N6CNJCIF.js';
11
+ import './chunk-EQ6S5SEZ.js';
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-LN2ASLMF.js';
2
- import './chunk-LUQYSUXS.js';
1
+ export { categoryOf, describeValue, diff, formatDiffReport, matchArrays, merge, similarity } from './chunk-H5QC3X3K.js';
2
+ import './chunk-XFOOKVRI.js';
3
3
  import './chunk-XRMV2GMB.js';
4
- import './chunk-N6CNJCIF.js';
4
+ import './chunk-F4HFDP6I.js';