odf.js 2.4.18 → 2.4.19
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/typed/ods/read.js +2 -2
- package/dist/typed/shared/a1.cjs +5 -25
- package/dist/typed/shared/a1.js +5 -25
- package/package.json +16 -8
package/dist/typed/ods/read.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseOdfLength } from "../shared/units.js";
|
|
2
2
|
import { attrValue, childrenWithTag, findChildElement, rootElement } from "../../xml/query.js";
|
|
3
|
-
import { TableCursor, parseCellReference } from "../shared/a1.js";
|
|
3
|
+
import { TableCursor, parseCellReference as parseCellReference$1 } from "../shared/a1.js";
|
|
4
4
|
import { parseMargins, parsePageSize } from "../shared/geometry.js";
|
|
5
5
|
import { findStyleElement, resolveStyleElementChain } from "../shared/cascade.js";
|
|
6
6
|
import { readOdfMetadata } from "../shared/metadata.js";
|
|
@@ -149,7 +149,7 @@ function parsePrintRanges(value) {
|
|
|
149
149
|
function parseA1WithOptionalSheetPrefix(cellPart) {
|
|
150
150
|
const dotIndex = cellPart.lastIndexOf(".");
|
|
151
151
|
const bareReference = dotIndex === -1 ? cellPart : cellPart.slice(dotIndex + 1);
|
|
152
|
-
return parseCellReference(bareReference);
|
|
152
|
+
return parseCellReference$1(bareReference);
|
|
153
153
|
}
|
|
154
154
|
function parseScalePercentage(value) {
|
|
155
155
|
const match = /^(\d+(?:\.\d+)?)%$/.exec(value);
|
package/dist/typed/shared/a1.cjs
CHANGED
|
@@ -1,40 +1,20 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let document_schema_js = require("document-schema.js");
|
|
2
3
|
//#region src/typed/shared/a1.ts
|
|
3
|
-
const ALPHABET_SIZE = 26;
|
|
4
|
-
const ALPHABET_START_CODE = "A".charCodeAt(0);
|
|
5
4
|
function columnIndexToLetters(index) {
|
|
6
5
|
if (!Number.isInteger(index) || index < 0) throw new Error(`columnIndexToLetters: index must be a non-negative integer, got ${index}`);
|
|
7
|
-
|
|
8
|
-
let letters = "";
|
|
9
|
-
while (remaining > 0) {
|
|
10
|
-
const digit = (remaining - 1) % ALPHABET_SIZE;
|
|
11
|
-
letters = String.fromCharCode(ALPHABET_START_CODE + digit) + letters;
|
|
12
|
-
remaining = Math.floor((remaining - 1) / ALPHABET_SIZE);
|
|
13
|
-
}
|
|
14
|
-
return letters;
|
|
6
|
+
return (0, document_schema_js.columnIndexToLetters)(index);
|
|
15
7
|
}
|
|
16
8
|
function cellReference(columnIndex, rowIndex) {
|
|
17
9
|
if (!Number.isInteger(rowIndex) || rowIndex < 0) throw new Error(`cellReference: rowIndex must be a non-negative integer, got ${rowIndex}`);
|
|
18
|
-
return
|
|
10
|
+
return (0, document_schema_js.cellReference)(rowIndex, columnIndex);
|
|
19
11
|
}
|
|
20
12
|
function columnLettersToIndex(letters) {
|
|
21
13
|
if (!/^[A-Z]+$/.test(letters)) return;
|
|
22
|
-
|
|
23
|
-
for (const char of letters) index = index * ALPHABET_SIZE + (char.charCodeAt(0) - ALPHABET_START_CODE + 1);
|
|
24
|
-
return index - 1;
|
|
14
|
+
return (0, document_schema_js.columnLettersToIndex)(letters);
|
|
25
15
|
}
|
|
26
16
|
function parseCellReference(reference) {
|
|
27
|
-
|
|
28
|
-
if (match === null) return;
|
|
29
|
-
const [, letters, digits] = match;
|
|
30
|
-
if (letters === void 0 || digits === void 0) return;
|
|
31
|
-
const column = columnLettersToIndex(letters);
|
|
32
|
-
const row = Number.parseInt(digits, 10) - 1;
|
|
33
|
-
if (column === void 0 || row < 0) return;
|
|
34
|
-
return {
|
|
35
|
-
column,
|
|
36
|
-
row
|
|
37
|
-
};
|
|
17
|
+
return (0, document_schema_js.parseCellReference)(reference);
|
|
38
18
|
}
|
|
39
19
|
function validateRepeatCount(repeatCount, caller) {
|
|
40
20
|
if (!Number.isInteger(repeatCount) || repeatCount < 1) throw new Error(`${caller}: repeatCount must be a positive integer, got ${repeatCount}`);
|
package/dist/typed/shared/a1.js
CHANGED
|
@@ -1,39 +1,19 @@
|
|
|
1
|
+
import { cellReference as cellReference$1, columnIndexToLetters as columnIndexToLetters$1, columnLettersToIndex as columnLettersToIndex$1, parseCellReference as parseCellReference$1 } from "document-schema.js";
|
|
1
2
|
//#region src/typed/shared/a1.ts
|
|
2
|
-
const ALPHABET_SIZE = 26;
|
|
3
|
-
const ALPHABET_START_CODE = "A".charCodeAt(0);
|
|
4
3
|
function columnIndexToLetters(index) {
|
|
5
4
|
if (!Number.isInteger(index) || index < 0) throw new Error(`columnIndexToLetters: index must be a non-negative integer, got ${index}`);
|
|
6
|
-
|
|
7
|
-
let letters = "";
|
|
8
|
-
while (remaining > 0) {
|
|
9
|
-
const digit = (remaining - 1) % ALPHABET_SIZE;
|
|
10
|
-
letters = String.fromCharCode(ALPHABET_START_CODE + digit) + letters;
|
|
11
|
-
remaining = Math.floor((remaining - 1) / ALPHABET_SIZE);
|
|
12
|
-
}
|
|
13
|
-
return letters;
|
|
5
|
+
return columnIndexToLetters$1(index);
|
|
14
6
|
}
|
|
15
7
|
function cellReference(columnIndex, rowIndex) {
|
|
16
8
|
if (!Number.isInteger(rowIndex) || rowIndex < 0) throw new Error(`cellReference: rowIndex must be a non-negative integer, got ${rowIndex}`);
|
|
17
|
-
return
|
|
9
|
+
return cellReference$1(rowIndex, columnIndex);
|
|
18
10
|
}
|
|
19
11
|
function columnLettersToIndex(letters) {
|
|
20
12
|
if (!/^[A-Z]+$/.test(letters)) return;
|
|
21
|
-
|
|
22
|
-
for (const char of letters) index = index * ALPHABET_SIZE + (char.charCodeAt(0) - ALPHABET_START_CODE + 1);
|
|
23
|
-
return index - 1;
|
|
13
|
+
return columnLettersToIndex$1(letters);
|
|
24
14
|
}
|
|
25
15
|
function parseCellReference(reference) {
|
|
26
|
-
|
|
27
|
-
if (match === null) return;
|
|
28
|
-
const [, letters, digits] = match;
|
|
29
|
-
if (letters === void 0 || digits === void 0) return;
|
|
30
|
-
const column = columnLettersToIndex(letters);
|
|
31
|
-
const row = Number.parseInt(digits, 10) - 1;
|
|
32
|
-
if (column === void 0 || row < 0) return;
|
|
33
|
-
return {
|
|
34
|
-
column,
|
|
35
|
-
row
|
|
36
|
-
};
|
|
16
|
+
return parseCellReference$1(reference);
|
|
37
17
|
}
|
|
38
18
|
function validateRepeatCount(repeatCount, caller) {
|
|
39
19
|
if (!Number.isInteger(repeatCount) || repeatCount < 1) throw new Error(`${caller}: repeatCount must be a positive integer, got ${repeatCount}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odf.js",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.19",
|
|
4
4
|
"description": "Type-safe, lossless round-trip conversion between OpenDocument Format packages (odt, ods, odp) and JSON, hand-written and dependency-minimal, built on Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -45,15 +45,22 @@
|
|
|
45
45
|
"node": ">=20"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
|
-
"build": "
|
|
48
|
+
"build": "turbo run _build",
|
|
49
|
+
"_build": "tsdown",
|
|
49
50
|
"prepublishOnly": "pnpm run lint && pnpm run typecheck && tsdown && publint && attw --pack",
|
|
50
|
-
"lint": "
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
51
|
+
"lint": "turbo run _lint",
|
|
52
|
+
"_lint": "eslint . --fix --cache --max-warnings 0",
|
|
53
|
+
"typecheck": "turbo run _typecheck",
|
|
54
|
+
"_typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.node.json",
|
|
55
|
+
"test": "turbo run _test",
|
|
56
|
+
"_test": "vitest run --project unit",
|
|
57
|
+
"test:workers": "turbo run _test:workers",
|
|
58
|
+
"_test:workers": "vitest run --config vitest.workers.config.ts",
|
|
54
59
|
"test:watch": "vitest --project unit",
|
|
55
|
-
"test:coverage": "
|
|
56
|
-
"
|
|
60
|
+
"test:coverage": "turbo run _test:coverage",
|
|
61
|
+
"_test:coverage": "vitest run --project unit --coverage",
|
|
62
|
+
"test:smoke": "turbo run _test:smoke",
|
|
63
|
+
"_test:smoke": "tsdown && vitest run --project smoke",
|
|
57
64
|
"prepare": "husky",
|
|
58
65
|
"release": "semantic-release"
|
|
59
66
|
},
|
|
@@ -92,6 +99,7 @@
|
|
|
92
99
|
"publint": "^0.3.21",
|
|
93
100
|
"semantic-release": "^25.0.8",
|
|
94
101
|
"tsdown": "^0.22.13",
|
|
102
|
+
"turbo": "^2.10.8",
|
|
95
103
|
"typescript": "^6.0.3",
|
|
96
104
|
"typescript-eslint": "^8.65.0",
|
|
97
105
|
"vitest": "^4.1.10"
|