{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "task-vue",
  "title": "Task (Vue)",
  "description": "The steps an agent takes for a task, as it takes them, with how many are done.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/vue@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/vue/task.ts",
      "content": "import { taskPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/vue/primitive\";\nimport { type Component, defineComponent, h, type Slot, type VNodeChild } from \"vue\";\n\nconst parts = createParts(taskPrimitive, {\n  root: \"div\",\n  trigger: \"button\",\n  icon: \"span\",\n  title: \"span\",\n  meta: \"span\",\n  content: \"div\",\n  list: \"ol\",\n  item: \"li\",\n  \"item-icon\": \"span\",\n  \"item-title\": \"span\",\n  \"item-files\": \"span\",\n});\n\n// A part whose default slot falls back to `fallback`, as React's default `children` do.\nconst withDefault = <State, Part extends Component = Component>(\n  part: Part,\n  name: string,\n  fallback: (scope: { state: State }) => VNodeChild,\n): Part =>\n  defineComponent({\n    name,\n    inheritAttrs: false,\n    setup(_, { attrs, slots }) {\n      return () => h(part as Component, attrs, { ...slots, default: slots.default ?? (fallback as Slot) });\n    },\n  }) as unknown as Part;\n\nexport const TaskTrigger = parts.Trigger;\nexport const TaskIcon = parts.Icon;\nexport const TaskContent = parts.Content;\nexport const TaskItemIcon = parts.ItemIcon;\n\n/** The `label`, else \"Task\", unless you fill the slot. */\nexport const TaskTitle = withDefault<{ title: string }>(parts.Title, \"TaskTitle\", ({ state }) => state.title);\n\n/** How many items are complete, as \"2 of 5\", unless you fill the slot. */\nexport const TaskMeta = withDefault<{ done: number; total: number }>(\n  parts.Meta,\n  \"TaskMeta\",\n  ({ state }) => `${state.done} of ${state.total}`,\n);\n\n/** The item's `title`, unless you fill the slot. */\nexport const TaskItemTitle = withDefault<{ title: string }>(\n  parts.ItemTitle,\n  \"TaskItemTitle\",\n  ({ state }) => state.title,\n);\n\n/** The item's `files`, each as code, unless you fill the slot. Rendered only while the item has files. */\nexport const TaskItemFiles = withDefault<{ files: string[] }>(parts.ItemFiles, \"TaskItemFiles\", ({ state }) =>\n  // A step can touch one file twice, so files are keyed by place.\n  state.files.map((file, index) => h(\"code\", { key: index }, file)),\n);\n\n/** The item whose `id` is `value`. Without a default slot, it shows the item's mark, title and files. */\nexport const TaskItem = withDefault(parts.Item, \"TaskItem\", () => [\n  h(TaskItemIcon),\n  h(TaskItemTitle),\n  h(TaskItemFiles),\n]);\n\n/** An item for each of the `items`, unless you fill the slot. */\nexport const TaskList = withDefault<{ items: readonly { id: string }[] }>(\n  parts.List,\n  \"TaskList\",\n  ({ state }) => state.items.map((item) => h(TaskItem, { key: item.id, value: item.id })),\n);\n\nconst defaultParts = () => [\n  h(TaskTrigger, null, () => [h(TaskIcon), h(TaskTitle), h(TaskMeta)]),\n  h(TaskContent, null, () => h(TaskList)),\n];\n\n/**\n * The steps an agent takes for one task, as it takes them, with how many are done. A default slot replaces the\n * default trigger and content.\n */\nexport const Task = withDefault(parts.Root, \"Task\", defaultParts);\n",
      "type": "registry:ui",
      "target": "@ui/vue/task.ts"
    }
  ],
  "meta": {
    "layer": "vue"
  },
  "type": "registry:ui"
}
