weasyprint-tsx 0.1.3 → 0.1.5

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 CHANGED
@@ -95,5 +95,5 @@ export default config;
95
95
  `@weasyprint-tsx/ui` provides print-optimized Preact components. See [`packages/ui/README.md`](packages/ui/README.md) for the full API.
96
96
 
97
97
  ```tsx
98
- import { H1, H2, Page, UL, LI, Table, Entry } from "@weasyprint-tsx/ui";
98
+ import { H1, H2, Page, UL, LI, Table, Entry, Chart } from "@weasyprint-tsx/ui";
99
99
  ```
package/ReadMe.pdf CHANGED
Binary file
package/bun.lock CHANGED
@@ -4,13 +4,10 @@
4
4
  "workspaces": {
5
5
  "": {
6
6
  "name": "@weasyprint-tsx/build",
7
- "dependencies": {
8
- "@fontsource-variable/public-sans": "^5.2.7",
9
- },
10
7
  },
11
8
  "packages/build": {
12
9
  "name": "@weasyprint-tsx/build",
13
- "version": "0.1.1",
10
+ "version": "0.1.6",
14
11
  "bin": {
15
12
  "weasyprint-tsx": "./src/cli.ts",
16
13
  },
@@ -27,20 +24,23 @@
27
24
  },
28
25
  "packages/create": {
29
26
  "name": "@weasyprint-tsx/create",
30
- "version": "0.1.0",
27
+ "version": "0.1.1",
31
28
  "bin": {
32
29
  "create-weasyprint-tsx": "cli.js",
33
30
  },
34
- "dependencies": {
35
- "highlight.js": "11.11.1",
36
- },
37
31
  },
38
32
  "packages/ui": {
39
33
  "name": "@weasyprint-tsx/ui",
40
- "version": "0.1.0",
34
+ "version": "0.1.13",
41
35
  "dependencies": {
42
- "highlight.js": "^11.11.1",
36
+ "@napi-rs/canvas": "^1.0.0",
37
+ "chart.js": "^4.5.1",
38
+ "highlight.js": "11.11.1",
43
39
  "katex": "^0.16.47",
40
+ "qrcode": "^1.5.4",
41
+ },
42
+ "devDependencies": {
43
+ "@types/qrcode": "^1.5.6",
44
44
  },
45
45
  },
46
46
  },
@@ -55,8 +55,6 @@
55
55
 
56
56
  "@csstools/utilities": ["@csstools/utilities@3.0.0", "", { "peerDependencies": { "postcss": "^8.4" } }, "sha512-etDqA/4jYvOGBM6yfKCOsEXfH96BKztZdgGmGqKi2xHnDe0ILIBraRspwgYatJH9JsCZ5HCGoCst8w18EKOAdg=="],
57
57
 
58
- "@fontsource-variable/public-sans": ["@fontsource-variable/public-sans@5.2.7", "", {}, "sha512-4mvade2J3slKkvwRkS+p8T3szet/0vhWoSnuUJTVU81Uo2pRpSZY/Y8bSLRqpSwzIPxjVmRJ53oq6JKP/l/PSg=="],
59
-
60
58
  "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],
61
59
 
62
60
  "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="],
@@ -67,6 +65,32 @@
67
65
 
68
66
  "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
69
67
 
