document-cli 5.11.23 → 5.11.25
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/dist/cli.js +8 -12
- package/dist/index.cjs +30 -33
- package/dist/index.js +31 -34
- package/dist/{odb-structure-CItnH50p.js → odb-structure-yc8OHoC0.js} +25 -24
- package/dist/{tui-CGo4rAhe.js → tui-3Ib43SWz.js} +107 -108
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as odbFormSummary, c as presentMetadataEntries, d as resolveDefaultOutputPath, f as writeOutput, g as isDocumentFormat, h as inferFormatFromExtension, i as formatOdbReportLines, l as formatDocxExtrasLines, n as describeOdbReport, o as formatMetadataLines, p as loadProvidedFonts, r as formatOdbFormLines, t as describeOdbForm, u as readInput } from "./odb-structure-
|
|
2
|
+
import { a as odbFormSummary, c as presentMetadataEntries, d as resolveDefaultOutputPath, f as writeOutput, g as isDocumentFormat, h as inferFormatFromExtension, i as formatOdbReportLines, l as formatDocxExtrasLines, n as describeOdbReport, o as formatMetadataLines, p as loadProvidedFonts, r as formatOdbFormLines, t as describeOdbForm, u as readInput } from "./odb-structure-yc8OHoC0.js";
|
|
3
3
|
import { Command, CommanderError, InvalidArgumentError } from "commander";
|
|
4
4
|
import { writeFile } from "node:fs/promises";
|
|
5
5
|
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
6
|
-
import { CsvSheetNotFoundError, CsvSheetNotSpecifiedError,
|
|
6
|
+
import { CsvSheetNotFoundError, CsvSheetNotSpecifiedError, OdbNoEmbeddedDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdmUnresolvedSectionError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, buildCsvText, buildDocumentBytes, buildSvgText, createLocalDocumentConverter, decodeOdbPackage, decodePackage, documentFromJson, documentTreeWithSchema, encodeCsvText, encodeSvgText, evaluateSelect, extractSourceFontsForFormat, hsqldbCellDisplayText, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readNativeDocumentTree, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { flattenTree } from "document-schema.js";
|
|
9
9
|
import { buildOutline, isOutlineNode, outlineLeafText } from "document-outline.js";
|
|
@@ -13,14 +13,12 @@ function combineSignals(a, b) {
|
|
|
13
13
|
const forward = (signal) => {
|
|
14
14
|
controller.abort(signal.reason);
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
else a.addEventListener("abort", () => {
|
|
16
|
+
a.addEventListener("abort", () => {
|
|
18
17
|
forward(a);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
else b.addEventListener("abort", () => {
|
|
18
|
+
});
|
|
19
|
+
b.addEventListener("abort", () => {
|
|
22
20
|
forward(b);
|
|
23
|
-
}
|
|
21
|
+
});
|
|
24
22
|
return controller.signal;
|
|
25
23
|
}
|
|
26
24
|
function createRuntimeSignal(options) {
|
|
@@ -120,9 +118,7 @@ function mapErrorToExit(error, abortReason) {
|
|
|
120
118
|
if (abortReason === "interrupt") return 130;
|
|
121
119
|
if (abortReason === "timeout") return 124;
|
|
122
120
|
if (error instanceof OdmUnresolvedSectionError || error instanceof OdbTableNotSpecifiedError || error instanceof OdbTableNotFoundError || error instanceof OdbNoEmbeddedDataSourceError || error instanceof OdbUnsupportedFormatError || error instanceof OdbReportNotSpecifiedError || error instanceof CsvSheetNotSpecifiedError || error instanceof CsvSheetNotFoundError || error instanceof SvgMultiPageNotSpecifiedError || error instanceof SvgPageNotFoundError) return 3;
|
|
123
|
-
if (error instanceof HsqldbSqlUnsupportedError || error instanceof HsqldbSqlParseError || error instanceof HsqldbSqlEvaluationError) return 1;
|
|
124
121
|
if (error instanceof UnsupportedFontSourceFormatError) return 2;
|
|
125
|
-
if (error instanceof PdfEncryptedError || error instanceof PdfParseError) return 1;
|
|
126
122
|
return 1;
|
|
127
123
|
}
|
|
128
124
|
//#endregion
|
|
@@ -1199,7 +1195,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1199
1195
|
}
|
|
1200
1196
|
//#endregion
|
|
1201
1197
|
//#region package.json
|
|
1202
|
-
var version = "5.11.
|
|
1198
|
+
var version = "5.11.25";
|
|
1203
1199
|
//#endregion
|
|
1204
1200
|
//#region src/program.ts
|
|
1205
1201
|
function createProgram() {
|
|
@@ -1227,7 +1223,7 @@ function createProgram() {
|
|
|
1227
1223
|
//#region src/cli-main.ts
|
|
1228
1224
|
async function launchTui(startPath, signal) {
|
|
1229
1225
|
try {
|
|
1230
|
-
const { runTui } = await import("./tui-
|
|
1226
|
+
const { runTui } = await import("./tui-3Ib43SWz.js");
|
|
1231
1227
|
await runTui({
|
|
1232
1228
|
startPath,
|
|
1233
1229
|
signal
|
package/dist/index.cjs
CHANGED
|
@@ -39,31 +39,32 @@ const EXTENSION_TO_FORMAT = {
|
|
|
39
39
|
epub: "epub",
|
|
40
40
|
pdf: "pdf"
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
function getFormatToExtension() {
|
|
43
|
+
return {
|
|
44
|
+
docx: "docx",
|
|
45
|
+
pptx: "pptx",
|
|
46
|
+
xlsx: "xlsx",
|
|
47
|
+
odt: "odt",
|
|
48
|
+
odp: "odp",
|
|
49
|
+
ods: "ods",
|
|
50
|
+
odg: "odg",
|
|
51
|
+
odf: "odf",
|
|
52
|
+
csv: "csv",
|
|
53
|
+
svg: "svg",
|
|
54
|
+
markdown: "md",
|
|
55
|
+
rtf: "rtf",
|
|
56
|
+
wpd: "wpd",
|
|
57
|
+
doc: "doc",
|
|
58
|
+
xls: "xls",
|
|
59
|
+
ppt: "ppt",
|
|
60
|
+
epub: "epub",
|
|
61
|
+
pdf: "pdf"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
62
64
|
function isDocumentFormat(value) {
|
|
63
|
-
return value in
|
|
65
|
+
return value in getFormatToExtension();
|
|
64
66
|
}
|
|
65
67
|
function inferFormatFromExtension(path) {
|
|
66
|
-
if (path === "-") return;
|
|
67
68
|
const lastSegment = path.split(/[/\\]/).pop() ?? path;
|
|
68
69
|
const dotIndex = lastSegment.lastIndexOf(".");
|
|
69
70
|
if (dotIndex <= 0) return;
|
|
@@ -71,7 +72,7 @@ function inferFormatFromExtension(path) {
|
|
|
71
72
|
return EXTENSION_TO_FORMAT[extension];
|
|
72
73
|
}
|
|
73
74
|
function formatToExtension(format) {
|
|
74
|
-
return
|
|
75
|
+
return getFormatToExtension()[format];
|
|
75
76
|
}
|
|
76
77
|
//#endregion
|
|
77
78
|
//#region src/runtime/abort.ts
|
|
@@ -80,14 +81,12 @@ function combineSignals(a, b) {
|
|
|
80
81
|
const forward = (signal) => {
|
|
81
82
|
controller.abort(signal.reason);
|
|
82
83
|
};
|
|
83
|
-
|
|
84
|
-
else a.addEventListener("abort", () => {
|
|
84
|
+
a.addEventListener("abort", () => {
|
|
85
85
|
forward(a);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
else b.addEventListener("abort", () => {
|
|
86
|
+
});
|
|
87
|
+
b.addEventListener("abort", () => {
|
|
89
88
|
forward(b);
|
|
90
|
-
}
|
|
89
|
+
});
|
|
91
90
|
return controller.signal;
|
|
92
91
|
}
|
|
93
92
|
function createRuntimeSignal(options) {
|
|
@@ -195,9 +194,7 @@ function mapErrorToExit(error, abortReason) {
|
|
|
195
194
|
if (abortReason === "interrupt") return 130;
|
|
196
195
|
if (abortReason === "timeout") return 124;
|
|
197
196
|
if (error instanceof documents_js.OdmUnresolvedSectionError || error instanceof documents_js.OdbTableNotSpecifiedError || error instanceof documents_js.OdbTableNotFoundError || error instanceof documents_js.OdbNoEmbeddedDataSourceError || error instanceof documents_js.OdbUnsupportedFormatError || error instanceof documents_js.OdbReportNotSpecifiedError || error instanceof documents_js.CsvSheetNotSpecifiedError || error instanceof documents_js.CsvSheetNotFoundError || error instanceof documents_js.SvgMultiPageNotSpecifiedError || error instanceof documents_js.SvgPageNotFoundError) return 3;
|
|
198
|
-
if (error instanceof documents_js.HsqldbSqlUnsupportedError || error instanceof documents_js.HsqldbSqlParseError || error instanceof documents_js.HsqldbSqlEvaluationError) return 1;
|
|
199
197
|
if (error instanceof documents_js.UnsupportedFontSourceFormatError) return 2;
|
|
200
|
-
if (error instanceof documents_js.PdfEncryptedError || error instanceof documents_js.PdfParseError) return 1;
|
|
201
198
|
return 1;
|
|
202
199
|
}
|
|
203
200
|
//#endregion
|
|
@@ -499,7 +496,7 @@ function numberingSection(numbering) {
|
|
|
499
496
|
const definition = numbering[numId];
|
|
500
497
|
if (definition === void 0) continue;
|
|
501
498
|
lines.push(`${indent$1(1)}numId ${numId}`);
|
|
502
|
-
const ilvls = Object.keys(definition.levels)
|
|
499
|
+
const ilvls = Object.keys(definition.levels);
|
|
503
500
|
for (const ilvl of ilvls) {
|
|
504
501
|
const level = definition.levels[ilvl];
|
|
505
502
|
if (level === void 0) continue;
|
|
@@ -1549,7 +1546,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1549
1546
|
}
|
|
1550
1547
|
//#endregion
|
|
1551
1548
|
//#region package.json
|
|
1552
|
-
var version = "5.11.
|
|
1549
|
+
var version = "5.11.25";
|
|
1553
1550
|
//#endregion
|
|
1554
1551
|
//#region src/program.ts
|
|
1555
1552
|
function createProgram() {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2
2
|
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
3
|
-
import { CsvSheetNotFoundError, CsvSheetNotSpecifiedError,
|
|
3
|
+
import { CsvSheetNotFoundError, CsvSheetNotSpecifiedError, OdbNoEmbeddedDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdmUnresolvedSectionError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, buildCsvText, buildDocumentBytes, buildSvgText, createLocalDocumentConverter, decodeOdbPackage, decodePackage, describeFontFace, documentFromJson, documentTreeWithSchema, encodeCsvText, encodeSvgText, evaluateSelect, extractSourceFontsForFormat, hsqldbCellDisplayText, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readNativeDocumentTree, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { Command, InvalidArgumentError } from "commander";
|
|
6
6
|
import { flattenTree } from "document-schema.js";
|
|
@@ -38,31 +38,32 @@ const EXTENSION_TO_FORMAT = {
|
|
|
38
38
|
epub: "epub",
|
|
39
39
|
pdf: "pdf"
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
function getFormatToExtension() {
|
|
42
|
+
return {
|
|
43
|
+
docx: "docx",
|
|
44
|
+
pptx: "pptx",
|
|
45
|
+
xlsx: "xlsx",
|
|
46
|
+
odt: "odt",
|
|
47
|
+
odp: "odp",
|
|
48
|
+
ods: "ods",
|
|
49
|
+
odg: "odg",
|
|
50
|
+
odf: "odf",
|
|
51
|
+
csv: "csv",
|
|
52
|
+
svg: "svg",
|
|
53
|
+
markdown: "md",
|
|
54
|
+
rtf: "rtf",
|
|
55
|
+
wpd: "wpd",
|
|
56
|
+
doc: "doc",
|
|
57
|
+
xls: "xls",
|
|
58
|
+
ppt: "ppt",
|
|
59
|
+
epub: "epub",
|
|
60
|
+
pdf: "pdf"
|
|
61
|
+
};
|
|
62
|
+
}
|
|
61
63
|
function isDocumentFormat(value) {
|
|
62
|
-
return value in
|
|
64
|
+
return value in getFormatToExtension();
|
|
63
65
|
}
|
|
64
66
|
function inferFormatFromExtension(path) {
|
|
65
|
-
if (path === "-") return;
|
|
66
67
|
const lastSegment = path.split(/[/\\]/).pop() ?? path;
|
|
67
68
|
const dotIndex = lastSegment.lastIndexOf(".");
|
|
68
69
|
if (dotIndex <= 0) return;
|
|
@@ -70,7 +71,7 @@ function inferFormatFromExtension(path) {
|
|
|
70
71
|
return EXTENSION_TO_FORMAT[extension];
|
|
71
72
|
}
|
|
72
73
|
function formatToExtension(format) {
|
|
73
|
-
return
|
|
74
|
+
return getFormatToExtension()[format];
|
|
74
75
|
}
|
|
75
76
|
//#endregion
|
|
76
77
|
//#region src/runtime/abort.ts
|
|
@@ -79,14 +80,12 @@ function combineSignals(a, b) {
|
|
|
79
80
|
const forward = (signal) => {
|
|
80
81
|
controller.abort(signal.reason);
|
|
81
82
|
};
|
|
82
|
-
|
|
83
|
-
else a.addEventListener("abort", () => {
|
|
83
|
+
a.addEventListener("abort", () => {
|
|
84
84
|
forward(a);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
else b.addEventListener("abort", () => {
|
|
85
|
+
});
|
|
86
|
+
b.addEventListener("abort", () => {
|
|
88
87
|
forward(b);
|
|
89
|
-
}
|
|
88
|
+
});
|
|
90
89
|
return controller.signal;
|
|
91
90
|
}
|
|
92
91
|
function createRuntimeSignal(options) {
|
|
@@ -194,9 +193,7 @@ function mapErrorToExit(error, abortReason) {
|
|
|
194
193
|
if (abortReason === "interrupt") return 130;
|
|
195
194
|
if (abortReason === "timeout") return 124;
|
|
196
195
|
if (error instanceof OdmUnresolvedSectionError || error instanceof OdbTableNotSpecifiedError || error instanceof OdbTableNotFoundError || error instanceof OdbNoEmbeddedDataSourceError || error instanceof OdbUnsupportedFormatError || error instanceof OdbReportNotSpecifiedError || error instanceof CsvSheetNotSpecifiedError || error instanceof CsvSheetNotFoundError || error instanceof SvgMultiPageNotSpecifiedError || error instanceof SvgPageNotFoundError) return 3;
|
|
197
|
-
if (error instanceof HsqldbSqlUnsupportedError || error instanceof HsqldbSqlParseError || error instanceof HsqldbSqlEvaluationError) return 1;
|
|
198
196
|
if (error instanceof UnsupportedFontSourceFormatError) return 2;
|
|
199
|
-
if (error instanceof PdfEncryptedError || error instanceof PdfParseError) return 1;
|
|
200
197
|
return 1;
|
|
201
198
|
}
|
|
202
199
|
//#endregion
|
|
@@ -498,7 +495,7 @@ function numberingSection(numbering) {
|
|
|
498
495
|
const definition = numbering[numId];
|
|
499
496
|
if (definition === void 0) continue;
|
|
500
497
|
lines.push(`${indent$1(1)}numId ${numId}`);
|
|
501
|
-
const ilvls = Object.keys(definition.levels)
|
|
498
|
+
const ilvls = Object.keys(definition.levels);
|
|
502
499
|
for (const ilvl of ilvls) {
|
|
503
500
|
const level = definition.levels[ilvl];
|
|
504
501
|
if (level === void 0) continue;
|
|
@@ -1548,7 +1545,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1548
1545
|
}
|
|
1549
1546
|
//#endregion
|
|
1550
1547
|
//#region package.json
|
|
1551
|
-
var version = "5.11.
|
|
1548
|
+
var version = "5.11.25";
|
|
1552
1549
|
//#endregion
|
|
1553
1550
|
//#region src/program.ts
|
|
1554
1551
|
function createProgram() {
|
|
@@ -34,31 +34,32 @@ const EXTENSION_TO_FORMAT = {
|
|
|
34
34
|
epub: "epub",
|
|
35
35
|
pdf: "pdf"
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
function getFormatToExtension() {
|
|
38
|
+
return {
|
|
39
|
+
docx: "docx",
|
|
40
|
+
pptx: "pptx",
|
|
41
|
+
xlsx: "xlsx",
|
|
42
|
+
odt: "odt",
|
|
43
|
+
odp: "odp",
|
|
44
|
+
ods: "ods",
|
|
45
|
+
odg: "odg",
|
|
46
|
+
odf: "odf",
|
|
47
|
+
csv: "csv",
|
|
48
|
+
svg: "svg",
|
|
49
|
+
markdown: "md",
|
|
50
|
+
rtf: "rtf",
|
|
51
|
+
wpd: "wpd",
|
|
52
|
+
doc: "doc",
|
|
53
|
+
xls: "xls",
|
|
54
|
+
ppt: "ppt",
|
|
55
|
+
epub: "epub",
|
|
56
|
+
pdf: "pdf"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
57
59
|
function isDocumentFormat(value) {
|
|
58
|
-
return value in
|
|
60
|
+
return value in getFormatToExtension();
|
|
59
61
|
}
|
|
60
62
|
function inferFormatFromExtension(path) {
|
|
61
|
-
if (path === "-") return;
|
|
62
63
|
const lastSegment = path.split(/[/\\]/).pop() ?? path;
|
|
63
64
|
const dotIndex = lastSegment.lastIndexOf(".");
|
|
64
65
|
if (dotIndex <= 0) return;
|
|
@@ -66,7 +67,7 @@ function inferFormatFromExtension(path) {
|
|
|
66
67
|
return EXTENSION_TO_FORMAT[extension];
|
|
67
68
|
}
|
|
68
69
|
function formatToExtension(format) {
|
|
69
|
-
return
|
|
70
|
+
return getFormatToExtension()[format];
|
|
70
71
|
}
|
|
71
72
|
//#endregion
|
|
72
73
|
//#region src/runtime/fonts.ts
|
|
@@ -167,7 +168,7 @@ function numberingSection(numbering) {
|
|
|
167
168
|
const definition = numbering[numId];
|
|
168
169
|
if (definition === void 0) continue;
|
|
169
170
|
lines.push(`${indent$1(1)}numId ${numId}`);
|
|
170
|
-
const ilvls = Object.keys(definition.levels)
|
|
171
|
+
const ilvls = Object.keys(definition.levels);
|
|
171
172
|
for (const ilvl of ilvls) {
|
|
172
173
|
const level = definition.levels[ilvl];
|
|
173
174
|
if (level === void 0) continue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as inferFormatFromExtension, i as formatOdbReportLines, l as formatDocxExtrasLines, m as formatToExtension, n as describeOdbReport, o as formatMetadataLines, p as loadProvidedFonts, r as formatOdbFormLines, s as formatMetadataValue, t as describeOdbForm, u as readInput } from "./odb-structure-
|
|
1
|
+
import { h as inferFormatFromExtension, i as formatOdbReportLines, l as formatDocxExtrasLines, m as formatToExtension, n as describeOdbReport, o as formatMetadataLines, p as loadProvidedFonts, r as formatOdbFormLines, s as formatMetadataValue, t as describeOdbForm, u as readInput } from "./odb-structure-yc8OHoC0.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { basename, dirname, extname, join } from "node:path";
|
|
4
4
|
import { bytesToBase64, cellReference, columnIndexToLetters, convertDocument, createDoc, createDocx, createMarkdownEditor, createOdg, createOdp, createOds, createOdt, createPdf, createPpt, createPptx, createXls, csvToPdf, decodeMarkdownText, decodeOdbPackage, docToPdf, docxToPdf, encodeMarkdownText, epubToPdf, hsqldbCellDisplayText, markdownToPdf, odbReportToDocx, odbReportToOdt, odbReportToPdf, odgToPdf, odpToPdf, odsToPdf, odtToPdf, openDoc, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPpt, openPptx, openXls, parseXml, pptToPdf, pptxToPdf, readDocxContent, readDocxExtras, readMarkdownContent, readOdbForms, readOdbReportContent, readOdbReports, readOdbTables, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readPdf, readPptxContent, rgbHexToColor, rtfToPdf, svgToPdf, xlsToPdf, xlsxToPdf } from "documents.js";
|
|
@@ -411,7 +411,6 @@ function anyOverlayOpen(state) {
|
|
|
411
411
|
}
|
|
412
412
|
//#endregion
|
|
413
413
|
//#region src/tui/state/reducer.ts
|
|
414
|
-
const UNDO_STACK_LIMIT = 20;
|
|
415
414
|
function createInitialState(options) {
|
|
416
415
|
return {
|
|
417
416
|
stack: [{ kind: "launcher" }],
|
|
@@ -474,8 +473,7 @@ function setOverlay(overlays, overlay, open) {
|
|
|
474
473
|
}
|
|
475
474
|
}
|
|
476
475
|
function pushSnapshot(stack, snapshot) {
|
|
477
|
-
|
|
478
|
-
return next.length > UNDO_STACK_LIMIT ? next.slice(next.length - UNDO_STACK_LIMIT) : next;
|
|
476
|
+
return [...stack, snapshot].slice(-20);
|
|
479
477
|
}
|
|
480
478
|
function documentWithPath(doc, path) {
|
|
481
479
|
switch (doc.format) {
|
|
@@ -995,13 +993,6 @@ function appReducer(state, action) {
|
|
|
995
993
|
const doc = wordprocessingDocument(state);
|
|
996
994
|
if (doc === void 0) return wrongDocument(state, "a docx, odt or markdown document");
|
|
997
995
|
return mutate(state, doc, () => {
|
|
998
|
-
if (doc.format === "markdown") {
|
|
999
|
-
doc.editor.body.appendParagraph({
|
|
1000
|
-
text: action.text,
|
|
1001
|
-
styleId: action.styleId
|
|
1002
|
-
});
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
996
|
doc.editor.body.appendParagraph({
|
|
1006
997
|
text: action.text,
|
|
1007
998
|
styleId: action.styleId,
|
|
@@ -1156,11 +1147,11 @@ function appReducer(state, action) {
|
|
|
1156
1147
|
if (doc?.format !== "docx") return wrongDocument(state, "a docx document");
|
|
1157
1148
|
const paragraph = doc.editor.paragraphs()[action.blockIndex];
|
|
1158
1149
|
if (paragraph === void 0) return withStatus(state, "warning", `There is no paragraph at index ${action.blockIndex}`);
|
|
1159
|
-
|
|
1150
|
+
let written;
|
|
1160
1151
|
const nextState = mutate(state, doc, () => {
|
|
1161
|
-
|
|
1152
|
+
written = paragraph.appendOfficeMath(action.mathml).written;
|
|
1162
1153
|
});
|
|
1163
|
-
return
|
|
1154
|
+
return written ? nextState : withStatus(nextState, "warning", "The formula produced no OMML content and was not written");
|
|
1164
1155
|
}
|
|
1165
1156
|
case "INSERT_ODT_FORMULA": {
|
|
1166
1157
|
const doc = state.openDocument;
|
|
@@ -1573,7 +1564,7 @@ function appReducer(state, action) {
|
|
|
1573
1564
|
case "UNDO": {
|
|
1574
1565
|
const doc = state.openDocument;
|
|
1575
1566
|
if (doc === void 0) return withStatus(state, "info", "There is nothing to undo");
|
|
1576
|
-
if (doc.format === "odb" || doc.format === "xlsx" || doc.format === "csv" || doc.format === "svg" || doc.format === "rtf" || doc.format === "wpd" || doc.format === "
|
|
1567
|
+
if (doc.format === "odb" || doc.format === "xlsx" || doc.format === "csv" || doc.format === "svg" || doc.format === "rtf" || doc.format === "wpd" || doc.format === "epub") return withStatus(state, "warning", `A ${doc.format} document is read-only, so it has no history to undo`);
|
|
1577
1568
|
const snapshot = state.undoStack.at(-1);
|
|
1578
1569
|
if (snapshot === void 0) return withStatus(state, "info", "There is nothing to undo");
|
|
1579
1570
|
const restored = doc.format === "markdown" ? {
|
|
@@ -1977,6 +1968,9 @@ function useNavigationInput(options) {
|
|
|
1977
1968
|
//#endregion
|
|
1978
1969
|
//#region src/tui/components/list-view.tsx
|
|
1979
1970
|
const DEFAULT_RESERVED_ROWS = 4;
|
|
1971
|
+
function selectedColor(isSelected) {
|
|
1972
|
+
return isSelected ? "cyan" : void 0;
|
|
1973
|
+
}
|
|
1980
1974
|
function ListView(props) {
|
|
1981
1975
|
const { rows } = useWindowSize();
|
|
1982
1976
|
const reserved = props.reservedRows ?? DEFAULT_RESERVED_ROWS;
|
|
@@ -2044,7 +2038,7 @@ function DiagnosticsPanel() {
|
|
|
2044
2038
|
emptyMessage: "No diagnostics have been reported.",
|
|
2045
2039
|
reservedRows: PANEL_RESERVED_ROWS,
|
|
2046
2040
|
renderItem: (diagnostic, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
2047
|
-
color: isSelected
|
|
2041
|
+
color: selectedColor(isSelected),
|
|
2048
2042
|
inverse: isSelected,
|
|
2049
2043
|
children: describe(diagnostic)
|
|
2050
2044
|
})
|
|
@@ -2058,6 +2052,9 @@ function DiagnosticsPanel() {
|
|
|
2058
2052
|
}
|
|
2059
2053
|
//#endregion
|
|
2060
2054
|
//#region src/tui/components/error-detail.tsx
|
|
2055
|
+
function detailNode(detail) {
|
|
2056
|
+
return detail === void 0 ? void 0 : /* @__PURE__ */ jsx(Text, { children: detail });
|
|
2057
|
+
}
|
|
2061
2058
|
function ErrorDetail() {
|
|
2062
2059
|
const state = useAppState();
|
|
2063
2060
|
const dispatch = useAppDispatch();
|
|
@@ -2076,7 +2073,7 @@ function ErrorDetail() {
|
|
|
2076
2073
|
color: "red",
|
|
2077
2074
|
children: errorDetail.message
|
|
2078
2075
|
}),
|
|
2079
|
-
|
|
2076
|
+
detailNode(errorDetail.detail),
|
|
2080
2077
|
/* @__PURE__ */ jsx(Text, {
|
|
2081
2078
|
dimColor: true,
|
|
2082
2079
|
children: "Esc or Enter to dismiss"
|
|
@@ -2294,11 +2291,10 @@ function requireFieldValue(values, key) {
|
|
|
2294
2291
|
}
|
|
2295
2292
|
function FieldWizard(props) {
|
|
2296
2293
|
const [stepIndex, setStepIndex] = useState(0);
|
|
2297
|
-
const [collected, setCollected] = useState({});
|
|
2298
|
-
const initialField = props.fields[0];
|
|
2299
|
-
const [draft, setDraft] = useState(initialField === void 0 ? "" : initialField.defaultValue);
|
|
2300
2294
|
const field = props.fields[stepIndex];
|
|
2301
2295
|
if (field === void 0) throw new Error(`FieldWizard stepIndex ${stepIndex} is out of range for ${props.fields.length} fields -- onComplete always fires before stepIndex can advance past the last field, so this indicates a bug in that advance.`);
|
|
2296
|
+
const [collected, setCollected] = useState({});
|
|
2297
|
+
const [draft, setDraft] = useState(field.defaultValue);
|
|
2302
2298
|
return /* @__PURE__ */ jsxs(Box, {
|
|
2303
2299
|
flexDirection: "column",
|
|
2304
2300
|
borderStyle: "round",
|
|
@@ -2367,59 +2363,61 @@ function mn(value) {
|
|
|
2367
2363
|
function mo(operator) {
|
|
2368
2364
|
return element("mo", [text(operator)]);
|
|
2369
2365
|
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2366
|
+
function getFormulaPresets() {
|
|
2367
|
+
return [
|
|
2368
|
+
{
|
|
2369
|
+
label: "Fraction: x / 2",
|
|
2370
|
+
mathml: [element("mfrac", [mi("x"), mn("2")])]
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
label: "Power: x^2",
|
|
2374
|
+
mathml: [element("msup", [mi("x"), mn("2")])]
|
|
2375
|
+
},
|
|
2376
|
+
{
|
|
2377
|
+
label: "Subscript: x_i",
|
|
2378
|
+
mathml: [element("msub", [mi("x"), mi("i")])]
|
|
2379
|
+
},
|
|
2380
|
+
{
|
|
2381
|
+
label: "Square root: sqrt(x)",
|
|
2382
|
+
mathml: [element("msqrt", [mi("x")])]
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
label: "Summation: sum(i=1..n) i",
|
|
2386
|
+
mathml: [element("munderover", [
|
|
2387
|
+
mo("∑"),
|
|
2388
|
+
element("mrow", [
|
|
2389
|
+
mi("i"),
|
|
2390
|
+
mo("="),
|
|
2391
|
+
mn("1")
|
|
2392
|
+
]),
|
|
2393
|
+
mi("n")
|
|
2394
|
+
])]
|
|
2395
|
+
},
|
|
2396
|
+
{
|
|
2397
|
+
label: "Quadratic formula",
|
|
2398
|
+
mathml: [element("mrow", [
|
|
2399
|
+
mi("x"),
|
|
2393
2400
|
mo("="),
|
|
2394
|
-
|
|
2395
|
-
]),
|
|
2396
|
-
mi("n")
|
|
2397
|
-
])]
|
|
2398
|
-
},
|
|
2399
|
-
{
|
|
2400
|
-
label: "Quadratic formula",
|
|
2401
|
-
mathml: [element("mrow", [
|
|
2402
|
-
mi("x"),
|
|
2403
|
-
mo("="),
|
|
2404
|
-
element("mfrac", [element("mrow", [
|
|
2405
|
-
mo("-"),
|
|
2406
|
-
mi("b"),
|
|
2407
|
-
mo("±"),
|
|
2408
|
-
element("msqrt", [element("mrow", [
|
|
2409
|
-
element("msup", [mi("b"), mn("2")]),
|
|
2401
|
+
element("mfrac", [element("mrow", [
|
|
2410
2402
|
mo("-"),
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2403
|
+
mi("b"),
|
|
2404
|
+
mo("±"),
|
|
2405
|
+
element("msqrt", [element("mrow", [
|
|
2406
|
+
element("msup", [mi("b"), mn("2")]),
|
|
2407
|
+
mo("-"),
|
|
2408
|
+
mn("4"),
|
|
2409
|
+
mi("a"),
|
|
2410
|
+
mi("c")
|
|
2411
|
+
])])
|
|
2412
|
+
]), element("mrow", [mn("2"), mi("a")])])
|
|
2413
|
+
])]
|
|
2414
|
+
}
|
|
2415
|
+
];
|
|
2416
|
+
}
|
|
2419
2417
|
//#endregion
|
|
2420
2418
|
//#region src/tui/screens/shared/formula-picker.tsx
|
|
2421
2419
|
const RAW_ENTRY_LABEL = "Raw MathML...";
|
|
2422
|
-
const PICKER_ROWS = [...
|
|
2420
|
+
const PICKER_ROWS = [...getFormulaPresets().map((preset) => ({
|
|
2423
2421
|
label: preset.label,
|
|
2424
2422
|
mathml: preset.mathml
|
|
2425
2423
|
})), {
|
|
@@ -2488,7 +2486,7 @@ function FormulaPicker(props) {
|
|
|
2488
2486
|
selectedIndex,
|
|
2489
2487
|
reservedRows: PICKER_ROWS.length + 2,
|
|
2490
2488
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
2491
|
-
color: isSelected
|
|
2489
|
+
color: selectedColor(isSelected),
|
|
2492
2490
|
children: [isSelected ? "> " : " ", row.label]
|
|
2493
2491
|
})
|
|
2494
2492
|
}),
|
|
@@ -2829,17 +2827,17 @@ function ParagraphFamilyBodyList(props) {
|
|
|
2829
2827
|
children: row.label
|
|
2830
2828
|
});
|
|
2831
2829
|
if (row.kind === "paragraph") return /* @__PURE__ */ jsx(Text, {
|
|
2832
|
-
color: isSelected
|
|
2830
|
+
color: selectedColor(isSelected),
|
|
2833
2831
|
inverse: isSelected,
|
|
2834
2832
|
children: ` ¶ ${truncatePreview(row.paragraph.text, PREVIEW_WIDTH)}${paragraphBadges(row.paragraph)}`
|
|
2835
2833
|
});
|
|
2836
2834
|
if (row.kind === "table") return /* @__PURE__ */ jsx(Text, {
|
|
2837
|
-
color: isSelected
|
|
2835
|
+
color: selectedColor(isSelected),
|
|
2838
2836
|
inverse: isSelected,
|
|
2839
2837
|
children: ` ▦ ${tableSummary(row.table)}`
|
|
2840
2838
|
});
|
|
2841
2839
|
return /* @__PURE__ */ jsx(Text, {
|
|
2842
|
-
color: isSelected
|
|
2840
|
+
color: selectedColor(isSelected),
|
|
2843
2841
|
inverse: isSelected,
|
|
2844
2842
|
children: ` ≡ ${listSummary(row.list, row.index)}`
|
|
2845
2843
|
});
|
|
@@ -3563,7 +3561,7 @@ function TableViewScreen() {
|
|
|
3563
3561
|
borderStyle: "single",
|
|
3564
3562
|
borderColor: isSelected ? "cyan" : isAnchor ? "yellow" : "gray",
|
|
3565
3563
|
children: /* @__PURE__ */ jsx(Text, {
|
|
3566
|
-
color: isSelected
|
|
3564
|
+
color: selectedColor(isSelected),
|
|
3567
3565
|
inverse: isSelected,
|
|
3568
3566
|
children: truncatePreview(cell.text, 14)
|
|
3569
3567
|
})
|
|
@@ -3739,7 +3737,7 @@ function DocxExtrasScreen() {
|
|
|
3739
3737
|
reservedRows: DOCX_EXTRAS_RESERVED_ROWS,
|
|
3740
3738
|
emptyMessage: query === "" ? "This document carries no comments, footnotes, headers, footers, or numbering definitions." : `No lines match "${state.searchQuery}".`,
|
|
3741
3739
|
renderItem: (line, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
3742
|
-
color: isSelected
|
|
3740
|
+
color: selectedColor(isSelected),
|
|
3743
3741
|
inverse: isSelected,
|
|
3744
3742
|
children: line
|
|
3745
3743
|
})
|
|
@@ -3869,7 +3867,7 @@ function OdbFormDetailScreen() {
|
|
|
3869
3867
|
reservedRows: FORM_DETAIL_RESERVED_ROWS,
|
|
3870
3868
|
emptyMessage: query === "" ? "This form declares no structure." : `No lines match "${state.searchQuery}".`,
|
|
3871
3869
|
renderItem: (line, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
3872
|
-
color: isSelected
|
|
3870
|
+
color: selectedColor(isSelected),
|
|
3873
3871
|
inverse: isSelected,
|
|
3874
3872
|
children: line
|
|
3875
3873
|
})
|
|
@@ -3925,7 +3923,7 @@ function OdbFormListScreen() {
|
|
|
3925
3923
|
selectedIndex,
|
|
3926
3924
|
emptyMessage: query === "" ? "This database declares no forms." : `No forms match "${state.searchQuery}".`,
|
|
3927
3925
|
renderItem: (form, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
3928
|
-
color: isSelected
|
|
3926
|
+
color: selectedColor(isSelected),
|
|
3929
3927
|
inverse: isSelected,
|
|
3930
3928
|
children: describeOdbForm(form)
|
|
3931
3929
|
})
|
|
@@ -3995,7 +3993,7 @@ function OdbReportDetailScreen() {
|
|
|
3995
3993
|
reservedRows: REPORT_DETAIL_RESERVED_ROWS,
|
|
3996
3994
|
emptyMessage: query === "" ? "This report declares no structure." : `No lines match "${state.searchQuery}".`,
|
|
3997
3995
|
renderItem: (line, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
3998
|
-
color: isSelected
|
|
3996
|
+
color: selectedColor(isSelected),
|
|
3999
3997
|
inverse: isSelected,
|
|
4000
3998
|
children: line
|
|
4001
3999
|
})
|
|
@@ -4051,7 +4049,7 @@ function OdbReportListScreen() {
|
|
|
4051
4049
|
selectedIndex,
|
|
4052
4050
|
emptyMessage: query === "" ? "This database declares no reports." : `No reports match "${state.searchQuery}".`,
|
|
4053
4051
|
renderItem: (report, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
4054
|
-
color: isSelected
|
|
4052
|
+
color: selectedColor(isSelected),
|
|
4055
4053
|
inverse: isSelected,
|
|
4056
4054
|
children: describeOdbReport(report)
|
|
4057
4055
|
})
|
|
@@ -4236,7 +4234,7 @@ function OdbTableListScreen() {
|
|
|
4236
4234
|
reservedRows: TABLE_LIST_RESERVED_ROWS,
|
|
4237
4235
|
emptyMessage: query === "" ? "This database has no tables." : `No tables match "${state.searchQuery}".`,
|
|
4238
4236
|
renderItem: (table, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
4239
|
-
color: isSelected
|
|
4237
|
+
color: selectedColor(isSelected),
|
|
4240
4238
|
inverse: isSelected,
|
|
4241
4239
|
children: [
|
|
4242
4240
|
table.tableName,
|
|
@@ -4316,7 +4314,7 @@ function OdbTableRowsScreen() {
|
|
|
4316
4314
|
reservedRows: TABLE_ROWS_RESERVED_ROWS,
|
|
4317
4315
|
emptyMessage: query === "" ? "This table has no rows." : `No rows match "${state.searchQuery}".`,
|
|
4318
4316
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
4319
|
-
color: isSelected
|
|
4317
|
+
color: selectedColor(isSelected),
|
|
4320
4318
|
inverse: isSelected,
|
|
4321
4319
|
children: rowText(row)
|
|
4322
4320
|
})
|
|
@@ -4502,7 +4500,7 @@ function OdgPageListScreen() {
|
|
|
4502
4500
|
const page = pages[pageIndex];
|
|
4503
4501
|
const shapeCount = page === void 0 ? 0 : page.shapes().length;
|
|
4504
4502
|
return /* @__PURE__ */ jsxs(Text, {
|
|
4505
|
-
color: isSelected
|
|
4503
|
+
color: selectedColor(isSelected),
|
|
4506
4504
|
children: [
|
|
4507
4505
|
isSelected ? "> " : " ",
|
|
4508
4506
|
"Page ",
|
|
@@ -4787,7 +4785,7 @@ function AddItemFlow$1(props) {
|
|
|
4787
4785
|
selectedIndex,
|
|
4788
4786
|
reservedRows: 6,
|
|
4789
4787
|
renderItem: (option, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
4790
|
-
color: isSelected
|
|
4788
|
+
color: selectedColor(isSelected),
|
|
4791
4789
|
children: [isSelected ? "> " : " ", option.label]
|
|
4792
4790
|
})
|
|
4793
4791
|
})]
|
|
@@ -4876,7 +4874,7 @@ function OdgPageDetailScreen() {
|
|
|
4876
4874
|
selectedIndex,
|
|
4877
4875
|
emptyMessage: "No items yet -- press 'a' to add one",
|
|
4878
4876
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
4879
|
-
color: isSelected
|
|
4877
|
+
color: selectedColor(isSelected),
|
|
4880
4878
|
children: [isSelected ? "> " : " ", describeItem(row.item)]
|
|
4881
4879
|
})
|
|
4882
4880
|
})]
|
|
@@ -4994,7 +4992,7 @@ function VectorDetail(props) {
|
|
|
4994
4992
|
selectedIndex,
|
|
4995
4993
|
reservedRows: 5,
|
|
4996
4994
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
4997
|
-
color: isSelected
|
|
4995
|
+
color: selectedColor(isSelected),
|
|
4998
4996
|
children: [isSelected ? "> " : " ", row.label]
|
|
4999
4997
|
})
|
|
5000
4998
|
}),
|
|
@@ -5152,7 +5150,7 @@ function ShapeDetail(props) {
|
|
|
5152
5150
|
selectedIndex,
|
|
5153
5151
|
reservedRows: 5,
|
|
5154
5152
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
5155
|
-
color: isSelected
|
|
5153
|
+
color: selectedColor(isSelected),
|
|
5156
5154
|
children: [isSelected ? "> " : " ", row.label]
|
|
5157
5155
|
})
|
|
5158
5156
|
}),
|
|
@@ -5256,7 +5254,7 @@ function SlideRowView({ row, isSelected }) {
|
|
|
5256
5254
|
return /* @__PURE__ */ jsxs(Box, {
|
|
5257
5255
|
flexDirection: "column",
|
|
5258
5256
|
children: [/* @__PURE__ */ jsxs(Text, {
|
|
5259
|
-
color: isSelected
|
|
5257
|
+
color: selectedColor(isSelected),
|
|
5260
5258
|
inverse: isSelected,
|
|
5261
5259
|
bold: true,
|
|
5262
5260
|
children: [
|
|
@@ -5355,7 +5353,7 @@ function RotationField(props) {
|
|
|
5355
5353
|
onCancel: props.onCancel
|
|
5356
5354
|
})] });
|
|
5357
5355
|
return /* @__PURE__ */ jsxs(Text, {
|
|
5358
|
-
color: props.isSelected
|
|
5356
|
+
color: selectedColor(props.isSelected),
|
|
5359
5357
|
inverse: props.isSelected,
|
|
5360
5358
|
children: ["[R] Rotation: ", formatRotationDeg(props.rotationDeg)]
|
|
5361
5359
|
});
|
|
@@ -5437,7 +5435,7 @@ function FieldRow(props) {
|
|
|
5437
5435
|
return /* @__PURE__ */ jsxs(Box, {
|
|
5438
5436
|
flexDirection: "column",
|
|
5439
5437
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
5440
|
-
color: isSelected
|
|
5438
|
+
color: selectedColor(isSelected),
|
|
5441
5439
|
bold: isSelected,
|
|
5442
5440
|
children: "Text:"
|
|
5443
5441
|
}), /* @__PURE__ */ jsx(Text, {
|
|
@@ -5447,7 +5445,7 @@ function FieldRow(props) {
|
|
|
5447
5445
|
});
|
|
5448
5446
|
}
|
|
5449
5447
|
return /* @__PURE__ */ jsxs(Text, {
|
|
5450
|
-
color: isSelected
|
|
5448
|
+
color: selectedColor(isSelected),
|
|
5451
5449
|
inverse: isSelected,
|
|
5452
5450
|
children: [
|
|
5453
5451
|
FIELD_LABELS[fieldKey],
|
|
@@ -5997,7 +5995,7 @@ function SlideDetailScreen(props) {
|
|
|
5997
5995
|
]
|
|
5998
5996
|
});
|
|
5999
5997
|
if (row.kind === "table") return /* @__PURE__ */ jsxs(Text, {
|
|
6000
|
-
color: isSelected
|
|
5998
|
+
color: selectedColor(isSelected),
|
|
6001
5999
|
inverse: isSelected,
|
|
6002
6000
|
children: [
|
|
6003
6001
|
" ",
|
|
@@ -6011,7 +6009,7 @@ function SlideDetailScreen(props) {
|
|
|
6011
6009
|
]
|
|
6012
6010
|
});
|
|
6013
6011
|
return /* @__PURE__ */ jsxs(Text, {
|
|
6014
|
-
color: isSelected
|
|
6012
|
+
color: selectedColor(isSelected),
|
|
6015
6013
|
inverse: isSelected,
|
|
6016
6014
|
children: [
|
|
6017
6015
|
row.index + 1,
|
|
@@ -6142,7 +6140,10 @@ function SlideTableDetailScreen(props) {
|
|
|
6142
6140
|
setMergeAnchor(void 0);
|
|
6143
6141
|
};
|
|
6144
6142
|
useInput((input, key) => {
|
|
6145
|
-
if (table === void 0)
|
|
6143
|
+
if (table === void 0) {
|
|
6144
|
+
if (key.escape) dispatch({ type: "POP_SCREEN" });
|
|
6145
|
+
return;
|
|
6146
|
+
}
|
|
6146
6147
|
if (key.upArrow || input === "k") {
|
|
6147
6148
|
setCursor({
|
|
6148
6149
|
row: Math.max(0, clampedRow - 1),
|
|
@@ -6562,7 +6563,7 @@ function OdsSheetListScreen() {
|
|
|
6562
6563
|
selectedIndex,
|
|
6563
6564
|
emptyMessage: "This workbook has no sheets yet -- press 'a' to add one.",
|
|
6564
6565
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
6565
|
-
color: isSelected
|
|
6566
|
+
color: selectedColor(isSelected),
|
|
6566
6567
|
inverse: isSelected,
|
|
6567
6568
|
children: row.name
|
|
6568
6569
|
})
|
|
@@ -6772,7 +6773,7 @@ function OdsPrintSettingsEditorScreen() {
|
|
|
6772
6773
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Box, {
|
|
6773
6774
|
width: LABEL_COLUMN_WIDTH,
|
|
6774
6775
|
children: /* @__PURE__ */ jsx(Text, {
|
|
6775
|
-
color: isSelected
|
|
6776
|
+
color: selectedColor(isSelected),
|
|
6776
6777
|
inverse: isSelected,
|
|
6777
6778
|
children: row.label
|
|
6778
6779
|
})
|
|
@@ -7168,7 +7169,7 @@ function OdsSpreadsheetGridScreen() {
|
|
|
7168
7169
|
reservedRows: GRID_CHROME_ROWS,
|
|
7169
7170
|
emptyMessage: "No populated cells yet -- press 't' to go back to the grid and start typing.",
|
|
7170
7171
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
7171
|
-
color: isSelected
|
|
7172
|
+
color: selectedColor(isSelected),
|
|
7172
7173
|
inverse: isSelected,
|
|
7173
7174
|
children: [
|
|
7174
7175
|
padCell(row.address, COMPACT_ADDRESS_WIDTH),
|
|
@@ -7526,7 +7527,7 @@ function XlsSheetListScreen() {
|
|
|
7526
7527
|
selectedIndex,
|
|
7527
7528
|
emptyMessage: "This workbook has no sheets yet -- press 'a' to add one.",
|
|
7528
7529
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
7529
|
-
color: isSelected
|
|
7530
|
+
color: selectedColor(isSelected),
|
|
7530
7531
|
inverse: isSelected,
|
|
7531
7532
|
children: row.name
|
|
7532
7533
|
})
|
|
@@ -7822,7 +7823,7 @@ function ListEditorScreen() {
|
|
|
7822
7823
|
renderItem: (row, isSelected) => {
|
|
7823
7824
|
const trimmed = row.item.text.trim();
|
|
7824
7825
|
return /* @__PURE__ */ jsxs(Text, {
|
|
7825
|
-
color: isSelected
|
|
7826
|
+
color: selectedColor(isSelected),
|
|
7826
7827
|
inverse: isSelected,
|
|
7827
7828
|
children: [
|
|
7828
7829
|
row.index + 1,
|
|
@@ -7917,9 +7918,7 @@ function parseFontStyle(raw) {
|
|
|
7917
7918
|
return raw.trim().toLowerCase() === "italic" ? "italic" : "normal";
|
|
7918
7919
|
}
|
|
7919
7920
|
function parseOptionalNumberField(raw) {
|
|
7920
|
-
const
|
|
7921
|
-
if (trimmed.length === 0) return;
|
|
7922
|
-
const parsed = Number.parseFloat(trimmed);
|
|
7921
|
+
const parsed = Number.parseFloat(raw);
|
|
7923
7922
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
7924
7923
|
}
|
|
7925
7924
|
function defaultTriangleLayoutSubpaths(widthPt, heightPt) {
|
|
@@ -8014,7 +8013,7 @@ function PdfPageListScreen() {
|
|
|
8014
8013
|
selectedIndex,
|
|
8015
8014
|
emptyMessage: query === "" ? "This PDF has no pages." : `No pages match "${state.searchQuery}".`,
|
|
8016
8015
|
renderItem: ({ page, pageIndex }, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
8017
|
-
color: isSelected
|
|
8016
|
+
color: selectedColor(isSelected),
|
|
8018
8017
|
inverse: isSelected,
|
|
8019
8018
|
children: [
|
|
8020
8019
|
"Page ",
|
|
@@ -8700,7 +8699,7 @@ function EditableItemDetail(props) {
|
|
|
8700
8699
|
selectedIndex,
|
|
8701
8700
|
reservedRows: 5,
|
|
8702
8701
|
renderItem: (row, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
8703
|
-
color: isSelected
|
|
8702
|
+
color: selectedColor(isSelected),
|
|
8704
8703
|
inverse: isSelected,
|
|
8705
8704
|
children: row.label
|
|
8706
8705
|
})
|
|
@@ -9093,7 +9092,7 @@ function AddItemFlow(props) {
|
|
|
9093
9092
|
selectedIndex,
|
|
9094
9093
|
reservedRows: 6,
|
|
9095
9094
|
renderItem: (option, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
9096
|
-
color: isSelected
|
|
9095
|
+
color: selectedColor(isSelected),
|
|
9097
9096
|
children: [isSelected ? "> " : " ", option.label]
|
|
9098
9097
|
})
|
|
9099
9098
|
})]
|
|
@@ -9185,7 +9184,7 @@ function PdfPageItemsScreen() {
|
|
|
9185
9184
|
selectedIndex,
|
|
9186
9185
|
emptyMessage: query === "" ? editable ? "This page has no items -- press 'a' to add one" : "This page has no items." : `No items match "${state.searchQuery}".`,
|
|
9187
9186
|
renderItem: ({ item, itemIndex }, isSelected) => /* @__PURE__ */ jsxs(Text, {
|
|
9188
|
-
color: isSelected
|
|
9187
|
+
color: selectedColor(isSelected),
|
|
9189
9188
|
inverse: isSelected,
|
|
9190
9189
|
children: [
|
|
9191
9190
|
itemIndex + 1,
|
|
@@ -9496,7 +9495,7 @@ function FilePickerScreen() {
|
|
|
9496
9495
|
selectedIndex,
|
|
9497
9496
|
emptyMessage: "This directory is empty.",
|
|
9498
9497
|
renderItem: (entry, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
9499
|
-
color: isSelected
|
|
9498
|
+
color: selectedColor(isSelected),
|
|
9500
9499
|
inverse: isSelected,
|
|
9501
9500
|
children: entry.isDirectory ? `${entry.name}/` : entry.name
|
|
9502
9501
|
})
|
|
@@ -9651,12 +9650,12 @@ function NewDocumentPickerScreen() {
|
|
|
9651
9650
|
renderItem: (entry, isSelected) => /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Box, {
|
|
9652
9651
|
width: EXTENSION_COLUMN_WIDTH,
|
|
9653
9652
|
children: /* @__PURE__ */ jsxs(Text, {
|
|
9654
|
-
color: isSelected
|
|
9653
|
+
color: selectedColor(isSelected),
|
|
9655
9654
|
inverse: isSelected,
|
|
9656
9655
|
children: [".", formatToExtension(entry.format)]
|
|
9657
9656
|
})
|
|
9658
9657
|
}), /* @__PURE__ */ jsx(Text, {
|
|
9659
|
-
color: isSelected
|
|
9658
|
+
color: selectedColor(isSelected),
|
|
9660
9659
|
inverse: isSelected,
|
|
9661
9660
|
children: entry.description
|
|
9662
9661
|
})] })
|
|
@@ -9868,7 +9867,7 @@ function MetadataScreen() {
|
|
|
9868
9867
|
items: EDITABLE_FIELDS,
|
|
9869
9868
|
selectedIndex,
|
|
9870
9869
|
renderItem: (field, isSelected) => /* @__PURE__ */ jsx(Text, {
|
|
9871
|
-
color: isSelected
|
|
9870
|
+
color: selectedColor(isSelected),
|
|
9872
9871
|
inverse: isSelected,
|
|
9873
9872
|
children: field.label
|
|
9874
9873
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-cli",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.25",
|
|
4
4
|
"description": "CLI and interactive Ink TUI for documents.js: every docx/pptx/odt/odp/ods/odg/odf/pdf/odm/odb/xlsx/csv/svg/markdown/rtf conversion, bridge, and editor as a scriptable command or a terminal app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
"packageManager": "pnpm@12.4.1+sha512.2e81e399d73fe8390dab25e06aa788ab7a5908248d2f5a370f82b481147a6a7a367bf8048f9a6fdb6460f21a66f0542dedb8b94ca2c8723596741920b1656d4c",
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"commander": "15.0.0",
|
|
95
|
-
"document-outline.js": "3.9.
|
|
95
|
+
"document-outline.js": "3.9.8",
|
|
96
96
|
"document-schema.js": "7.11.3",
|
|
97
|
-
"documents.js": "7.20.
|
|
97
|
+
"documents.js": "7.20.24",
|
|
98
98
|
"ink": "7.1.1",
|
|
99
99
|
"ink-text-input": "6.0.0",
|
|
100
100
|
"react": "19.2.8"
|