@openpresentation/opf 0.26.10 → 0.28.0

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 (105) hide show
  1. package/README.md +6 -0
  2. package/dist/browser.js +20 -17
  3. package/dist/{catalog-refs-BSfGELpt.d.ts → catalog-refs-kAefsZWT.d.ts} +2 -1
  4. package/dist/{catalog-schemas-DoxA2BgY.d.ts → catalog-schemas-CC1d_h8s.d.ts} +3 -2
  5. package/dist/{chart-data-BnNqgnC-.d.ts → chart-data-Ci9s_NDN.d.ts} +2 -1
  6. package/dist/{chunk-XRMV2GMB.js → chunk-2CUCYENF.js} +758 -232
  7. package/dist/chunk-43JWUIGF.js +8 -0
  8. package/dist/{chunk-F4HFDP6I.js → chunk-5Q4IYLMW.js} +31 -15
  9. package/dist/{chunk-GIWNHRTX.js → chunk-BQUWRXTR.js} +4 -4
  10. package/dist/chunk-CR72ZJ6W.js +236 -0
  11. package/dist/{chunk-L52N5FZZ.js → chunk-F6DCEGB3.js} +6 -6
  12. package/dist/chunk-GM7WFPGG.js +10 -0
  13. package/dist/chunk-JBARNYFR.js +23 -0
  14. package/dist/{chunk-EQ6S5SEZ.js → chunk-KELC4K62.js} +1 -1
  15. package/dist/{chunk-77KL2PMM.js → chunk-KXKN3W5Z.js} +3 -3
  16. package/dist/{chunk-D25BNPTW.js → chunk-LLEXM7TQ.js} +4 -4
  17. package/dist/{chunk-3S2XVDPN.js → chunk-MTFK7QEY.js} +6 -6
  18. package/dist/{chunk-TKQ2VFV5.js → chunk-N77N4AOD.js} +1 -1
  19. package/dist/{chunk-NVT2YDVC.js → chunk-OAIAFXMS.js} +2 -2
  20. package/dist/{chunk-PHP45MO7.js → chunk-P6PKYJTS.js} +1 -1
  21. package/dist/{chunk-H7XMO36O.js → chunk-PCU4XGKV.js} +5 -5
  22. package/dist/{chunk-Y4TZCE7R.js → chunk-SEZ4EPW6.js} +2 -2
  23. package/dist/{chunk-Y25DYRME.js → chunk-TNUTRV6E.js} +1 -1
  24. package/dist/{chunk-G5WJMJV3.js → chunk-UOHWG4OS.js} +1 -1
  25. package/dist/{chunk-A54NGT2K.js → chunk-VGGPAMP7.js} +2 -2
  26. package/dist/{chunk-IVPA6NG6.js → chunk-WPKCWQ6W.js} +494 -120
  27. package/dist/{chunk-VZBFQLCA.js → chunk-XZ23FORL.js} +6 -6
  28. package/dist/chunk-ZROVYWGU.js +1 -0
  29. package/dist/{composition-DIftf6iP.d.ts → composition-C-hd_Ci3.d.ts} +134 -14
  30. package/dist/composition.d.ts +3 -3
  31. package/dist/composition.js +2 -1
  32. package/dist/conversion-XJTDWQ5W.js +24 -0
  33. package/dist/{conversion-ChmGA8Ul.d.ts → conversion-hbZeS5kD.d.ts} +8 -7
  34. package/dist/convert.d.ts +6 -5
  35. package/dist/convert.js +9 -7
  36. package/dist/data.d.ts +4 -3
  37. package/dist/data.js +3 -2
  38. package/dist/{deck-report-5vwMGcQz.d.ts → deck-report-DQMsvyBI.d.ts} +5 -4
  39. package/dist/deck.d.ts +9 -8
  40. package/dist/deck.js +13 -11
  41. package/dist/diff.d.ts +3 -2
  42. package/dist/diff.js +6 -4
  43. package/dist/docs.d.ts +2 -1
  44. package/dist/docs.js +33 -19
  45. package/dist/examples.d.ts +3 -2
  46. package/dist/examples.js +92 -50
  47. package/dist/{explain-JSuESV-Y.d.ts → explain-iZeNOUc6.d.ts} +2 -1
  48. package/dist/font-policy.d.ts +2 -1
  49. package/dist/font-policy.js +1 -0
  50. package/dist/format.d.ts +2 -1
  51. package/dist/format.js +3 -2
  52. package/dist/ids.d.ts +114 -0
  53. package/dist/ids.js +6 -0
  54. package/dist/index.d.ts +40 -16
  55. package/dist/index.js +24 -21
  56. package/dist/markdown.d.ts +8 -7
  57. package/dist/markdown.js +10 -8
  58. package/dist/node-engine.d.ts +33 -10
  59. package/dist/node-engine.js +37 -28
  60. package/dist/{pagination-D_kJe4jH.d.ts → pagination-DyAKYpXu.d.ts} +4 -3
  61. package/dist/pagination.d.ts +4 -4
  62. package/dist/pagination.js +6 -4
  63. package/dist/patch.d.ts +89 -4
  64. package/dist/patch.js +5 -3
  65. package/dist/precompiled.d.ts +2 -0
  66. package/dist/precompiled.js +7 -0
  67. package/dist/{presentation-Bwo8Ko6D.d.ts → presentation-8jLSTFqL.d.ts} +11 -11
  68. package/dist/repo-readme.js +3 -1
  69. package/dist/schema-engine-ajv.js +37 -0
  70. package/dist/schema-engine-precompiled.js +3 -0
  71. package/dist/schema.d.ts +4 -3
  72. package/dist/schema.js +5 -3
  73. package/dist/schemas.d.ts +2 -1
  74. package/dist/schemas.js +2 -1
  75. package/dist/source.d.ts +5 -4
  76. package/dist/source.js +12 -10
  77. package/dist/spec/README.md +1 -1
  78. package/dist/spec/schemas/audience.schema.json +1 -0
  79. package/dist/spec/schemas/catalog-index.schema.json +1 -0
  80. package/dist/spec/schemas/catalog-manifest.schema.json +1 -0
  81. package/dist/spec/schemas/chart-type.schema.json +1 -0
  82. package/dist/spec/schemas/color-scheme.schema.json +1 -0
  83. package/dist/spec/schemas/finding.schema.json +1 -0
  84. package/dist/spec/schemas/font-scheme.schema.json +1 -0
  85. package/dist/spec/schemas/language.schema.json +1 -0
  86. package/dist/spec/schemas/layout-preview-index.schema.json +1 -0
  87. package/dist/spec/schemas/layout.schema.json +8 -6
  88. package/dist/spec/schemas/narrative.schema.json +1 -0
  89. package/dist/spec/schemas/opf.schema.json +9 -8
  90. package/dist/spec/schemas/purpose.schema.json +1 -0
  91. package/dist/spec/schemas/social-platform.schema.json +1 -0
  92. package/dist/spec/schemas/theme.schema.json +3 -1
  93. package/dist/spec/schemas/tone.schema.json +1 -0
  94. package/dist/spec-files.d.ts +2 -1
  95. package/dist/spec-files.js +1 -0
  96. package/dist/symbol-font-encodings.d.ts +2 -1
  97. package/dist/symbol-font-encodings.js +2 -0
  98. package/dist/types.d.ts +9 -9
  99. package/dist/{validation-types-3ARvTsB0.d.ts → validation-types-mNmfcY9A.d.ts} +4 -3
  100. package/dist/validator.d.ts +8 -8
  101. package/dist/validator.js +5 -3
  102. package/dist/yaml.d.ts +8 -7
  103. package/dist/yaml.js +9 -7
  104. package/package.json +30 -9
  105. package/dist/conversion-IVKCKMCN.js +0 -21
