diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md deleted file mode 100644 index c360cd2..0000000 --- a/.github/copilot-instructions.md +++ /dev/null @@ -1,48 +0,0 @@ -# BlueprintPi Copilot Instructions - -## Project Overview -BlueprintPi is a React-based web application for analyzing Balatro seeds, specifically focusing on seed filtering and visualization. It is a fork of the original Blueprint project, emphasizing experimental features and the "JAML" (Joker Analysis Markup Language) system. - -## Tech Stack -- **Framework**: React 18+ (Functional Components, Hooks) -- **Language**: TypeScript (Strict mode preferred) -- **UI Library**: Mantine v8 (@mantine/core, @mantine/hooks, etc.) -- **Icons**: @tabler/icons-react -- **State Management**: Zustand, React Query (@tanstack/react-query) -- **Build Tool**: Vite -- **Testing**: Vitest -- **Data Serialization**: JAML (YAML-based) using `js-yaml` -- **Engine**: WASM via `motely-wasm` - -## Coding Standards -- **Components**: Use functional components with arrow functions. Prefer Mantine components over raw HTML. -- **Styling**: Use Mantine's style props, `className` with CSS Modules (`.module.scss` or `.module.css`), or Mantine's theme system. -- **Type Safety**: Always define interfaces or types for props and data models. Use the predefined enums and types in `src/modules/balatrots/enum/`. -- **State**: Use specialized providers in `src/modules/state/` (e.g., `optionsProvider.tsx`, `analysisResultProvider.tsx`) or Zustand stores in `src/modules/state/store.ts`. -- **Naming**: - - Components: PascalCase (e.g., `JamlEditor.tsx`) - - Hooks: `use` prefix (e.g., `useJamlSearch.ts`) - - Modules: camelCase or kebab-case - -## Domain Knowledge (Balatro / JAML) -- **Seeds**: 8-character strings (e.g., `2K9H9HN`). -- **JAML**: A YAML-based DSL for defining filters for Balatro seeds. It includes sections like `name`, `author`, `deck`, `stake`, `must`, `should`, and `seeds`. -- **Search Modes**: - - `quick`: Search a specific number of seeds (1k, 100k, etc.) or a single seed. - - `sequential`: Search between a range of seeds. - - `funny`: Specialized searches for palindromes or keywords. -- **Antes/Packs**: The game is structured in Antes (1-8 typically). Shops contain booster packs and shop slots. -- **WASM**: Seed analysis is often performed using WebAssembly (`motely-wasm`) with configurable thread counts and batch sizes. - -## File Structure -- `src/components/blueprint/`: Core UI divided by view types (`jamlView`, `simpleView`, `snapshotView`, `standardView`). -- `src/modules/balatrots/`: Core logic for Balatro game mechanics and analysis. -- `src/modules/state/`: Context providers and global state stores. -- `src/themes/`: Custom Mantine themes (e.g., `Goomy.ts`, `Sylveon.ts`). - -## Guidelines for Copilot -- When suggesting UI changes, prioritize Mantine v8 components and patterns. -- When working with JAML, respect the YAML structure and the `JAML_PRESETS` defined in the project. -- If modifying game logic, refer to `src/modules/balatrots/` for existing enums and types to ensure consistency. -- Maintain the "experimental" and "performance-focused" nature of the JAML search implementation. -- Use `lucide-react` or `@tabler/icons-react` for icons as per existing patterns. diff --git a/CLAUDE.md b/CLAUDE.md index a062a29..65a36da 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,7 +17,6 @@ ## motely-wasm - v11+ is NativeAOT-LLVM, single-threaded, no SharedArrayBuffer needed, no COI serviceworker. - Boot once on mount. Don't boot again. -- Import directly: `import motely, { MotelyWasm, MotelyWasmEvents } from "motely-wasm"` ## React - Modern React patterns only. No unnecessary refs, useCallback chains, or setState-in-effects. diff --git a/___tests___/jamlDocument.spec.ts b/___tests___/jamlDocument.spec.ts deleted file mode 100644 index ae56d96..0000000 --- a/___tests___/jamlDocument.spec.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { load } from "js-yaml"; -import { describe, expect, it } from "vitest"; -import { documentLooksLikeSeedBundle, parseJamlDocument } from "../src/modules/jamlDocumentParse"; -import { parseSeedList } from "../src/modules/state/store"; - -describe("parseJamlDocument", () => { - it("splits filter clauses from a seeds list and reads deck/stake", () => { - const doc = parseJamlDocument(`name: demo -deck: Ghost -stake: White -must: - - tag: NegativeTag - antes: [1] -seeds: - - ALEEB - - PIROCKS -`); - expect(doc.name).toBe("demo"); - expect(doc.deck).toBe("Ghost"); - expect(doc.stake).toBe("White"); - expect(doc.seeds).toEqual(["ALEEB", "PIROCKS"]); - expect(doc.filterJaml).toContain("must:"); - expect(doc.filterJaml).not.toMatch(/^seeds:/m); - }); - - it("feeds parseSeedList for whole JAML uploads", () => { - const text = `deck: Red -stake: White -must: - - joker: Any - antes: [1] -seeds: - - WEEJOKER - - ALEEB -`; - expect(parseSeedList(text)).toEqual(["WEEJOKER", "ALEEB"]); - }); -}); - -describe("simpleCola fixture", () => { - it("loads 46,210 seeds without keeping them in the filter body", () => { - const alphabet = "123456789ABCDEFGHIJKLMNPQRSTUVWXYZ"; - const seeds = Array.from({ length: 46210 }, (_, i) => { - let n = i, out = ""; - for (let k = 0; k < 8; k++) { out += alphabet[n % alphabet.length]; n = Math.floor(n / alphabet.length); } - return out; - }); - const text = `name: simpleCola\ndeck: Ghost\nstake: White\nmust:\n - joker: DietCola\n antes: [1, 2]\nseeds:\n${seeds.map((x) => ` - ${x}`).join("\n")}\n`; - const started = performance.now(); - const doc = parseJamlDocument(text); - const elapsed = performance.now() - started; - expect(doc.seeds).toHaveLength(46210); - expect(doc.deck).toBe("Ghost"); - expect(doc.stake).toBe("White"); - expect(doc.filterJaml).toContain("simpleCola"); - expect(doc.filterJaml).not.toMatch(/^seeds:/m); - expect(elapsed).toBeLessThan(5000); - }); -}); - -describe("JSON filter", () => { - it("reads seeds, deck and stake off a JSON document and keeps the rest as the filter", () => { - const text = JSON.stringify({ name: "cola", deck: "Ghost", stake: "White", must: [{ joker: "DietCola", antes: [1] }], seeds: ["WEEJOKER", "aleeb"] }); - const doc = parseJamlDocument(text); - expect(doc.seeds).toEqual(["WEEJOKER", "ALEEB"]); - expect(doc.deck).toBe("Ghost"); - expect(doc.stake).toBe("White"); - expect(doc.name).toBe("cola"); - expect(load(doc.filterJaml)).toEqual({ name: "cola", deck: "Ghost", stake: "White", must: [{ joker: "DietCola", antes: [1] }] }); - }); - - it("is detected as a seed bundle", () => { - expect(documentLooksLikeSeedBundle(JSON.stringify({ must: [], seeds: ["ALEEB"] }))).toBe(true); - expect(documentLooksLikeSeedBundle(JSON.stringify({ must: [{ joker: "Blueprint" }] }))).toBe(false); - }); -}); diff --git a/index.html b/index.html index 2f96f90..452aa2e 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,7 @@
- + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e973426..16c0985 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,10 +19,9 @@ "@tanstack/react-query": "^5.85.9", "embla-carousel-react": "^8.6.0", "immer": "^10.1.3", - "jaml-ui": "^4.6.0", + "jaml-ui": "^10.0.0", "js-convert-case": "^4.2.0", - "js-yaml": "^4.1.1", - "motely-wasm": "^26.0.2", + "motely-wasm": "^31.2.0", "motion": "^12.29.2", "react": "^18.0.0", "react-dom": "^18.0.0", @@ -33,7 +32,6 @@ "devDependencies": { "@eslint/js": "^9.39.1", "@tanstack/eslint-config": "^0.3.4", - "@types/js-yaml": "^4.0.9", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@vitejs/plugin-react": "^5.0.2", @@ -364,6 +362,66 @@ "node": ">=6.9.0" } }, + "node_modules/@base-ui/react": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@base-ui/react/-/react-1.9.0.tgz", + "integrity": "sha512-S8CSYosASBKtpL8SWUfS78rFElfLijiCgA7oHOK22jCJ95FULsYyKwBNFOgudt0RA+/7yNc7F81bOvQnRgbBiQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.29.7 || ^8.0.0", + "@base-ui/utils": "0.5.0", + "@floating-ui/react-dom": "^2.1.9", + "@floating-ui/utils": "^0.2.12", + "use-sync-external-store": "^1.7.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "@date-fns/tz": "^1.2.0", + "@types/react": "^17 || ^18 || ^19", + "date-fns": "^4.0.0", + "react": "^17 || ^18 || ^19", + "react-dom": "^17 || ^18 || ^19" + }, + "peerDependenciesMeta": { + "@date-fns/tz": { + "optional": true + }, + "@types/react": { + "optional": true + }, + "date-fns": { + "optional": true + } + } + }, + "node_modules/@base-ui/utils": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@base-ui/utils/-/utils-0.5.0.tgz", + "integrity": "sha512-dYGGcEttjkYiMoa5nHm8vLaJ2UcuTWxo3BFAwOYXeRg/q7UVVvA6cacEIXEs3FgBfK1CGtW1ptElqs7wsx+t9A==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.29.7 || ^8.0.0", + "@floating-ui/utils": "^0.2.12", + "reselect": "^5.3.0", + "use-sync-external-store": "^1.7.0" + }, + "peerDependencies": { + "@types/react": "^17 || ^18 || ^19", + "react": "^17 || ^18 || ^19", + "react-dom": "^17 || ^18 || ^19" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@bufbuild/protobuf": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.15.0.tgz", @@ -2198,13 +2256,6 @@ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "license": "MIT" }, - "node_modules/@types/js-yaml": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", - "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -2965,6 +3016,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, "license": "Python-2.0" }, "node_modules/array-buffer-byte-length": { @@ -5338,33 +5390,23 @@ } }, "node_modules/jaml-ui": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/jaml-ui/-/jaml-ui-4.6.0.tgz", - "integrity": "sha512-RzqTz/tqK5xj+SN+5HPA2Ej0xRYfg0+6GQTQuJjxQDy9APHnfIf+wS8OrM/0kXpiCZ+W1u9DcK97f3pKtK4yOQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/jaml-ui/-/jaml-ui-10.0.0.tgz", + "integrity": "sha512-Q7WXYAHyQDGxa9kh5HVdAKVSgkR8VdBg0kfGNlbo6CchUeMaHNngjLebi58h7wwmn1pW9X1wQzBPRUjiEzAkRw==", "license": "MIT", "dependencies": { + "@base-ui/react": "^1.9.0", "@json-render/core": "^0.20.0", "@json-render/react": "^0.20.0", - "jaml-lang": "^3.14.2", "react-icons": "^5.7.0", - "zod": "^4.5.4" - }, - "engines": { - "node": ">=18" + "zod": "^4.6.5" }, "peerDependencies": { - "motely-wasm": "^25.1.0", + "motely-wasm": "^31.1.1", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0" } }, - "node_modules/jaml-ui/node_modules/jaml-lang": { - "name": "empty-npm-package", - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/empty-npm-package/-/empty-npm-package-1.0.0.tgz", - "integrity": "sha512-q4Mq/+XO7UNDdMiPpR/LIBIW1Zl4V0Z6UT9aKGqIAnBCtCb3lvZJM1KbDbdzdC8fKflwflModfjR29Nt0EpcwA==", - "license": "ISC" - }, "node_modules/jiti": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", @@ -5391,6 +5433,7 @@ "version": "4.3.2", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, "funding": [ { "type": "github", @@ -5587,10 +5630,18 @@ } }, "node_modules/motely-wasm": { - "version": "26.0.2", - "resolved": "https://registry.npmjs.org/motely-wasm/-/motely-wasm-26.0.2.tgz", - "integrity": "sha512-74pdgvHhfcmhJhH4SCr1NG6oq5tYH2IYiQxmkuLw6hDgfYUSS1reuPuu9uAwmxkj/BfdPOZ63+yIQKh3cCh3Rg==", - "license": "MIT" + "version": "31.2.0", + "resolved": "https://registry.npmjs.org/motely-wasm/-/motely-wasm-31.2.0.tgz", + "integrity": "sha512-IIWLwawCKXXH4Iq+9LOJMOTtS1XDRt7n8UZG9xaGqF1q1cLQxS/pFhK7Fn3IUEf1vxxhj/rjVurYYRiuhyk8tw==", + "license": "MIT", + "peerDependencies": { + "@rewaffle/bootsharp-file-system": "*" + }, + "peerDependenciesMeta": { + "@rewaffle/bootsharp-file-system": { + "optional": true + } + } }, "node_modules/motion": { "version": "12.43.0", @@ -6412,6 +6463,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/reselect": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.3.0.tgz", + "integrity": "sha512-XGoLeRAVzUTcJ1qkxPQhDJyIZ5d6zzZD9nT7AEZOaaU9UbWclhycElmhO+VD5bFeLuzhPBaOV2oXC8uG35ZSpg==", + "license": "MIT" + }, "node_modules/resolve": { "version": "2.0.0-next.7", "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.7.tgz", @@ -7795,6 +7852,15 @@ } } }, + "node_modules/use-sync-external-store": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz", + "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 084e2e7..df1a783 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,9 @@ "@tanstack/react-query": "^5.85.9", "embla-carousel-react": "^8.6.0", "immer": "^10.1.3", - "jaml-ui": "^4.6.0", + "jaml-ui": "^10.0.0", "js-convert-case": "^4.2.0", - "js-yaml": "^4.1.1", - "motely-wasm": "^26.0.2", + "motely-wasm": "^31.2.0", "motion": "^12.29.2", "react": "^18.0.0", "react-dom": "^18.0.0", @@ -32,13 +31,9 @@ "vitest": "^5.0.1", "zustand": "^5.0.8" }, - "overrides": { - "jaml-lang": "npm:empty-npm-package@1.0.0" - }, "devDependencies": { "@eslint/js": "^9.39.1", "@tanstack/eslint-config": "^0.3.4", - "@types/js-yaml": "^4.0.9", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@vitejs/plugin-react": "^5.0.2", diff --git a/src/components/SeedQueue.tsx b/src/components/SeedQueue.tsx index 7b26288..27b4a00 100644 --- a/src/components/SeedQueue.tsx +++ b/src/components/SeedQueue.tsx @@ -98,7 +98,7 @@ export function SeedQueuePanel() {