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,137 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
import { EditorView, keymap, lineNumbers, highlightActiveLine, drawSelection, placeholder as cmPlaceholder } from "@codemirror/view";
|
|
5
|
-
import { EditorState } from "@codemirror/state";
|
|
6
|
-
import { yaml } from "@codemirror/lang-yaml";
|
|
7
|
-
import { defaultKeymap, history, historyKeymap, indentWithTab } from "@codemirror/commands";
|
|
8
|
-
import { syntaxHighlighting, HighlightStyle } from "@codemirror/language";
|
|
9
|
-
import { tags } from "@lezer/highlight";
|
|
10
|
-
import { JimboColorOption } from "../ui/tokens.js";
|
|
11
|
-
const balatroHighlight = HighlightStyle.define([
|
|
12
|
-
{ tag: tags.comment, color: JimboColorOption.GREY, fontStyle: "italic" },
|
|
13
|
-
{ tag: tags.keyword, color: JimboColorOption.RED },
|
|
14
|
-
{ tag: tags.string, color: JimboColorOption.GOLD_TEXT },
|
|
15
|
-
{ tag: tags.number, color: JimboColorOption.BLUE },
|
|
16
|
-
{ tag: tags.bool, color: JimboColorOption.BLUE },
|
|
17
|
-
{ tag: tags.null, color: JimboColorOption.GREY },
|
|
18
|
-
{ tag: tags.propertyName, color: JimboColorOption.GREEN_TEXT },
|
|
19
|
-
{ tag: tags.typeName, color: JimboColorOption.GREEN_TEXT },
|
|
20
|
-
]);
|
|
21
|
-
const balatroTheme = EditorView.theme({
|
|
22
|
-
"&": {
|
|
23
|
-
backgroundColor: JimboColorOption.DARKEST,
|
|
24
|
-
color: JimboColorOption.WHITE,
|
|
25
|
-
fontSize: "13px",
|
|
26
|
-
height: "100%",
|
|
27
|
-
},
|
|
28
|
-
".cm-content": {
|
|
29
|
-
fontFamily: "var(--j-font-code, 'JetBrains Mono', ui-monospace, monospace)",
|
|
30
|
-
lineHeight: "22px",
|
|
31
|
-
padding: "12px 0",
|
|
32
|
-
caretColor: JimboColorOption.GOLD_TEXT,
|
|
33
|
-
minHeight: "100%",
|
|
34
|
-
},
|
|
35
|
-
".cm-gutters": {
|
|
36
|
-
backgroundColor: JimboColorOption.DARKEST,
|
|
37
|
-
color: JimboColorOption.GREY,
|
|
38
|
-
border: "none",
|
|
39
|
-
},
|
|
40
|
-
".cm-lineNumbers .cm-gutterElement": {
|
|
41
|
-
minWidth: "2ch",
|
|
42
|
-
padding: "0 6px 0 8px",
|
|
43
|
-
},
|
|
44
|
-
".cm-activeLineGutter": {
|
|
45
|
-
color: JimboColorOption.GOLD_TEXT,
|
|
46
|
-
backgroundColor: "transparent",
|
|
47
|
-
},
|
|
48
|
-
".cm-activeLine": {
|
|
49
|
-
backgroundColor: `${JimboColorOption.BLACK}20`,
|
|
50
|
-
},
|
|
51
|
-
".cm-selectionBackground": {
|
|
52
|
-
backgroundColor: `${JimboColorOption.WHITE}20 !important`,
|
|
53
|
-
},
|
|
54
|
-
"&.cm-focused .cm-selectionBackground": {
|
|
55
|
-
backgroundColor: `${JimboColorOption.WHITE}20`,
|
|
56
|
-
},
|
|
57
|
-
".cm-cursor, .cm-dropCursor": {
|
|
58
|
-
borderLeftColor: JimboColorOption.GOLD_TEXT,
|
|
59
|
-
},
|
|
60
|
-
".cm-scroller": {
|
|
61
|
-
overflow: "auto",
|
|
62
|
-
},
|
|
63
|
-
".cm-placeholder": {
|
|
64
|
-
color: JimboColorOption.GREY,
|
|
65
|
-
fontStyle: "italic",
|
|
66
|
-
},
|
|
67
|
-
}, { dark: true });
|
|
68
|
-
export function JamlCodeEditor({ value, onChange, placeholder = "", minHeight = 320, }) {
|
|
69
|
-
const containerRef = useRef(null);
|
|
70
|
-
const viewRef = useRef(null);
|
|
71
|
-
const suppressEmitRef = useRef(false);
|
|
72
|
-
const lastSyncedValueRef = useRef(value);
|
|
73
|
-
const onChangeRef = useRef(onChange);
|
|
74
|
-
useEffect(() => { onChangeRef.current = onChange; });
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (!containerRef.current)
|
|
77
|
-
return;
|
|
78
|
-
const view = new EditorView({
|
|
79
|
-
state: EditorState.create({
|
|
80
|
-
doc: lastSyncedValueRef.current,
|
|
81
|
-
extensions: [
|
|
82
|
-
history(),
|
|
83
|
-
lineNumbers(),
|
|
84
|
-
highlightActiveLine(),
|
|
85
|
-
drawSelection(),
|
|
86
|
-
yaml(),
|
|
87
|
-
syntaxHighlighting(balatroHighlight),
|
|
88
|
-
balatroTheme,
|
|
89
|
-
EditorView.lineWrapping,
|
|
90
|
-
keymap.of([indentWithTab, ...defaultKeymap, ...historyKeymap]),
|
|
91
|
-
...(placeholder ? [cmPlaceholder(placeholder)] : []),
|
|
92
|
-
EditorView.updateListener.of((update) => {
|
|
93
|
-
if (update.docChanged && !suppressEmitRef.current) {
|
|
94
|
-
onChangeRef.current(update.state.doc.toString());
|
|
95
|
-
}
|
|
96
|
-
}),
|
|
97
|
-
],
|
|
98
|
-
}),
|
|
99
|
-
parent: containerRef.current,
|
|
100
|
-
});
|
|
101
|
-
viewRef.current = view;
|
|
102
|
-
return () => {
|
|
103
|
-
view.destroy();
|
|
104
|
-
viewRef.current = null;
|
|
105
|
-
};
|
|
106
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
107
|
-
}, []);
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
const view = viewRef.current;
|
|
110
|
-
if (!view)
|
|
111
|
-
return;
|
|
112
|
-
const current = view.state.doc.toString();
|
|
113
|
-
if (current === value) {
|
|
114
|
-
lastSyncedValueRef.current = value;
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
suppressEmitRef.current = true;
|
|
118
|
-
try {
|
|
119
|
-
// Streaming-friendly: append only the suffix when new value extends current.
|
|
120
|
-
if (value.length > current.length && value.startsWith(current)) {
|
|
121
|
-
view.dispatch({
|
|
122
|
-
changes: { from: view.state.doc.length, insert: value.slice(current.length) },
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
view.dispatch({
|
|
127
|
-
changes: { from: 0, to: view.state.doc.length, insert: value },
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
finally {
|
|
132
|
-
suppressEmitRef.current = false;
|
|
133
|
-
lastSyncedValueRef.current = value;
|
|
134
|
-
}
|
|
135
|
-
}, [value]);
|
|
136
|
-
return (_jsx("div", { ref: containerRef, style: { width: "100%", minHeight, background: JimboColorOption.DARKEST } }));
|
|
137
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { JimboButton, JimboPanel } from "../ui/panel.js";
|
|
5
|
-
import { JimboText } from "../ui/jimboText.js";
|
|
6
|
-
import { JimboColorOption } from "../ui/tokens.js";
|
|
7
|
-
import { JimboFlankNav } from "../ui/jimboFlankNav.js";
|
|
8
|
-
import { JamlMapEditor } from "./jamlMap/JamlMapEditor.js";
|
|
9
|
-
import { JamlAnalyzerFullscreen } from "./JamlAnalyzerFullscreen.js";
|
|
10
|
-
import { useSearch } from "../hooks/useSearch.js";
|
|
11
|
-
import { useAnalyzer } from "../hooks/useAnalyzer.js";
|
|
12
|
-
import { JamlSpeedometer } from "./JamlSpeedometer.js";
|
|
13
|
-
const C = JimboColorOption;
|
|
14
|
-
export function JamlCurator({ motely, motelyWasmUrl }) {
|
|
15
|
-
// Use map editor by default to generate JAML
|
|
16
|
-
const [jamlText, setJamlText] = useState("");
|
|
17
|
-
const search = useSearch(motelyWasmUrl);
|
|
18
|
-
const analyzer = useAnalyzer(motely);
|
|
19
|
-
// Search results pagination
|
|
20
|
-
const [resultIndex, setResultIndex] = useState(0);
|
|
21
|
-
const isSearching = search.status === "running";
|
|
22
|
-
const handleSearch = () => {
|
|
23
|
-
if (isSearching) {
|
|
24
|
-
search.cancel();
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
setResultIndex(0);
|
|
28
|
-
search.start(jamlText, 1_000_000);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const currentSeed = search.results[resultIndex]?.seed;
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (currentSeed) {
|
|
34
|
-
analyzer.analyze(currentSeed, "Red", "White", jamlText);
|
|
35
|
-
}
|
|
36
|
-
}, [currentSeed, jamlText]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
37
|
-
// Map Editor changes
|
|
38
|
-
const handleMapChange = (jamlString) => {
|
|
39
|
-
setJamlText(jamlString);
|
|
40
|
-
};
|
|
41
|
-
return (_jsx("div", { style: {
|
|
42
|
-
width: "100%",
|
|
43
|
-
maxWidth: 375,
|
|
44
|
-
height: "100dvh",
|
|
45
|
-
maxHeight: 812,
|
|
46
|
-
margin: "0 auto",
|
|
47
|
-
position: "relative",
|
|
48
|
-
background: C.DARKEST,
|
|
49
|
-
overflow: "hidden",
|
|
50
|
-
borderLeft: `1px solid ${C.PANEL_EDGE}`,
|
|
51
|
-
borderRight: `1px solid ${C.PANEL_EDGE}`,
|
|
52
|
-
boxShadow: `0 0 20px rgba(0,0,0,0.5)`,
|
|
53
|
-
}, children: _jsx(JamlAnalyzerFullscreen, { antes: analyzer.antes, live: analyzer.live, hidePicker: true, topPage: _jsxs("section", { style: {
|
|
54
|
-
width: "100%",
|
|
55
|
-
height: "100svh",
|
|
56
|
-
scrollSnapAlign: "start",
|
|
57
|
-
display: "flex",
|
|
58
|
-
flexDirection: "column",
|
|
59
|
-
gap: 12,
|
|
60
|
-
padding: "16px 12px 24px",
|
|
61
|
-
boxSizing: "border-box",
|
|
62
|
-
borderBottom: `2px solid ${C.GOLD}`,
|
|
63
|
-
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' }, children: [_jsx(JimboText, { size: "lg", tone: "gold", children: "JAML Curator" }), _jsx(JimboButton, { tone: isSearching ? "red" : "green", size: "sm", onClick: handleSearch, children: isSearching ? "STOP" : "SEARCH" })] }), _jsx("div", { style: { flex: 1, minHeight: 0, overflowY: 'auto' }, className: "hide-scrollbar", children: _jsx(JamlMapEditor, { onChange: handleMapChange }) }), _jsx("div", { style: { flexShrink: 0 }, children: _jsx(JamlSpeedometer, { status: search.status, seedsPerSecond: search.seedsPerSecond, totalSearched: search.totalSearched, matchingSeeds: search.matchingSeeds }) }), _jsx("div", { style: { flexShrink: 0 }, children: _jsx(JimboPanel, { children: search.results.length === 0 ? (_jsx(JimboText, { size: "sm", tone: "grey", className: "j-text-center", children: isSearching ? "Searching..." : "No results yet." })) : (_jsxs("div", { className: "j-flex-col j-gap-sm", children: [_jsxs("div", { className: "j-flex j-items-center j-justify-between", children: [_jsx(JimboText, { size: "xs", tone: "grey", children: "SEED MATCHES" }), _jsxs(JimboText, { size: "xs", tone: "gold", children: [search.matchingSeeds, " FOUND"] })] }), _jsx(JimboFlankNav, { canPrev: resultIndex > 0, canNext: resultIndex < search.results.length - 1, onPrev: () => setResultIndex(i => Math.max(0, i - 1)), onNext: () => setResultIndex(i => Math.min(search.results.length - 1, i + 1)), children: _jsxs("div", { className: "j-flex-col j-items-center j-gap-xs", children: [_jsx(JimboText, { size: "lg", tone: "gold", style: { letterSpacing: 2 }, children: currentSeed }), _jsx(JimboButton, { tone: "blue", size: "xs", children: "Copy Seed" })] }) }), _jsx(JimboText, { size: "micro", tone: "grey", className: "j-text-center", style: { opacity: 0.7, marginTop: 8 }, children: "\u25BC SWIPE DOWN FOR ANTES \u25BC" })] })) }) })] }) }) }));
|
|
64
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { JamlCurator } from "./JamlCurator.js";
|
|
2
|
-
const meta = {
|
|
3
|
-
title: "JAML/JamlCurator",
|
|
4
|
-
component: JamlCurator,
|
|
5
|
-
parameters: {
|
|
6
|
-
layout: "fullscreen",
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
export const Default = {
|
|
11
|
-
args: {
|
|
12
|
-
motelyWasmUrl: "https://unpkg.com/@nims11/motely@0.2.2/motely_bg.wasm",
|
|
13
|
-
},
|
|
14
|
-
};
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useState } from "react";
|
|
4
|
-
import { JamlMapPreview } from "./JamlMapPreview.js";
|
|
5
|
-
import { JamlMapEditor, CategoryMenu, JokerPicker, CategoryPicker, VOUCHER_PICKER_CONFIG, TAG_PICKER_CONFIG, BOSS_PICKER_CONFIG, TAROT_PICKER_CONFIG, PLANET_PICKER_CONFIG, SPECTRAL_PICKER_CONFIG, PACK_PICKER_CONFIG, } from "./jamlMap/index.js";
|
|
6
|
-
import { JamlIdeToolbar } from "./JamlIdeToolbar.js";
|
|
7
|
-
import { JamlIdeVisual } from "./JamlIdeVisual.js";
|
|
8
|
-
import { JamlCodeEditor } from "./JamlCodeEditor.js";
|
|
9
|
-
import { Jimbolate } from "./Jimbolate.js";
|
|
10
|
-
import { JimboColorOption } from "../ui/tokens.js";
|
|
11
|
-
import { JimboModal } from "../ui/panel.js";
|
|
12
|
-
import { jamlTextToVisualFilter, visualFilterToJamlText } from "../utils/jamlVisualFilter.js";
|
|
13
|
-
const CATEGORY_CONFIG_MAP = {
|
|
14
|
-
voucher: VOUCHER_PICKER_CONFIG,
|
|
15
|
-
tag: TAG_PICKER_CONFIG,
|
|
16
|
-
boss: BOSS_PICKER_CONFIG,
|
|
17
|
-
tarot: TAROT_PICKER_CONFIG,
|
|
18
|
-
planet: PLANET_PICKER_CONFIG,
|
|
19
|
-
spectral: SPECTRAL_PICKER_CONFIG,
|
|
20
|
-
pack: PACK_PICKER_CONFIG,
|
|
21
|
-
};
|
|
22
|
-
function TallyBar({ value, max }) {
|
|
23
|
-
const pct = max > 0 ? Math.min(1, value / max) : 0;
|
|
24
|
-
return (_jsx("div", { style: { flex: 1, height: 4, borderRadius: 999, background: `${JimboColorOption.DARK_GREY}88`, overflow: "hidden" }, children: _jsx("div", { style: {
|
|
25
|
-
height: "100%",
|
|
26
|
-
width: `${pct * 100}%`,
|
|
27
|
-
borderRadius: 999,
|
|
28
|
-
background: value > 0 ? JimboColorOption.GREEN : JimboColorOption.GREY,
|
|
29
|
-
transition: "width 200ms ease",
|
|
30
|
-
} }) }));
|
|
31
|
-
}
|
|
32
|
-
function ResultsView({ results, jaml }) {
|
|
33
|
-
const [expanded, setExpanded] = useState(null);
|
|
34
|
-
if (results.length === 0) {
|
|
35
|
-
return (_jsx("div", { style: {
|
|
36
|
-
border: `1px dashed ${JimboColorOption.DARK_GREY}`,
|
|
37
|
-
borderRadius: 10,
|
|
38
|
-
padding: 16,
|
|
39
|
-
fontSize: 12,
|
|
40
|
-
color: JimboColorOption.GREY,
|
|
41
|
-
background: `${JimboColorOption.DARKEST}88`,
|
|
42
|
-
textAlign: "center",
|
|
43
|
-
}, children: "No results yet. Run a search to find seeds." }));
|
|
44
|
-
}
|
|
45
|
-
const maxScore = Math.max(...results.map((r) => r.score ?? 0));
|
|
46
|
-
return (_jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: results.map((result) => {
|
|
47
|
-
const isOpen = expanded === result.seed;
|
|
48
|
-
const hasTally = result.tallyColumns && result.tallyColumns.length > 0;
|
|
49
|
-
return (_jsxs("div", { style: {
|
|
50
|
-
borderRadius: 10,
|
|
51
|
-
border: `1px solid ${isOpen ? JimboColorOption.GOLD + "55" : JimboColorOption.PANEL_EDGE}`,
|
|
52
|
-
background: isOpen ? `${JimboColorOption.GOLD}0a` : `${JimboColorOption.DARKEST}cc`,
|
|
53
|
-
overflow: "hidden",
|
|
54
|
-
transition: "border-color 120ms",
|
|
55
|
-
}, children: [_jsxs("button", { type: "button", onClick: () => hasTally && setExpanded(isOpen ? null : result.seed), style: {
|
|
56
|
-
width: "100%",
|
|
57
|
-
display: "flex",
|
|
58
|
-
alignItems: "center",
|
|
59
|
-
gap: 10,
|
|
60
|
-
padding: "9px 12px",
|
|
61
|
-
background: "none",
|
|
62
|
-
border: "none",
|
|
63
|
-
cursor: hasTally ? "pointer" : "default",
|
|
64
|
-
color: "inherit",
|
|
65
|
-
textAlign: "left",
|
|
66
|
-
}, children: [_jsx("span", { style: {
|
|
67
|
-
fontFamily: "m6x11plus, monospace",
|
|
68
|
-
fontWeight: "normal",
|
|
69
|
-
fontSize: 14,
|
|
70
|
-
letterSpacing: 1,
|
|
71
|
-
color: JimboColorOption.GOLD_TEXT,
|
|
72
|
-
minWidth: 80,
|
|
73
|
-
}, children: result.seed }), result.score !== undefined ? (_jsxs(_Fragment, { children: [_jsx(TallyBar, { value: result.score, max: maxScore }), _jsx("span", { style: {
|
|
74
|
-
fontSize: 12,
|
|
75
|
-
color: result.score > 0 ? JimboColorOption.GREEN_TEXT : JimboColorOption.GREY,
|
|
76
|
-
minWidth: 36,
|
|
77
|
-
textAlign: "right",
|
|
78
|
-
}, children: result.score })] })) : null, hasTally ? (_jsx("span", { style: { fontSize: 11, color: JimboColorOption.GREY, marginLeft: 2 }, children: isOpen ? "▲" : "▼" })) : null] }), isOpen && hasTally ? (_jsxs("div", { style: {
|
|
79
|
-
borderTop: `1px solid ${JimboColorOption.PANEL_EDGE}`,
|
|
80
|
-
padding: "4px",
|
|
81
|
-
display: "flex",
|
|
82
|
-
flexDirection: "column",
|
|
83
|
-
gap: 8,
|
|
84
|
-
}, children: [_jsx(JamlMapPreview, { jaml: jaml, tallyColumns: result.tallyColumns, tallyLabels: result.tallyLabels }), _jsxs("div", { style: { padding: "4px 8px 8px", display: "flex", flexDirection: "column", gap: 5 }, children: [_jsx("span", { style: { fontSize: 9, color: JimboColorOption.WHITE, opacity: 0.8 }, children: "Raw Tally Data" }), (result.tallyLabels ?? []).map((label, i) => {
|
|
85
|
-
const val = result.tallyColumns[i] ?? 0;
|
|
86
|
-
if (val === 0)
|
|
87
|
-
return null;
|
|
88
|
-
return (_jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [_jsx("span", { style: { fontSize: 10, color: JimboColorOption.WHITE, flex: 1 }, children: label }), _jsx("span", { style: { fontSize: 10, color: JimboColorOption.GREEN_TEXT }, children: val })] }, label));
|
|
89
|
-
})] })] })) : null] }, result.seed));
|
|
90
|
-
}) }));
|
|
91
|
-
}
|
|
92
|
-
export function JamlIde({ jaml, defaultJaml, onChange, defaultMode = "code", searchResults = [], className = "", style, title = "JAML IDE", subtitle = "Jimbo's Ante Markup Language", compactHeader = false, actions, codePlaceholder = "Enter JAML...", onSearch, isSearching = false, onTestSeed, jimbolateResult = "idle", jimbolateError, visualFilter, onVisualFilterChange, }) {
|
|
93
|
-
const [mode, setMode] = useState(defaultMode);
|
|
94
|
-
const [internalText, setInternalText] = useState(jaml ?? defaultJaml ?? "");
|
|
95
|
-
const [lastJamlProp, setLastJamlProp] = useState(jaml);
|
|
96
|
-
// Adjust-state-during-render: sync controlled `jaml` prop into internal text.
|
|
97
|
-
if (jaml !== lastJamlProp) {
|
|
98
|
-
setLastJamlProp(jaml);
|
|
99
|
-
if (jaml !== undefined)
|
|
100
|
-
setInternalText(jaml);
|
|
101
|
-
}
|
|
102
|
-
const text = internalText;
|
|
103
|
-
const handleTextChange = (next) => {
|
|
104
|
-
setInternalText(next);
|
|
105
|
-
onChange?.(next);
|
|
106
|
-
};
|
|
107
|
-
// Derived visual filter state (used only when not externally controlled).
|
|
108
|
-
// Cache the last successfully parsed filter so a mid-edit invalid state
|
|
109
|
-
// doesn't flash the visual panel empty.
|
|
110
|
-
const [lastParsedText, setLastParsedText] = useState("");
|
|
111
|
-
const [lastParsedFilter, setLastParsedFilter] = useState(() => jamlTextToVisualFilter(jaml ?? defaultJaml ?? ""));
|
|
112
|
-
// Adjust-state-during-render: reparse when text changes (only if not
|
|
113
|
-
// controlled). Gated on `mode === "visual"` so we don't burn CPU parsing
|
|
114
|
-
// on every streamed token while the user is in the .jaml/map/results tab.
|
|
115
|
-
if (visualFilter === undefined && mode === "visual" && text !== lastParsedText) {
|
|
116
|
-
try {
|
|
117
|
-
const parsed = jamlTextToVisualFilter(text);
|
|
118
|
-
setLastParsedText(text);
|
|
119
|
-
setLastParsedFilter(parsed);
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
// Keep previous filter on parse error — don't flash empty.
|
|
123
|
-
setLastParsedText(text);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const activeFilter = visualFilter ?? lastParsedFilter;
|
|
127
|
-
const handleVisualFilterChange = (next) => {
|
|
128
|
-
if (onVisualFilterChange) {
|
|
129
|
-
// Controlled: let parent own both.
|
|
130
|
-
onVisualFilterChange(next);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// Uncontrolled: round-trip through text so textarea stays source of truth.
|
|
134
|
-
const nextText = visualFilterToJamlText(next);
|
|
135
|
-
setInternalText(nextText);
|
|
136
|
-
setLastParsedFilter(next);
|
|
137
|
-
setLastParsedText(nextText);
|
|
138
|
-
onChange?.(nextText);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
const results = useMemo(() => searchResults, [searchResults]);
|
|
142
|
-
// ── Add-clause picker state ──────────────────────────────────────────────
|
|
143
|
-
const [addZone, setAddZone] = useState(null);
|
|
144
|
-
const [pickerFlow, setPickerFlow] = useState("category");
|
|
145
|
-
const handleAddClause = (zone) => {
|
|
146
|
-
setAddZone(zone);
|
|
147
|
-
setPickerFlow("category");
|
|
148
|
-
};
|
|
149
|
-
const handlePickerSelect = (sel) => {
|
|
150
|
-
if (!addZone)
|
|
151
|
-
return;
|
|
152
|
-
const clause = {
|
|
153
|
-
id: `${Date.now()}-${Math.random()}`,
|
|
154
|
-
type: sel.clauseKey,
|
|
155
|
-
value: sel.value,
|
|
156
|
-
label: sel.value,
|
|
157
|
-
};
|
|
158
|
-
handleVisualFilterChange({ ...activeFilter, [addZone]: [...activeFilter[addZone], clause] });
|
|
159
|
-
setAddZone(null);
|
|
160
|
-
};
|
|
161
|
-
const handlePickerClose = () => {
|
|
162
|
-
if (pickerFlow !== "category") {
|
|
163
|
-
setPickerFlow("category");
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
setAddZone(null);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
return (_jsxs("div", { className: className, style: {
|
|
170
|
-
display: "flex",
|
|
171
|
-
flexDirection: "column",
|
|
172
|
-
minHeight: 420,
|
|
173
|
-
borderRadius: 12,
|
|
174
|
-
overflow: "hidden",
|
|
175
|
-
overflowX: "clip",
|
|
176
|
-
overscrollBehaviorX: "none",
|
|
177
|
-
maxWidth: "100%",
|
|
178
|
-
border: `2px solid ${JimboColorOption.BORDER_SILVER}`,
|
|
179
|
-
boxShadow: `0 3px 0 0 ${JimboColorOption.BORDER_SOUTH}`,
|
|
180
|
-
background: JimboColorOption.DARK_GREY,
|
|
181
|
-
color: JimboColorOption.WHITE,
|
|
182
|
-
...style,
|
|
183
|
-
}, children: [_jsxs("div", { style: {
|
|
184
|
-
display: "flex",
|
|
185
|
-
alignItems: "center",
|
|
186
|
-
justifyContent: "space-between",
|
|
187
|
-
flexWrap: "wrap",
|
|
188
|
-
gap: compactHeader ? 8 : 12,
|
|
189
|
-
padding: compactHeader ? "8px 10px" : "10px 14px",
|
|
190
|
-
borderBottom: `1px solid ${JimboColorOption.PANEL_EDGE}`,
|
|
191
|
-
background: JimboColorOption.TEAL_GREY,
|
|
192
|
-
}, children: [_jsxs("div", { children: [_jsx("div", { style: { fontSize: 16, fontWeight: "normal", fontFamily: "m6x11plus, monospace", color: JimboColorOption.GOLD_TEXT }, children: title }), subtitle ? _jsx("div", { style: { fontSize: 11, color: "rgba(255,255,255,0.6)" }, children: subtitle }) : null] }), actions && (_jsx("div", { style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap", justifyContent: "flex-end" }, children: actions }))] }), _jsx(JamlIdeToolbar, { mode: mode, onModeChange: setMode, resultCount: results.length, onSearch: onSearch, isSearching: isSearching }), _jsxs("div", { style: { flex: 1, minHeight: 0, overflow: mode === "map" ? "hidden" : "auto", background: JimboColorOption.DARKEST }, children: [mode === "visual" ? (_jsx(JamlIdeVisual, { filter: activeFilter, onChange: handleVisualFilterChange, onAddClause: handleAddClause })) : null, mode === "code" ? (_jsx(JamlCodeEditor, { value: text, onChange: handleTextChange, placeholder: codePlaceholder })) : null, mode === "map" ? _jsx(JamlMapEditor, { onChange: handleTextChange }) : null, mode === "results" ? (_jsx("div", { style: { padding: 12 }, children: _jsx(ResultsView, { results: results, jaml: text }) })) : null, mode === "jimbolate" ? (_jsx(Jimbolate, { jaml: text, onTest: (seed) => onTestSeed?.(seed), result: jimbolateResult, error: jimbolateError })) : null] }), _jsx(JimboModal, { open: addZone !== null, onClose: handlePickerClose, children: addZone !== null && (pickerFlow === "category" ? (_jsx(CategoryMenu, { onSelect: (cat) => setPickerFlow(cat) })) : pickerFlow === "joker" ? (_jsx(JokerPicker, { onSelect: handlePickerSelect })) : (_jsx(CategoryPicker, { config: CATEGORY_CONFIG_MAP[pickerFlow], onSelect: handlePickerSelect }))) })] }));
|
|
193
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { JimboButton } from "../ui/panel.js";
|
|
4
|
-
import { JimboTabs } from "../ui/jimboTabs.js";
|
|
5
|
-
import { JimboColorOption } from "../ui/tokens.js";
|
|
6
|
-
export function JamlIdeToolbar({ mode, onModeChange, resultCount = 0, className = "", onSearch, isSearching = false }) {
|
|
7
|
-
const tabs = [
|
|
8
|
-
{ id: "visual", label: "Visual" },
|
|
9
|
-
{ id: "code", label: "JAML" },
|
|
10
|
-
{ id: "map", label: "Map" },
|
|
11
|
-
{ id: "results", label: resultCount > 0 ? `Results (${resultCount})` : "Results" },
|
|
12
|
-
{ id: "jimbolate", label: "Jimbolate" },
|
|
13
|
-
];
|
|
14
|
-
return (_jsxs("div", { className: className, style: {
|
|
15
|
-
display: "flex",
|
|
16
|
-
alignItems: "center",
|
|
17
|
-
gap: 8,
|
|
18
|
-
padding: "10px 10px 6px",
|
|
19
|
-
borderBottom: `1px solid ${JimboColorOption.PANEL_EDGE}`,
|
|
20
|
-
background: JimboColorOption.DARKEST,
|
|
21
|
-
minWidth: 0,
|
|
22
|
-
}, children: [_jsx("div", { style: { flex: 1, minWidth: 0, paddingBottom: 3 }, children: _jsx(JimboTabs, { tabs: tabs, activeTab: mode, onTabChange: (id) => onModeChange(id) }) }), onSearch && (_jsx("div", { style: { flexShrink: 0 }, children: _jsx(JimboButton, { tone: isSearching ? "red" : "orange", size: "sm", onClick: onSearch, children: isSearching ? "Stop" : "Search" }) }))] }));
|
|
23
|
-
}
|