@openpresentation/opf 0.26.10 → 0.27.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.
- package/README.md +6 -0
- package/dist/browser.js +20 -17
- package/dist/{chunk-H7XMO36O.js → chunk-353VBJ6K.js} +5 -5
- package/dist/chunk-43JWUIGF.js +8 -0
- package/dist/chunk-4ACS57MG.js +236 -0
- package/dist/{chunk-F4HFDP6I.js → chunk-4ZM5G3XX.js} +1 -1
- package/dist/{chunk-NVT2YDVC.js → chunk-7XUEKIXH.js} +2 -2
- package/dist/{chunk-Y25DYRME.js → chunk-ABFDFZIW.js} +1 -1
- package/dist/{chunk-A54NGT2K.js → chunk-APLNGCEZ.js} +2 -2
- package/dist/{chunk-G5WJMJV3.js → chunk-CXPBU5W4.js} +1 -1
- package/dist/{chunk-PHP45MO7.js → chunk-EO3JWEO5.js} +1 -1
- package/dist/chunk-GJO5NUVT.js +1 -0
- package/dist/chunk-GM7WFPGG.js +10 -0
- package/dist/{chunk-3S2XVDPN.js → chunk-GNKESMZT.js} +6 -6
- package/dist/chunk-JBARNYFR.js +23 -0
- package/dist/{chunk-TKQ2VFV5.js → chunk-JSHMFTSY.js} +1 -1
- package/dist/{chunk-VZBFQLCA.js → chunk-KZPZRHL6.js} +6 -6
- package/dist/{chunk-XRMV2GMB.js → chunk-LRTQXGJO.js} +236 -144
- package/dist/{chunk-EQ6S5SEZ.js → chunk-O3SA5SJ4.js} +1 -1
- package/dist/{chunk-GIWNHRTX.js → chunk-OSM3LZ2Y.js} +4 -4
- package/dist/{chunk-IVPA6NG6.js → chunk-PAGVSTVF.js} +348 -97
- package/dist/{chunk-Y4TZCE7R.js → chunk-SYW4BCGZ.js} +2 -2
- package/dist/{chunk-D25BNPTW.js → chunk-TMREBZBQ.js} +4 -4
- package/dist/{chunk-77KL2PMM.js → chunk-WJ4XTCOD.js} +2 -2
- package/dist/{chunk-L52N5FZZ.js → chunk-ZGTOZA2S.js} +6 -6
- package/dist/{composition-DIftf6iP.d.ts → composition-BGmpe5e4.d.ts} +51 -5
- package/dist/composition.d.ts +1 -1
- package/dist/composition.js +2 -1
- package/dist/{conversion-ChmGA8Ul.d.ts → conversion-8SQD4dqu.d.ts} +6 -6
- package/dist/conversion-LN6PFRZL.js +24 -0
- package/dist/convert.d.ts +2 -2
- package/dist/convert.js +9 -7
- package/dist/data.d.ts +1 -1
- package/dist/data.js +3 -2
- package/dist/{deck-report-5vwMGcQz.d.ts → deck-report-BaKgPh_N.d.ts} +2 -2
- package/dist/deck.d.ts +6 -6
- package/dist/deck.js +13 -11
- package/dist/diff.d.ts +1 -1
- package/dist/diff.js +6 -4
- package/dist/docs.js +6 -4
- package/dist/examples.d.ts +1 -1
- package/dist/examples.js +2 -0
- package/dist/{finding-l9dlQ2NF.d.ts → finding-Bh56sGtF.d.ts} +1 -1
- package/dist/font-policy.js +1 -0
- package/dist/format.js +3 -2
- package/dist/ids.d.ts +113 -0
- package/dist/ids.js +6 -0
- package/dist/index.d.ts +15 -12
- package/dist/index.js +24 -21
- package/dist/markdown.d.ts +4 -4
- package/dist/markdown.js +10 -8
- package/dist/node-engine.d.ts +8 -8
- package/dist/node-engine.js +24 -21
- package/dist/{pagination-D_kJe4jH.d.ts → pagination-BsUTsQvk.d.ts} +1 -1
- package/dist/pagination.d.ts +2 -2
- package/dist/pagination.js +6 -4
- package/dist/patch.d.ts +87 -4
- package/dist/patch.js +5 -3
- package/dist/precompiled.d.ts +2 -0
- package/dist/precompiled.js +7 -0
- package/dist/{presentation-Bwo8Ko6D.d.ts → presentation-C-nHZyMw.d.ts} +1 -1
- package/dist/repo-readme.js +2 -0
- package/dist/schema-engine-ajv.js +37 -0
- package/dist/schema-engine-precompiled.js +3 -0
- package/dist/schema.js +5 -3
- package/dist/schemas.js +2 -1
- package/dist/source.d.ts +1 -1
- package/dist/source.js +12 -10
- package/dist/spec/schemas/opf.schema.json +1 -1
- package/dist/spec-files.js +1 -0
- package/dist/symbol-font-encodings.js +2 -0
- package/dist/types.d.ts +2 -2
- package/dist/{validation-types-3ARvTsB0.d.ts → validation-types-6_jEaHeE.d.ts} +2 -2
- package/dist/validator.d.ts +5 -5
- package/dist/validator.js +5 -3
- package/dist/yaml.d.ts +4 -4
- package/dist/yaml.js +9 -7
- package/package.json +29 -8
- package/dist/conversion-IVKCKMCN.js +0 -21
package/dist/examples.d.ts
CHANGED
package/dist/examples.js
CHANGED
|
@@ -213,4 +213,4 @@ interface ValidationIssue {
|
|
|
213
213
|
alternatives?: string[];
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
export type {
|
|
216
|
+
export type { Finding as F, JsonPatchOperation as J, ValidationIssue as V, FindingLocation as a, FindingReport as b, FindingSeverity as c, FindingCategory as d, FindingFix as e, FindingFocus as f, FindingSuggestion as g };
|
package/dist/font-policy.js
CHANGED
package/dist/format.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { OPFFormatError, format, isFormatted, sortPresentationKeys } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { OPFFormatError, format, isFormatted, sortPresentationKeys } from './chunk-O3SA5SJ4.js';
|
|
2
|
+
import './chunk-4ZM5G3XX.js';
|
|
3
|
+
import './chunk-GM7WFPGG.js';
|
package/dist/ids.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { J as JsonPatchOperation } from './finding-Bh56sGtF.js';
|
|
2
|
+
export { OPFPatchHashError, documentHash, idToken, isIdToken, resolveIdPatch, resolveIdPointer, toIdPatch, toIdPointer } from './patch.js';
|
|
3
|
+
|
|
4
|
+
type IdErrorCode = "invalid-document" | "invalid-id" | "duplicate-id";
|
|
5
|
+
/** Thrown by `assignIds` for a value that is not a document or a `generate` that returns an unusable id. */
|
|
6
|
+
declare class OPFIdError extends Error {
|
|
7
|
+
readonly code: IdErrorCode;
|
|
8
|
+
/** The JSON Pointer of the slide or payload the error is about, when known. */
|
|
9
|
+
path?: string;
|
|
10
|
+
constructor(code: IdErrorCode, message: string, path?: string);
|
|
11
|
+
}
|
|
12
|
+
interface AssignIdsContext {
|
|
13
|
+
/** `slide` for an entry of `slides`; `block` for a content payload (a block, a nested group or a promoted region). */
|
|
14
|
+
kind: "slide" | "block";
|
|
15
|
+
/** The JSON Pointer of the node, in index form (`/slides/2/blocks/0`). */
|
|
16
|
+
pointer: string;
|
|
17
|
+
/** The node, read only. */
|
|
18
|
+
node: Readonly<Record<string, unknown>>;
|
|
19
|
+
/** The id of the nearest slide or group above the node that has one (an id assigned earlier in this call counts). */
|
|
20
|
+
parentId?: string;
|
|
21
|
+
}
|
|
22
|
+
interface AssignIdsOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Make the id of a node. It must return a non-empty string no slide or payload of the document uses, or `assignIds` throws
|
|
25
|
+
* `OPFIdError` (`invalid-id`, `duplicate-id`). It is called in document order and must not depend on anything but its argument if the
|
|
26
|
+
* result is to be deterministic. The default makes `slide-1`, `slide-2`, ... and `block-1`, `block-2`, ... skipping ids in use.
|
|
27
|
+
*/
|
|
28
|
+
generate?: (context: AssignIdsContext) => string;
|
|
29
|
+
}
|
|
30
|
+
interface AssignedId {
|
|
31
|
+
/** The JSON Pointer of the node that got the id, in index form. */
|
|
32
|
+
pointer: string;
|
|
33
|
+
kind: "slide" | "block";
|
|
34
|
+
id: string;
|
|
35
|
+
}
|
|
36
|
+
interface AssignIdsResult {
|
|
37
|
+
/** A copy of the document in which every slide and payload has an id. */
|
|
38
|
+
document: unknown;
|
|
39
|
+
/** The `add` operations that produce `document` from the input: one `/…/id` per assigned id. Empty when nothing was missing. */
|
|
40
|
+
patch: JsonPatchOperation[];
|
|
41
|
+
assigned: AssignedId[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Give every slide and content payload that has no `id` one, deterministically: the same document and `generate` give the same ids. An
|
|
45
|
+
* existing id is never changed (not even a duplicate: that is a validation finding, not an assignment), and a new id is never one in
|
|
46
|
+
* use, so a valid document stays valid. The input is not changed; `patch` is the same change as operations, for an editor to apply as one
|
|
47
|
+
* undoable edit. The id is added as the node's last member (`format` puts it in canonical order).
|
|
48
|
+
*
|
|
49
|
+
* Slides and payloads share one id namespace in the schema; list items, table rows and runs have no id.
|
|
50
|
+
*/
|
|
51
|
+
declare function assignIds(document: unknown, options?: AssignIdsOptions): AssignIdsResult;
|
|
52
|
+
/**
|
|
53
|
+
* The part of a presentation a location belongs to:
|
|
54
|
+
* - `document`: the whole document (the root);
|
|
55
|
+
* - `slide-order`: the `slides` array, or a slide as a whole (added, removed, moved, copied);
|
|
56
|
+
* - `slide`: a field of one slide, or a slide replaced or read as a whole;
|
|
57
|
+
* - `block`: a content payload (a block, a nested group or a promoted region) or the `blocks` array that holds it, below a slide;
|
|
58
|
+
* - `design`: the deck's `design` or a slide's `design`;
|
|
59
|
+
* - `assets`, `catalogs`: the deck's `assets` and `catalogs`;
|
|
60
|
+
* - `metadata`: every other deck field (`name`, `language`, `references`, `datasets`, `variables`, `narrative`, `extensions`, ...).
|
|
61
|
+
*/
|
|
62
|
+
type PatchScopeKind = "document" | "slide-order" | "slide" | "block" | "design" | "assets" | "catalogs" | "metadata";
|
|
63
|
+
/** One location an operation reads or writes. */
|
|
64
|
+
interface PatchTouch {
|
|
65
|
+
/** The index of the operation within the patch. */
|
|
66
|
+
operation: number;
|
|
67
|
+
op: JsonPatchOperation["op"];
|
|
68
|
+
/**
|
|
69
|
+
* The JSON Pointer of the location. With a document: in index form, as it is when the operation runs (id tokens resolved, an
|
|
70
|
+
* `add` at `-` given the index it appended at). Without one: as written.
|
|
71
|
+
*/
|
|
72
|
+
pointer: string;
|
|
73
|
+
/** The same location with `@id` tokens wherever an element has an id; without a document, as written. It survives reordering. */
|
|
74
|
+
idPointer: string;
|
|
75
|
+
kind: PatchScopeKind;
|
|
76
|
+
/**
|
|
77
|
+
* The ids of the slides and payloads this location is inside, is, or contains: every slide and payload on the path, plus the
|
|
78
|
+
* ones inside the value a write removes, replaces or inserts (removing a slide lists its blocks). Without a document: the ids the
|
|
79
|
+
* pointer names with id tokens and the ids inside the operation's value.
|
|
80
|
+
*/
|
|
81
|
+
ids: string[];
|
|
82
|
+
/** The ids in `ids` that belong to slides. */
|
|
83
|
+
slideIds: string[];
|
|
84
|
+
}
|
|
85
|
+
interface PatchScope {
|
|
86
|
+
/** What the patch looks at without changing: `test`, and the source of `copy`. In operation order. */
|
|
87
|
+
reads: PatchTouch[];
|
|
88
|
+
/** What the patch changes: `add`, `replace`, `remove`, both ends of `move`, the destination of `copy`. In operation order. */
|
|
89
|
+
writes: PatchTouch[];
|
|
90
|
+
/** Every id in `reads` and `writes`, in order of first appearance. */
|
|
91
|
+
ids: string[];
|
|
92
|
+
slideIds: string[];
|
|
93
|
+
/** The kinds of `reads` and `writes`, in the order `PatchScopeKind` lists them. */
|
|
94
|
+
kinds: PatchScopeKind[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* What a patch reads and writes, for conflict detection and permission checks.
|
|
98
|
+
*
|
|
99
|
+
* Without `document`, from the patch alone: the pointers as written, the id tokens they carry and the ids inside the values the
|
|
100
|
+
* operations insert. With `document`, the patch is walked operation by operation against that document (the version it was made for),
|
|
101
|
+
* so each location is resolved as it is when its operation runs: an earlier operation that inserts or moves a slide is accounted for,
|
|
102
|
+
* `@id` tokens become indexes, every location also gets its id form, and a `remove`, `replace` or `move` lists the ids of what it
|
|
103
|
+
* destroys. A patch that does not apply to `document` throws the `OPFPatchError` that `applyPatch` throws; the document is not changed.
|
|
104
|
+
*
|
|
105
|
+
* Two patches made against the same document conflict when a write of one has the same `idPointer` as, or sits inside or above, a
|
|
106
|
+
* location the other reads or writes (compare `pointer` when elements have no ids), or when what one destroys is in the `ids` of the
|
|
107
|
+
* other. A `move` changes where an element sits, not what is inside it, so it meets the element and its siblings but not an edit
|
|
108
|
+
* inside it: skip the descendants of a `move` location (`op` is `move`). A permission check reads `kind`, `slideIds` and `ids` of
|
|
109
|
+
* `writes`, moves included. What counts as a conflict and what a user may touch stays with the host.
|
|
110
|
+
*/
|
|
111
|
+
declare function touches(patch: unknown, document?: unknown): PatchScope;
|
|
112
|
+
|
|
113
|
+
export { type AssignIdsContext, type AssignIdsOptions, type AssignIdsResult, type AssignedId, type IdErrorCode, OPFIdError, type PatchScope, type PatchScopeKind, type PatchTouch, assignIds, touches };
|
package/dist/ids.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { OPFIdError, assignIds, touches } from './chunk-4ACS57MG.js';
|
|
2
|
+
export { OPFPatchHashError, documentHash, idToken, isIdToken, resolveIdPatch, resolveIdPointer, toIdPatch, toIdPointer } from './chunk-PAGVSTVF.js';
|
|
3
|
+
import './chunk-JBARNYFR.js';
|
|
4
|
+
import './chunk-4ZM5G3XX.js';
|
|
5
|
+
import './chunk-LRTQXGJO.js';
|
|
6
|
+
import './chunk-GM7WFPGG.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
export { SchemaEntry, SchemaName, audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './schemas.js';
|
|
2
|
-
import { C as ConvertInput, a as ConvertOptions, b as ConvertResult, c as ConvertFormat, O as OpenOptions, S as SaveOptions, d as SaveResult } from './conversion-
|
|
3
|
-
export { e as ConvertedFile, E as ExportFormat, F as FontsHandle, f as OPFApiError, g as OPFExportError, h as OPFImportError, i as SlideSelection, p as parseSlideSelection } from './conversion-
|
|
2
|
+
import { C as ConvertInput, a as ConvertOptions, b as ConvertResult, c as ConvertFormat, O as OpenOptions, S as SaveOptions, d as SaveResult } from './conversion-8SQD4dqu.js';
|
|
3
|
+
export { e as ConvertedFile, E as ExportFormat, F as FontsHandle, f as OPFApiError, g as OPFExportError, h as OPFImportError, i as SlideSelection, p as parseSlideSelection } from './conversion-8SQD4dqu.js';
|
|
4
4
|
export { R as RuleExplanation, e as explain } from './explain-JSuESV-Y.js';
|
|
5
5
|
import { validate as validate$1 } from './validator.js';
|
|
6
6
|
export { DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, validateCatalogRecord, validationRules } from './validator.js';
|
|
7
|
-
import { R as ResolveVariablesOptions, h as VariableDiagnostic } from './validation-types-
|
|
8
|
-
export { B as BuiltinVariableInfo, C as Contract, D as DEFAULT_VARIABLE_DATE_FORMAT, O as OPFVariableError, i as ResolveVariablesResult, j as VARIABLE_KINDS, d as ValidateFonts, a as ValidateOptions, e as ValidationCategory, f as ValidationChecks, V as ValidationReport, g as ValidationRuleCost, c as ValidationRuleInfo, b as ValidationThresholds, k as VariableDeclaration, l as VariableDiagnosticCode, m as VariableDiagnosticSeverity, n as VariableInfo, o as VariableKind, p as VariableUse, q as VariableUseForm, r as VariableValues, s as coerceVariableValue, t as formatVariableNumber, u as hasContentVariables, w as isTemplate, x as listBuiltinVariables, y as listVariables, z as resolveVariables, v as validationCategories, A as variableDeclarations } from './validation-types-
|
|
9
|
-
export { a as CHART_TYPES, C as ComposeSlideOptions, E as ENGINE_DEFAULT_CHART_TYPES, b as ENGINE_DEFAULT_COLOR_SCHEME, c as ENGINE_DEFAULT_FONT_SCHEME, d as ENGINE_DEFAULT_THEME, e as FontFamilies, F as Fonts, f as LANGUAGES, g as LOGO_SHAPES, h as LanguageFamilyName, i as LanguageVocabulary, L as LayoutDiagnostic, j as LogoShape, k as LogoVariant, M as MeasureTextWidth, l as ResolveLogoOptions, m as ResolvedLogo, S as SOCIAL_PLATFORMS, n as SocialPlatformVocabulary, T as TextMeasurement, o as TextStyle, p as normalizeLanguageFamily } from './composition-
|
|
7
|
+
import { R as ResolveVariablesOptions, h as VariableDiagnostic } from './validation-types-6_jEaHeE.js';
|
|
8
|
+
export { B as BuiltinVariableInfo, C as Contract, D as DEFAULT_VARIABLE_DATE_FORMAT, O as OPFVariableError, i as ResolveVariablesResult, j as VARIABLE_KINDS, d as ValidateFonts, a as ValidateOptions, e as ValidationCategory, f as ValidationChecks, V as ValidationReport, g as ValidationRuleCost, c as ValidationRuleInfo, b as ValidationThresholds, k as VariableDeclaration, l as VariableDiagnosticCode, m as VariableDiagnosticSeverity, n as VariableInfo, o as VariableKind, p as VariableUse, q as VariableUseForm, r as VariableValues, s as coerceVariableValue, t as formatVariableNumber, u as hasContentVariables, w as isTemplate, x as listBuiltinVariables, y as listVariables, z as resolveVariables, v as validationCategories, A as variableDeclarations } from './validation-types-6_jEaHeE.js';
|
|
9
|
+
export { a as CHART_TYPES, C as ComposeSlideOptions, E as ENGINE_DEFAULT_CHART_TYPES, b as ENGINE_DEFAULT_COLOR_SCHEME, c as ENGINE_DEFAULT_FONT_SCHEME, d as ENGINE_DEFAULT_THEME, e as FontFamilies, F as Fonts, f as LANGUAGES, g as LOGO_SHAPES, h as LanguageFamilyName, i as LanguageVocabulary, L as LayoutDiagnostic, j as LogoShape, k as LogoVariant, M as MeasureTextWidth, l as ResolveLogoOptions, m as ResolvedLogo, S as SOCIAL_PLATFORMS, n as SocialPlatformVocabulary, T as TextMeasurement, o as TextStyle, p as normalizeLanguageFamily } from './composition-BGmpe5e4.js';
|
|
10
10
|
export { SpecFileEntry, SpecFileKind, SpecFilePath, specFileEntries, specFileKinds, specFilePaths } from './spec-files.js';
|
|
11
|
-
import { P as Presentation } from './presentation-
|
|
11
|
+
import { P as Presentation } from './presentation-C-nHZyMw.js';
|
|
12
12
|
export { Audience, ChartType, ColorScheme, FontScheme, Language, Layout, Narrative, Purpose, SocialPlatform, Theme, Tone } from './types.js';
|
|
13
13
|
import { C as CatalogKind, U as UnresolvedReferenceDiagnostic, b as CatalogOptions, a as Catalog, R as RecordProvenance } from './catalog-refs-BSfGELpt.js';
|
|
14
14
|
export { c as CATALOG_GROUP_PATTERN, d as CATALOG_REFERENCE_PATTERN, e as CatalogRecordMap, f as CatalogRecords, g as CatalogReferenceSite, O as OPFCatalogsOptionError, h as OPFUnresolvedReferenceError, i as ResolvedReference, j as catalogGroupSource, k as catalogKinds, l as catalogRecords, m as catalogReferenceSites, p as parseReference, r as resolveReference, u as unresolvedReference } from './catalog-refs-BSfGELpt.js';
|
|
15
|
-
import {
|
|
16
|
-
export { d as FindingCategory, e as FindingFix, f as FindingFocus,
|
|
15
|
+
import { F as Finding, J as JsonPatchOperation } from './finding-Bh56sGtF.js';
|
|
16
|
+
export { d as FindingCategory, e as FindingFix, f as FindingFocus, a as FindingLocation, b as FindingReport, c as FindingSeverity, g as FindingSuggestion, V as ValidationIssue } from './finding-Bh56sGtF.js';
|
|
17
17
|
export { a as CATALOG_SCHEMA, b as CatalogDisplayKind, C as CatalogRecordKind, c as catalogDisplayKinds, d as catalogSchemaNames } from './catalog-schemas-DoxA2BgY.js';
|
|
18
|
-
import { p as paginate$1 } from './pagination-
|
|
19
|
-
export { O as OPFPaginationError, P as PaginatedPage, b as PaginationMapping, c as PaginationOptions, d as PaginationResult, a as PresentationPaginationOptions, e as PresentationPaginationResult, S as SlideContext, f as SlideContextDiagnostic, g as SlideContextOptions, h as paginateSlide, r as resolveSlideContext } from './pagination-
|
|
20
|
-
export { ApplyPatchOptions, OPFPatchError, OPFPatchValidationError, PatchResult, applyPatch } from './patch.js';
|
|
18
|
+
import { p as paginate$1 } from './pagination-BsUTsQvk.js';
|
|
19
|
+
export { O as OPFPaginationError, P as PaginatedPage, b as PaginationMapping, c as PaginationOptions, d as PaginationResult, a as PresentationPaginationOptions, e as PresentationPaginationResult, S as SlideContext, f as SlideContextDiagnostic, g as SlideContextOptions, h as paginateSlide, r as resolveSlideContext } from './pagination-BsUTsQvk.js';
|
|
20
|
+
export { ApplyPatchOptions, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, PatchResult, applyPatch, documentHash, idToken, isIdToken, resolveIdPatch, resolveIdPointer, toIdPatch, toIdPointer } from './patch.js';
|
|
21
|
+
export { AssignIdsContext, AssignIdsOptions, AssignIdsResult, AssignedId, IdErrorCode, OPFIdError, PatchScope, PatchScopeKind, PatchTouch, assignIds, touches } from './ids.js';
|
|
21
22
|
export { DiffOptions, MergeConflict, MergeOptions, MergeResult, PresentationDiff, diff, merge } from './diff.js';
|
|
22
23
|
export { FormatOptions, OPFFormatError, format } from './format.js';
|
|
23
24
|
export { FromMarkdownOptions, FromMarkdownResult, OPFMarkdownError, ToMarkdownOptions, ToMarkdownResult, fromMarkdown, toMarkdown } from './markdown.js';
|
|
@@ -25,7 +26,7 @@ export { StringifyOptions, parse, stringify } from './deck.js';
|
|
|
25
26
|
export { DataCell, DataImportOptions, ImportedChart, ImportedChartData, ImportedChartType, ImportedTable, IngestOptions, OPFDataImportError, TabularData, ingest, parseTabularData } from './data.js';
|
|
26
27
|
export { I as ChartComboSeries, C as ChartMapping, a as ChartNumberFix, b as ChartNumberFixOperation, c as ChartNumberFixOptions, D as DataCellValue, d as DataColumn, e as DataDiagnostic, f as DataDiagnosticCode, g as DataResolveOptions, h as DataSourceRef, i as DataStyledCell, j as DataTableCell, k as DataTableHeader, l as DataTableValue, m as DataTextRun, n as Dataset, o as DatasetRef, R as ResolvedChartData, p as ResolvedTableData, q as chartNumber, r as datasetDiagnostics, s as formatDataNumber, t as fromExcelNumberFormat, u as inlineChartData, v as inlineDatasets, w as inlineTableData, x as isDatasetRef, y as isXYChartType, z as numberFormatError, A as resolveChartData, B as resolveTableData, E as suggestChartNumberFix, F as tableCellDisplayValue, G as toExcelNumberFormat, H as unusedDatasets } from './chart-data-BnNqgnC-.js';
|
|
27
28
|
export { FONT_POLICY, FontAvailability, FontAvailabilityCode, FontAvailabilityDiagnostic, FontLicenseClass, FontPolicyDecision, FontPolicyEntry, FontPolicyTable, FontReplacement, FontReplacementCompatibility, FontReplacementMeasurement, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './font-policy.js';
|
|
28
|
-
export { a as DECK_FORMATS, D as DeckFormat, P as ParseOptions, d as deckFormatOf } from './deck-report-
|
|
29
|
+
export { a as DECK_FORMATS, D as DeckFormat, P as ParseOptions, d as deckFormatOf } from './deck-report-BaKgPh_N.js';
|
|
29
30
|
import './json-BFSdESOE.js';
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -583,6 +584,8 @@ interface EditOptions {
|
|
|
583
584
|
catalogs?: readonly Catalog[];
|
|
584
585
|
/** `false` skips the check of the result (work in progress). Default true. */
|
|
585
586
|
validate?: boolean;
|
|
587
|
+
/** Apply the patch only to the deck whose `documentHash` this is; a different deck throws `OPFPatchHashError` before anything is applied. */
|
|
588
|
+
expectHash?: string;
|
|
586
589
|
}
|
|
587
590
|
interface EditResult {
|
|
588
591
|
/** The patched deck (a copy). */
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { defaultCatalogs } from './chunk-
|
|
2
|
-
import { stats, embed, edit, OPFApiError, asApiError } from './chunk-
|
|
3
|
-
export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, updateFromCatalog } from './chunk-
|
|
1
|
+
import { defaultCatalogs } from './chunk-7XUEKIXH.js';
|
|
2
|
+
import { stats, embed, edit, OPFApiError, asApiError } from './chunk-TMREBZBQ.js';
|
|
3
|
+
export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, updateFromCatalog } from './chunk-TMREBZBQ.js';
|
|
4
4
|
export { specFileEntries, specFileKinds, specFilePaths } from './chunk-UJSAR6GF.js';
|
|
5
5
|
export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-PJSPHHRK.js';
|
|
6
|
-
export { OPFDataImportError, ingest, parseTabularData } from './chunk-
|
|
7
|
-
import { paginate } from './chunk-
|
|
8
|
-
export { OPFPaginationError, paginateSlide } from './chunk-
|
|
9
|
-
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-
|
|
10
|
-
export { fromMarkdown, toMarkdown } from './chunk-
|
|
11
|
-
import './chunk-
|
|
6
|
+
export { OPFDataImportError, ingest, parseTabularData } from './chunk-JSHMFTSY.js';
|
|
7
|
+
import { paginate } from './chunk-WJ4XTCOD.js';
|
|
8
|
+
export { OPFPaginationError, paginateSlide } from './chunk-WJ4XTCOD.js';
|
|
9
|
+
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-OSM3LZ2Y.js';
|
|
10
|
+
export { fromMarkdown, toMarkdown } from './chunk-GNKESMZT.js';
|
|
11
|
+
import './chunk-KZPZRHL6.js';
|
|
12
|
+
export { OPFFormatError, format } from './chunk-O3SA5SJ4.js';
|
|
12
13
|
import './chunk-RYZPBJLB.js';
|
|
13
|
-
export { explain } from './chunk-
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
export { OPFMarkdownError } from './chunk-
|
|
17
|
-
import './chunk-
|
|
18
|
-
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
|
|
23
|
-
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-
|
|
14
|
+
export { explain } from './chunk-CXPBU5W4.js';
|
|
15
|
+
import './chunk-353VBJ6K.js';
|
|
16
|
+
import './chunk-EO3JWEO5.js';
|
|
17
|
+
export { OPFMarkdownError } from './chunk-SYW4BCGZ.js';
|
|
18
|
+
import './chunk-ABFDFZIW.js';
|
|
19
|
+
export { OPFIdError, assignIds, touches } from './chunk-4ACS57MG.js';
|
|
20
|
+
export { diff, merge } from './chunk-APLNGCEZ.js';
|
|
21
|
+
import { validate, OPFValidationError } from './chunk-PAGVSTVF.js';
|
|
22
|
+
export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogSchemaNames, documentHash, findValidationRule, idToken, isIdToken, resolveIdPatch, resolveIdPointer, resolveSlideContext, toIdPatch, toIdPointer, validateCatalogRecord, validationCategories, validationRules } from './chunk-PAGVSTVF.js';
|
|
23
|
+
import './chunk-JBARNYFR.js';
|
|
24
|
+
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-4ZM5G3XX.js';
|
|
25
|
+
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-LRTQXGJO.js';
|
|
26
|
+
import './chunk-GM7WFPGG.js';
|
|
24
27
|
|
|
25
28
|
// src/index.ts
|
|
26
29
|
var withDefaultCatalog = (options) => {
|
|
@@ -33,7 +36,7 @@ var stats2 = (presentation2, options) => stats(presentation2, withDefaultCatalog
|
|
|
33
36
|
var paginate2 = (input, options) => paginate(input, withDefaultCatalog(options));
|
|
34
37
|
var embed2 = (document, options) => embed(document, withDefaultCatalog(options));
|
|
35
38
|
var edit2 = (deck, patch, options) => edit(deck, patch, withDefaultCatalog(options));
|
|
36
|
-
var engine = () => import('./conversion-
|
|
39
|
+
var engine = () => import('./conversion-LN6PFRZL.js');
|
|
37
40
|
var rethrow = (error, fallback) => {
|
|
38
41
|
if (error instanceof OPFValidationError) throw error;
|
|
39
42
|
throw asApiError(OPFApiError, error, fallback);
|
package/dist/markdown.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
2
|
-
import { P as Presentation } from './presentation-
|
|
3
|
-
import {
|
|
4
|
-
import { a as ValidateOptions, V as ValidationReport } from './validation-types-
|
|
5
|
-
import './composition-
|
|
2
|
+
import { P as Presentation } from './presentation-C-nHZyMw.js';
|
|
3
|
+
import { F as Finding, a as FindingLocation } from './finding-Bh56sGtF.js';
|
|
4
|
+
import { a as ValidateOptions, V as ValidationReport } from './validation-types-6_jEaHeE.js';
|
|
5
|
+
import './composition-BGmpe5e4.js';
|
|
6
6
|
import './chart-data-BnNqgnC-.js';
|
|
7
7
|
import './json-BFSdESOE.js';
|
|
8
8
|
|
package/dist/markdown.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { fromMarkdown, toMarkdown } from './chunk-
|
|
1
|
+
export { fromMarkdown, toMarkdown } from './chunk-GNKESMZT.js';
|
|
2
2
|
import './chunk-RYZPBJLB.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
export { OPFMarkdownError } from './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
3
|
+
import './chunk-353VBJ6K.js';
|
|
4
|
+
import './chunk-EO3JWEO5.js';
|
|
5
|
+
export { OPFMarkdownError } from './chunk-SYW4BCGZ.js';
|
|
6
|
+
import './chunk-ABFDFZIW.js';
|
|
7
|
+
import './chunk-PAGVSTVF.js';
|
|
8
|
+
import './chunk-JBARNYFR.js';
|
|
9
|
+
import './chunk-4ZM5G3XX.js';
|
|
10
|
+
import './chunk-LRTQXGJO.js';
|
|
11
|
+
import './chunk-GM7WFPGG.js';
|
package/dist/node-engine.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { b as DeckReport, c as DeckReportOptions, r as readDeckReport } from './deck-report-
|
|
2
|
-
import { F as FontsHandle, j as EmbeddedFace, R as Renderer, k as Reporter, P as Peer, l as PptxModule, f as OPFApiError } from './conversion-
|
|
3
|
-
export { m as ConversionPlan, D as Diagnostic, n as EXPORT_FORMATS, o as EXPORT_TEXT, q as ExportContext, r as ExportFile, s as ExportFontSummary, E as ExportFormat, t as ExportOptions, u as ExportResult, v as ExportRun, w as ExportText, I as ImportOptions, x as ImportResult, g as OPFExportError, h as OPFImportError, y as PEER_RANGES, z as PPTX_PACKAGE, A as PreparedExport, B as RENDER_EXTRAS, G as RENDER_PACKAGE, H as ReportFinding, J as ResolvedExportOptions, i as SlideSelection, K as Source, V as VERSIONS, L as asApiError, M as assetRoot, N as checkDate, Q as checkOptions, T as checkRenamedOptions, U as checkScale, W as deckFileFormat, X as exportFormatOf, Y as finishReport, Z as importPresentation, _ as loadPptx, $ as loadRenderer, a0 as locatePackage, a1 as missingPeerFrom, p as parseSlideSelection, a2 as planConversion, a3 as prepareExport, a4 as reaches, a5 as readInput, a6 as reportThrown, a7 as resolveExportOptions, a8 as runExport, a9 as runPreparedExport, aa as writePlanned } from './conversion-
|
|
1
|
+
export { b as DeckReport, c as DeckReportOptions, r as readDeckReport } from './deck-report-BaKgPh_N.js';
|
|
2
|
+
import { F as FontsHandle, j as EmbeddedFace, R as Renderer, k as Reporter, P as Peer, l as PptxModule, f as OPFApiError } from './conversion-8SQD4dqu.js';
|
|
3
|
+
export { m as ConversionPlan, D as Diagnostic, n as EXPORT_FORMATS, o as EXPORT_TEXT, q as ExportContext, r as ExportFile, s as ExportFontSummary, E as ExportFormat, t as ExportOptions, u as ExportResult, v as ExportRun, w as ExportText, I as ImportOptions, x as ImportResult, g as OPFExportError, h as OPFImportError, y as PEER_RANGES, z as PPTX_PACKAGE, A as PreparedExport, B as RENDER_EXTRAS, G as RENDER_PACKAGE, H as ReportFinding, J as ResolvedExportOptions, i as SlideSelection, K as Source, V as VERSIONS, L as asApiError, M as assetRoot, N as checkDate, Q as checkOptions, T as checkRenamedOptions, U as checkScale, W as deckFileFormat, X as exportFormatOf, Y as finishReport, Z as importPresentation, _ as loadPptx, $ as loadRenderer, a0 as locatePackage, a1 as missingPeerFrom, p as parseSlideSelection, a2 as planConversion, a3 as prepareExport, a4 as reaches, a5 as readInput, a6 as reportThrown, a7 as resolveExportOptions, a8 as runExport, a9 as runPreparedExport, aa as writePlanned } from './conversion-8SQD4dqu.js';
|
|
4
4
|
import { a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
5
|
-
import { e as PresentationPaginationResult } from './pagination-
|
|
6
|
-
import './presentation-
|
|
7
|
-
import './validation-types-
|
|
8
|
-
import './composition-
|
|
5
|
+
import { e as PresentationPaginationResult } from './pagination-BsUTsQvk.js';
|
|
6
|
+
import './presentation-C-nHZyMw.js';
|
|
7
|
+
import './validation-types-6_jEaHeE.js';
|
|
8
|
+
import './composition-BGmpe5e4.js';
|
|
9
9
|
import './chart-data-BnNqgnC-.js';
|
|
10
|
-
import './finding-
|
|
10
|
+
import './finding-Bh56sGtF.js';
|
|
11
11
|
import './json-BFSdESOE.js';
|
|
12
12
|
|
|
13
13
|
/** `deck.opf.json` and `deck.pptx` both give `deck`; stdin gives `deck`. */
|
package/dist/node-engine.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import { loadRenderer, listFontDirectories, leaseSharedFonts, prepareFonts } from './chunk-
|
|
2
|
-
export { EXPORT_FORMATS, EXPORT_TEXT, PEER_RANGES, PPTX_PACKAGE, RENDER_EXTRAS, RENDER_PACKAGE, Reporter, VERSIONS, assetRoot, checkDate, checkDestinations, checkOptions, checkOutputPattern, checkRenamedOptions, checkScale, createZip, deckFileFormat, deckStem, embeddedFor, exportFormatOf, finishReport, importPresentation, leaseSharedFonts, listFontDirectories, loadPptx, loadRenderer, localAssetProblems, locatePackage, missingPeerFrom, padNumber, planConversion, pointerOf, prepareExport, prepareFonts, publishNew, reaches, readInput, reportThrown, resolveExportOptions, runExport, runImport, runPreparedExport, stemOf, writeFiles, writePlanned } from './chunk-
|
|
3
|
-
import { defaultCatalogs } from './chunk-
|
|
4
|
-
export { defaultCatalogs, galleryMismatch } from './chunk-
|
|
5
|
-
import { OPFApiError } from './chunk-
|
|
6
|
-
export { OPFApiError, OPFExportError, OPFImportError, asApiError, parseSlideSelection } from './chunk-
|
|
1
|
+
import { loadRenderer, listFontDirectories, leaseSharedFonts, prepareFonts } from './chunk-ZGTOZA2S.js';
|
|
2
|
+
export { EXPORT_FORMATS, EXPORT_TEXT, PEER_RANGES, PPTX_PACKAGE, RENDER_EXTRAS, RENDER_PACKAGE, Reporter, VERSIONS, assetRoot, checkDate, checkDestinations, checkOptions, checkOutputPattern, checkRenamedOptions, checkScale, createZip, deckFileFormat, deckStem, embeddedFor, exportFormatOf, finishReport, importPresentation, leaseSharedFonts, listFontDirectories, loadPptx, loadRenderer, localAssetProblems, locatePackage, missingPeerFrom, padNumber, planConversion, pointerOf, prepareExport, prepareFonts, publishNew, reaches, readInput, reportThrown, resolveExportOptions, runExport, runImport, runPreparedExport, stemOf, writeFiles, writePlanned } from './chunk-ZGTOZA2S.js';
|
|
3
|
+
import { defaultCatalogs } from './chunk-7XUEKIXH.js';
|
|
4
|
+
export { defaultCatalogs, galleryMismatch } from './chunk-7XUEKIXH.js';
|
|
5
|
+
import { OPFApiError } from './chunk-TMREBZBQ.js';
|
|
6
|
+
export { OPFApiError, OPFExportError, OPFImportError, asApiError, parseSlideSelection } from './chunk-TMREBZBQ.js';
|
|
7
7
|
import './chunk-UJSAR6GF.js';
|
|
8
8
|
import './chunk-PJSPHHRK.js';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import { paginate } from './chunk-
|
|
11
|
-
export { readDeckReport } from './chunk-
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './chunk-
|
|
9
|
+
import './chunk-JSHMFTSY.js';
|
|
10
|
+
import { paginate } from './chunk-WJ4XTCOD.js';
|
|
11
|
+
export { readDeckReport } from './chunk-OSM3LZ2Y.js';
|
|
12
|
+
import './chunk-GNKESMZT.js';
|
|
13
|
+
import './chunk-KZPZRHL6.js';
|
|
14
|
+
import './chunk-O3SA5SJ4.js';
|
|
14
15
|
import './chunk-RYZPBJLB.js';
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
19
|
-
import './chunk-
|
|
20
|
-
import './chunk-
|
|
21
|
-
import './chunk-
|
|
22
|
-
import './chunk-
|
|
23
|
-
import './chunk-
|
|
24
|
-
import './chunk-
|
|
16
|
+
import './chunk-CXPBU5W4.js';
|
|
17
|
+
import './chunk-353VBJ6K.js';
|
|
18
|
+
import './chunk-EO3JWEO5.js';
|
|
19
|
+
import './chunk-SYW4BCGZ.js';
|
|
20
|
+
import './chunk-ABFDFZIW.js';
|
|
21
|
+
import './chunk-4ACS57MG.js';
|
|
22
|
+
import './chunk-APLNGCEZ.js';
|
|
23
|
+
import './chunk-PAGVSTVF.js';
|
|
24
|
+
import './chunk-JBARNYFR.js';
|
|
25
|
+
import './chunk-4ZM5G3XX.js';
|
|
26
|
+
import './chunk-LRTQXGJO.js';
|
|
27
|
+
import './chunk-GM7WFPGG.js';
|
|
25
28
|
|
|
26
29
|
// src/node/paginate.ts
|
|
27
30
|
async function paginateDeck(deck, options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ComposeSlideOptions, R as ResolvedColorRoles, F as Fonts, L as LayoutDiagnostic } from './composition-
|
|
1
|
+
import { C as ComposeSlideOptions, R as ResolvedColorRoles, F as Fonts, L as LayoutDiagnostic } from './composition-BGmpe5e4.js';
|
|
2
2
|
import { U as UnresolvedReferenceDiagnostic, R as RecordProvenance, b as CatalogOptions, a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './composition-
|
|
1
|
+
import './composition-BGmpe5e4.js';
|
|
2
2
|
import './catalog-refs-BSfGELpt.js';
|
|
3
|
-
export { O as OPFPaginationError, P as PaginatedPage, b as PaginationMapping, c as PaginationOptions, d as PaginationResult, a as PresentationPaginationOptions, e as PresentationPaginationResult, p as paginate, h as paginateSlide } from './pagination-
|
|
3
|
+
export { O as OPFPaginationError, P as PaginatedPage, b as PaginationMapping, c as PaginationOptions, d as PaginationResult, a as PresentationPaginationOptions, e as PresentationPaginationResult, p as paginate, h as paginateSlide } from './pagination-BsUTsQvk.js';
|
|
4
4
|
import './chart-data-BnNqgnC-.js';
|
package/dist/pagination.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { OPFPaginationError, paginate, paginateSlide } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { OPFPaginationError, paginate, paginateSlide } from './chunk-WJ4XTCOD.js';
|
|
2
|
+
import './chunk-PAGVSTVF.js';
|
|
3
|
+
import './chunk-JBARNYFR.js';
|
|
4
|
+
import './chunk-4ZM5G3XX.js';
|
|
5
|
+
import './chunk-LRTQXGJO.js';
|
|
6
|
+
import './chunk-GM7WFPGG.js';
|
package/dist/patch.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as FindingReport, F as Finding, J as JsonPatchOperation } from './finding-Bh56sGtF.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The content hash of a document: `sha256:` and the SHA-256 of its canonical JSON (members sorted at every depth), as 64 lowercase
|
|
5
|
+
* hex digits. It is the same in Node, browsers and edge runtimes, does not depend on key order or on the file form the document was
|
|
6
|
+
* read from, and changes with any change of content, including the order of arrays. Pass it as `expectHash` to `applyPatch` or `edit`
|
|
7
|
+
* to apply a patch only to the document it was made for.
|
|
8
|
+
*/
|
|
9
|
+
declare function documentHash(document: unknown): string;
|
|
2
10
|
|
|
3
11
|
type JsonPointer = string;
|
|
4
|
-
type PatchErrorCode = "invalid-patch" | "invalid-patch-operation" | "unsupported-patch-operation" | "invalid-json-pointer" | "patch-path-missing" | "patch-parent-missing" | "invalid-array-index" | "patch-test-failed" | "patch-invalid-move" | "patch-root-remove" | "patch-invalid-document";
|
|
12
|
+
type PatchErrorCode = "invalid-patch" | "invalid-patch-operation" | "unsupported-patch-operation" | "invalid-json-pointer" | "patch-path-missing" | "patch-parent-missing" | "invalid-array-index" | "patch-test-failed" | "patch-invalid-move" | "patch-root-remove" | "patch-invalid-document" | "patch-id-not-found" | "patch-id-ambiguous" | "invalid-expect-hash" | "patch-hash-mismatch";
|
|
5
13
|
declare class OPFPatchError extends Error {
|
|
6
14
|
readonly code: PatchErrorCode;
|
|
7
15
|
/** The JSON Pointer the failing operation addressed, when known. */
|
|
@@ -21,6 +29,17 @@ declare class OPFPatchValidationError extends OPFPatchError {
|
|
|
21
29
|
readonly validation: PatchValidationResult;
|
|
22
30
|
constructor(validation: PatchValidationResult);
|
|
23
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Thrown when `expectHash` is given and the document is not the one the patch was made for (`code` `patch-hash-mismatch`): it changed
|
|
34
|
+
* since the hash was taken. Nothing was applied. Read the document again, rebase the edit, and retry with the new hash.
|
|
35
|
+
*/
|
|
36
|
+
declare class OPFPatchHashError extends OPFPatchError {
|
|
37
|
+
/** The hash the caller expected, in the form `documentHash` returns. */
|
|
38
|
+
readonly expected: string;
|
|
39
|
+
/** The hash of the document the patch was given. */
|
|
40
|
+
readonly actual: string;
|
|
41
|
+
constructor(expected: string, actual: string);
|
|
42
|
+
}
|
|
24
43
|
/** What a validator hook returns: a `validate` report, or anything with `valid` (and `findings` for `strict` to read). */
|
|
25
44
|
interface PatchValidationResult extends Pick<FindingReport, "valid"> {
|
|
26
45
|
findings?: Finding[];
|
|
@@ -34,6 +53,12 @@ interface ApplyPatchOptions {
|
|
|
34
53
|
validate?: boolean | ((document: unknown) => PatchValidationResult);
|
|
35
54
|
/** With `validate`, also reject warnings. */
|
|
36
55
|
strict?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Apply the patch only to the document it was made for: the `documentHash` of the input. A different document throws
|
|
58
|
+
* `OPFPatchHashError` (`patch-hash-mismatch`) before anything is applied; a value that is not a hash throws `invalid-expect-hash`.
|
|
59
|
+
* The bare 64-digit hex form is accepted. This is optimistic concurrency for a server that holds the document.
|
|
60
|
+
*/
|
|
61
|
+
expectHash?: string;
|
|
37
62
|
}
|
|
38
63
|
interface PatchResult {
|
|
39
64
|
/** The patched presentation (a clone; the input is never changed). */
|
|
@@ -63,7 +88,25 @@ declare function splitPointer(pointer: JsonPointer): {
|
|
|
63
88
|
parent: JsonPointer;
|
|
64
89
|
token: string;
|
|
65
90
|
};
|
|
66
|
-
/**
|
|
91
|
+
/** True for a token that names an array element by id (`@intro`). */
|
|
92
|
+
declare const isIdToken: (token: string) => boolean;
|
|
93
|
+
/** The pointer token that names the array element with this id (`intro` gives `@intro`). Escape it with `escapePointerToken` or `formatPointer`. */
|
|
94
|
+
declare const idToken: (id: string) => string;
|
|
95
|
+
/**
|
|
96
|
+
* The index form of a pointer: every id token (`/slides/@intro/title`) replaced by the index of the element in `document`
|
|
97
|
+
* (`/slides/2/title`). A pointer without id tokens is returned as written; nothing else is checked, so a path that does not exist
|
|
98
|
+
* is not an error. Throws `patch-id-not-found` for an id no element has and `patch-id-ambiguous` for an id several elements share.
|
|
99
|
+
*/
|
|
100
|
+
declare function resolveIdPointer(document: unknown, pointer: JsonPointer): JsonPointer;
|
|
101
|
+
/**
|
|
102
|
+
* The id form of an index pointer: every array index whose element has a unique, non-empty string `id` becomes `@id`
|
|
103
|
+
* (`/slides/2/blocks/0` gives `/slides/@intro/blocks/@kpi`); indexes of elements without an id stay. Id tokens in the pointer are kept.
|
|
104
|
+
* Pass an index into an array as the last token of an insertion (`add`) with `{ keepLast: true }` to leave it as written.
|
|
105
|
+
*/
|
|
106
|
+
declare function toIdPointer(document: unknown, pointer: JsonPointer, options?: {
|
|
107
|
+
keepLast?: boolean;
|
|
108
|
+
}): JsonPointer;
|
|
109
|
+
/** Read a value without throwing: `found` is false for a missing path (including `-` and bad indices). An id token (`@intro`) finds the array element with that id. */
|
|
67
110
|
declare function readPointer(document: unknown, pointer: JsonPointer | readonly string[]): {
|
|
68
111
|
found: true;
|
|
69
112
|
value: unknown;
|
|
@@ -75,6 +118,32 @@ declare function getAtPointer(document: unknown, pointer: JsonPointer | readonly
|
|
|
75
118
|
declare const hasPointer: (document: unknown, pointer: JsonPointer | readonly string[]) => boolean;
|
|
76
119
|
/** Normalise and structurally validate a patch (shape only; no document needed). Values are cloned. */
|
|
77
120
|
declare function normalizePatch(patch: unknown): JsonPatchOperation[];
|
|
121
|
+
/** One applied operation, as `walkPatch` reports it. */
|
|
122
|
+
interface PatchStep {
|
|
123
|
+
/** The index of the operation within the patch. */
|
|
124
|
+
index: number;
|
|
125
|
+
/** The normalized operation as given (id tokens as written). */
|
|
126
|
+
operation: JsonPatchOperation;
|
|
127
|
+
/** The same operation with id tokens resolved to indexes in the document it applied to (an `add` at `-` carries the index it appended at). */
|
|
128
|
+
resolved: JsonPatchOperation;
|
|
129
|
+
/** The patch that undoes this operation, in application order. */
|
|
130
|
+
inverse: JsonPatchOperation[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Apply `patch` to a clone of `document` one operation at a time and tell the hooks about each: `before` sees the document an
|
|
134
|
+
* operation is about to change, `after` the document it produced. The documents are the working copy, shared between calls: read them,
|
|
135
|
+
* never keep or change them. Errors are those of `applyPatch`, with the operation's index. This is the one loop under
|
|
136
|
+
* `applyPatchWithInverse`, `resolveIdPatch`, `toIdPatch` and `touches`; most callers want one of them.
|
|
137
|
+
* @returns the patched clone.
|
|
138
|
+
*/
|
|
139
|
+
declare function walkPatch(document: unknown, patch: unknown, hooks?: {
|
|
140
|
+
before?: (index: number, operation: JsonPatchOperation, working: unknown) => void;
|
|
141
|
+
after?: (step: PatchStep, working: unknown) => void;
|
|
142
|
+
}): {
|
|
143
|
+
document: unknown;
|
|
144
|
+
operations: JsonPatchOperation[];
|
|
145
|
+
inverse: JsonPatchOperation[];
|
|
146
|
+
};
|
|
78
147
|
/**
|
|
79
148
|
* Apply a patch to a clone of `document` and return the result with its
|
|
80
149
|
* inverse. Atomic: any failing operation throws and nothing is returned.
|
|
@@ -84,5 +153,19 @@ declare function applyPatchWithInverse(document: unknown, patch: unknown, option
|
|
|
84
153
|
declare function applyPatch(document: unknown, patch: unknown, options?: ApplyPatchOptions): unknown;
|
|
85
154
|
/** The patch that undoes `patch` when applied to the result of `applyPatch(document, patch)`. */
|
|
86
155
|
declare function invertPatch(document: unknown, patch: unknown): JsonPatchOperation[];
|
|
156
|
+
/**
|
|
157
|
+
* The patch with every id token resolved to the index it has when the operation runs: `/slides/@intro/title` becomes `/slides/2/title`,
|
|
158
|
+
* operation by operation, so an earlier operation that moves a slide is accounted for. A path in the destination of `move` resolves
|
|
159
|
+
* after the value has left. Throws what `applyPatch` throws (`patch-id-not-found`, ...). Use it to hand an id-addressed patch to a tool
|
|
160
|
+
* that reads indexes.
|
|
161
|
+
*/
|
|
162
|
+
declare function resolveIdPatch(document: unknown, patch: unknown): JsonPatchOperation[];
|
|
163
|
+
/**
|
|
164
|
+
* The patch with every index that names an element with an `id` written as the id token (`/slides/2/title` becomes
|
|
165
|
+
* `/slides/@intro/title`), operation by operation against the document each operation applies to. Where an operation inserts
|
|
166
|
+
* (`add`, `copy` and `move` destinations), the last token stays an index (or `-`): there is no element yet to name. The id form survives
|
|
167
|
+
* reordering, so a host that syncs by id sends it; `applyPatch` accepts it. Elements without an id keep their indexes.
|
|
168
|
+
*/
|
|
169
|
+
declare function toIdPatch(document: unknown, patch: unknown): JsonPatchOperation[];
|
|
87
170
|
|
|
88
|
-
export { type ApplyPatchOptions, JsonPatchOperation, type JsonPointer, OPFPatchError, OPFPatchValidationError, type PatchErrorCode, type PatchResult, type PatchValidationResult, applyPatch, applyPatchWithInverse, escapePointerToken, formatPointer, getAtPointer, hasPointer, invertPatch, jsonEqual, normalizePatch, parsePointer, pointerFromPath, readPointer, splitPointer, unescapePointerToken };
|
|
171
|
+
export { type ApplyPatchOptions, JsonPatchOperation, type JsonPointer, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, type PatchErrorCode, type PatchResult, type PatchStep, type PatchValidationResult, applyPatch, applyPatchWithInverse, documentHash, escapePointerToken, formatPointer, getAtPointer, hasPointer, idToken, invertPatch, isIdToken, jsonEqual, normalizePatch, parsePointer, pointerFromPath, readPointer, resolveIdPatch, resolveIdPointer, splitPointer, toIdPatch, toIdPointer, unescapePointerToken, walkPatch };
|
package/dist/patch.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export { OPFPatchError, OPFPatchValidationError, applyPatch, applyPatchWithInverse, escapePointerToken, formatPointer, getAtPointer, hasPointer, invertPatch, jsonEqual, normalizePatch, parsePointer, pointerFromPath, readPointer, splitPointer, unescapePointerToken } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { OPFPatchError, OPFPatchHashError, OPFPatchValidationError, applyPatch, applyPatchWithInverse, documentHash, escapePointerToken, formatPointer, getAtPointer, hasPointer, idToken, invertPatch, isIdToken, jsonEqual, normalizePatch, parsePointer, pointerFromPath, readPointer, resolveIdPatch, resolveIdPointer, splitPointer, toIdPatch, toIdPointer, unescapePointerToken, walkPatch } from './chunk-PAGVSTVF.js';
|
|
2
|
+
import './chunk-JBARNYFR.js';
|
|
3
|
+
import './chunk-4ZM5G3XX.js';
|
|
4
|
+
import './chunk-LRTQXGJO.js';
|
|
5
|
+
import './chunk-GM7WFPGG.js';
|
|
@@ -2634,7 +2634,7 @@ interface TableCellStyle {
|
|
|
2634
2634
|
verticalAlign?: ("top" | "middle" | "bottom");
|
|
2635
2635
|
padding?: TableCellPadding;
|
|
2636
2636
|
/**
|
|
2637
|
-
* Independent cell edges.
|
|
2637
|
+
* Independent cell edges. An omitted edge keeps the table's default rule: a line under every row (and over the first row), none between columns. Width 0 removes an edge.
|
|
2638
2638
|
*/
|
|
2639
2639
|
borders?: {
|
|
2640
2640
|
top?: TableCellBorder;
|