68
+ "@kurkle/color": ["@kurkle/color@0.3.4", "", {}, "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w=="],
69
+
70
+ "@napi-rs/canvas": ["@napi-rs/canvas@1.0.0", "", { "optionalDependencies": { "@napi-rs/canvas-android-arm64": "1.0.0", "@napi-rs/canvas-darwin-arm64": "1.0.0", "@napi-rs/canvas-darwin-x64": "1.0.0", "@napi-rs/canvas-linux-arm-gnueabihf": "1.0.0", "@napi-rs/canvas-linux-arm64-gnu": "1.0.0", "@napi-rs/canvas-linux-arm64-musl": "1.0.0", "@napi-rs/canvas-linux-riscv64-gnu": "1.0.0", "@napi-rs/canvas-linux-x64-gnu": "1.0.0", "@napi-rs/canvas-linux-x64-musl": "1.0.0", "@napi-rs/canvas-win32-arm64-msvc": "1.0.0", "@napi-rs/canvas-win32-x64-msvc": "1.0.0" } }, "sha512-Jqxcy1XOIqj+lH9sl1GT+il6GR3uQv13vI2mrwubP3uT8Olak2ClDrK2RnxlQKjwv8BRr4b3ug0YR7c6hBX8wg=="],
71
+
72
+ "@napi-rs/canvas-android-arm64": ["@napi-rs/canvas-android-arm64@1.0.0", "", { "os": "android", "cpu": "arm64" }, "sha512-3hNKJObUK7JsCF9aJlVCs1J0/KE/gGfZNeK8MO1ge6bB3aicr5walGme9t9No1f/oyk9GgvdAT/rjSdsx3gbIw=="],
73
+
74
+ "@napi-rs/canvas-darwin-arm64": ["@napi-rs/canvas-darwin-arm64@1.0.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ZIja19/BiGz2puhki+WUYSRriwFeFJ8Mi9eK3hZdSS85w4Y60cuEAJVhMCfKwswQkKkUtrnzdKMBuO7TupvexA=="],
75
+
76
+ "@napi-rs/canvas-darwin-x64": ["@napi-rs/canvas-darwin-x64@1.0.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-hImggWc82jqZVpEsFR9S7PE9OQYjq/H/D7vwCGB6X1jRH+UVBP1+1niJTPBOat1B154T6GKK7/kcFtoWgjgFzQ=="],
77
+
78
+ "@napi-rs/canvas-linux-arm-gnueabihf": ["@napi-rs/canvas-linux-arm-gnueabihf@1.0.0", "", { "os": "linux", "cpu": "arm" }, "sha512-hlJRy6d+kWLKVOG/+1rEvNQVURZ0DxxRPJsLmEWwhwiXZUJc0BF5o9esALHSEP4CoJK4wChRtj3hnyBgVx2oWA=="],
79
+
80
+ "@napi-rs/canvas-linux-arm64-gnu": ["@napi-rs/canvas-linux-arm64-gnu@1.0.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-5Hru4T3RXkosRQafcjelv7AUzw9mXqmGYsxnzeDDOWveFCJyEPMSJltvGCM+jfH98seOCbfwm9KyFg6Jm5FhAA=="],
81
+
82
+ "@napi-rs/canvas-linux-arm64-musl": ["@napi-rs/canvas-linux-arm64-musl@1.0.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-LTUl9jS8WsLSUGaxQZKQkxfluOJRpgvBuxxdM4pYcjib+di8AU4OzQc6+L6SzGMLcKc9H0RAjojRatBhTMqYdg=="],
83
+
84
+ "@napi-rs/canvas-linux-riscv64-gnu": ["@napi-rs/canvas-linux-riscv64-gnu@1.0.0", "", { "os": "linux", "cpu": "none" }, "sha512-Iz931SAZf+WVDzpjk52Q3ffW3zw0YflFwEZMgs036Wfu1kX/LrwT9wGjsuSqyduqefUkl91/vTdAjn8hQu5ezA=="],
85
+
86
+ "@napi-rs/canvas-linux-x64-gnu": ["@napi-rs/canvas-linux-x64-gnu@1.0.0", "", { "os": "linux", "cpu": "x64" }, "sha512-pFEQ5eFK4JusgN1K6KkO9DKP/Hi1WMJOkF8Ch03/khTc4bFbCKkCCsJG4YcOMOW9bI4XbT2/eMAWxhO0xaWgPA=="],
87
+
88
+ "@napi-rs/canvas-linux-x64-musl": ["@napi-rs/canvas-linux-x64-musl@1.0.0", "", { "os": "linux", "cpu": "x64" }, "sha512-jnvr8NrLHiZ3NCiOKWqDbkI4Ah+QDrqtZ+sddPZBltEb1mQ2coSvCSJYfict+oAwcm0c970oTmVySpjKP/lnaA=="],
89
+
90
+ "@napi-rs/canvas-win32-arm64-msvc": ["@napi-rs/canvas-win32-arm64-msvc@1.0.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-y2j9/Gfd5joqiqxdP/L1smqjQ+uAx3C4N0EC7bDHrnZEEH8ToM/OC5p3uHvtj4Lq591aHj+ArL01UDLNwT5HgQ=="],
91
+
92
+ "@napi-rs/canvas-win32-x64-msvc": ["@napi-rs/canvas-win32-x64-msvc@1.0.0", "", { "os": "win32", "cpu": "x64" }, "sha512-qwdhh9N6Gge/hC4pL9S1tQp0iKwhSl/dYjg7+RGp9k26iRGRi5MqqUyKGOXIWli0zOcuy5Y2wIH/jk2ry6i/jA=="],
93
+
70
94
  "@tailwindcss/node": ["@tailwindcss/node@4.3.0", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "enhanced-resolve": "^5.21.0", "jiti": "^2.6.1", "lightningcss": "1.32.0", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.3.0" } }, "sha512-aFb4gUhFOgdh9AXo4IzBEOzBkkAxm9VigwDJnMIYv3lcfXCJVesNfbEaBl4BNgVRyid92AmdviqwBUBRKSeY3g=="],
71
95
 
72
96
  "@tailwindcss/oxide": ["@tailwindcss/oxide@4.3.0", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.3.0", "@tailwindcss/oxide-darwin-arm64": "4.3.0", "@tailwindcss/oxide-darwin-x64": "4.3.0", "@tailwindcss/oxide-freebsd-x64": "4.3.0", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.0", "@tailwindcss/oxide-linux-arm64-gnu": "4.3.0", "@tailwindcss/oxide-linux-arm64-musl": "4.3.0", "@tailwindcss/oxide-linux-x64-gnu": "4.3.0", "@tailwindcss/oxide-linux-x64-musl": "4.3.0", "@tailwindcss/oxide-wasm32-wasi": "4.3.0", "@tailwindcss/oxide-win32-arm64-msvc": "4.3.0", "@tailwindcss/oxide-win32-x64-msvc": "4.3.0" } }, "sha512-F7HZGBeN9I0/AuuJS5PwcD8xayx5ri5GhjYUDBEVYUkexyA/giwbDNjRVrxSezE3T250OU2K/wp/ltWx3UOefg=="],
