jaml-ui 0.24.3 → 0.24.5
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/DESIGN.md +236 -236
- package/README.md +145 -147
- package/dist/components/DeckSprite.d.ts +1 -1
- package/dist/components/DeckSprite.js +1 -1
- package/dist/components/JamlCurator.d.ts +2 -1
- package/dist/components/JamlCurator.js +2 -2
- package/dist/components/JamlIde.js +39 -1
- package/dist/components/JamlMapPreview.js +9 -9
- package/dist/components/JamlSpeedometer.js +47 -2
- package/dist/components/jamlMap/CategoryPicker.js +1 -9
- package/dist/components/jamlMap/JamlMapEditor.d.ts +4 -1
- package/dist/components/jamlMap/JamlMapEditor.js +16 -8
- package/dist/components/jamlMap/JokerPicker.js +1 -13
- package/dist/components/jamlMap/index.d.ts +1 -1
- package/dist/components/jamlMap/index.js +1 -1
- package/dist/hooks/useSearch.js +25 -4
- package/dist/lib/data/constants.js +11 -15
- package/dist/lib/jaml/jamlData.js +2 -4
- package/dist/ui/jimbo.css +1420 -1761
- package/dist/ui/jimboTabs.js +2 -2
- package/dist/ui/panel.js +1 -1
- package/package.json +3 -3
|
@@ -93,18 +93,6 @@ export function JokerPicker({ onSelect, onCancel }) {
|
|
|
93
93
|
rarity: selectedRarity ?? "common",
|
|
94
94
|
});
|
|
95
95
|
}, [onSelect, selectedRarity]);
|
|
96
|
-
const handleAnySelect = useCallback(() => {
|
|
97
|
-
const rarity = selectedRarity ?? "common";
|
|
98
|
-
onSelect({
|
|
99
|
-
category: "joker",
|
|
100
|
-
value: "Any",
|
|
101
|
-
clauseKey: rarity === "legendary" ? "legendaryJoker"
|
|
102
|
-
: rarity === "rare" ? "rareJoker"
|
|
103
|
-
: rarity === "uncommon" ? "uncommonJoker"
|
|
104
|
-
: "commonJoker",
|
|
105
|
-
rarity,
|
|
106
|
-
});
|
|
107
|
-
}, [onSelect, selectedRarity]);
|
|
108
96
|
return (_jsxs("div", { style: { padding: 0, display: "flex", flexDirection: "column" }, children: [step === "rarity" && (_jsx("div", { className: "j-flex-col j-gap-sm", style: { padding: 10 }, children: ["common", "uncommon", "rare", "legendary"].map((rarity) => {
|
|
109
97
|
const meta = RARITY_META[rarity];
|
|
110
98
|
return (_jsx(JimboButton, { tone: meta.tone, size: "md", fullWidth: true, onClick: () => handleRaritySelect(rarity), children: _jsxs("span", { style: { display: "flex", flexDirection: "column", gap: 2, textAlign: "left", width: "100%" }, children: [_jsx("span", { children: meta.label }), _jsx("span", { style: { fontSize: 9, opacity: 0.7 }, children: meta.hint })] }) }, rarity));
|
|
@@ -112,7 +100,7 @@ export function JokerPicker({ onSelect, onCancel }) {
|
|
|
112
100
|
justifyContent: "space-between",
|
|
113
101
|
padding: "8px 10px",
|
|
114
102
|
borderBottom: `2px solid ${C.PANEL_EDGE}`,
|
|
115
|
-
}, children: [_jsx(JimboButton, { tone: "orange", size: "xs", onClick: () => setStep("rarity"), children: "\u2190 Back" }), _jsxs(JimboText, { size: "md", children: [RARITY_META[selectedRarity].label, " Jokers"] }), _jsx("div", { style: { width: 44 } })] }),
|
|
103
|
+
}, children: [_jsx(JimboButton, { tone: "orange", size: "xs", onClick: () => setStep("rarity"), children: "\u2190 Back" }), _jsxs(JimboText, { size: "md", children: [RARITY_META[selectedRarity].label, " Jokers"] }), _jsx("div", { style: { width: 44 } })] }), _jsx("div", { className: "j-flex j-gap-sm", style: { padding: "8px 10px 4px" }, children: _jsx("input", { className: "j-seed-input__field", type: "text", placeholder: "Search jokers...", value: search, onChange: (e) => setSearch(e.target.value), style: { fontSize: 13, padding: "6px 10px", textTransform: "none", letterSpacing: "0.04em" } }) }), selectedRarity === "legendary" && (_jsx("div", { className: "j-inner-panel", style: { margin: "4px 10px 6px", padding: "6px 10px" }, children: _jsx(JimboText, { size: "xs", tone: "purple", children: "Legendary jokers spawn from The Soul. Find it in Arcana Pack, Spectral Pack, Charm Tag, or Ethereal Tag only!" }) })), _jsxs("div", { style: {
|
|
116
104
|
display: "grid",
|
|
117
105
|
gridTemplateColumns: "repeat(auto-fill, minmax(64px, 1fr))",
|
|
118
106
|
gap: 6,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { MysterySlot, type MysterySlotProps, type SlotSelection, type SlotCategory, type JamlZone } from "./MysterySlot.js";
|
|
2
2
|
export { JokerPicker, type JokerPickerProps, type JokerRarity } from "./JokerPicker.js";
|
|
3
|
-
export { JamlMapEditor, type JamlMapEditorProps } from "./JamlMapEditor.js";
|
|
3
|
+
export { JamlMapEditor, CategoryMenu, type JamlMapEditorProps } from "./JamlMapEditor.js";
|
|
4
4
|
export { CategoryPicker, type CategoryPickerConfig, type CategoryPickerProps, VOUCHER_PICKER_CONFIG, TAG_PICKER_CONFIG, BOSS_PICKER_CONFIG, TAROT_PICKER_CONFIG, PLANET_PICKER_CONFIG, SPECTRAL_PICKER_CONFIG, PACK_PICKER_CONFIG, } from "./CategoryPicker.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { MysterySlot } from "./MysterySlot.js";
|
|
2
2
|
export { JokerPicker } from "./JokerPicker.js";
|
|
3
|
-
export { JamlMapEditor } from "./JamlMapEditor.js";
|
|
3
|
+
export { JamlMapEditor, CategoryMenu } from "./JamlMapEditor.js";
|
|
4
4
|
export { CategoryPicker, VOUCHER_PICKER_CONFIG, TAG_PICKER_CONFIG, BOSS_PICKER_CONFIG, TAROT_PICKER_CONFIG, PLANET_PICKER_CONFIG, SPECTRAL_PICKER_CONFIG, PACK_PICKER_CONFIG, } from "./CategoryPicker.js";
|
package/dist/hooks/useSearch.js
CHANGED
|
@@ -13,6 +13,7 @@ const SEARCH_WORKER_CODE = `
|
|
|
13
13
|
let MotelyWasm = null;
|
|
14
14
|
let MotelyWasmEvents = null;
|
|
15
15
|
let activeSearch = null;
|
|
16
|
+
let activeSearchRunId = 0;
|
|
16
17
|
|
|
17
18
|
self.addEventListener('message', async function(e) {
|
|
18
19
|
const msg = e.data;
|
|
@@ -35,21 +36,27 @@ self.addEventListener('message', async function(e) {
|
|
|
35
36
|
if (!MotelyWasm) { self.postMessage({ type: 'error', message: 'Not initialized' }); return; }
|
|
36
37
|
const validation = MotelyWasm.validateJaml(msg.jaml);
|
|
37
38
|
if (validation !== 'valid') { self.postMessage({ type: 'error', message: validation }); return; }
|
|
39
|
+
const runId = ++activeSearchRunId;
|
|
38
40
|
|
|
39
41
|
function cleanup() {
|
|
40
42
|
MotelyWasmEvents.notifyResult = () => {};
|
|
41
43
|
MotelyWasmEvents.notifyProgress = () => {};
|
|
42
44
|
MotelyWasmEvents.notifyComplete = () => {};
|
|
43
|
-
|
|
45
|
+
if (runId === activeSearchRunId) {
|
|
46
|
+
activeSearch = null;
|
|
47
|
+
}
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
MotelyWasmEvents.notifyResult = function(seed, score, tallyColumns) {
|
|
51
|
+
if (runId !== activeSearchRunId) return;
|
|
47
52
|
self.postMessage({ type: 'result', seed, score, tallyColumns: Array.from(tallyColumns) });
|
|
48
53
|
};
|
|
49
54
|
MotelyWasmEvents.notifyProgress = function(searched, matching) {
|
|
55
|
+
if (runId !== activeSearchRunId) return;
|
|
50
56
|
self.postMessage({ type: 'progress', searched: searched.toString(), matching: matching.toString() });
|
|
51
57
|
};
|
|
52
58
|
MotelyWasmEvents.notifyComplete = function(status, searched, matched) {
|
|
59
|
+
if (runId !== activeSearchRunId) return;
|
|
53
60
|
cleanup();
|
|
54
61
|
self.postMessage({ type: 'complete', status, searched: searched.toString(), matched: matched.toString() });
|
|
55
62
|
};
|
|
@@ -80,6 +87,10 @@ self.addEventListener('message', async function(e) {
|
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
if (msg.type === 'stop') {
|
|
90
|
+
activeSearchRunId++;
|
|
91
|
+
MotelyWasmEvents.notifyResult = () => {};
|
|
92
|
+
MotelyWasmEvents.notifyProgress = () => {};
|
|
93
|
+
MotelyWasmEvents.notifyComplete = () => {};
|
|
83
94
|
if (activeSearch) { activeSearch.cancel(); activeSearch = null; }
|
|
84
95
|
self.postMessage({ type: 'cancelled' });
|
|
85
96
|
}
|
|
@@ -150,8 +161,14 @@ export function useSearch(motelyWasmUrl) {
|
|
|
150
161
|
speedRef.current = { lastSearched: 0n, lastTime: 0, ema: 0 };
|
|
151
162
|
setState((s) => ({
|
|
152
163
|
...s,
|
|
153
|
-
status: msg.status === "Completed"
|
|
154
|
-
|
|
164
|
+
status: msg.status === "Completed"
|
|
165
|
+
? "completed"
|
|
166
|
+
: msg.status === "Cancelled"
|
|
167
|
+
? "cancelled"
|
|
168
|
+
: "error",
|
|
169
|
+
error: msg.status === "Completed" || msg.status === "Cancelled"
|
|
170
|
+
? null
|
|
171
|
+
: msg.status,
|
|
155
172
|
totalSearched: BigInt(msg.searched),
|
|
156
173
|
matchingSeeds: BigInt(msg.matched),
|
|
157
174
|
seedsPerSecond: 0,
|
|
@@ -177,6 +194,10 @@ export function useSearch(motelyWasmUrl) {
|
|
|
177
194
|
const worker = workerRef.current;
|
|
178
195
|
if (!worker)
|
|
179
196
|
return;
|
|
197
|
+
if (!motelyWasmUrl) {
|
|
198
|
+
setState((s) => ({ ...s, status: "error", error: "motelyWasmUrl is required to start search" }));
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
180
201
|
speedRef.current = { lastSearched: 0n, lastTime: 0, ema: 0 };
|
|
181
202
|
setState({ ...INITIAL_STATE, status: "running", tallyLabels: state.tallyLabels });
|
|
182
203
|
const send = () => worker.postMessage(payload);
|
|
@@ -193,7 +214,7 @@ export function useSearch(motelyWasmUrl) {
|
|
|
193
214
|
}
|
|
194
215
|
};
|
|
195
216
|
}
|
|
196
|
-
}, [state.tallyLabels]);
|
|
217
|
+
}, [motelyWasmUrl, state.tallyLabels]);
|
|
197
218
|
const start = useCallback((jaml, count) => {
|
|
198
219
|
sendStart({ type: "start", mode: "random", jaml, count });
|
|
199
220
|
}, [sendStart]);
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const
|
|
1
|
+
import { CLAUSE_TYPE_KEYS, DECK_VALUES, EDITION_VALUES, ENHANCEMENT_VALUES, RANK_VALUES, SEAL_VALUES, SOURCE_KEYS, STAKE_VALUES, SUIT_VALUES, } from '../jaml/jamlSchema.js';
|
|
2
|
+
// UI options derived from the shipped JAML schema wherever possible.
|
|
3
|
+
export const DECK_OPTIONS = [...DECK_VALUES];
|
|
4
|
+
export const STAKE_OPTIONS = [...STAKE_VALUES];
|
|
4
5
|
export const ANTE_OPTIONS = [1, 2, 3, 4, 5, 6, 7, 8];
|
|
5
6
|
export const SLOT_OPTIONS = [1, 2, 3, 4, 5];
|
|
6
|
-
export const RANK_OPTIONS = [
|
|
7
|
-
export const SUIT_OPTIONS = [
|
|
8
|
-
export const ENHANCEMENT_OPTIONS = [
|
|
9
|
-
export const EDITION_OPTIONS = [
|
|
10
|
-
export const SEAL_OPTIONS = [
|
|
11
|
-
export const CLAUSE_TYPES = [
|
|
12
|
-
|
|
13
|
-
];
|
|
14
|
-
export const SOURCE_OPTIONS = [
|
|
15
|
-
'shop', 'arcana_pack', 'celestial_pack', 'spectral_pack', 'buffoon_pack', 'standard_pack',
|
|
16
|
-
'uncommon_tag', 'rare_tag', 'top_up_tag', 'emperor', 'vagabond', 'judgement', 'wraith'
|
|
17
|
-
];
|
|
7
|
+
export const RANK_OPTIONS = [...RANK_VALUES];
|
|
8
|
+
export const SUIT_OPTIONS = [...SUIT_VALUES];
|
|
9
|
+
export const ENHANCEMENT_OPTIONS = [...ENHANCEMENT_VALUES];
|
|
10
|
+
export const EDITION_OPTIONS = [...EDITION_VALUES];
|
|
11
|
+
export const SEAL_OPTIONS = [...SEAL_VALUES];
|
|
12
|
+
export const CLAUSE_TYPES = [...CLAUSE_TYPE_KEYS];
|
|
13
|
+
export const SOURCE_OPTIONS = [...SOURCE_KEYS];
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
'spectralCard', 'standardCard', 'tag', 'boss', 'event'
|
|
4
|
-
];
|
|
1
|
+
import { CLAUSE_TYPE_KEYS } from './jamlSchema.js';
|
|
2
|
+
export const CLAUSE_TYPES = [...CLAUSE_TYPE_KEYS];
|
|
5
3
|
export const ARRAY_KEYS = ['antes', 'tags', 'labels'];
|
|
6
4
|
export const JAML_KEYWORDS = [
|
|
7
5
|
'must', 'should', 'mustNot', 'any', 'Any', ...CLAUSE_TYPES, ...ARRAY_KEYS
|