jaml-ui 0.7.2 → 0.8.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/LICENSE +21 -21
- package/README.md +135 -135
- package/dist/assets.js +1 -1
- package/dist/components/JamlIde.d.ts +4 -0
- package/dist/components/JamlIde.js +36 -1
- package/dist/components/JamlIdeToolbar.js +43 -2
- package/dist/data/balatro-jokers.json +1241 -0
- package/dist/hooks/searchWorkerCode.js +59 -59
- 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/ui/footer.js +5 -5
- package/dist/utils/jamlVisualFilter.d.ts +9 -0
- package/dist/utils/jamlVisualFilter.js +194 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 pifreak
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pifreak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
# jaml-ui
|
|
2
|
-
|
|
3
|
-
React components, UI tokens, sprites, and utilities for Balatro/JAML apps.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install jaml-ui react react-dom
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Package exports
|
|
12
|
-
|
|
13
|
-
| Entry | Contents |
|
|
14
|
-
|-------|----------|
|
|
15
|
-
| `jaml-ui` | Game card components, JAML IDE, Analyzer Explorer, hooks |
|
|
16
|
-
| `jaml-ui/ui` | Jimbo design system — JimboPanel, JimboButton, JimboModal, tokens |
|
|
17
|
-
| `jaml-ui/core` | Pure asset helpers, sprite metadata, decode utilities (no React) |
|
|
18
|
-
| `jaml-ui/motely` | motely-wasm decode helpers (requires `motely-wasm` peer) |
|
|
19
|
-
| `jaml-ui/r3f` | 3D card component via React Three Fiber (requires r3f peers) |
|
|
20
|
-
|
|
21
|
-
## Quick start
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import { JamlGameCard, AnalyzerExplorer, JamlIde } from "jaml-ui";
|
|
25
|
-
import { JimboPanel, JimboButton } from "jaml-ui/ui";
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Game card
|
|
29
|
-
|
|
30
|
-
```tsx
|
|
31
|
-
import { JamlGameCard } from "jaml-ui";
|
|
32
|
-
|
|
33
|
-
<JamlGameCard
|
|
34
|
-
type="joker"
|
|
35
|
-
card={{ name: "Blueprint", edition: "Foil", isEternal: true, scale: 1.5 }}
|
|
36
|
-
/>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Jimbo UI (Balatro design system)
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
import { JimboPanel, JimboButton, JimboModal } from "jaml-ui/ui";
|
|
43
|
-
import { JimboColorOption } from "jaml-ui/ui";
|
|
44
|
-
|
|
45
|
-
<JimboPanel sway onBack={() => setOpen(false)}>
|
|
46
|
-
<JimboButton variant="primary" onClick={handleSearch}>Search</JimboButton>
|
|
47
|
-
</JimboPanel>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Available variants: `primary`, `secondary`, `danger`, `back`, `ghost`
|
|
51
|
-
|
|
52
|
-
### JAML IDE
|
|
53
|
-
|
|
54
|
-
```tsx
|
|
55
|
-
import { JamlIde } from "jaml-ui";
|
|
56
|
-
|
|
57
|
-
<JamlIde
|
|
58
|
-
jaml={jaml}
|
|
59
|
-
onChange={setJaml}
|
|
60
|
-
searchResults={results}
|
|
61
|
-
onSearch={handleSearch}
|
|
62
|
-
isSearching={isSearching}
|
|
63
|
-
/>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Analyzer Explorer
|
|
67
|
-
|
|
68
|
-
```tsx
|
|
69
|
-
import { AnalyzerExplorer } from "jaml-ui";
|
|
70
|
-
|
|
71
|
-
// antes: AnalyzerAnteView[] — stream from motely-wasm createSearchContext
|
|
72
|
-
<AnalyzerExplorer antes={antes} totalAntes={8} highlights={highlights} />
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### JAML Map Preview
|
|
76
|
-
|
|
77
|
-
```tsx
|
|
78
|
-
import { JamlMapPreview } from "jaml-ui";
|
|
79
|
-
|
|
80
|
-
<JamlMapPreview jaml={jaml} />
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Asset handling
|
|
84
|
-
|
|
85
|
-
By default sprites resolve from the package `assets/` directory via `import.meta.url`.
|
|
86
|
-
|
|
87
|
-
Override at app startup:
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
import { setJamlAssetBaseUrl, clearJamlAssetBaseUrl } from "jaml-ui";
|
|
91
|
-
|
|
92
|
-
setJamlAssetBaseUrl("/vendor/jaml-ui/"); // custom CDN
|
|
93
|
-
clearJamlAssetBaseUrl(); // back to default
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Core utilities
|
|
97
|
-
|
|
98
|
-
```ts
|
|
99
|
-
import { SPRITE_SHEETS, getSpriteData, resolveJamlAssetUrl } from "jaml-ui/core";
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Motely decode helpers
|
|
103
|
-
|
|
104
|
-
```ts
|
|
105
|
-
import { decodeMotelyItemName, motelyItemTypeName } from "jaml-ui/motely";
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## 3D card (optional)
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
npm install three @react-three/fiber @react-three/drei @react-spring/three
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
```tsx
|
|
115
|
-
import { Card3D } from "jaml-ui/r3f";
|
|
116
|
-
|
|
117
|
-
<Card3D itemName="Blueprint" />
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Next.js
|
|
121
|
-
|
|
122
|
-
Import pure helpers from `jaml-ui/core` for server components. For local workspace installs add:
|
|
123
|
-
|
|
124
|
-
```ts
|
|
125
|
-
// next.config.ts
|
|
126
|
-
const nextConfig = { transpilePackages: ["jaml-ui"] };
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Peer dependencies
|
|
130
|
-
|
|
131
|
-
| Peer | Required for |
|
|
132
|
-
|------|-------------|
|
|
133
|
-
| `react`, `react-dom` | All components |
|
|
134
|
-
| `motely-wasm ^10 \|\| ^11 \|\| ^12` | `jaml-ui/motely`, `AnalyzerExplorer` data |
|
|
135
|
-
| `three`, `@react-three/fiber`, `@react-three/drei`, `@react-spring/three` | `jaml-ui/r3f` only |
|
|
1
|
+
# jaml-ui
|
|
2
|
+
|
|
3
|
+
React components, UI tokens, sprites, and utilities for Balatro/JAML apps.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install jaml-ui react react-dom
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Package exports
|
|
12
|
+
|
|
13
|
+
| Entry | Contents |
|
|
14
|
+
|-------|----------|
|
|
15
|
+
| `jaml-ui` | Game card components, JAML IDE, Analyzer Explorer, hooks |
|
|
16
|
+
| `jaml-ui/ui` | Jimbo design system — JimboPanel, JimboButton, JimboModal, tokens |
|
|
17
|
+
| `jaml-ui/core` | Pure asset helpers, sprite metadata, decode utilities (no React) |
|
|
18
|
+
| `jaml-ui/motely` | motely-wasm decode helpers (requires `motely-wasm` peer) |
|
|
19
|
+
| `jaml-ui/r3f` | 3D card component via React Three Fiber (requires r3f peers) |
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { JamlGameCard, AnalyzerExplorer, JamlIde } from "jaml-ui";
|
|
25
|
+
import { JimboPanel, JimboButton } from "jaml-ui/ui";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Game card
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { JamlGameCard } from "jaml-ui";
|
|
32
|
+
|
|
33
|
+
<JamlGameCard
|
|
34
|
+
type="joker"
|
|
35
|
+
card={{ name: "Blueprint", edition: "Foil", isEternal: true, scale: 1.5 }}
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Jimbo UI (Balatro design system)
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { JimboPanel, JimboButton, JimboModal } from "jaml-ui/ui";
|
|
43
|
+
import { JimboColorOption } from "jaml-ui/ui";
|
|
44
|
+
|
|
45
|
+
<JimboPanel sway onBack={() => setOpen(false)}>
|
|
46
|
+
<JimboButton variant="primary" onClick={handleSearch}>Search</JimboButton>
|
|
47
|
+
</JimboPanel>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Available variants: `primary`, `secondary`, `danger`, `back`, `ghost`
|
|
51
|
+
|
|
52
|
+
### JAML IDE
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { JamlIde } from "jaml-ui";
|
|
56
|
+
|
|
57
|
+
<JamlIde
|
|
58
|
+
jaml={jaml}
|
|
59
|
+
onChange={setJaml}
|
|
60
|
+
searchResults={results}
|
|
61
|
+
onSearch={handleSearch}
|
|
62
|
+
isSearching={isSearching}
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Analyzer Explorer
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { AnalyzerExplorer } from "jaml-ui";
|
|
70
|
+
|
|
71
|
+
// antes: AnalyzerAnteView[] — stream from motely-wasm createSearchContext
|
|
72
|
+
<AnalyzerExplorer antes={antes} totalAntes={8} highlights={highlights} />
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### JAML Map Preview
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { JamlMapPreview } from "jaml-ui";
|
|
79
|
+
|
|
80
|
+
<JamlMapPreview jaml={jaml} />
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Asset handling
|
|
84
|
+
|
|
85
|
+
By default sprites resolve from the package `assets/` directory via `import.meta.url`.
|
|
86
|
+
|
|
87
|
+
Override at app startup:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { setJamlAssetBaseUrl, clearJamlAssetBaseUrl } from "jaml-ui";
|
|
91
|
+
|
|
92
|
+
setJamlAssetBaseUrl("/vendor/jaml-ui/"); // custom CDN
|
|
93
|
+
clearJamlAssetBaseUrl(); // back to default
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Core utilities
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { SPRITE_SHEETS, getSpriteData, resolveJamlAssetUrl } from "jaml-ui/core";
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Motely decode helpers
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { decodeMotelyItemName, motelyItemTypeName } from "jaml-ui/motely";
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 3D card (optional)
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm install three @react-three/fiber @react-three/drei @react-spring/three
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { Card3D } from "jaml-ui/r3f";
|
|
116
|
+
|
|
117
|
+
<Card3D itemName="Blueprint" />
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Next.js
|
|
121
|
+
|
|
122
|
+
Import pure helpers from `jaml-ui/core` for server components. For local workspace installs add:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
// next.config.ts
|
|
126
|
+
const nextConfig = { transpilePackages: ["jaml-ui"] };
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Peer dependencies
|
|
130
|
+
|
|
131
|
+
| Peer | Required for |
|
|
132
|
+
|------|-------------|
|
|
133
|
+
| `react`, `react-dom` | All components |
|
|
134
|
+
| `motely-wasm ^10 \|\| ^11 \|\| ^12` | `jaml-ui/motely`, `AnalyzerExplorer` data |
|
|
135
|
+
| `three`, `@react-three/fiber`, `@react-three/drei`, `@react-spring/three` | `jaml-ui/r3f` only |
|
package/dist/assets.js
CHANGED
|
@@ -12,7 +12,7 @@ export const JAML_ASSET_FILES = {
|
|
|
12
12
|
};
|
|
13
13
|
const assetKeyByFileName = Object.fromEntries(Object.entries(JAML_ASSET_FILES).map(([key, fileName]) => [fileName, key]));
|
|
14
14
|
// Keep in lockstep with package.json version. Upload assets to this path when publishing.
|
|
15
|
-
const JAML_UI_VERSION = "0.
|
|
15
|
+
const JAML_UI_VERSION = "0.8.0";
|
|
16
16
|
const CDN_BASE = `https://cdn.seedfinder.app/jaml-ui/${JAML_UI_VERSION}/assets/`;
|
|
17
17
|
const defaultAssetUrls = {
|
|
18
18
|
deck: `${CDN_BASE}${JAML_ASSET_FILES.deck}`,
|
|
@@ -22,6 +22,10 @@ export interface JamlIdeProps {
|
|
|
22
22
|
codePlaceholder?: string;
|
|
23
23
|
onSearch?: () => void;
|
|
24
24
|
isSearching?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Controlled visual filter. When provided alongside `onVisualFilterChange`, the Visual tab
|
|
27
|
+
* is fully controlled by the parent. When absent, the Visual tab auto-derives from the text.
|
|
28
|
+
*/
|
|
25
29
|
visualFilter?: JamlVisualFilter;
|
|
26
30
|
onVisualFilterChange?: (filter: JamlVisualFilter) => void;
|
|
27
31
|
}
|
|
@@ -5,6 +5,7 @@ import { JamlMapPreview } from "./JamlMapPreview.js";
|
|
|
5
5
|
import { JamlIdeToolbar } from "./JamlIdeToolbar.js";
|
|
6
6
|
import { JamlIdeVisual } from "./JamlIdeVisual.js";
|
|
7
7
|
import { JimboColorOption } from "../ui/tokens.js";
|
|
8
|
+
import { jamlTextToVisualFilter, visualFilterToJamlText } from "../utils/jamlVisualFilter.js";
|
|
8
9
|
function TallyBar({ value, max }) {
|
|
9
10
|
const pct = max > 0 ? Math.min(1, value / max) : 0;
|
|
10
11
|
return (_jsx("div", { style: { flex: 1, height: 4, borderRadius: 999, background: `${JimboColorOption.DARK_GREY}88`, overflow: "hidden" }, children: _jsx("div", { style: {
|
|
@@ -93,6 +94,7 @@ export function JamlIde({ jaml, defaultJaml, onChange, defaultMode = "code", sea
|
|
|
93
94
|
const [mode, setMode] = useState(defaultMode);
|
|
94
95
|
const [internalText, setInternalText] = useState(jaml ?? defaultJaml ?? "");
|
|
95
96
|
const [lastJamlProp, setLastJamlProp] = useState(jaml);
|
|
97
|
+
// Adjust-state-during-render: sync controlled `jaml` prop into internal text.
|
|
96
98
|
if (jaml !== lastJamlProp) {
|
|
97
99
|
setLastJamlProp(jaml);
|
|
98
100
|
if (jaml !== undefined)
|
|
@@ -103,6 +105,38 @@ export function JamlIde({ jaml, defaultJaml, onChange, defaultMode = "code", sea
|
|
|
103
105
|
setInternalText(next);
|
|
104
106
|
onChange?.(next);
|
|
105
107
|
};
|
|
108
|
+
// Derived visual filter state (used only when not externally controlled).
|
|
109
|
+
// Cache the last successfully parsed filter so a mid-edit invalid state
|
|
110
|
+
// doesn't flash the visual panel empty.
|
|
111
|
+
const [lastParsedText, setLastParsedText] = useState("");
|
|
112
|
+
const [lastParsedFilter, setLastParsedFilter] = useState(() => jamlTextToVisualFilter(jaml ?? defaultJaml ?? ""));
|
|
113
|
+
// Adjust-state-during-render: reparse when text changes (only if not controlled).
|
|
114
|
+
if (visualFilter === undefined && text !== lastParsedText) {
|
|
115
|
+
try {
|
|
116
|
+
const parsed = jamlTextToVisualFilter(text);
|
|
117
|
+
setLastParsedText(text);
|
|
118
|
+
setLastParsedFilter(parsed);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// Keep previous filter on parse error — don't flash empty.
|
|
122
|
+
setLastParsedText(text);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const activeFilter = visualFilter ?? lastParsedFilter;
|
|
126
|
+
const handleVisualFilterChange = (next) => {
|
|
127
|
+
if (onVisualFilterChange) {
|
|
128
|
+
// Controlled: let parent own both.
|
|
129
|
+
onVisualFilterChange(next);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// Uncontrolled: round-trip through text so textarea stays source of truth.
|
|
133
|
+
const nextText = visualFilterToJamlText(next);
|
|
134
|
+
setInternalText(nextText);
|
|
135
|
+
setLastParsedFilter(next);
|
|
136
|
+
setLastParsedText(nextText);
|
|
137
|
+
onChange?.(nextText);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
106
140
|
const results = useMemo(() => searchResults, [searchResults]);
|
|
107
141
|
return (_jsxs("div", { className: className, style: {
|
|
108
142
|
display: "flex",
|
|
@@ -122,7 +156,7 @@ export function JamlIde({ jaml, defaultJaml, onChange, defaultMode = "code", sea
|
|
|
122
156
|
padding: "10px 14px",
|
|
123
157
|
borderBottom: `1px solid ${JimboColorOption.PANEL_EDGE}`,
|
|
124
158
|
background: JimboColorOption.TEAL_GREY,
|
|
125
|
-
}, children: [_jsxs("div", { children: [_jsx("div", { style: { fontSize: 14, fontWeight: 800, fontFamily: "m6x11plus, monospace", color: JimboColorOption.GOLD_TEXT }, children: title }), _jsx("div", { style: { fontSize: 11, color: JimboColorOption.GREY }, children: "Jimbo's Ante Markup Language" })] }), actions ? _jsx("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: actions }) : null] }), _jsx(JamlIdeToolbar, { mode: mode, onModeChange: setMode, resultCount: results.length, onSearch: onSearch, isSearching: isSearching }), _jsxs("div", { style: { flex: 1, minHeight: 0, overflow: "auto", background: JimboColorOption.DARKEST }, children: [mode === "visual"
|
|
159
|
+
}, children: [_jsxs("div", { children: [_jsx("div", { style: { fontSize: 14, fontWeight: 800, fontFamily: "m6x11plus, monospace", color: JimboColorOption.GOLD_TEXT }, children: title }), _jsx("div", { style: { fontSize: 11, color: JimboColorOption.GREY }, children: "Jimbo's Ante Markup Language" })] }), actions ? _jsx("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: actions }) : null] }), _jsx(JamlIdeToolbar, { mode: mode, onModeChange: setMode, resultCount: results.length, onSearch: onSearch, isSearching: isSearching }), _jsxs("div", { style: { flex: 1, minHeight: 0, overflow: "auto", background: JimboColorOption.DARKEST }, children: [mode === "visual" ? (_jsx(JamlIdeVisual, { filter: activeFilter, onChange: handleVisualFilterChange })) : null, mode === "code" ? (_jsx("textarea", { title: "JAML IDE Editor", value: text, onChange: (event) => handleTextChange(event.target.value), placeholder: codePlaceholder, spellCheck: false, autoCapitalize: "off", autoCorrect: "off", style: {
|
|
126
160
|
width: "100%",
|
|
127
161
|
minHeight: 320,
|
|
128
162
|
resize: "vertical",
|
|
@@ -134,5 +168,6 @@ export function JamlIde({ jaml, defaultJaml, onChange, defaultMode = "code", sea
|
|
|
134
168
|
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
|
|
135
169
|
fontSize: 13,
|
|
136
170
|
lineHeight: 1.7,
|
|
171
|
+
boxSizing: "border-box",
|
|
137
172
|
} })) : null, mode === "map" ? _jsx(JamlMapPreview, { jaml: text }) : null, mode === "results" ? (_jsx("div", { style: { padding: 12 }, children: _jsx(ResultsView, { results: results }) })) : null] })] }));
|
|
138
173
|
}
|
|
@@ -4,7 +4,7 @@ import { JimboButton } from "../ui/panel.js";
|
|
|
4
4
|
import { JimboColorOption } from "../ui/tokens.js";
|
|
5
5
|
const TABS = [
|
|
6
6
|
{ id: "visual", label: "Visual" },
|
|
7
|
-
{ id: "code", label: "
|
|
7
|
+
{ id: "code", label: ".jaml" },
|
|
8
8
|
{ id: "map", label: "Map" },
|
|
9
9
|
{ id: "results", label: "Results" },
|
|
10
10
|
];
|
|
@@ -17,5 +17,46 @@ export function JamlIdeToolbar({ mode, onModeChange, resultCount = 0, className
|
|
|
17
17
|
padding: "6px 10px",
|
|
18
18
|
borderBottom: `1px solid ${JimboColorOption.PANEL_EDGE}`,
|
|
19
19
|
background: JimboColorOption.DARKEST,
|
|
20
|
-
}, children: [_jsx("div", { style: {
|
|
20
|
+
}, children: [_jsx("div", { style: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
alignItems: "stretch",
|
|
23
|
+
gap: 0,
|
|
24
|
+
background: `${JimboColorOption.DARK_GREY}cc`,
|
|
25
|
+
borderRadius: 7,
|
|
26
|
+
border: `1px solid ${JimboColorOption.PANEL_EDGE}`,
|
|
27
|
+
padding: 2,
|
|
28
|
+
overflow: "hidden",
|
|
29
|
+
}, children: TABS.map((tab) => {
|
|
30
|
+
const isActive = mode === tab.id;
|
|
31
|
+
return (_jsxs("button", { type: "button", onClick: () => onModeChange(tab.id), style: {
|
|
32
|
+
display: "flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
gap: 5,
|
|
35
|
+
padding: "3px 10px",
|
|
36
|
+
border: "none",
|
|
37
|
+
borderRadius: 5,
|
|
38
|
+
cursor: "pointer",
|
|
39
|
+
fontFamily: "m6x11plus, monospace",
|
|
40
|
+
fontSize: 10,
|
|
41
|
+
letterSpacing: 1,
|
|
42
|
+
textTransform: "uppercase",
|
|
43
|
+
lineHeight: 1.2,
|
|
44
|
+
transition: "background 80ms, color 80ms, box-shadow 80ms",
|
|
45
|
+
color: isActive ? JimboColorOption.DARKEST : JimboColorOption.GREY,
|
|
46
|
+
background: isActive ? JimboColorOption.GOLD : "transparent",
|
|
47
|
+
boxShadow: isActive ? `0 2px 0 #8a6a1e` : "none",
|
|
48
|
+
textShadow: isActive ? "none" : "none",
|
|
49
|
+
userSelect: "none",
|
|
50
|
+
position: "relative",
|
|
51
|
+
transform: isActive ? "translateY(0)" : "translateY(0)",
|
|
52
|
+
}, children: [tab.label, tab.id === "results" && resultCount > 0 ? (_jsx("span", { style: {
|
|
53
|
+
borderRadius: 999,
|
|
54
|
+
background: isActive ? `${JimboColorOption.DARKEST}44` : `${JimboColorOption.GOLD}33`,
|
|
55
|
+
color: isActive ? JimboColorOption.DARKEST : JimboColorOption.GOLD_TEXT,
|
|
56
|
+
padding: "0px 5px",
|
|
57
|
+
fontSize: 9,
|
|
58
|
+
fontFamily: "monospace",
|
|
59
|
+
letterSpacing: 0,
|
|
60
|
+
}, children: resultCount })) : null] }, tab.id));
|
|
61
|
+
}) }), onSearch ? (_jsx(JimboButton, { tone: isSearching ? "red" : "blue", size: "xs", onClick: onSearch, children: isSearching ? "Stop" : "Search" })) : null] }));
|
|
21
62
|
}
|