@openpresentation/opf 0.26.3 → 0.26.5
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 +3 -1
- package/dist/browser.js +14 -11
- package/dist/{chunk-NJWI6MPT.js → chunk-CIWC7DRZ.js} +1985 -366
- package/dist/{chunk-7RY7QWWJ.js → chunk-DXTPLVAK.js} +1 -1
- package/dist/{chunk-54OV2WQC.js → chunk-EFMR32A5.js} +1 -1
- package/dist/{chunk-PXOXTJTN.js → chunk-HPEZCAYC.js} +1 -1
- package/dist/{chunk-2ZQBMZTZ.js → chunk-K5Q3LLYK.js} +2 -2
- package/dist/chunk-KPALXWX3.js +712 -0
- package/dist/{chunk-34LIUOT7.js → chunk-L7YEVQHP.js} +6 -6
- package/dist/chunk-MD3CJ5YJ.js +452 -0
- package/dist/{chunk-WASENX2R.js → chunk-MLH5LIGF.js} +29 -647
- package/dist/chunk-RYZPBJLB.js +4 -0
- package/dist/{chunk-FXNUM2PN.js → chunk-STIYINEL.js} +4 -4
- package/dist/{chunk-YVNFACTC.js → chunk-TAV5S2JG.js} +1 -1
- package/dist/{chunk-GLLR3AQ5.js → chunk-UFEWQDQI.js} +1 -1
- package/dist/chunk-UY6SQVR2.js +639 -0
- package/dist/{chunk-PB5X2VSV.js → chunk-WAZDP2WS.js} +12 -20
- package/dist/{conversion-BjsKgxBZ.d.ts → conversion-C7o2EpDb.d.ts} +2 -2
- package/dist/conversion-PMJWLHDV.js +21 -0
- package/dist/convert.js +5 -5
- package/dist/deck.js +9 -7
- package/dist/diff.js +2 -2
- package/dist/docs.js +3 -3
- package/dist/explain-JSuESV-Y.d.ts +71 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +18 -15
- package/dist/markdown.js +7 -5
- package/dist/node-engine.d.ts +2 -2
- package/dist/node-engine.js +18 -15
- package/dist/pagination.js +2 -2
- package/dist/patch.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/source.d.ts +184 -5
- package/dist/source.js +391 -11
- package/dist/validator.js +1 -1
- package/dist/yaml.js +5 -4
- package/package.json +5 -5
- package/dist/chunk-DEI2M2H6.js +0 -194
- package/dist/conversion-F4UCOGR7.js +0 -18
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small helpers for writing a finding in plain words (`describeFinding`, `finding-text.ts`). Pure, browser-safe, no state.
|
|
3
|
+
* Internal module: `finding-text-rules.ts` and `finding-text.ts` share them.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** What a finding is turned into: a sentence that says what is wrong, and (almost always) what could come next. */
|
|
7
|
+
interface FindingText {
|
|
8
|
+
/** What is wrong, one or two sentences, American spelling, fields in backticks. */
|
|
9
|
+
message: string;
|
|
10
|
+
/** What could come next, without a leading "Next:" and starting in lower case. */
|
|
11
|
+
next?: string;
|
|
12
|
+
}
|
|
13
|
+
/** What the text of a finding may read besides the finding itself. Every member is optional. */
|
|
14
|
+
interface FindingTextContext {
|
|
15
|
+
/** The checked document: lets a sentence quote the value that is there and read the schema and the ids of the document. */
|
|
16
|
+
document?: unknown;
|
|
17
|
+
/** The text format the finding was found in: examples are written for it (`"slides": [ ... ]` or `slides:`). Default `"json"`. */
|
|
18
|
+
format?: "json" | "yaml" | "md";
|
|
19
|
+
/** How many records of a catalog kind (`layouts`, `themes`, ...) can be chosen, for "press Ctrl+Space for the 28 layouts". */
|
|
20
|
+
catalogCount?: (kind: string) => number;
|
|
21
|
+
/** The chord that opens the list of choices in the editor the text is shown in. Default `Ctrl+Space`. */
|
|
22
|
+
chord?: string;
|
|
23
|
+
/** Overrides for what is otherwise read from `document`. */
|
|
24
|
+
valueAt?: (segments: string[]) => unknown;
|
|
25
|
+
schemaAt?: (segments: string[]) => Record<string, any> | undefined;
|
|
26
|
+
keysOf?: (segments: string[]) => string[];
|
|
27
|
+
catalogKind?: (segments: string[]) => string | undefined;
|
|
28
|
+
starter?: (segments: string[], property: string) => unknown;
|
|
29
|
+
}
|
|
30
|
+
/** The segments of a JSON Pointer (`/slides/0/title`); `""` is the document. */
|
|
31
|
+
declare function segmentsOf(path: unknown): string[];
|
|
32
|
+
/** Edit distance between two short strings (case-insensitive; enough for "did you mean"). */
|
|
33
|
+
declare function distance(a: string, b: string): number;
|
|
34
|
+
/** The candidates ordered by closeness to `value`; `close` holds those within an edit distance of 2 (or a known alias) and `all` every candidate. */
|
|
35
|
+
declare function nearest(value: unknown, candidates: readonly unknown[], limit?: number): {
|
|
36
|
+
close: unknown[];
|
|
37
|
+
all: unknown[];
|
|
38
|
+
};
|
|
39
|
+
/** What `explain(ruleId)` returns: what a rule checks, why it matters and a before/after example. */
|
|
40
|
+
interface RuleExplanation {
|
|
41
|
+
/** The finding's `ruleId`: `opf/text-contrast`, `yaml/syntax`, `markdown/fence-unterminated`. */
|
|
42
|
+
id: string;
|
|
43
|
+
/** The short name: `text-contrast`. */
|
|
44
|
+
name: string;
|
|
45
|
+
category: string;
|
|
46
|
+
/** The default severity (host policy can change it). */
|
|
47
|
+
severity: "error" | "warning" | "info";
|
|
48
|
+
/** One sentence: what the rule finds. */
|
|
49
|
+
summary: string;
|
|
50
|
+
/** Why it matters to the person who reads or presents the deck, or to the tools that read the file. */
|
|
51
|
+
rationale: string;
|
|
52
|
+
/** What to do, in a sentence or two (the general advice behind a finding's `Next:` line). */
|
|
53
|
+
fix: string;
|
|
54
|
+
/** A small example of the problem and of the repair, as the author would write it (JSON for `opf/*`, the reader's own format for `yaml/*` and `markdown/*`). */
|
|
55
|
+
example?: {
|
|
56
|
+
problem: string;
|
|
57
|
+
fixed: string;
|
|
58
|
+
language?: "json" | "yaml" | "markdown";
|
|
59
|
+
};
|
|
60
|
+
/** Where the rule is documented. */
|
|
61
|
+
docs: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* What a rule checks, why, and what to do (`explain("opf/text-contrast")`, `explain("text-contrast")`, `explain("yaml/syntax")`). The `opf/*` rules come
|
|
66
|
+
* from the validation registry (summary, rationale, category, default severity, standard) plus a `fix` sentence and a small before/after example;
|
|
67
|
+
* `yaml/*` and `markdown/*` come from the readers' table. `undefined` for an unknown id.
|
|
68
|
+
*/
|
|
69
|
+
declare function explain(ruleId: string): RuleExplanation | undefined;
|
|
70
|
+
|
|
71
|
+
export { type FindingTextContext as F, type RuleExplanation as R, type FindingText as a, distance as d, explain as e, nearest as n, segmentsOf as s };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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-C7o2EpDb.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-C7o2EpDb.js';
|
|
4
|
+
export { R as RuleExplanation, e as explain } from './explain-JSuESV-Y.js';
|
|
4
5
|
import { validate as validate$1 } from './validator.js';
|
|
5
6
|
export { DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, validateCatalogRecord, validationRules } from './validator.js';
|
|
6
7
|
import { R as ResolveVariablesOptions, h as VariableDiagnostic } from './validation-types-3ARvTsB0.js';
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
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-K5Q3LLYK.js';
|
|
2
|
+
import { stats, embed, edit, OPFApiError, asApiError } from './chunk-UFEWQDQI.js';
|
|
3
|
+
export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, updateFromCatalog } from './chunk-UFEWQDQI.js';
|
|
4
4
|
export { specFileEntries, specFileKinds, specFilePaths } from './chunk-UJSAR6GF.js';
|
|
5
5
|
export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-PJSPHHRK.js';
|
|
6
6
|
export { OPFDataImportError, ingest, parseTabularData } from './chunk-TKQ2VFV5.js';
|
|
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-
|
|
12
|
-
import './chunk-
|
|
13
|
-
export {
|
|
14
|
-
import './chunk-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
import { paginate } from './chunk-EFMR32A5.js';
|
|
8
|
+
export { OPFPaginationError, paginateSlide } from './chunk-EFMR32A5.js';
|
|
9
|
+
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-STIYINEL.js';
|
|
10
|
+
export { fromMarkdown, toMarkdown } from './chunk-UY6SQVR2.js';
|
|
11
|
+
import './chunk-WAZDP2WS.js';
|
|
12
|
+
import './chunk-RYZPBJLB.js';
|
|
13
|
+
export { explain } from './chunk-MD3CJ5YJ.js';
|
|
14
|
+
import './chunk-MLH5LIGF.js';
|
|
15
|
+
import './chunk-DXTPLVAK.js';
|
|
16
|
+
export { OPFMarkdownError } from './chunk-KPALXWX3.js';
|
|
17
|
+
import './chunk-HPEZCAYC.js';
|
|
18
|
+
export { diff, merge } from './chunk-TAV5S2JG.js';
|
|
19
|
+
import { validate, OPFValidationError } from './chunk-CIWC7DRZ.js';
|
|
20
|
+
export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogSchemaNames, findValidationRule, resolveSlideContext, validateCatalogRecord, validationCategories, validationRules } from './chunk-CIWC7DRZ.js';
|
|
18
21
|
export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_TYPES, DEFAULT_VARIABLE_DATE_FORMAT, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, LANGUAGES, LOGO_SHAPES, OPFCatalogsOptionError, OPFUnresolvedReferenceError, OPFVariableError, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, VARIABLE_KINDS, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, chartNumber, coerceVariableValue, datasetDiagnostics, formatDataNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isTemplate, isXYChartType, listBuiltinVariables, listVariables, normalizeLanguageFamily, numberFormatError, parseReference, resolveChartData, resolveDesignRecords, resolveFontScheme, resolveReference, resolveSlideVariables, resolveTableData, resolveVariables, suggestChartNumberFix, tableCellDisplayValue, toExcelNumberFormat, unresolvedReference, unusedDatasets, variableDeclarations } from './chunk-XRMV2GMB.js';
|
|
19
22
|
export { OPFFormatError, format } from './chunk-EQ6S5SEZ.js';
|
|
20
23
|
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-F4HFDP6I.js';
|
|
@@ -30,7 +33,7 @@ var stats2 = (presentation2, options) => stats(presentation2, withDefaultCatalog
|
|
|
30
33
|
var paginate2 = (input, options) => paginate(input, withDefaultCatalog(options));
|
|
31
34
|
var embed2 = (document, options) => embed(document, withDefaultCatalog(options));
|
|
32
35
|
var edit2 = (deck, patch, options) => edit(deck, patch, withDefaultCatalog(options));
|
|
33
|
-
var engine = () => import('./conversion-
|
|
36
|
+
var engine = () => import('./conversion-PMJWLHDV.js');
|
|
34
37
|
var rethrow = (error, fallback) => {
|
|
35
38
|
if (error instanceof OPFValidationError) throw error;
|
|
36
39
|
throw asApiError(OPFApiError, error, fallback);
|
package/dist/markdown.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { fromMarkdown, toMarkdown } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
|
|
4
|
-
import './chunk-
|
|
5
|
-
|
|
1
|
+
export { fromMarkdown, toMarkdown } from './chunk-UY6SQVR2.js';
|
|
2
|
+
import './chunk-RYZPBJLB.js';
|
|
3
|
+
import './chunk-MLH5LIGF.js';
|
|
4
|
+
import './chunk-DXTPLVAK.js';
|
|
5
|
+
export { OPFMarkdownError } from './chunk-KPALXWX3.js';
|
|
6
|
+
import './chunk-HPEZCAYC.js';
|
|
7
|
+
import './chunk-CIWC7DRZ.js';
|
|
6
8
|
import './chunk-XRMV2GMB.js';
|
|
7
9
|
import './chunk-F4HFDP6I.js';
|
package/dist/node-engine.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { b as DeckReport, c as DeckReportOptions, r as readDeckReport } from './deck-report-5vwMGcQz.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-
|
|
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-
|
|
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-C7o2EpDb.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-C7o2EpDb.js';
|
|
4
4
|
import { a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
5
5
|
import { e as PresentationPaginationResult } from './pagination-D_kJe4jH.js';
|
|
6
6
|
import './presentation-Bwo8Ko6D.js';
|
package/dist/node-engine.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
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-L7YEVQHP.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-L7YEVQHP.js';
|
|
3
|
+
import { defaultCatalogs } from './chunk-K5Q3LLYK.js';
|
|
4
|
+
export { defaultCatalogs, galleryMismatch } from './chunk-K5Q3LLYK.js';
|
|
5
|
+
import { OPFApiError } from './chunk-UFEWQDQI.js';
|
|
6
|
+
export { OPFApiError, OPFExportError, OPFImportError, asApiError, parseSlideSelection } from './chunk-UFEWQDQI.js';
|
|
7
7
|
import './chunk-UJSAR6GF.js';
|
|
8
8
|
import './chunk-PJSPHHRK.js';
|
|
9
9
|
import './chunk-TKQ2VFV5.js';
|
|
10
|
-
import { paginate } from './chunk-
|
|
11
|
-
export { readDeckReport } from './chunk-
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
10
|
+
import { paginate } from './chunk-EFMR32A5.js';
|
|
11
|
+
export { readDeckReport } from './chunk-STIYINEL.js';
|
|
12
|
+
import './chunk-UY6SQVR2.js';
|
|
13
|
+
import './chunk-WAZDP2WS.js';
|
|
14
|
+
import './chunk-RYZPBJLB.js';
|
|
15
|
+
import './chunk-MD3CJ5YJ.js';
|
|
16
|
+
import './chunk-MLH5LIGF.js';
|
|
17
|
+
import './chunk-DXTPLVAK.js';
|
|
18
|
+
import './chunk-KPALXWX3.js';
|
|
19
|
+
import './chunk-HPEZCAYC.js';
|
|
20
|
+
import './chunk-TAV5S2JG.js';
|
|
21
|
+
import './chunk-CIWC7DRZ.js';
|
|
19
22
|
import './chunk-XRMV2GMB.js';
|
|
20
23
|
import './chunk-EQ6S5SEZ.js';
|
|
21
24
|
import './chunk-F4HFDP6I.js';
|
package/dist/pagination.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { OPFPaginationError, paginate, paginateSlide } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { OPFPaginationError, paginate, paginateSlide } from './chunk-EFMR32A5.js';
|
|
2
|
+
import './chunk-CIWC7DRZ.js';
|
|
3
3
|
import './chunk-XRMV2GMB.js';
|
|
4
4
|
import './chunk-F4HFDP6I.js';
|
package/dist/patch.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { OPFPatchError, OPFPatchValidationError, applyPatch, applyPatchWithInverse, escapePointerToken, formatPointer, getAtPointer, hasPointer, invertPatch, jsonEqual, normalizePatch, parsePointer, pointerFromPath, readPointer, splitPointer, unescapePointerToken } from './chunk-
|
|
1
|
+
export { OPFPatchError, OPFPatchValidationError, applyPatch, applyPatchWithInverse, escapePointerToken, formatPointer, getAtPointer, hasPointer, invertPatch, jsonEqual, normalizePatch, parsePointer, pointerFromPath, readPointer, splitPointer, unescapePointerToken } from './chunk-CIWC7DRZ.js';
|
|
2
2
|
import './chunk-XRMV2GMB.js';
|
|
3
3
|
import './chunk-F4HFDP6I.js';
|
package/dist/schema.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { COMMON_KEYS, UNRANKED_PRIORITY, activeSchema, catalogKindAt, createSchemaValue, describeField, isPromotedRegionKey, listSchemaFields, resolveSchema, schemaAtPath, schemaCatalogKinds, schemaLabel, schemaType, schemaVariants, splitOpfPath } from './chunk-
|
|
1
|
+
export { COMMON_KEYS, UNRANKED_PRIORITY, activeSchema, catalogKindAt, createSchemaValue, describeField, isPromotedRegionKey, listSchemaFields, resolveSchema, schemaAtPath, schemaCatalogKinds, schemaLabel, schemaType, schemaVariants, splitOpfPath } from './chunk-CIWC7DRZ.js';
|
|
2
2
|
import './chunk-XRMV2GMB.js';
|
|
3
3
|
import './chunk-F4HFDP6I.js';
|
package/dist/source.d.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import { b as FindingLocation } from './finding-l9dlQ2NF.js';
|
|
1
|
+
import { b as FindingLocation, a as Finding } from './finding-l9dlQ2NF.js';
|
|
2
|
+
import { F as FindingTextContext, a as FindingText } from './explain-JSuESV-Y.js';
|
|
3
|
+
export { R as RuleExplanation, d as distance, e as explain, n as nearest, s as pointerSegments } from './explain-JSuESV-Y.js';
|
|
4
|
+
|
|
5
|
+
/** Keys of `<!-- slide: ... -->`. */
|
|
6
|
+
declare const SLIDE_OPTION_KEYS: readonly ["id", "type", "layout", "section", "tag", "hidden", "beat"];
|
|
7
|
+
/** Keys of `<!-- block: ... -->`. */
|
|
8
|
+
declare const BLOCK_OPTION_KEYS: readonly ["id", "type", "as", "region"];
|
|
9
|
+
/** Values of `as=` in a block options comment. */
|
|
10
|
+
declare const BLOCK_AS_VALUES: readonly ["bullets", "video"];
|
|
11
|
+
/** The first word of a fence info string that is not code: `chart`, `metric`, `timeline` and the two YAML escape hatches. */
|
|
12
|
+
declare const FENCE_KINDS: readonly ["chart", "metric", "timeline", "opf-block", "opf-slide"];
|
|
13
|
+
/** Lines of a ```metric fence: `key: value`. */
|
|
14
|
+
declare const METRIC_KEYS: readonly ["value", "label", "description", "unit", "delta", "trend", "sentiment"];
|
|
15
|
+
/** Attributes after the info word: `chart` takes `alt`, `timeline` `name` and `description`, a code fence `title`. */
|
|
16
|
+
declare const FENCE_ATTRIBUTES: {
|
|
17
|
+
readonly chart: readonly ["alt"];
|
|
18
|
+
readonly timeline: readonly ["name", "description"];
|
|
19
|
+
readonly code: readonly ["title"];
|
|
20
|
+
};
|
|
21
|
+
/** Flags of an inline span `[text]{bold italic}` (the converter also reads `strikethrough`, `superscript` and `subscript`). */
|
|
22
|
+
declare const SPAN_FLAGS: readonly ["bold", "italic", "underline", "strike", "sup", "sub"];
|
|
23
|
+
/** Attributes of an inline span that take a value: `[text]{color=#B42318 size=24 font="Open Sans" lang=fr}`. */
|
|
24
|
+
declare const SPAN_VALUES: readonly ["color", "size", "font", "lang"];
|
|
25
|
+
/** Keywords a line of a slide can start with. */
|
|
26
|
+
declare const LINE_KEYWORDS: readonly ["Note:", "Notes:"];
|
|
27
|
+
type FenceKind = (typeof FENCE_KINDS)[number];
|
|
2
28
|
|
|
3
29
|
/**
|
|
4
30
|
* A range of source text in the `Finding.location` convention: UTF-16 offset and length, 1-based line and column (a line break is
|
|
@@ -85,13 +111,166 @@ interface PathAtResult {
|
|
|
85
111
|
* underlined in the source. Tolerant: it reads text with syntax errors, comments and trailing commas as far as it can be read.
|
|
86
112
|
* When the node does not exist, the range is that of the nearest ancestor that does, with `exact: false`.
|
|
87
113
|
*
|
|
88
|
-
*
|
|
114
|
+
* JSON, YAML and Markdown. YAML is read with the `yaml` library's tolerant parse, so a text with syntax errors is located as far as it
|
|
115
|
+
* can be read. Markdown uses the ranges the converter records for every part it reads (the ones its findings are located by): a
|
|
116
|
+
* slide, its title, a list item, a block, the `layout=` of an options comment, the keys of the front matter and of the YAML in
|
|
117
|
+
* `opf-slide` and `opf-block` fences. A slide field the Markdown writes as a line (`# Title`, `- item`) has `value` = the text after
|
|
118
|
+
* the marker, `key` = the marker and `entry` = the line.
|
|
89
119
|
*/
|
|
90
120
|
declare function locate(text: string, format: SourceFormat, pointer: string | readonly (string | number)[], options?: LocateOptions): TextRange | undefined;
|
|
91
121
|
/**
|
|
92
|
-
* The document path and the kind of position at a character offset (a caret between characters)
|
|
93
|
-
*
|
|
122
|
+
* The document path and the kind of position at a character offset (a caret between characters), in JSON, YAML or Markdown.
|
|
123
|
+
* Tolerant of broken text. In YAML a position on the whitespace of a blank line is `none` after the last node and `between` inside
|
|
124
|
+
* a collection; in Markdown a position outside the front matter and the slides is `none`.
|
|
94
125
|
*/
|
|
95
126
|
declare function pathAt(text: string, format: SourceFormat, offset: number): PathAtResult | undefined;
|
|
96
127
|
|
|
97
|
-
|
|
128
|
+
/** A range of the text: UTF-16 offsets, `from` inclusive and `to` exclusive, and the one-based line `from` is on. */
|
|
129
|
+
interface ScanRange {
|
|
130
|
+
from: number;
|
|
131
|
+
to: number;
|
|
132
|
+
line: number;
|
|
133
|
+
}
|
|
134
|
+
interface MarkdownFrontMatter extends ScanRange {
|
|
135
|
+
/** The YAML between the two `---` lines: from the end of the opening line to the start of the closing line. */
|
|
136
|
+
yamlFrom: number;
|
|
137
|
+
yamlTo: number;
|
|
138
|
+
/** False when the closing `---` (or `...`) line is missing: then the YAML runs to the end of the text. */
|
|
139
|
+
closed: boolean;
|
|
140
|
+
}
|
|
141
|
+
interface MarkdownSlideScan extends ScanRange {
|
|
142
|
+
/** The slide's number in the converted deck (empty segments between `---` lines are not slides). */
|
|
143
|
+
index: number;
|
|
144
|
+
}
|
|
145
|
+
interface MarkdownCommentScan extends ScanRange {
|
|
146
|
+
/** `slide` and `block` are options comments (`<!-- slide: ... -->`), `comment` any other. */
|
|
147
|
+
kind: "slide" | "block" | "comment";
|
|
148
|
+
/** The text between `<!--` and `-->` (for an unclosed comment, to the end of its last line). */
|
|
149
|
+
innerFrom: number;
|
|
150
|
+
innerTo: number;
|
|
151
|
+
closed: boolean;
|
|
152
|
+
/** The slide it is in. */
|
|
153
|
+
slide: number;
|
|
154
|
+
}
|
|
155
|
+
interface MarkdownFenceScan extends ScanRange {
|
|
156
|
+
/** The opening fence characters (```` ``` ````, `~~~~`). */
|
|
157
|
+
marker: string;
|
|
158
|
+
/** The info string after the fence characters, trimmed; `infoFrom` and `infoTo` are its offsets. */
|
|
159
|
+
info: string;
|
|
160
|
+
infoFrom: number;
|
|
161
|
+
infoTo: number;
|
|
162
|
+
/** The first word of the info string. */
|
|
163
|
+
word: string;
|
|
164
|
+
/** `chart`, `metric`, `timeline`, `opf-block`, `opf-slide`, or `code` for any other fence. */
|
|
165
|
+
kind: FenceKind | "code";
|
|
166
|
+
/** The lines between the fences: `bodyFrom` is the start of the first line, `bodyTo` the end of the last (equal when the body is empty). */
|
|
167
|
+
bodyFrom: number;
|
|
168
|
+
bodyTo: number;
|
|
169
|
+
closed: boolean;
|
|
170
|
+
slide: number;
|
|
171
|
+
}
|
|
172
|
+
interface MarkdownNotesScan extends ScanRange {
|
|
173
|
+
slide: number;
|
|
174
|
+
}
|
|
175
|
+
interface MarkdownScan {
|
|
176
|
+
frontMatter?: MarkdownFrontMatter;
|
|
177
|
+
/** The slides, in order; each runs from its first to its last non-blank line. */
|
|
178
|
+
slides: MarkdownSlideScan[];
|
|
179
|
+
/** Offsets of the `---` lines that separate slides. */
|
|
180
|
+
separators: number[];
|
|
181
|
+
comments: MarkdownCommentScan[];
|
|
182
|
+
fences: MarkdownFenceScan[];
|
|
183
|
+
/** Speaker notes: from the `Note:` or `Notes:` line to the end of the slide. */
|
|
184
|
+
notes: MarkdownNotesScan[];
|
|
185
|
+
}
|
|
186
|
+
interface ScanMarkdownOptions {
|
|
187
|
+
/** How the text is cut into slides, as for `fromMarkdown`. */
|
|
188
|
+
split?: "auto" | "rules" | "headings";
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The structure of a Markdown deck, found with the converter's line rules: front matter, slides, option comments, fences and notes, as
|
|
192
|
+
* offset ranges. Tolerant: an unclosed front matter, comment or fence is reported with `closed: false` and runs to the end of its slide.
|
|
193
|
+
* It is the one place an editor learns the dialect's regions from.
|
|
194
|
+
*/
|
|
195
|
+
declare function scanMarkdown(source: string, options?: ScanMarkdownOptions): MarkdownScan;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A finding in plain words (`describeFinding`): what is wrong, where it matters, and what could come next.
|
|
199
|
+
*
|
|
200
|
+
* `validate` returns findings written for tools (an Ajv sentence such as "must be equal to one of the allowed values", a rule's own sentence, `help`
|
|
201
|
+
* text for agents). An editor, the CLI or an agent that shows them to a person wants the sentence of artifacts/source-editor/VALIDATOR-HINTS.md:
|
|
202
|
+
*
|
|
203
|
+
* `titleAlignment` must be left, center or right, but is `middle`. (message)
|
|
204
|
+
* did you mean `center`? (next)
|
|
205
|
+
*
|
|
206
|
+
* The text is written from the structured data a finding already carries (the schema keyword and its parameters, the suggestions, the measured
|
|
207
|
+
* numbers, the path and the document), never by guessing at prose. Every `opf/*` rule has a `next` line (`finding-text-rules.ts`), as do the YAML and
|
|
208
|
+
* Markdown reader's findings (`finding-text-source.ts`); a finding from another producer keeps its sentence and the first sentence of its `help`.
|
|
209
|
+
*
|
|
210
|
+
* Pure and browser-safe. The reader of the text (a person) is addressed in American English, with fields in backticks.
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
/** What a regular expression of the schemas means in words: "a hex color like `#1F4E79` (3, 6 or 8 hex digits)". Keyed by the pattern's source. */
|
|
214
|
+
interface PatternPhrase {
|
|
215
|
+
/** The thing the value should be, after "must be": `a hex color like \`#1F4E79\``. */
|
|
216
|
+
what: string;
|
|
217
|
+
/** What to write instead, after "Next:": `write the color as #RRGGBB.` */
|
|
218
|
+
next: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Every `pattern` of the published schemas, in words. A test walks the schemas and fails when a pattern has no entry here, so a new pattern needs
|
|
222
|
+
* its phrase in the same change. The catalog reference pattern is written per catalog kind by `describeFinding` and is listed for completeness.
|
|
223
|
+
*/
|
|
224
|
+
declare const PATTERN_PHRASES: Readonly<Record<string, PatternPhrase>>;
|
|
225
|
+
/**
|
|
226
|
+
* The message and the hint for a finding, in plain words. `message` says what is wrong (fields in backticks, no JSON Pointers, no Ajv keywords),
|
|
227
|
+
* `next` what could come next (it continues the word "Next:" and starts in lower case; absent only when the finding says nothing more). The
|
|
228
|
+
* schema findings are written from their keyword and parameters, every `opf/*` rule and every YAML and Markdown reader finding from a table,
|
|
229
|
+
* and a finding from another producer keeps its own sentence and the first sentence of its `help`.
|
|
230
|
+
*
|
|
231
|
+
* `context.document` (the checked deck) makes the text quote the value that is there; without it the text still reads well. Never throws.
|
|
232
|
+
*/
|
|
233
|
+
declare function describeFinding(finding: Finding, context?: FindingTextContext): FindingText;
|
|
234
|
+
/** A starting value for a property the schema requires (`createSchemaValue` with the deck's slides and ids special-cased). */
|
|
235
|
+
declare function starterValue(document: unknown, segments: readonly string[], property: string): unknown;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* YAML syntax problems in plain words (VALIDATOR-HINTS section 9): what the `yaml` library reports as "Implicit keys need to be on a single line" or
|
|
239
|
+
* "Flow sequence in block collection must be sufficiently indented and end with a ]" becomes the sentence an author needs, at the place that matters
|
|
240
|
+
* (the quote that is never closed, not the end of the file), with the text edits that repair it. One problem per root cause: the damage a mistake
|
|
241
|
+
* does further down is dropped.
|
|
242
|
+
*
|
|
243
|
+
* Internal module for the YAML and Markdown readers (`readYamlDocument`, `readYamlMapping`); `analyzeYamlSyntax` is the public face
|
|
244
|
+
* (`@openpresentation/opf/source`) that editors use for the edits. Browser-safe.
|
|
245
|
+
*/
|
|
246
|
+
|
|
247
|
+
/** Why the problem was reported, in kebab-case. */
|
|
248
|
+
type YamlProblemCode = "tab-indent" | "unclosed-quote" | "unclosed-list" | "unclosed-map" | "incomplete-key" | "list-item-under-value" | "colon-in-value" | "misaligned" | "missing-dash" | "trailing-text" | "missing-colon" | "bad-escape" | "reserved-start" | "long-key" | "duplicate-key" | "multiple-documents" | "empty-document" | "not-a-mapping" | "other";
|
|
249
|
+
/** What `analyzeYamlSyntax` returns: a problem with its reader rule, a located range and the text edits that repair it. */
|
|
250
|
+
interface YamlSyntaxProblem {
|
|
251
|
+
/** The finding id the YAML reader reports it under: `yaml/syntax`, `yaml/duplicate-key`, `yaml/empty`, ... */
|
|
252
|
+
ruleId: string;
|
|
253
|
+
code: YamlProblemCode;
|
|
254
|
+
severity: "error";
|
|
255
|
+
range: TextRange;
|
|
256
|
+
message: string;
|
|
257
|
+
/** What to do, starting in lower case. */
|
|
258
|
+
next: string;
|
|
259
|
+
fixes: SyntaxFix[];
|
|
260
|
+
/** Other places that belong to the problem. */
|
|
261
|
+
related?: TextRange[];
|
|
262
|
+
}
|
|
263
|
+
interface AnalyzeYamlOptions {
|
|
264
|
+
/** The most problems returned (default 5). */
|
|
265
|
+
limit?: number;
|
|
266
|
+
/** `"any"` accepts a list or a plain value at the top (the YAML of a Markdown fence is checked by its own rules). Default `"mapping"`. */
|
|
267
|
+
rootKind?: "mapping" | "any";
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The syntax problems of a YAML text, one per root cause, in position order: the `yaml` library's errors in plain words (a tab for indentation, a quote
|
|
271
|
+
* or bracket never closed, a line that is not `key: value`, a repeated key), an empty text, and a top level that is not a mapping, each with the edits
|
|
272
|
+
* that repair it. Empty for text the reader accepts as YAML (the OPF schema is another check). The offsets are the ones of `text`.
|
|
273
|
+
*/
|
|
274
|
+
declare function analyzeYamlSyntax(text: string, options?: AnalyzeYamlOptions): YamlSyntaxProblem[];
|
|
275
|
+
|
|
276
|
+
export { type AnalyzeOptions, type AnalyzeYamlOptions, BLOCK_AS_VALUES, BLOCK_OPTION_KEYS, FENCE_ATTRIBUTES, FENCE_KINDS, FindingText, FindingTextContext, LINE_KEYWORDS, type LocateOptions, type LocatePart, METRIC_KEYS, type MarkdownCommentScan, type MarkdownFenceScan, type MarkdownFrontMatter, type MarkdownNotesScan, type MarkdownScan, type MarkdownSlideScan, PATTERN_PHRASES, type PathAtResult, type PatternPhrase, SLIDE_OPTION_KEYS, SPAN_FLAGS, SPAN_VALUES, type ScanMarkdownOptions, type ScanRange, type SourceFormat, type SyntaxFix, type SyntaxProblem, type SyntaxProblemCode, type TextEdit, type TextRange, type YamlProblemCode, type YamlSyntaxProblem, analyzeJsonSyntax, analyzeYamlSyntax, applyTextEdits, describeFinding, locate, pathAt, scanMarkdown, starterValue };
|