jaml-ui 0.24.20 → 0.25.2
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 +0 -13
- package/assets/WeeJokerExampleDAilyGame.png +0 -0
- package/assets/balatro-stake-chips.png +0 -0
- package/dist/assets.d.ts +1 -2
- package/dist/chunks/Layer-BBPJFHfs.js +17 -0
- package/dist/chunks/Layer-BBPJFHfs.js.map +1 -0
- package/dist/chunks/assets-RWUiFSTc.js +37 -0
- package/dist/chunks/assets-RWUiFSTc.js.map +1 -0
- package/dist/chunks/motelyItemDecoder-CueyZ0XD.js +6039 -0
- package/dist/chunks/motelyItemDecoder-CueyZ0XD.js.map +1 -0
- package/dist/chunks/spriteMapper-CFjN0_TV.js +2415 -0
- package/dist/chunks/spriteMapper-CFjN0_TV.js.map +1 -0
- package/dist/chunks/tokens-B65Fzble.js +57 -0
- package/dist/chunks/tokens-B65Fzble.js.map +1 -0
- package/dist/chunks/ui-5cBy3zAm.js +1387 -0
- package/dist/chunks/ui-5cBy3zAm.js.map +1 -0
- package/dist/components/AnalyzerExplorer.d.ts +1 -1
- package/dist/components/CardFan.d.ts +1 -1
- package/dist/components/CardList.d.ts +1 -1
- package/dist/components/DeckSprite.d.ts +1 -1
- package/dist/components/JamlAestheticSelector.d.ts +1 -1
- package/dist/components/JamlAnalyzerFullscreen.d.ts +5 -5
- package/dist/components/JamlCurator.d.ts +1 -6
- package/dist/components/JamlIde.d.ts +5 -5
- package/dist/components/JamlSeedInput.d.ts +1 -1
- package/dist/components/JamlSpeedometer.d.ts +1 -1
- package/dist/components/MotelyVersionBadge.d.ts +1 -1
- package/dist/components/Standardcard.d.ts +1 -1
- package/dist/components/jamlMap/CategoryPicker.d.ts +3 -3
- package/dist/components/jamlMap/JamlMapEditor.d.ts +1 -1
- package/dist/components/jamlMap/JokerPicker.d.ts +1 -1
- package/dist/components/jamlMap/MysterySlot.d.ts +2 -2
- package/dist/components/jamlMap/index.d.ts +4 -4
- package/dist/core.d.ts +5 -5
- package/dist/core.js +27 -5
- package/dist/core.js.map +1 -0
- package/dist/decode/motelyItemDecoder.d.ts +0 -10
- package/dist/decode/motelySprite.d.ts +1 -1
- package/dist/fonts/m6x11plus.otf +0 -0
- package/dist/hooks/analyzerStreamRegistry.d.ts +2 -2
- package/dist/hooks/useAnalyzer.d.ts +3 -3
- package/dist/hooks/useSearch.d.ts +2 -2
- package/dist/index.d.ts +29 -31
- package/dist/index.js +16721 -34
- package/dist/index.js.map +1 -0
- package/dist/lib/const.d.ts +2 -2
- package/dist/lib/hooks/useDragScroll.d.ts +1 -1
- package/dist/lib/hooks/useJamlFilter.d.ts +2 -2
- package/dist/lib/hooks/useSeedAnalyzer.d.ts +2 -2
- package/dist/lib/utils.d.ts +1 -1
- package/dist/motely.d.ts +4 -3
- package/dist/motely.js +65 -3
- package/dist/motely.js.map +1 -0
- package/dist/motelyBoot.d.ts +2 -0
- package/dist/motelyDisplay.d.ts +0 -2
- package/dist/r3f/Card3D.d.ts +2 -2
- package/dist/r3f/JimboBillboard.d.ts +1 -1
- package/dist/r3f.js +235 -3
- package/dist/r3f.js.map +1 -0
- package/dist/render/CanvasRenderer.d.ts +1 -1
- package/dist/sprites/spriteData.d.ts +1 -6
- package/dist/sprites/spriteMapper.d.ts +1 -1
- package/dist/ui/JimboBadge.d.ts +1 -1
- package/dist/ui/JimboFloating.d.ts +1 -1
- package/dist/ui/JimboIconButton.d.ts +1 -1
- package/dist/ui/JimboSelect.d.ts +1 -1
- package/dist/ui/footer.d.ts +2 -3
- package/dist/ui/hooks.d.ts +1 -1
- package/dist/ui/ide/DeckSprite.d.ts +1 -1
- package/dist/ui/jimbo.css +2 -1856
- package/dist/ui/jimboApp.d.ts +1 -1
- package/dist/ui/jimboFilterBar.d.ts +1 -1
- package/dist/ui/jimboFlankNav.d.ts +1 -1
- package/dist/ui/jimboInfoCard.d.ts +1 -1
- package/dist/ui/jimboInset.d.ts +1 -1
- package/dist/ui/jimboStatGrid.d.ts +1 -1
- package/dist/ui/jimboText.d.ts +1 -1
- package/dist/ui/jimboTooltip.d.ts +2 -2
- package/dist/ui/mascot/SeedMascot.d.ts +2 -2
- package/dist/ui/panel.d.ts +1 -1
- package/dist/ui/radial/RadialBadge.d.ts +1 -2
- package/dist/ui/radial/RadialButton.d.ts +1 -2
- package/dist/ui/radial/RadialMenu.d.ts +2 -2
- package/dist/ui/radial/RadialPill.d.ts +1 -2
- package/dist/ui/radial/index.d.ts +16 -16
- package/dist/ui/radial/radialMenuStore.d.ts +1 -1
- package/dist/ui/showcase.d.ts +1 -1
- package/dist/ui/sprites.d.ts +2 -2
- package/dist/ui.d.ts +0 -1
- package/dist/ui.js +3 -36
- package/dist/utils/gameCardUtils.d.ts +1 -1
- package/dist/utils/jamlVisualFilter.d.ts +1 -7
- package/package.json +13 -25
- package/dist/assets.js +0 -48
- package/dist/components/AnalyzerExplorer.js +0 -391
- package/dist/components/CardFan.js +0 -80
- package/dist/components/CardList.js +0 -5
- package/dist/components/DeckSprite.js +0 -75
- package/dist/components/GameCard.js +0 -355
- package/dist/components/JamlAestheticSelector.js +0 -22
- package/dist/components/JamlAnalyzerFullscreen.js +0 -263
- package/dist/components/JamlCodeEditor.js +0 -137
- package/dist/components/JamlCurator.js +0 -64
- package/dist/components/JamlCurator.stories.d.ts +0 -6
- package/dist/components/JamlCurator.stories.js +0 -14
- package/dist/components/JamlIde.js +0 -193
- package/dist/components/JamlIdeToolbar.js +0 -23
- package/dist/components/JamlIdeVisual.js +0 -218
- package/dist/components/JamlMapPreview.js +0 -121
- package/dist/components/JamlSeedInput.js +0 -26
- package/dist/components/JamlSpeedometer.js +0 -70
- package/dist/components/Jimbolate.js +0 -17
- package/dist/components/MotelyVersionBadge.js +0 -19
- package/dist/components/PaginatedFilterBrowser.js +0 -54
- package/dist/components/RunConfigModal.js +0 -59
- package/dist/components/Standardcard.js +0 -80
- package/dist/components/jamlMap/CategoryPicker.js +0 -135
- package/dist/components/jamlMap/JamlMapEditor.js +0 -304
- package/dist/components/jamlMap/JamlMapEditor.stories.d.ts +0 -7
- package/dist/components/jamlMap/JamlMapEditor.stories.js +0 -26
- package/dist/components/jamlMap/JamlMapEditorDemo.d.ts +0 -8
- package/dist/components/jamlMap/JamlMapEditorDemo.js +0 -323
- package/dist/components/jamlMap/JokerPicker.js +0 -113
- package/dist/components/jamlMap/MysterySlot.js +0 -128
- package/dist/components/jamlMap/MysterySlot.stories.d.ts +0 -7
- package/dist/components/jamlMap/MysterySlot.stories.js +0 -31
- package/dist/components/jamlMap/index.js +0 -4
- package/dist/decode/motelyItemDecoder.js +0 -164
- package/dist/decode/motelySprite.js +0 -84
- package/dist/hooks/analyzerStreamRegistry.js +0 -96
- package/dist/hooks/searchWorker.d.ts +0 -1
- package/dist/hooks/searchWorker.js +0 -119
- package/dist/hooks/searchWorkerCode.d.ts +0 -1
- package/dist/hooks/searchWorkerCode.js +0 -85
- package/dist/hooks/useAnalyzer.js +0 -91
- package/dist/hooks/useIntersectionObserver.js +0 -52
- package/dist/hooks/useSearch.js +0 -161
- package/dist/hooks/useShopStream.js +0 -85
- package/dist/lib/SpriteMapper.js +0 -48
- package/dist/lib/cardParser.js +0 -67
- package/dist/lib/classes/BuyMetaData.js +0 -1
- package/dist/lib/config.js +0 -15
- package/dist/lib/const.js +0 -521
- package/dist/lib/data/constants.js +0 -14
- package/dist/lib/hooks/useDragScroll.js +0 -48
- package/dist/lib/hooks/useJamlFilter.js +0 -219
- package/dist/lib/hooks/useSeedAnalyzer.js +0 -50
- package/dist/lib/jaml/jamlCompletion.js +0 -13
- package/dist/lib/jaml/jamlData.js +0 -6
- package/dist/lib/jaml/jamlObjectives.js +0 -97
- package/dist/lib/jaml/jamlParser.js +0 -47
- package/dist/lib/jaml/jamlPresets.js +0 -61
- package/dist/lib/jaml/jamlSchema.js +0 -91
- package/dist/lib/parseDailyRitual.js +0 -70
- package/dist/lib/tts/getRevealPos.js +0 -16
- package/dist/lib/tts/splitTtsDisplay.js +0 -35
- package/dist/lib/types.js +0 -1
- package/dist/lib/utils.js +0 -5
- package/dist/motelyDisplay.js +0 -59
- package/dist/r3f/Card3D.js +0 -72
- package/dist/r3f/JimboBillboard.js +0 -32
- package/dist/r3f/JimboText3D.js +0 -8
- package/dist/render/CanvasRenderer.js +0 -11
- package/dist/render/Layer.js +0 -18
- package/dist/sprites/spriteData.js +0 -100
- package/dist/sprites/spriteMapper.js +0 -75
- package/dist/stories/Button.d.ts +0 -15
- package/dist/stories/Button.js +0 -7
- package/dist/stories/Button.stories.d.ts +0 -24
- package/dist/stories/Button.stories.js +0 -50
- package/dist/stories/Header.d.ts +0 -12
- package/dist/stories/Header.js +0 -4
- package/dist/stories/Header.stories.d.ts +0 -18
- package/dist/stories/Header.stories.js +0 -26
- package/dist/stories/Page.d.ts +0 -3
- package/dist/stories/Page.js +0 -8
- package/dist/stories/Page.stories.d.ts +0 -12
- package/dist/stories/Page.stories.js +0 -24
- package/dist/ui/Jimbo.stories.d.ts +0 -7
- package/dist/ui/Jimbo.stories.js +0 -28
- package/dist/ui/JimboBadge.js +0 -8
- package/dist/ui/JimboFloating.js +0 -17
- package/dist/ui/JimboIconButton.js +0 -28
- package/dist/ui/JimboInputModal.js +0 -66
- package/dist/ui/JimboSelect.js +0 -43
- package/dist/ui/JimboToggleList.js +0 -5
- package/dist/ui/PanelSplitter.js +0 -78
- package/dist/ui/codeBlock.js +0 -14
- package/dist/ui/footer.js +0 -20
- package/dist/ui/hooks.js +0 -634
- package/dist/ui/ide/AgnosticSeedCard.d.ts +0 -19
- package/dist/ui/ide/AgnosticSeedCard.js +0 -48
- package/dist/ui/ide/DeckSprite.js +0 -2
- package/dist/ui/ide/JamlBuilder.d.ts +0 -1
- package/dist/ui/ide/JamlBuilder.js +0 -112
- package/dist/ui/ide/JamlEditor.js +0 -486
- package/dist/ui/ide/JamlEditorMonaco.d.ts +0 -8
- package/dist/ui/ide/JamlEditorMonaco.js +0 -78
- package/dist/ui/ide/WasmStatus.d.ts +0 -1
- package/dist/ui/ide/WasmStatus.js +0 -42
- package/dist/ui/jimboApp.js +0 -15
- package/dist/ui/jimboBackground.js +0 -27
- package/dist/ui/jimboCopyRow.js +0 -18
- package/dist/ui/jimboFilterBar.js +0 -16
- package/dist/ui/jimboFlankNav.js +0 -18
- package/dist/ui/jimboInfoCard.js +0 -26
- package/dist/ui/jimboInset.js +0 -9
- package/dist/ui/jimboSectionHeader.js +0 -9
- package/dist/ui/jimboStatGrid.js +0 -9
- package/dist/ui/jimboTabs.js +0 -22
- package/dist/ui/jimboText.js +0 -33
- package/dist/ui/jimboTooltip.js +0 -39
- package/dist/ui/jimboWordmark.js +0 -9
- package/dist/ui/mascot/JammySpeechBox.js +0 -30
- package/dist/ui/mascot/SeedMascot.js +0 -17
- package/dist/ui/mascot/index.js +0 -3
- package/dist/ui/mascot/menuConfig.js +0 -12
- package/dist/ui/panel.js +0 -24
- package/dist/ui/radial/RadialBadge.js +0 -43
- package/dist/ui/radial/RadialBreadcrumb.js +0 -18
- package/dist/ui/radial/RadialButton.js +0 -102
- package/dist/ui/radial/RadialMenu.js +0 -168
- package/dist/ui/radial/RadialPill.js +0 -15
- package/dist/ui/radial/index.js +0 -18
- package/dist/ui/radial/radialMenuStore.js +0 -122
- package/dist/ui/radial/radialMenuViewport.js +0 -59
- package/dist/ui/radial/useRadialMenu.js +0 -107
- package/dist/ui/showcase.js +0 -20
- package/dist/ui/sprites.js +0 -77
- package/dist/ui/tokens.js +0 -64
- package/dist/utils/gameCardUtils.js +0 -15
- package/dist/utils/jamlMapPreview.js +0 -106
- package/dist/utils/jamlVisualFilter.js +0 -210
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Motely item decoder — thin wrapper over motely-wasm runtime enums.
|
|
3
|
-
* No hand-rolled bitmask tables. The WASM enum IS the source of truth.
|
|
4
|
-
*
|
|
5
|
-
* Consumers must call `setMotelyEnums(Motely)` once after `await bootsharp.boot()`
|
|
6
|
-
* for runtime enum lookups to resolve. Before that, decoders return placeholder
|
|
7
|
-
* strings rather than throwing.
|
|
8
|
-
*/
|
|
9
|
-
let _motely = null;
|
|
10
|
-
let _categoryMap = null;
|
|
11
|
-
export function setMotelyEnums(motely) {
|
|
12
|
-
_motely = motely;
|
|
13
|
-
_categoryMap = null;
|
|
14
|
-
}
|
|
15
|
-
function getCategoryMap() {
|
|
16
|
-
if (_categoryMap)
|
|
17
|
-
return _categoryMap;
|
|
18
|
-
if (!_motely)
|
|
19
|
-
return {};
|
|
20
|
-
_categoryMap = {
|
|
21
|
-
[_motely.MotelyItemTypeCategory.Standardcard]: "playing",
|
|
22
|
-
[_motely.MotelyItemTypeCategory.SpectralCard]: "spectral",
|
|
23
|
-
[_motely.MotelyItemTypeCategory.TarotCard]: "tarot",
|
|
24
|
-
[_motely.MotelyItemTypeCategory.PlanetCard]: "planet",
|
|
25
|
-
[_motely.MotelyItemTypeCategory.Joker]: "joker",
|
|
26
|
-
};
|
|
27
|
-
return _categoryMap;
|
|
28
|
-
}
|
|
29
|
-
// ─── Helpers using motely-wasm runtime enums directly ────────────────────────
|
|
30
|
-
function enumKey(e, value) {
|
|
31
|
-
const k = e[String(value)];
|
|
32
|
-
return typeof k === "string" ? k : null;
|
|
33
|
-
}
|
|
34
|
-
function spaceSplit(value) {
|
|
35
|
-
return value.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2");
|
|
36
|
-
}
|
|
37
|
-
// ─── Core decoder ────────────────────────────────────────────────────────────
|
|
38
|
-
function resolvePackedValue(input) {
|
|
39
|
-
if (input == null)
|
|
40
|
-
return null;
|
|
41
|
-
if (typeof input === "number")
|
|
42
|
-
return Number.isFinite(input) ? input : null;
|
|
43
|
-
return input.value ?? input.type ?? null;
|
|
44
|
-
}
|
|
45
|
-
export function resolveMotelyItemType(input) {
|
|
46
|
-
const val = resolvePackedValue(input);
|
|
47
|
-
return val !== null ? val & 0xffff : null;
|
|
48
|
-
}
|
|
49
|
-
export function motelyItemTypeName(input) {
|
|
50
|
-
const itemType = resolveMotelyItemType(input);
|
|
51
|
-
if (itemType === null)
|
|
52
|
-
return "Unknown";
|
|
53
|
-
if (!_motely)
|
|
54
|
-
return `item#${itemType}`;
|
|
55
|
-
return enumKey(_motely.MotelyItemType, itemType) ?? `item#${itemType}`;
|
|
56
|
-
}
|
|
57
|
-
export function motelyItemCategory(itemType) {
|
|
58
|
-
const catValue = (itemType >> 12) & 0xf;
|
|
59
|
-
return getCategoryMap()[catValue] ?? "unknown";
|
|
60
|
-
}
|
|
61
|
-
export function motelyItemRenderCategory(input) {
|
|
62
|
-
const itemType = resolveMotelyItemType(input);
|
|
63
|
-
if (itemType === null)
|
|
64
|
-
return "unknown";
|
|
65
|
-
return motelyItemCategory(itemType);
|
|
66
|
-
}
|
|
67
|
-
export function motelyItemDisplayName(input) {
|
|
68
|
-
return spaceSplit(motelyItemTypeName(input));
|
|
69
|
-
}
|
|
70
|
-
export function motelyItemEditionName(input) {
|
|
71
|
-
if (input == null || !_motely)
|
|
72
|
-
return null;
|
|
73
|
-
const val = typeof input === "number" ? input : input.edition;
|
|
74
|
-
if (val == null)
|
|
75
|
-
return null;
|
|
76
|
-
const key = enumKey(_motely.MotelyItemEdition, typeof val === "number" ? val : 0);
|
|
77
|
-
if (!key || key === "None")
|
|
78
|
-
return null;
|
|
79
|
-
return key;
|
|
80
|
-
}
|
|
81
|
-
export function motelyItemSealName(input) {
|
|
82
|
-
if (input == null || !_motely)
|
|
83
|
-
return null;
|
|
84
|
-
const val = typeof input === "number" ? null : input.seal;
|
|
85
|
-
if (val == null)
|
|
86
|
-
return null;
|
|
87
|
-
const key = enumKey(_motely.MotelyItemSeal, val);
|
|
88
|
-
if (!key || key === "None")
|
|
89
|
-
return null;
|
|
90
|
-
return key;
|
|
91
|
-
}
|
|
92
|
-
export function motelyItemEnhancementName(input) {
|
|
93
|
-
if (input == null || !_motely)
|
|
94
|
-
return null;
|
|
95
|
-
const val = typeof input === "number" ? null : input.enhancement;
|
|
96
|
-
if (val == null)
|
|
97
|
-
return null;
|
|
98
|
-
const key = enumKey(_motely.MotelyItemEnhancement, val);
|
|
99
|
-
if (!key || key === "None")
|
|
100
|
-
return null;
|
|
101
|
-
return key;
|
|
102
|
-
}
|
|
103
|
-
export function motelyStandardcardRankName(input) {
|
|
104
|
-
if (input == null || !_motely)
|
|
105
|
-
return null;
|
|
106
|
-
const val = typeof input === "number" ? null : input.rank;
|
|
107
|
-
if (val == null)
|
|
108
|
-
return null;
|
|
109
|
-
return enumKey(_motely.MotelyStandardcardRank, val);
|
|
110
|
-
}
|
|
111
|
-
export function motelyStandardcardSuitName(input) {
|
|
112
|
-
if (input == null || !_motely)
|
|
113
|
-
return null;
|
|
114
|
-
const val = typeof input === "number" ? null : input.suit;
|
|
115
|
-
if (val == null)
|
|
116
|
-
return null;
|
|
117
|
-
return enumKey(_motely.MotelyStandardcardSuit, val);
|
|
118
|
-
}
|
|
119
|
-
export function decodeMotelyItemName(input) {
|
|
120
|
-
return motelyItemTypeName(input);
|
|
121
|
-
}
|
|
122
|
-
export function decodeMotelyItem(input) {
|
|
123
|
-
const itemType = resolveMotelyItemType(input);
|
|
124
|
-
if (itemType === null)
|
|
125
|
-
return null;
|
|
126
|
-
const enumKeyStr = _motely
|
|
127
|
-
? enumKey(_motely.MotelyItemType, itemType) ?? `Unknown_${itemType}`
|
|
128
|
-
: `Unknown_${itemType}`;
|
|
129
|
-
const category = motelyItemCategory(itemType);
|
|
130
|
-
const displayName = spaceSplit(enumKeyStr);
|
|
131
|
-
return {
|
|
132
|
-
itemType,
|
|
133
|
-
enumKey: enumKeyStr,
|
|
134
|
-
displayName,
|
|
135
|
-
category,
|
|
136
|
-
edition: motelyItemEditionName(input),
|
|
137
|
-
seal: motelyItemSealName(input),
|
|
138
|
-
enhancement: motelyItemEnhancementName(input),
|
|
139
|
-
rank: motelyStandardcardRankName(input),
|
|
140
|
-
suit: motelyStandardcardSuitName(input),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
export function decodeMotelyItemToJamlCard(input, scale) {
|
|
144
|
-
const decoded = decodeMotelyItem(input);
|
|
145
|
-
if (!decoded)
|
|
146
|
-
return null;
|
|
147
|
-
const type = decoded.category === "joker" ? "joker"
|
|
148
|
-
: decoded.category === "playing" ? "playing"
|
|
149
|
-
: "consumable";
|
|
150
|
-
return {
|
|
151
|
-
type,
|
|
152
|
-
card: {
|
|
153
|
-
name: decoded.displayName,
|
|
154
|
-
edition: decoded.edition ?? undefined,
|
|
155
|
-
seal: decoded.seal ?? undefined,
|
|
156
|
-
enhancements: decoded.enhancement ? [decoded.enhancement] : undefined,
|
|
157
|
-
rank: decoded.rank ?? undefined,
|
|
158
|
-
suit: decoded.suit ?? undefined,
|
|
159
|
-
scale,
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
export function warmMotelyItemCache() { }
|
|
164
|
-
export function motelyItemCacheSize() { return 0; }
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { decodeMotelyItem } from "./motelyItemDecoder.js";
|
|
2
|
-
import { getSpriteData, SHEET_META } from "../sprites/spriteMapper.js";
|
|
3
|
-
import { RANK_MAP, SUIT_MAP } from "../sprites/spriteData.js";
|
|
4
|
-
import { resolveJamlAssetUrl } from "../assets.js";
|
|
5
|
-
/**
|
|
6
|
-
* Given a raw motely-wasm item value (which may be a bitpacked integer or raw MotelyItemType),
|
|
7
|
-
* resolves it to a sprite atlas path and grid coordinates for rendering.
|
|
8
|
-
*/
|
|
9
|
-
export function motelyItemToSprite(rawValue) {
|
|
10
|
-
const decoded = decodeMotelyItem(rawValue);
|
|
11
|
-
if (!decoded)
|
|
12
|
-
return null;
|
|
13
|
-
if (decoded.category === "playing" && decoded.rank && decoded.suit) {
|
|
14
|
-
const col = RANK_MAP[decoded.rank];
|
|
15
|
-
const row = SUIT_MAP[decoded.suit];
|
|
16
|
-
if (col !== undefined && row !== undefined) {
|
|
17
|
-
return {
|
|
18
|
-
atlasPath: resolveJamlAssetUrl('deck'),
|
|
19
|
-
gridCol: col,
|
|
20
|
-
gridRow: row,
|
|
21
|
-
gridCols: 13,
|
|
22
|
-
gridRows: 4,
|
|
23
|
-
displayName: decoded.displayName,
|
|
24
|
-
category: "playing"
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const sprite = getSpriteData(decoded.displayName);
|
|
29
|
-
if (!sprite)
|
|
30
|
-
return null;
|
|
31
|
-
const meta = SHEET_META[sprite.type];
|
|
32
|
-
if (!meta)
|
|
33
|
-
return null;
|
|
34
|
-
return {
|
|
35
|
-
atlasPath: resolveJamlAssetUrl(meta.assetKey),
|
|
36
|
-
gridCol: sprite.pos.x,
|
|
37
|
-
gridRow: sprite.pos.y,
|
|
38
|
-
gridCols: meta.cols,
|
|
39
|
-
gridRows: meta.rows,
|
|
40
|
-
displayName: decoded.displayName,
|
|
41
|
-
category: decoded.category
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Resolves a sprite by name and category without needing a Motely integer.
|
|
46
|
-
*/
|
|
47
|
-
export function getMotelySpriteByName(name, category = "unknown") {
|
|
48
|
-
if (category === "playing") {
|
|
49
|
-
// Attempt to parse "Rank of Suit"
|
|
50
|
-
const match = /^(.*?)\s+of\s+(.*?)$/i.exec(name);
|
|
51
|
-
if (match) {
|
|
52
|
-
const rank = match[1];
|
|
53
|
-
const suit = match[2];
|
|
54
|
-
const col = RANK_MAP[rank];
|
|
55
|
-
const row = SUIT_MAP[suit];
|
|
56
|
-
if (col !== undefined && row !== undefined) {
|
|
57
|
-
return {
|
|
58
|
-
atlasPath: resolveJamlAssetUrl('deck'),
|
|
59
|
-
gridCol: col,
|
|
60
|
-
gridRow: row,
|
|
61
|
-
gridCols: 13,
|
|
62
|
-
gridRows: 4,
|
|
63
|
-
displayName: name,
|
|
64
|
-
category: "playing"
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const sprite = getSpriteData(name);
|
|
70
|
-
if (!sprite)
|
|
71
|
-
return null;
|
|
72
|
-
const meta = SHEET_META[sprite.type];
|
|
73
|
-
if (!meta)
|
|
74
|
-
return null;
|
|
75
|
-
return {
|
|
76
|
-
atlasPath: resolveJamlAssetUrl(meta.assetKey),
|
|
77
|
-
gridCol: sprite.pos.x,
|
|
78
|
-
gridRow: sprite.pos.y,
|
|
79
|
-
gridCols: meta.cols,
|
|
80
|
-
gridRows: meta.rows,
|
|
81
|
-
displayName: name,
|
|
82
|
-
category
|
|
83
|
-
};
|
|
84
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { motelyItemDisplayNameFromValue } from "../motelyDisplay.js";
|
|
3
|
-
export const ANALYZER_STREAM_META = {
|
|
4
|
-
shop: { key: "shop", label: "Shop", tone: "default", defaultEnabled: true },
|
|
5
|
-
shopJoker: { key: "shopJoker", label: "Shop Jokers", tone: "default", defaultEnabled: false },
|
|
6
|
-
soulJoker: { key: "soulJoker", label: "Soul (Legendary)", tone: "gold", defaultEnabled: true },
|
|
7
|
-
rareTagJoker: { key: "rareTagJoker", label: "Rare Tag Jokers", tone: "default", defaultEnabled: false },
|
|
8
|
-
uncommonTagJoker: { key: "uncommonTagJoker", label: "Uncommon Tag Jokers", tone: "default", defaultEnabled: false },
|
|
9
|
-
riffRaffJoker: { key: "riffRaffJoker", label: "Riff Raff", tone: "default", defaultEnabled: false },
|
|
10
|
-
buffoonJoker: { key: "buffoonJoker", label: "Buffoon Pack Jokers", tone: "default", defaultEnabled: false },
|
|
11
|
-
judgementJoker: { key: "judgementJoker", label: "Judgement Jokers", tone: "purple", defaultEnabled: false },
|
|
12
|
-
wraithJoker: { key: "wraithJoker", label: "Wraith Jokers", tone: "spectral", defaultEnabled: false },
|
|
13
|
-
shopTarot: { key: "shopTarot", label: "Shop Tarots", tone: "purple", defaultEnabled: false },
|
|
14
|
-
shopPlanet: { key: "shopPlanet", label: "Shop Planets", tone: "blue", defaultEnabled: false },
|
|
15
|
-
shopSpectral: { key: "shopSpectral", label: "Shop Spectrals", tone: "spectral", defaultEnabled: false },
|
|
16
|
-
purpleSealTarot: { key: "purpleSealTarot", label: "Purple Seal Tarots", tone: "purple", defaultEnabled: false },
|
|
17
|
-
};
|
|
18
|
-
export const DEFAULT_ENABLED_STREAMS = (Object.values(ANALYZER_STREAM_META)
|
|
19
|
-
.filter((m) => m.defaultEnabled)
|
|
20
|
-
.map((m) => m.key));
|
|
21
|
-
/**
|
|
22
|
-
* Build init/next callbacks for a (key, ante) pair against the live ctx.
|
|
23
|
-
* The component wraps these with useMotelyStream. Items are normalized to
|
|
24
|
-
* { id, name, value } so the same ShopItem renderer can show every lane.
|
|
25
|
-
*/
|
|
26
|
-
export function buildStreamHandle(live, ante, key) {
|
|
27
|
-
const ctx = live.ctx;
|
|
28
|
-
const Motely = live.Motely;
|
|
29
|
-
const runState = live.runStates[ante];
|
|
30
|
-
let cursor = 0;
|
|
31
|
-
const idBase = `${ante}-${key}`;
|
|
32
|
-
function nameFromValue(value) {
|
|
33
|
-
return motelyItemDisplayNameFromValue(value);
|
|
34
|
-
}
|
|
35
|
-
function streamHandle(createStream, getNextValue) {
|
|
36
|
-
let stream = null;
|
|
37
|
-
return {
|
|
38
|
-
initStream: () => {
|
|
39
|
-
stream = createStream();
|
|
40
|
-
cursor = 0;
|
|
41
|
-
},
|
|
42
|
-
nextItem: () => {
|
|
43
|
-
if (stream === null)
|
|
44
|
-
throw new Error(`Analyzer stream ${key} was read before initialization.`);
|
|
45
|
-
const value = getNextValue(stream);
|
|
46
|
-
const id = `${idBase}-${cursor++}`;
|
|
47
|
-
return { id, name: nameFromValue(value), value };
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function joker(createStream, getNext) {
|
|
52
|
-
return streamHandle(createStream, (stream) => getNext(stream).item.value);
|
|
53
|
-
}
|
|
54
|
-
function fixedRarityJoker(createStream, getNext) {
|
|
55
|
-
return streamHandle(createStream, (stream) => getNext(stream).item.value);
|
|
56
|
-
}
|
|
57
|
-
function tarot(createStream, getNext) {
|
|
58
|
-
return streamHandle(createStream, (stream) => getNext(stream).item.value);
|
|
59
|
-
}
|
|
60
|
-
function planet(createStream, getNext) {
|
|
61
|
-
return streamHandle(createStream, (stream) => getNext(stream).item.value);
|
|
62
|
-
}
|
|
63
|
-
function spectral(createStream, getNext) {
|
|
64
|
-
return streamHandle(createStream, (stream) => getNext(stream).item.value);
|
|
65
|
-
}
|
|
66
|
-
switch (key) {
|
|
67
|
-
case "shop":
|
|
68
|
-
return streamHandle(() => ctx.createShopItemStream(ante, runState, Motely.MotelyShopStreamFlags.Default, Motely.MotelyJokerStreamFlags.Default), (stream) => ctx.getNextShopItem(stream).item.value);
|
|
69
|
-
case "shopJoker":
|
|
70
|
-
return joker(() => ctx.createShopJokerStream(ante, Motely.MotelyJokerStreamFlags.Default), (stream) => ctx.getNextShopJoker(stream));
|
|
71
|
-
case "soulJoker":
|
|
72
|
-
return fixedRarityJoker(() => ctx.createLegendaryJokerStream(ante, Motely.MotelyJokerFixedRarityStreamFlags.Default), (stream) => ctx.getNextLegendaryJoker(stream));
|
|
73
|
-
case "rareTagJoker":
|
|
74
|
-
return fixedRarityJoker(() => ctx.createRareTagJokerStream(ante, Motely.MotelyJokerFixedRarityStreamFlags.Default), (stream) => ctx.getNextRareTagJoker(stream));
|
|
75
|
-
case "uncommonTagJoker":
|
|
76
|
-
return fixedRarityJoker(() => ctx.createUncommonTagJokerStream(ante, Motely.MotelyJokerFixedRarityStreamFlags.Default), (stream) => ctx.getNextUncommonTagJoker(stream));
|
|
77
|
-
case "riffRaffJoker":
|
|
78
|
-
return fixedRarityJoker(() => ctx.createRiffRaffJokerStream(ante, Motely.MotelyJokerFixedRarityStreamFlags.Default), (stream) => ctx.getNextRiffRaffJoker(stream));
|
|
79
|
-
case "buffoonJoker":
|
|
80
|
-
return joker(() => ctx.createBuffoonPackJokerStream(ante, Motely.MotelyJokerStreamFlags.Default), (stream) => ctx.getNextBuffoonPackJoker(stream));
|
|
81
|
-
case "judgementJoker":
|
|
82
|
-
return joker(() => ctx.createJudgementJokerStream(ante, Motely.MotelyJokerStreamFlags.Default), (stream) => ctx.getNextJudgementJoker(stream));
|
|
83
|
-
case "wraithJoker":
|
|
84
|
-
return joker(() => ctx.createWraithJokerStream(ante, Motely.MotelyJokerStreamFlags.Default), (stream) => ctx.getNextWraithJoker(stream));
|
|
85
|
-
case "shopTarot":
|
|
86
|
-
return tarot(() => ctx.createShopTarotStream(ante), (stream) => ctx.getNextShopTarot(stream));
|
|
87
|
-
case "shopPlanet":
|
|
88
|
-
return planet(() => ctx.createShopPlanetStream(ante), (stream) => ctx.getNextShopPlanet(stream));
|
|
89
|
-
case "shopSpectral":
|
|
90
|
-
return spectral(() => ctx.createShopSpectralStream(ante), (stream) => ctx.getNextShopSpectral(stream));
|
|
91
|
-
case "purpleSealTarot":
|
|
92
|
-
return tarot(() => ctx.createPurpleSealTarotStream(ante), (stream) => ctx.getNextPurpleSealTarot(stream));
|
|
93
|
-
default:
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
let MotelyWasm = null;
|
|
2
|
-
let MotelyWasmEvents = null;
|
|
3
|
-
let activeSearch = null;
|
|
4
|
-
let activeSearchRunId = 0;
|
|
5
|
-
function post(message) {
|
|
6
|
-
self.postMessage(message);
|
|
7
|
-
}
|
|
8
|
-
function resetEventHandlers() {
|
|
9
|
-
if (!MotelyWasmEvents)
|
|
10
|
-
return;
|
|
11
|
-
MotelyWasmEvents.notifyResult = () => { };
|
|
12
|
-
MotelyWasmEvents.notifyProgress = () => { };
|
|
13
|
-
MotelyWasmEvents.notifyComplete = () => { };
|
|
14
|
-
}
|
|
15
|
-
self.addEventListener("message", async (e) => {
|
|
16
|
-
const msg = e.data;
|
|
17
|
-
if (msg.type === "init") {
|
|
18
|
-
try {
|
|
19
|
-
const mod = await import(/* @vite-ignore */ msg.url);
|
|
20
|
-
await mod.default.boot();
|
|
21
|
-
const motely = mod.Motely;
|
|
22
|
-
MotelyWasm = motely.MotelyWasm;
|
|
23
|
-
MotelyWasmEvents = motely.MotelyWasmEvents;
|
|
24
|
-
post({ type: "ready" });
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
post({ type: "error", message: String(err) });
|
|
28
|
-
}
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (msg.type === "start") {
|
|
32
|
-
if (!MotelyWasm) {
|
|
33
|
-
post({ type: "error", message: "Not initialized" });
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const validation = MotelyWasm.validateJaml(msg.jaml);
|
|
37
|
-
if (validation !== "valid") {
|
|
38
|
-
post({ type: "error", message: validation });
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const runId = ++activeSearchRunId;
|
|
42
|
-
function cleanup() {
|
|
43
|
-
resetEventHandlers();
|
|
44
|
-
if (runId === activeSearchRunId) {
|
|
45
|
-
activeSearch = null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (!MotelyWasmEvents)
|
|
49
|
-
return;
|
|
50
|
-
MotelyWasmEvents.notifyResult = (seed, score, tallyColumns) => {
|
|
51
|
-
if (runId !== activeSearchRunId)
|
|
52
|
-
return;
|
|
53
|
-
post({ type: "result", seed, score, tallyColumns: Array.from(tallyColumns) });
|
|
54
|
-
};
|
|
55
|
-
MotelyWasmEvents.notifyProgress = (searched, matching) => {
|
|
56
|
-
if (runId !== activeSearchRunId)
|
|
57
|
-
return;
|
|
58
|
-
post({ type: "progress", searched: searched.toString(), matching: matching.toString() });
|
|
59
|
-
};
|
|
60
|
-
MotelyWasmEvents.notifyComplete = (status, searched, matched) => {
|
|
61
|
-
if (runId !== activeSearchRunId)
|
|
62
|
-
return;
|
|
63
|
-
cleanup();
|
|
64
|
-
post({ type: "complete", status, searched: searched.toString(), matched: matched.toString() });
|
|
65
|
-
};
|
|
66
|
-
try {
|
|
67
|
-
const mode = msg.mode || "random";
|
|
68
|
-
if (mode === "random") {
|
|
69
|
-
activeSearch = MotelyWasm.startRandomSearch(msg.jaml, msg.count || 1);
|
|
70
|
-
}
|
|
71
|
-
else if (mode === "aesthetic") {
|
|
72
|
-
activeSearch = MotelyWasm.startAestheticSearch(msg.jaml, msg.aesthetic || 0);
|
|
73
|
-
}
|
|
74
|
-
else if (mode === "seedList") {
|
|
75
|
-
activeSearch = MotelyWasm.startSeedListSearch(msg.jaml, msg.seeds || []);
|
|
76
|
-
}
|
|
77
|
-
else if (mode === "keyword") {
|
|
78
|
-
activeSearch = MotelyWasm.startKeywordSearch(msg.jaml, msg.keywords || "", msg.padding || "");
|
|
79
|
-
}
|
|
80
|
-
else if (mode === "sequential") {
|
|
81
|
-
activeSearch = MotelyWasm.startSequentialSearch(msg.jaml, msg.batchCharCount || 1, BigInt(msg.startBatch || "0"), BigInt(msg.endBatch || "0"));
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
post({ type: "error", message: `Unknown search mode: ${mode}` });
|
|
85
|
-
cleanup();
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
cleanup();
|
|
91
|
-
post({ type: "error", message: String(err) });
|
|
92
|
-
}
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (msg.type === "stop") {
|
|
96
|
-
activeSearchRunId++;
|
|
97
|
-
resetEventHandlers();
|
|
98
|
-
if (activeSearch) {
|
|
99
|
-
activeSearch.cancel();
|
|
100
|
-
activeSearch = null;
|
|
101
|
-
}
|
|
102
|
-
post({ type: "cancelled" });
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (msg.type === "get_tally_labels") {
|
|
106
|
-
if (!MotelyWasm) {
|
|
107
|
-
post({ type: "error", message: "Not initialized" });
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
const labels = MotelyWasm.getTallyLabels(msg.jaml);
|
|
112
|
-
post({ type: "tally_labels", labels: Array.from(labels) });
|
|
113
|
-
}
|
|
114
|
-
catch (err) {
|
|
115
|
-
post({ type: "error", message: String(err) });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SEARCH_WORKER_CODE = "\nlet MotelyWasm = null;\nlet MotelyWasmEvents = null;\nlet activeSearch = null;\n\nself.addEventListener('message', async function(e) {\n const msg = e.data;\n\n if (msg.type === 'init') {\n try {\n const mod = await import(msg.url);\n await mod.default.boot();\n const motely = mod.Motely;\n MotelyWasm = motely.MotelyWasm;\n MotelyWasmEvents = motely.MotelyWasmEvents;\n self.postMessage({ type: 'ready' });\n } catch (err) {\n self.postMessage({ type: 'error', message: String(err) });\n }\n return;\n }\n\n if (msg.type === 'start') {\n if (!MotelyWasm) { self.postMessage({ type: 'error', message: 'Not initialized' }); return; }\n const validation = MotelyWasm.validateJaml(msg.jaml);\n if (validation !== 'valid') { self.postMessage({ type: 'error', message: validation }); return; }\n\n function cleanup() {\n MotelyWasmEvents.notifyResult = () => {};\n MotelyWasmEvents.notifyProgress = () => {};\n MotelyWasmEvents.notifyComplete = () => {};\n activeSearch = null;\n }\n\n MotelyWasmEvents.notifyResult = function(seed, score, tallyColumns) {\n self.postMessage({ type: 'result', seed, score, tallyColumns: Array.from(tallyColumns) });\n };\n MotelyWasmEvents.notifyProgress = function(searched, matching) {\n self.postMessage({ type: 'progress', searched: searched.toString(), matching: matching.toString() });\n };\n MotelyWasmEvents.notifyComplete = function(status, searched, matched) {\n cleanup();\n self.postMessage({ type: 'complete', status, searched: searched.toString(), matched: matched.toString() });\n };\n\n try {\n const mode = msg.mode || 'random';\n if (mode === 'random') {\n activeSearch = MotelyWasm.startRandomSearch(msg.jaml, msg.count);\n } else if (mode === 'aesthetic') {\n activeSearch = MotelyWasm.startAestheticSearch(msg.jaml, msg.aesthetic);\n } else if (mode === 'seedList') {\n activeSearch = MotelyWasm.startSeedListSearch(msg.jaml, msg.seeds);\n } else if (mode === 'keyword') {\n activeSearch = MotelyWasm.startKeywordSearch(msg.jaml, msg.keywords, msg.padding || '');\n } else if (mode === 'sequential') {\n activeSearch = MotelyWasm.startSequentialSearch(msg.jaml, msg.batchCharCount, BigInt(msg.startBatch), BigInt(msg.endBatch));\n } else {\n self.postMessage({ type: 'error', message: 'Unknown search mode: ' + mode });\n cleanup();\n return;\n }\n } catch (err) {\n cleanup();\n self.postMessage({ type: 'error', message: String(err) });\n }\n return;\n }\n\n if (msg.type === 'stop') {\n if (activeSearch) { activeSearch.cancel(); activeSearch = null; }\n self.postMessage({ type: 'cancelled' });\n }\n\n if (msg.type === 'get_tally_labels') {\n if (!MotelyWasm) { self.postMessage({ type: 'error', message: 'Not initialized' }); return; }\n try {\n const labels = MotelyWasm.getTallyLabels(msg.jaml);\n self.postMessage({ type: 'tally_labels', labels: Array.from(labels) });\n } catch (err) {\n self.postMessage({ type: 'error', message: String(err) });\n }\n }\n});\n";
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
export const SEARCH_WORKER_CODE = `
|
|
2
|
-
let MotelyWasm = null;
|
|
3
|
-
let MotelyWasmEvents = null;
|
|
4
|
-
let activeSearch = null;
|
|
5
|
-
|
|
6
|
-
self.addEventListener('message', async function(e) {
|
|
7
|
-
const msg = e.data;
|
|
8
|
-
|
|
9
|
-
if (msg.type === 'init') {
|
|
10
|
-
try {
|
|
11
|
-
const mod = await import(msg.url);
|
|
12
|
-
await mod.default.boot();
|
|
13
|
-
const motely = mod.Motely;
|
|
14
|
-
MotelyWasm = motely.MotelyWasm;
|
|
15
|
-
MotelyWasmEvents = motely.MotelyWasmEvents;
|
|
16
|
-
self.postMessage({ type: 'ready' });
|
|
17
|
-
} catch (err) {
|
|
18
|
-
self.postMessage({ type: 'error', message: String(err) });
|
|
19
|
-
}
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (msg.type === 'start') {
|
|
24
|
-
if (!MotelyWasm) { self.postMessage({ type: 'error', message: 'Not initialized' }); return; }
|
|
25
|
-
const validation = MotelyWasm.validateJaml(msg.jaml);
|
|
26
|
-
if (validation !== 'valid') { self.postMessage({ type: 'error', message: validation }); return; }
|
|
27
|
-
|
|
28
|
-
function cleanup() {
|
|
29
|
-
MotelyWasmEvents.notifyResult = () => {};
|
|
30
|
-
MotelyWasmEvents.notifyProgress = () => {};
|
|
31
|
-
MotelyWasmEvents.notifyComplete = () => {};
|
|
32
|
-
activeSearch = null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
MotelyWasmEvents.notifyResult = function(seed, score, tallyColumns) {
|
|
36
|
-
self.postMessage({ type: 'result', seed, score, tallyColumns: Array.from(tallyColumns) });
|
|
37
|
-
};
|
|
38
|
-
MotelyWasmEvents.notifyProgress = function(searched, matching) {
|
|
39
|
-
self.postMessage({ type: 'progress', searched: searched.toString(), matching: matching.toString() });
|
|
40
|
-
};
|
|
41
|
-
MotelyWasmEvents.notifyComplete = function(status, searched, matched) {
|
|
42
|
-
cleanup();
|
|
43
|
-
self.postMessage({ type: 'complete', status, searched: searched.toString(), matched: matched.toString() });
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
const mode = msg.mode || 'random';
|
|
48
|
-
if (mode === 'random') {
|
|
49
|
-
activeSearch = MotelyWasm.startRandomSearch(msg.jaml, msg.count);
|
|
50
|
-
} else if (mode === 'aesthetic') {
|
|
51
|
-
activeSearch = MotelyWasm.startAestheticSearch(msg.jaml, msg.aesthetic);
|
|
52
|
-
} else if (mode === 'seedList') {
|
|
53
|
-
activeSearch = MotelyWasm.startSeedListSearch(msg.jaml, msg.seeds);
|
|
54
|
-
} else if (mode === 'keyword') {
|
|
55
|
-
activeSearch = MotelyWasm.startKeywordSearch(msg.jaml, msg.keywords, msg.padding || '');
|
|
56
|
-
} else if (mode === 'sequential') {
|
|
57
|
-
activeSearch = MotelyWasm.startSequentialSearch(msg.jaml, msg.batchCharCount, BigInt(msg.startBatch), BigInt(msg.endBatch));
|
|
58
|
-
} else {
|
|
59
|
-
self.postMessage({ type: 'error', message: 'Unknown search mode: ' + mode });
|
|
60
|
-
cleanup();
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
} catch (err) {
|
|
64
|
-
cleanup();
|
|
65
|
-
self.postMessage({ type: 'error', message: String(err) });
|
|
66
|
-
}
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (msg.type === 'stop') {
|
|
71
|
-
if (activeSearch) { activeSearch.cancel(); activeSearch = null; }
|
|
72
|
-
self.postMessage({ type: 'cancelled' });
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (msg.type === 'get_tally_labels') {
|
|
76
|
-
if (!MotelyWasm) { self.postMessage({ type: 'error', message: 'Not initialized' }); return; }
|
|
77
|
-
try {
|
|
78
|
-
const labels = MotelyWasm.getTallyLabels(msg.jaml);
|
|
79
|
-
self.postMessage({ type: 'tally_labels', labels: Array.from(labels) });
|
|
80
|
-
} catch (err) {
|
|
81
|
-
self.postMessage({ type: 'error', message: String(err) });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
`;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState, useCallback } from "react";
|
|
3
|
-
import { extractVisualJamlItems } from "../utils/jamlMapPreview.js";
|
|
4
|
-
import { motelyItemDisplayNameFromValue } from "../motelyDisplay.js";
|
|
5
|
-
export function useAnalyzer(motely) {
|
|
6
|
-
const [antes, setAntes] = useState([]);
|
|
7
|
-
const [status, setStatus] = useState("idle");
|
|
8
|
-
const [error, setError] = useState(null);
|
|
9
|
-
const [live, setLive] = useState(null);
|
|
10
|
-
const [tallyColumns, setTallyColumns] = useState([]);
|
|
11
|
-
const [tallyLabels, setTallyLabels] = useState([]);
|
|
12
|
-
const analyze = useCallback(async (seed, deck, stake, jaml) => {
|
|
13
|
-
if (!motely) {
|
|
14
|
-
setError("motely-wasm not ready");
|
|
15
|
-
setStatus("error");
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const MotelyWasm = motely.MotelyWasm;
|
|
19
|
-
setAntes([]);
|
|
20
|
-
setLive(null);
|
|
21
|
-
setTallyColumns([]);
|
|
22
|
-
setTallyLabels([]);
|
|
23
|
-
setStatus("running");
|
|
24
|
-
setError(null);
|
|
25
|
-
try {
|
|
26
|
-
const deckEnum = motely.MotelyDeck[deck] ?? motely.MotelyDeck.Red;
|
|
27
|
-
const stakeEnum = motely.MotelyStake[stake] ?? motely.MotelyStake.White;
|
|
28
|
-
const desiredNames = new Set();
|
|
29
|
-
if (jaml) {
|
|
30
|
-
const groups = extractVisualJamlItems(jaml);
|
|
31
|
-
for (const item of [...groups.must, ...groups.should]) {
|
|
32
|
-
desiredNames.add(item.value.toLowerCase());
|
|
33
|
-
}
|
|
34
|
-
const labels = MotelyWasm.getTallyLabels(jaml);
|
|
35
|
-
setTallyLabels(labels);
|
|
36
|
-
}
|
|
37
|
-
const ctx = MotelyWasm.createSearchContext(seed, deckEnum, stakeEnum);
|
|
38
|
-
const bossStream = ctx.createBossStream();
|
|
39
|
-
let runState = { voucherBitfield: 0, bossBitfield: 0 };
|
|
40
|
-
const results = [];
|
|
41
|
-
const runStates = {};
|
|
42
|
-
for (let ante = 1; ante <= 39; ante++) {
|
|
43
|
-
const bossResult = ctx.getNextBossForAnte(bossStream, ante, runState);
|
|
44
|
-
const bossName = motely.MotelyBossBlind[bossResult.boss] ?? `Unknown(${bossResult.boss})`;
|
|
45
|
-
runState = bossResult.runState;
|
|
46
|
-
const voucherResult = ctx.getAnteFirstVoucher(ante, runState);
|
|
47
|
-
const voucherName = motely.MotelyVoucher[voucherResult.voucher] ?? `Unknown(${voucherResult.voucher})`;
|
|
48
|
-
runState = voucherResult.runState;
|
|
49
|
-
runStates[ante] = { ...runState };
|
|
50
|
-
const tagStream = ctx.createTagStream(ante);
|
|
51
|
-
const tag1 = ctx.getNextTag(tagStream);
|
|
52
|
-
const tag2 = ctx.getNextTag(tagStream);
|
|
53
|
-
const packStream = ctx.createBoosterPackStream(ante);
|
|
54
|
-
const packs = [];
|
|
55
|
-
for (let p = 0; p < 2; p++) {
|
|
56
|
-
const packResult = ctx.getNextBoosterPack(packStream);
|
|
57
|
-
packs.push(motely.MotelyBoosterPack[packResult.pack] ?? `Unknown(${packResult.pack})`);
|
|
58
|
-
}
|
|
59
|
-
const shopStream = ctx.createShopItemStream(ante, runState, motely.MotelyShopStreamFlags.Default, motely.MotelyJokerStreamFlags.Default);
|
|
60
|
-
const shop = [];
|
|
61
|
-
for (let i = 0; i < 4; i++) {
|
|
62
|
-
const itemResult = ctx.getNextShopItem(shopStream);
|
|
63
|
-
const name = motelyItemDisplayNameFromValue(itemResult.item.value);
|
|
64
|
-
const desired = desiredNames.size > 0 && desiredNames.has(name.toLowerCase());
|
|
65
|
-
shop.push({ id: `${ante}-shop-${i}`, name, value: itemResult.item.value, desired });
|
|
66
|
-
}
|
|
67
|
-
results.push({
|
|
68
|
-
ante,
|
|
69
|
-
boss: bossName,
|
|
70
|
-
voucher: voucherName,
|
|
71
|
-
smallBlindTag: motely.MotelyTag[tag1.tag] ?? `Unknown(${tag1.tag})`,
|
|
72
|
-
bigBlindTag: motely.MotelyTag[tag2.tag] ?? `Unknown(${tag2.tag})`,
|
|
73
|
-
packs,
|
|
74
|
-
shop,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
setAntes(results);
|
|
78
|
-
setLive({ ctx, Motely: motely, runStates, desiredNames, seed, deck, stake });
|
|
79
|
-
setStatus("done");
|
|
80
|
-
}
|
|
81
|
-
catch (e) {
|
|
82
|
-
setError(e instanceof Error ? e.message : String(e));
|
|
83
|
-
setStatus("error");
|
|
84
|
-
}
|
|
85
|
-
}, [motely]);
|
|
86
|
-
const clearError = useCallback(() => {
|
|
87
|
-
setError(null);
|
|
88
|
-
setStatus((s) => (s === "error" ? "idle" : s));
|
|
89
|
-
}, []);
|
|
90
|
-
return { antes, status, error, analyze, clearError, live, tallyColumns, tallyLabels };
|
|
91
|
-
}
|