jaml-ui 0.14.1 → 0.14.3
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/dist/components/AnalyzerExplorer.js +0 -11
- package/dist/components/JamlAestheticSelector.js +1 -3
- package/dist/components/JamlAnalyzerFullscreen.js +3 -3
- package/dist/components/JamlIde.js +0 -2
- package/dist/components/JamlSeedInput.js +1 -2
- package/dist/components/JamlSpeedometer.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/ui/codeBlock.js +1 -1
- package/dist/ui/jimboCopyRow.js +1 -2
- package/dist/ui/jimboFilterBar.js +2 -4
- package/dist/ui/showcase.js +4 -4
- package/package.json +5 -3
- package/dist/components/PlayingCard.d.ts +0 -18
- package/dist/components/PlayingCard.js +0 -80
- package/dist/data/balatro-jokers.json +0 -1241
- package/dist/r3f/BalatroJokerMesh3D.d.ts +0 -8
- package/dist/r3f/BalatroJokerMesh3D.js +0 -98
- package/dist/r3f/BalatroJokerPreview3D.d.ts +0 -14
- package/dist/r3f/BalatroJokerPreview3D.js +0 -30
- package/dist/r3f/BalatroPlayingCard3D.d.ts +0 -22
- package/dist/r3f/BalatroPlayingCard3D.js +0 -62
- package/dist/r3f/cardConstants.d.ts +0 -16
- package/dist/r3f/cardConstants.js +0 -14
- package/dist/r3f/compositedAtlas.d.ts +0 -5
- package/dist/r3f/compositedAtlas.js +0 -56
- package/dist/r3f/gridUV.d.ts +0 -22
- package/dist/r3f/gridUV.js +0 -30
- package/dist/r3f/index.d.ts +0 -12
- package/dist/r3f/index.js +0 -13
- package/dist/r3f/jokerRegistry.d.ts +0 -28
- package/dist/r3f/jokerRegistry.js +0 -40
- package/dist/r3f/jokerTilt.d.ts +0 -8
- package/dist/r3f/jokerTilt.js +0 -41
- package/dist/r3f/magneticTilt.d.ts +0 -18
- package/dist/r3f/magneticTilt.js +0 -34
- package/dist/r3f/playingCardTypes.d.ts +0 -24
- package/dist/r3f/playingCardTypes.js +0 -32
- package/dist/r3f/playingCardVisuals.d.ts +0 -7
- package/dist/r3f/playingCardVisuals.js +0 -45
- package/dist/r3f/usePlayingCardTexture.d.ts +0 -7
- package/dist/r3f/usePlayingCardTexture.js +0 -92
- package/dist/utils/fileSystem.d.ts +0 -1
- package/dist/utils/fileSystem.js +0 -23
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export const PLAYING_CARD_ATLAS = {
|
|
2
|
-
columns: 13,
|
|
3
|
-
rows: 4,
|
|
4
|
-
cellPx: { x: 71, y: 95 },
|
|
5
|
-
};
|
|
6
|
-
export const SUIT_ROW = {
|
|
7
|
-
hearts: 0,
|
|
8
|
-
clubs: 1,
|
|
9
|
-
diamonds: 2,
|
|
10
|
-
spades: 3,
|
|
11
|
-
};
|
|
12
|
-
export const RANK_COLUMN = {
|
|
13
|
-
"2": 0,
|
|
14
|
-
"3": 1,
|
|
15
|
-
"4": 2,
|
|
16
|
-
"5": 3,
|
|
17
|
-
"6": 4,
|
|
18
|
-
"7": 5,
|
|
19
|
-
"8": 6,
|
|
20
|
-
"9": 7,
|
|
21
|
-
"10": 8,
|
|
22
|
-
J: 9,
|
|
23
|
-
Q: 10,
|
|
24
|
-
K: 11,
|
|
25
|
-
A: 12,
|
|
26
|
-
};
|
|
27
|
-
export const SUIT_COLORS = {
|
|
28
|
-
hearts: "#e74c3c",
|
|
29
|
-
diamonds: "#3498db",
|
|
30
|
-
clubs: "#27ae60",
|
|
31
|
-
spades: "#2c3e50",
|
|
32
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { PlayingCard3DModel } from "./playingCardTypes.js";
|
|
2
|
-
export declare function editionMaterialProps(edition: PlayingCard3DModel["edition"]): {
|
|
3
|
-
metalness: number;
|
|
4
|
-
roughness: number;
|
|
5
|
-
};
|
|
6
|
-
export declare function enhancementGlowHex(card: PlayingCard3DModel, highlighted: boolean): string;
|
|
7
|
-
export declare function sealColorHex(seal: PlayingCard3DModel["seal"]): string;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { SUIT_COLORS } from "./playingCardTypes.js";
|
|
2
|
-
export function editionMaterialProps(edition) {
|
|
3
|
-
switch (edition) {
|
|
4
|
-
case "foil":
|
|
5
|
-
return { metalness: 0.9, roughness: 0.1 };
|
|
6
|
-
case "holographic":
|
|
7
|
-
return { metalness: 0.7, roughness: 0.2 };
|
|
8
|
-
case "polychrome":
|
|
9
|
-
return { metalness: 0.8, roughness: 0.15 };
|
|
10
|
-
default:
|
|
11
|
-
return { metalness: 0.1, roughness: 0.8 };
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export function enhancementGlowHex(card, highlighted) {
|
|
15
|
-
switch (card.enhancement) {
|
|
16
|
-
case "bonus":
|
|
17
|
-
return "#3498db";
|
|
18
|
-
case "mult":
|
|
19
|
-
return "#e74c3c";
|
|
20
|
-
case "wild":
|
|
21
|
-
return "#9b59b6";
|
|
22
|
-
case "glass":
|
|
23
|
-
return "#1abc9c";
|
|
24
|
-
case "steel":
|
|
25
|
-
return "#95a5a6";
|
|
26
|
-
case "gold":
|
|
27
|
-
return "#f1c40f";
|
|
28
|
-
case "lucky":
|
|
29
|
-
return "#2ecc71";
|
|
30
|
-
default:
|
|
31
|
-
return highlighted ? SUIT_COLORS[card.suit] : "#ffffff";
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export function sealColorHex(seal) {
|
|
35
|
-
switch (seal) {
|
|
36
|
-
case "gold":
|
|
37
|
-
return "#f1c40f";
|
|
38
|
-
case "red":
|
|
39
|
-
return "#e74c3c";
|
|
40
|
-
case "blue":
|
|
41
|
-
return "#3498db";
|
|
42
|
-
default:
|
|
43
|
-
return "#9b59b6";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { type PlayingCardRank, type PlayingCardSuit } from "./playingCardTypes.js";
|
|
3
|
-
export declare function usePlayingCardFaceTexture(suit: PlayingCardSuit, rank: PlayingCardRank, options?: {
|
|
4
|
-
deckUrl?: string;
|
|
5
|
-
enhancersUrl?: string;
|
|
6
|
-
}): THREE.Texture | null;
|
|
7
|
-
export declare function useCardBackTexture(): THREE.Texture;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import * as THREE from "three";
|
|
4
|
-
import { resolveJamlAssetUrl } from "../assets.js";
|
|
5
|
-
import { applyBalatroGridUV } from "./gridUV.js";
|
|
6
|
-
import { loadCompositedPlayingAtlas } from "./compositedAtlas.js";
|
|
7
|
-
import { PLAYING_CARD_ATLAS, RANK_COLUMN, SUIT_ROW, } from "./playingCardTypes.js";
|
|
8
|
-
const textureCache = new Map();
|
|
9
|
-
function magnetKey(suit, rank, deckUrl, enhancersUrl) {
|
|
10
|
-
return `${deckUrl}|${enhancersUrl}|${suit}|${rank}`;
|
|
11
|
-
}
|
|
12
|
-
export function usePlayingCardFaceTexture(suit, rank, options) {
|
|
13
|
-
const [texture, setTexture] = useState(null);
|
|
14
|
-
const loadSerial = useRef(0);
|
|
15
|
-
const deckUrl = options?.deckUrl ?? resolveJamlAssetUrl("deck");
|
|
16
|
-
const enhancersUrl = options?.enhancersUrl ?? resolveJamlAssetUrl("enhancers");
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const serial = ++loadSerial.current;
|
|
19
|
-
let cancelled = false;
|
|
20
|
-
const key = magnetKey(suit, rank, deckUrl, enhancersUrl);
|
|
21
|
-
const cached = textureCache.get(key);
|
|
22
|
-
if (cached) {
|
|
23
|
-
setTexture(cached);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
loadCompositedPlayingAtlas(deckUrl, PLAYING_CARD_ATLAS.columns, PLAYING_CARD_ATLAS.rows, enhancersUrl)
|
|
27
|
-
.then((canvas) => {
|
|
28
|
-
if (cancelled || serial !== loadSerial.current)
|
|
29
|
-
return;
|
|
30
|
-
const tex = new THREE.CanvasTexture(canvas);
|
|
31
|
-
tex.colorSpace = THREE.SRGBColorSpace;
|
|
32
|
-
tex.magFilter = THREE.NearestFilter;
|
|
33
|
-
tex.minFilter = THREE.NearestFilter;
|
|
34
|
-
const tw = canvas.width;
|
|
35
|
-
const th = canvas.height;
|
|
36
|
-
const cellW = tw / PLAYING_CARD_ATLAS.columns;
|
|
37
|
-
const cellH = th / PLAYING_CARD_ATLAS.rows;
|
|
38
|
-
applyBalatroGridUV(tex, { x: RANK_COLUMN[rank], y: SUIT_ROW[suit] }, {
|
|
39
|
-
cellW,
|
|
40
|
-
cellH,
|
|
41
|
-
textureWidth: tw,
|
|
42
|
-
textureHeight: th,
|
|
43
|
-
});
|
|
44
|
-
textureCache.set(key, tex);
|
|
45
|
-
setTexture(tex);
|
|
46
|
-
})
|
|
47
|
-
.catch((err) => {
|
|
48
|
-
console.error("[jaml-ui/r3f] playing card atlas failed:", err);
|
|
49
|
-
});
|
|
50
|
-
return () => {
|
|
51
|
-
cancelled = true;
|
|
52
|
-
};
|
|
53
|
-
}, [suit, rank, deckUrl, enhancersUrl]);
|
|
54
|
-
return texture;
|
|
55
|
-
}
|
|
56
|
-
export function useCardBackTexture() {
|
|
57
|
-
const [tex] = useState(() => {
|
|
58
|
-
const canvas = document.createElement("canvas");
|
|
59
|
-
canvas.width = PLAYING_CARD_ATLAS.cellPx.x;
|
|
60
|
-
canvas.height = PLAYING_CARD_ATLAS.cellPx.y;
|
|
61
|
-
const ctx = canvas.getContext("2d");
|
|
62
|
-
if (!ctx)
|
|
63
|
-
throw new Error("2d context unavailable");
|
|
64
|
-
ctx.fillStyle = "#1a1a2e";
|
|
65
|
-
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
66
|
-
ctx.strokeStyle = "#c9a227";
|
|
67
|
-
ctx.lineWidth = 2;
|
|
68
|
-
ctx.strokeRect(2, 2, canvas.width - 4, canvas.height - 4);
|
|
69
|
-
ctx.fillStyle = "#16213e";
|
|
70
|
-
for (let y = 8; y < canvas.height - 8; y += 10) {
|
|
71
|
-
for (let x = 8; x < canvas.width - 8; x += 10) {
|
|
72
|
-
ctx.fillRect(x, y, 5, 5);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
ctx.fillStyle = "#c9a227";
|
|
76
|
-
const cx = canvas.width / 2;
|
|
77
|
-
const cy = canvas.height / 2;
|
|
78
|
-
ctx.beginPath();
|
|
79
|
-
ctx.moveTo(cx, cy - 17);
|
|
80
|
-
ctx.lineTo(cx + 14, cy);
|
|
81
|
-
ctx.lineTo(cx, cy + 17);
|
|
82
|
-
ctx.lineTo(cx - 14, cy);
|
|
83
|
-
ctx.closePath();
|
|
84
|
-
ctx.fill();
|
|
85
|
-
const texture = new THREE.CanvasTexture(canvas);
|
|
86
|
-
texture.magFilter = THREE.NearestFilter;
|
|
87
|
-
texture.minFilter = THREE.NearestFilter;
|
|
88
|
-
texture.colorSpace = THREE.SRGBColorSpace;
|
|
89
|
-
return texture;
|
|
90
|
-
});
|
|
91
|
-
return tex;
|
|
92
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function initJamlFileSystem(): boolean;
|
package/dist/utils/fileSystem.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { init } from "@rewaffle/bootsharp-file-system";
|
|
2
|
-
// Assuming motely-wasm exposes Bootsharp APIs
|
|
3
|
-
// We need to pass the FileMounter export generated by Bootsharp
|
|
4
|
-
import * as motelyWasm from "motely-wasm";
|
|
5
|
-
export function initJamlFileSystem() {
|
|
6
|
-
if (motelyWasm && motelyWasm.Bootsharp && motelyWasm.Bootsharp.FileSystem) {
|
|
7
|
-
const fileMounter = motelyWasm.Bootsharp.FileSystem.FileMounter;
|
|
8
|
-
if (fileMounter) {
|
|
9
|
-
init(fileMounter);
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
// Also try lowercase namespaces depending on how bootsharp generates it
|
|
14
|
-
if (motelyWasm && motelyWasm.bootsharp && motelyWasm.bootsharp.fileSystem) {
|
|
15
|
-
const fileMounter = motelyWasm.bootsharp.fileSystem.fileMounter;
|
|
16
|
-
if (fileMounter) {
|
|
17
|
-
init(fileMounter);
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
console.warn("Could not initialize Jaml File System: Bootsharp.FileSystem.FileMounter not found in motely-wasm.");
|
|
22
|
-
return false;
|
|
23
|
-
}
|