This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
SolidTV (@solidtv/solid) — a SolidJS-based UI framework for building TV applications over WebGL/Canvas (not DOM). Navigation is directional (arrow keys/remote), not pointer-based. UI is built with <view>, <text>, <Row>, <Column> — never DOM elements like <div>.
- Don’t assume. Don’t hide confusion. Surface tradeoffs.
- Minimum code that solves the problem. Nothing speculative.
- Touch only what you must. Clean up only your own mess.
- Define success criteria. Loop until verified.
npm run build # Clean build (rm -rf dist && tsc + copy jsx-runtime.d.ts)
npm run tsc # TypeScript compile only
npm test # Run vitest (jsdom, non-watch)
npm run test:browser # Run vitest in Playwright/Chromium
npm run lint # Prettier check + ESLint
npm run lint:fix # Auto-fix both
npm run release # release-it (bumps version, tags, publishes to npm, creates GitHub release)Run a single test file: npx vitest tests/flex.spec.ts
src/render.ts— Creates a SolidJS universal renderer (solid-js/universal) with custom node operations (solidOpts.ts). ExportsDynamic,createRenderer, and re-exports SolidJS flow components (For,Show,Switch, etc.). The core<view>and<text>intrinsic elements are registered with the renderer.src/core/elementNode.ts—ElementNodeis the core node abstraction. Manages properties, children, flex layout, focus, states, animations, and syncs to the underlying@solidtv/rendererINode.src/core/focusManager.ts— Handles keyboard/remote input, focus path traversal, and key mapping. Focus walks the component tree viaonUp/onDown/onLeft/onRight/onEnterhandlers.src/core/config.ts— RuntimeConfigobject (debug flags, animation settings, font defaults, focus state key).src/core/flex.ts/src/core/flexLayout.ts— Two flex layout implementations; toggled byVITE_USE_NEW_FLEXenv var.
SOLIDTV_DOM_RENDERING— enables DOM renderer instead of WebGL (used in tests)SOLIDTV_DISABLE_SHADERS— disables shader processing__DEV__— development mode flag
@solidtv/solid— main:<view>/<text>intrinsic elements, renderer, core node types@solidtv/solid/primitives— layout components (Row, Column, Grid, Virtual, VirtualGrid), focus utilities, announcer, router helpers, Lazy/KeepAlive/Preserve@solidtv/solid/devtools— devtools integration@solidtv/solid/shaders— shader exports
solid-js— reactivity and component model@solidtv/renderer— WebGL/Canvas rendering engine (INode, ITextNode, animations)@solidjs/router— optional, for routing primitives
Tests use jsdom with SOLIDTV_DOM_RENDERING: true (DOM renderer). tests/setup.ts creates a renderer with mocked ResizeObserver/MutationObserver/document.fonts. Vitest uses vite-plugin-solid with generate: 'universal' to compile JSX.
The @solidtv/source custom import condition resolves to source .ts files instead of compiled .js — used in vitest and vite configs for dev/test.
- All nodes are
position: absoluteby default. Position withx,y,width,height. - Colors must be 8-char hex strings (e.g.,
"#ff0000ff"). No named colors. - Use
colornotbackground. Use object structures forborder/shadow. - No
style={{}}, no CSS classes, no DOM elements. - Flex:
display: "flex"activates it. Only singlepaddingnumber (nopaddingLeftetc.). Margins, gap, alignItems, justifyContent all supported. - Focus:
onFocusChanged,onFocus,onBlur,onEnter,onUp/onDown/onLeft/onRight. One item should haveautofocus.Row/Columnmanage child focus automatically.