@@ -99,24 +123,52 @@
99
123
 
100
124
  "@types/node": ["@types/node@25.9.3", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-603BddQMv3pUcr4U2dhujk83N2tTDVr/34wII2B6bJy6g+8WD6yUb11jszNs0gdi4PesVWl7ABt8nYMVpnLUcg=="],
101
125
 
126
+ "@types/qrcode": ["@types/qrcode@1.5.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw=="],
127
+
102
128
  "@weasyprint-tsx/build": ["@weasyprint-tsx/build@workspace:packages/build"],
103
129
 
104
130
  "@weasyprint-tsx/create": ["@weasyprint-tsx/create@workspace:packages/create"],
105
131
 
106
132
  "@weasyprint-tsx/ui": ["@weasyprint-tsx/ui@workspace:packages/ui"],
107
133
 
134
+ "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
135
+
136
+ "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
137
+
108
138
  "bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
109
139
 
140
+ "camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="],
141
+
142
+ "chart.js": ["chart.js@4.5.1", "", { "dependencies": { "@kurkle/color": "^0.3.0" } }, "sha512-GIjfiT9dbmHRiYi6Nl2yFCq7kkwdkp1W/lp2J99rX0yo9tgJGn3lKQATztIjb5tVtevcBtIdICNWqlq5+E8/Pw=="],
143
+
144
+ "cliui": ["cliui@6.0.0", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^6.2.0" } }, "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ=="],
145
+
146
+ "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
147
+
148
+ "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
149
+
110
150
  "commander": ["commander@8.3.0", "", {}, "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="],
111
151
 
152
+ "decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="],
153
+
112
154
  "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
