pretext-pdf 0.5.2 → 0.8.0
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/CHANGELOG.md +462 -351
- package/README.md +749 -568
- package/dist/assets.d.ts +5 -0
- package/dist/assets.d.ts.map +1 -1
- package/dist/assets.js +248 -43
- package/dist/assets.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/fonts.d.ts.map +1 -1
- package/dist/fonts.js +67 -8
- package/dist/fonts.js.map +1 -1
- package/dist/index.d.ts +29 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts +28 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +222 -0
- package/dist/markdown.js.map +1 -0
- package/dist/measure-blocks.d.ts.map +1 -1
- package/dist/measure-blocks.js +347 -62
- package/dist/measure-blocks.js.map +1 -1
- package/dist/measure-text.d.ts.map +1 -1
- package/dist/measure-text.js +1 -8
- package/dist/measure-text.js.map +1 -1
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +13 -21
- package/dist/measure.js.map +1 -1
- package/dist/render-blocks.d.ts +4 -1
- package/dist/render-blocks.d.ts.map +1 -1
- package/dist/render-blocks.js +227 -105
- package/dist/render-blocks.js.map +1 -1
- package/dist/render-extras.d.ts.map +1 -1
- package/dist/render-extras.js +72 -71
- package/dist/render-extras.js.map +1 -1
- package/dist/render-utils.d.ts +9 -2
- package/dist/render-utils.d.ts.map +1 -1
- package/dist/render-utils.js +24 -13
- package/dist/render-utils.js.map +1 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +27 -3
- package/dist/render.js.map +1 -1
- package/dist/rich-text.d.ts +0 -4
- package/dist/rich-text.d.ts.map +1 -1
- package/dist/rich-text.js +15 -9
- package/dist/rich-text.js.map +1 -1
- package/dist/templates.d.ts +79 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +201 -0
- package/dist/templates.js.map +1 -0
- package/dist/types.d.ts +139 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +241 -28
- package/dist/validate.js.map +1 -1
- package/package.json +175 -130
package/package.json
CHANGED
|
@@ -1,130 +1,175 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pretext-pdf",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Declarative JSON → PDF generation with professional typography. Built on pretext's precision text layout engine.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"pdf",
|
|
7
|
-
"pdf-generation",
|
|
8
|
-
"pretext",
|
|
9
|
-
"typography",
|
|
10
|
-
"invoice",
|
|
11
|
-
"report",
|
|
12
|
-
"document",
|
|
13
|
-
"typescript",
|
|
14
|
-
"nodejs",
|
|
15
|
-
"type-safe",
|
|
16
|
-
"forms",
|
|
17
|
-
"rtl",
|
|
18
|
-
"hyphenation"
|
|
19
|
-
],
|
|
20
|
-
"author": "Himanshu Jain <himanshu@antigravity.dev>",
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"homepage": "https://github.com/Himaan1998Y/pretext-pdf#readme",
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/Himaan1998Y/pretext-pdf/issues"
|
|
25
|
-
},
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "https://github.com/Himaan1998Y/pretext-pdf.git"
|
|
29
|
-
},
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">=18.0.0"
|
|
32
|
-
},
|
|
33
|
-
"sideEffects": false,
|
|
34
|
-
"type": "module",
|
|
35
|
-
"main": "./dist/index.js",
|
|
36
|
-
"types": "./dist/index.d.ts",
|
|
37
|
-
"files": [
|
|
38
|
-
"dist/",
|
|
39
|
-
"fonts/",
|
|
40
|
-
"docs/screenshots/",
|
|
41
|
-
"README.md",
|
|
42
|
-
"LICENSE",
|
|
43
|
-
"CHANGELOG.md"
|
|
44
|
-
],
|
|
45
|
-
"exports": {
|
|
46
|
-
".": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"test:
|
|
63
|
-
"test:
|
|
64
|
-
"test:
|
|
65
|
-
"test:
|
|
66
|
-
"test:
|
|
67
|
-
"test": "
|
|
68
|
-
"test:
|
|
69
|
-
"test:
|
|
70
|
-
"test:
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"example
|
|
86
|
-
"example:
|
|
87
|
-
"example:
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"@
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"@
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"@
|
|
117
|
-
"@
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
},
|
|
125
|
-
"
|
|
126
|
-
"@napi-rs/canvas":
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "pretext-pdf",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Declarative JSON → PDF generation with professional typography. Built on pretext's precision text layout engine.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pdf",
|
|
7
|
+
"pdf-generation",
|
|
8
|
+
"pretext",
|
|
9
|
+
"typography",
|
|
10
|
+
"invoice",
|
|
11
|
+
"report",
|
|
12
|
+
"document",
|
|
13
|
+
"typescript",
|
|
14
|
+
"nodejs",
|
|
15
|
+
"type-safe",
|
|
16
|
+
"forms",
|
|
17
|
+
"rtl",
|
|
18
|
+
"hyphenation"
|
|
19
|
+
],
|
|
20
|
+
"author": "Himanshu Jain <himanshu@antigravity.dev>",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"homepage": "https://github.com/Himaan1998Y/pretext-pdf#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/Himaan1998Y/pretext-pdf/issues"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/Himaan1998Y/pretext-pdf.git"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"type": "module",
|
|
35
|
+
"main": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/",
|
|
39
|
+
"fonts/",
|
|
40
|
+
"docs/screenshots/",
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE",
|
|
43
|
+
"CHANGELOG.md"
|
|
44
|
+
],
|
|
45
|
+
"exports": {
|
|
46
|
+
".": {
|
|
47
|
+
"types": "./dist/index.d.ts",
|
|
48
|
+
"import": "./dist/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./markdown": {
|
|
51
|
+
"types": "./dist/markdown.d.ts",
|
|
52
|
+
"import": "./dist/markdown.js"
|
|
53
|
+
},
|
|
54
|
+
"./templates": {
|
|
55
|
+
"types": "./dist/templates.d.ts",
|
|
56
|
+
"import": "./dist/templates.js"
|
|
57
|
+
},
|
|
58
|
+
"./package.json": "./package.json"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsc",
|
|
62
|
+
"test:unit": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsx --test test/validate.test.ts test/builder.test.ts test/rich-text.test.ts",
|
|
63
|
+
"test:validate": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsx --test test/validate.test.ts test/builder.test.ts",
|
|
64
|
+
"test:e2e": "tsx --test test/e2e.test.ts",
|
|
65
|
+
"test:phase-3": "tsx --test test/phase-3-signatures.test.ts",
|
|
66
|
+
"test:10a": "tsx --test test/phase-10a-qr-barcode.test.ts",
|
|
67
|
+
"test:10b": "tsx --test test/phase-10b-charts.test.ts",
|
|
68
|
+
"test:10c": "tsx --test test/phase-10c-markdown.test.ts",
|
|
69
|
+
"test:10d": "tsx --test test/phase-10d-templates.test.ts",
|
|
70
|
+
"test:phase-4": "tsx --test test/phase-4-footnotes.test.ts",
|
|
71
|
+
"test:phase-5": "tsx --test test/phase-5-image-float.test.ts",
|
|
72
|
+
"test:phases": "tsx --test test/phase-4-footnotes.test.ts test/phase-5-image-float.test.ts test/phase-7a.test.ts test/phase-7b.test.ts test/phase-7c.test.ts test/phase-7d-toc.test.ts test/phase-7e-svg.test.ts test/phase-7f-rtl.test.ts test/phase-7g.test.ts test/phase-7-integration.test.ts test/phase-8g-hyperlinks.test.ts test/phase-8h-inline-formatting.test.ts test/phase-8a-annotations.test.ts test/phase-8c-assembly.test.ts test/phase-8f-metadata.test.ts test/phase-8e-signatures.test.ts test/phase-8b-forms.test.ts test/phase-8d-callout.test.ts test/phase-9a-crypto-signatures.test.ts test/phase-9b-float-groups.test.ts test/phase-9c-font-subsetting.test.ts test/phase-2-performance.test.ts test/phase-3-signatures.test.ts test/phase-11-enhancements.test.ts test/phase-10a-qr-barcode.test.ts test/phase-10b-charts.test.ts test/phase-10c-markdown.test.ts test/phase-10d-templates.test.ts",
|
|
73
|
+
"test:phase-7": "tsx --test test/phase-7a.test.ts test/phase-7b.test.ts test/phase-7c.test.ts test/phase-7d-toc.test.ts test/phase-7e-svg.test.ts test/phase-7f-rtl.test.ts test/phase-7g.test.ts test/phase-7-integration.test.ts",
|
|
74
|
+
"test:phase-8": "tsx --test test/phase-8g-hyperlinks.test.ts test/phase-8h-inline-formatting.test.ts test/phase-8a-annotations.test.ts test/phase-8c-assembly.test.ts test/phase-8b-forms.test.ts test/phase-8d-callout.test.ts test/phase-8e-signatures.test.ts test/phase-8f-metadata.test.ts",
|
|
75
|
+
"test:8d": "tsx --test test/phase-8d-callout.test.ts",
|
|
76
|
+
"test:8f": "tsx --test test/phase-8f-metadata.test.ts",
|
|
77
|
+
"test:8e": "tsx --test test/phase-8e-signatures.test.ts",
|
|
78
|
+
"test:8b": "tsx --test test/phase-8b-forms.test.ts",
|
|
79
|
+
"test:contract": "tsx --test test/pretext-api-contract.test.ts",
|
|
80
|
+
"test:2f": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsx --test test/phase-2f-stress.test.ts",
|
|
81
|
+
"test": "npm run test:contract && npm run test:unit && npm run test:e2e && npm run test:phases && npm run test:2f",
|
|
82
|
+
"test:rich": "tsx --test test/rich-text.test.ts",
|
|
83
|
+
"test:visual": "tsx --test test/visual/visual.test.ts",
|
|
84
|
+
"test:visual:update": "cross-env UPDATE_BASELINES=1 tsx test/visual/visual.test.ts",
|
|
85
|
+
"example": "tsx examples/invoice.ts",
|
|
86
|
+
"example:watermark": "tsx examples/phase7-watermark.ts",
|
|
87
|
+
"example:bookmarks": "tsx examples/phase7-bookmarks.ts",
|
|
88
|
+
"example:toc": "tsx examples/phase7-toc.ts",
|
|
89
|
+
"example:rtl": "tsx examples/phase7-rtl.ts",
|
|
90
|
+
"example:encryption": "tsx examples/phase7-encryption.ts",
|
|
91
|
+
"example:hyperlinks": "tsx examples/phase8-hyperlinks.ts",
|
|
92
|
+
"example:annotations": "tsx examples/phase8-annotations.ts",
|
|
93
|
+
"example:assembly": "tsx examples/phase8-assembly.ts",
|
|
94
|
+
"example:inline": "tsx examples/phase8-inline.ts",
|
|
95
|
+
"example:forms": "tsx examples/phase8-forms.ts",
|
|
96
|
+
"example:callout": "tsx examples/phase8-callout.ts",
|
|
97
|
+
"example:gst": "tsx examples/gst-invoice-india.ts",
|
|
98
|
+
"example:floats": "tsx examples/phase9b-float-groups.ts",
|
|
99
|
+
"example:showcase-invoice": "tsx examples/showcase-invoice.ts",
|
|
100
|
+
"example:showcase-report": "tsx examples/showcase-report.ts",
|
|
101
|
+
"example:showcase-resume": "tsx examples/showcase-resume.ts",
|
|
102
|
+
"screenshots": "npm run example:showcase-invoice && npm run example:showcase-report && npm run example:showcase-resume && node scripts/screenshot.cjs",
|
|
103
|
+
"typecheck": "tsc --noEmit"
|
|
104
|
+
},
|
|
105
|
+
"dependencies": {
|
|
106
|
+
"@cantoo/pdf-lib": "^2.6.5",
|
|
107
|
+
"@chenglou/pretext": "^0.0.5",
|
|
108
|
+
"@fontsource-variable/inter": "^5.2.8",
|
|
109
|
+
"@fontsource/inter": "^5.0.0",
|
|
110
|
+
"@pdf-lib/fontkit": "^1.1.1",
|
|
111
|
+
"bidi-js": "^1.0.3",
|
|
112
|
+
"hyphenation.en-us": "^0.2.1",
|
|
113
|
+
"hypher": "^0.2.5"
|
|
114
|
+
},
|
|
115
|
+
"peerDependencies": {
|
|
116
|
+
"@napi-rs/canvas": "^0.1.57",
|
|
117
|
+
"@signpdf/signpdf": "^3.3.0",
|
|
118
|
+
"bwip-js": "^4.0.0",
|
|
119
|
+
"highlight.js": "^11.0.0",
|
|
120
|
+
"qrcode": "^1.5.0",
|
|
121
|
+
"marked": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
122
|
+
"vega": "^5.0.0 || ^6.0.0",
|
|
123
|
+
"vega-lite": "^5.0.0 || ^6.0.0"
|
|
124
|
+
},
|
|
125
|
+
"peerDependenciesMeta": {
|
|
126
|
+
"@napi-rs/canvas": {
|
|
127
|
+
"optional": true
|
|
128
|
+
},
|
|
129
|
+
"@signpdf/signpdf": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
132
|
+
"highlight.js": {
|
|
133
|
+
"optional": true
|
|
134
|
+
},
|
|
135
|
+
"qrcode": {
|
|
136
|
+
"optional": true
|
|
137
|
+
},
|
|
138
|
+
"bwip-js": {
|
|
139
|
+
"optional": true
|
|
140
|
+
},
|
|
141
|
+
"marked": {
|
|
142
|
+
"optional": true
|
|
143
|
+
},
|
|
144
|
+
"vega": {
|
|
145
|
+
"optional": true
|
|
146
|
+
},
|
|
147
|
+
"vega-lite": {
|
|
148
|
+
"optional": true
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"devDependencies": {
|
|
152
|
+
"@signpdf/signpdf": "^3.3.0",
|
|
153
|
+
"@types/bwip-js": "^3.2.3",
|
|
154
|
+
"@types/node": "^22.0.0",
|
|
155
|
+
"@types/pixelmatch": "^5.2.6",
|
|
156
|
+
"@types/pngjs": "^6.0.5",
|
|
157
|
+
"@types/qrcode": "^1.5.6",
|
|
158
|
+
"bwip-js": "^4.9.2",
|
|
159
|
+
"cross-env": "^10.1.0",
|
|
160
|
+
"highlight.js": "^11.11.1",
|
|
161
|
+
"marked": "^18.0.2",
|
|
162
|
+
"pdfjs-dist": "^5.6.205",
|
|
163
|
+
"qrcode": "^1.5.4",
|
|
164
|
+
"ts-node": "^10.9.2",
|
|
165
|
+
"tsx": "^4.7.0",
|
|
166
|
+
"typescript": "^5.5.0",
|
|
167
|
+
"vega": "^6.2.0",
|
|
168
|
+
"vega-lite": "^6.4.2"
|
|
169
|
+
},
|
|
170
|
+
"optionalDependencies": {
|
|
171
|
+
"@napi-rs/canvas": "^0.1.57",
|
|
172
|
+
"pixelmatch": "^7.1.0",
|
|
173
|
+
"pngjs": "^7.0.0"
|
|
174
|
+
}
|
|
175
|
+
}
|