weasyprint-tsx 0.1.4 → 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.pdf +0 -0
- package/bun.lock +67 -3
- package/package.json +1 -1
- package/packages/ui/package.json +6 -2
- package/packages/ui/src/Equation.tsx +7 -4
- package/packages/ui/src/QrCode.tsx +53 -0
- package/packages/ui/src/index.ts +2 -0
- package/testUI/index.tsx +6 -3
package/ReadMe.pdf
CHANGED
|
Binary file
|
package/bun.lock
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"packages/build": {
|
|
9
9
|
"name": "@weasyprint-tsx/build",
|
|
10
|
-
"version": "0.1.
|
|
10
|
+
"version": "0.1.6",
|
|
11
11
|
"bin": {
|
|
12
12
|
"weasyprint-tsx": "./src/cli.ts",
|
|
13
13
|
},
|
|
@@ -24,19 +24,23 @@
|
|
|
24
24
|
},
|
|
25
25
|
"packages/create": {
|
|
26
26
|
"name": "@weasyprint-tsx/create",
|
|
27
|
-
"version": "0.1.
|
|
27
|
+
"version": "0.1.1",
|
|
28
28
|
"bin": {
|
|
29
29
|
"create-weasyprint-tsx": "cli.js",
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
"packages/ui": {
|
|
33
33
|
"name": "@weasyprint-tsx/ui",
|
|
34
|
-
"version": "0.1.
|
|
34
|
+
"version": "0.1.13",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@napi-rs/canvas": "^1.0.0",
|
|
37
37
|
"chart.js": "^4.5.1",
|
|
38
38
|
"highlight.js": "11.11.1",
|
|
39
39
|
"katex": "^0.16.47",
|
|
40
|
+
"qrcode": "^1.5.4",
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/qrcode": "^1.5.6",
|
|
40
44
|
},
|
|
41
45
|
},
|
|
42
46
|
},
|
|
@@ -119,26 +123,52 @@
|
|
|
119
123
|
|
|
120
124
|
"@types/node": ["@types/node@25.9.3", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-603BddQMv3pUcr4U2dhujk83N2tTDVr/34wII2B6bJy6g+8WD6yUb11jszNs0gdi4PesVWl7ABt8nYMVpnLUcg=="],
|
|
121
125
|
|
|
126
|
+
"@types/qrcode": ["@types/qrcode@1.5.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw=="],
|
|
127
|
+
|
|
122
128
|
"@weasyprint-tsx/build": ["@weasyprint-tsx/build@workspace:packages/build"],
|
|
123
129
|
|
|
124
130
|
"@weasyprint-tsx/create": ["@weasyprint-tsx/create@workspace:packages/create"],
|
|
125
131
|
|
|
126
132
|
"@weasyprint-tsx/ui": ["@weasyprint-tsx/ui@workspace:packages/ui"],
|
|
127
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
|
+
|
|
128
138
|
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
|
|
129
139
|
|
|
140
|
+
"camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="],
|
|
141
|
+
|
|
130
142
|
"chart.js": ["chart.js@4.5.1", "", { "dependencies": { "@kurkle/color": "^0.3.0" } }, "sha512-GIjfiT9dbmHRiYi6Nl2yFCq7kkwdkp1W/lp2J99rX0yo9tgJGn3lKQATztIjb5tVtevcBtIdICNWqlq5+E8/Pw=="],
|
|
131
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
|
+
|
|
132
150
|
"commander": ["commander@8.3.0", "", {}, "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="],
|
|
133
151
|
|
|
152
|
+
"decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="],
|
|
153
|
+
|
|
134
154
|
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
|
135
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
|
+
|
|
136
160
|
"enhanced-resolve": ["enhanced-resolve@5.24.0", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.3" } }, "sha512-SkE2t82KlkkxQRVMVLAGKxLfORGQfrkx5dkj+vlgXRVNEdPc4eZcR+J/Fvj8C+yKSFH5L0q3NFlyufOVQnCcYQ=="],
|
|
137
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
|
+
|
|
138
166
|
"graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
|
|
139
167
|
|
|
140
168
|
"highlight.js": ["highlight.js@11.11.1", "", {}, "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w=="],
|
|
141
169
|
|
|
170
|
+
"is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
|
|
171
|
+
|
|
142
172
|
"jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="],
|
|
143
173
|
|
|
144
174
|
"katex": ["katex@0.16.47", "", { "dependencies": { "commander": "^8.3.0" }, "bin": { "katex": "cli.js" } }, "sha512-Eeo8Ys1doU1z+x8AZsPpQu+p/QcZBI5PeOo7QGQdy2x2m0MU/hYagBbGOmXwr5KVbEfVuWv9LpnQWeehogurjg=="],
|
|
@@ -167,12 +197,24 @@
|
|
|
167
197
|
|
|
168
198
|
"lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.32.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q=="],
|
|
169
199
|
|
|
200
|
+
"locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
|
|
201
|
+
|
|
170
202
|
"magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
|
|
171
203
|
|
|
172
204
|
"nanoid": ["nanoid@3.3.12", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ=="],
|
|
173
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
|
+
|
|
174
214
|
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
|
175
215
|
|
|
216
|
+
"pngjs": ["pngjs@5.0.0", "", {}, "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw=="],
|
|
217
|
+
|
|
176
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=="],
|
|
177
219
|
|
|
178
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=="],
|
|
@@ -183,14 +225,36 @@
|
|
|
183
225
|
|
|
184
226
|
"preact-render-to-string": ["preact-render-to-string@6.7.0", "", { "peerDependencies": { "preact": ">=10 || >= 11.0.0-0" } }, "sha512-Z4WR8fmLMRpdYqJ9i7vrlXSsSrxVJydwrkEXHapexfARbWfGb7vGcnvNQnIzN0cXciMVOlz/XLoiMCi9gUsy9Q=="],
|
|
185
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
|
+
|
|
186
236
|
"source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
|
|
187
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
|
+
|
|
188
242
|
"tailwindcss": ["tailwindcss@4.3.0", "", {}, "sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q=="],
|
|
189
243
|
|
|
190
244
|
"tapable": ["tapable@2.3.3", "", {}, "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A=="],
|
|
191
245
|
|
|
192
246
|
"undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="],
|
|
193
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
|
+
|
|
194
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=="],
|
|
195
259
|
|
|
196
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
package/packages/ui/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasyprint-tsx/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": "./src/index.ts"
|
|
6
6
|
},
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"@napi-rs/canvas": "^1.0.0",
|
|
10
10
|
"chart.js": "^4.5.1",
|
|
11
11
|
"highlight.js": "11.11.1",
|
|
12
|
-
"katex": "^0.16.47"
|
|
12
|
+
"katex": "^0.16.47",
|
|
13
|
+
"qrcode": "^1.5.4"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/qrcode": "^1.5.6"
|
|
13
17
|
}
|
|
14
18
|
}
|
|
@@ -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<
|
|
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(
|
|
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
|
+
}
|
package/packages/ui/src/index.ts
CHANGED
|
@@ -20,6 +20,8 @@ export { Stack } from "./Stack";
|
|
|
20
20
|
export type { StackProps } from "./Stack";
|
|
21
21
|
export { Entry, Table } from "./Table";
|
|
22
22
|
export type { TableEntryProps, TableProps } from "./Table";
|
|
23
|
+
export { QrCode } from "./QrCode";
|
|
24
|
+
export type { QrCodeProps } from "./QrCode";
|
|
23
25
|
export { H1, H2, H3, H4, H5, H6, ResetCounter, Title } from "./Titles";
|
|
24
26
|
export type { Hprops, Htype, TitleProps } from "./Titles";
|
|
25
27
|
export * from "./utils";
|
package/testUI/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
-
<
|
|
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
|
);
|