@openpresentation/opf 0.26.1 → 0.26.3

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 (52) hide show
  1. package/README.md +4 -0
  2. package/dist/browser.js +13 -14
  3. package/dist/{catalog-refs-CSHevLn1.d.ts → catalog-refs-BSfGELpt.d.ts} +1 -1
  4. package/dist/catalog-schemas-DoxA2BgY.d.ts +19 -0
  5. package/dist/{chunk-IC6OPLMU.js → chunk-2ZQBMZTZ.js} +2 -2
  6. package/dist/{chunk-JIHHLV47.js → chunk-34LIUOT7.js} +6 -6
  7. package/dist/{chunk-FITOGMR3.js → chunk-54OV2WQC.js} +1 -1
  8. package/dist/{chunk-IWFXFWGD.js → chunk-7RY7QWWJ.js} +1 -1
  9. package/dist/{chunk-GS37EBPQ.js → chunk-DEI2M2H6.js} +1 -1
  10. package/dist/{chunk-3OE6PZIC.js → chunk-FXNUM2PN.js} +4 -4
  11. package/dist/{chunk-WW62PPYV.js → chunk-GLLR3AQ5.js} +1 -2
  12. package/dist/{chunk-P7S3ORB4.js → chunk-NJWI6MPT.js} +1827 -68
  13. package/dist/{chunk-F5ABHDUX.js → chunk-PB5X2VSV.js} +4 -4
  14. package/dist/{chunk-LU6XM5JQ.js → chunk-PXOXTJTN.js} +1 -1
  15. package/dist/{chunk-MJ57RSYO.js → chunk-WASENX2R.js} +4 -4
  16. package/dist/{chunk-X7RANZWP.js → chunk-YVNFACTC.js} +1 -1
  17. package/dist/{composition-Daqvi-GV.d.ts → composition-DIftf6iP.d.ts} +1 -1
  18. package/dist/composition.d.ts +2 -2
  19. package/dist/{conversion-BFr5USlh.d.ts → conversion-BjsKgxBZ.d.ts} +5 -5
  20. package/dist/conversion-F4UCOGR7.js +18 -0
  21. package/dist/convert.d.ts +3 -3
  22. package/dist/convert.js +5 -5
  23. package/dist/{deck-report-DHaboWbM.d.ts → deck-report-5vwMGcQz.d.ts} +2 -2
  24. package/dist/deck.d.ts +5 -5
  25. package/dist/deck.js +8 -8
  26. package/dist/diff.js +2 -3
  27. package/dist/docs.js +6 -6
  28. package/dist/index.d.ts +13 -12
  29. package/dist/index.js +17 -18
  30. package/dist/markdown.d.ts +3 -3
  31. package/dist/markdown.js +5 -5
  32. package/dist/node-engine.d.ts +7 -7
  33. package/dist/node-engine.js +17 -18
  34. package/dist/{pagination-R8YFwVj7.d.ts → pagination-D_kJe4jH.d.ts} +2 -2
  35. package/dist/pagination.d.ts +3 -3
  36. package/dist/pagination.js +2 -2
  37. package/dist/patch.js +1 -2
  38. package/dist/repo-readme.js +1 -1
  39. package/dist/schema.d.ts +165 -0
  40. package/dist/schema.js +3 -0
  41. package/dist/source.d.ts +97 -0
  42. package/dist/source.js +90 -0
  43. package/dist/types.d.ts +1 -1
  44. package/dist/{validation-types-JW8e06ee.d.ts → validation-types-3ARvTsB0.d.ts} +2 -2
  45. package/dist/validator.d.ts +54 -6
  46. package/dist/validator.js +1 -1
  47. package/dist/yaml.d.ts +3 -3
  48. package/dist/yaml.js +5 -5
  49. package/package.json +13 -5
  50. package/dist/chunk-IY5SCRTV.js +0 -261
  51. package/dist/conversion-ETAHLWAH.js +0 -19
  52. package/dist/validator-Dym2zYVK.d.ts +0 -67
package/README.md CHANGED
@@ -97,6 +97,10 @@ The layout engine's names are not on the root. `composeSlide`, `fitText`, `layou
97
97
 
98
98
  `@openpresentation/opf/yaml` reads and writes a deck as YAML, the authoring form of the same data (JSON stays canonical). `fromYaml(text, { aliases, validate })` reads strict JSON-compatible YAML 1.2 (one document, a mapping at the root, no custom tags, duplicate keys or non-finite numbers; anchors, aliases and merge keys only with `aliases: true`) and returns `{ presentation, valid, findings, counts, schemaValid, checks }`: the `validate` report of the deck, with every finding (the shared `Finding` format, YAML syntax errors as `yaml/<rule>` findings) located at the line and column of the YAML. `toYaml(presentation, { schemaComment })` writes canonical YAML (schema key order, block style, ambiguous strings quoted) that reads back to the same deck, and throws `OPFYamlError` for an invalid one. `parseYamlData` and `scanYamlComments` are the helpers. See [the YAML guide](../../docs/yaml.md).
99
99
 
100
+ ### Source editing: schema field queries, text addressing and syntax recovery
101
+
102
+ Two browser-safe subpaths for source editors, the CLI and agents. `@openpresentation/opf/schema` reads the field model of a document from the JSON Schemas: `describeField(path, document?)` returns the types, description, enum values, default, examples, whether the parent requires it, the `oneOf` variants (and `primary`, the form a template should use), the ranked `children` of an object (required first, then the curated `COMMON_KEYS` order, then alphabetical; promoted regions, `extensions` and `$schema` are `advanced`), the item schema of an array (`itemInfo`) or map (`entryInfo`), `requiredChildren` and `freeText`, and `{ known: false }` for a path the schema does not describe; `catalogKindAt(path, document?)` names the catalog a reference field points into (`layouts`, `themes`, `colorSchemes`, `fontSchemes`, `narratives`, `audiences`, `purposes`, `tones`) from `schemaCatalogKinds` (also exported), core-side metadata keyed by schema name and JSON Pointer; the published schemas carry no vendor keyword and compile under strict Ajv, so a new reference field is one entry there and needs no editor change. The navigation helpers it is built on are exported too (`resolveSchema`, `schemaVariants`, `activeSchema`, `schemaAtPath`, `createSchemaValue`, `listSchemaFields`, `splitOpfPath`). `@openpresentation/opf/source` turns text into positions and back: `locate(text, "json", pointer, { part })` is the range of a JSON Pointer (`value`, `key`, `entry`, `open` or `colon`; the nearest ancestor with `exact: false` when the node is missing), `pathAt(text, "json", offset)` the path under a caret, and `analyzeJsonSyntax(text, { limit })` the root cause of each JSON syntax error, once, in position order (at most five), with a range, a message, a hint and the fixes that repair it (`Insert comma`, `Add { }`, `Remove "design"`, `Insert }`, `Use double quotes`, ...); `validate(text)` reports the same causes as `opf/json-syntax` findings. YAML and Markdown addressing is not there yet and returns `undefined`. See [validate](../../docs/validate.md).
103
+
100
104
  ### Validate (0.14.0)
101
105
 
102
106
  `validate(input, options?)` is the one checker, from the root and from `@openpresentation/opf/validator`. `input` is a parsed presentation or strict JSON text; the result is a `ValidationReport` whose `findings` (the shared `Finding` format, `spec/schemas/finding.schema.json`) each have a stable `opf/<rule>` id, a severity and one of six categories: `format` (JSON syntax, duplicate keys, schema), `references` (catalog references, assets, citations, datasets), `policy` (host `contracts`), `accessibility` (contrast, alt text, reading order, links), `layout` (overflow, type size, image resolution, fonts) and `content` (placeholders, empty slides, non-numeric chart cells). `valid` means no finding has severity `error`, which by default only `format`, `references` and `policy` findings can have. Text input adds line and column; `only`, `ignore` and `severity` pick and promote rules or categories; composition is lazy, so `validate(deck, { only: ["format"] })` costs what a schema check costs. Read-only and deterministic: no remote resources are fetched. See [the validate guide](../../docs/validate.md). A clean report does not certify layout, fonts, or native export fidelity.
