mtg-crucible 0.4.9 → 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 CHANGED
@@ -4,6 +4,8 @@ A TypeScript library for rendering custom Magic: The Gathering card images. Runs
4
4
 
5
5
  Includes a react component for rendering resulting card images, complete with card rotations for double-faced cards, etc.
6
6
 
7
+ **▶ Try it in your browser:** the [MTG Crucible Playground](https://domainellipticlanguage.com/project/mtg-crucible-playground/) renders cards live — edit via a structured UI, the plaintext format, or raw JSON.
8
+
7
9
  ## Installation
8
10
 
9
11
  ```bash
@@ -27,7 +29,6 @@ Rarity: Mythic Rare
27
29
  Art URL: https://raw.githubusercontent.com/domainellipticlanguage/mtg-crucible/refs/heads/main/examples/crucible-art.png
28
30
  `);
29
31
 
30
- // result.frontFace is a Uint8Array — fs accepts it directly:
31
32
  writeFileSync('crucible-of-legends.png', result.frontFace);
32
33
  ```
33
34
 
@@ -82,6 +83,7 @@ Options:
82
83
  - `quality` — `'high'` (2010x2814, default), `'medium'` (745x1040), or `'low'` (350x490)
83
84
  - `format` — `'png'` (default, lossless with transparency), `'jpeg'` (smaller, no transparency, white corners), or `'webp'` (smallest, with transparency)
84
85
  - `allowUnsafeArtUrls` — defaults to `false`. See [Security](#security) below.
86
+ - `suppressAttribution` — defaults to `false`. When `true`, omits the small "Powered by mtg-crucible" credit from the footer.
85
87
 
86
88
  ### `toBlob(data: Uint8Array, format?: RenderFormat): Blob`
87
89
 
@@ -97,7 +99,7 @@ Front-face image size for a typical card:
97
99
  | medium (745×1040) | 1167 KB | 233 KB | 86 KB |
98
100
  | high (2010×2814) | 5529 KB | 1013 KB | 355 KB |
99
101
 
100
- WebP uses lossy quality 60/70/80 for low/medium/high. Generate fresh numbers with `npx tsx scripts/sizes.ts`.
102
+ WebP uses lossy quality 60/70/80 for low/medium/high.
101
103
 
102
104
  ### `parseCard(text: string): CardData`
103
105
 
@@ -196,11 +198,15 @@ Instead of `----`, you can use one of `--transform--`, `--mdfc--`, `--split--`,
196
198
  Crucible provides a React component for rendering cards.
197
199
 
198
200
  ```tsx
201
+ import { renderCard, toDisplayCard } from 'mtg-crucible';
199
202
  import { MtgCard } from 'mtg-crucible/react';
200
203
 
204
+ const result = await renderCard(...);
205
+ const renderedCardDisplay = toDisplayCard(result);
206
+
201
207
  <MtgCard
202
208
  card={renderedCardDisplay}
203
- cardText="Crucible of Legends" // will be invisible, but searchable with ctrl+f
209
+ cardText={renderedCardDisplay.scryfallText} // invisible overlay, searchable with Ctrl+F
204
210
  />
205
211
  ```
206
212
 
@@ -217,6 +223,7 @@ Projects built with Crucible:
217
223
 
218
224
  - **[This Magic Card Does Not Exist](https://thismagiccarddoesnotexist.com/)** — A website for creating custom cards with AI.
219
225
  - **[Obsidian Custom MTG](https://github.com/domainellipticlanguage/obsidian-custom-mtg)** — an [Obsidian](https://obsidian.md) plugin for creating custom cards in plaintext in your vault.
226
+ - **[Command Tower MCP](https://github.com/domainellipticlanguage/command-tower-mcp)** — an MCP server for vibe-brewing Magic: The Gathering decks on Archidekt, with support for custom card creation.
220
227
 
221
228
  Built something with Crucible? Open a PR to add it here.
222
229
 
@@ -262,18 +269,13 @@ await fetch('/upload', { method: 'POST', body: blob });
262
269
 
263
270
  ### Assets (`assetBaseUrl`)
264
271
 
265
- The browser build does **not** bundle the ~190 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 the GitHub repo via jsDelivr, pinned to the release tag:
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):
266
273
 
267
274
  ```
268
- https://cdn.jsdelivr.net/gh/domainellipticlanguage/mtg-crucible@v<version>/assets/
275
+ https://mtg-crucible-assets-v<N>.pages.dev/
269
276
  ```
270
277
 
271
- > **Why the GitHub source, not jsDelivr's npm mirror?** jsDelivr rejects packages
272
- > over ~150 MB, and this package's frame assets push it past that — the npm path
273
- > (`/npm/mtg-crucible@<version>/assets/`) returns **403**. The `gh` source has no
274
- > such limit and serves the same files with permissive CORS. (unpkg serves them
275
- > too, but rate-limits the burst of symbol requests on first render.) This is the
276
- > 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.
277
279
 
278
280
  To self-host the assets (the `assets/` folder is included in the npm package), override the base URL **before** your first `renderCard`:
279
281
 
@@ -288,7 +290,6 @@ Notes:
288
290
  - Fonts are loaded with `FontFace` and awaited before any text is drawn.
289
291
  - Non-Chromium browsers may rasterize text slightly differently than the Node (`@napi-rs/canvas`) output; this is expected and acceptable.
290
292
 
291
- 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>.
292
293
 
293
294
 
294
295
  ## Development
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.4.9";
1
+ export declare const VERSION = "0.4.11";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,WAAW,CAAC"}
package/dist/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // AUTO-GENERATED by scripts/gen-version.ts — do not edit by hand.
5
- exports.VERSION = "0.4.9";
5
+ exports.VERSION = "0.4.11";
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,kEAAkE;AACrD,QAAA,OAAO,GAAG,OAAO,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,kEAAkE;AACrD,QAAA,OAAO,GAAG,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtg-crucible",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "TypeScript library for rendering custom Magic: The Gathering card images, in Node and the browser",
5
5
  "repository": {
6
6
  "type": "git",