mtg-crucible 0.4.10 → 0.4.11
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 +9 -12
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,6 @@ Rarity: Mythic Rare
|
|
|
29
29
|
Art URL: https://raw.githubusercontent.com/domainellipticlanguage/mtg-crucible/refs/heads/main/examples/crucible-art.png
|
|
30
30
|
`);
|
|
31
31
|
|
|
32
|
-
// result.frontFace is a Uint8Array — fs accepts it directly:
|
|
33
32
|
writeFileSync('crucible-of-legends.png', result.frontFace);
|
|
34
33
|
```
|
|
35
34
|
|
|
@@ -100,7 +99,7 @@ Front-face image size for a typical card:
|
|
|
100
99
|
| medium (745×1040) | 1167 KB | 233 KB | 86 KB |
|
|
101
100
|
| high (2010×2814) | 5529 KB | 1013 KB | 355 KB |
|
|
102
101
|
|
|
103
|
-
WebP uses lossy quality 60/70/80 for low/medium/high.
|
|
102
|
+
WebP uses lossy quality 60/70/80 for low/medium/high.
|
|
104
103
|
|
|
105
104
|
### `parseCard(text: string): CardData`
|
|
106
105
|
|
|
@@ -199,11 +198,15 @@ Instead of `----`, you can use one of `--transform--`, `--mdfc--`, `--split--`,
|
|
|
199
198
|
Crucible provides a React component for rendering cards.
|
|
200
199
|
|
|
201
200
|
```tsx
|
|
201
|
+
import { renderCard, toDisplayCard } from 'mtg-crucible';
|
|
202
202
|
import { MtgCard } from 'mtg-crucible/react';
|
|
203
203
|
|
|
204
|
+
const result = await renderCard(...);
|
|
205
|
+
const renderedCardDisplay = toDisplayCard(result);
|
|
206
|
+
|
|
204
207
|
<MtgCard
|
|
205
208
|
card={renderedCardDisplay}
|
|
206
|
-
cardText=
|
|
209
|
+
cardText={renderedCardDisplay.scryfallText} // invisible overlay, searchable with Ctrl+F
|
|
207
210
|
/>
|
|
208
211
|
```
|
|
209
212
|
|
|
@@ -266,18 +269,13 @@ await fetch('/upload', { method: 'POST', body: blob });
|
|
|
266
269
|
|
|
267
270
|
### Assets (`assetBaseUrl`)
|
|
268
271
|
|
|
269
|
-
The browser build does **not** bundle the ~
|
|
272
|
+
The browser build does **not** bundle the ~14 MB of frame assets. Frames, masks, symbols, and fonts are fetched **on demand** — only the ones a given card needs — and cached by the browser's HTTP cache. By default they come from a Cloudflare Pages CDN, versioned by *asset* major version (decoupled from the package version, so consumers across package versions share one warm cache):
|
|
270
273
|
|
|
271
274
|
```
|
|
272
|
-
https://
|
|
275
|
+
https://mtg-crucible-assets-v<N>.pages.dev/
|
|
273
276
|
```
|
|
274
277
|
|
|
275
|
-
|
|
276
|
-
> over ~150 MB, and this package's frame assets push it past that — the npm path
|
|
277
|
-
> (`/npm/mtg-crucible@<version>/assets/`) returns **403**. The `gh` source has no
|
|
278
|
-
> such limit and serves the same files with permissive CORS. (unpkg serves them
|
|
279
|
-
> too, but rate-limits the burst of symbol requests on first render.) This is the
|
|
280
|
-
> recommended base URL.
|
|
278
|
+
Assets are served with permissive CORS and a one-year `immutable` cache, so each file is fetched at most once and reused across renders, sessions, and every site on the CDN.
|
|
281
279
|
|
|
282
280
|
To self-host the assets (the `assets/` folder is included in the npm package), override the base URL **before** your first `renderCard`:
|
|
283
281
|
|
|
@@ -292,7 +290,6 @@ Notes:
|
|
|
292
290
|
- Fonts are loaded with `FontFace` and awaited before any text is drawn.
|
|
293
291
|
- Non-Chromium browsers may rasterize text slightly differently than the Node (`@napi-rs/canvas`) output; this is expected and acceptable.
|
|
294
292
|
|
|
295
|
-
A runnable example lives in [`examples/browser/`](examples/browser/) — `npm run example:browser` builds it and serves it (with the repo's own assets) at <http://localhost:5173>.
|
|
296
293
|
|
|
297
294
|
|
|
298
295
|
## Development
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.4.
|
|
1
|
+
export declare const VERSION = "0.4.11";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED