{
  "name": "table",
  "title": "Table",
  "type": "registry:component",
  "description": "Table with a top and four legs.",
  "dependencies": [
    "@react-three/rapier@^2.2.0",
    "@runek/core@^0.12.0"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "Table.tsx",
      "content": "import { CuboidCollider, RigidBody } from '@react-three/rapier'\nimport { useWorld, type Vec3 } from '@runek/core'\n\nexport interface TableProps {\n  position?: Vec3\n  rotation?: Vec3\n  width?: number\n  depth?: number\n  height?: number\n  thickness?: number\n  /** Defaults to the world palette's `wood` slot. */\n  color?: string\n}\n\nexport function Table({\n  position = [0, 0, 0],\n  rotation = [0, 0, 0],\n  width = 1.2,\n  depth = 0.8,\n  height = 0.75,\n  thickness = 0.05,\n  color,\n}: TableProps) {\n  const { unit, palette } = useWorld()\n  const woodColor = color ?? palette.wood\n  const w = width * unit\n  const d = depth * unit\n  const h = height * unit\n  const t = thickness * unit\n  const leg = 0.06 * unit\n  const legH = h - t\n  const lx = w / 2 - leg\n  const lz = d / 2 - leg\n  const legs: Vec3[] = [\n    [-lx, legH / 2, -lz],\n    [lx, legH / 2, -lz],\n    [-lx, legH / 2, lz],\n    [lx, legH / 2, lz],\n  ]\n\n  return (\n    <RigidBody type=\"fixed\" colliders={false} position={position} rotation={rotation}>\n      <CuboidCollider args={[w / 2, t / 2, d / 2]} position={[0, h - t / 2, 0]} />\n      <mesh castShadow receiveShadow position={[0, h - t / 2, 0]}>\n        <boxGeometry args={[w, t, d]} />\n        <meshStandardMaterial color={woodColor} />\n      </mesh>\n      {legs.map((p) => (\n        <mesh key={`leg-${p[0].toFixed(3)}:${p[2].toFixed(3)}`} castShadow position={p}>\n          <boxGeometry args={[leg, legH, leg]} />\n          <meshStandardMaterial color={woodColor} />\n        </mesh>\n      ))}\n    </RigidBody>\n  )\n}\n",
      "type": "registry:component"
    }
  ]
}