package/README.md CHANGED
@@ -64,6 +64,8 @@ const { files } = await opf.convert(deck, { format: "pptx" }); // bytes, nothing
64
64
 
65
65
  Drawing and PowerPoint go through the optional peers `@openpresentation/opf-render` and `@openpresentation/opf-pptx`, which core loads the first time a call needs them; npm does not install them for you. The root has conditional exports (OPF 0.18 removed `/node`): `node`, `bun` and `deno` get this full build, and `browser`, `worker`, `workerd` and `default` get a browser-safe build with the same names and the same types, where `open`, `save` and `convert` reject with `OPFApiError` code `node-only`. Every other subpath runs in a browser. `parseSlideSelection(3 | "1-3" | [1, 3], total)` reads slide selections in both. See [OPF files in Node](../../docs/node.md).
66
66
 
67
+ On Cloudflare Workers, Vercel Edge and other hosts that refuse code generation from strings, `validate` runs validators compiled at build time instead of compiling the schemas with Ajv. The `workerd`, `worker` and `edge-light` conditions choose them, so a Worker needs no alias and no option; code bundled for Node that runs on a worker (and a page under a strict Content-Security-Policy) imports `@openpresentation/opf/precompiled` once. The verdicts and findings are the same, and a CI lane runs the package in the real `workerd` runtime. See [Edge runtimes](../../docs/node.md#edge-runtimes-validators-that-never-compile-code).
68
+
67
69
  Use focused imports when you only need one surface:
68
70
 
69
71
  ```ts
@@ -111,6 +113,10 @@ Two browser-safe subpaths for source editors, the CLI and agents. `@openpresenta
111
113
 
112
114
  Added in 0.12.0 (not in 0.11.4 or earlier): `@openpresentation/opf/patch` is the one RFC 6902 implementation the CLI and the editor share (`applyPatch`, `applyPatchWithInverse`, `invertPatch`, strict pointer helpers, optional schema validation of the result); `@openpresentation/opf/diff` has `diff` (slide matching by id, content and similarity, moves, a readable report and a JSON Patch) and `merge` (three-way merge with conflict objects that never drop a side); `@openpresentation/opf/format` has `format` (canonical key order and layout, idempotent). See [the guide](../../docs/patch-diff-merge-format.md).
113
115
 
116
+ ### Ids, document hash and patch scope (CE-04, CE-05)
117
+
118
+ `@openpresentation/opf/ids` (all of it also on the package root, the pointer and hash parts also on `/patch`) makes edits addressable and checkable. `assignIds(document, { generate? })` fills the missing `id` of slides and content payloads deterministically (`{ document, patch, assigned }`; existing ids are never changed). In an array, the pointer token `@intro` names the element whose `id` is `intro`, so `/slides/@intro/blocks/@kpi/text` survives reordering: `applyPatch` and `readPointer` resolve it, `resolveIdPointer` and `toIdPointer` convert a pointer, `resolveIdPatch` and `toIdPatch` a whole patch. `documentHash(document)` is `sha256:` and a SHA-256 of the key-sorted JSON (pure JavaScript, the same in Node, browsers and edge runtimes); `applyPatch(document, patch, { expectHash })` and `edit(deck, patch, { expectHash })` apply only to the document that hash was taken from, else throw `OPFPatchHashError` and change nothing. `touches(patch, document?)` returns the pointers (index and id form), ids, slide ids and kinds a patch reads and writes, for conflict detection and permission checks. See [the guide](../../docs/patch-diff-merge-format.md#ids-id-addressed-paths-hashes-and-patch-scope).
119
+
114
120
  ### Layout previews
115
121
 
116
122
  `@openpresentation/gallery/previews` ships pre-rendered SVG thumbnails for the
package/dist/browser.js CHANGED
@@ -1,23 +1,26 @@
1
- import { OPFApiError } from './chunk-D25BNPTW.js';
2
- export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-D25BNPTW.js';
1
+ import { OPFApiError } from './chunk-LLEXM7TQ.js';
2
+ export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-LLEXM7TQ.js';
3
3
  export { specFileEntries, specFileKinds, specFilePaths } from './chunk-UJSAR6GF.js';
4
4
  export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-PJSPHHRK.js';
5
- export { OPFDataImportError, ingest, parseTabularData } from './chunk-TKQ2VFV5.js';
6
- export { OPFPaginationError, paginate, paginateSlide } from './chunk-77KL2PMM.js';
7
- export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-GIWNHRTX.js';
8
- export { fromMarkdown, toMarkdown } from './chunk-3S2XVDPN.js';
9
- import './chunk-VZBFQLCA.js';
5
+ export { OPFDataImportError, ingest, parseTabularData } from './chunk-N77N4AOD.js';
6
+ export { OPFPaginationError, paginate, paginateSlide } from './chunk-KXKN3W5Z.js';
7
+ export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-BQUWRXTR.js';
8
+ export { fromMarkdown, toMarkdown } from './chunk-MTFK7QEY.js';
9
+ import './chunk-XZ23FORL.js';
10
+ export { OPFFormatError, format } from './chunk-KELC4K62.js';
10
11
  import './chunk-RYZPBJLB.js';
11
- export { explain } from './chunk-G5WJMJV3.js';
12
- import './chunk-H7XMO36O.js';
13
- import './chunk-PHP45MO7.js';
14
- export { OPFMarkdownError } from './chunk-Y4TZCE7R.js';
15
- import './chunk-Y25DYRME.js';
16
- export { diff, merge } from './chunk-A54NGT2K.js';
17
- export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogSchemaNames, findValidationRule, resolveSlideContext, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-IVPA6NG6.js';
18
- 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';
19
- export { OPFFormatError, format } from './chunk-EQ6S5SEZ.js';
20
- export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-F4HFDP6I.js';
12
+ export { explain } from './chunk-UOHWG4OS.js';
13
+ import './chunk-PCU4XGKV.js';
14
+ import './chunk-P6PKYJTS.js';
15
+ export { OPFMarkdownError } from './chunk-SEZ4EPW6.js';
16
+ import './chunk-TNUTRV6E.js';
17
+ export { OPFIdError, assignIds, touches } from './chunk-CR72ZJ6W.js';
18
+ export { diff, merge } from './chunk-VGGPAMP7.js';
19
+ export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogSchemaNames, documentHash, findValidationRule, idToken, isIdToken, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSlideContext, toIdPatch, toIdPointer, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-WPKCWQ6W.js';
20
+ import './chunk-JBARNYFR.js';
21
+ export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-5Q4IYLMW.js';
22
+ 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-2CUCYENF.js';
23
+ import './chunk-GM7WFPGG.js';
21
24
 
22
25
  // src/browser.ts
23
26
  var nodeOnly = (name, message) => new OPFApiError(`\`${name}\` ${message}`, "node-only", { details: { function: name, build: "browser" } });
@@ -125,4 +125,5 @@ 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 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 };
128
+ export { OPFCatalogsOptionError as O, CATALOG_GROUP_PATTERN as c, CATALOG_REFERENCE_PATTERN as d, OPFUnresolvedReferenceError as h, catalogGroupSource as j, catalogKinds as k, catalogRecords as l, catalogReferenceSites as m, parseReference as p, resolveReference as r, unresolvedReference as u };
129
+ export type { Catalog as C, RecordProvenance as R, UnresolvedReferenceDiagnostic as U, CatalogKind as a, CatalogOptions as b, CatalogRecordMap as e, CatalogRecords as f, CatalogReferenceSite as g, ResolvedReference as i };
@@ -1,4 +1,4 @@
1
- import { C as CatalogKind } from './catalog-refs-BSfGELpt.js';
1
+ import { a as CatalogKind } from './catalog-refs-kAefsZWT.js';
2
2
  import { SchemaName } from './schemas.js';
3
3
 
4
4
  /**
@@ -16,4 +16,5 @@ type CatalogRecordKind = CatalogKind | CatalogDisplayKind;
16
16
  /** The companion schema each catalog record kind validates against. */
17
17
  declare const catalogSchemaNames: Readonly<Record<CatalogRecordKind, SchemaName>>;
18
18
 
19
- export { type CatalogRecordKind as C, CATALOG_SCHEMA as a, type CatalogDisplayKind as b, catalogDisplayKinds as c, catalogSchemaNames as d };
19
+ export { CATALOG_SCHEMA as a, catalogDisplayKinds as c, catalogSchemaNames as d };
20
+ export type { CatalogRecordKind as C, CatalogDisplayKind as b };
@@ -185,4 +185,5 @@ declare function resolveTableData(table: unknown, document?: unknown, options?:
185
185
  /** Display value of a table cell: a number with a format (cell, else column) becomes formatted text; anything else is returned unchanged. */
186
186
  declare function tableCellDisplayValue(cell: DataTableCell, columnFormat?: string): DataTableCell;
187
187
 
188
- export { resolveChartData as A, resolveTableData as B, type ChartMapping as C, type DataCellValue as D, suggestChartNumberFix as E, tableCellDisplayValue as F, toExcelNumberFormat as G, unusedDatasets as H, type ChartComboSeries as I, type ResolvedChartData as R, type ChartNumberFix as a, type ChartNumberFixOperation as b, type ChartNumberFixOptions as c, type DataColumn as d, type DataDiagnostic as e, type DataDiagnosticCode as f, type DataResolveOptions as g, type DataSourceRef as h, type DataStyledCell as i, type DataTableCell as j, type DataTableHeader as k, type DataTableValue as l, type DataTextRun as m, type Dataset as n, type DatasetRef as o, type ResolvedTableData as p, chartNumber as q, datasetDiagnostics as r, formatDataNumber as s, fromExcelNumberFormat as t, inlineChartData as u, inlineDatasets as v, inlineTableData as w, isDatasetRef as x, isXYChartType as y, numberFormatError as z };
188
+ export { resolveChartData as A, resolveTableData as B, suggestChartNumberFix as E, tableCellDisplayValue as F, toExcelNumberFormat as G, unusedDatasets as H, chartNumber as q, datasetDiagnostics as r, formatDataNumber as s, fromExcelNumberFormat as t, inlineChartData as u, inlineDatasets as v, inlineTableData as w, isDatasetRef as x, isXYChartType as y, numberFormatError as z };
189
+ export type { ChartMapping as C, DataCellValue as D, ChartComboSeries as I, ResolvedChartData as R, ChartNumberFix as a, ChartNumberFixOperation as b, ChartNumberFixOptions as c, DataColumn as d, DataDiagnostic as e, DataDiagnosticCode as f, DataResolveOptions as g, DataSourceRef as h, DataStyledCell as i, DataTableCell as j, DataTableHeader as k, DataTableValue as l, DataTextRun as m, Dataset as n, DatasetRef as o, ResolvedTableData as p };