plantasia.space-design
Shared design system for plantasia.space — Home for Regenerative Music.
This repo is the source of the plantasia.space-design
npm package: design tokens, base styles, brand effects, React UI components, icons,
and a composable timeline kit, shared by every Plantasia Space frontend. React-first,
framework-agnostic — no Next.js, SSR-only, or package-manager assumptions.
It is the look of plantasia.space, Orbiters and Entangled Worlds.
What's inside
| Path |
What |
src/tokens.css |
All design tokens as plain CSS custom properties (dark by default, light under .light). Zero-build consumption. |
src/styles/fonts.css |
Brand webfonts: Orbit (titles), Inter (body), JetBrains Mono. |
src/styles/base.css |
Portable base styles (backgrounds, type, cursors, scrollbars). |
src/styles/effects.css |
Brand interactions: corner-bracket hovers, tab legs, segmented groups, filter rings, glass surfaces, motion. |
src/styles/entity-frames.css |
Entity shapes: circle (xPlorer), square (Track), diamond (Collection), hexagon (Orbiter), bordered rect (Entangled World). |
src/index.css |
Everything-in barrel import. |
src/anatomy/ |
Anatomy figures: the isometric figure kit (geometry, tones, iso.css), the machine's parts (one drawing per entity), the stage helpers (entity colours from --ps-entity-*, decks, perches, taps), the writer, the page runtime, and the ps-anatomy checks. See Anatomy figures. |
src/react/ |
The React component library (buttons through drawers, arrow/ parameter controls, icons/, timeline/ kit). Built with Radix primitives + cva variants; every component self-describes in the generated manifest. |
playground/ |
Vite + React app: the developer UI kit (cd playground && npm i && npm run dev → http://localhost:5180). |
src/react/components.generated.{json,ts} |
Generated component manifest — every component's slot, variants, owned props, composition. The self-describing layer for CLIs / generators. See docs/COMPONENT-MANIFEST.md. |
docs/DESIGN.md |
Design-language reference (component patterns, spacing, voice). |
docs/brand.md |
Platform, entity, and voice/tone context. |
Doc drift warning: docs/DESIGN.md and docs/brand.md still describe the older
teal/pink brand accents. Production (and src/tokens.css, extracted from the
production app) uses the monochrome white/black palette — --xplorer-col-1: #fff,
--xplorer-col-2: #000. Trust the tokens; the docs' color sections await a pass.
Consuming
npm install plantasia.space-design
Vanilla app, no build step
<link rel="stylesheet" href=".../plantasia.space-design/src/index.css" />
<!-- or just the tokens during migration: -->
<link rel="stylesheet" href=".../plantasia.space-design/src/tokens.css" />
Bundled app (Vite, Next.js, anything)
import 'plantasia.space-design/tokens.css'; // tokens only
import 'plantasia.space-design/index.css'; // the full visual language
import 'plantasia.space-design/styles/entity-frames.css'; // à la carte
Tailwind v4 host (plantasia.space-root)
Keep your @theme inline block mapping the tokens into Tailwind; import the token
file first:
@import 'tailwindcss';
@import 'plantasia.space-design/tokens.css';
@import 'plantasia.space-design/styles/theme.css'; /* or copy its @custom-variant dark */
/* app-local @theme inline { --color-background: var(--background); … } */
Importing the tokens alone is no longer enough: the dark: variant must use the SAME selector as
the token block (&:is(:root:not(.light) *, .dark *)). A host still compiling dark: against a
bare .dark rule — or against Tailwind's default prefers-color-scheme — will render dark
surfaces with light-mode component states on a document that carries no theme class.
Tailwind hosts that use the React components also add
@source "../node_modules/plantasia.space-design"; so component classes generate.
Theming contract
- Dark is the default. A document with NO theme class renders dark. Light is an explicit
opt-in: put
light on <html>. .dark still works for hosts that pin the mode themselves.
(This inverted in the release that made :root dark — light used to be the unscoped default,
which meant any moment before a theme class was written painted the page white.)
- Hosts may override any token at runtime by writing the custom property —
this is how the root app's theme-config and EW Studio's
studioTheme.js already
work. Brand primitives to override first: --xplorer-col-1, --xplorer-col-2;
everything semantic derives from those two plus the neutral scale.
- Fonts: hosts may keep loading the same Google Fonts via
<link> in their own
head (as the Next.js app does) instead of styles/fonts.css — token names are
the contract, not the loader.
Event handlers on the arrow controls
Knob, Slider, SegmentSlider, Switch, Multislider and Param run an onPointerDown, onKeyDown,
onClick (etc.) you pass alongside their own, never instead of it: yours runs first, then the
control's. Call e.preventDefault() in yours to skip the control's own handling of that event.
Ending a drag and tracking hover always run. (Before 0.78 a handler you passed replaced the
control's own, which broke dragging and keys.)
The extraction law — extract ⇒ migrate-back, always
When you move a component OUT of an app and INTO this library, the SAME branch must also
migrate that app to consume the library version and DELETE the app's local copy.
Extracting a component here without retiring the original does not reduce duplication — it
creates a second copy, and the two drift apart forever. "I'll migrate the app later" is how we
end up with the same panel/section/color-control implemented twice — current debt: the EW studio's
vanilla panel.js / section.js / colorControl.js / swatchRow.js were ported to React here but
never removed from EW.
A clean extraction PR therefore touches two repos:
- This library — add/port the component, build, version.
- The source app — replace the local implementation with an import from
plantasia.space-design,
delete the now-dead local file, and verify (typecheck + the app still renders).
Shared values follow the same rule, not just components: e.g. the nav breakpoint lives once in
src/breakpoints.ts (→ plantasia.space-design/breakpoints, framework-agnostic) and both root and
EW consume it — neither hard-codes its own. A pure value that server code reads must NOT ship from
the "use client" React barrel; give it its own non-React entry (see tsup.config.ts).
If you genuinely can't migrate the source app in the same PR (e.g. it's still vanilla JS and needs a
React mount bridge first), file a debt ticket immediately and link it in the extraction PR — the
duplication must be tracked, never silent.
Developing
npm install
npm run build # component + theme codegen, tsup (ESM + d.ts), Tailwind CSS bundle
npm run type-check # tsc --noEmit
npm test # icon transform + timeline assertions
The playground (cd playground && npm i && npm run dev → http://localhost:5180) is the
developer UI kit — spot-check visual changes there.
Codegen — keep the generated manifests fresh
Two files are generated, never hand-edited:
src/react/icons/manifest.generated.ts — npm run icons:generate
src/react/components.generated.{json,ts} — npm run components:generate
npm run build regenerates both before bundling, so a published package is always
current. After adding or changing a component (export, data-slot, variant
options, or own props), run npm run components:generate to refresh the committed
manifest in your PR. npm run components:check fails if it's stale. See
docs/COMPONENT-MANIFEST.md.
Contextual hints
TooltipProvider waits 1000 ms for pointer hover and opens immediately on keyboard focus.
TooltipConfigProvider can disable automatic hints without changing accessible control names.
Escape and activation dismiss a hint; it stays dismissed until the trigger is left or loses focus.
Touch taps keep the control's normal action. Put longer explanations and links in an explicit
Popover, and keep essential instructions visible without a tooltip.
ControlHint applies the same policy to existing DOM or canvas controls that cannot be wrapped
in TooltipTrigger. Supply a live getText function and a themed getContainer when needed;
call setEnabled, refresh when visible copy changes, and dispose when the control is removed.
The binding owns its timers, accessible description, hoverable surface and event cleanup.
Anatomy figures
Live isometric figures: one object drawn as hardware, moved by the page. A figure is built by a
script in the app that shows it (what is drawn, and what it means, stays with the app) and the
library supplies everything generic:
| Import |
Side |
What |
plantasia.space-design/anatomy/build |
Node (build script) |
k (the kit), G (lathe geometry), tubes, scene() and the parts, stage() (entity colours, decks, perches, tap targets), buildFigures(import.meta.url, figures) and emit() (a picture per theme + <name>.json), kitSource() |
plantasia.space-design/anatomy |
Browser |
mount(root, scene, hooks): moves a built figure, reports taps and machine events, moves slower under reduced motion, stops off screen (and holds at rest on a page marked data-anatomy-still, as the CLI's --reduced does). No React, no sound. |
plantasia.space-design/react/anatomy |
React |
AnatomyFigure (picture first, then live; narrow arrangement; events only while on screen) and useAnatomyModule for figures built as one module |
plantasia.space-design/anatomy/iso.css |
CSS |
The kit's tones for figures inlined in a page |
Build and check from any repo (Node 20.10+ and Chrome; a .ts script runs on the repo's own
typescript):
npx ps-anatomy run figures/<name>/build.ts --preview # writes the figure, and preview pages beside the script
npx ps-anatomy check figures/<name> # the line check, every preview, dark and light: must be 0
npx ps-anatomy capture figures/<name>/preview-<name>-dark.html --reduced --out shot.png
The house rules and the method live in the shared ps-anatomy skill. The kit started from
Anatomy (MIT, © 2026 Ryan): see src/anatomy/LICENSE-anatomy and THIRD-PARTY-NOTICES.md.
Local testing — link before publishing
A change is proven inside a real consuming app before it ships. With a consumer
checked out next to this repo:
# from the consuming app (orbiters, entangled-worlds, plantasia.space-root):
npm install --no-save ../plantasia.space-design
--no-save keeps the app's package.json and lockfile untouched (deploys/CI are
unaffected); the install symlinks node_modules/plantasia.space-design to this
folder, so package edits show up in the app's dev server live. Re-run the command
after a fresh npm install in the app (a clean install drops the unlisted link).
Publishing is a deliberate, separate step: bump version in package.json and merge
to main. CI runs the checks and publishes any version that is not on npm yet
(.github/workflows/publish.yml); consumers then bump to the new semver version.
Consumers
| App |
Usage |
plantasia.space-root (Next 15) |
Tokens + the React components (nav shells, cards, forms). |
orbiters (Vite + React) |
Tokens, React components, and the timeline/ waveform kit. |
entangled-worlds (Vite + React) |
Tokens (bridged onto --studio-theme-*) + studio UI components. |
Credits
- The entity icons (xPlorer, Track, Collection, Orbiter, Entangled World, Release) were
made with Inés Mihalik.
- The Plantasia Space brand logo is by Bruna Guarnieri and Inés Mihalik.
License
MIT © Plantasia Space.