package/dist/browser.js CHANGED
@@ -1,21 +1,20 @@
1
- import { OPFApiError } from './chunk-WW62PPYV.js';
2
- export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-WW62PPYV.js';
1
+ import { OPFApiError } from './chunk-GLLR3AQ5.js';
2
+ export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-GLLR3AQ5.js';
3
3
  export { specFileEntries, specFileKinds, specFilePaths } from './chunk-UJSAR6GF.js';
4
+ export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-PJSPHHRK.js';
4
5
  export { OPFDataImportError, ingest, parseTabularData } from './chunk-TKQ2VFV5.js';
5
- export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-3OE6PZIC.js';
6
- export { fromMarkdown, toMarkdown } from './chunk-MJ57RSYO.js';
7
- import './chunk-F5ABHDUX.js';
8
- export { OPFMarkdownError } from './chunk-GS37EBPQ.js';
9
- export { diff, merge } from './chunk-X7RANZWP.js';
10
- export { OPFPatchError, OPFPatchValidationError, applyPatch } from './chunk-IY5SCRTV.js';
11
- export { OPFFormatError, format } from './chunk-EQ6S5SEZ.js';
12
- export { OPFPaginationError, paginate, paginateSlide } from './chunk-FITOGMR3.js';
13
- import './chunk-IWFXFWGD.js';
14
- import './chunk-LU6XM5JQ.js';
15
- export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogSchemaNames, findValidationRule, resolveSlideContext, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-P7S3ORB4.js';
6
+ export { OPFPaginationError, paginate, paginateSlide } from './chunk-54OV2WQC.js';
7
+ export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-FXNUM2PN.js';
8
+ export { fromMarkdown, toMarkdown } from './chunk-WASENX2R.js';
9
+ import './chunk-7RY7QWWJ.js';
10
+ import './chunk-PB5X2VSV.js';
11
+ export { OPFMarkdownError } from './chunk-DEI2M2H6.js';
12
+ import './chunk-PXOXTJTN.js';
13
+ export { diff, merge } from './chunk-YVNFACTC.js';
14
+ export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogSchemaNames, findValidationRule, resolveSlideContext, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-NJWI6MPT.js';
16
15
  export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_TYPES, DEFAULT_VARIABLE_DATE_FORMAT, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, LANGUAGES, LOGO_SHAPES, OPFCatalogsOptionError, OPFUnresolvedReferenceError, OPFVariableError, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, VARIABLE_KINDS, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, chartNumber, coerceVariableValue, datasetDiagnostics, formatDataNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isTemplate, isXYChartType, listBuiltinVariables, listVariables, normalizeLanguageFamily, numberFormatError, parseReference, resolveChartData, resolveDesignRecords, resolveFontScheme, resolveReference, resolveSlideVariables, resolveTableData, resolveVariables, suggestChartNumberFix, tableCellDisplayValue, toExcelNumberFormat, unresolvedReference, unusedDatasets, variableDeclarations } from './chunk-XRMV2GMB.js';
16
+ export { OPFFormatError, format } from './chunk-EQ6S5SEZ.js';
17
17
  export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-F4HFDP6I.js';
18
- export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-PJSPHHRK.js';
19
18
 
20
19
  // src/browser.ts
21
20
  var nodeOnly = (name, message) => new OPFApiError(`\`${name}\` ${message}`, "node-only", { details: { function: name, build: "browser" } });
