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.
Files changed (57) hide show
  1. package/CHANGELOG.md +462 -351
  2. package/README.md +749 -568
  3. package/dist/assets.d.ts +5 -0
  4. package/dist/assets.d.ts.map +1 -1
  5. package/dist/assets.js +248 -43
  6. package/dist/assets.js.map +1 -1
  7. package/dist/errors.d.ts +1 -1
  8. package/dist/errors.d.ts.map +1 -1
  9. package/dist/errors.js.map +1 -1
  10. package/dist/fonts.d.ts.map +1 -1
  11. package/dist/fonts.js +67 -8
  12. package/dist/fonts.js.map +1 -1
  13. package/dist/index.d.ts +29 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +35 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/markdown.d.ts +28 -0
  18. package/dist/markdown.d.ts.map +1 -0
  19. package/dist/markdown.js +222 -0
  20. package/dist/markdown.js.map +1 -0
  21. package/dist/measure-blocks.d.ts.map +1 -1
  22. package/dist/measure-blocks.js +347 -62
  23. package/dist/measure-blocks.js.map +1 -1
  24. package/dist/measure-text.d.ts.map +1 -1
  25. package/dist/measure-text.js +1 -8
  26. package/dist/measure-text.js.map +1 -1
  27. package/dist/measure.d.ts.map +1 -1
  28. package/dist/measure.js +13 -21
  29. package/dist/measure.js.map +1 -1
  30. package/dist/render-blocks.d.ts +4 -1
  31. package/dist/render-blocks.d.ts.map +1 -1
  32. package/dist/render-blocks.js +227 -105
  33. package/dist/render-blocks.js.map +1 -1
  34. package/dist/render-extras.d.ts.map +1 -1
  35. package/dist/render-extras.js +72 -71
  36. package/dist/render-extras.js.map +1 -1
  37. package/dist/render-utils.d.ts +9 -2
  38. package/dist/render-utils.d.ts.map +1 -1
  39. package/dist/render-utils.js +24 -13
  40. package/dist/render-utils.js.map +1 -1
  41. package/dist/render.d.ts.map +1 -1
  42. package/dist/render.js +27 -3
  43. package/dist/render.js.map +1 -1
  44. package/dist/rich-text.d.ts +0 -4
  45. package/dist/rich-text.d.ts.map +1 -1
  46. package/dist/rich-text.js +15 -9
  47. package/dist/rich-text.js.map +1 -1
  48. package/dist/templates.d.ts +79 -0
  49. package/dist/templates.d.ts.map +1 -0
  50. package/dist/templates.js +201 -0
  51. package/dist/templates.js.map +1 -0
  52. package/dist/types.d.ts +139 -5
  53. package/dist/types.d.ts.map +1 -1
  54. package/dist/validate.d.ts.map +1 -1
  55. package/dist/validate.js +241 -28
  56. package/dist/validate.js.map +1 -1
  57. package/package.json +175 -130
package/package.json CHANGED
@@ -1,130 +1,175 @@
1
- {
2
- "name": "pretext-pdf",
3
- "version": "0.5.2",
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
- "import": "./dist/index.js",
48
- "types": "./dist/index.d.ts"
49
- }
50
- },
51
- "scripts": {
52
- "build": "tsc",
53
- "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",
54
- "test:validate": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsx --test test/validate.test.ts test/builder.test.ts",
55
- "test:e2e": "tsx --test test/e2e.test.ts",
56
- "test:phase-3": "tsx --test test/phase-3-signatures.test.ts",
57
- "test:phase-4": "tsx --test test/phase-4-footnotes.test.ts",
58
- "test:phase-5": "tsx --test test/phase-5-image-float.test.ts",
59
- "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",
60
- "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",
61
- "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",
62
- "test:8d": "tsx --test test/phase-8d-callout.test.ts",
63
- "test:8f": "tsx --test test/phase-8f-metadata.test.ts",
64
- "test:8e": "tsx --test test/phase-8e-signatures.test.ts",
65
- "test:8b": "tsx --test test/phase-8b-forms.test.ts",
66
- "test:contract": "tsx --test test/pretext-api-contract.test.ts",
67
- "test": "npm run test:contract && npm run test:unit && npm run test:e2e && npm run test:phases",
68
- "test:rich": "tsx --test test/rich-text.test.ts",
69
- "test:visual": "tsx --test test/visual/visual.test.ts",
70
- "test:visual:update": "cross-env UPDATE_BASELINES=1 tsx test/visual/visual.test.ts",
71
- "example": "tsx examples/invoice.ts",
72
- "example:watermark": "tsx examples/phase7-watermark.ts",
73
- "example:bookmarks": "tsx examples/phase7-bookmarks.ts",
74
- "example:toc": "tsx examples/phase7-toc.ts",
75
- "example:rtl": "tsx examples/phase7-rtl.ts",
76
- "example:encryption": "tsx examples/phase7-encryption.ts",
77
- "example:hyperlinks": "tsx examples/phase8-hyperlinks.ts",
78
- "example:annotations": "tsx examples/phase8-annotations.ts",
79
- "example:assembly": "tsx examples/phase8-assembly.ts",
80
- "example:inline": "tsx examples/phase8-inline.ts",
81
- "example:forms": "tsx examples/phase8-forms.ts",
82
- "example:callout": "tsx examples/phase8-callout.ts",
83
- "example:gst": "tsx examples/gst-invoice-india.ts",
84
- "example:floats": "tsx examples/phase9b-float-groups.ts",
85
- "example:showcase-invoice": "tsx examples/showcase-invoice.ts",
86
- "example:showcase-report": "tsx examples/showcase-report.ts",
87
- "example:showcase-resume": "tsx examples/showcase-resume.ts",
88
- "screenshots": "npm run example:showcase-invoice && npm run example:showcase-report && npm run example:showcase-resume && node scripts/screenshot.cjs",
89
- "typecheck": "tsc --noEmit"
90
- },
91
- "dependencies": {
92
- "@cantoo/pdf-lib": "^2.6.5",
93
- "@chenglou/pretext": "0.0.3",
94
- "@fontsource-variable/inter": "^5.2.8",
95
- "@fontsource/inter": "^5.0.0",
96
- "@pdf-lib/fontkit": "^1.1.1",
97
- "bidi-js": "^1.0.3",
98
- "hyphenation.en-us": "^0.2.1",
99
- "hypher": "^0.2.5",
100
- "subset-font": "^2.5.0"
101
- },
102
- "peerDependencies": {
103
- "@napi-rs/canvas": "^0.1.57",
104
- "@signpdf/signpdf": "^3.3.0"
105
- },
106
- "peerDependenciesMeta": {
107
- "@napi-rs/canvas": {
108
- "optional": true
109
- },
110
- "@signpdf/signpdf": {
111
- "optional": true
112
- }
113
- },
114
- "devDependencies": {
115
- "@signpdf/signpdf": "^3.3.0",
116
- "@types/node": "^22.0.0",
117
- "@types/pixelmatch": "^5.2.6",
118
- "@types/pngjs": "^6.0.5",
119
- "cross-env": "^10.1.0",
120
- "pdfjs-dist": "^5.6.205",
121
- "ts-node": "^10.9.2",
122
- "tsx": "^4.7.0",
123
- "typescript": "^5.5.0"
124
- },
125
- "optionalDependencies": {
126
- "@napi-rs/canvas": "^0.1.57",
127
- "pixelmatch": "^7.1.0",
128
- "pngjs": "^7.0.0"
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
+ }