satori 0.16.2 → 0.18.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 +30 -2
- package/dist/index.cjs +8 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/standalone.cjs +8 -0
- package/dist/standalone.cjs.LEGAL.txt +4 -0
- package/dist/standalone.cjs.map +1 -0
- package/dist/standalone.d.cts +173 -0
- package/dist/standalone.d.ts +173 -0
- package/dist/standalone.js +8 -0
- package/dist/standalone.js.LEGAL.txt +4 -0
- package/dist/standalone.js.map +1 -0
- package/package.json +17 -10
- package/yoga.wasm +0 -0
package/README.md
CHANGED
|
@@ -204,7 +204,7 @@ Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Na
|
|
|
204
204
|
|
|
205
205
|
<tr><td rowspan="7">Background</td></tr>
|
|
206
206
|
<tr><td><code>backgroundColor</code></td><td>Supported, single value</td><td></td></tr>
|
|
207
|
-
<tr><td><code>backgroundImage</code></td><td><code>linear-gradient</code>, <code>radial-gradient</code>, <code>url</code>, single value</td><td></td></tr>
|
|
207
|
+
<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>
|
|
208
208
|
<tr><td><code>backgroundPosition</code></td><td>Support single value</td><td></td></tr>
|
|
209
209
|
<tr><td><code>backgroundSize</code></td><td>Support two-value size i.e. <code>10px 20%</code></td><td></td></tr>
|
|
210
210
|
<tr><td><code>backgroundClip</code></td><td><code>border-box</code>, <code>text</code></td><td></td></tr>
|
|
@@ -228,6 +228,12 @@ Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Na
|
|
|
228
228
|
<td></td>
|
|
229
229
|
</tr>
|
|
230
230
|
|
|
231
|
+
<tr>
|
|
232
|
+
<td colspan="2"><code>objectPosition</code></td>
|
|
233
|
+
<td>Support keywords: <code>top</code>, <code>bottom</code>, <code>left</code>, <code>right</code>, <code>center</code>, and combinations like <code>top left</code>. Defaults to <code>center</code>.</td>
|
|
234
|
+
<td></td>
|
|
235
|
+
</tr>
|
|
236
|
+
|
|
231
237
|
<tr>
|
|
232
238
|
<td colspan="2"><code>opacity</code></td>
|
|
233
239
|
<td>Supported</td>
|
|
@@ -396,7 +402,29 @@ await satori(
|
|
|
396
402
|
|
|
397
403
|
### Runtime Support
|
|
398
404
|
|
|
399
|
-
Satori can be used in browser, Node.js (>= 16), and Web Workers.
|
|
405
|
+
Satori can be directly used in browser, Node.js (>= 16), and Web Workers. It bundles its underlying WASM dependencies as base64-encoded strings and loads them at runtime.
|
|
406
|
+
|
|
407
|
+
If there is a limitation on dynamically loading WASM (e.g. Cloudflare Workers), you can use the Standalone Build which is mentioned below.
|
|
408
|
+
|
|
409
|
+
#### Standalone Build of Satori
|
|
410
|
+
|
|
411
|
+
Satori's standalone build doesn't include Yoga's WASM binary by default, and you need to load it manually before using Satori.
|
|
412
|
+
|
|
413
|
+
First, you need to download the `yoga.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:
|
|
414
|
+
|
|
415
|
+
```jsx
|
|
416
|
+
import satori, { init } from 'satori/standalone'
|
|
417
|
+
|
|
418
|
+
const res = await fetch('https://unpkg.com/satori/yoga.wasm')
|
|
419
|
+
const yogaWasm = await res.arrayBuffer()
|
|
420
|
+
|
|
421
|
+
await init(yogaWasm)
|
|
422
|
+
|
|
423
|
+
// Now you can use satori as usual
|
|
424
|
+
const svg = await satori(...)
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
Of course, you can also load the `yoga.wasm` file from your local disk via `fs.readFile` in Node.js or other methods.
|
|
400
428
|
|
|
401
429
|
### Font Embedding
|
|
402
430
|
|