@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.
- package/README.md +6 -0
- package/dist/browser.js +20 -17
- package/dist/{catalog-refs-BSfGELpt.d.ts → catalog-refs-kAefsZWT.d.ts} +2 -1
- package/dist/{catalog-schemas-DoxA2BgY.d.ts → catalog-schemas-CC1d_h8s.d.ts} +3 -2
- package/dist/{chart-data-BnNqgnC-.d.ts → chart-data-Ci9s_NDN.d.ts} +2 -1
- package/dist/{chunk-XRMV2GMB.js → chunk-2CUCYENF.js} +758 -232
- package/dist/chunk-43JWUIGF.js +8 -0
- package/dist/{chunk-F4HFDP6I.js → chunk-5Q4IYLMW.js} +31 -15
- package/dist/{chunk-GIWNHRTX.js → chunk-BQUWRXTR.js} +4 -4
- package/dist/chunk-CR72ZJ6W.js +236 -0
- package/dist/{chunk-L52N5FZZ.js → chunk-F6DCEGB3.js} +6 -6
- package/dist/chunk-GM7WFPGG.js +10 -0
- package/dist/chunk-JBARNYFR.js +23 -0
- package/dist/{chunk-EQ6S5SEZ.js → chunk-KELC4K62.js} +1 -1
- package/dist/{chunk-77KL2PMM.js → chunk-KXKN3W5Z.js} +3 -3
- package/dist/{chunk-D25BNPTW.js → chunk-LLEXM7TQ.js} +4 -4
- package/dist/{chunk-3S2XVDPN.js → chunk-MTFK7QEY.js} +6 -6
- package/dist/{chunk-TKQ2VFV5.js → chunk-N77N4AOD.js} +1 -1
- package/dist/{chunk-NVT2YDVC.js → chunk-OAIAFXMS.js} +2 -2
- package/dist/{chunk-PHP45MO7.js → chunk-P6PKYJTS.js} +1 -1
- package/dist/{chunk-H7XMO36O.js → chunk-PCU4XGKV.js} +5 -5
- package/dist/{chunk-Y4TZCE7R.js → chunk-SEZ4EPW6.js} +2 -2
- package/dist/{chunk-Y25DYRME.js → chunk-TNUTRV6E.js} +1 -1
- package/dist/{chunk-G5WJMJV3.js → chunk-UOHWG4OS.js} +1 -1
- package/dist/{chunk-A54NGT2K.js → chunk-VGGPAMP7.js} +2 -2
- package/dist/{chunk-IVPA6NG6.js → chunk-WPKCWQ6W.js} +494 -120
- package/dist/{chunk-VZBFQLCA.js → chunk-XZ23FORL.js} +6 -6
- package/dist/chunk-ZROVYWGU.js +1 -0
- package/dist/{composition-DIftf6iP.d.ts → composition-C-hd_Ci3.d.ts} +134 -14
- package/dist/composition.d.ts +3 -3
- package/dist/composition.js +2 -1
- package/dist/conversion-XJTDWQ5W.js +24 -0
- package/dist/{conversion-ChmGA8Ul.d.ts → conversion-hbZeS5kD.d.ts} +8 -7
- package/dist/convert.d.ts +6 -5
- package/dist/convert.js +9 -7
- package/dist/data.d.ts +4 -3
- package/dist/data.js +3 -2
- package/dist/{deck-report-5vwMGcQz.d.ts → deck-report-DQMsvyBI.d.ts} +5 -4
- package/dist/deck.d.ts +9 -8
- package/dist/deck.js +13 -11
- package/dist/diff.d.ts +3 -2
- package/dist/diff.js +6 -4
- package/dist/docs.d.ts +2 -1
- package/dist/docs.js +33 -19
- package/dist/examples.d.ts +3 -2
- package/dist/examples.js +92 -50
- package/dist/{explain-JSuESV-Y.d.ts → explain-iZeNOUc6.d.ts} +2 -1
- package/dist/font-policy.d.ts +2 -1
- package/dist/font-policy.js +1 -0
- package/dist/format.d.ts +2 -1
- package/dist/format.js +3 -2
- package/dist/ids.d.ts +114 -0
- package/dist/ids.js +6 -0
- package/dist/index.d.ts +40 -16
- package/dist/index.js +24 -21
- package/dist/markdown.d.ts +8 -7
- package/dist/markdown.js +10 -8
- package/dist/node-engine.d.ts +33 -10
- package/dist/node-engine.js +37 -28
- package/dist/{pagination-D_kJe4jH.d.ts → pagination-DyAKYpXu.d.ts} +4 -3
- package/dist/pagination.d.ts +4 -4
- package/dist/pagination.js +6 -4
- package/dist/patch.d.ts +89 -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-8jLSTFqL.d.ts} +11 -11
- package/dist/repo-readme.js +3 -1
- package/dist/schema-engine-ajv.js +37 -0
- package/dist/schema-engine-precompiled.js +3 -0
- package/dist/schema.d.ts +4 -3
- package/dist/schema.js +5 -3
- package/dist/schemas.d.ts +2 -1
- package/dist/schemas.js +2 -1
- package/dist/source.d.ts +5 -4
- package/dist/source.js +12 -10
- package/dist/spec/README.md +1 -1
- package/dist/spec/schemas/audience.schema.json +1 -0
- package/dist/spec/schemas/catalog-index.schema.json +1 -0
- package/dist/spec/schemas/catalog-manifest.schema.json +1 -0
- package/dist/spec/schemas/chart-type.schema.json +1 -0
- package/dist/spec/schemas/color-scheme.schema.json +1 -0
- package/dist/spec/schemas/finding.schema.json +1 -0
- package/dist/spec/schemas/font-scheme.schema.json +1 -0
- package/dist/spec/schemas/language.schema.json +1 -0
- package/dist/spec/schemas/layout-preview-index.schema.json +1 -0
- package/dist/spec/schemas/layout.schema.json +8 -6
- package/dist/spec/schemas/narrative.schema.json +1 -0
- package/dist/spec/schemas/opf.schema.json +9 -8
- package/dist/spec/schemas/purpose.schema.json +1 -0
- package/dist/spec/schemas/social-platform.schema.json +1 -0
- package/dist/spec/schemas/theme.schema.json +3 -1
- package/dist/spec/schemas/tone.schema.json +1 -0
- package/dist/spec-files.d.ts +2 -1
- package/dist/spec-files.js +1 -0
- package/dist/symbol-font-encodings.d.ts +2 -1
- package/dist/symbol-font-encodings.js +2 -0
- package/dist/types.d.ts +9 -9
- package/dist/{validation-types-3ARvTsB0.d.ts → validation-types-mNmfcY9A.d.ts} +4 -3
- package/dist/validator.d.ts +8 -8
- package/dist/validator.js +5 -3
- package/dist/yaml.d.ts +8 -7
- package/dist/yaml.js +9 -7
- package/package.json +30 -9
- package/dist/conversion-IVKCKMCN.js +0 -21
package/dist/ids.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { OPFIdError, assignIds, touches } from './chunk-CR72ZJ6W.js';
|
|
2
|
+
export { OPFPatchHashError, documentHash, idToken, isIdToken, resolveIdPatch, resolveIdPointer, toIdPatch, toIdPointer } from './chunk-WPKCWQ6W.js';
|
|
3
|
+
import './chunk-JBARNYFR.js';
|
|
4
|
+
import './chunk-5Q4IYLMW.js';
|
|
5
|
+
import './chunk-2CUCYENF.js';
|
|
6
|
+
import './chunk-GM7WFPGG.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
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 {
|
|
3
|
-
export {
|
|
4
|
-
export { R as RuleExplanation, e as explain } from './explain-
|
|
2
|
+
import { a3 as ConvertInput, a4 as ConvertOptions, a5 as ConvertResult, a6 as ConvertFormat, a7 as OpenOptions, a8 as SaveOptions, a9 as SaveResult } from './conversion-hbZeS5kD.js';
|
|
3
|
+
export { aa as ConvertedFile, h as ExportFormat, F as FontsHandle, O as OPFApiError, n as OPFExportError, o as OPFImportError, S as SlideSelection, U as parseSlideSelection } from './conversion-hbZeS5kD.js';
|
|
4
|
+
export { R as RuleExplanation, e as explain } from './explain-iZeNOUc6.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
|
-
|
|
7
|
+
import { R as ResolveVariablesOptions, h as VariableDiagnostic } from './validation-types-mNmfcY9A.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-mNmfcY9A.js';
|
|
9
|
+
import { a as FontFamilies, T as TextMeasurement } from './composition-C-hd_Ci3.js';
|
|
10
|
+
export { b as CHART_TYPES, C as ComposeSlideOptions, E as ENGINE_DEFAULT_CHART_TYPES, c as ENGINE_DEFAULT_COLOR_SCHEME, d as ENGINE_DEFAULT_FONT_SCHEME, e as ENGINE_DEFAULT_THEME, 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, o as TextStyle, p as normalizeLanguageFamily } from './composition-C-hd_Ci3.js';
|
|
10
11
|
export { SpecFileEntry, SpecFileKind, SpecFilePath, specFileEntries, specFileKinds, specFilePaths } from './spec-files.js';
|
|
11
|
-
import { P as Presentation } from './presentation-
|
|
12
|
+
import { P as Presentation } from './presentation-8jLSTFqL.js';
|
|
12
13
|
export { Audience, ChartType, ColorScheme, FontScheme, Language, Layout, Narrative, Purpose, SocialPlatform, Theme, Tone } from './types.js';
|
|
13
|
-
import {
|
|
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-
|
|
14
|
+
import { a as CatalogKind, U as UnresolvedReferenceDiagnostic, b as CatalogOptions, C as Catalog, R as RecordProvenance } from './catalog-refs-kAefsZWT.js';
|
|
15
|
+
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-kAefsZWT.js';
|
|
15
16
|
import { a as Finding, J as JsonPatchOperation } from './finding-l9dlQ2NF.js';
|
|
16
17
|
export { d as FindingCategory, e as FindingFix, f as FindingFocus, b as FindingLocation, F as FindingReport, c as FindingSeverity, g as FindingSuggestion, V as ValidationIssue } from './finding-l9dlQ2NF.js';
|
|
17
|
-
export { a as CATALOG_SCHEMA, b as CatalogDisplayKind, C as CatalogRecordKind, c as catalogDisplayKinds, d as catalogSchemaNames } from './catalog-schemas-
|
|
18
|
-
import {
|
|
19
|
-
export { O as OPFPaginationError, P as PaginatedPage,
|
|
20
|
-
export { ApplyPatchOptions, OPFPatchError, OPFPatchValidationError, PatchResult, applyPatch } from './patch.js';
|
|
18
|
+
export { a as CATALOG_SCHEMA, b as CatalogDisplayKind, C as CatalogRecordKind, c as catalogDisplayKinds, d as catalogSchemaNames } from './catalog-schemas-CC1d_h8s.js';
|
|
19
|
+
import { paginate as paginate$1 } from './pagination.js';
|
|
20
|
+
export { O as OPFPaginationError, P as PaginatedPage, c as PaginationMapping, d as PaginationOptions, e as PaginationResult, a as PresentationPaginationOptions, b as PresentationPaginationResult, S as SlideContext, f as SlideContextDiagnostic, g as SlideContextOptions, h as paginateSlide, r as resolveSlideContext } from './pagination-DyAKYpXu.js';
|
|
21
|
+
export { ApplyPatchOptions, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, PatchResult, applyPatch, documentHash, idToken, isIdToken, resolveIdPatch, resolveIdPointer, toIdPatch, toIdPointer } from './patch.js';
|
|
22
|
+
export { AssignIdsContext, AssignIdsOptions, AssignIdsResult, AssignedId, IdErrorCode, OPFIdError, PatchScope, PatchScopeKind, PatchTouch, assignIds, touches } from './ids.js';
|
|
21
23
|
export { DiffOptions, MergeConflict, MergeOptions, MergeResult, PresentationDiff, diff, merge } from './diff.js';
|
|
22
24
|
export { FormatOptions, OPFFormatError, format } from './format.js';
|
|
23
25
|
export { FromMarkdownOptions, FromMarkdownResult, OPFMarkdownError, ToMarkdownOptions, ToMarkdownResult, fromMarkdown, toMarkdown } from './markdown.js';
|
|
24
26
|
export { StringifyOptions, parse, stringify } from './deck.js';
|
|
25
27
|
export { DataCell, DataImportOptions, ImportedChart, ImportedChartData, ImportedChartType, ImportedTable, IngestOptions, OPFDataImportError, TabularData, ingest, parseTabularData } from './data.js';
|
|
26
|
-
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-
|
|
28
|
+
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-Ci9s_NDN.js';
|
|
27
29
|
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-
|
|
30
|
+
export { a as DECK_FORMATS, D as DeckFormat, P as ParseOptions, d as deckFormatOf } from './deck-report-DQMsvyBI.js';
|
|
29
31
|
import './json-BFSdESOE.js';
|
|
30
32
|
|
|
31
33
|
/**
|
|
@@ -583,6 +585,8 @@ interface EditOptions {
|
|
|
583
585
|
catalogs?: readonly Catalog[];
|
|
584
586
|
/** `false` skips the check of the result (work in progress). Default true. */
|
|
585
587
|
validate?: boolean;
|
|
588
|
+
/** Apply the patch only to the deck whose `documentHash` this is; a different deck throws `OPFPatchHashError` before anything is applied. */
|
|
589
|
+
expectHash?: string;
|
|
586
590
|
}
|
|
587
591
|
interface EditResult {
|
|
588
592
|
/** The patched deck (a copy). */
|
|
@@ -644,6 +648,25 @@ declare function fillRecords(raw: string, options?: Pick<FillOptions, "format" |
|
|
|
644
648
|
*/
|
|
645
649
|
declare function fill(template: unknown, data?: string | FillRecord | readonly FillRecord[], options?: FillOptions): FillResult;
|
|
646
650
|
|
|
651
|
+
/**
|
|
652
|
+
* The role families a slide composes with when a host measures text (WI-1, P24): each role family resolves once through
|
|
653
|
+
* the host's measurement (heading at weight 700, the others at 400), and composition then asks for the family the host
|
|
654
|
+
* draws. With the renderer's fonts, Aptos Display becomes Intos Display, its open replacement, and a run at a weight that
|
|
655
|
+
* face does not have (a metric value at 800, a quote at 600) draws its nearest weight, which the registry records as a
|
|
656
|
+
* visual substitution. This is the resolution `toSvg` composes with, so `validate` and `paginate` measure the same slide
|
|
657
|
+
* the renderer draws instead of failing on a weight the replacement lacks.
|
|
658
|
+
*
|
|
659
|
+
* Two kinds of family keep their own name, as in the renderer since RR-17 and FF-45: a family that names its weight
|
|
660
|
+
* (Arial Black, Segoe UI Semibold: at weight 400 the host draws another weight) resolves again on every run to its
|
|
661
|
+
* replacement's encoded weight, and a symbol-encoded family (Symbol, Wingdings: the host's resolved style carries
|
|
662
|
+
* `symbolEncoding`) keeps its encoding for the script planner. By default both are read from the host's own resolution,
|
|
663
|
+
* so core needs neither the font policy table nor the symbol tables here; a host that holds those tables (the renderer)
|
|
664
|
+
* passes `keepsName` and decides from them, with no extra resolution. Without a measurement that resolves styles the
|
|
665
|
+
* families are returned unchanged, and a family the host cannot resolve keeps its name, so a run that uses it fails with
|
|
666
|
+
* the host's error and a slide that never draws it is not affected.
|
|
667
|
+
*/
|
|
668
|
+
declare function resolveDrawnFontFamilies<T extends Partial<FontFamilies>>(families: T, measurement: TextMeasurement | undefined, keepsName?: (family: string, resolved: string) => boolean): T;
|
|
669
|
+
|
|
647
670
|
/** `validate` with the gallery registered when `catalogs` is omitted, as `opf validate` does. */
|
|
648
671
|
declare const validate: typeof validate$1;
|
|
649
672
|
/** `stats` with the gallery registered when `catalogs` is omitted, as `opf stats` does. */
|
|
@@ -695,4 +718,5 @@ declare function open(input: string | Uint8Array | ArrayBuffer, options?: OpenOp
|
|
|
695
718
|
*/
|
|
696
719
|
declare function save(deck: Presentation, path: string, options?: SaveOptions): Promise<SaveResult>;
|
|
697
720
|
|
|
698
|
-
export { Catalog, CatalogKind, CatalogOptions,
|
|
721
|
+
export { Catalog, CatalogKind, CatalogOptions, ConvertFormat, ConvertInput, ConvertOptions, ConvertResult, Finding, FontFamilies, JsonPatchOperation, OPFMoveToCustomError, OpenOptions, Presentation, RecordProvenance, ResolveVariablesOptions, SLIDE_SCOPED_BUILTINS, SaveOptions, SaveResult, TextMeasurement, UnresolvedReferenceDiagnostic, VariableDiagnostic, convert, copySlides, edit, embed, fill, fillRecords, localAssetSources, moveToCustom, open, paginate, resolveDesignRecords, resolveDrawnFontFamilies, resolveFontScheme, resolveSlideVariables, sameRecord, save, stats, updateFromCatalog, validate };
|
|
722
|
+
export type { CatalogPatchOperation, CatalogRecordChange, CatalogRef, CatalogUpdate, CopiedRecordRename, CopySlidesResult, DatasetFact, EditOptions, EditResult, EmbedResult, EmbeddedRecord, FillOptions, FillRecord, FillResult, FilledDeck, HeaderFooterFact, MoveToCustomErrorCode, MoveToCustomPatchOperation, MoveToCustomResult, MovedRecord, PresentationStats, ReferenceFact, ResolvedDesignRecords, SlideScopedBuiltin, SlideSizeFact, SlideStats, StatsOptions, StatsSlideRef, TableFact };
|
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-OAIAFXMS.js';
|
|
2
|
+
import { stats, embed, edit, OPFApiError, asApiError } from './chunk-LLEXM7TQ.js';
|
|
3
|
+
export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, updateFromCatalog } from './chunk-LLEXM7TQ.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-N77N4AOD.js';
|
|
7
|
+
import { paginate } from './chunk-KXKN3W5Z.js';
|
|
8
|
+
export { OPFPaginationError, paginateSlide } from './chunk-KXKN3W5Z.js';
|
|
9
|
+
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-BQUWRXTR.js';
|
|
10
|
+
export { fromMarkdown, toMarkdown } from './chunk-MTFK7QEY.js';
|
|
11
|
+
import './chunk-XZ23FORL.js';
|
|
12
|
+
export { OPFFormatError, format } from './chunk-KELC4K62.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-UOHWG4OS.js';
|
|
15
|
+
import './chunk-PCU4XGKV.js';
|
|
16
|
+
import './chunk-P6PKYJTS.js';
|
|
17
|
+
export { OPFMarkdownError } from './chunk-SEZ4EPW6.js';
|
|
18
|
+
import './chunk-TNUTRV6E.js';
|
|
19
|
+
export { OPFIdError, assignIds, touches } from './chunk-CR72ZJ6W.js';
|
|
20
|
+
export { diff, merge } from './chunk-VGGPAMP7.js';
|
|
21
|
+
import { validate, OPFValidationError } from './chunk-WPKCWQ6W.js';
|
|
22
|
+
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, validateCatalogRecord, validationCategories, validationRules } from './chunk-WPKCWQ6W.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-5Q4IYLMW.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-2CUCYENF.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-XJTDWQ5W.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,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import './composition-
|
|
6
|
-
import './chart-data-
|
|
1
|
+
import { Catalog } from './composition.js';
|
|
2
|
+
import { Presentation } from './index.js';
|
|
3
|
+
import { Finding, FindingLocation } from './index.js';
|
|
4
|
+
import { ValidateOptions, ValidationReport } from './index.js';
|
|
5
|
+
import './composition-C-hd_Ci3.js';
|
|
6
|
+
import './chart-data-Ci9s_NDN.js';
|
|
7
7
|
import './json-BFSdESOE.js';
|
|
8
8
|
|
|
9
9
|
interface EmbeddedPart {
|
|
@@ -89,4 +89,5 @@ interface ToMarkdownResult {
|
|
|
89
89
|
*/
|
|
90
90
|
declare function toMarkdown(document: unknown, options?: ToMarkdownOptions): ToMarkdownResult;
|
|
91
91
|
|
|
92
|
-
export {
|
|
92
|
+
export { OPFMarkdownError, fromMarkdown, toMarkdown };
|
|
93
|
+
export type { EmbeddedPart, FromMarkdownOptions, FromMarkdownResult, ToMarkdownOptions, ToMarkdownResult };
|
package/dist/markdown.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { fromMarkdown, toMarkdown } from './chunk-
|
|
1
|
+
export { fromMarkdown, toMarkdown } from './chunk-MTFK7QEY.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-PCU4XGKV.js';
|
|
4
|
+
import './chunk-P6PKYJTS.js';
|
|
5
|
+
export { OPFMarkdownError } from './chunk-SEZ4EPW6.js';
|
|
6
|
+
import './chunk-TNUTRV6E.js';
|
|
7
|
+
import './chunk-WPKCWQ6W.js';
|
|
8
|
+
import './chunk-JBARNYFR.js';
|
|
9
|
+
import './chunk-5Q4IYLMW.js';
|
|
10
|
+
import './chunk-2CUCYENF.js';
|
|
11
|
+
import './chunk-GM7WFPGG.js';
|
package/dist/node-engine.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { b as DeckReport, c as DeckReportOptions, r as readDeckReport } from './deck-report-
|
|
2
|
-
import { F as FontsHandle,
|
|
3
|
-
export {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import './
|
|
7
|
-
import './
|
|
8
|
-
import './
|
|
9
|
-
import './chart-data-BnNqgnC-.js';
|
|
1
|
+
export { b as DeckReport, c as DeckReportOptions, r as readDeckReport } from './deck-report-DQMsvyBI.js';
|
|
2
|
+
import { F as FontsHandle, E as EmbeddedFace, R as Renderer, a as Reporter, P as Peer, b as PptxModule, O as OPFApiError } from './conversion-hbZeS5kD.js';
|
|
3
|
+
export { C as ConversionPlan, D as Diagnostic, c as EXPORT_FORMATS, d as EXPORT_TEXT, e as ExportContext, f as ExportFile, g as ExportFontSummary, h as ExportFormat, i as ExportOptions, j as ExportResult, k as ExportRun, l as ExportText, I as ImportOptions, m as ImportResult, n as OPFExportError, o as OPFImportError, p as PEER_RANGES, q as PPTX_PACKAGE, r as PreparedExport, s as RENDER_EXTRAS, t as RENDER_PACKAGE, u as ReportFinding, v as ResolvedExportOptions, S as SlideSelection, w as Source, V as VERSIONS, x as asApiError, y as assetRoot, z as checkDate, A as checkOptions, B as checkRenamedOptions, G as checkScale, H as deckFileFormat, J as exportFormatOf, K as finishReport, L as importPresentation, M as loadPptx, N as loadRenderer, Q as locatePackage, T as missingPeerFrom, U as parseSlideSelection, W as planConversion, X as prepareExport, Y as reaches, Z as readInput, _ as reportThrown, $ as resolveExportOptions, a0 as runExport, a1 as runPreparedExport, a2 as writePlanned } from './conversion-hbZeS5kD.js';
|
|
4
|
+
import { Catalog } from './composition.js';
|
|
5
|
+
import { Fonts } from './composition.js';
|
|
6
|
+
import { PresentationPaginationResult } from './index.js';
|
|
7
|
+
import './presentation-8jLSTFqL.js';
|
|
8
|
+
import './validation-types-mNmfcY9A.js';
|
|
10
9
|
import './finding-l9dlQ2NF.js';
|
|
11
10
|
import './json-BFSdESOE.js';
|
|
11
|
+
import './chart-data-Ci9s_NDN.js';
|
|
12
12
|
|
|
13
13
|
/** `deck.opf.json` and `deck.pptx` both give `deck`; stdin gives `deck`. */
|
|
14
14
|
declare function stemOf(input: string): string;
|
|
@@ -144,10 +144,33 @@ interface PaginatedDeck {
|
|
|
144
144
|
* `fontFolders` the fonts are required, so a missing renderer throws. Throws `OPFPaginationError` when content cannot fit.
|
|
145
145
|
*/
|
|
146
146
|
declare function paginateDeck(deck: unknown, options: PaginateDeckOptions): Promise<PaginatedDeck>;
|
|
147
|
+
interface MeasuringFontsOptions {
|
|
148
|
+
/** Folders of `.ttf` and `.otf` files, loaded before the bundled pack (as `--fonts`). They need opf-render. */
|
|
149
|
+
fontFolders?: readonly string[];
|
|
150
|
+
/** Receives the font diagnostics. */
|
|
151
|
+
reporter: Reporter;
|
|
152
|
+
/** Name options as the command's flags in messages. */
|
|
153
|
+
flags?: boolean;
|
|
154
|
+
}
|
|
155
|
+
interface MeasuringFonts {
|
|
156
|
+
/** The fonts `opf convert` draws `deck` with; absent when the layout can only be estimated. */
|
|
157
|
+
fonts?: Fonts;
|
|
158
|
+
/** Why there are no fonts: the missing or too old peer (`peer-not-installed`, `peer-too-old`) that measuring needs. */
|
|
159
|
+
estimated?: OPFApiError;
|
|
160
|
+
/** Returns a shared handle; call it when the measurement is done. */
|
|
161
|
+
release(): void;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The fonts the CLI measures a deck with (`opf paginate`, `opf validate`; WI-1, P24): opf-render's office pack, prepared once per
|
|
165
|
+
* process and shared, plus any `fontFolders`, as `opf convert` draws. Without opf-render (or with one too old) the result has no
|
|
166
|
+
* fonts and says why in `estimated`. With `fontFolders` the fonts are required, so a missing renderer throws.
|
|
167
|
+
*/
|
|
168
|
+
declare function measuringFonts(deck: unknown, options: MeasuringFontsOptions): Promise<MeasuringFonts>;
|
|
147
169
|
|
|
148
170
|
/** Why a gallery that declares `declared` cannot be the default catalog of a core that reads `reads`, or undefined when it can. */
|
|
149
171
|
declare function galleryMismatch(declared: unknown, reads?: number): string | undefined;
|
|
150
172
|
/** The catalogs a call registers when it names none: `[gallery]`. Throws `gallery-schema-mismatch` for a gallery of another schema. */
|
|
151
173
|
declare function defaultCatalogs(): readonly Catalog[];
|
|
152
174
|
|
|
153
|
-
export {
|
|
175
|
+
export { FontsHandle, OPFApiError, Peer, PptxModule, Renderer, Reporter, checkDestinations, checkOutputPattern, createZip, deckStem, defaultCatalogs, embeddedFor, galleryMismatch, leaseSharedFonts, listFontDirectories, localAssetProblems, measuringFonts, padNumber, paginateDeck, pointerOf, prepareFonts, publishNew, runImport, stemOf, writeFiles };
|
|
176
|
+
export type { AssetProblem, ImportRun, MeasuringFonts, MeasuringFontsOptions, PaginateDeckOptions, PaginatedDeck, PlannedFile };
|
package/dist/node-engine.js
CHANGED
|
@@ -1,45 +1,54 @@
|
|
|
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-F6DCEGB3.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-F6DCEGB3.js';
|
|
3
|
+
import { defaultCatalogs } from './chunk-OAIAFXMS.js';
|
|
4
|
+
export { defaultCatalogs, galleryMismatch } from './chunk-OAIAFXMS.js';
|
|
5
|
+
import { OPFApiError } from './chunk-LLEXM7TQ.js';
|
|
6
|
+
export { OPFApiError, OPFExportError, OPFImportError, asApiError, parseSlideSelection } from './chunk-LLEXM7TQ.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-N77N4AOD.js';
|
|
10
|
+
import { paginate } from './chunk-KXKN3W5Z.js';
|
|
11
|
+
export { readDeckReport } from './chunk-BQUWRXTR.js';
|
|
12
|
+
import './chunk-MTFK7QEY.js';
|
|
13
|
+
import './chunk-XZ23FORL.js';
|
|
14
|
+
import './chunk-KELC4K62.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-UOHWG4OS.js';
|
|
17
|
+
import './chunk-PCU4XGKV.js';
|
|
18
|
+
import './chunk-P6PKYJTS.js';
|
|
19
|
+
import './chunk-SEZ4EPW6.js';
|
|
20
|
+
import './chunk-TNUTRV6E.js';
|
|
21
|
+
import './chunk-CR72ZJ6W.js';
|
|
22
|
+
import './chunk-VGGPAMP7.js';
|
|
23
|
+
import './chunk-WPKCWQ6W.js';
|
|
24
|
+
import './chunk-JBARNYFR.js';
|
|
25
|
+
import './chunk-5Q4IYLMW.js';
|
|
26
|
+
import './chunk-2CUCYENF.js';
|
|
27
|
+
import './chunk-GM7WFPGG.js';
|
|
25
28
|
|
|
26
29
|
// src/node/paginate.ts
|
|
27
30
|
async function paginateDeck(deck, options) {
|
|
28
31
|
const catalogs = options.catalogs ?? defaultCatalogs();
|
|
32
|
+
const measuring = await measuringFonts(deck, options);
|
|
33
|
+
try {
|
|
34
|
+
return { result: paginate(deck, { ...measuring.fonts ? { fonts: measuring.fonts } : {}, catalogs }), ...measuring.estimated ? { estimated: measuring.estimated } : {} };
|
|
35
|
+
} finally {
|
|
36
|
+
measuring.release();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function measuringFonts(deck, options) {
|
|
29
40
|
const folders = options.fontFolders ?? [];
|
|
30
|
-
let lease;
|
|
31
41
|
try {
|
|
32
42
|
const renderer = await loadRenderer();
|
|
33
43
|
const userFonts = await listFontDirectories([...folders], options.flags ? "--fonts" : "fonts");
|
|
34
|
-
lease = await leaseSharedFonts(renderer, deck, userFonts, options.reporter);
|
|
44
|
+
const lease = await leaseSharedFonts(renderer, deck, userFonts, options.reporter);
|
|
35
45
|
const handle = lease?.handle ?? (await prepareFonts(renderer, deck, userFonts, options.reporter)).handle;
|
|
36
|
-
return {
|
|
46
|
+
return { fonts: handle, release: () => lease?.release() };
|
|
37
47
|
} catch (error) {
|
|
38
|
-
if (error instanceof OPFApiError && (error.code === "peer-not-installed" || error.code === "peer-too-old") && !folders.length) return {
|
|
48
|
+
if (error instanceof OPFApiError && (error.code === "peer-not-installed" || error.code === "peer-too-old") && !folders.length) return { estimated: error, release: () => {
|
|
49
|
+
} };
|
|
39
50
|
throw error;
|
|
40
|
-
} finally {
|
|
41
|
-
lease?.release();
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
53
|
|
|
45
|
-
export { paginateDeck };
|
|
54
|
+
export { measuringFonts, paginateDeck };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ComposeSlideOptions, R as ResolvedColorRoles, F as Fonts, L as LayoutDiagnostic } from './composition-
|
|
2
|
-
import { U as UnresolvedReferenceDiagnostic, R as RecordProvenance, b as CatalogOptions,
|
|
1
|
+
import { C as ComposeSlideOptions, R as ResolvedColorRoles, F as Fonts, L as LayoutDiagnostic } from './composition-C-hd_Ci3.js';
|
|
2
|
+
import { U as UnresolvedReferenceDiagnostic, R as RecordProvenance, b as CatalogOptions, C as Catalog } from './catalog-refs-kAefsZWT.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* One slide's composition context: the layout, canvas, theme and font families that `composeSlide` needs,
|
|
@@ -135,4 +135,5 @@ interface PresentationPaginationResult {
|
|
|
135
135
|
/** Resolve the slides' references (the document's catalogs groups, then the registered catalogs) and paginate a complete presentation without mutating it. */
|
|
136
136
|
declare function paginate(input: unknown, options?: PresentationPaginationOptions): PresentationPaginationResult;
|
|
137
137
|
|
|
138
|
-
export { OPFPaginationError as O,
|
|
138
|
+
export { OPFPaginationError as O, paginateSlide as h, paginate as p, resolveSlideContext as r };
|
|
139
|
+
export type { PaginatedPage as P, SlideContext as S, PresentationPaginationOptions as a, PresentationPaginationResult as b, PaginationMapping as c, PaginationOptions as d, PaginationResult as e, SlideContextDiagnostic as f, SlideContextOptions as g };
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './composition-
|
|
2
|
-
import './catalog-refs-
|
|
3
|
-
export { O as OPFPaginationError, P as PaginatedPage,
|
|
4
|
-
import './chart-data-
|
|
1
|
+
import './composition-C-hd_Ci3.js';
|
|
2
|
+
import './catalog-refs-kAefsZWT.js';
|
|
3
|
+
export { O as OPFPaginationError, P as PaginatedPage, c as PaginationMapping, d as PaginationOptions, e as PaginationResult, a as PresentationPaginationOptions, b as PresentationPaginationResult, p as paginate, h as paginateSlide } from './pagination-DyAKYpXu.js';
|
|
4
|
+
import './chart-data-Ci9s_NDN.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-KXKN3W5Z.js';
|
|
2
|
+
import './chunk-WPKCWQ6W.js';
|
|
3
|
+
import './chunk-JBARNYFR.js';
|
|
4
|
+
import './chunk-5Q4IYLMW.js';
|
|
5
|
+
import './chunk-2CUCYENF.js';
|
|
6
|
+
import './chunk-GM7WFPGG.js';
|
package/dist/patch.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as JsonPatchOperation } from './finding-l9dlQ2NF.js';
|
|
2
|
+
import { FindingReport, Finding } from './index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The content hash of a document: `sha256:` and the SHA-256 of its canonical JSON (members sorted at every depth), as 64 lowercase
|
|
6
|
+
* 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
|
|
7
|
+
* read from, and changes with any change of content, including the order of arrays. Pass it as `expectHash` to `applyPatch` or `edit`
|
|
8
|
+
* to apply a patch only to the document it was made for.
|
|
9
|
+
*/
|
|
10
|
+
declare function documentHash(document: unknown): string;
|
|
2
11
|
|
|
3
12
|
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";
|
|
13
|
+
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
14
|
declare class OPFPatchError extends Error {
|
|
6
15
|
readonly code: PatchErrorCode;
|
|
7
16
|
/** The JSON Pointer the failing operation addressed, when known. */
|
|
@@ -21,6 +30,17 @@ declare class OPFPatchValidationError extends OPFPatchError {
|
|
|
21
30
|
readonly validation: PatchValidationResult;
|
|
22
31
|
constructor(validation: PatchValidationResult);
|
|
23
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when `expectHash` is given and the document is not the one the patch was made for (`code` `patch-hash-mismatch`): it changed
|
|
35
|
+
* since the hash was taken. Nothing was applied. Read the document again, rebase the edit, and retry with the new hash.
|
|
36
|
+
*/
|
|
37
|
+
declare class OPFPatchHashError extends OPFPatchError {
|
|
38
|
+
/** The hash the caller expected, in the form `documentHash` returns. */
|
|
39
|
+
readonly expected: string;
|
|
40
|
+
/** The hash of the document the patch was given. */
|
|
41
|
+
readonly actual: string;
|
|
42
|
+
constructor(expected: string, actual: string);
|
|
43
|
+
}
|
|
24
44
|
/** What a validator hook returns: a `validate` report, or anything with `valid` (and `findings` for `strict` to read). */
|
|
25
45
|
interface PatchValidationResult extends Pick<FindingReport, "valid"> {
|
|
26
46
|
findings?: Finding[];
|
|
@@ -34,6 +54,12 @@ interface ApplyPatchOptions {
|
|
|
34
54
|
validate?: boolean | ((document: unknown) => PatchValidationResult);
|
|
35
55
|
/** With `validate`, also reject warnings. */
|
|
36
56
|
strict?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Apply the patch only to the document it was made for: the `documentHash` of the input. A different document throws
|
|
59
|
+
* `OPFPatchHashError` (`patch-hash-mismatch`) before anything is applied; a value that is not a hash throws `invalid-expect-hash`.
|
|
60
|
+
* The bare 64-digit hex form is accepted. This is optimistic concurrency for a server that holds the document.
|
|
61
|
+
*/
|
|
62
|
+
expectHash?: string;
|
|
37
63
|
}
|
|
38
64
|
interface PatchResult {
|
|
39
65
|
/** The patched presentation (a clone; the input is never changed). */
|
|
@@ -63,7 +89,25 @@ declare function splitPointer(pointer: JsonPointer): {
|
|
|
63
89
|
parent: JsonPointer;
|
|
64
90
|
token: string;
|
|
65
91
|
};
|
|
66
|
-
/**
|
|
92
|
+
/** True for a token that names an array element by id (`@intro`). */
|
|
93
|
+
declare const isIdToken: (token: string) => boolean;
|
|
94
|
+
/** The pointer token that names the array element with this id (`intro` gives `@intro`). Escape it with `escapePointerToken` or `formatPointer`. */
|
|
95
|
+
declare const idToken: (id: string) => string;
|
|
96
|
+
/**
|
|
97
|
+
* The index form of a pointer: every id token (`/slides/@intro/title`) replaced by the index of the element in `document`
|
|
98
|
+
* (`/slides/2/title`). A pointer without id tokens is returned as written; nothing else is checked, so a path that does not exist
|
|
99
|
+
* 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.
|
|
100
|
+
*/
|
|
101
|
+
declare function resolveIdPointer(document: unknown, pointer: JsonPointer): JsonPointer;
|
|
102
|
+
/**
|
|
103
|
+
* The id form of an index pointer: every array index whose element has a unique, non-empty string `id` becomes `@id`
|
|
104
|
+
* (`/slides/2/blocks/0` gives `/slides/@intro/blocks/@kpi`); indexes of elements without an id stay. Id tokens in the pointer are kept.
|
|
105
|
+
* Pass an index into an array as the last token of an insertion (`add`) with `{ keepLast: true }` to leave it as written.
|
|
106
|
+
*/
|
|
107
|
+
declare function toIdPointer(document: unknown, pointer: JsonPointer, options?: {
|
|
108
|
+
keepLast?: boolean;
|
|
109
|
+
}): JsonPointer;
|
|
110
|
+
/** 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
111
|
declare function readPointer(document: unknown, pointer: JsonPointer | readonly string[]): {
|
|
68
112
|
found: true;
|
|
69
113
|
value: unknown;
|
|
@@ -75,6 +119,32 @@ declare function getAtPointer(document: unknown, pointer: JsonPointer | readonly
|
|
|
75
119
|
declare const hasPointer: (document: unknown, pointer: JsonPointer | readonly string[]) => boolean;
|
|
76
120
|
/** Normalise and structurally validate a patch (shape only; no document needed). Values are cloned. */
|
|
77
121
|
declare function normalizePatch(patch: unknown): JsonPatchOperation[];
|
|
122
|
+
/** One applied operation, as `walkPatch` reports it. */
|
|
123
|
+
interface PatchStep {
|
|
124
|
+
/** The index of the operation within the patch. */
|
|
125
|
+
index: number;
|
|
126
|
+
/** The normalized operation as given (id tokens as written). */
|
|
127
|
+
operation: JsonPatchOperation;
|
|
128
|
+
/** The same operation with id tokens resolved to indexes in the document it applied to (an `add` at `-` carries the index it appended at). */
|
|
129
|
+
resolved: JsonPatchOperation;
|
|
130
|
+
/** The patch that undoes this operation, in application order. */
|
|
131
|
+
inverse: JsonPatchOperation[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Apply `patch` to a clone of `document` one operation at a time and tell the hooks about each: `before` sees the document an
|
|
135
|
+
* operation is about to change, `after` the document it produced. The documents are the working copy, shared between calls: read them,
|
|
136
|
+
* never keep or change them. Errors are those of `applyPatch`, with the operation's index. This is the one loop under
|
|
137
|
+
* `applyPatchWithInverse`, `resolveIdPatch`, `toIdPatch` and `touches`; most callers want one of them.
|
|
138
|
+
* @returns the patched clone.
|
|
139
|
+
*/
|
|
140
|
+
declare function walkPatch(document: unknown, patch: unknown, hooks?: {
|
|
141
|
+
before?: (index: number, operation: JsonPatchOperation, working: unknown) => void;
|
|
142
|
+
after?: (step: PatchStep, working: unknown) => void;
|
|
143
|
+
}): {
|
|
144
|
+
document: unknown;
|
|
145
|
+
operations: JsonPatchOperation[];
|
|
146
|
+
inverse: JsonPatchOperation[];
|
|
147
|
+
};
|
|
78
148
|
/**
|
|
79
149
|
* Apply a patch to a clone of `document` and return the result with its
|
|
80
150
|
* inverse. Atomic: any failing operation throws and nothing is returned.
|
|
@@ -84,5 +154,20 @@ declare function applyPatchWithInverse(document: unknown, patch: unknown, option
|
|
|
84
154
|
declare function applyPatch(document: unknown, patch: unknown, options?: ApplyPatchOptions): unknown;
|
|
85
155
|
/** The patch that undoes `patch` when applied to the result of `applyPatch(document, patch)`. */
|
|
86
156
|
declare function invertPatch(document: unknown, patch: unknown): JsonPatchOperation[];
|
|
157
|
+
/**
|
|
158
|
+
* The patch with every id token resolved to the index it has when the operation runs: `/slides/@intro/title` becomes `/slides/2/title`,
|
|
159
|
+
* operation by operation, so an earlier operation that moves a slide is accounted for. A path in the destination of `move` resolves
|
|
160
|
+
* after the value has left. Throws what `applyPatch` throws (`patch-id-not-found`, ...). Use it to hand an id-addressed patch to a tool
|
|
161
|
+
* that reads indexes.
|
|
162
|
+
*/
|
|
163
|
+
declare function resolveIdPatch(document: unknown, patch: unknown): JsonPatchOperation[];
|
|
164
|
+
/**
|
|
165
|
+
* The patch with every index that names an element with an `id` written as the id token (`/slides/2/title` becomes
|
|
166
|
+
* `/slides/@intro/title`), operation by operation against the document each operation applies to. Where an operation inserts
|
|
167
|
+
* (`add`, `copy` and `move` destinations), the last token stays an index (or `-`): there is no element yet to name. The id form survives
|
|
168
|
+
* reordering, so a host that syncs by id sends it; `applyPatch` accepts it. Elements without an id keep their indexes.
|
|
169
|
+
*/
|
|
170
|
+
declare function toIdPatch(document: unknown, patch: unknown): JsonPatchOperation[];
|
|
87
171
|
|
|
88
|
-
export {
|
|
172
|
+
export { JsonPatchOperation, 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 };
|
|
173
|
+
export type { ApplyPatchOptions, JsonPointer, PatchErrorCode, PatchResult, PatchStep, PatchValidationResult };
|
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-WPKCWQ6W.js';
|
|
2
|
+
import './chunk-JBARNYFR.js';
|
|
3
|
+
import './chunk-5Q4IYLMW.js';
|
|
4
|
+
import './chunk-2CUCYENF.js';
|
|
5
|
+
import './chunk-GM7WFPGG.js';
|