113
155
 
156
+ "dijkstrajs": ["dijkstrajs@1.0.3", "", {}, "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA=="],
157
+
158
+ "emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
159
+
114
160
  "enhanced-resolve": ["enhanced-resolve@5.24.0", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.3" } }, "sha512-SkE2t82KlkkxQRVMVLAGKxLfORGQfrkx5dkj+vlgXRVNEdPc4eZcR+J/Fvj8C+yKSFH5L0q3NFlyufOVQnCcYQ=="],
115
161
 
162
+ "find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="],
163
+
164
+ "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="],
165
+
116
166
  "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
117
167
 
118
168
  "highlight.js": ["highlight.js@11.11.1", "", {}, "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w=="],
119
169
 
170
+ "is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
171
+
120
172
  "jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="],
121
173
 
122
174
  "katex": ["katex@0.16.47", "", { "dependencies": { "commander": "^8.3.0" }, "bin": { "katex": "cli.js" } }, "sha512-Eeo8Ys1doU1z+x8AZsPpQu+p/QcZBI5PeOo7QGQdy2x2m0MU/hYagBbGOmXwr5KVbEfVuWv9LpnQWeehogurjg=="],
@@ -145,12 +197,24 @@
145
197
 
146
198
  "lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.32.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q=="],
147
199
 
200
+ "locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
201
+
148
202
  "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
149
203
 
150
204
  "nanoid": ["nanoid@3.3.12", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ=="],
151
205
 
206
+ "p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="],
207
+
208
+ "p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="],
209
+
210
+ "p-try": ["p-try@2.2.0", "", {}, "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="],
211
+
212
+ "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],
213
+
152
214
  "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
153
215
 
216
+ "pngjs": ["pngjs@5.0.0", "", {}, "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw=="],
217
+
154
218
  "postcss": ["postcss@8.5.15", "", { "dependencies": { "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A=="],
155
219
 
156
220
  "postcss-custom-properties": ["postcss-custom-properties@15.0.1", "", { "dependencies": { "@csstools/cascade-layer-name-parser": "^3.0.0", "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.0", "@csstools/utilities": "^3.0.0", "postcss-value-parser": "^4.2.0" }, "peerDependencies": { "postcss": "^8.4" } }, "sha512-cuyq8sd8dLY0GLbelz1KB8IMIoDECo6RVXMeHeXY2Uw3Q05k/d1GVITdaKLsheqrHbnxlwxzSRZQQ5u+rNtbMg=="],
@@ -161,14 +225,36 @@
161
225
 
162
226
  "preact-render-to-string": ["preact-render-to-string@6.7.0", "", { "peerDependencies": { "preact": ">=10 || >= 11.0.0-0" } }, "sha512-Z4WR8fmLMRpdYqJ9i7vrlXSsSrxVJydwrkEXHapexfARbWfGb7vGcnvNQnIzN0cXciMVOlz/XLoiMCi9gUsy9Q=="],
163
227
 
228
+ "qrcode": ["qrcode@1.5.4", "", { "dependencies": { "dijkstrajs": "^1.0.1", "pngjs": "^5.0.0", "yargs": "^15.3.1" }, "bin": { "qrcode": "bin/qrcode" } }, "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg=="],
229
+
230
+ "require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="],
231
+
232
+ "require-main-filename": ["require-main-filename@2.0.0", "", {}, "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="],
233
+
234
+ "set-blocking": ["set-blocking@2.0.0", "", {}, "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="],
235
+
164
236
  "source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
165
237
 
238
+ "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
239
+
240
+ "strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
241
+
166
242
  "tailwindcss": ["tailwindcss@4.3.0", "", {}, "sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q=="],
167
243
 
168
244
  "tapable": ["tapable@2.3.3", "", {}, "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A=="],
169
245
 
170
246
  "undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="],
171
247
 
