@openpresentation/opf 0.26.4 → 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 +2 -0
- package/dist/browser.js +13 -12
- package/dist/{chunk-XFOOKVRI.js → chunk-CIWC7DRZ.js} +1977 -373
- package/dist/{chunk-O6BY3AU2.js → chunk-DXTPLVAK.js} +1 -1
- package/dist/{chunk-QH2W6HIM.js → chunk-EFMR32A5.js} +1 -1
- package/dist/{chunk-6NBTZYYD.js → chunk-HPEZCAYC.js} +1 -1
- package/dist/{chunk-ZSZDVIDV.js → chunk-K5Q3LLYK.js} +2 -2
- package/dist/chunk-KPALXWX3.js +712 -0
- package/dist/{chunk-6IXSHIAL.js → chunk-L7YEVQHP.js} +6 -6
- package/dist/chunk-MD3CJ5YJ.js +452 -0
- package/dist/{chunk-MN7DRK57.js → chunk-MLH5LIGF.js} +11 -21
- package/dist/{chunk-EDCRBTJF.js → chunk-STIYINEL.js} +3 -3
- package/dist/{chunk-H5QC3X3K.js → chunk-TAV5S2JG.js} +1 -1
- package/dist/{chunk-NZLW6FBQ.js → chunk-UFEWQDQI.js} +1 -1
- package/dist/{chunk-GWJBZ4LC.js → chunk-UY6SQVR2.js} +5 -5
- package/dist/{chunk-PIO73BQ6.js → chunk-WAZDP2WS.js} +11 -20
- package/dist/{conversion-DSafOGzh.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 +8 -8
- 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 +17 -16
- package/dist/markdown.js +6 -6
- package/dist/node-engine.d.ts +2 -2
- package/dist/node-engine.js +17 -16
- package/dist/pagination.js +2 -2
- package/dist/patch.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/source.d.ts +83 -2
- package/dist/source.js +10 -9
- package/dist/validator.js +1 -1
- package/dist/yaml.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-QAEBYDKY.js +0 -192
- package/dist/conversion-QIAJM6DQ.js +0 -20
|
@@ -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,22 +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-
|
|
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
12
|
import './chunk-RYZPBJLB.js';
|
|
13
|
-
|
|
14
|
-
import './chunk-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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';
|
|
20
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';
|
|
21
22
|
export { OPFFormatError, format } from './chunk-EQ6S5SEZ.js';
|
|
22
23
|
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-F4HFDP6I.js';
|
|
@@ -32,7 +33,7 @@ var stats2 = (presentation2, options) => stats(presentation2, withDefaultCatalog
|
|
|
32
33
|
var paginate2 = (input, options) => paginate(input, withDefaultCatalog(options));
|
|
33
34
|
var embed2 = (document, options) => embed(document, withDefaultCatalog(options));
|
|
34
35
|
var edit2 = (deck, patch, options) => edit(deck, patch, withDefaultCatalog(options));
|
|
35
|
-
var engine = () => import('./conversion-
|
|
36
|
+
var engine = () => import('./conversion-PMJWLHDV.js');
|
|
36
37
|
var rethrow = (error, fallback) => {
|
|
37
38
|
if (error instanceof OPFValidationError) throw error;
|
|
38
39
|
throw asApiError(OPFApiError, error, fallback);
|
package/dist/markdown.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { fromMarkdown, toMarkdown } from './chunk-
|
|
1
|
+
export { fromMarkdown, toMarkdown } from './chunk-UY6SQVR2.js';
|
|
2
2
|
import './chunk-RYZPBJLB.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
export { OPFMarkdownError } from './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
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';
|
|
8
8
|
import './chunk-XRMV2GMB.js';
|
|
9
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,23 +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-
|
|
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
14
|
import './chunk-RYZPBJLB.js';
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
19
|
-
import './chunk-
|
|
20
|
-
import './chunk-
|
|
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';
|
|
21
22
|
import './chunk-XRMV2GMB.js';
|
|
22
23
|
import './chunk-EQ6S5SEZ.js';
|
|
23
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,6 @@
|
|
|
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';
|
|
2
4
|
|
|
3
5
|
/** Keys of `<!-- slide: ... -->`. */
|
|
4
6
|
declare const SLIDE_OPTION_KEYS: readonly ["id", "type", "layout", "section", "tag", "hidden", "beat"];
|
|
@@ -192,4 +194,83 @@ interface ScanMarkdownOptions {
|
|
|
192
194
|
*/
|
|
193
195
|
declare function scanMarkdown(source: string, options?: ScanMarkdownOptions): MarkdownScan;
|
|
194
196
|
|
|
195
|
-
|
|
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 };
|
package/dist/source.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import { splitLines } from './chunk-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
export { explain } from './chunk-MD3CJ5YJ.js';
|
|
2
|
+
import { readMarkdown, frontMatter, splitSegments, isOutline, NOTES, fenceStart, fenceClose, COMMENT } from './chunk-MLH5LIGF.js';
|
|
3
|
+
import './chunk-DXTPLVAK.js';
|
|
4
|
+
import { splitLines } from './chunk-KPALXWX3.js';
|
|
5
|
+
export { analyzeYamlSyntax } from './chunk-KPALXWX3.js';
|
|
6
|
+
import './chunk-HPEZCAYC.js';
|
|
7
|
+
import { rememberByText, SLIDE_OPTION_KEYS, FENCE_KINDS, createLocator, parsePointer } from './chunk-CIWC7DRZ.js';
|
|
8
|
+
export { BLOCK_AS_VALUES, BLOCK_OPTION_KEYS, FENCE_ATTRIBUTES, FENCE_KINDS, LINE_KEYWORDS, METRIC_KEYS, PATTERN_PHRASES, SLIDE_OPTION_KEYS, SPAN_FLAGS, SPAN_VALUES, analyzeJsonSyntax, applyTextEdits, describeFinding, distance, nearest, segmentsOf as pointerSegments, starterValue } from './chunk-CIWC7DRZ.js';
|
|
8
9
|
import './chunk-XRMV2GMB.js';
|
|
9
10
|
import './chunk-F4HFDP6I.js';
|
|
10
11
|
import { findNodeAtOffset, getNodePath, parseTree } from 'jsonc-parser';
|
|
@@ -372,7 +373,7 @@ var indexOrKey = (segment) => /^(?:0|[1-9][0-9]*)$/.test(segment) ? Number(segme
|
|
|
372
373
|
var isJson = (format) => format === "json";
|
|
373
374
|
var isMarkdown = (format) => format === "md" || format === "markdown";
|
|
374
375
|
var parseText = (text) => parseTree(text.startsWith("\uFEFF") ? ` ${text.slice(1)}` : text, [], { allowTrailingComma: true, allowEmptyContent: true, disallowComments: false });
|
|
375
|
-
function
|
|
376
|
+
function segmentsOf2(pointer) {
|
|
376
377
|
if (Array.isArray(pointer)) return pointer.map(String);
|
|
377
378
|
if (typeof pointer !== "string") return void 0;
|
|
378
379
|
try {
|
|
@@ -403,7 +404,7 @@ function partOf(value, property, part) {
|
|
|
403
404
|
}
|
|
404
405
|
}
|
|
405
406
|
function locate(text, format, pointer, options = {}) {
|
|
406
|
-
const segments =
|
|
407
|
+
const segments = segmentsOf2(pointer);
|
|
407
408
|
if (!segments) return void 0;
|
|
408
409
|
const part = options.part ?? "value";
|
|
409
410
|
const place = createLocator(text);
|
package/dist/validator.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-
|
|
1
|
+
export { DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-CIWC7DRZ.js';
|
|
2
2
|
export { promotedRegionKeys } from './chunk-XRMV2GMB.js';
|
|
3
3
|
import './chunk-F4HFDP6I.js';
|
package/dist/yaml.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { OPFYamlError, YAML_SCHEMA_URL, fromYaml, parseYamlData, scanYamlComments, toYaml } from './chunk-
|
|
1
|
+
export { OPFYamlError, YAML_SCHEMA_URL, fromYaml, parseYamlData, scanYamlComments, toYaml } from './chunk-WAZDP2WS.js';
|
|
2
2
|
import './chunk-RYZPBJLB.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
3
|
+
import './chunk-KPALXWX3.js';
|
|
4
|
+
import './chunk-HPEZCAYC.js';
|
|
5
|
+
import './chunk-CIWC7DRZ.js';
|
|
6
6
|
import './chunk-XRMV2GMB.js';
|
|
7
7
|
import './chunk-EQ6S5SEZ.js';
|
|
8
8
|
import './chunk-F4HFDP6I.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpresentation/opf",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.5",
|
|
4
4
|
"description": "Canonical Open Presentation Format schemas, TypeScript types, local validation and composition; in Node, the file API and the CLI defaults register the pptx.gallery catalog of @openpresentation/gallery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Open Presentation",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"ajv-formats": "^3.0.1",
|
|
146
146
|
"jsonc-parser": "3.3.1",
|
|
147
147
|
"yaml": "^2.9.1",
|
|
148
|
-
"@openpresentation/gallery": "^0.26.
|
|
148
|
+
"@openpresentation/gallery": "^0.26.5"
|
|
149
149
|
},
|
|
150
150
|
"devDependencies": {
|
|
151
151
|
"@expo-google-fonts/arimo": "0.4.3",
|
|
@@ -165,8 +165,8 @@
|
|
|
165
165
|
"typescript": "~5.9.3"
|
|
166
166
|
},
|
|
167
167
|
"peerDependencies": {
|
|
168
|
-
"@openpresentation/opf-pptx": "^0.26.
|
|
169
|
-
"@openpresentation/opf-render": "^0.26.
|
|
168
|
+
"@openpresentation/opf-pptx": "^0.26.5",
|
|
169
|
+
"@openpresentation/opf-render": "^0.26.5"
|
|
170
170
|
},
|
|
171
171
|
"peerDependenciesMeta": {
|
|
172
172
|
"@openpresentation/opf-pptx": {
|
|
@@ -186,5 +186,5 @@
|
|
|
186
186
|
"test:packed": "node test/packed-install-smoke.mjs",
|
|
187
187
|
"pack:dry-run": "pnpm run build:deps && pnpm run build && npm pack --dry-run --cache /tmp/opf-npm-cache"
|
|
188
188
|
},
|
|
189
|
-
"gitHead": "
|
|
189
|
+
"gitHead": "750d120e715b6c4930906aa71322d092d057c58d"
|
|
190
190
|
}
|
package/dist/chunk-QAEBYDKY.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { isRecord, same } from './chunk-6NBTZYYD.js';
|
|
2
|
-
import { parseDocument, YAMLMap, Scalar, stringify } from 'yaml';
|
|
3
|
-
|
|
4
|
-
function splitLines(source) {
|
|
5
|
-
const lines = [];
|
|
6
|
-
let start = 0;
|
|
7
|
-
let no = 1;
|
|
8
|
-
let i = 0;
|
|
9
|
-
while (i < source.length) {
|
|
10
|
-
const c = source[i];
|
|
11
|
-
if (c === "\n" || c === "\r") {
|
|
12
|
-
lines.push({ text: source.slice(start, i), start, end: i, no: no++ });
|
|
13
|
-
if (c === "\r" && source[i + 1] === "\n") i++;
|
|
14
|
-
i++;
|
|
15
|
-
start = i;
|
|
16
|
-
} else i++;
|
|
17
|
-
}
|
|
18
|
-
if (start < source.length) lines.push({ text: source.slice(start), start, end: source.length, no });
|
|
19
|
-
return lines;
|
|
20
|
-
}
|
|
21
|
-
var Ctx = class {
|
|
22
|
-
constructor(source) {
|
|
23
|
-
this.source = source;
|
|
24
|
-
for (let i = 0; i < source.length; i++) {
|
|
25
|
-
if (source[i] === "\r") {
|
|
26
|
-
if (source[i + 1] === "\n") i++;
|
|
27
|
-
this.lineStarts.push(i + 1);
|
|
28
|
-
} else if (source[i] === "\n") this.lineStarts.push(i + 1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
source;
|
|
32
|
-
findings = [];
|
|
33
|
-
/** JSON Pointer in the converted document to the source range that produced it. */
|
|
34
|
-
ranges = /* @__PURE__ */ new Map();
|
|
35
|
-
lineStarts = [0];
|
|
36
|
-
location(range) {
|
|
37
|
-
let lo = 0;
|
|
38
|
-
let hi = this.lineStarts.length;
|
|
39
|
-
while (lo + 1 < hi) {
|
|
40
|
-
const mid = lo + hi >> 1;
|
|
41
|
-
if ((this.lineStarts[mid] ?? 0) <= range.start) lo = mid;
|
|
42
|
-
else hi = mid;
|
|
43
|
-
}
|
|
44
|
-
return { offset: range.start, length: Math.max(0, range.end - range.start), line: lo + 1, column: range.start - (this.lineStarts[lo] ?? 0) + 1 };
|
|
45
|
-
}
|
|
46
|
-
report(ruleId, severity, message, help, range, path = "") {
|
|
47
|
-
this.findings.push({ ruleId, severity, category: "format", scope: "document", path, message, help, location: this.location(range) });
|
|
48
|
-
}
|
|
49
|
-
error(rule, message, help, range, path = "") {
|
|
50
|
-
this.report(`markdown/${rule}`, "error", message, help, range, path);
|
|
51
|
-
}
|
|
52
|
-
warn(rule, message, help, range, path = "") {
|
|
53
|
-
this.report(`markdown/${rule}`, "warning", message, help, range, path);
|
|
54
|
-
}
|
|
55
|
-
get errors() {
|
|
56
|
-
return this.findings.filter((d) => d.severity === "error").length;
|
|
57
|
-
}
|
|
58
|
-
/** The source range of a JSON Pointer, falling back to the nearest ancestor that has one. */
|
|
59
|
-
rangeOf(pointer) {
|
|
60
|
-
for (let path = pointer; ; path = path.slice(0, path.lastIndexOf("/"))) {
|
|
61
|
-
const found = this.ranges.get(path);
|
|
62
|
-
if (found) return found;
|
|
63
|
-
if (!path) return void 0;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var lineRange = (first, last = first) => ({ start: first.start, end: last.end });
|
|
68
|
-
function readYamlMapping(text, base, ctx, rule, context) {
|
|
69
|
-
const keys = /* @__PURE__ */ new Map();
|
|
70
|
-
const doc = parseDocument(text, { schema: "core", uniqueKeys: true, merge: false, prettyErrors: false });
|
|
71
|
-
let ok = true;
|
|
72
|
-
for (const error of doc.errors) {
|
|
73
|
-
ok = false;
|
|
74
|
-
const [start, end] = error.pos;
|
|
75
|
-
ctx.error(rule, `YAML: ${error.message.split("\n")[0]}`, "Fix the YAML syntax. Front matter and embedded blocks hold JSON-compatible YAML: mappings, sequences and scalars, no anchors or tags.", { start: base + start, end: base + Math.max(end, start) });
|
|
76
|
-
}
|
|
77
|
-
if (!ok) return { value: {}, keys, ok };
|
|
78
|
-
if (doc.contents === null) return { value: {}, keys, ok };
|
|
79
|
-
if (!(doc.contents instanceof YAMLMap)) {
|
|
80
|
-
ctx.error(`${rule}-not-mapping`, "Expected a YAML mapping of keys and values.", "Write `key: value` lines; a list or a bare value is not accepted here.", context);
|
|
81
|
-
return { value: {}, keys, ok: false };
|
|
82
|
-
}
|
|
83
|
-
for (const pair of doc.contents.items) {
|
|
84
|
-
const key = pair.key;
|
|
85
|
-
const name = key instanceof Scalar ? String(key.value) : void 0;
|
|
86
|
-
if (name !== void 0 && key?.range) keys.set(name, { start: base + key.range[0], end: base + (pair.value?.range?.[1] ?? key.range[1]) });
|
|
87
|
-
}
|
|
88
|
-
let value;
|
|
89
|
-
try {
|
|
90
|
-
value = doc.toJS({ maxAliasCount: 0 });
|
|
91
|
-
} catch (error) {
|
|
92
|
-
ctx.error(rule, `YAML: ${error.message}`, "Anchors and aliases are not accepted; write each value out.", context);
|
|
93
|
-
return { value: {}, keys, ok: false };
|
|
94
|
-
}
|
|
95
|
-
const bad = nonJson(value);
|
|
96
|
-
if (bad) {
|
|
97
|
-
ctx.error(rule, `YAML value is not JSON-compatible (${bad}).`, "Quote special numbers such as .inf or .nan to keep them as strings.", context);
|
|
98
|
-
return { value: {}, keys, ok: false };
|
|
99
|
-
}
|
|
100
|
-
return { value, keys, ok };
|
|
101
|
-
}
|
|
102
|
-
function nonJson(value) {
|
|
103
|
-
if (typeof value === "number") return Number.isFinite(value) ? void 0 : "a number that is not finite";
|
|
104
|
-
if (value === null || typeof value === "string" || typeof value === "boolean") return void 0;
|
|
105
|
-
if (Array.isArray(value)) return value.map(nonJson).find(Boolean);
|
|
106
|
-
if (isRecord(value)) return Object.values(value).map(nonJson).find(Boolean);
|
|
107
|
-
return `a ${typeof value}`;
|
|
108
|
-
}
|
|
109
|
-
function writeYaml(value) {
|
|
110
|
-
for (const blockQuote of [true, false]) {
|
|
111
|
-
const text = stringify(value, { indent: 2, lineWidth: 0, minContentWidth: 0, blockQuote, defaultStringType: "PLAIN", defaultKeyType: "PLAIN" });
|
|
112
|
-
const doc = parseDocument(text, { schema: "core", uniqueKeys: true, merge: false });
|
|
113
|
-
if (!doc.errors.length && same(doc.toJS({ maxAliasCount: 0 }), value)) return text.endsWith("\n") ? text : `${text}
|
|
114
|
-
`;
|
|
115
|
-
}
|
|
116
|
-
return void 0;
|
|
117
|
-
}
|
|
118
|
-
var DECIMAL = /^-?(?:0|[1-9]\d*)(?:\.\d+)?$/;
|
|
119
|
-
function scalarText(value) {
|
|
120
|
-
if (typeof value === "number") return DECIMAL.test(String(value)) ? String(value) : JSON.stringify(String(value));
|
|
121
|
-
const plain = value !== "" && value === value.trim() && !value.startsWith('"') && !/[\r\n]/.test(value) && !DECIMAL.test(value);
|
|
122
|
-
return plain ? value : JSON.stringify(value);
|
|
123
|
-
}
|
|
124
|
-
function readCsv(text) {
|
|
125
|
-
const rows = [];
|
|
126
|
-
let row = [];
|
|
127
|
-
let i = 0;
|
|
128
|
-
const n = text.length;
|
|
129
|
-
const endRecord = () => {
|
|
130
|
-
rows.push(row);
|
|
131
|
-
row = [];
|
|
132
|
-
};
|
|
133
|
-
while (i < n) {
|
|
134
|
-
while (text[i] === " " || text[i] === " ") i++;
|
|
135
|
-
if (text[i] === '"') {
|
|
136
|
-
let value = "";
|
|
137
|
-
i++;
|
|
138
|
-
for (; ; ) {
|
|
139
|
-
if (i >= n) return { rows, error: "A quoted field is not closed." };
|
|
140
|
-
if (text[i] === '"') {
|
|
141
|
-
if (text[i + 1] === '"') {
|
|
142
|
-
value += '"';
|
|
143
|
-
i += 2;
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
i++;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
value += text[i++];
|
|
150
|
-
}
|
|
151
|
-
while (text[i] === " " || text[i] === " ") i++;
|
|
152
|
-
if (i < n && text[i] !== "," && text[i] !== "\n" && text[i] !== "\r") return { rows, error: "Text follows a closing quote." };
|
|
153
|
-
row.push({ value, quoted: true });
|
|
154
|
-
} else {
|
|
155
|
-
let j = i;
|
|
156
|
-
while (j < n && text[j] !== "," && text[j] !== "\n" && text[j] !== "\r") j++;
|
|
157
|
-
row.push({ value: text.slice(i, j).trim(), quoted: false });
|
|
158
|
-
i = j;
|
|
159
|
-
}
|
|
160
|
-
if (text[i] === ",") {
|
|
161
|
-
i++;
|
|
162
|
-
if (i >= n || text[i] === "\n" || text[i] === "\r") row.push({ value: "", quoted: false });
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
if (text[i] === "\r" && text[i + 1] === "\n") i++;
|
|
166
|
-
i++;
|
|
167
|
-
endRecord();
|
|
168
|
-
}
|
|
169
|
-
if (row.length) endRecord();
|
|
170
|
-
return { rows };
|
|
171
|
-
}
|
|
172
|
-
var needsQuotes = (value) => /[",\r\n]/.test(value) || value !== value.trim() || value === "";
|
|
173
|
-
function csvField(cell, header = false) {
|
|
174
|
-
if (cell === null) return "";
|
|
175
|
-
if (typeof cell === "number") return String(cell);
|
|
176
|
-
if (typeof cell === "boolean") return String(cell);
|
|
177
|
-
const text = String(cell);
|
|
178
|
-
const ambiguous = !header && (DECIMAL.test(text) || /^(?:true|false)$/.test(text));
|
|
179
|
-
return needsQuotes(text) || ambiguous ? `"${text.replaceAll('"', '""')}"` : text;
|
|
180
|
-
}
|
|
181
|
-
var OPFMarkdownError = class extends Error {
|
|
182
|
-
code;
|
|
183
|
-
details;
|
|
184
|
-
constructor(code, message, details = {}) {
|
|
185
|
-
super(message);
|
|
186
|
-
this.name = "OPFMarkdownError";
|
|
187
|
-
this.code = code;
|
|
188
|
-
this.details = details;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export { Ctx, DECIMAL, OPFMarkdownError, csvField, lineRange, readCsv, readYamlMapping, scalarText, splitLines, writeYaml };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export { convertFiles, deckFileFormat, exportFormatOf, openDeck, planConversion, readInput, saveDeck, writePlanned } from './chunk-6IXSHIAL.js';
|
|
2
|
-
import './chunk-ZSZDVIDV.js';
|
|
3
|
-
import './chunk-NZLW6FBQ.js';
|
|
4
|
-
import './chunk-UJSAR6GF.js';
|
|
5
|
-
import './chunk-PJSPHHRK.js';
|
|
6
|
-
import './chunk-TKQ2VFV5.js';
|
|
7
|
-
import './chunk-QH2W6HIM.js';
|
|
8
|
-
import './chunk-EDCRBTJF.js';
|
|
9
|
-
import './chunk-GWJBZ4LC.js';
|
|
10
|
-
import './chunk-PIO73BQ6.js';
|
|
11
|
-
import './chunk-RYZPBJLB.js';
|
|
12
|
-
import './chunk-MN7DRK57.js';
|
|
13
|
-
import './chunk-O6BY3AU2.js';
|
|
14
|
-
import './chunk-QAEBYDKY.js';
|
|
15
|
-
import './chunk-6NBTZYYD.js';
|
|
16
|
-
import './chunk-H5QC3X3K.js';
|
|
17
|
-
import './chunk-XFOOKVRI.js';
|
|
18
|
-
import './chunk-XRMV2GMB.js';
|
|
19
|
-
import './chunk-EQ6S5SEZ.js';
|
|
20
|
-
import './chunk-F4HFDP6I.js';
|