jaml-ui 0.1.0 → 0.2.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.
Files changed (37) hide show
  1. package/README.md +27 -0
  2. package/dist/components/GameCard.d.ts +8 -4
  3. package/dist/components/GameCard.js +8 -8
  4. package/dist/data/balatro-jokers.json +1241 -0
  5. package/dist/decode/motelyItemDecoder.d.ts +49 -5
  6. package/dist/decode/motelyItemDecoder.js +227 -8
  7. package/dist/motely.d.ts +1 -1
  8. package/dist/motely.js +1 -1
  9. package/dist/r3f/BalatroJokerMesh3D.d.ts +8 -0
  10. package/dist/r3f/BalatroJokerMesh3D.js +98 -0
  11. package/dist/r3f/BalatroJokerPreview3D.d.ts +14 -0
  12. package/dist/r3f/BalatroJokerPreview3D.js +30 -0
  13. package/dist/r3f/BalatroPlayingCard3D.d.ts +22 -0
  14. package/dist/r3f/BalatroPlayingCard3D.js +62 -0
  15. package/dist/r3f/cardConstants.d.ts +16 -0
  16. package/dist/r3f/cardConstants.js +14 -0
  17. package/dist/r3f/compositedAtlas.d.ts +5 -0
  18. package/dist/r3f/compositedAtlas.js +56 -0
  19. package/dist/r3f/gridUV.d.ts +22 -0
  20. package/dist/r3f/gridUV.js +30 -0
  21. package/dist/r3f/index.d.ts +12 -0
  22. package/dist/r3f/index.js +13 -0
  23. package/dist/r3f/jokerRegistry.d.ts +28 -0
  24. package/dist/r3f/jokerRegistry.js +40 -0
  25. package/dist/r3f/jokerTilt.d.ts +8 -0
  26. package/dist/r3f/jokerTilt.js +41 -0
  27. package/dist/r3f/magneticTilt.d.ts +18 -0
  28. package/dist/r3f/magneticTilt.js +34 -0
  29. package/dist/r3f/playingCardTypes.d.ts +24 -0
  30. package/dist/r3f/playingCardTypes.js +32 -0
  31. package/dist/r3f/playingCardVisuals.d.ts +7 -0
  32. package/dist/r3f/playingCardVisuals.js +45 -0
  33. package/dist/r3f/usePlayingCardTexture.d.ts +7 -0
  34. package/dist/r3f/usePlayingCardTexture.js +92 -0
  35. package/dist/render/CanvasRenderer.d.ts +2 -1
  36. package/dist/render/CanvasRenderer.js +31 -3
  37. package/package.json +30 -10
package/README.md CHANGED
@@ -17,6 +17,8 @@ Balatro rendering components, sprite metadata, and optional Motely helpers for R
17
17
  npm install jaml-ui react react-dom
18
18
  ```
19
19
 
20
+ **Latest published major features:** `0.2.x` adds `jaml-ui/r3f` (Three.js card meshes). If you need `0.2.0` from npm and hit Windows publish issues, see [PUBLISHING.md](./PUBLISHING.md) and use GitHub Actions or Linux to `npm publish`.
21
+
20
22
  If you want the Motely-specific helpers too:
21
23
 
22
24
  ```bash
@@ -88,9 +90,34 @@ const itemName = decodeMotelyItemName(0x5001);
88
90
  const enumKey = motelyItemTypeName(0x5001);
