satori 0.35.2 → 0.37.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/README.md +58 -18
- package/dist/experimental.cjs +6 -7
- package/dist/experimental.cjs.map +1 -1
- package/dist/experimental.d.cts +2 -2
- package/dist/experimental.d.ts +2 -2
- package/dist/experimental.js +6 -7
- package/dist/experimental.js.map +1 -1
- package/dist/index.cjs +6 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/standalone.cjs +6 -7
- package/dist/standalone.cjs.map +1 -1
- package/dist/standalone.d.cts +13 -4
- package/dist/standalone.d.ts +13 -4
- package/dist/standalone.js +6 -7
- package/dist/standalone.js.map +1 -1
- package/dist/{satori-dd73c891.d.ts → wasm-3bdd7431.d.ts} +13 -4
- package/layout.wasm +0 -0
- package/package.json +5 -5
- package/yoga.wasm +0 -0
package/README.md
CHANGED
|
@@ -173,7 +173,7 @@ declare module 'react' {
|
|
|
173
173
|
|
|
174
174
|
### CSS
|
|
175
175
|
|
|
176
|
-
Satori uses
|
|
176
|
+
Satori uses [Taffy](https://github.com/DioxusLabs/taffy) to lay out Flexbox, Grid and block layouts, and it’s **not** a complete CSS implementation. However, it supports a subset of the spec that covers most common CSS features:
|
|
177
177
|
|
|
178
178
|
<table>
|
|
179
179
|
<thead>
|
|
@@ -194,13 +194,19 @@ Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Na
|
|
|
194
194
|
|
|
195
195
|
<tr>
|
|
196
196
|
<td colspan="2"><code>display</code></td>
|
|
197
|
-
<td><code>flex</code>, <code>block</code>, <code>contents</code>, <code>none</code>, <code>-webkit-box</code>, default to <code>flex</code>. Use <code>flex</code>, <code>contents</code>, or <code>none</code> for <code>div</code> elements with multiple child nodes.</td>
|
|
197
|
+
<td><code>flex</code>, <code>block</code>, <code>grid</code>, <code>contents</code>, <code>none</code>, <code>-webkit-box</code>, default to <code>flex</code>. Use <code>flex</code>, <code>block</code>, <code>grid</code>, <code>contents</code>, or <code>none</code> for <code>div</code> elements with multiple child nodes. Children of <code>block</code> elements are stacked vertically, including text, and margins collapse like in CSS.</td>
|
|
198
198
|
<td></td>
|
|
199
199
|
</tr>
|
|
200
200
|
|
|
201
201
|
<tr>
|
|
202
202
|
<td colspan="2"><code>position</code></td>
|
|
203
|
-
<td><code>relative</code>, <code>static</code> and <code>
|
|
203
|
+
<td><code>relative</code>, <code>static</code>, <code>absolute</code> and <code>fixed</code>, default to <code>relative</code>. Fixed elements are positioned relative to the image, or to the nearest ancestor with <code>transform</code>, <code>perspective</code>, <code>filter</code>, <code>backdropFilter</code> or <code>transformStyle: preserve-3d</code></td>
|
|
204
|
+
<td></td>
|
|
205
|
+
</tr>
|
|
206
|
+
|
|
207
|
+
<tr>
|
|
208
|
+
<td colspan="2"><code>zIndex</code></td>
|
|
209
|
+
<td>Integers and <code>auto</code>, default to <code>auto</code>. Elements are painted in <a href="https://www.w3.org/TR/CSS22/zindex.html">stacking order</a>: positioned elements are painted above static ones, and all elements are flex items, so <code>zIndex</code> applies to static elements too</td>
|
|
204
210
|
<td></td>
|
|
205
211
|
</tr>
|
|
206
212
|
|
|
@@ -258,11 +264,20 @@ Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Na
|
|
|
258
264
|
<tr><td><code>flexGrow</code></td><td>Supported</td><td></td></tr>
|
|
259
265
|
<tr><td><code>flexShrink</code></td><td>Supported</td><td></td></tr>
|
|
260
266
|
<tr><td><code>flexBasis</code></td><td>Supported except for <code>auto</code></td><td></td></tr>
|
|
261
|
-
<tr><td><code>alignItems</code></td><td><code>stretch</code>, <code>center</code>, <code>flex-start</code>, <code>flex-end</code>, <code>baseline</code>, <code>normal</code>, default to <code>stretch</code></td><td></td></tr>
|
|
267
|
+
<tr><td><code>alignItems</code></td><td><code>stretch</code>, <code>center</code>, <code>start</code>, <code>end</code>, <code>flex-start</code>, <code>flex-end</code>, <code>baseline</code>, <code>normal</code>, default to <code>stretch</code></td><td></td></tr>
|
|
262
268
|
<tr><td><code>alignContent</code></td><td>Supported</td><td></td></tr>
|
|
263
269
|
<tr><td><code>alignSelf</code></td><td>Supported</td><td></td></tr>
|
|
264
270
|
<tr><td><code>justifyContent</code></td><td>Supported</td><td></td></tr>
|
|
265
|
-
<tr><td><code>gap</code></td><td>Supported</td><td></td></tr>
|
|
271
|
+
<tr><td><code>gap</code></td><td>Supported, with one or two values. Also <code>rowGap</code> and <code>columnGap</code></td><td></td></tr>
|
|
272
|
+
|
|
273
|
+
<tr><td rowspan="8">Grid</td></tr>
|
|
274
|
+
<tr><td><code>gridTemplateColumns</code>, <code>gridTemplateRows</code></td><td>Lengths, percentages, <code>fr</code>, <code>auto</code>, <code>min-content</code>, <code>max-content</code>, <code>minmax()</code>, <code>fit-content()</code>, <code>repeat()</code> with a count, <code>auto-fill</code> or <code>auto-fit</code>, and line names</td><td></td></tr>
|
|
275
|
+
<tr><td><code>gridTemplateAreas</code></td><td>Supported</td><td></td></tr>
|
|
276
|
+
<tr><td><code>gridAutoColumns</code>, <code>gridAutoRows</code></td><td>Supported</td><td></td></tr>
|
|
277
|
+
<tr><td><code>gridAutoFlow</code></td><td><code>row</code>, <code>column</code> and <code>dense</code>, default to <code>row</code></td><td></td></tr>
|
|
278
|
+
<tr><td><code>gridRow</code>, <code>gridColumn</code>, <code>gridArea</code></td><td>Line numbers, spans, line names and area names. Also the longhands, e.g. <code>gridColumnStart</code></td><td></td></tr>
|
|
279
|
+
<tr><td><code>justifyItems</code>, <code>justifySelf</code></td><td><code>stretch</code>, <code>center</code>, <code>start</code>, <code>end</code>, <code>left</code>, <code>right</code>, <code>baseline</code>, <code>normal</code></td><td></td></tr>
|
|
280
|
+
<tr><td>Shorthands (<code>grid</code>, <code>gridTemplate</code>)</td><td>Not supported</td><td></td></tr>
|
|
266
281
|
|
|
267
282
|
<tr><td rowspan="6">Font</td></tr>
|
|
268
283
|
<tr><td><code>fontFamily</code></td><td>Supported</td><td></td></tr>
|
|
@@ -290,16 +305,17 @@ Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Na
|
|
|
290
305
|
<tr><td><code>backgroundImage</code></td><td><code>linear-gradient</code>, <code>repeating-linear-gradient</code>, <code>radial-gradient</code>, <code>repeating-radial-gradient</code>, <code>url</code>, single value</td><td></td></tr>
|
|
291
306
|
<tr><td><code>backgroundPosition</code></td><td>Support single value</td><td></td></tr>
|
|
292
307
|
<tr><td><code>backgroundSize</code></td><td>Support <code>cover</code>, <code>contain</code>, <code>auto</code>, and two-value sizes i.e. <code>10px 20%</code></td><td><a href="https://og-playground.vercel.app/?share=ZZXXjqNIFIZfpeWb2RW9Itik3tmRwAQDJgeDNTfkHEwwYdTvvnhGWq003HDOqZ8fDlX11Y9D2Ebx4ePwNcqf35u3t2Fcq_ifHz9e8dtbFudpNn68wRD0_qsy59GY_b8Q-GGZ9u3UREbcxf4u_tK0f_U_4y-_acx8i3dF2Dajnze_jwu1n74EU1_9Efmj_5G_CmDXpH8H_hBjp_fcoVVjhiQ-ban9Ukw7Y-10j3j9ldtnyttvND6LubMHTABVrO4YJypeXGSdBtuwwCRWANMRpy7W49jmUFvuyU0fnmZeduAiZ6ZZaueUXM0V5VDBNs2OtfX6MimW0iTTBD0JeYbFeSOrpLGR5_iMkrHGYSAGEFJl77xRCsjNDC_MmIHV8KDOdsboszJAXchEZifrokEtSyrT5cUkbkifODIuyKC2oblXy8yAqyt-VLcJr8UhYJc2PGoWrW4dppebvMnexThypKZD-IRPx2dFjjnj3eAxqMU1XLTipNKFhrv-1Te3ZWE41aKHtHUogVtC98ZlniyqI9lkcOS5xQnRSlTV0-tKaHckalSGADnQlda0i12YNG7wcO3J-IrGTiWLXtviZ6tc1LDpTrmyhe5uybE1CSYwMHinsikaLkdSepmcxdufvxhlwGcYZFBUF9yqXt9fIT5MC0L3H99JUi4UOqz4PPHkFsq72zM8WjYnYGqRWukUlGh4gcFkBi7zyiOuA0c-D4-VW-zWoSnBLSFHV2qkeLMWcwGd7jWpWVCi5AgElPbN7TB1vJpQbagUW4USzTgmUwZs5ckWiKtbeoovGVYKVZYplg37_NjrsGiWVdUBSYO2HADFotULPEJ1kl-3_QMDRpkEjjNQJkq5rpYMXk6gMN14z9Nh9lIhURHsoqlSm5QUTb2sFTs1ag4JjyqDx8eRoJY24GdbW3E7mrfC2jYpulOIfsX9q8znWkYJIU1Lpl3RHbd1jvHq2hVJ27w8Hu0DQtHereC9qSlsH2pBzdY8HbMclOVBaxkCNQPbCS280YnTjDj1vRVdXk2GTcHUtcLIC2kuZmc-F0CjT5O0bxLguUZX0-46gocAOemyO9ud16EQRYoEzoUHKbUT2c6Z6iVo8ikGz_c28GlfMMZFXId-3ndkk55Y6pEpLu00ERw5DiE5ibPw6Jg0pxiXMCDPY5Xv0ooyy07SOY2ItUJA0GcAc95NKKS17ERr91XBFBjo7kTiSi-nM-MjY9_WyXH_6BRO6OxOPK9k9bA925tNd9HmcmRzKI6YXmAFWWNmoOixTTtukLU1GRFeZIuaqTM24QNH063N0Ubq86kAJkdSfl7B89Dt0_KkVXVtMRYgb4Wsogggys-O-89XYZGtuDtasBrKY6ZmsIg42314VQNix3wBqQC70a0ODgxY3BbqKvgnxsscyioJTTAUoJHSrXUiwWwtLqtAakcVCILGBrn4C1p0-WKUzlCXhIAKTFUJTXzV9zXLWaU56fX5_OfvsDy3VdvvsJyzfIy_vEY_P783376CO8u_fW8O74e2G_O2GQ4fPw4_wX34IHZwH35h_fBxeiVRHEzp4SPxqyF-P8R1W-TW2r3OhHH-me0-yc5rtg7i6PAx9lP8-X4Y_WBXZHFVtXPbV9Hh818">Example</a></td></tr>
|
|
293
|
-
<tr><td><code>backgroundClip</code></td><td><code>border-box</code>, <code>text</code></td><td></td></tr>
|
|
308
|
+
<tr><td><code>backgroundClip</code></td><td><code>border-box</code>, <code>padding-box</code>, <code>content-box</code>, <code>text</code>, also as <code>WebkitBackgroundClip</code></td><td></td></tr>
|
|
294
309
|
<tr><td><code>backgroundRepeat</code></td><td><code>repeat</code>, <code>repeat-x</code>, <code>repeat-y</code>, <code>no-repeat</code>, defaults to <code>repeat</code></td><td></td></tr>
|
|
295
310
|
|
|
296
|
-
<tr><td rowspan="
|
|
311
|
+
<tr><td rowspan="8"><code>transform</code></td></tr>
|
|
297
312
|
<tr><td>Translate (<code>translate</code>, <code>translateX</code>, <code>translateY</code>, <code>translateZ</code>, <code>translate3d</code>)</td><td>Supported, with <code>px</code>, <code>em</code>, <code>rem</code>, <code>vw</code> and <code>vh</code> lengths, and percentages of the element's size along X and Y</td><td></td></tr>
|
|
298
313
|
<tr><td>Rotate (<code>rotate</code>, <code>rotateX</code>, <code>rotateY</code>, <code>rotateZ</code>, <code>rotate3d</code>)</td><td>Supported, with <code>deg</code>, <code>rad</code>, <code>grad</code> and <code>turn</code> angles</td><td></td></tr>
|
|
299
314
|
<tr><td>Scale (<code>scale</code>, <code>scaleX</code>, <code>scaleY</code>, <code>scaleZ</code>, <code>scale3d</code>)</td><td>Supported, including percentages</td><td></td></tr>
|
|
300
315
|
<tr><td>Skew (<code>skew</code>, <code>skewX</code>, <code>skewY</code>)</td><td>Supported</td><td></td></tr>
|
|
301
316
|
<tr><td>Matrix (<code>matrix</code>, <code>matrix3d</code>)</td><td>Supported</td><td></td></tr>
|
|
302
317
|
<tr><td>Perspective (<code>perspective</code>)</td><td>Approximated, see the notes below</td><td></td></tr>
|
|
318
|
+
<tr><td>The <code>transform</code> attribute of inline <code><svg></code></td><td>Transforms the element like the property, which takes precedence</td><td></td></tr>
|
|
303
319
|
|
|
304
320
|
<tr>
|
|
305
321
|
<td colspan="2"><code>transformOrigin</code></td>
|
|
@@ -349,6 +365,18 @@ Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Na
|
|
|
349
365
|
<td></td>
|
|
350
366
|
</tr>
|
|
351
367
|
|
|
368
|
+
<tr>
|
|
369
|
+
<td colspan="2"><code>mixBlendMode</code></td>
|
|
370
|
+
<td>All blend modes. Elements blend with what's painted below them in their stacking context</td>
|
|
371
|
+
<td></td>
|
|
372
|
+
</tr>
|
|
373
|
+
|
|
374
|
+
<tr>
|
|
375
|
+
<td colspan="2"><code>isolation</code></td>
|
|
376
|
+
<td><code>auto</code>, <code>isolate</code>, defaults to <code>auto</code></td>
|
|
377
|
+
<td></td>
|
|
378
|
+
</tr>
|
|
379
|
+
|
|
352
380
|
<tr>
|
|
353
381
|
<td colspan="2"><code>boxSizing</code></td>
|
|
354
382
|
<td>Supported</td>
|
|
@@ -398,14 +426,26 @@ Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Na
|
|
|
398
426
|
<tr><td><code>maskRepeat</code></td><td><code>repeat</code>, <code>repeat-x</code>, <code>repeat-y</code>, <code>no-repeat</code>, defaults to <code>repeat</code></td><td><a href="https://og-playground.vercel.app/?share=nVbpjqNIEn6VkqXVzMg1AhtjQ-3MStwGA-Ywl9U_hssJ5jSHAbf63TdxdfXUzh4_FhllHF8cGZkm4usirKJ48bb4LUrvX8qXl7ab8vj3r19n-uUliVOQdG8vP61Q9G8_vb4LhzTqkr_IorStc3-C0ksejx_SmWbTJg67tCqhLqzyvig_tH6eglLs4qKdVXHZxc2H6tq3XXqZmAoKyzn-v6ovUG6mj_jtBVt_Ejnfs92i6Hdp4IcZaKq-jKCPvsl_jvzOf0sLH8RIXYK_B34bbzevqU0fjQE9CKCi4KOaVsJZAFK0PvMaQ3lwYbPiSNqzgHJV00BFqmk34XaGiEbucHlxslDqMNtRAJpyJkUpM0NTFAcXzqco6ztPUSbggs-8BTgY_AMvwl9UU9Qz_lPvPP0-WaiEz6zinkKoPwLIs9_lkGcATGEO-o6jTUANn3iKeJJ2F-6CJ58PJp8_ICFzA7QeFZqSbqHwBOW1zSeow62UY6HeAxNPzgKZnk18E7jfU2LHzbFMulBY5ZHAgVhYtUGpbGMWTT3HuHuFtZ35wLFRzyRScQ-2EDNEQkuKeaJaDM0GmJSLrNcrzGYQr5uDyFBA20vZ-VqbBuf98BkWRqGZUhXtjeGYEvcIizC5DB9yQU7niRiPpwyXH9QkP8RJdqF9unrEDo56Luig_fXD9yf_3NlVr2GRw3zye5DS01nwtp4j3SNXJ8VU_IH_eD9ygfjifEVTf2-gIVvd5TUO8-CzYC3l8rNWJOo750J-cHBfRKqB6rMf4t2-1mDsPCiN5Bn_uhk15t3umJGT79h9JPCQJ_tP9oSM_YfcP-rGwFrAPViZIUAbiH2v97P-p81BsHcJDc-ZWvGSwfHWkRZUm-8UDuWsMsJM7ITXvl8YYxpVaWIcDFuQMp-lDYZXUyUzNVLX4KYTMBgGNxwFaEUoF84QWe6mXMYz13GVeU91ISF0sPF8oDNpbYtxHVWOmSxRzOXLyHCzEenHcHk5as7liJUdRl2SjhWUE3PZ2gdM43nDPrEUGwnJxHISvL6WuHksd8qjuK66bTDEQyKKHu5qIGNFxvAo5byyizvKZ1y7x28hf-CjZXAw2EGzWn_bP04b2lbtMx3Y0jpXaDNktVtXbPH7o8A3k8q5jhVNxsBWhe0F8jqqYqJnr17XAO9o1UZrAcDRo3tY7Zc5wGhikM4Wilz3YTH1akMOy1XMMGOVEZokexWWlo7HMrJ4mBzVqM7u8aSyN7SWb870cAKdUCqJ6c2z3xr6gV61QqrD22-O_pRosq3iHQHGzFRQ5Yisjo61Tseq0VByWxKmdVrHa9fRk122bBpiUHnDCTG_OR28OudwcW0E4qGozUaOdnHZRLesiUbXkbg1bku7lGdSrNTYBlHqgxtVdr9RjvZyd8xXd4BUYBvou7VvXLoxGkldoSrXdvmzRHnurQiLi9WfDPsgi_dJE5cB4pIZG6gaVm1qkrxQVSUqZU3d0bDMtxfdU3kSiVwJKVrPXy8HaWAJzNBDjq4entTprFOeWL32HNwX1u2dXVfSQJQeeyMecFNHn6ezUUmaO9md4uaKL3twybpTNuQ1QYGym8gitAjRu7DoFaQkWHI7miNzZ2UUsuEE2LlmjNrpp5XTh3mM-eXt_mi2O1kor9tBsfwbxgILhzkJ68PRPh25nlhRkxTTuWQq6dWVpp3BVPWq6ree34P7ivDPAljuwsQbB8fxjnTSn-lsx7sPMdwQe48zB3lI0rI02Vgz2kBmsColkI3M3QuwOSUEzZuCd99fNIykkP0YINFwL6LNUiQmKiAPoo5PqkVFGc1fEaQtxrW6psdO4C5IhRxC1916J3mrxeDerWKcRC_0etLjCiR7IexI2eG0w57VB4S0zd53hq0xZI7sNuqZ2ka4KhmHvBQke2sbO_gn013TtlADlAmPyZEcSqsdVrqFl8IbmAgqnY9pFukjifCFN1mcGPOEFPsIAi-V0rgqfdMZSlIkpEGa4ua3J44SQ4thMqQRr8ujjuxUKgCIq3Iaheg6fbOvF2qN895725IMC-eaTAIA_P77Lx_NvfDbTJw79NvLH3laxn7zK2j8KIUTwM9d9dLMPf71Jcj7-PWla_yyrf0G6n7545P9-3AwTyj1-LJaz8tn90Zcx_48VjRP4tcfSicOsrRTPmXwl6GhvYPlWOQfg4O2V9fnicZ8x0B92OyOLDWIKV2dnbz097B5XMGgMCKICnsK1_MHGk0VczNCzBp-2DG9IDeaKQ4iSwHlJEIsNSrXp49N4Ix9-PjUXGCjiyYcUyb8HhbhfcYpDPmIijDVruPguUYlCjBmho4KMzxUk6Yhpn2-zDDILNeqJ0g_LKDDWDI7v0_dKLMZpJWVyHM45NeqOazgikMfhgJt1KvVzuts66QiOBd5G8D9RuukjgQrFRliCZvOnMvyx0H8ezH_n-P808v_ONQ_Qf_laL99-1L-40v5GwLHXLguXhdVPQ-l7eLt6-I50C7eZpevi_eRd_E2D5GLKA56sHi7-Hkbvy7iorqmp6me5-VueHLQ0Tx5ckUQR4u3runjb6-Lzg8gIonzvBqqJo8W3_4J">Example</a></td></tr>
|
|
399
427
|
|
|
400
428
|
<tr>
|
|
401
|
-
<td rowspan="2"><code>WebkitTextStroke</code>
|
|
429
|
+
<td rowspan="2"><code>WebkitTextStroke</code></td>
|
|
402
430
|
<td><code>WebkitTextStrokeWidth</code></td>
|
|
403
|
-
<td>
|
|
431
|
+
<td>Lengths, <code>thin</code>, <code>medium</code> and <code>thick</code>. The shorthand takes the width and color in any order</td>
|
|
404
432
|
<td></td>
|
|
405
433
|
</tr>
|
|
406
434
|
<tr>
|
|
407
435
|
<td><code>WebkitTextStrokeColor</code></td>
|
|
408
|
-
<td>Supported</td>
|
|
436
|
+
<td>Supported, defaults to <code>currentColor</code></td>
|
|
437
|
+
<td></td>
|
|
438
|
+
</tr>
|
|
439
|
+
|
|
440
|
+
<tr>
|
|
441
|
+
<td colspan="2"><code>WebkitTextFillColor</code></td>
|
|
442
|
+
<td>Supported, defaults to <code>currentColor</code></td>
|
|
443
|
+
<td></td>
|
|
444
|
+
</tr>
|
|
445
|
+
|
|
446
|
+
<tr>
|
|
447
|
+
<td colspan="2"><code>paintOrder</code></td>
|
|
448
|
+
<td><code>normal</code>, or <code>fill</code>, <code>stroke</code> and <code>markers</code> in any order. Like browsers, text strokes are painted above the fill by default</td>
|
|
409
449
|
<td></td>
|
|
410
450
|
</tr>
|
|
411
451
|
|
|
@@ -415,7 +455,7 @@ Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Na
|
|
|
415
455
|
Note:
|
|
416
456
|
|
|
417
457
|
1. 3D transforms are drawn like in browsers, with two differences. Elements in a `preserve-3d` context are drawn back to front by the depth of their centers, and elements that intersect aren't cut where they cross. Perspective is approximated: each element is drawn with the affine transform closest to it around its center, which is exact for elements facing the viewer, such as `translateZ()`. `satori/experimental` [draws perspective exactly](#perspective-experimental).
|
|
418
|
-
2.
|
|
458
|
+
2. Elements are painted in stacking order, see `zIndex`. Unlike browsers, `opacity` applies to each shape of an element instead of the element as a group.
|
|
419
459
|
3. `calc` isn't supported.
|
|
420
460
|
4. `currentColor` support is only available for the `color` property.
|
|
421
461
|
5. CSS variables (custom properties) are supported, including inheritance, fallback values, and nested variables.
|
|
@@ -556,23 +596,23 @@ If there is a limitation on dynamically loading WASM (e.g. Cloudflare Workers),
|
|
|
556
596
|
|
|
557
597
|
#### Standalone Build of Satori
|
|
558
598
|
|
|
559
|
-
Satori's standalone build doesn't include
|
|
599
|
+
Satori's standalone build doesn't include the WASM binary of its layout engine by default, and you need to load it manually before using Satori.
|
|
560
600
|
|
|
561
|
-
First, you need to download the `
|
|
601
|
+
First, you need to download the `layout.wasm` binary from [Satori build](https://unpkg.com/satori/) and provide it yourself. Let's use `fetch` to load it directly from the CDN as an example:
|
|
562
602
|
|
|
563
603
|
```jsx
|
|
564
604
|
import satori, { init } from 'satori/standalone'
|
|
565
605
|
|
|
566
|
-
const res = await fetch('https://unpkg.com/satori/
|
|
567
|
-
const
|
|
606
|
+
const res = await fetch('https://unpkg.com/satori/layout.wasm')
|
|
607
|
+
const layoutWasm = await res.arrayBuffer()
|
|
568
608
|
|
|
569
|
-
await init(
|
|
609
|
+
await init(layoutWasm)
|
|
570
610
|
|
|
571
611
|
// Now you can use satori as usual
|
|
572
612
|
const svg = await satori(...)
|
|
573
613
|
```
|
|
574
614
|
|
|
575
|
-
Of course, you can also load the `
|
|
615
|
+
Of course, you can also load the `layout.wasm` file from your local disk via `fs.readFile` in Node.js or other methods.
|
|
576
616
|
|
|
577
617
|
### Font Embedding
|
|
578
618
|
|
|
@@ -592,7 +632,7 @@ const svg = await satori(
|
|
|
592
632
|
|
|
593
633
|
### Pixel Grid Rounding
|
|
594
634
|
|
|
595
|
-
Set `pointScaleFactor` to control how layout values are rounded to the pixel grid
|
|
635
|
+
Set `pointScaleFactor` to control how layout values are rounded to the pixel grid: they are rounded to multiples of `1 / pointScaleFactor` px, or not rounded with `0`. It defaults to `1`, and higher values improve rendering precision on high-DPI displays.
|
|
596
636
|
|
|
597
637
|
```jsx
|
|
598
638
|
const svg = await satori(
|