{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "document-svelte",
  "title": "Document (Svelte)",
  "description": "A document card with its title, kind and size, copy and download, and a preview that expands.",
  "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/markdown-svelte",
    "@kind-ui/code-block-svelte",
    "@kind-ui/internal-toolbar-svelte",
    "@kind-ui/internal-scroll-area-svelte"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/svelte/document/Document.svelte",
      "content": "<!--\n  A document as a card: its title, kind and size, Copy and Download, and a preview that expands. Any `children`\n  replace the default header and body.\n-->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import DocumentBody from \"./DocumentBody.svelte\";\n  import DocumentMeta from \"./DocumentMeta.svelte\";\n  import DocumentTitle from \"./DocumentTitle.svelte\";\n  import DocumentToolbar from \"./DocumentToolbar.svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, open = $bindable(), ...props }: ComponentProps<typeof parts.Root> = $props();\n</script>\n\n{#snippet fallback()}\n  <parts.Header>\n    <DocumentTitle\n    /><DocumentMeta\n    /><DocumentToolbar />\n  </parts.Header\n  ><DocumentBody />\n{/snippet}\n\n<parts.Root {...props} bind:open children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/Document.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/DocumentBody.svelte",
      "content": "<!-- The preview: a `KindScrollArea` holding the content, followed by Show more, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import {\n    KindScrollArea,\n    KindScrollAreaContent,\n    KindScrollAreaScrollbar,\n    KindScrollAreaThumb,\n    KindScrollAreaViewport,\n  } from \"../internal/scroll-area/index\";\n  import DocumentContent from \"./DocumentContent.svelte\";\n  import DocumentExpand from \"./DocumentExpand.svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Body> = $props();\n</script>\n\n{#snippet fallback({ streaming }: { streaming: boolean })}\n  <KindScrollArea stickToEnd={streaming}>\n    <KindScrollAreaViewport>\n      <KindScrollAreaContent>\n        <DocumentContent />\n      </KindScrollAreaContent>\n    </KindScrollAreaViewport\n    ><KindScrollAreaScrollbar>\n      <KindScrollAreaThumb />\n    </KindScrollAreaScrollbar>\n  </KindScrollArea\n  ><DocumentExpand />\n{/snippet}\n\n<parts.Body {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/DocumentBody.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/DocumentContent.svelte",
      "content": "<!--\n  The `content` as its `format` says: Markdown, a Code Block without its header, or wrapped plain text, unless you\n  pass children.\n-->\n<script lang=\"ts\">\n  import type { DocumentContentState } from \"@kind-ui/agent-ui/core\";\n  import type { ComponentProps } from \"svelte\";\n  import { CodeBlock } from \"../code-block/index\";\n  import { Markdown } from \"../markdown/index\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Content> = $props();\n</script>\n\n{#snippet fallback(state: DocumentContentState)}\n  {#if state.format === \"markdown\"}\n    <Markdown source={state.content} streaming={state.streaming} highlight={state.highlight} />\n  {:else if state.format === \"code\"}\n    <CodeBlock\n      header={false}\n      code={state.content}\n      language={state.language}\n      streaming={state.streaming}\n      highlight={state.highlight}\n    />\n  {:else}\n    <pre>{state.content}</pre>\n  {/if}\n{/snippet}\n\n<parts.Content {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/DocumentContent.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/DocumentCopy.svelte",
      "content": "<!-- Copies the `content`. Wraps a `KindToolbarButton` named \"Copy\", unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { KindToolbarButton } from \"../internal/toolbar/index\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Copy> = $props();\n</script>\n\n{#snippet fallback()}<KindToolbarButton aria-label=\"Copy\" />{/snippet}\n\n<parts.Copy {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/DocumentCopy.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/DocumentDownload.svelte",
      "content": "<!--\n  Calls `onDownload` with its `value`, a download's `id`. Wraps a `KindToolbarButton` named \"Download\", or showing\n  the download's `label` when there are several, unless you pass children.\n-->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { KindToolbarButton } from \"../internal/toolbar/index\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Download> = $props();\n</script>\n\n{#snippet fallback({ label }: { label: string | undefined })}\n  <KindToolbarButton aria-label={label ? `Download ${label}` : \"Download\"}\n    >{#if label}<span data-document-download-label=\"\">{label}</span>{/if}</KindToolbarButton\n  >\n{/snippet}\n\n<parts.Download {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/DocumentDownload.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/DocumentExpand.svelte",
      "content": "<!-- \"Show more\", or \"Show less\" while expanded. Rendered only while the content overflows the preview. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Expand> = $props();\n</script>\n\n{#snippet fallback({ label }: { label: string })}{label}{/snippet}\n\n<parts.Expand {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/DocumentExpand.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/DocumentMeta.svelte",
      "content": "<!-- What the document is and its size, like \"Markdown · 2.4 kB\", unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Meta> = $props();\n</script>\n\n{#snippet fallback({ meta }: { meta: string })}{meta}{/snippet}\n\n<parts.Meta {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/DocumentMeta.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/DocumentTitle.svelte",
      "content": "<!-- The `label`, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Title> = $props();\n</script>\n\n{#snippet fallback({ label }: { label: string })}{label}{/snippet}\n\n<parts.Title {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/DocumentTitle.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/DocumentToolbar.svelte",
      "content": "<!-- A `KindToolbar` with Copy and a Download for each of the `downloads`, unless you pass children. -->\n<script lang=\"ts\">\n  import type { DocumentDownload as Download } from \"@kind-ui/agent-ui/core\";\n  import type { ComponentProps } from \"svelte\";\n  import { KindToolbar } from \"../internal/toolbar/index\";\n  import DocumentCopy from \"./DocumentCopy.svelte\";\n  import DocumentDownload from \"./DocumentDownload.svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Toolbar> = $props();\n</script>\n\n{#snippet fallback({ downloads, canDownload }: { downloads: Download[]; canDownload: boolean })}\n  <KindToolbar aria-label=\"Document actions\">\n    <DocumentCopy\n    />{#if canDownload}\n      {#if downloads.length > 1}\n        {#each downloads as { id } (id)}\n          <DocumentDownload value={id} />\n        {/each}\n      {:else}\n        <DocumentDownload value={downloads[0]?.id} />\n      {/if}\n    {/if}\n  </KindToolbar>\n{/snippet}\n\n<parts.Toolbar {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/DocumentToolbar.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/index.ts",
      "content": "import type { ComponentProps } from \"svelte\";\nimport Document from \"./Document.svelte\";\nimport DocumentBody from \"./DocumentBody.svelte\";\nimport DocumentContent from \"./DocumentContent.svelte\";\nimport DocumentCopy from \"./DocumentCopy.svelte\";\nimport DocumentDownload from \"./DocumentDownload.svelte\";\nimport DocumentExpand from \"./DocumentExpand.svelte\";\nimport DocumentMeta from \"./DocumentMeta.svelte\";\nimport DocumentTitle from \"./DocumentTitle.svelte\";\nimport DocumentToolbar from \"./DocumentToolbar.svelte\";\nimport { parts } from \"./parts\";\n\n/** Holds the title, the meta line and the toolbar. */\nexport const DocumentHeader = parts.Header;\n\nexport {\n  Document,\n  DocumentBody,\n  DocumentContent,\n  DocumentCopy,\n  DocumentDownload,\n  DocumentExpand,\n  DocumentMeta,\n  DocumentTitle,\n  DocumentToolbar,\n};\n\nexport type DocumentProps = ComponentProps<typeof Document>;\nexport type DocumentTitleProps = ComponentProps<typeof DocumentTitle>;\nexport type DocumentMetaProps = ComponentProps<typeof DocumentMeta>;\nexport type DocumentToolbarProps = ComponentProps<typeof DocumentToolbar>;\nexport type DocumentCopyProps = ComponentProps<typeof DocumentCopy>;\nexport type DocumentDownloadProps = ComponentProps<typeof DocumentDownload>;\nexport type DocumentBodyProps = ComponentProps<typeof DocumentBody>;\nexport type DocumentContentProps = ComponentProps<typeof DocumentContent>;\nexport type DocumentExpandProps = ComponentProps<typeof DocumentExpand>;\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/index.ts"
    },
    {
      "path": "packages/agent-ui/src/svelte/document/parts.ts",
      "content": "import { documentPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/svelte/primitive\";\n\nexport const parts = createParts(documentPrimitive, {\n  root: \"div\",\n  header: \"div\",\n  title: \"span\",\n  meta: \"span\",\n  toolbar: \"div\",\n  copy: \"span\",\n  download: \"span\",\n  body: \"div\",\n  content: \"div\",\n  expand: \"button\",\n});\n",
      "type": "registry:ui",
      "target": "@ui/svelte/document/parts.ts"
    }
  ],
  "meta": {
    "layer": "svelte"
  },
  "type": "registry:ui"
}
