{"_id":"@pixygon/anima","name":"@pixygon/anima","description":"Shared Anima types, API layer, and UI components for Pixygon apps","license":"MIT","homepage":"https://github.com/pixygon/pixygon-packages#readme","repository":{"type":"git","url":"git+https://github.com/pixygon/pixygon-packages.git"},"keywords":["pixygon","anima","animadex","react","typescript"],"author":{"name":"Pixygon"},"bugs":{"url":"https://github.com/pixygon/pixygon-packages/issues"},"dist-tags":{"latest":"1.5.0"},"versions":{"1.0.0":{"name":"@pixygon/anima","version":"1.0.0","keywords":["pixygon","anima","animadex","react","typescript"],"author":{"name":"Pixygon"},"license":"MIT","_id":"@pixygon/anima@1.0.0","maintainers":[{"name":"imakestupidgames","email":"anders@pixygon.io"}],"homepage":"https://github.com/pixygon/pixygon-packages#readme","bugs":{"url":"https://github.com/pixygon/pixygon-packages/issues"},"dist":{"shasum":"926c0c43398d45cfe6ac207477113c5c5c04edfb","unpackedSize":569498,"fileCount":33,"integrity":"sha512-KdC38Lg5P4NhUGtC00v4RVzPQxPWNennMtPY20uBBN7XzHd5e532UCmxc1Cooix9yxuGjrx9efYW2/GM0WWTjA==","tarball":"https://ppm.pixygon.io/@pixygon/anima/-/anima-1.0.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./api":{"types":"./dist/api/index.d.ts","import":"./dist/api/index.mjs","require":"./dist/api/index.js"},"./components":{"types":"./dist/components/index.d.ts","import":"./dist/components/index.mjs","require":"./dist/components/index.js"}},"gitHead":"a32e287d9d6242322013642357fab79775740695","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"imakestupidgames","email":"anders@pixygon.io"},"repository":{"url":"git+https://github.com/pixygon/pixygon-packages.git","type":"git"},"_npmVersion":"11.10.1","description":"Shared Anima types, API layer, and UI components for Pixygon apps","directories":{},"_nodeVersion":"25.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^19.0.0","react-dom":"^19.0.0","typescript":"^5.3.0","react-redux":"^9.0.0","@types/react":"^18.2.0","@mui/material":"^7.0.0","@emotion/react":"^11.0.0","@emotion/styled":"^11.0.0","@reduxjs/toolkit":"^2.0.0","@types/react-dom":"^18.2.0","@mui/icons-material":"^7.0.0"},"peerDependencies":{"react":">=18.0.0","react-dom":">=18.0.0","react-redux":">=9.0.0","@mui/material":">=7.0.0","@emotion/react":">=11.0.0","@emotion/styled":">=11.0.0","@reduxjs/toolkit":">=2.0.0","@mui/icons-material":">=7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/anima_1.0.0_1772423423862_0.4744008411972134","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@pixygon/anima","version":"1.2.0","keywords":["pixygon","anima","animadex","react","typescript"],"author":{"name":"Pixygon"},"license":"MIT","_id":"@pixygon/anima@1.2.0","maintainers":[{"name":"imakestupidgames","email":"anders@pixygon.io"}],"homepage":"https://github.com/pixygon/pixygon-packages#readme","bugs":{"url":"https://github.com/pixygon/pixygon-packages/issues"},"dist":{"shasum":"5decf6d24e736459404194b8113c1aebdbbb8e19","unpackedSize":599911,"fileCount":35,"integrity":"sha512-KkX/ap3izZWTzKfX6eiQ8Fqy0EhV1UuwN6TGWMOKxLQgT1uiYGQFqI7FcRb/oLnR1YixT9vi2iTrrE9HepACBg==","tarball":"https://ppm.pixygon.io/@pixygon/anima/-/anima-1.2.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./api":{"types":"./dist/api/index.d.ts","import":"./dist/api/index.mjs","require":"./dist/api/index.js"},"./components":{"types":"./dist/components/index.d.ts","import":"./dist/components/index.mjs","require":"./dist/components/index.js"}},"gitHead":"f63b03791961f2eb05937e2149125db963c4427a","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"imakestupidgames","email":"anders@pixygon.io"},"repository":{"url":"git+https://github.com/pixygon/pixygon-packages.git","type":"git"},"_npmVersion":"11.16.0","description":"Shared Anima types, API layer, and UI components for Pixygon apps","directories":{},"_nodeVersion":"26.2.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^19.0.0","react-dom":"^19.0.0","typescript":"^5.3.0","react-redux":"^9.0.0","@types/react":"^18.2.0","@mui/material":"^7.0.0","@emotion/react":"^11.0.0","@emotion/styled":"^11.0.0","@reduxjs/toolkit":"^2.0.0","@types/react-dom":"^18.2.0","@mui/icons-material":"^7.0.0"},"peerDependencies":{"react":">=18.0.0","react-dom":">=18.0.0","react-redux":">=9.0.0","@mui/material":">=7.0.0","@emotion/react":">=11.0.0","@emotion/styled":">=11.0.0","@reduxjs/toolkit":">=2.0.0","@mui/icons-material":">=7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/anima_1.2.0_1781548382723_0.5088544110592157","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@pixygon/anima","version":"1.3.0","keywords":["pixygon","anima","animadex","react","typescript"],"author":{"name":"Pixygon"},"license":"MIT","_id":"@pixygon/anima@1.3.0","maintainers":[{"name":"imakestupidgames","email":"anders@pixygon.io"}],"homepage":"https://github.com/pixygon/pixygon-packages#readme","bugs":{"url":"https://github.com/pixygon/pixygon-packages/issues"},"dist":{"shasum":"9bd7c3e816295750930aa9fd4e481463a3ea677a","unpackedSize":602094,"fileCount":35,"integrity":"sha512-chPHMM5tUNZnUziro0asardUoGsxhrzUVWjiWgbvllf7lGeNfTZ2mAlQnYGWPL5vmRbXppAQPhvfmkb2/9Uz6g==","tarball":"https://ppm.pixygon.io/@pixygon/anima/-/anima-1.3.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./api":{"types":"./dist/api/index.d.ts","import":"./dist/api/index.mjs","require":"./dist/api/index.js"},"./components":{"types":"./dist/components/index.d.ts","import":"./dist/components/index.mjs","require":"./dist/components/index.js"}},"gitHead":"3dd69744794189082a5e0d4e18280df46df7782d","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"imakestupidgames","email":"anders@pixygon.io"},"repository":{"url":"git+https://github.com/pixygon/pixygon-packages.git","type":"git"},"_npmVersion":"11.16.0","description":"Shared Anima types, API layer, and UI components for Pixygon apps","directories":{},"_nodeVersion":"26.2.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^19.0.0","react-dom":"^19.0.0","typescript":"^5.3.0","react-redux":"^9.0.0","@types/react":"^18.2.0","@mui/material":"^7.0.0","@emotion/react":"^11.0.0","@emotion/styled":"^11.0.0","@reduxjs/toolkit":"^2.0.0","@types/react-dom":"^18.2.0","@mui/icons-material":"^7.0.0"},"peerDependencies":{"react":">=18.0.0","react-dom":">=18.0.0","react-redux":">=9.0.0","@mui/material":">=7.0.0","@emotion/react":">=11.0.0","@emotion/styled":">=11.0.0","@reduxjs/toolkit":">=2.0.0","@mui/icons-material":">=7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/anima_1.3.0_1781572832273_0.9314434500758939","host":"s3://npm-registry-packages-npm-production"}},"1.3.1":{"name":"@pixygon/anima","version":"1.3.1","description":"Shared Anima types, API layer, and UI components for Pixygon apps","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./api":{"types":"./dist/api/index.d.ts","import":"./dist/api/index.mjs","require":"./dist/api/index.js"},"./components":{"types":"./dist/components/index.d.ts","import":"./dist/components/index.mjs","require":"./dist/components/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit"},"peerDependencies":{"react":">=18.0.0","react-dom":">=18.0.0","@mui/material":">=7.0.0","@mui/icons-material":">=7.0.0","@emotion/react":">=11.0.0","@emotion/styled":">=11.0.0","@reduxjs/toolkit":">=2.0.0","react-redux":">=9.0.0"},"devDependencies":{"@types/react":"^18.2.0","@types/react-dom":"^18.2.0","@mui/material":"^7.0.0","@mui/icons-material":"^7.0.0","@emotion/react":"^11.0.0","@emotion/styled":"^11.0.0","@reduxjs/toolkit":"^2.0.0","react":"^19.0.0","react-dom":"^19.0.0","react-redux":"^9.0.0","tsup":"^8.0.0","typescript":"^5.3.0"},"keywords":["pixygon","anima","animadex","react","typescript"],"author":{"name":"Pixygon"},"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/pixygon/pixygon-packages.git"},"gitHead":"796eeb7cff5b9cc0718fcf35f2f5b75a147a897f","_id":"@pixygon/anima@1.3.1","bugs":{"url":"https://github.com/pixygon/pixygon-packages/issues"},"homepage":"https://github.com/pixygon/pixygon-packages#readme","_nodeVersion":"26.2.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-o2DSNw39ZIQWWXVs9PpjjkA7PuSV2mUK+602B5nHvE2SXMXZ0jHMR/Rx9gUIRqUqyHxRLcsHxawVzaBysaOacw==","shasum":"2236a3e17ad905c282f9047e3d470666a8812703","unpackedSize":602134,"fileCount":35,"tarball":"https://ppm.pixygon.io/@pixygon/anima/-/anima-1.3.1.tgz"},"_npmUser":{"name":"imakestupidgames","email":"anders@pixygon.io"},"directories":{},"maintainers":[{"name":"imakestupidgames","email":"anders@pixygon.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/anima_1.3.1_1781580208208_0.04879822897483188"},"_hasShrinkwrap":false},"1.4.0":{"name":"@pixygon/anima","version":"1.4.0","description":"Shared Anima types, API layer, and UI components for Pixygon apps","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./api":{"types":"./dist/api/index.d.ts","import":"./dist/api/index.mjs","require":"./dist/api/index.js"},"./components":{"types":"./dist/components/index.d.ts","import":"./dist/components/index.mjs","require":"./dist/components/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","verify":"node verify.mjs"},"bin":{"pixygon-verify-anima":"verify.mjs"},"peerDependencies":{"react":">=18.0.0","react-dom":">=18.0.0","@mui/material":">=7.0.0","@mui/icons-material":">=7.0.0","@emotion/react":">=11.0.0","@emotion/styled":">=11.0.0","@reduxjs/toolkit":">=2.0.0","react-redux":">=9.0.0"},"devDependencies":{"@types/react":"^18.2.0","@types/react-dom":"^18.2.0","@mui/material":"^7.0.0","@mui/icons-material":"^7.0.0","@emotion/react":"^11.0.0","@emotion/styled":"^11.0.0","@reduxjs/toolkit":"^2.0.0","react":"^19.0.0","react-dom":"^19.0.0","react-redux":"^9.0.0","tsup":"^8.0.0","typescript":"^5.3.0"},"files":["dist","src","verify.mjs"],"keywords":["pixygon","anima","animadex","react","typescript"],"author":{"name":"Pixygon"},"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/pixygon/pixygon-packages.git"},"dist":{"integrity":"sha512-vizDtIg5r+WSrZa1gnCVpEWgRKZnItDqJHgb7JE9k/jJd7XsdPlQbfroxiQeW42xRu7WgIgmwZ+iicorQ0T0/w==","shasum":"6992e7cd9877c19b274cb8e174b73c8b48103a9d","tarball":"https://ppm.pixygon.io/@pixygon/anima/-/anima-1.4.0.tgz"},"readmeFilename":"README.md","gitHead":"140a5504f46664033037eae2deb3fc75399b7a5a","_id":"@pixygon/anima@1.4.0","bugs":{"url":"https://github.com/pixygon/pixygon-packages/issues"},"homepage":"https://github.com/pixygon/pixygon-packages#readme","_nodeVersion":"26.10.0","_npmVersion":"12.1.0"},"1.5.0":{"name":"@pixygon/anima","version":"1.5.0","description":"Shared Anima types, API layer, and UI components for Pixygon apps","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./api":{"types":"./dist/api/index.d.ts","import":"./dist/api/index.mjs","require":"./dist/api/index.js"},"./components":{"types":"./dist/components/index.d.ts","import":"./dist/components/index.mjs","require":"./dist/components/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","verify":"node verify.mjs","test":"npm run build && node --test test/*.test.mjs"},"bin":{"pixygon-verify-anima":"verify.mjs"},"peerDependencies":{"react":">=18.0.0","react-dom":">=18.0.0","@mui/material":">=7.0.0","@mui/icons-material":">=7.0.0","@emotion/react":">=11.0.0","@emotion/styled":">=11.0.0","@reduxjs/toolkit":">=2.0.0","react-redux":">=9.0.0"},"devDependencies":{"@types/react":"^18.2.0","@types/react-dom":"^18.2.0","@mui/material":"^7.0.0","@mui/icons-material":"^7.0.0","@emotion/react":"^11.0.0","@emotion/styled":"^11.0.0","@reduxjs/toolkit":"^2.0.0","react":"^19.0.0","react-dom":"^19.0.0","react-redux":"^9.0.0","tsup":"^8.0.0","typescript":"^5.3.0"},"files":["dist","src","verify.mjs"],"keywords":["pixygon","anima","animadex","react","typescript"],"author":{"name":"Pixygon"},"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/pixygon/pixygon-packages.git"},"dist":{"integrity":"sha512-rFwBWptdI6UztihPBl/TN5bSSd+aYElx9KYMALP4BH8BvLjEaqvcDtpfdRlWQf9c+As93f0yxc8+7IE25RQd7A==","shasum":"d943cff5d0e0a5d9491d3231ad6590ef7423a1fb","tarball":"https://ppm.pixygon.io/@pixygon/anima/-/anima-1.5.0.tgz"},"readmeFilename":"README.md","_id":"@pixygon/anima@1.5.0","bugs":{"url":"https://github.com/pixygon/pixygon-packages/issues"},"homepage":"https://github.com/pixygon/pixygon-packages#readme","_integrity":"sha512-rFwBWptdI6UztihPBl/TN5bSSd+aYElx9KYMALP4BH8BvLjEaqvcDtpfdRlWQf9c+As93f0yxc8+7IE25RQd7A==","_resolved":"/tmp/dyson-ppm-317400-1795522113199/@pixygon/anima/pixygon-anima-1.5.0.tgz","_from":"file:pixygon-anima-1.5.0.tgz","_nodeVersion":"26.13.1","_npmVersion":"12.2.2"}},"time":{"1.0.0":"2026-03-02T03:50:24.009Z","modified":"2026-11-24T12:08:34.704Z","created":"2026-03-02T03:50:24.009Z","1.2.0":"2026-06-15T18:33:02.868Z","1.3.0":"2026-06-16T01:20:32.446Z","1.3.1":"2026-06-16T03:23:28.351Z","1.4.0":"2026-10-03T19:54:12.667Z","1.5.0":"2026-11-24T12:08:34.704Z"},"readme":"# @pixygon/anima\n\nThe Anima layer — the universe's creature roster as types, colours, an RTK Query\nclient, and a set of MUI components. **5 repos** depend on it (Kartograf,\npixygon.io, CoreFeed, PixygonAdmin, Animunda); everything below is how those\nrepos actually wire it, not an idealised example.\n\nThe data lives in `PixygonAPI` under `/v1/animas` — species, moves, eggs\n(\"cores\"), owned animas, and trades. There is **one** central roster; never\nbuild a per-pearl creature table.\n\n---\n\n## Pick your mode first — this is the whole decision\n\nThe package ships **three independent export subpaths**. Which ones you import\n*is* the integration; nothing else about this package is hard.\n\n| Subpath | What you get | Needs a Redux store? | Repos using it |\n|---|---|---|---|\n| `@pixygon/anima` | types + colour/label constants + `animaThemeTokens`. No React. | no | pixygon.io, CoreFeed, Animunda |\n| `@pixygon/anima/components` | 12 presentational components. Pure props-in. | **no** | all 5 |\n| `@pixygon/anima/api` | the RTK Query slice + 17 hooks | **yes** | Kartograf, pixygon.io |\n\n**3 of the 5 consumers never import `/api`.** CoreFeed, PixygonAdmin and\nAnimunda feed the components from their own fetch layer, and that is correct —\nnot a gap to be closed. `verify.mjs` detects the mode and only applies the\napi-layer checks when `/api` is actually in play.\n\nThere is **no data provider**. No `AnimaProvider`, no data context, no\n`useAnima()`. Do not go looking for one. The only two contexts are optional and\npresentational: `AnimaFormProvider` (draws hatched animas) and\n`AnimaLocaleProvider` (the language, see *Language* below).\n\n---\n\n## Retrofitting it into an existing app (≈10 minutes)\n\nWritten for an agent. Do these in order. If you are in components-only mode,\nstop after step 3.\n\n### 1. Install\n\n```bash\nnpm i @pixygon/anima@^1.3.0\n```\n\n⚠ **MUI 7 is a hard floor.** The components use the v7 `<Grid size={{ xs: 12 }}>`\nAPI. On MUI 5/6 that prop does not exist, so every grid silently collapses to\nfull-width rows — no error, just a broken layout. Same for\n`@mui/icons-material`. If the repo is still on MUI 6, upgrade MUI first.\n\nPeers: `react >=18`, `react-dom >=18`, `@mui/material >=7`,\n`@mui/icons-material >=7`, `@emotion/react >=11`, `@emotion/styled >=11`, and —\n**only in api mode** — `@reduxjs/toolkit >=2`, `react-redux >=9`.\n\n### 2. Types + constants (free, no wiring)\n\n```ts\nimport {\n  TYPE_COLORS, ELEMENT_COLORS, RARITY_COLORS, STAT_LABELS,\n  statToPercent, animaThemeTokens,\n  type Anima, type AnimaSpecies, type AnimaEgg, type AnimaTrade,\n} from '@pixygon/anima'\n```\n\nCoreFeed and Animunda re-export these under their own local names\n(`AnimaType as MonsterType`) so their legacy code keeps compiling while the\ncolours stay estate-canonical. That is a good pattern — copy it rather than\nforking the palette.\n\n### 3. Mount components (components-only mode ends here)\n\nEvery component is presentational: it takes arrays and callbacks, holds only\nlocal UI state, and touches neither Redux nor the network. Feed it from\nwhatever data layer the app already has.\n\n```tsx\nimport { AnimaPage } from '@pixygon/anima/components'\n\n<AnimaPage\n  userId={userId}\n  species={species}\n  animas={animas}          // ← see the _id gotcha below, this WILL bite you\n  eggs={eggs}\n  trades={trades}\n  onActivateEgg={handleHatch}\n  onProjectAnima={handleProject}\n  onSetTradeable={handleTradeable}\n  onAcceptTrade={handleAccept}\n  onDeclineTrade={handleDecline}\n  onCancelTrade={handleCancel}\n/>\n```\n\n`AnimaPage` is the whole surface — a 4-tab shell (Animas / Cores / Dex /\nTrades) over `AnimaCollection`, `AnimaCores`, `Animadex`, `AnimaTrades`.\nAnimunda mounts exactly this from plain `fetch`, with no RTK at all.\n\n**The callbacks are the buttons.** `AnimaCollection`/`AnimaDetail` render\n*Project* and *Lock Trading* only when `onProjectAnima`/`onSetTradeable` are\npassed; `AnimaTrades` renders *Accept*/*Decline*/*Cancel* only when\n`onAccept`/`onDecline`/`onCancel` are. Omit them and the buttons don't exist —\nsilently. (pixygon.io currently omits all of them; see gotchas.)\n\n### Language: English or Norwegian (`locale`)\n\nEvery component takes an optional `locale` prop: `'en'` (the default) or\n`'nb'` (Norwegian bokmål). `<AnimaPage locale=\"nb\">` also sets the language of\nthe four tabs inside it. To set it once for the whole app, wrap it in\n`AnimaLocaleProvider`; a component's own `locale` prop always wins over it.\n\n```tsx\nimport { AnimaPage, AnimaLocaleProvider } from '@pixygon/anima/components'\n\n<AnimaPage {...props} locale=\"nb\" />            // this page in Norwegian\n\n<AnimaLocaleProvider locale={i18n.language}>  // or the whole app ('nb', 'no', 'nn', 'nb-NO' → Norwegian; anything else → English)\n  <AnimaPage {...props} />\n</AnimaLocaleProvider>\n```\n\nWith no prop and no provider the components render exactly the English they\nalways did. Norwegian covers every label, tab, button, empty state and count,\nand the game terms (types, elements, rarities, natures, trade statuses, dex\ntiers, stat labels); the stored values stay the English keys. Names are kept:\nAnima, Animas, Animadex, Dex. Species, move, ribbon and app names are data and\nare shown as they come. `useAnimaStrings(locale?)` and `ANIMA_STRINGS` give an\napp the same words for its own UI around the components.\n\n### 4. Configure the API layer — the step that silently breaks everything\n\n**`baseUrl` defaults to `''`.** If `configureAnimaApi()` never runs, every hook\nrequests `/species`, `/user/<id>`, `/trades/...` **same-origin-relative** — your\nown SPA host — gets the index.html 404 shell back, and fails to parse. Nothing\nthrows a useful error.\n\nThe real namespace is `<API>/v1/animas` (PixygonAPI `routes_v1/routes.js`:\n`router.use(\"/animas\", animaRoutes)`).\n\n```ts\n// src/main.tsx — Kartograf\nimport { configureAnimaApi } from '@pixygon/anima/api'\n\nconst API_URL = import.meta.env.VITE_API_URL || 'https://api.pixygon.io/v1'\nconfigureAnimaApi({\n  baseUrl: `${API_URL}/animas`,\n  getToken: () => store.getState().global.token,\n})\n```\n\nBoth config keys matter. `baseUrl` is read **at query time**, not at module\nload, so it is enough that `configureAnimaApi()` runs before the first hook\nrenders — but it must. `getToken` feeds `Authorization: Bearer` on every\nrequest; only `GET /species*` and `GET /moves` accept an API key instead. Every\n`/user/:id`, `/eggs`, `/trades` route and **every** mutation is\n`verifyToken`-protected, so a `() => null` token means permanently empty\ncollections with no error surfaced to the user.\n\n### 5. Register the slice in the store — both halves\n\n```ts\n// src/store/store.ts — Kartograf\nimport { animaApi } from '@pixygon/anima/api'\n\nconst rootReducer = combineReducers({\n  …,\n  [animaApi.reducerPath]: animaApi.reducer,      // half 1\n})\n\nexport const store = configureStore({\n  reducer: rootReducer,\n  middleware: (getDefaultMiddleware) =>\n    getDefaultMiddleware({ … }).concat(kartografApi.middleware, animaApi.middleware),  // half 2\n})\n```\n\n`reducerPath` is the literal string `'animaApi'`. Adding the reducer **without**\nthe middleware is the nastiest failure mode in this package: the cache slice\nexists so React Redux is happy and nothing throws, but no request is ever\ndispatched and every hook sits at `isLoading: true` forever. `verify.mjs`\nreports that case with its own distinct message.\n\nAnd the store needs a `<Provider store={store}>` above anything using the hooks.\n\n### 6. Use the hooks\n\n```tsx\nimport {\n  useGetSpeciesQuery, useGetUserAnimasQuery, useGetUserEggsQuery,\n  useGetUserTradesQuery, useGetMovesQuery,\n} from '@pixygon/anima/api'\n\nconst { data: animasData } = useGetUserAnimasQuery(userId, { skip: !userId })\nconst { data: speciesData } = useGetSpeciesQuery()\n\nconst animas  = (animasData?.animas ?? []).map(a => ({ ...a, id: a._id }))  // ← required\nconst species = speciesData?.species ?? []\n```\n\n`src/pages/AnimaDashboard.tsx` in pixygon.io is the canonical hooks→components\npage. (It is also missing that `.map`, which is gotcha #1.)\n\n### 7. Verify it worked\n\n```bash\nnode node_modules/@pixygon/anima/verify.mjs\n# or, from Dyson's registry:\npearl verify anima\n```\n\nMode-aware static check — dependency + installed version, which subpaths are in\nuse, peer floors, and (api mode only) `configureAnimaApi`, `baseUrl`/`getToken`,\nreducer **and** middleware, and `<Provider>`. It prints the detected mode and\nnever fails a legitimate components-only repo. Exit 0 pass, 1 fail.\n\nAdd a **live** probe of the namespace:\n\n```bash\nnode node_modules/@pixygon/anima/verify.mjs --url=https://api.pixygon.io/v1/animas\nnode node_modules/@pixygon/anima/verify.mjs --url=… --token=<jwt>     # asserts real species come back\n```\n\nWithout a token a **401 is the pass** — it proves the route exists and is\nguarded. A 404 means your `baseUrl` is wrong.\n\n**What verify can and cannot prove.** It proves the package is installed,\nimported, and — in api mode — configured against a real store. It cannot prove\n`configureAnimaApi()` ran before the first hook fired, that the token is\nunexpired, that the env var behind `baseUrl` is defined in the *deployed* build\n(an undefined `VITE_*` yields `\"undefined/animas\"` and still passes), or that a\nsingle component rendered a single row. The components are pure props-in: an\nempty array and the `_id`/`id` mismatch below both produce an empty-but-passing\nUI. Open the page and count creatures.\n\n---\n\n## API\n\n| Export | From | Use |\n|---|---|---|\n| `TYPE_COLORS` / `ELEMENT_COLORS` / `RARITY_COLORS` | `@pixygon/anima` | the canonical palettes — don't fork them |\n| `STAT_LABELS` / `CATEGORY_COLORS` / `NATURE_MODIFIERS` | `@pixygon/anima` | stat rows, move chips, nature maths |\n| `DISCOVERY_TIER_ORDER` / `_LABELS` / `_COLORS` | `@pixygon/anima` | the 5 dex tiers (`unknown→glimpsed→sensed→overcome→bonded`) |\n| `statToPercent(v, max=255)` / `xpToPercent(xp, next)` | `@pixygon/anima` | bar fill maths |\n| `animaThemeTokens` | `@pixygon/anima` | MUI theme fragment (`palette.anima.*`, Chip overrides) |\n| `Anima` / `AnimaSpecies` / `AnimaEgg` / `AnimaTrade` / `AnimaMove` … | `@pixygon/anima` | 49 exported types |\n| `configureAnimaApi({ baseUrl, getToken })` | `@pixygon/anima/api` | **call once at app entry — see step 4** |\n| `animaApi` | `@pixygon/anima/api` | the slice: `reducerPath: 'animaApi'`, tags `Species/Anima/Egg/Trade/Move/Summary` |\n| `useGetSpeciesQuery()` / `useGetSpeciesByIdQuery(id)` / `useGetSpeciesLearnsetQuery(id)` | `@pixygon/anima/api` | species catalogue |\n| `useGetMovesQuery()` | `@pixygon/anima/api` | move catalogue |\n| `useGetUserAnimasQuery(userId)` / `useGetAnimaByIdQuery(id)` / `useGetUserSummaryQuery(userId)` | `@pixygon/anima/api` | a user's collection |\n| `useGetUserEggsQuery(userId)` | `@pixygon/anima/api` | cores |\n| `useGetUserTradesQuery(userId)` / `useGetTradeOfferQuery(tradeId)` | `@pixygon/anima/api` | trades |\n| `usePlaceAnimaMutation()` / `useSetTradeableMutation()` / `useUpdatePartyMutation()` | `@pixygon/anima/api` | projection, trade lock, party order |\n| `useCreateTradeMutation()` / `useAcceptTradeMutation()` / `useDeclineTradeMutation()` / `useCancelTradeMutation()` | `@pixygon/anima/api` | the trade lifecycle |\n| `<AnimaPage>` | `@pixygon/anima/components` | **the whole surface** — 4 tabs over the four below |\n| `<AnimaCollection>` / `<AnimaCores>` / `<Animadex>` / `<AnimaTrades>` | `@pixygon/anima/components` | the individual tabs |\n| `<AnimaCard>` / `<AnimaDetail>` / `<AnimaModelViewer>` | `@pixygon/anima/components` | card, detail panel, 3D/sprite hero |\n| `<StatBar>` / `<TypeBadge>` / `<ElementBadge>` / `<RarityChip>` | `@pixygon/anima/components` | the primitives |\n| `locale` prop (`'en'` \\| `'nb'`) | every component above | the language; wins over the provider |\n| `<AnimaLocaleProvider locale>` / `useAnimaLocale()` / `useAnimaStrings()` / `ANIMA_STRINGS` / `resolveAnimaLocale()` | `@pixygon/anima/components` | the language for a whole tree, and the words themselves |\n\n### Config\n\n```ts\nconfigureAnimaApi({\n  baseUrl?: string            // REQUIRED in practice — default '' means same-origin-relative 404s.\n                              // Must be <API>/v1/animas\n  getToken?: () => string | null   // default () => null. Everything except\n                                   // GET /species* and GET /moves needs a real Bearer token\n})\n```\n\n## Gotchas\n\n- **`_id` vs `id` — this is a live bug, not a hypothetical.** Every anima\n  controller reads with Mongoose `.lean()`, so the JSON carries `_id` and **not**\n  the `id` virtual. But the package types declare `id: string`, and\n  `AnimaCollection` / `AnimaCores` / `AnimaTrades` both `key={x.id}` and select\n  on `x.id`. Feed API rows in raw and you get `key={undefined}` on every card\n  plus selection that never matches — an empty detail panel and dead clicks,\n  with no console error. Animunda maps it (`animas = monsters.map(m => ({ ...m,\n  id: m._id }))`); **pixygon.io's `AnimaDashboard.tsx` does not, and is broken\n  today.** Always remap:\n  ```ts\n  const animas = (data?.animas ?? []).map(a => ({ ...a, id: a._id }))\n  ```\n- **`AnimaModelViewer` loads a script from unpkg.com.** On first mount it\n  appends `<script type=\"module\" src=\"https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js\">`\n  to `document.head`. `AnimaCard` and `AnimaDetail` default `showHero={true}`,\n  so `AnimaCollection` and `AnimaPage` pull it in transitively — you get a\n  third-party CDN dependency just by rendering the collection tab. If the site\n  has a CSP, `script-src` must include `https://unpkg.com`; if it is offline or\n  air-gapped, the 3D hero degrades to sprite → emoji **silently**. Pass\n  `showHero={false}` for text-only contexts. (pixygon.io's `nginx.conf` CSP is\n  currently Report-Only and omits unpkg.com — it doesn't block today, but it\n  will the moment that policy is enforced.)\n- **The list endpoints silently truncate.** The server defaults\n  `GET /animas/species` to `limit=100` and `GET /animas/user/:userId`,\n  `/eggs/user/:userId`, `/trades/user/:userId` to `limit=50`. The package's\n  hooks send **no query string at all**, so past those counts data just stops\n  arriving — the response's `total` field is the only tell. Animunda works\n  around it by calling its own fetch layer with `{ limit: 200 }`. If your roster\n  is bigger than the default, you cannot use the plain hooks unchanged.\n- **Reducer without middleware = eternal `isLoading`.** See step 5. It is the\n  one wiring mistake that produces no error of any kind.\n- **`configureAnimaApi()` is global, not per-store.** It mutates one module-level\n  object. Two apps in one bundle, or a second call with a different `baseUrl`,\n  and last-write-wins for everyone.\n- **`AnimaPage` renders its own `<Tabs>`.** Don't wrap it in another tab shell —\n  pixygon.io deliberately uses the four sub-components directly instead, for\n  exactly this reason.\n- **Species are keyed by `speciesId`, not `_id`.** `speciesMap` in every\n  component is built from `species.speciesId`, and `anima.speciesId` must match\n  it. Animunda has to remap (`speciesId: m.species?._id ?? m.speciesId`) because\n  its legacy monster documents nest the species. If species art/name/types come\n  up blank on otherwise-working cards, this join is why.\n- **Colours belong to the roster, not to your site.** `TYPE_COLORS` /\n  `ELEMENT_COLORS` / `RARITY_COLORS` are canon across the estate. Style the\n  chrome around them from the site's own brand in\n  `@pixygon/design/tokens.mjs` — don't recolour the creatures.\n\n## Publishing\n\n```bash\nnpm run build && npm publish --access public\n```\n","readmeFilename":"README.md"}