248
+ "which-module": ["which-module@2.0.1", "", {}, "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ=="],
249
+
250
+ "wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],
251
+
252
+ "y18n": ["y18n@4.0.3", "", {}, "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ=="],
253
+
254
+ "yargs": ["yargs@15.4.1", "", { "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" } }, "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="],
255
+
256
+ "yargs-parser": ["yargs-parser@18.1.3", "", { "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ=="],
257
+
172
258
  "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" }, "bundled": true }, "sha512-l9Oo58x0HOP5znGzVhYW9U3e5wVuA4LAZU2AGezTmkhO1CgQRFDhDg4nneHsu/t3WniXg9QrG2nIXL/ZS8ln8Q=="],
173
259
 
174
260
  "@tailwindcss/oxide-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.0", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-55coeOFKHv1ywEcUXJtWU5f+Jr/W5tZDvZig8DLKSwUN1JpROQ4rk/SNOQiFWmaR/VKF4zuFyW1B8JduOSv6Pg=="],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weasyprint-tsx",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "bin": {
5
5
  "create-weasyprint-tsx": "bun packages/create/cli.ts",
6
6
  "build-weasyprint-tsx": "bun packages/build/src/cli.ts"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasyprint-tsx/build",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "main": "./src/index.ts",
5
5
  "exports": { ".": "./src/index.ts" },
6
6
  "types": "./src/index.ts",
@@ -46,7 +46,7 @@ export async function devMode(output?: string) {
46
46
 
47
47
  WATCH_DIRS.forEach((dir) =>
48
48
  watch(dir, { recursive: true }, async (_, f) => {
49
- process.stdout.write(`file changed ${f}`);
49
+ process.stdout.write(`file changed ${f}\n`);
50
50
  await rebuild();
51
51
  }),
52
52
  );
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasyprint-tsx/create",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "bin": {
5
5
  "create-weasyprint-tsx": "cli.js"
6
6
  },
@@ -114,6 +114,5 @@ See the full API: https://github.com/weasyprint-tsx/weasyprint-tsx/blob/main/pac
114
114
  - **No `@media screen`** — the document is rendered in print media; use `@media print` or no media query
115
115
  - **Page geometry** belongs in `@page` rules, not on `html` or `body`
116
116
  - **All layout** should use CSS that WeasyPrint supports. Flexbox and CSS Grid have partial support — prefer block layout or the `BlockBox`/`Block` components for multi-column content
117
- - **Components are Preact**, not React — use `class` not `className` for raw HTML elements (Preact accepts both, but prefer `class`)
118
117
  - **Images** must be embedded as base64 data URIs or served by the dev server; external URLs may not resolve during build
119
118
  - **Fonts** must be declared in CSS with `@font-face` or imported via Tailwind; Google Fonts CDN links work at build time
@@ -1,7 +1,6 @@
1
+ import { Chart, H1, H2, LI, UL } from "@weasyprint-tsx/ui";
1
2
  import "./index.css";
2
3
 
3
- import { H1, H2, LI, UL } from "@weasyprint-tsx/ui";
4
-
5
4
  export default function Document() {
6
5
  return (
7
6
  <html lang="en">
@@ -13,12 +12,33 @@ export default function Document() {
13
12
  <body>
14
13
  <H1>My Document</H1>
15
14
  <H2>Introduction</H2>
16
- <p>Edit <code>src/index.tsx</code> to start writing your document.</p>
15
+ <p>
16
+ Edit <code>src/index.tsx</code> to start writing your document.
17
+ </p>
17
18
  <UL>
18
- <LI>Use components from <code>@weasyprint-tsx/ui</code></LI>
19
- <LI>Style with Tailwind utility classes or plain CSS in <code>src/index.css</code></LI>
20
- <LI>Run <code>bun run dev</code> for live preview</LI>
19
+ <LI>
20
+ Use components from <code>@weasyprint-tsx/ui</code>
21
+ </LI>
22
+ <LI>
23
+ Style with Tailwind utility classes or plain CSS in{" "}
24
+ <code>src/index.css</code>
25
+ </LI>
26
+ <LI>
27
+ Run <code>bun run dev</code> for live preview
28
+ </LI>
21
29
  </UL>
30
+ <H2>Chart Example</H2>
31
+ <Chart
32
+ config={{
33
+ type: "bar",
34
+ data: {
35
+ labels: ["Jan", "Feb", "Mar"],
36
+ datasets: [{ label: "Sales", data: [12, 8, 21] }],
37
+ },
38
+ }}
39
+ width={600}
40
+ height={300}
41
+ />
22
42
  </body>
23
43
  </html>
24
44
  );
@@ -276,3 +276,77 @@ LaTeX equation rendering via KaTeX.
276
276
  | `displayMode` | `boolean` | `false` | Render as block-level equation |
277
277
  | `aligned` | `boolean` | `false` | Wrap in `\begin{aligned}…\end{aligned}` |
278
278
  | `chemical` | `boolean` | `false` | Wrap in `\ce{…}` for chemical notation |
279
+
280
+ ---
281
+
282
+ ## Chart
283
+
284
+ Renders a [chart.js](https://www.chartjs.org/) chart server-side as a base64-encoded PNG `<img>`.
285
+
286
+ ### `Chart`
287
+
288
+ ```tsx
289
+ import type { ChartConfiguration } from "chart.js";
290
+ import { Chart } from "@weasyprint-tsx/ui";
291
+
292
+ const config: ChartConfiguration = {
293
+ type: "bar",
294
+ data: {
295
+ labels: ["Jan", "Feb", "Mar"],
296
+ datasets: [{ label: "Sales", data: [12, 8, 21] }],
297
+ },
298
+ };
299
+
300
+ <Chart config={config} width={600} height={300} />
301
+ ```
302
+
303
+ | Prop | Type | Default | Description |
304
+ |------|------|---------|-------------|
305
+ | `config` | `ChartConfiguration` | — | chart.js configuration object |
306
+ | `width` | `number` | `800` | Canvas width in pixels |
307
+ | `height` | `number` | `500` | Canvas height in pixels |
308
+ | `...rest` | `Omit<ComponentProps<"img">, "src">` | — | All standard `<img>` attributes except `src` |
309
+
310
+ ---
311
+
312
+ ### `chartFunction`
313
+
314
+ Samples a numeric function into a data array for chart datasets. Produces `sample + 1` values evaluated at `n * step` for `n` in `0..sample`.
315
+
316
+ ```ts
317
+ chartFunction(func, options?)
318
+ ```
319
+
320
+ | Param | Type | Default | Description |
321
+ |-------|------|---------|-------------|
322
+ | `func` | `(n: number) => number` | — | Function to sample |
323
+ | `options.step` | `number` | `1` | Multiplier applied to the index before calling `func` |
324
+ | `options.sample` | `number` | `100` | Number of intervals (yields `sample + 1` points) |
325
+
326
+ ```tsx
327
+ import { Chart, chartFunction } from "@weasyprint-tsx/ui";
328
+
329
+ <Chart config={{
330
+ type: "line",
331
+ data: {
332
+ labels: chartFunction(n => n, { step: 0.1 }),
333
+ datasets: [{ label: "sin(x)", data: chartFunction(Math.sin, { step: 0.1 }) }],
334
+ },
335
+ }} />
336
+ ```
337
+
338
+ ---
339
+
340
+ ### `labelFunction`
341
+
342
+ Same as `chartFunction` but the sampling function may return a `number` or `string`. Use to generate axis labels.
343
+
344
+ ```ts
345
+ labelFunction(func, options?)
346
+ ```
347
+
348
+ | Param | Type | Default | Description |
349
+ |-------|------|---------|-------------|
350
+ | `func` | `(n: number) => number \| string` | — | Function to sample |
351
+ | `options.step` | `number` | `1` | Multiplier applied to the index |
352
+ | `options.sample` | `number` | `100` | Number of intervals (yields `sample + 1` values) |
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@weasyprint-tsx/ui",
3
- "version": "0.1.7",
3
+ "version": "0.1.14",
4
4
  "exports": {
5
5
  ".": "./src/index.ts"
6
6
  },
7
7
  "types": "./src/index.ts",
8
8
  "dependencies": {
9
+ "@napi-rs/canvas": "^1.0.0",
10
+ "chart.js": "^4.5.1",
9
11
  "highlight.js": "11.11.1",
10
- "katex": "^0.16.47"
12
+ "katex": "^0.16.47",
13
+ "qrcode": "^1.5.4"
14
+ },
15
+ "devDependencies": {
16
+ "@types/qrcode": "^1.5.6"
11
17
  }
12
18
  }
@@ -0,0 +1,54 @@
1
+ import { createCanvas } from "@napi-rs/canvas";
2
+ import type { ChartConfiguration } from "chart.js";
3
+ import { Chart as ChartJS } from "chart.js/auto";
4
+ import { ComponentProps } from "preact";
5
+
6
+ export interface ChartProps extends Omit<ComponentProps<"img">, "src"> {
7
+ config: ChartConfiguration;
8
+ width?: number;
9
+ height?: number;
10
+ }
11
+
12
+ export function Chart({
13
+ config,
14
+ width = 800,
15
+ height = 500,
16
+ ...props
17
+ }: ChartProps) {
18
+ const canvas = createCanvas(width, height);
19
+
20
+ const chart = new ChartJS(canvas as unknown as HTMLCanvasElement, {
21
+ ...config,
22
+ options: {
23
+ ...config.options,
24
+ animation: false,
25
+ responsive: false,
26
+ },
27
+ });
28
+
29
+ const dataUrl = `data:image/png;base64,${canvas.toBuffer("image/png").toString("base64")}`;
30
+ chart.destroy();
31
+
32
+ return <img src={dataUrl} width={width} height={height} {...props} />;
33
+ }
34
+
35
+ type FunctionOptions = {
36
+ step?: number;
37
+ sample?: number;
38
+ };
39
+
40
+ export function chartFunction(
41
+ func: (n: number) => number,
42
+ options?: FunctionOptions,
43
+ ) {
44
+ const { sample = 100, step = 1 } = options ?? {};
45
+ return Array.from({ length: sample + 1 }, (_, n) => func(n * step));
46
+ }
47
+
48
+ export function labelFunction(
49
+ func: (n: number) => number | string,
50
+ options?: FunctionOptions
51
+ ) {
52
+ const { sample = 100, step = 1 } = options ?? {};
53
+ return Array.from({ length: sample + 1 }, (_, n) => func(n * step));
54
+ }
@@ -5,7 +5,10 @@ import { ComponentProps } from "preact";
5
5
  import styles from "./Equation.module.css";
6
6
  import { joinClasses } from "./utils";
7
7
 
8
- export interface EquationProps extends Omit<ComponentProps<"span">, "children"> {
8
+ export interface EquationProps extends Omit<
9
+ ComponentProps<"span">,
10
+ "children"
11
+ > {
9
12
  tex: string;
10
13
  displayMode?: boolean;
11
14
  aligned?: boolean;
@@ -71,10 +74,10 @@ export function functionFactory(txt: string, init: string = "x") {
71
74
 
72
75
  function formatNumber(tex: string | undefined) {
73
76
  if (!tex) return "";
74
- return tex.replace(/\d+(?:\.\d+)?/g, (match) => {
75
- const [intPart, decPart] = match.split(".");
77
+ return tex.replace(/(?:\d{4,}(?:[\.|\,]\d+)?|\d+[\.|\,]\d{4,})/g, (match) => {
78
+ const [intPart, decPart] = match.split(/\.|\,/);
76
79
  const formattedInt = intPart.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1\\,");
77
- if (decPart === undefined) return formattedInt;
80
+ if (decPart === undefined) return `${formattedInt}\\:`;
78
81
  const formattedDec = decPart.replace(/(\d{3})(?=\d)/g, "$1\\,");
79
82
  return `${formattedInt},${formattedDec}\\:`;
80
83
  });
@@ -0,0 +1,53 @@
1
+ import { createCanvas } from "@napi-rs/canvas";
2
+ import { ComponentProps } from "preact";
3
+ import { create as createQR } from "qrcode";
4
+
5
+ export interface QrCodeProps extends Omit<ComponentProps<"img">, "src"> {
6
+ href: string;
7
+ size?: number;
8
+ margin?: number;
9
+ color?: string;
10
+ bgColor?: string;
11
+ }
12
+
13
+ export function QrCode({
14
+ color = "#000",
15
+ bgColor = "transparent",
16
+ href,
17
+ size = 200,
18
+ margin = 4,
19
+ ...props
20
+ }: QrCodeProps) {
21
+ const qr = createQR(href);
22
+ const moduleCount = qr.modules.size;
23
+ const cellSize = Math.floor((size - margin * 2) / moduleCount);
24
+ const actualSize = cellSize * moduleCount + margin * 2;
25
+
26
+ const canvas = createCanvas(actualSize, actualSize);
27
+ const ctx = canvas.getContext("2d");
28
+
29
+ ctx.fillStyle = bgColor;
30
+ ctx.fillRect(0, 0, actualSize, actualSize);
31
+
32
+ ctx.fillStyle = color;
33
+ for (let row = 0; row < moduleCount; row++) {
34
+ for (let col = 0; col < moduleCount; col++) {
35
+ if (qr.modules.get(row, col)) {
36
+ ctx.fillRect(
37
+ margin + col * cellSize,
38
+ margin + row * cellSize,
39
+ cellSize,
40
+ cellSize,
41
+ );
42
+ }
43
+ }
44
+ }
45
+
46
+ const dataUrl = `data:image/png;base64,${canvas.toBuffer("image/png").toString("base64")}`;
47
+
48
+ return (
49
+ <a href={href}>
50
+ <img src={dataUrl} width={actualSize} height={actualSize} {...props} />
51
+ </a>
52
+ );
53
+ }
@@ -1,3 +1,5 @@
1
+ export { Chart, chartFunction, labelFunction } from "./Chart";
2
+ export type { ChartProps } from "./Chart";
1
3
  export { Block, BlockBox } from "./BlockBox";
2
4
  export type { BlockBoxProps, BlockProps } from "./BlockBox";
3
5
  export { CodeBlock } from "./CodeBlock";
@@ -18,6 +20,8 @@ export { Stack } from "./Stack";
18
20
  export type { StackProps } from "./Stack";
19
21
  export { Entry, Table } from "./Table";
20
22
  export type { TableEntryProps, TableProps } from "./Table";
23
+ export { QrCode } from "./QrCode";
24
+ export type { QrCodeProps } from "./QrCode";
21
25
  export { H1, H2, H3, H4, H5, H6, ResetCounter, Title } from "./Titles";
22
26
  export type { Hprops, Htype, TitleProps } from "./Titles";
23
27
  export * from "./utils";
package/testUI/index.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { Eq, Equation, functionFactory } from "@weasyprint-tsx/ui";
1
+ import { Equation, functionFactory, LtX, QrCode } from "@weasyprint-tsx/ui";
2
2
  import "./index.css";
3
3
 
4
4
  const S = functionFactory("S" , "x")
@@ -11,11 +11,14 @@ export default function Document() {
11
11
  <title>weasyprint-tsx</title>
12
12
  <link rel="stylesheet" href="index.css" />
13
13
  </head>
14
- <body>
14
+ <body className="bg-red-500">
15
15
  <Equation tex="C_m = 50000.0000000000000000001 g/L"></Equation>
16
- <Eq>151545312313513.13543545345343 a151515131 .13513513</Eq>
16
+ <Equation tex="C_{1000} = 151545312313513.13543545345343 g/L"></Equation>
17
+ <LtX>151545312313513.13543545345343</LtX>
17
18
  <S/>
18
19
  <S>g</S>
20
+
21
+ <QrCode className="w-1/4" size={50} href="https://fr.wikipedia.org/wiki/Fichier:Laser,_principe_de_fonctionnement.ogv"/>
19
22
  </body>
20
23
  </html>
21
24
  );