{
  "name": "shelf",
  "title": "Shelf",
  "type": "registry:component",
  "description": "Wall shelf with planks.",
  "dependencies": [
    "@react-three/rapier@^2.2.0",
    "@runek/core@^0.12.0"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "Shelf.tsx",
      "content": "import { CuboidCollider, RigidBody } from '@react-three/rapier'\nimport { useWorld, type Vec3 } from '@runek/core'\n\nexport interface ShelfProps {\n  position?: Vec3\n  rotation?: Vec3\n  width?: number\n  height?: number\n  depth?: number\n  shelves?: number\n  /** Defaults to the world palette's `wood` slot. */\n  color?: string\n}\n\n/** Open shelving unit — frame + planks, no contents (see Bookshelf for a filled variant). */\nexport function Shelf({\n  position = [0, 0, 0],\n  rotation = [0, 0, 0],\n  width = 1,\n  height = 1.8,\n  depth = 0.3,\n  shelves = 4,\n  color,\n}: ShelfProps) {\n  const { unit, palette } = useWorld()\n  const frameColor = color ?? palette.wood\n  const w = width * unit\n  const h = height * unit\n  const d = depth * unit\n  const plank = 0.03 * unit\n  const inner = w - plank * 2\n  const gap = (h - plank) / shelves\n  const plankYs = Array.from({ length: shelves + 1 }, (_, i) => plank / 2 + gap * i)\n\n  return (\n    <RigidBody type=\"fixed\" colliders={false} position={position} rotation={rotation}>\n      <CuboidCollider args={[w / 2, h / 2, d / 2]} position={[0, h / 2, 0]} />\n\n      <mesh castShadow receiveShadow position={[-w / 2 + plank / 2, h / 2, 0]}>\n        <boxGeometry args={[plank, h, d]} />\n        <meshStandardMaterial color={frameColor} />\n      </mesh>\n      <mesh castShadow receiveShadow position={[w / 2 - plank / 2, h / 2, 0]}>\n        <boxGeometry args={[plank, h, d]} />\n        <meshStandardMaterial color={frameColor} />\n      </mesh>\n\n      {plankYs.map((y) => (\n        <mesh key={`plank-${y.toFixed(4)}`} castShadow receiveShadow position={[0, y, 0]}>\n          <boxGeometry args={[inner, plank, d]} />\n          <meshStandardMaterial color={frameColor} />\n        </mesh>\n      ))}\n    </RigidBody>\n  )\n}\n",
      "type": "registry:component"
    }
  ]
}
