{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "file-tree-svelte",
  "title": "File Tree (Svelte)",
  "description": "Changed files as a folder tree, each with its change and the lines it added and removed.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/svelte@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup",
    "@kind-ui/internal-tree-svelte"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/svelte/file-tree/FileTree.svelte",
      "content": "<!--\n  Changed files as a folder tree: each file shows its change as a badge and its added and removed lines; a folder\n  shows the most significant change inside it as a dot. The arrow keys, Home and End, and typing a name move between\n  rows, as in UI SDK's Tree. Any `children` replace the rows inside the Tree; `FileTreeRows` draws them.\n-->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { KindTree } from \"../internal/tree/index\";\n  import FileTreeRows from \"./FileTreeRows.svelte\";\n  import { parts } from \"./parts\";\n\n  let {\n    children: content,\n    value = $bindable(),\n    expanded = $bindable(),\n    ...props\n  }: ComponentProps<typeof parts.Root> = $props();\n</script>\n\n<parts.Root {...props} bind:value bind:expanded>\n  {#snippet children(tree)}\n    <KindTree\n      controller={tree.controller}\n      items={tree.items}\n      defaultValue={tree.defaultValue}\n      defaultExpanded={tree.defaultExpanded}\n      aria-label={tree[\"aria-label\"]}\n      hiddenUntilFound={tree.hiddenUntilFound}\n    >\n      {#if content}\n        {@render content(tree)}\n      {:else}\n        <FileTreeRows items={tree.items} />\n      {/if}\n    </KindTree>\n  {/snippet}\n</parts.Root>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/file-tree/FileTree.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/file-tree/FileTreeItem.svelte",
      "content": "<!--\n  A row's icon, name, line counts and badge, unless you pass children. Its `value` is the row's path. Spaces between\n  the parts keep their words apart in the row's accessible name.\n-->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Item> = $props();\n</script>\n\n{#snippet fallback({ name }: { name: string })}<span data-file-tree-name=\"\">{name}</span>{\" \"}<parts.Counts />{\" \"}<parts.Badge\n  />{/snippet}\n\n<parts.Item {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/file-tree/FileTreeItem.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/file-tree/FileTreeRows.svelte",
      "content": "<!--\n  A Tree row for each item, with a `FileTreeItem` in its label, and its children in a group. Every row has an\n  indicator, a file's an empty spacer that lines its name up with a folder's. It's hidden from agents, which hides\n  UI SDK's Tree from them (a component with a part under `data-agent-hidden` is off limits) while the rows stay the\n  File Tree's.\n-->\n<script lang=\"ts\">\n  import type { TreeItemData } from \"@ui-sdk/svelte/tree\";\n  import {\n    KindTreeGroup,\n    KindTreeItem,\n    KindTreeItemIndicator,\n    KindTreeItemLabel,\n  } from \"../internal/tree/index\";\n  import FileTreeItem from \"./FileTreeItem.svelte\";\n  import FileTreeRows from \"./FileTreeRows.svelte\";\n\n  let { items }: { items: TreeItemData[] } = $props();\n</script>\n\n{#each items as item (item.value)}\n  <KindTreeItem value={item.value}\n    ><KindTreeItemLabel\n      ><KindTreeItemIndicator data-agent-hidden=\"\"\n        >{#if item.children}<!-- Lucide \"chevron-right\", see THIRD_PARTY_NOTICES.md. --><svg\n            viewBox=\"0 0 24 24\"\n            fill=\"none\"\n            stroke=\"currentColor\"\n            stroke-width=\"2\"\n            aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" /></svg\n          >{/if}</KindTreeItemIndicator\n      ><FileTreeItem value={item.value} /></KindTreeItemLabel\n    >{#if item.children}<KindTreeGroup><FileTreeRows items={item.children} /></KindTreeGroup>{/if}</KindTreeItem\n  >\n{/each}\n",
      "type": "registry:ui",
      "target": "@ui/svelte/file-tree/FileTreeRows.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/file-tree/index.ts",
      "content": "import type { ComponentProps } from \"svelte\";\nimport FileTree from \"./FileTree.svelte\";\nimport FileTreeItem from \"./FileTreeItem.svelte\";\nimport FileTreeRows from \"./FileTreeRows.svelte\";\nimport { parts } from \"./parts\";\n\n/** A file's added and removed lines, shown as `+N −N` and read as words. */\nexport const FileTreeCounts = parts.Counts;\n/** A file's change, shown as a letter like `M` and read as the word, like \"modified\". */\nexport const FileTreeBadge = parts.Badge;\n\nexport { FileTree, FileTreeItem, FileTreeRows };\n\nexport type FileTreeProps = ComponentProps<typeof FileTree>;\nexport type FileTreeRowsProps = ComponentProps<typeof FileTreeRows>;\nexport type FileTreeItemProps = ComponentProps<typeof FileTreeItem>;\nexport type FileTreeCountsProps = ComponentProps<typeof parts.Counts>;\nexport type FileTreeBadgeProps = ComponentProps<typeof parts.Badge>;\n",
      "type": "registry:ui",
      "target": "@ui/svelte/file-tree/index.ts"
    },
    {
      "path": "packages/agent-ui/src/svelte/file-tree/parts.ts",
      "content": "import { fileTreePrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/svelte/primitive\";\n\nexport const parts = createParts(fileTreePrimitive, {\n  root: \"div\",\n  item: \"span\",\n  counts: \"span\",\n  badge: \"span\",\n});\n",
      "type": "registry:ui",
      "target": "@ui/svelte/file-tree/parts.ts"
    }
  ],
  "meta": {
    "layer": "svelte"
  },
  "type": "registry:ui"
}