@@ -125,4 +125,4 @@ declare function catalogReferenceSites(document: unknown, options?: {
125
125
  /** Records a picker can offer for `kind`: the document's embedded records, then those of the registered catalogs its groups name, with the reference to write for each. */
126
126
  declare function catalogRecords(document: unknown, kind: CatalogKind, options?: CatalogOptions): ResolvedReference[];
127
127
 
128
- export { type Catalog as C, OPFCatalogsOptionError as O, type RecordProvenance as R, type UnresolvedReferenceDiagnostic as U, type CatalogOptions as a, type CatalogKind as b, CATALOG_GROUP_PATTERN as c, CATALOG_REFERENCE_PATTERN as d, type CatalogRecordMap as e, type CatalogRecords as f, type CatalogReferenceSite as g, OPFUnresolvedReferenceError as h, type ResolvedReference as i, catalogGroupSource as j, catalogKinds as k, catalogRecords as l, catalogReferenceSites as m, parseReference as p, resolveReference as r, unresolvedReference as u };
128
+ export { type CatalogKind as C, OPFCatalogsOptionError as O, type RecordProvenance as R, type UnresolvedReferenceDiagnostic as U, type Catalog as a, type CatalogOptions as b, CATALOG_GROUP_PATTERN as c, CATALOG_REFERENCE_PATTERN as d, type CatalogRecordMap as e, type CatalogRecords as f, type CatalogReferenceSite as g, OPFUnresolvedReferenceError as h, type ResolvedReference as i, catalogGroupSource as j, catalogKinds as k, catalogRecords as l, catalogReferenceSites as m, parseReference as p, resolveReference as r, unresolvedReference as u };
@@ -0,0 +1,19 @@
1
+ import { C as CatalogKind } from './catalog-refs-BSfGELpt.js';
2
+ import { SchemaName } from './schemas.js';
3
+
4
+ /**
5
+ * RR-78: the version of the catalog record schemas (spec/schemas/<kind>.schema.json) this core reads. A catalog package
6
+ * declares the version its records target (`opf.catalogSchema` in its package.json, `CATALOG_SCHEMA` in its exports, as
7
+ * @openpresentation/gallery does); the Node defaults refuse a gallery that targets another one. A record schema change that
8
+ * old records no longer validate against raises it.
9
+ */
10
+ declare const CATALOG_SCHEMA = 4;
11
+ /** Kinds of catalog display metadata: published by catalogs for pickers, never referenced by documents. */
12
+ declare const catalogDisplayKinds: readonly ["chartTypes", "languages", "socialPlatforms"];
13
+ type CatalogDisplayKind = (typeof catalogDisplayKinds)[number];
14
+ /** Every kind of record a catalog publishes: the content kinds documents reference, and the display kinds. */
15
+ type CatalogRecordKind = CatalogKind | CatalogDisplayKind;
16
+ /** The companion schema each catalog record kind validates against. */
17
+ declare const catalogSchemaNames: Readonly<Record<CatalogRecordKind, SchemaName>>;
18
+
19
+ export { type CatalogRecordKind as C, CATALOG_SCHEMA as a, type CatalogDisplayKind as b, catalogDisplayKinds as c, catalogSchemaNames as d };
@@ -1,5 +1,5 @@
1
- import { OPFApiError } from './chunk-WW62PPYV.js';
2
- import { CATALOG_SCHEMA } from './chunk-P7S3ORB4.js';
1
+ import { OPFApiError } from './chunk-GLLR3AQ5.js';
2
+ import { CATALOG_SCHEMA } from './chunk-NJWI6MPT.js';
3
3
  import { CATALOG_SCHEMA as CATALOG_SCHEMA$1, gallery } from '@openpresentation/gallery';
4
4
 
5
5
  function galleryMismatch(declared, reads = CATALOG_SCHEMA) {
@@ -1,8 +1,8 @@
1
- import { defaultCatalogs } from './chunk-IC6OPLMU.js';
2
- import { localAssetSources, OPFApiError, parseSlideSelection, OPFExportError, asApiError, OPFImportError } from './chunk-WW62PPYV.js';
3
- import { deckFormatOf, readDeckReport, stringify } from './chunk-3OE6PZIC.js';
4
- import { paginate } from './chunk-FITOGMR3.js';
5
- import { validate, OPFValidationError } from './chunk-P7S3ORB4.js';
1
+ import { defaultCatalogs } from './chunk-2ZQBMZTZ.js';
2
+ import { localAssetSources, OPFApiError, parseSlideSelection, OPFExportError, asApiError, OPFImportError } from './chunk-GLLR3AQ5.js';
3
+ import { paginate } from './chunk-54OV2WQC.js';
4
+ import { deckFormatOf, readDeckReport, stringify } from './chunk-FXNUM2PN.js';
5
+ import { validate, OPFValidationError } from './chunk-NJWI6MPT.js';
6
6
  import { link, stat, readdir, lstat, readFile, open, unlink, mkdir, rename } from 'fs/promises';
7
7
  import path6 from 'path';
8
8
  import { readFileSync, statSync, realpathSync } from 'fs';
@@ -117,7 +117,7 @@ function localAssetProblems(deck, root) {
117
117
  }
118
118
  var RENDER_PACKAGE = "@openpresentation/opf-render";
119
119
  var PPTX_PACKAGE = "@openpresentation/opf-pptx";
120
- var PEER_RANGES = { [RENDER_PACKAGE]: "^0.26.1", [PPTX_PACKAGE]: "^0.26.1" };
120
+ var PEER_RANGES = { [RENDER_PACKAGE]: "^0.26.3", [PPTX_PACKAGE]: "^0.26.3" };
121
121
  var PPTX_TEXT_OPTIONS_FROM = "0.22.0";
122
122
  var numbers = (version) => version.replace(/[-+].*$/, "").split(".").map((part) => Number.parseInt(part, 10) || 0);
123
123
  function atLeast(version, minimum) {
@@ -1,4 +1,4 @@
1
- import { assertValid, resolveSlideScriptMeasurement, resolveSlideContext } from './chunk-P7S3ORB4.js';
1
+ import { assertValid, resolveSlideScriptMeasurement, resolveSlideContext } from './chunk-NJWI6MPT.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
@@ -1,4 +1,4 @@
1
- import { runText } from './chunk-LU6XM5JQ.js';
1
+ import { runText } from './chunk-PXOXTJTN.js';
2
2
 
3
3
  // src/convert/text-lines.ts
4
4
  var LIST_PREFIX = /^([ \t]*)(?:([-*•+]|\d{1,3}[.)])[ \t]+)?/;
@@ -1,4 +1,4 @@
1
- import { isRecord, same } from './chunk-LU6XM5JQ.js';
1
+ import { isRecord, same } from './chunk-PXOXTJTN.js';
2
2
  import { parseDocument, YAMLMap, Scalar, stringify } from 'yaml';
3
3
 
4
4
  // src/not-checked.ts
@@ -1,7 +1,7 @@
1
- import { fromMarkdown, toMarkdown } from './chunk-MJ57RSYO.js';
2
- import { fromYaml, toYaml } from './chunk-F5ABHDUX.js';
3
- import { NOT_CHECKED } from './chunk-GS37EBPQ.js';
4
- import { parseSource, validate, OPFValidationError } from './chunk-P7S3ORB4.js';
1
+ import { fromMarkdown, toMarkdown } from './chunk-WASENX2R.js';
2
+ import { fromYaml, toYaml } from './chunk-PB5X2VSV.js';
3
+ import { NOT_CHECKED } from './chunk-DEI2M2H6.js';
4
+ import { parseSource, validate, OPFValidationError } from './chunk-NJWI6MPT.js';
5
5
  import { checkCatalogsOption } from './chunk-XRMV2GMB.js';
6
6
 
7
7
  // src/deck-report.ts
@@ -1,6 +1,5 @@
1
1
  import { OPFDataImportError, parseTabularData } from './chunk-TKQ2VFV5.js';
2
- import { applyPatchWithInverse } from './chunk-IY5SCRTV.js';
3
- import { validate, OPFValidationError } from './chunk-P7S3ORB4.js';
2
+ import { applyPatchWithInverse, validate, OPFValidationError } from './chunk-NJWI6MPT.js';
4
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';
5
4
 
6
5
  // src/api-errors.ts