@openpresentation/opf 0.16.0 → 0.18.1
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 +16 -2
- package/dist/browser.js +38 -0
- package/dist/{catalog-refs-_anZs-Qz.d.ts → catalog-refs-BSfGELpt.d.ts} +1 -1
- package/dist/{catalog-schemas-BZCjgAxu.d.ts → catalog-schemas-CinPh5WA.d.ts} +1 -1
- package/dist/catalog.d.ts +2 -2
- package/dist/catalog.js +3 -23712
- package/dist/{chunk-BSYQDWT4.js → chunk-64YSJZDH.js} +28 -15
- package/dist/{chunk-WEDGVC5W.js → chunk-6WW2EDUW.js} +108 -108
- package/dist/{chunk-5UEUAW57.js → chunk-CJPDTLGD.js} +1 -1
- package/dist/{chunk-FQSIIADJ.js → chunk-DBYZI75U.js} +30 -5
- package/dist/{chunk-PX5AWL7Y.js → chunk-JT3QXA22.js} +99 -29
- package/dist/{chunk-6OR326EA.js → chunk-JXVS7BJK.js} +1 -1
- package/dist/chunk-KXBZ6ZSB.js +991 -0
- package/dist/{chunk-5PDN7BN6.js → chunk-MBU42S5Y.js} +427 -167
- package/dist/{chunk-K4DQQIT4.js → chunk-NS3VYB57.js} +5 -5
- package/dist/chunk-QLFWWHRF.js +919 -0
- package/dist/{chunk-5TO6I3GB.js → chunk-RAKEVM52.js} +1 -1
- package/dist/{chunk-NAWQR7MN.js → chunk-VCGRMNY2.js} +1 -1
- package/dist/chunk-WCG3THTD.js +23712 -0
- package/dist/{chunk-UM24JFUE.js → chunk-YWXB4XAT.js} +2 -2
- package/dist/{chunk-3XDRQYWZ.js → chunk-YZXTXX2D.js} +1 -1
- package/dist/{chunk-SMLMI6IZ.js → chunk-ZCFSDSUX.js} +3 -3
- package/dist/{chunk-KINQFU6X.js → chunk-ZOHFLP3O.js} +19 -12
- package/dist/{composition-D4ADF5c-.d.ts → composition-C-OoqvAr.d.ts} +227 -167
- package/dist/composition.d.ts +2 -2
- package/dist/composition.js +1 -1
- package/dist/conversion-C5foedh6.d.ts +502 -0
- package/dist/conversion-KGDVJM75.js +21 -0
- package/dist/convert.d.ts +3 -3
- package/dist/convert.js +7 -7
- package/dist/data.d.ts +6 -6
- package/dist/data.js +2 -2
- package/dist/deck-report-wszX7uo8.d.ts +40 -0
- package/dist/deck.d.ts +21 -51
- package/dist/deck.js +10 -10
- package/dist/diff.js +5 -5
- package/dist/docs.js +33 -27
- package/dist/examples.d.ts +1 -1
- package/dist/examples.js +418 -451
- package/dist/format.js +2 -2
- package/dist/index.d.ts +179 -16
- package/dist/index.js +51 -796
- package/dist/markdown.d.ts +10 -6
- package/dist/markdown.js +7 -7
- package/dist/node-engine.d.ts +114 -0
- package/dist/node-engine.js +44 -0
- package/dist/{pagination-DzZPFheM.d.ts → pagination-BaUjDrTz.d.ts} +25 -8
- package/dist/pagination.d.ts +3 -3
- package/dist/pagination.js +4 -4
- package/dist/patch.js +4 -4
- package/dist/{presentation-COrFuj2g.d.ts → presentation-HondgJ3l.d.ts} +278 -454
- package/dist/repo-readme.js +1 -1
- package/dist/schemas.d.ts +4 -2
- package/dist/schemas.js +1 -1
- package/dist/spec/catalogs/manifest.json +1 -1
- package/dist/spec/schemas/opf.schema.json +74 -100
- package/dist/types.d.ts +2 -2
- package/dist/{validation-types-HxIgJfKx.d.ts → validation-types-PbGDrNUr.d.ts} +23 -7
- package/dist/validator.d.ts +6 -6
- package/dist/validator.js +3 -3
- package/dist/yaml.d.ts +4 -4
- package/dist/yaml.js +7 -7
- package/package.json +37 -2
package/dist/data.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Chart } from './presentation-
|
|
1
|
+
import { C as Chart } from './presentation-HondgJ3l.js';
|
|
2
2
|
export { C as ChartMapping, a as ChartNumberFix, b as ChartNumberFixOperation, c as ChartNumberFixOptions, D as DataCellValue, d as DataColumn, e as DataDiagnostic, f as DataDiagnosticCode, g as DataResolveOptions, h as DataSourceRef, i as DataStyledCell, j as DataTableCell, k as DataTableHeader, l as DataTableValue, m as DataTextRun, n as Dataset, o as DatasetRef, R as ResolvedChartData, p as ResolvedTableData, q as chartNumber, r as datasetDiagnostics, s as formatDataNumber, t as fromExcelNumberFormat, u as inlineChartData, v as inlineDatasets, w as inlineTableData, x as isDatasetRef, y as isXYChartType, z as numberFormatError, A as resolveChartData, B as resolveTableData, E as suggestChartNumberFix, F as tableCellDisplayValue, G as toExcelNumberFormat, H as unusedDatasets } from './chart-data-BnNqgnC-.js';
|
|
3
3
|
|
|
4
4
|
type DataCell = string | number | boolean | null;
|
|
@@ -28,7 +28,7 @@ interface DataImportOptions {
|
|
|
28
28
|
header?: boolean;
|
|
29
29
|
columns?: string[];
|
|
30
30
|
}
|
|
31
|
-
interface
|
|
31
|
+
interface IngestOptions extends DataImportOptions {
|
|
32
32
|
as: 'table' | 'chart';
|
|
33
33
|
/** Default `column`. Values outside `CHART_TYPES` make an invalid chart; the CLI checks `--chart-type` first. */
|
|
34
34
|
chartType?: ImportedChartType;
|
|
@@ -39,12 +39,12 @@ declare class OPFDataImportError extends Error {
|
|
|
39
39
|
constructor(message: string);
|
|
40
40
|
}
|
|
41
41
|
declare function parseTabularData(input: unknown, options?: DataImportOptions): TabularData;
|
|
42
|
-
declare function
|
|
42
|
+
declare function ingest(input: unknown, options: IngestOptions & {
|
|
43
43
|
as: 'table';
|
|
44
44
|
}): ImportedTable;
|
|
45
|
-
declare function
|
|
45
|
+
declare function ingest(input: unknown, options: IngestOptions & {
|
|
46
46
|
as: 'chart';
|
|
47
47
|
}): ImportedChart;
|
|
48
|
-
declare function
|
|
48
|
+
declare function ingest(input: unknown, options: IngestOptions): ImportedTable | ImportedChart;
|
|
49
49
|
|
|
50
|
-
export { type DataCell, type DataImportOptions, type
|
|
50
|
+
export { type DataCell, type DataImportOptions, type ImportedChart, type ImportedChartData, type ImportedChartType, type ImportedTable, type IngestOptions, OPFDataImportError, type TabularData, ingest, parseTabularData };
|
package/dist/data.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { OPFDataImportError,
|
|
2
|
-
export { chartNumber, datasetDiagnostics, formatDataNumber, fromExcelNumberFormat, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isXYChartType, numberFormatError, resolveChartData, resolveTableData, suggestChartNumberFix, tableCellDisplayValue, toExcelNumberFormat, unusedDatasets } from './chunk-
|
|
1
|
+
export { OPFDataImportError, ingest, parseTabularData } from './chunk-ZCFSDSUX.js';
|
|
2
|
+
export { chartNumber, datasetDiagnostics, formatDataNumber, fromExcelNumberFormat, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isXYChartType, numberFormatError, resolveChartData, resolveTableData, suggestChartNumberFix, tableCellDisplayValue, toExcelNumberFormat, unusedDatasets } from './chunk-MBU42S5Y.js';
|
|
3
3
|
import './chunk-SPFV27O5.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { a as Catalog } from './catalog-refs-BSfGELpt.js';
|
|
2
|
+
import { P as Presentation } from './presentation-HondgJ3l.js';
|
|
3
|
+
import { V as ValidationReport, a as ValidateOptions } from './validation-types-PbGDrNUr.js';
|
|
4
|
+
|
|
5
|
+
/** The serializations of a deck: `json` (canonical), `yaml` (`.opf.yaml`) and `markdown` (`.opf.md`). */
|
|
6
|
+
type DeckFormat = "json" | "yaml" | "markdown";
|
|
7
|
+
/** Every deck format, in the order JSON, YAML, Markdown. */
|
|
8
|
+
declare const DECK_FORMATS: readonly DeckFormat[];
|
|
9
|
+
/**
|
|
10
|
+
* The format a file name stands for: `.opf.md` is Markdown, `.yaml` and `.yml` are YAML (any case), every other name is JSON.
|
|
11
|
+
* A plain `.md` file is not a deck: it is Markdown that `fromMarkdown` converts when asked, so it is never detected.
|
|
12
|
+
*/
|
|
13
|
+
declare function deckFormatOf(filename: string | undefined): DeckFormat;
|
|
14
|
+
/** Where a deck's text comes from: its format, or the file name that names it, and the catalogs its references resolve in. */
|
|
15
|
+
interface ParseOptions {
|
|
16
|
+
/** The format of the text. Wins over `filename`. */
|
|
17
|
+
format?: DeckFormat;
|
|
18
|
+
/** The file name, for the format only: `.opf.md` is Markdown, `.yaml` and `.yml` are YAML, anything else is JSON. The content is never sniffed. */
|
|
19
|
+
filename?: string;
|
|
20
|
+
/** Catalogs the host registered, for the references check. Nothing is fetched. */
|
|
21
|
+
catalogs?: readonly Catalog[];
|
|
22
|
+
}
|
|
23
|
+
/** The options of `readDeckReport`: `parse`'s, plus the check to run. */
|
|
24
|
+
interface DeckReportOptions extends ParseOptions {
|
|
25
|
+
/** `true` (the default) checks `format` and `references`; options pick other rules; `false` reports only syntax errors. */
|
|
26
|
+
validate?: boolean | ValidateOptions;
|
|
27
|
+
}
|
|
28
|
+
/** A deck read from text with the report of its check, whatever the format. */
|
|
29
|
+
interface DeckReport extends ValidationReport {
|
|
30
|
+
/** The deck; a best effort (an empty object after a syntax error) when `valid` is false. */
|
|
31
|
+
presentation: Presentation;
|
|
32
|
+
format: DeckFormat;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The reader behind `parse` that never throws for content: the deck and the `validate` report of it, every finding
|
|
36
|
+
* located in the text. Not exported from the package root; the Node file API and `parse` use it.
|
|
37
|
+
*/
|
|
38
|
+
declare function readDeckReport(text: string, options?: DeckReportOptions, caller?: string): DeckReport;
|
|
39
|
+
|
|
40
|
+
export { type DeckFormat as D, type ParseOptions as P, DECK_FORMATS as a, type DeckReport as b, type DeckReportOptions as c, deckFormatOf as d, readDeckReport as r };
|
package/dist/deck.d.ts
CHANGED
|
@@ -1,67 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import './
|
|
1
|
+
import { D as DeckFormat, P as ParseOptions } from './deck-report-wszX7uo8.js';
|
|
2
|
+
export { a as DECK_FORMATS, d as deckFormatOf } from './deck-report-wszX7uo8.js';
|
|
3
|
+
import { P as Presentation } from './presentation-HondgJ3l.js';
|
|
4
|
+
import './catalog-refs-BSfGELpt.js';
|
|
5
|
+
import './validation-types-PbGDrNUr.js';
|
|
6
|
+
import './composition-C-OoqvAr.js';
|
|
5
7
|
import './chart-data-BnNqgnC-.js';
|
|
6
8
|
import './finding-CT_f_vbD.js';
|
|
7
9
|
import './json-BFSdESOE.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* One entry point to read and write a deck in any of its three serializations (RR-60): JSON, the canonical and interchange
|
|
11
|
-
* form, and the two authoring forms of the same data, YAML (`.opf.yaml`, RR-56) and Markdown (`.opf.md`, RR-30). `
|
|
12
|
-
* turns text into a deck
|
|
13
|
-
* turns a deck into text.
|
|
13
|
+
* form, and the two authoring forms of the same data, YAML (`.opf.yaml`, RR-56) and Markdown (`.opf.md`, RR-30). `parse`
|
|
14
|
+
* turns text into a deck (a deck that fails the format and references check throws, with every finding located in the text
|
|
15
|
+
* that was read); `stringify` turns a deck into text.
|
|
14
16
|
*
|
|
15
17
|
* The format comes from the `format` option, else from the file name, and never from the content: a string that starts with
|
|
16
18
|
* `{` is JSON only because JSON is the default. No renderer, fonts, DOM, network or model calls, and no Node APIs, so it runs in
|
|
17
19
|
* a browser. The same input always gives the same output.
|
|
18
20
|
*/
|
|
19
21
|
|
|
20
|
-
/** The serializations of a deck: `json` (canonical), `yaml` (`.opf.yaml`) and `markdown` (`.opf.md`). */
|
|
21
|
-
type DeckFormat = "json" | "yaml" | "markdown";
|
|
22
|
-
/** Every deck format, in the order JSON, YAML, Markdown. */
|
|
23
|
-
declare const DECK_FORMATS: readonly DeckFormat[];
|
|
24
22
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* Read a deck from JSON, YAML or Markdown text and return it. The format comes from `format`, else from `filename`, never from the
|
|
24
|
+
* content. The deck is checked for format and references (in `catalogs`); a syntax, schema or reference error throws
|
|
25
|
+
* `OPFValidationError`, whose `report.findings` carry `location` (the UTF-16 offset and length, and the one-based line and column
|
|
26
|
+
* of the text that caused them; a JSON syntax error is `opf/json-syntax`, a YAML one `yaml/<rule>`, a Markdown one
|
|
27
|
+
* `markdown/<rule>`). Warnings do not throw: `validate` reports them. Throws a `TypeError` for text that is not a string, a
|
|
28
|
+
* format that is none of the three, or a bad option.
|
|
27
29
|
*/
|
|
28
|
-
declare function
|
|
29
|
-
interface
|
|
30
|
-
/** The format of the text. Wins over `filename`. */
|
|
31
|
-
format?: DeckFormat;
|
|
32
|
-
/** The file name, for the format only: `.opf.md` is Markdown, `.yaml` and `.yml` are YAML, anything else is JSON. The content is never sniffed. */
|
|
33
|
-
filename?: string;
|
|
34
|
-
/** Catalogs the host registered, for the references check. Nothing is fetched. */
|
|
35
|
-
catalogs?: readonly Catalog[];
|
|
36
|
-
/**
|
|
37
|
-
* Check the deck with `validate` and locate its findings in the text: `true` (the default) checks `format` and `references`;
|
|
38
|
-
* options pick other rules or categories (`{}` runs every rule; `catalogs` above is added when the options name none);
|
|
39
|
-
* `false` skips the check, so only syntax errors are reported and `schemaValid` is null.
|
|
40
|
-
*/
|
|
41
|
-
validate?: boolean | ValidateOptions;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The deck read from the text with the `validate` report of it (`valid`, `schemaValid`, `checks`, `findings`, `counts`, and
|
|
45
|
-
* `template` and `unfilledVariables` for a deck with content variables), the same whatever the format.
|
|
46
|
-
*/
|
|
47
|
-
interface ReadDeckResult extends ValidationReport {
|
|
48
|
-
/** The deck. Always a value; when `valid` is false it is a best effort (an empty object after a syntax error). */
|
|
49
|
-
presentation: Presentation;
|
|
50
|
-
/** The format the text was read as. */
|
|
51
|
-
format: DeckFormat;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Read a deck from JSON, YAML or Markdown text. Never throws for malformed content; read `valid` and `findings`. The findings
|
|
55
|
-
* of a YAML or Markdown deck carry `location` (the UTF-16 offset and length, one-based line and column of the text that caused
|
|
56
|
-
* them, a validation finding mapped to the field it names); so do those of a JSON deck. A JSON syntax error is `opf/json-syntax`,
|
|
57
|
-
* a YAML one `yaml/<rule>` and a Markdown one `markdown/<rule>`. Throws a `TypeError` for text that is not a string, a format
|
|
58
|
-
* that is none of the three, or a bad option.
|
|
59
|
-
*/
|
|
60
|
-
declare function readDeck(text: string, options?: ReadDeckOptions): ReadDeckResult;
|
|
61
|
-
interface WriteDeckOptions {
|
|
30
|
+
declare function parse(text: string, options?: ParseOptions): Presentation;
|
|
31
|
+
interface StringifyOptions {
|
|
62
32
|
/** The format to write. Wins over `filename`. */
|
|
63
33
|
format?: DeckFormat;
|
|
64
|
-
/** The file name the text is for, for the format only (see `
|
|
34
|
+
/** The file name the text is for, for the format only (see `parse`). */
|
|
65
35
|
filename?: string;
|
|
66
36
|
/** YAML: start with `# yaml-language-server: $schema=...` so editors validate and complete the file. */
|
|
67
37
|
schemaComment?: boolean;
|
|
@@ -69,9 +39,9 @@ interface WriteDeckOptions {
|
|
|
69
39
|
/**
|
|
70
40
|
* Write a deck as text: JSON as two-space JSON with a final newline, YAML in canonical form (`toYaml`) and Markdown in canonical
|
|
71
41
|
* form (`toMarkdown`, with anything the dialect has no syntax for embedded in `opf-slide` and `opf-block` fences so nothing is
|
|
72
|
-
* lost). `
|
|
42
|
+
* lost). `parse` reads each result back to the same deck. YAML and Markdown throw `OPFYamlError` or `OPFMarkdownError`
|
|
73
43
|
* (`invalid-document`) for a document that is not valid OPF; JSON writes whatever it is given.
|
|
74
44
|
*/
|
|
75
|
-
declare function
|
|
45
|
+
declare function stringify(presentation: unknown, options?: StringifyOptions): string;
|
|
76
46
|
|
|
77
|
-
export {
|
|
47
|
+
export { DeckFormat, ParseOptions, type StringifyOptions, parse, stringify };
|
package/dist/deck.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { DECK_FORMATS, deckFormatOf,
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
1
|
+
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-ZOHFLP3O.js';
|
|
2
|
+
import './chunk-DBYZI75U.js';
|
|
3
|
+
import './chunk-NS3VYB57.js';
|
|
4
|
+
import './chunk-CJPDTLGD.js';
|
|
5
|
+
import './chunk-JXVS7BJK.js';
|
|
6
|
+
import './chunk-VCGRMNY2.js';
|
|
7
|
+
import './chunk-RAKEVM52.js';
|
|
8
|
+
import './chunk-JT3QXA22.js';
|
|
9
|
+
import './chunk-MBU42S5Y.js';
|
|
10
10
|
import './chunk-TRDXRRQK.js';
|
|
11
11
|
import './chunk-SPFV27O5.js';
|
|
12
|
-
import './chunk-
|
|
12
|
+
import './chunk-6WW2EDUW.js';
|
package/dist/diff.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { categoryOf, describeValue, diff, formatDiffReport, matchArrays, merge, similarity } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { categoryOf, describeValue, diff, formatDiffReport, matchArrays, merge, similarity } from './chunk-YWXB4XAT.js';
|
|
2
|
+
import './chunk-YZXTXX2D.js';
|
|
3
|
+
import './chunk-JT3QXA22.js';
|
|
4
|
+
import './chunk-MBU42S5Y.js';
|
|
5
5
|
import './chunk-TRDXRRQK.js';
|
|
6
6
|
import './chunk-SPFV27O5.js';
|
|
7
|
-
import './chunk-
|
|
7
|
+
import './chunk-6WW2EDUW.js';
|