"use client"; import { CATALOG, GROUP_LABELS, type CatalogEntry } from "@/lib/node-catalog"; import { cn } from "@/lib/utils"; import { GripVertical } from "lucide-react"; const DRAG_TYPE = "application/x-flow-node"; export function NodePalette() { const groups = CATALOG.reduce>((acc, c) => { (acc[c.group] ??= []).push(c); return acc; }, {}); return ( ); } function PaletteItem({ entry }: { entry: CatalogEntry }) { const Icon = entry.icon; return (
{ e.dataTransfer.setData(DRAG_TYPE, entry.type); e.dataTransfer.effectAllowed = "move"; }} title={entry.description} className="group flex cursor-grab items-center gap-2 rounded-md border bg-background px-2 py-1.5 text-sm shadow-sm transition-colors hover:bg-accent active:cursor-grabbing" > {entry.label}
); } export const PALETTE_DRAG_TYPE = DRAG_TYPE;