89
91
  ```
90
92
 
93
+ ## Three.js / R3F (optional)
94
+
95
+ `jaml-ui/r3f` provides **magnetic-tilt** meshes for playing cards and jokers. Peer dependencies (install in your app):
96
+
97
+ - `three`
98
+ - `@react-three/fiber`
99
+ - `@react-spring/three`
100
+
101
+ ```tsx
102
+ "use client";
103
+
104
+ import { BalatroPlayingCard3D, BalatroJokerPreview3D } from "jaml-ui/r3f";
105
+
106
+ // In an existing <Canvas>: BalatroPlayingCard3D with card={{ suit, rank, ... }}
107
+ // Standalone joker preview:
108
+ export function Preview() {
109
+ return <BalatroJokerPreview3D displayName="Blueprint" />;
110
+ }
111
+ ```
112
+
113
+ Atlas URLs default to packaged sprites; override with `setJamlAssetBaseUrl("/your/public/images/")` or per-component `deckUrl` / `jokersImageUrl` props.
114
+
115
+ Bundled data: `balatro-jokers.json` ships in `dist/data/` for joker grid lookup.
116
+
91
117
  ## Next.js notes
92
118
 
93
119
  - The root `jaml-ui` entry is client-oriented and preserves the `"use client"` boundary for component consumers.
120
+ - Add `jaml-ui/r3f` to `transpilePackages` when you use the R3F entry.
94
121
  - Import pure helpers from `jaml-ui/core` when you want server-safe metadata and asset utilities.
95
122
  - If you are consuming `jaml-ui` from a local workspace package in a Next.js app, you may need:
96
123
 
@@ -13,6 +13,7 @@ export interface JamlGameCardProps {
13
13
  };
14
14
  type: "joker" | "consumable" | "playing";
15
15
  className?: string;
16
+ hoverTilt?: boolean;
16
17
  }
17
18
  export type AnalyzerShopItem = {
18
19
  id: string;
@@ -31,22 +32,25 @@ export type AnalyzerResolvedItem = {
31
32
  label: string;
32
33
  };
33
34
  export declare function resolveAnalyzerShopItem(item: AnalyzerShopItem, scale?: number): AnalyzerResolvedItem;
34
- export declare function JamlGameCard({ card, type, className }: JamlGameCardProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function JamlGameCard({ card, type, className, hoverTilt }: JamlGameCardProps): import("react/jsx-runtime").JSX.Element;
35
36
  export interface VoucherProps {
36
37
  voucherName: string;
37
38
  scale?: number;
38
39
  className?: string;
40
+ hoverTilt?: boolean;
39
41
  }
40
- export declare function JamlVoucher({ voucherName, scale, className }: VoucherProps): import("react/jsx-runtime").JSX.Element | null;
42
+ export declare function JamlVoucher({ voucherName, scale, className, hoverTilt }: VoucherProps): import("react/jsx-runtime").JSX.Element | null;
41
43
  export interface TagProps {
42
44
  tagName: string;
43
45
  scale?: number;
44
46
  className?: string;
47
+ hoverTilt?: boolean;
45
48
  }
46
- export declare function JamlTag({ tagName, scale, className }: TagProps): import("react/jsx-runtime").JSX.Element | null;
49
+ export declare function JamlTag({ tagName, scale, className, hoverTilt }: TagProps): import("react/jsx-runtime").JSX.Element | null;
47
50
  export interface BossProps {
48
51
  bossName: string;
49
52
  scale?: number;
50
53
  className?: string;
54
+ hoverTilt?: boolean;
51
55
  }
52
- export declare function JamlBoss({ bossName, scale, className }: BossProps): import("react/jsx-runtime").JSX.Element | null;
56
+ export declare function JamlBoss({ bossName, scale, className, hoverTilt }: BossProps): import("react/jsx-runtime").JSX.Element | null;
@@ -198,7 +198,7 @@ export function resolveAnalyzerShopItem(item, scale = 1) {
198
198
  }
199
199
  return packedResolved ?? { kind: "unknown", label: displayName };
200
200
  }
201
- export function JamlGameCard({ card, type, className = "" }) {
201
+ export function JamlGameCard({ card, type, className = "", hoverTilt = false }) {
202
202
  const { name, edition, isEternal, isPerishable, isRental, rank, suit, enhancements, seal, scale = 1 } = card;
203
203
  const layers = [];
204
204
  if (type === "joker") {
@@ -299,9 +299,9 @@ export function JamlGameCard({ card, type, className = "" }) {
299
299
  }
300
300
  }
301
301
  const wrapperStyle = { width: `${71 * scale}px` };
302
- return (_jsx("div", { style: wrapperStyle, className: className, children: _jsx(JamlCardRenderer, { invert: edition === "Negative", layers: layers }) }));
302
+ return (_jsx("div", { style: wrapperStyle, className: className, children: _jsx(JamlCardRenderer, { invert: edition === "Negative", layers: layers, hoverTilt: hoverTilt }) }));
303
303
  }
304
- export function JamlVoucher({ voucherName, scale = 1, className = "" }) {
304
+ export function JamlVoucher({ voucherName, scale = 1, className = "", hoverTilt = false }) {
305
305
  const voucherData = VOUCHERS.find((v) => v.name === voucherName);
306
306
  if (!voucherData)
307
307
  return null;
@@ -315,9 +315,9 @@ export function JamlVoucher({ voucherName, scale = 1, className = "" }) {
315
315
  }),
316
316
  ];
317
317
  const wrapperStyle = { width: `${71 * scale}px` };
318
- return (_jsx("div", { style: wrapperStyle, className: className, children: _jsx(JamlCardRenderer, { layers: layers }) }));
318
+ return (_jsx("div", { style: wrapperStyle, className: className, children: _jsx(JamlCardRenderer, { layers: layers, hoverTilt: hoverTilt }) }));
319
319
  }
320
- export function JamlTag({ tagName, scale = 1, className = "" }) {
320
+ export function JamlTag({ tagName, scale = 1, className = "", hoverTilt = false }) {
321
321
  const tagData = TAGS.find((t) => t.name === tagName);
322
322
  if (!tagData)
323
323
  return null;
@@ -331,9 +331,9 @@ export function JamlTag({ tagName, scale = 1, className = "" }) {
331
331
  }),
332
332
  ];
333
333
  const wrapperStyle = { width: `${71 * scale}px` };
334
- return (_jsx("div", { style: wrapperStyle, className: className, children: _jsx(JamlCardRenderer, { layers: layers }) }));
334
+ return (_jsx("div", { style: wrapperStyle, className: className, children: _jsx(JamlCardRenderer, { layers: layers, hoverTilt: hoverTilt }) }));
335
335
  }
336
- export function JamlBoss({ bossName, scale = 1, className = "" }) {
336
+ export function JamlBoss({ bossName, scale = 1, className = "", hoverTilt = false }) {
337
337
  const bossData = BOSSES.find((b) => b.name === bossName);
338
338
  if (!bossData)
339
339
  return null;
@@ -347,5 +347,5 @@ export function JamlBoss({ bossName, scale = 1, className = "" }) {
347
347
  }),
348
348
  ];
349
349
  const wrapperStyle = { width: `${71 * scale}px` };
350
- return (_jsx("div", { style: wrapperStyle, className: className, children: _jsx(JamlCardRenderer, { layers: layers }) }));
350
+ return (_jsx("div", { style: wrapperStyle, className: className, children: _jsx(JamlCardRenderer, { layers: layers, hoverTilt: hoverTilt }) }));
351
351
  }