{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "selection-svelte",
  "title": "Selection (Svelte)",
  "description": "A small toolbar of actions that floats above text a person selects in a reply.",
  "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-toolbar-svelte"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/svelte/selection/Selection.svelte",
      "content": "<!-- Wraps a reply so selecting text in it shows a toolbar of `actions` above the selection. The `children` are the reply. -->\n<script lang=\"ts\">\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n  import SelectionToolbar from \"./SelectionToolbar.svelte\";\n\n  type Props = ComponentProps<typeof parts.Root> & { children?: Snippet };\n\n  let { children, ...props }: Props = $props();\n</script>\n\n<parts.Root {...props}>\n  <parts.Content>{@render children?.()}</parts.Content\n  ><SelectionToolbar />\n</parts.Root>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/selection/Selection.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/selection/SelectionItem.svelte",
      "content": "<!--\n  An action, whose `value` is its `id`. Wrap a `KindToolbarButton`, or leave it empty for one with the action's label.\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.Item> = $props();\n</script>\n\n{#snippet fallback({ label, description, canRun }: { label: string; description?: string; canRun: boolean })}\n  <KindToolbarButton disabled={!canRun} title={description}>{label}</KindToolbarButton>\n{/snippet}\n\n<parts.Item {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/selection/SelectionItem.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/selection/SelectionToolbar.svelte",
      "content": "<!-- Shown above the selection, with one `SelectionItem` per action unless you pass children. -->\n<script lang=\"ts\">\n  import type { SelectionToolbarState } from \"@kind-ui/agent-ui/core\";\n  import type { ComponentProps } from \"svelte\";\n  import { KindToolbar } from \"../internal/toolbar/index\";\n  import { parts } from \"./parts\";\n  import SelectionItem from \"./SelectionItem.svelte\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Toolbar> = $props();\n</script>\n\n{#snippet fallback({ label, actions }: SelectionToolbarState)}\n  <KindToolbar aria-label={label}>\n    {#each actions as action (action.id)}\n      <SelectionItem value={action.id} />\n    {/each}\n  </KindToolbar>\n{/snippet}\n\n<parts.Toolbar {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/selection/SelectionToolbar.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/selection/index.ts",
      "content": "import type { ComponentProps } from \"svelte\";\nimport { parts } from \"./parts\";\nimport Selection from \"./Selection.svelte\";\nimport SelectionItem from \"./SelectionItem.svelte\";\nimport SelectionToolbar from \"./SelectionToolbar.svelte\";\n\n/** The bare root, for arranging `SelectionContent` and `SelectionToolbar` yourself. */\nexport const SelectionRoot = parts.Root;\n\n/** Holds the text a person selects. Put `SelectionToolbar` right after it. */\nexport const SelectionContent = parts.Content;\n\nexport { Selection, SelectionItem, SelectionToolbar };\nexport type SelectionProps = ComponentProps<typeof Selection>;\nexport type SelectionToolbarProps = ComponentProps<typeof SelectionToolbar>;\nexport type SelectionItemProps = ComponentProps<typeof SelectionItem>;\n",
      "type": "registry:ui",
      "target": "@ui/svelte/selection/index.ts"
    },
    {
      "path": "packages/agent-ui/src/svelte/selection/parts.ts",
      "content": "import { selectionPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/svelte/primitive\";\n\nexport const parts = createParts(selectionPrimitive, {\n  root: \"div\",\n  content: \"div\",\n  toolbar: \"div\",\n  item: \"span\",\n});\n",
      "type": "registry:ui",
      "target": "@ui/svelte/selection/parts.ts"
    }
  ],
  "meta": {
    "layer": "svelte"
  },
  "type": "registry:ui"
}
