jaml-ui 0.17.2 → 0.18.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/DESIGN.md +7 -3
- package/dist/components/JamlAnalyzerFullscreen.d.ts +4 -1
- package/dist/components/JamlAnalyzerFullscreen.js +2 -2
- package/dist/components/JamlCurator.d.ts +4 -0
- package/dist/components/JamlCurator.js +63 -0
- package/dist/components/JamlCurator.stories.d.ts +6 -0
- package/dist/components/JamlCurator.stories.js +14 -0
- package/dist/components/JamlIde.js +1 -1
- package/dist/components/JamlIdeVisual.js +12 -20
- package/dist/components/jamlMap/CategoryPicker.d.ts +32 -0
- package/dist/components/jamlMap/CategoryPicker.js +142 -0
- package/dist/components/jamlMap/JamlMapEditor.d.ts +11 -0
- package/dist/components/jamlMap/JamlMapEditor.js +170 -0
- package/dist/components/jamlMap/JamlMapEditor.stories.d.ts +7 -0
- package/dist/components/jamlMap/JamlMapEditor.stories.js +26 -0
- package/dist/components/jamlMap/JamlMapEditorDemo.d.ts +1 -1
- package/dist/components/jamlMap/JamlMapEditorDemo.js +174 -21
- package/dist/components/jamlMap/JokerPicker.js +28 -157
- package/dist/components/jamlMap/MysterySlot.js +32 -5
- package/dist/components/jamlMap/MysterySlot.stories.d.ts +7 -0
- package/dist/components/jamlMap/MysterySlot.stories.js +31 -0
- package/dist/components/jamlMap/index.d.ts +2 -1
- package/dist/components/jamlMap/index.js +2 -1
- package/dist/hooks/useAnalyzer.d.ts +4 -8
- package/dist/hooks/useAnalyzer.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/stories/Button.d.ts +15 -0
- package/dist/stories/Button.js +7 -0
- package/dist/stories/Button.stories.d.ts +24 -0
- package/dist/stories/Button.stories.js +50 -0
- package/dist/stories/Header.d.ts +12 -0
- package/dist/stories/Header.js +4 -0
- package/dist/stories/Header.stories.d.ts +18 -0
- package/dist/stories/Header.stories.js +26 -0
- package/dist/stories/Page.d.ts +3 -0
- package/dist/stories/Page.js +8 -0
- package/dist/stories/Page.stories.d.ts +12 -0
- package/dist/stories/Page.stories.js +24 -0
- package/dist/ui/Jimbo.stories.d.ts +7 -0
- package/dist/ui/Jimbo.stories.js +28 -0
- package/dist/ui/jimbo.css +20 -11
- package/dist/ui/jimboText.d.ts +1 -1
- package/dist/ui/panel.d.ts +1 -1
- package/dist/ui/panel.js +7 -5
- package/package.json +16 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MysterySlot } from './MysterySlot';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'JAML/MysterySlot',
|
|
5
|
+
component: MysterySlot,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Empty = {
|
|
12
|
+
args: {
|
|
13
|
+
zone: 'must',
|
|
14
|
+
width: 64,
|
|
15
|
+
},
|
|
16
|
+
render: (args) => (_jsx("div", { style: { background: '#1e2b2d', padding: 20 }, children: _jsx(MysterySlot, { ...args }) })),
|
|
17
|
+
};
|
|
18
|
+
export const FilledJoker = {
|
|
19
|
+
args: {
|
|
20
|
+
zone: 'must',
|
|
21
|
+
width: 64,
|
|
22
|
+
selection: {
|
|
23
|
+
clauseKey: 'joker',
|
|
24
|
+
value: 'Joker',
|
|
25
|
+
displayLabel: 'Joker',
|
|
26
|
+
spriteName: 'Joker',
|
|
27
|
+
sheetType: 'Jokers',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
render: (args) => (_jsx("div", { style: { background: '#1e2b2d', padding: 20 }, children: _jsx(MysterySlot, { ...args }) })),
|
|
31
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { MysterySlot, type MysterySlotProps, type SlotSelection, type SlotCategory, type JamlZone } from "./MysterySlot.js";
|
|
2
2
|
export { JokerPicker, type JokerPickerProps, type JokerRarity } from "./JokerPicker.js";
|
|
3
|
-
export {
|
|
3
|
+
export { JamlMapEditor, type JamlMapEditorProps } from "./JamlMapEditor.js";
|
|
4
|
+
export { CategoryPicker, type CategoryPickerConfig, type CategoryPickerProps, VOUCHER_PICKER_CONFIG, TAG_PICKER_CONFIG, BOSS_PICKER_CONFIG, TAROT_PICKER_CONFIG, PLANET_PICKER_CONFIG, SPECTRAL_PICKER_CONFIG, PACK_PICKER_CONFIG, } from "./CategoryPicker.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { MysterySlot } from "./MysterySlot.js";
|
|
2
2
|
export { JokerPicker } from "./JokerPicker.js";
|
|
3
|
-
export {
|
|
3
|
+
export { JamlMapEditor } from "./JamlMapEditor.js";
|
|
4
|
+
export { CategoryPicker, VOUCHER_PICKER_CONFIG, TAG_PICKER_CONFIG, BOSS_PICKER_CONFIG, TAROT_PICKER_CONFIG, PLANET_PICKER_CONFIG, SPECTRAL_PICKER_CONFIG, PACK_PICKER_CONFIG, } from "./CategoryPicker.js";
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MotelyWasm, Motely } from "motely-wasm";
|
|
2
2
|
import type { AnalyzerAnteView } from "../components/AnalyzerExplorer.js";
|
|
3
|
-
export interface MotelyRuntime {
|
|
4
|
-
MotelyWasm: typeof MotelyWasmT;
|
|
5
|
-
Motely: typeof MotelyT;
|
|
6
|
-
}
|
|
7
3
|
export type AnalyzerStatus = "idle" | "running" | "done" | "error";
|
|
8
4
|
export type MotelyJsRunState = {
|
|
9
5
|
voucherBitfield: number;
|
|
@@ -18,15 +14,15 @@ export type MotelyJsRunState = {
|
|
|
18
14
|
* `createShopItemStream(ante, runState, ...)`.
|
|
19
15
|
*/
|
|
20
16
|
export interface AnalyzerLive {
|
|
21
|
-
ctx: ReturnType<typeof
|
|
22
|
-
Motely: typeof
|
|
17
|
+
ctx: ReturnType<typeof MotelyWasm.createSearchContext>;
|
|
18
|
+
Motely: typeof Motely;
|
|
23
19
|
runStates: Record<number, MotelyJsRunState>;
|
|
24
20
|
desiredNames: ReadonlySet<string>;
|
|
25
21
|
seed: string;
|
|
26
22
|
deck: string;
|
|
27
23
|
stake: string;
|
|
28
24
|
}
|
|
29
|
-
export declare function useAnalyzer(
|
|
25
|
+
export declare function useAnalyzer(): {
|
|
30
26
|
antes: AnalyzerAnteView[];
|
|
31
27
|
status: AnalyzerStatus;
|
|
32
28
|
error: string | null;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
|
+
import { MotelyWasm, Motely } from "motely-wasm";
|
|
3
4
|
import { extractVisualJamlItems } from "../utils/jamlMapPreview.js";
|
|
4
5
|
import { motelyItemDisplayNameFromValue } from "../motelyDisplay.js";
|
|
5
|
-
export function useAnalyzer(
|
|
6
|
+
export function useAnalyzer() {
|
|
6
7
|
const [antes, setAntes] = useState([]);
|
|
7
8
|
const [status, setStatus] = useState("idle");
|
|
8
9
|
const [error, setError] = useState(null);
|
|
@@ -17,7 +18,6 @@ export function useAnalyzer(motelyRuntime) {
|
|
|
17
18
|
setStatus("running");
|
|
18
19
|
setError(null);
|
|
19
20
|
try {
|
|
20
|
-
const { MotelyWasm, Motely } = motelyRuntime;
|
|
21
21
|
const deckEnum = Motely.MotelyDeck[deck] ?? Motely.MotelyDeck.Red;
|
|
22
22
|
const stakeEnum = Motely.MotelyStake[stake] ?? Motely.MotelyStake.White;
|
|
23
23
|
const desiredNames = new Set();
|
|
@@ -77,7 +77,7 @@ export function useAnalyzer(motelyRuntime) {
|
|
|
77
77
|
setError(e instanceof Error ? e.message : String(e));
|
|
78
78
|
setStatus("error");
|
|
79
79
|
}
|
|
80
|
-
}, [
|
|
80
|
+
}, []);
|
|
81
81
|
const clearError = useCallback(() => {
|
|
82
82
|
setError(null);
|
|
83
83
|
setStatus((s) => (s === "error" ? "idle" : s));
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { Showcase, type ShowcaseFilter, type ShowcaseLiveStats, type ShowcasePro
|
|
|
21
21
|
export { extractVisualJamlItems, type JamlPreviewGroups, type JamlPreviewItem, type JamlPreviewSection, type JamlPreviewVisualType, } from "./utils/jamlMapPreview.js";
|
|
22
22
|
export { useMotelyStream, type StreamItem, type StreamState } from "./hooks/useShopStream.js";
|
|
23
23
|
export { useSearch, type SearchResult, type SearchStatus, type UseSearchState, } from "./hooks/useSearch.js";
|
|
24
|
-
export { useAnalyzer, type AnalyzerStatus, type AnalyzerLive, type
|
|
24
|
+
export { useAnalyzer, type AnalyzerStatus, type AnalyzerLive, type MotelyJsRunState, } from "./hooks/useAnalyzer.js";
|
|
25
25
|
export { JamlAestheticSelector, type JamlAestheticSelectorProps, type JamlAestheticOption, } from "./components/JamlAestheticSelector.js";
|
|
26
26
|
export { JamlSeedInput, type JamlSeedInputProps, } from "./components/JamlSeedInput.js";
|
|
27
|
-
export {
|
|
27
|
+
export { JamlMapEditor, JokerPicker, MysterySlot, CategoryPicker, type JamlMapEditorProps, type JokerPickerProps, type JokerRarity, type MysterySlotProps, type SlotCategory, type SlotSelection, type CategoryPickerConfig, type CategoryPickerProps, VOUCHER_PICKER_CONFIG, TAG_PICKER_CONFIG, BOSS_PICKER_CONFIG, TAROT_PICKER_CONFIG, PLANET_PICKER_CONFIG, SPECTRAL_PICKER_CONFIG, PACK_PICKER_CONFIG, } from "./components/jamlMap/index.js";
|
package/dist/index.js
CHANGED
|
@@ -25,4 +25,4 @@ export { useSearch, } from "./hooks/useSearch.js";
|
|
|
25
25
|
export { useAnalyzer, } from "./hooks/useAnalyzer.js";
|
|
26
26
|
export { JamlAestheticSelector, } from "./components/JamlAestheticSelector.js";
|
|
27
27
|
export { JamlSeedInput, } from "./components/JamlSeedInput.js";
|
|
28
|
-
export {
|
|
28
|
+
export { JamlMapEditor, JokerPicker, MysterySlot, CategoryPicker, VOUCHER_PICKER_CONFIG, TAG_PICKER_CONFIG, BOSS_PICKER_CONFIG, TAROT_PICKER_CONFIG, PLANET_PICKER_CONFIG, SPECTRAL_PICKER_CONFIG, PACK_PICKER_CONFIG, } from "./components/jamlMap/index.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './button.css';
|
|
2
|
+
export interface ButtonProps {
|
|
3
|
+
/** Is this the principal call to action on the page? */
|
|
4
|
+
primary?: boolean;
|
|
5
|
+
/** What background color to use */
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
/** How large should the button be? */
|
|
8
|
+
size?: 'small' | 'medium' | 'large';
|
|
9
|
+
/** Button contents */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Optional click handler */
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/** Primary UI component for user interaction */
|
|
15
|
+
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './button.css';
|
|
3
|
+
/** Primary UI component for user interaction */
|
|
4
|
+
export const Button = ({ primary = false, size = 'medium', backgroundColor, label, ...props }) => {
|
|
5
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
6
|
+
return (_jsx("button", { type: "button", className: ['storybook-button', `storybook-button--${size}`, mode].join(' '), style: { backgroundColor }, ...props, children: label }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
backgroundColor: {
|
|
11
|
+
control: "color";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
args: {
|
|
15
|
+
onClick: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
export declare const Primary: Story;
|
|
21
|
+
export declare const Secondary: Story;
|
|
22
|
+
export declare const Large: Story;
|
|
23
|
+
export declare const Small: Story;
|
|
24
|
+
export declare const JAMLUI: Story;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Example/Button',
|
|
6
|
+
component: Button,
|
|
7
|
+
parameters: {
|
|
8
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
14
|
+
argTypes: {
|
|
15
|
+
backgroundColor: { control: 'color' },
|
|
16
|
+
},
|
|
17
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
|
|
18
|
+
args: { onClick: fn() },
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
22
|
+
export const Primary = {
|
|
23
|
+
args: {
|
|
24
|
+
primary: true,
|
|
25
|
+
label: 'Button',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const Secondary = {
|
|
29
|
+
args: {
|
|
30
|
+
label: 'Button',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const Large = {
|
|
34
|
+
args: {
|
|
35
|
+
size: 'large',
|
|
36
|
+
label: 'Button',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export const Small = {
|
|
40
|
+
args: {
|
|
41
|
+
size: 'small',
|
|
42
|
+
label: 'Button',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export const JAMLUI = {
|
|
46
|
+
args: {
|
|
47
|
+
primary: false,
|
|
48
|
+
label: "Button"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import './header.css';
|
|
2
|
+
type User = {
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
export interface HeaderProps {
|
|
6
|
+
user?: User;
|
|
7
|
+
onLogin?: () => void;
|
|
8
|
+
onLogout?: () => void;
|
|
9
|
+
onCreateAccount?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const Header: ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import './header.css';
|
|
4
|
+
export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (_jsx("header", { children: _jsxs("div", { className: "storybook-header", children: [_jsxs("div", { children: [_jsx("svg", { width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsx("path", { d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z", fill: "#FFF" }), _jsx("path", { d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z", fill: "#555AB9" }), _jsx("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })] }) }), _jsx("h1", { children: "Acme" })] }), _jsx("div", { children: user ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "welcome", children: ["Welcome, ", _jsx("b", { children: user.name }), "!"] }), _jsx(Button, { size: "small", onClick: onLogout, label: "Log out" })] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { size: "small", onClick: onLogin, label: "Log in" }), _jsx(Button, { primary: true, size: "small", onClick: onCreateAccount, label: "Sign up" })] })) })] }) }));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ user, onLogin, onLogout, onCreateAccount }: import("./Header").HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
args: {
|
|
10
|
+
onLogin: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
onLogout: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
12
|
+
onCreateAccount: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
export declare const LoggedIn: Story;
|
|
18
|
+
export declare const LoggedOut: Story;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { Header } from './Header';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Example/Header',
|
|
5
|
+
component: Header,
|
|
6
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
onLogin: fn(),
|
|
14
|
+
onLogout: fn(),
|
|
15
|
+
onCreateAccount: fn(),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const LoggedIn = {
|
|
20
|
+
args: {
|
|
21
|
+
user: {
|
|
22
|
+
name: 'Jane Doe',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const LoggedOut = {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Header } from './Header';
|
|
4
|
+
import './page.css';
|
|
5
|
+
export const Page = () => {
|
|
6
|
+
const [user, setUser] = React.useState();
|
|
7
|
+
return (_jsxs("article", { children: [_jsx(Header, { user: user, onLogin: () => setUser({ name: 'Jane Doe' }), onLogout: () => setUser(undefined), onCreateAccount: () => setUser({ name: 'Jane Doe' }) }), _jsxs("section", { className: "storybook-page", children: [_jsx("h2", { children: "Pages in Storybook" }), _jsxs("p", { children: ["We recommend building UIs with a", ' ', _jsx("a", { href: "https://componentdriven.org", target: "_blank", rel: "noopener noreferrer", children: _jsx("strong", { children: "component-driven" }) }), ' ', "process starting with atomic components and ending with pages."] }), _jsx("p", { children: "Render pages with mock data. This makes it easy to build and review page states without needing to navigate to them in your app. Here are some handy patterns for managing page data in Storybook:" }), _jsxs("ul", { children: [_jsx("li", { children: "Use a higher-level connected component. Storybook helps you compose such data from the \"args\" of child component stories" }), _jsx("li", { children: "Assemble data in the page component from your services. You can mock these services out using Storybook." })] }), _jsxs("p", { children: ["Get a guided tutorial on component-driven development at", ' ', _jsx("a", { href: "https://storybook.js.org/tutorials/", target: "_blank", rel: "noopener noreferrer", children: "Storybook tutorials" }), ". Read more in the", ' ', _jsx("a", { href: "https://storybook.js.org/docs", target: "_blank", rel: "noopener noreferrer", children: "docs" }), "."] }), _jsxs("div", { className: "tip-wrapper", children: [_jsx("span", { className: "tip", children: "Tip" }), " Adjust the width of the canvas with the", ' ', _jsx("svg", { width: "10", height: "10", viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { fill: "none", fillRule: "evenodd", children: _jsx("path", { d: "M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z", id: "a", fill: "#999" }) }) }), "Viewports addon in the toolbar"] })] })] }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").FC<{}>;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const LoggedOut: Story;
|
|
12
|
+
export declare const LoggedIn: Story;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
2
|
+
import { Page } from './Page';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Example/Page',
|
|
5
|
+
component: Page,
|
|
6
|
+
parameters: {
|
|
7
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
8
|
+
layout: 'fullscreen',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const LoggedOut = {};
|
|
13
|
+
// More on component testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
|
14
|
+
export const LoggedIn = {
|
|
15
|
+
play: async ({ canvasElement }) => {
|
|
16
|
+
const canvas = within(canvasElement);
|
|
17
|
+
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
|
18
|
+
await expect(loginButton).toBeInTheDocument();
|
|
19
|
+
await userEvent.click(loginButton);
|
|
20
|
+
await expect(loginButton).not.toBeInTheDocument();
|
|
21
|
+
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
|
22
|
+
await expect(logoutButton).toBeInTheDocument();
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { JimboButton, JimboText, JimboModalRoot, useJimboModal } from './index';
|
|
3
|
+
import "./jimbo.css";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'JimboUI/Core',
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Typography = {
|
|
12
|
+
render: () => (_jsxs("div", { className: "j-panel", style: { display: "flex", flexDirection: "column", gap: 10, padding: 20 }, children: [_jsx(JimboText, { size: "title", tone: "white", children: "Title Text" }), _jsx(JimboText, { size: "header", tone: "gold", children: "Header Text (Gold)" }), _jsx(JimboText, { size: "lg", tone: "white", children: "Large Text" }), _jsx(JimboText, { size: "md", tone: "grey", children: "Medium Text (Grey)" }), _jsx(JimboText, { size: "sm", tone: "blue", children: "Small Text (Blue)" }), _jsx(JimboText, { size: "xs", tone: "red", children: "Extra Small (Red)" }), _jsx(JimboText, { size: "micro", tone: "tarot", children: "Micro Text (Tarot)" })] })),
|
|
13
|
+
};
|
|
14
|
+
export const Buttons = {
|
|
15
|
+
render: () => (_jsxs("div", { className: "j-panel", style: { display: "flex", flexDirection: "column", gap: 10, padding: 20, width: 300 }, children: [_jsx(JimboButton, { tone: "gold", size: "lg", children: "Large Gold Button" }), _jsx(JimboButton, { tone: "blue", size: "md", children: "Medium Blue Button" }), _jsx(JimboButton, { tone: "red", size: "sm", children: "Small Red Button" }), _jsx(JimboButton, { tone: "grey", size: "xs", children: "XS Grey Button" }), _jsxs("div", { style: { display: "flex", gap: 10 }, children: [_jsx(JimboButton, { tone: "tarot", size: "md", style: { flex: 1 }, children: "Flex 1" }), _jsx(JimboButton, { tone: "planet", size: "md", style: { flex: 1 }, children: "Flex 2" })] })] })),
|
|
16
|
+
};
|
|
17
|
+
const ModalDemo = () => {
|
|
18
|
+
const { openModal, closeModal } = useJimboModal();
|
|
19
|
+
return (_jsxs("div", { className: "j-panel", style: { padding: 20, textAlign: "center" }, children: [_jsx(JimboText, { size: "lg", tone: "white", children: "Modal Testing" }), _jsx("div", { style: { height: 20 } }), _jsx(JimboButton, { tone: "gold", size: "md", onClick: () => {
|
|
20
|
+
openModal("demo-modal", (_jsxs("div", { style: { padding: 20 }, children: [_jsx(JimboText, { size: "md", tone: "white", children: "This is a JimboModal!" }), _jsx("div", { style: { height: 20 } }), _jsx(JimboButton, { tone: "red", size: "sm", onClick: () => closeModal(), children: "Close" })] })));
|
|
21
|
+
}, children: "Open Modal" })] }));
|
|
22
|
+
};
|
|
23
|
+
export const Modal = {
|
|
24
|
+
decorators: [
|
|
25
|
+
(Story) => (_jsxs("div", { style: { width: 375, height: 600, border: "1px solid #333", position: "relative", overflow: "hidden" }, children: [_jsx(Story, {}), _jsx(JimboModalRoot, {})] }))
|
|
26
|
+
],
|
|
27
|
+
render: () => _jsx(ModalDemo, {})
|
|
28
|
+
};
|
package/dist/ui/jimbo.css
CHANGED
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
Eyedropped from actual game shader output — not Lua hex values.
|
|
5
5
|
═══════════════════════════════════════════════════════════════════════════ */
|
|
6
6
|
|
|
7
|
+
/* Global Scrollbar Hide */
|
|
8
|
+
* {
|
|
9
|
+
scrollbar-width: none !important;
|
|
10
|
+
-ms-overflow-style: none !important;
|
|
11
|
+
}
|
|
12
|
+
*::-webkit-scrollbar {
|
|
13
|
+
display: none !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
/* ── Design Tokens (CSS Custom Properties) ─────────────────────────────── */
|
|
8
17
|
|
|
9
18
|
:root {
|
|
@@ -121,7 +130,7 @@
|
|
|
121
130
|
display: flex;
|
|
122
131
|
flex-direction: column;
|
|
123
132
|
align-items: stretch;
|
|
124
|
-
overflow:
|
|
133
|
+
overflow: visible;
|
|
125
134
|
position: relative;
|
|
126
135
|
}
|
|
127
136
|
|
|
@@ -209,23 +218,23 @@
|
|
|
209
218
|
border-radius: var(--j-radius-sm);
|
|
210
219
|
font-family: var(--j-font);
|
|
211
220
|
font-weight: 400;
|
|
212
|
-
text-transform: uppercase;
|
|
213
221
|
letter-spacing: 0.04em;
|
|
214
222
|
white-space: nowrap;
|
|
215
223
|
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
|
|
224
|
+
border: none;
|
|
216
225
|
}
|
|
217
226
|
.j-badge--sm { padding: 2px 6px; font-size: 10px; }
|
|
218
227
|
.j-badge--md { padding: 4px 8px; font-size: 12px; }
|
|
219
228
|
|
|
220
|
-
/* Badge tones */
|
|
221
|
-
.j-badge--dark { background: var(--j-darkest); color: var(--j-white);
|
|
222
|
-
.j-badge--blue { background: var(--j-blue); color: var(--j-white);
|
|
223
|
-
.j-badge--red { background: var(--j-red); color: var(--j-white);
|
|
224
|
-
.j-badge--green { background: var(--j-green); color: var(--j-
|
|
225
|
-
.j-badge--gold { background: var(--j-gold); color: var(--j-black);
|
|
226
|
-
.j-badge--grey { background: var(--j-grey); color: var(--j-white);
|
|
227
|
-
.j-badge--orange { background: var(--j-orange); color: var(--j-white);
|
|
228
|
-
.j-badge--purple { background: var(--j-purple); color: var(--j-white);
|
|
229
|
+
/* Badge tones — dark-colored bottom edge, no thin pixel borders */
|
|
230
|
+
.j-badge--dark { background: var(--j-darkest); color: var(--j-white); box-shadow: 0 2px 0 0 var(--j-panel-edge); }
|
|
231
|
+
.j-badge--blue { background: var(--j-blue); color: var(--j-white); box-shadow: 0 2px 0 0 var(--j-dark-blue); }
|
|
232
|
+
.j-badge--red { background: var(--j-red); color: var(--j-white); box-shadow: 0 2px 0 0 var(--j-dark-red); }
|
|
233
|
+
.j-badge--green { background: var(--j-green); color: var(--j-white); box-shadow: 0 2px 0 0 var(--j-dark-green); }
|
|
234
|
+
.j-badge--gold { background: var(--j-gold); color: var(--j-black); box-shadow: 0 2px 0 0 #8a6a1e; }
|
|
235
|
+
.j-badge--grey { background: var(--j-grey); color: var(--j-white); box-shadow: 0 2px 0 0 var(--j-teal-grey); }
|
|
236
|
+
.j-badge--orange { background: var(--j-orange); color: var(--j-white); box-shadow: 0 2px 0 0 var(--j-dark-orange); }
|
|
237
|
+
.j-badge--purple { background: var(--j-purple); color: var(--j-white); box-shadow: 0 2px 0 0 var(--j-dark-purple); }
|
|
229
238
|
|
|
230
239
|
|
|
231
240
|
/* ── Tabs ──────────────────────────────────────────────────────────────── */
|
package/dist/ui/jimboText.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type JimboTextTone = 'default' | 'mult' | 'chips' | 'gold' | 'green' | 'red' | 'blue' | 'orange' | 'purple' | 'grey';
|
|
3
|
-
export type JimboTextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
export type JimboTextSize = 'micro' | 'label' | 'xs' | 'body' | 'sm' | 'md' | 'heading' | 'lg' | 'xl' | 'display';
|
|
4
4
|
export interface JimboTextProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
5
|
tone?: JimboTextTone;
|
|
6
6
|
size?: JimboTextSize;
|
package/dist/ui/panel.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const JimboPanel: React.MemoExoticComponent<({ children, classNam
|
|
|
8
8
|
export interface JimboInnerPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
9
|
}
|
|
10
10
|
export declare const JimboInnerPanel: React.MemoExoticComponent<({ children, className, style, ...props }: JimboInnerPanelProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
-
export type JimboTone = 'orange' | 'red' | 'blue' | 'green' | 'gold' | 'grey';
|
|
11
|
+
export type JimboTone = 'orange' | 'red' | 'blue' | 'green' | 'gold' | 'grey' | 'tarot' | 'planet' | 'spectral';
|
|
12
12
|
export interface JimboButtonProps {
|
|
13
13
|
tone?: JimboTone;
|
|
14
14
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
package/dist/ui/panel.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, memo } from 'react';
|
|
4
|
-
import { JimboColorOption
|
|
5
|
-
import { useSway
|
|
4
|
+
import { JimboColorOption } from './tokens.js';
|
|
5
|
+
import { useSway } from './hooks.js';
|
|
6
6
|
import { JimboText } from './jimboText.js';
|
|
7
7
|
export const JimboPanel = memo(({ children, className = '', sway = false, onBack, hideBack = false, style, ...props }) => {
|
|
8
8
|
const panelRef = useSway(sway);
|
|
@@ -22,6 +22,9 @@ const JIMBO_TONE_PAIRS = {
|
|
|
22
22
|
green: [JimboColorOption.GREEN, JimboColorOption.DARK_GREEN],
|
|
23
23
|
gold: [JimboColorOption.GOLD, '#8a6a1e'],
|
|
24
24
|
grey: [JimboColorOption.DARK_GREY, JimboColorOption.DARKEST],
|
|
25
|
+
tarot: ['#9e74ce', '#5e437e'],
|
|
26
|
+
planet: ['#00a7ca', '#00657c'],
|
|
27
|
+
spectral: ['#2e76fd', '#14449e'],
|
|
25
28
|
};
|
|
26
29
|
export function JimboButton({ tone = 'orange', size = 'md', fullWidth = false, disabled = false, uppercase = false, onClick, style, className = '', children, }) {
|
|
27
30
|
const [pressed, setPressed] = useState(false);
|
|
@@ -36,8 +39,7 @@ export function JimboBackButton({ onClick }) {
|
|
|
36
39
|
return (_jsx("div", { className: "j-flex j-justify-center j-w-full", style: { padding: '4px 0' }, children: _jsx(JimboButton, { tone: "orange", size: "md", fullWidth: true, onClick: onClick, children: "Back" }) }));
|
|
37
40
|
}
|
|
38
41
|
export function JimboModal({ children, open, onClose, title, className }) {
|
|
39
|
-
|
|
40
|
-
if (!visible)
|
|
42
|
+
if (!open)
|
|
41
43
|
return null;
|
|
42
|
-
return (_jsx("div", { className: "j-modal-overlay",
|
|
44
|
+
return (_jsx("div", { className: "j-modal-overlay", onClick: onClose, children: _jsxs(JimboPanel, { sway: true, onBack: onClose, className: `j-modal ${className ?? ''}`, onClick: (e) => e.stopPropagation(), children: [title && _jsx(JimboText, { as: "h2", size: "lg", className: "j-modal__title", children: title }), children] }) }));
|
|
43
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jaml-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Balatro rendering components, sprite metadata, and optional Motely helpers for React apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -47,7 +47,9 @@
|
|
|
47
47
|
"dev": "tsc --watch",
|
|
48
48
|
"demo": "vite --config demo/vite.config.ts",
|
|
49
49
|
"typecheck": "tsc --noEmit --pretty false",
|
|
50
|
-
"prepack": "npm run build"
|
|
50
|
+
"prepack": "npm run build",
|
|
51
|
+
"storybook": "storybook dev -p 6006",
|
|
52
|
+
"build-storybook": "storybook build"
|
|
51
53
|
},
|
|
52
54
|
"engines": {
|
|
53
55
|
"node": ">=18"
|
|
@@ -123,7 +125,18 @@
|
|
|
123
125
|
"react-icons": "^5.6.0",
|
|
124
126
|
"three": "^0.184.0",
|
|
125
127
|
"typescript": "^5.9.3",
|
|
126
|
-
"vite": "^8.0.9"
|
|
128
|
+
"vite": "^8.0.9",
|
|
129
|
+
"storybook": "^10.3.6",
|
|
130
|
+
"@storybook/react-vite": "^10.3.6",
|
|
131
|
+
"@chromatic-com/storybook": "^5.1.2",
|
|
132
|
+
"@storybook/addon-vitest": "^10.3.6",
|
|
133
|
+
"@storybook/addon-a11y": "^10.3.6",
|
|
134
|
+
"@storybook/addon-docs": "^10.3.6",
|
|
135
|
+
"@storybook/addon-onboarding": "^10.3.6",
|
|
136
|
+
"vitest": "^4.1.5",
|
|
137
|
+
"playwright": "^1.59.1",
|
|
138
|
+
"@vitest/browser-playwright": "^4.1.5",
|
|
139
|
+
"@vitest/coverage-v8": "^4.1.5"
|
|
127
140
|
},
|
|
128
141
|
"dependencies": {
|
|
129
142
|
"@react-three/drei": ">=9.0.0"
|