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