jaml-ui 0.1.0 → 0.3.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 +37 -0
- package/dist/components/GameCard.d.ts +8 -4
- package/dist/components/GameCard.js +8 -8
- package/dist/components/JamlIde.d.ts +17 -0
- package/dist/components/JamlIde.js +61 -0
- package/dist/components/JamlIdeToolbar.d.ts +8 -0
- package/dist/components/JamlIdeToolbar.js +36 -0
- package/dist/components/JamlMapPreview.d.ts +10 -0
- package/dist/components/JamlMapPreview.js +117 -0
- package/dist/data/balatro-jokers.json +1241 -0
- package/dist/decode/motelyItemDecoder.d.ts +49 -5
- package/dist/decode/motelyItemDecoder.js +227 -8
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/motely.d.ts +1 -1
- package/dist/motely.js +1 -1
- package/dist/r3f/BalatroJokerMesh3D.d.ts +8 -0
- package/dist/r3f/BalatroJokerMesh3D.js +98 -0
- package/dist/r3f/BalatroJokerPreview3D.d.ts +14 -0
- package/dist/r3f/BalatroJokerPreview3D.js +30 -0
- package/dist/r3f/BalatroPlayingCard3D.d.ts +22 -0
- package/dist/r3f/BalatroPlayingCard3D.js +62 -0
- package/dist/r3f/cardConstants.d.ts +16 -0
- package/dist/r3f/cardConstants.js +14 -0
- package/dist/r3f/compositedAtlas.d.ts +5 -0
- package/dist/r3f/compositedAtlas.js +56 -0
- package/dist/r3f/gridUV.d.ts +22 -0
- package/dist/r3f/gridUV.js +30 -0
- package/dist/r3f/index.d.ts +12 -0
- package/dist/r3f/index.js +13 -0
- package/dist/r3f/jokerRegistry.d.ts +28 -0
- package/dist/r3f/jokerRegistry.js +40 -0
- package/dist/r3f/jokerTilt.d.ts +8 -0
- package/dist/r3f/jokerTilt.js +41 -0
- package/dist/r3f/magneticTilt.d.ts +18 -0
- package/dist/r3f/magneticTilt.js +34 -0
- package/dist/r3f/playingCardTypes.d.ts +24 -0
- package/dist/r3f/playingCardTypes.js +32 -0
- package/dist/r3f/playingCardVisuals.d.ts +7 -0
- package/dist/r3f/playingCardVisuals.js +45 -0
- package/dist/r3f/usePlayingCardTexture.d.ts +7 -0
- package/dist/r3f/usePlayingCardTexture.js +92 -0
- package/dist/render/CanvasRenderer.d.ts +2 -1
- package/dist/render/CanvasRenderer.js +31 -3
- package/dist/utils/jamlMapPreview.d.ts +12 -0
- package/dist/utils/jamlMapPreview.js +105 -0
- package/package.json +11 -3
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const CLAUSE_VISUAL_TYPES = {
|
|
2
|
+
joker: "joker",
|
|
3
|
+
jokers: "joker",
|
|
4
|
+
commonJoker: "joker",
|
|
5
|
+
commonJokers: "joker",
|
|
6
|
+
uncommonJoker: "joker",
|
|
7
|
+
uncommonJokers: "joker",
|
|
8
|
+
rareJoker: "joker",
|
|
9
|
+
rareJokers: "joker",
|
|
10
|
+
mixedJoker: "joker",
|
|
11
|
+
mixedJokers: "joker",
|
|
12
|
+
soulJoker: "joker",
|
|
13
|
+
legendaryJoker: "joker",
|
|
14
|
+
voucher: "voucher",
|
|
15
|
+
vouchers: "voucher",
|
|
16
|
+
tarot: "consumable",
|
|
17
|
+
tarotCard: "consumable",
|
|
18
|
+
spectral: "consumable",
|
|
19
|
+
spectralCard: "consumable",
|
|
20
|
+
planet: "consumable",
|
|
21
|
+
planetCard: "consumable",
|
|
22
|
+
boss: "boss",
|
|
23
|
+
bosses: "boss",
|
|
24
|
+
tag: "tag",
|
|
25
|
+
tags: "tag",
|
|
26
|
+
smallBlindTag: "tag",
|
|
27
|
+
bigBlindTag: "tag",
|
|
28
|
+
};
|
|
29
|
+
function createEmptyGroups() {
|
|
30
|
+
return { must: [], should: [], mustNot: [] };
|
|
31
|
+
}
|
|
32
|
+
function stripWrappingQuotes(value) {
|
|
33
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
34
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
35
|
+
return value.slice(1, -1).trim();
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
function normalizeCandidateValue(value) {
|
|
40
|
+
const normalized = stripWrappingQuotes(value.trim()).replace(/,$/, "").trim();
|
|
41
|
+
if (!normalized)
|
|
42
|
+
return null;
|
|
43
|
+
if (normalized === "Any")
|
|
44
|
+
return null;
|
|
45
|
+
return normalized;
|
|
46
|
+
}
|
|
47
|
+
function parseInlineValues(raw) {
|
|
48
|
+
const trimmed = raw.trim();
|
|
49
|
+
if (!trimmed)
|
|
50
|
+
return [];
|
|
51
|
+
if (trimmed.startsWith("[") && trimmed.includes("]")) {
|
|
52
|
+
const body = trimmed.slice(1, trimmed.indexOf("]"));
|
|
53
|
+
return body
|
|
54
|
+
.split(",")
|
|
55
|
+
.map((value) => normalizeCandidateValue(value))
|
|
56
|
+
.filter((value) => Boolean(value));
|
|
57
|
+
}
|
|
58
|
+
const normalized = normalizeCandidateValue(trimmed);
|
|
59
|
+
return normalized ? [normalized] : [];
|
|
60
|
+
}
|
|
61
|
+
export function extractVisualJamlItems(jaml) {
|
|
62
|
+
const groups = createEmptyGroups();
|
|
63
|
+
const seen = new Set();
|
|
64
|
+
const lines = jaml.replace(/\r\n/g, "\n").split("\n");
|
|
65
|
+
let currentSection = null;
|
|
66
|
+
for (const rawLine of lines) {
|
|
67
|
+
const trimmed = rawLine.trim();
|
|
68
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
69
|
+
continue;
|
|
70
|
+
const sectionMatch = /^(must|should|mustNot):\s*$/.exec(trimmed);
|
|
71
|
+
if (sectionMatch) {
|
|
72
|
+
currentSection = sectionMatch[1];
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const indent = rawLine.search(/\S|$/);
|
|
76
|
+
if (indent === 0 && /^[A-Za-z][A-Za-z0-9]*:\s*/.test(trimmed)) {
|
|
77
|
+
currentSection = null;
|
|
78
|
+
}
|
|
79
|
+
if (!currentSection)
|
|
80
|
+
continue;
|
|
81
|
+
const clauseMatch = /^-?\s*([A-Za-z][A-Za-z0-9]*):\s*(.*?)\s*$/.exec(trimmed);
|
|
82
|
+
if (!clauseMatch)
|
|
83
|
+
continue;
|
|
84
|
+
const clauseKey = clauseMatch[1];
|
|
85
|
+
const visualType = CLAUSE_VISUAL_TYPES[clauseKey];
|
|
86
|
+
if (!visualType)
|
|
87
|
+
continue;
|
|
88
|
+
const values = parseInlineValues(clauseMatch[2]);
|
|
89
|
+
for (const value of values) {
|
|
90
|
+
const dedupeKey = `${currentSection}:${visualType}:${value.toLowerCase()}`;
|
|
91
|
+
if (seen.has(dedupeKey))
|
|
92
|
+
continue;
|
|
93
|
+
seen.add(dedupeKey);
|
|
94
|
+
groups[currentSection].push({
|
|
95
|
+
id: dedupeKey,
|
|
96
|
+
section: currentSection,
|
|
97
|
+
clauseKey,
|
|
98
|
+
visualType,
|
|
99
|
+
value,
|
|
100
|
+
source: rawLine,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return groups;
|
|
105
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jaml-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Balatro rendering components, sprite metadata, and optional Motely helpers for React apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/OptimusPi/jaml-ui"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/OptimusPi/jaml-ui#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/OptimusPi/jaml-ui/issues"
|
|
50
|
+
},
|
|
43
51
|
"keywords": [
|
|
44
52
|
"balatro",
|
|
45
53
|
"jaml",
|
|
@@ -52,7 +60,7 @@
|
|
|
52
60
|
"author": "pifreak",
|
|
53
61
|
"license": "MIT",
|
|
54
62
|
"peerDependencies": {
|
|
55
|
-
"motely-wasm": "
|
|
63
|
+
"motely-wasm": "^10.2.0",
|
|
56
64
|
"react": "^18.2.0 || ^19.0.0",
|
|
57
65
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
58
66
|
},
|
|
@@ -64,7 +72,7 @@
|
|
|
64
72
|
"devDependencies": {
|
|
65
73
|
"@types/react": "^19.2.14",
|
|
66
74
|
"@types/react-dom": "^19.2.3",
|
|
67
|
-
"motely-wasm": "^
|
|
75
|
+
"motely-wasm": "^10.2.0",
|
|
68
76
|
"react": "^19.2.4",
|
|
69
77
|
"react-dom": "^19.2.4",
|
|
70
78
|
"typescript": "^5.9.3"
|