rtf-codec 4.1.5 → 4.2.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 +1 -1
- package/dist/codec.d.cts +22 -22
- package/dist/codec.d.ts +22 -22
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> A hand-written, dependency-minimal Rich Text Format codec: reads RTF into the shared [document-schema.js](../document-schema.js/README.md) content pivot, and writes deterministic, 7-bit-ASCII RTF back out. Built against Microsoft's own [RTF Specification, version 1.9.1](#the-specification) and [Zod 4](https://zod.dev), with no third-party RTF library.
|
|
6
6
|
|
|
7
|
-
**Status: under active development.** The read and write paths described below are implemented and tested,
|
|
7
|
+
**Status: under active development.** The read and write paths described below are implemented and tested, including against a real-producer corpus: `pnpm test:corpus` runs the gitignored `test/corpus/` suite against LibreOffice-produced RTF (flat-ODT sources spanning runs, colour, headings, lists, tables, and alignment, converted through Writer's own RTF filter by `scripts/generate-corpus.mjs`) -- the corpus validated the reader cleanly across all eight fixtures with no defects found. [Scope](#scope) states exactly what is handled and what is not; nothing in this README describes work that is planned rather than done.
|
|
8
8
|
|
|
9
9
|
Every construct that remains unhandled is either a gap in `document-schema.js` rather than in this codec (superscript/subscript and text direction have no field to land in), or something RTF itself does not specify at all beyond its own form-field vocabulary (a docx-style rich-text SDT has no RTF spelling of any kind) — see [Deliberately not handled](#deliberately-not-handled), which says which of the two each row is.
|
|
10
10
|
|
package/dist/codec.d.cts
CHANGED
|
@@ -11,8 +11,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
11
11
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
12
12
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
13
13
|
left: "left";
|
|
14
|
-
center: "center";
|
|
15
14
|
right: "right";
|
|
15
|
+
center: "center";
|
|
16
16
|
justify: "justify";
|
|
17
17
|
}>>;
|
|
18
18
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -160,8 +160,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
160
160
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
161
161
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
162
162
|
left: "left";
|
|
163
|
-
center: "center";
|
|
164
163
|
right: "right";
|
|
164
|
+
center: "center";
|
|
165
165
|
justify: "justify";
|
|
166
166
|
}>>;
|
|
167
167
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -309,8 +309,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
309
309
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
310
310
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
311
311
|
left: "left";
|
|
312
|
-
center: "center";
|
|
313
312
|
right: "right";
|
|
313
|
+
center: "center";
|
|
314
314
|
justify: "justify";
|
|
315
315
|
}>>;
|
|
316
316
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -458,8 +458,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
458
458
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
459
459
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
460
460
|
left: "left";
|
|
461
|
-
center: "center";
|
|
462
461
|
right: "right";
|
|
462
|
+
center: "center";
|
|
463
463
|
justify: "justify";
|
|
464
464
|
}>>;
|
|
465
465
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -639,8 +639,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
639
639
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
640
640
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
641
641
|
left: "left";
|
|
642
|
-
center: "center";
|
|
643
642
|
right: "right";
|
|
643
|
+
center: "center";
|
|
644
644
|
justify: "justify";
|
|
645
645
|
}>>;
|
|
646
646
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -1295,8 +1295,8 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
1295
1295
|
}, z.core.$strip>>;
|
|
1296
1296
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
1297
1297
|
left: "left";
|
|
1298
|
-
center: "center";
|
|
1299
1298
|
right: "right";
|
|
1299
|
+
center: "center";
|
|
1300
1300
|
justify: "justify";
|
|
1301
1301
|
}>>;
|
|
1302
1302
|
verticalAlignment: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1400,10 +1400,10 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
1400
1400
|
}>;
|
|
1401
1401
|
align: z.ZodEnum<{
|
|
1402
1402
|
left: "left";
|
|
1403
|
-
center: "center";
|
|
1404
1403
|
right: "right";
|
|
1405
1404
|
top: "top";
|
|
1406
1405
|
bottom: "bottom";
|
|
1406
|
+
center: "center";
|
|
1407
1407
|
inside: "inside";
|
|
1408
1408
|
outside: "outside";
|
|
1409
1409
|
}>;
|
|
@@ -1443,10 +1443,10 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
1443
1443
|
}>;
|
|
1444
1444
|
align: z.ZodEnum<{
|
|
1445
1445
|
left: "left";
|
|
1446
|
-
center: "center";
|
|
1447
1446
|
right: "right";
|
|
1448
1447
|
top: "top";
|
|
1449
1448
|
bottom: "bottom";
|
|
1449
|
+
center: "center";
|
|
1450
1450
|
inside: "inside";
|
|
1451
1451
|
outside: "outside";
|
|
1452
1452
|
}>;
|
|
@@ -1535,10 +1535,10 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
1535
1535
|
endColumn: z.ZodNumber;
|
|
1536
1536
|
}, z.core.$strip>>;
|
|
1537
1537
|
type: z.ZodEnum<{
|
|
1538
|
-
decimal: "decimal";
|
|
1539
|
-
list: "list";
|
|
1540
1538
|
date: "date";
|
|
1541
1539
|
custom: "custom";
|
|
1540
|
+
decimal: "decimal";
|
|
1541
|
+
list: "list";
|
|
1542
1542
|
time: "time";
|
|
1543
1543
|
whole: "whole";
|
|
1544
1544
|
textLength: "textLength";
|
|
@@ -2010,11 +2010,11 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
2010
2010
|
stops: z.ZodArray<z.ZodObject<{
|
|
2011
2011
|
value: z.ZodObject<{
|
|
2012
2012
|
type: z.ZodEnum<{
|
|
2013
|
-
num: "num";
|
|
2014
|
-
min: "min";
|
|
2015
|
-
max: "max";
|
|
2016
2013
|
formula: "formula";
|
|
2017
2014
|
percent: "percent";
|
|
2015
|
+
num: "num";
|
|
2016
|
+
max: "max";
|
|
2017
|
+
min: "min";
|
|
2018
2018
|
percentile: "percentile";
|
|
2019
2019
|
}>;
|
|
2020
2020
|
value: z.ZodOptional<z.ZodString>;
|
|
@@ -2057,22 +2057,22 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
2057
2057
|
}, z.core.$strip>, z.ZodObject<{
|
|
2058
2058
|
min: z.ZodObject<{
|
|
2059
2059
|
type: z.ZodEnum<{
|
|
2060
|
-
num: "num";
|
|
2061
|
-
min: "min";
|
|
2062
|
-
max: "max";
|
|
2063
2060
|
formula: "formula";
|
|
2064
2061
|
percent: "percent";
|
|
2062
|
+
num: "num";
|
|
2063
|
+
max: "max";
|
|
2064
|
+
min: "min";
|
|
2065
2065
|
percentile: "percentile";
|
|
2066
2066
|
}>;
|
|
2067
2067
|
value: z.ZodOptional<z.ZodString>;
|
|
2068
2068
|
}, z.core.$strip>;
|
|
2069
2069
|
max: z.ZodObject<{
|
|
2070
2070
|
type: z.ZodEnum<{
|
|
2071
|
-
num: "num";
|
|
2072
|
-
min: "min";
|
|
2073
|
-
max: "max";
|
|
2074
2071
|
formula: "formula";
|
|
2075
2072
|
percent: "percent";
|
|
2073
|
+
num: "num";
|
|
2074
|
+
max: "max";
|
|
2075
|
+
min: "min";
|
|
2076
2076
|
percentile: "percentile";
|
|
2077
2077
|
}>;
|
|
2078
2078
|
value: z.ZodOptional<z.ZodString>;
|
|
@@ -2116,11 +2116,11 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
2116
2116
|
iconSetType: z.ZodString;
|
|
2117
2117
|
thresholds: z.ZodArray<z.ZodObject<{
|
|
2118
2118
|
type: z.ZodEnum<{
|
|
2119
|
-
num: "num";
|
|
2120
|
-
min: "min";
|
|
2121
|
-
max: "max";
|
|
2122
2119
|
formula: "formula";
|
|
2123
2120
|
percent: "percent";
|
|
2121
|
+
num: "num";
|
|
2122
|
+
max: "max";
|
|
2123
|
+
min: "min";
|
|
2124
2124
|
percentile: "percentile";
|
|
2125
2125
|
}>;
|
|
2126
2126
|
value: z.ZodOptional<z.ZodString>;
|
package/dist/codec.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
11
11
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
12
12
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
13
13
|
left: "left";
|
|
14
|
-
center: "center";
|
|
15
14
|
right: "right";
|
|
15
|
+
center: "center";
|
|
16
16
|
justify: "justify";
|
|
17
17
|
}>>;
|
|
18
18
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -160,8 +160,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
160
160
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
161
161
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
162
162
|
left: "left";
|
|
163
|
-
center: "center";
|
|
164
163
|
right: "right";
|
|
164
|
+
center: "center";
|
|
165
165
|
justify: "justify";
|
|
166
166
|
}>>;
|
|
167
167
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -309,8 +309,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
309
309
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
310
310
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
311
311
|
left: "left";
|
|
312
|
-
center: "center";
|
|
313
312
|
right: "right";
|
|
313
|
+
center: "center";
|
|
314
314
|
justify: "justify";
|
|
315
315
|
}>>;
|
|
316
316
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -458,8 +458,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
458
458
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
459
459
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
460
460
|
left: "left";
|
|
461
|
-
center: "center";
|
|
462
461
|
right: "right";
|
|
462
|
+
center: "center";
|
|
463
463
|
justify: "justify";
|
|
464
464
|
}>>;
|
|
465
465
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -639,8 +639,8 @@ declare const rtfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
639
639
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
640
640
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
641
641
|
left: "left";
|
|
642
|
-
center: "center";
|
|
643
642
|
right: "right";
|
|
643
|
+
center: "center";
|
|
644
644
|
justify: "justify";
|
|
645
645
|
}>>;
|
|
646
646
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -1295,8 +1295,8 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
1295
1295
|
}, z.core.$strip>>;
|
|
1296
1296
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
1297
1297
|
left: "left";
|
|
1298
|
-
center: "center";
|
|
1299
1298
|
right: "right";
|
|
1299
|
+
center: "center";
|
|
1300
1300
|
justify: "justify";
|
|
1301
1301
|
}>>;
|
|
1302
1302
|
verticalAlignment: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1400,10 +1400,10 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
1400
1400
|
}>;
|
|
1401
1401
|
align: z.ZodEnum<{
|
|
1402
1402
|
left: "left";
|
|
1403
|
-
center: "center";
|
|
1404
1403
|
right: "right";
|
|
1405
1404
|
top: "top";
|
|
1406
1405
|
bottom: "bottom";
|
|
1406
|
+
center: "center";
|
|
1407
1407
|
inside: "inside";
|
|
1408
1408
|
outside: "outside";
|
|
1409
1409
|
}>;
|
|
@@ -1443,10 +1443,10 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
1443
1443
|
}>;
|
|
1444
1444
|
align: z.ZodEnum<{
|
|
1445
1445
|
left: "left";
|
|
1446
|
-
center: "center";
|
|
1447
1446
|
right: "right";
|
|
1448
1447
|
top: "top";
|
|
1449
1448
|
bottom: "bottom";
|
|
1449
|
+
center: "center";
|
|
1450
1450
|
inside: "inside";
|
|
1451
1451
|
outside: "outside";
|
|
1452
1452
|
}>;
|
|
@@ -1535,10 +1535,10 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
1535
1535
|
endColumn: z.ZodNumber;
|
|
1536
1536
|
}, z.core.$strip>>;
|
|
1537
1537
|
type: z.ZodEnum<{
|
|
1538
|
-
decimal: "decimal";
|
|
1539
|
-
list: "list";
|
|
1540
1538
|
date: "date";
|
|
1541
1539
|
custom: "custom";
|
|
1540
|
+
decimal: "decimal";
|
|
1541
|
+
list: "list";
|
|
1542
1542
|
time: "time";
|
|
1543
1543
|
whole: "whole";
|
|
1544
1544
|
textLength: "textLength";
|
|
@@ -2010,11 +2010,11 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
2010
2010
|
stops: z.ZodArray<z.ZodObject<{
|
|
2011
2011
|
value: z.ZodObject<{
|
|
2012
2012
|
type: z.ZodEnum<{
|
|
2013
|
-
num: "num";
|
|
2014
|
-
min: "min";
|
|
2015
|
-
max: "max";
|
|
2016
2013
|
formula: "formula";
|
|
2017
2014
|
percent: "percent";
|
|
2015
|
+
num: "num";
|
|
2016
|
+
max: "max";
|
|
2017
|
+
min: "min";
|
|
2018
2018
|
percentile: "percentile";
|
|
2019
2019
|
}>;
|
|
2020
2020
|
value: z.ZodOptional<z.ZodString>;
|
|
@@ -2057,22 +2057,22 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
2057
2057
|
}, z.core.$strip>, z.ZodObject<{
|
|
2058
2058
|
min: z.ZodObject<{
|
|
2059
2059
|
type: z.ZodEnum<{
|
|
2060
|
-
num: "num";
|
|
2061
|
-
min: "min";
|
|
2062
|
-
max: "max";
|
|
2063
2060
|
formula: "formula";
|
|
2064
2061
|
percent: "percent";
|
|
2062
|
+
num: "num";
|
|
2063
|
+
max: "max";
|
|
2064
|
+
min: "min";
|
|
2065
2065
|
percentile: "percentile";
|
|
2066
2066
|
}>;
|
|
2067
2067
|
value: z.ZodOptional<z.ZodString>;
|
|
2068
2068
|
}, z.core.$strip>;
|
|
2069
2069
|
max: z.ZodObject<{
|
|
2070
2070
|
type: z.ZodEnum<{
|
|
2071
|
-
num: "num";
|
|
2072
|
-
min: "min";
|
|
2073
|
-
max: "max";
|
|
2074
2071
|
formula: "formula";
|
|
2075
2072
|
percent: "percent";
|
|
2073
|
+
num: "num";
|
|
2074
|
+
max: "max";
|
|
2075
|
+
min: "min";
|
|
2076
2076
|
percentile: "percentile";
|
|
2077
2077
|
}>;
|
|
2078
2078
|
value: z.ZodOptional<z.ZodString>;
|
|
@@ -2116,11 +2116,11 @@ declare const rtfContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, U
|
|
|
2116
2116
|
iconSetType: z.ZodString;
|
|
2117
2117
|
thresholds: z.ZodArray<z.ZodObject<{
|
|
2118
2118
|
type: z.ZodEnum<{
|
|
2119
|
-
num: "num";
|
|
2120
|
-
min: "min";
|
|
2121
|
-
max: "max";
|
|
2122
2119
|
formula: "formula";
|
|
2123
2120
|
percent: "percent";
|
|
2121
|
+
num: "num";
|
|
2122
|
+
max: "max";
|
|
2123
|
+
min: "min";
|
|
2124
2124
|
percentile: "percentile";
|
|
2125
2125
|
}>;
|
|
2126
2126
|
value: z.ZodOptional<z.ZodString>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rtf-codec",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Hand-written Rich Text Format (RTF 1.9.1) reader and writer against the shared document-schema.js content pivot.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -67,7 +67,9 @@
|
|
|
67
67
|
"test:smoke": "turbo run _test:smoke",
|
|
68
68
|
"_test:smoke": "vitest run --project smoke",
|
|
69
69
|
"prepare": "husky",
|
|
70
|
-
"release": "semantic-release"
|
|
70
|
+
"release": "semantic-release",
|
|
71
|
+
"test:corpus": "turbo run _test:corpus",
|
|
72
|
+
"_test:corpus": "vitest run --project corpus"
|
|
71
73
|
},
|
|
72
74
|
"keywords": [
|
|
73
75
|
"rtf",
|
|
@@ -80,8 +82,8 @@
|
|
|
80
82
|
"license": "MIT",
|
|
81
83
|
"packageManager": "pnpm@11.6.0",
|
|
82
84
|
"dependencies": {
|
|
83
|
-
"archive-codec": "1.10.
|
|
84
|
-
"document-schema.js": "7.6.
|
|
85
|
+
"archive-codec": "1.10.3",
|
|
86
|
+
"document-schema.js": "7.6.1",
|
|
85
87
|
"zod": "4.4.3"
|
|
86
88
|
},
|
|
87
89
|
"devDependencies": {
|