{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "inline-citation-svelte",
  "title": "Inline Citation (Svelte)",
  "description": "A marker in running text whose card shows the sources it points to, paging through several.",
  "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"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitation.svelte",
      "content": "<!--\n  A marker in running text for the sources a sentence came from, with a card that opens on hover, keyboard focus and\n  press. More than one source pages in the card. Any `children` replace the marker and the card.\n-->\n<script lang=\"ts\">\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import InlineCitationCarousel from \"./InlineCitationCarousel.svelte\";\n  import InlineCitationContent from \"./InlineCitationContent.svelte\";\n  import InlineCitationItem from \"./InlineCitationItem.svelte\";\n  import InlineCitationTrigger from \"./InlineCitationTrigger.svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Root> & { children?: Snippet };\n\n  let { children: content, open = $bindable(), ...props }: Props = $props();\n</script>\n\n<parts.Root {...props} bind:open>\n  {#snippet children({ ids })}\n    {#if content}\n      {@render content()}\n    {:else}\n      <!-- A citation sits in running text, so no whitespace between its parts. -->\n      <InlineCitationTrigger /><InlineCitationContent>\n        {#if ids.length > 1}\n          <InlineCitationCarousel />\n        {:else if ids[0]}\n          <InlineCitationItem value={ids[0]} />\n        {/if}\n      </InlineCitationContent>\n    {/if}\n  {/snippet}\n</parts.Root>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitation.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationCarousel.svelte",
      "content": "<!--\n  UI SDK's Carousel, a slide per source with Previous, the page and Next below. Rendered only for more than one\n  source. Any `children` replace the slides and controls, inside the Carousel.\n-->\n<script lang=\"ts\">\n  import { Carousel, CarouselContent, CarouselItem, CarouselViewport } from \"@ui-sdk/svelte/carousel\";\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import InlineCitationIndex from \"./InlineCitationIndex.svelte\";\n  import InlineCitationItem from \"./InlineCitationItem.svelte\";\n  import InlineCitationNext from \"./InlineCitationNext.svelte\";\n  import InlineCitationPrevious from \"./InlineCitationPrevious.svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Carousel> & { children?: Snippet };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<!-- Every Carousel part is a `span`, so the card stays valid inside a paragraph. -->\n{#snippet span({ props, state, children }: { props: object; state: unknown; children?: Snippet<[never]> })}\n  <span {...props}>{@render children?.(state as never)}</span>\n{/snippet}\n\n<parts.Carousel {...props}>\n  {#snippet children({ controller, defaultPage, ids })}\n    <Carousel render={span} {controller} {defaultPage} drag={false} aria-label=\"Sources\">\n      {#if content}\n        {@render content()}\n      {:else}\n        <CarouselViewport render={span}>\n          <CarouselContent render={span}>\n            {#each ids as id (id)}\n              <CarouselItem render={span}>\n                <InlineCitationItem value={id} />\n              </CarouselItem>\n            {/each}\n          </CarouselContent>\n        </CarouselViewport\n        ><span data-inline-citation-controls=\"\">\n          <InlineCitationPrevious\n          /><InlineCitationIndex\n          /><InlineCitationNext />\n        </span>\n      {/if}\n    </Carousel>\n  {/snippet}\n</parts.Carousel>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationCarousel.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationContent.svelte",
      "content": "<!-- The card. Leaves focus on the marker when it opens. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  let props: ComponentProps<typeof parts.Content> = $props();\n</script>\n\n<parts.Content initialFocus=\"none\" {...props} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationContent.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationHost.svelte",
      "content": "<!-- The host name of the source's `url`, unless you pass children. Rendered only with a safe `url`. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Host> = $props();\n</script>\n\n{#snippet fallback({ host }: { host: string })}{host}{/snippet}\n\n<parts.Host {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationHost.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationIcon.svelte",
      "content": "<!-- A UI SDK Avatar of the source's `favicon`, showing a link glyph until it loads or without one. -->\n<script lang=\"ts\">\n  import { Avatar, AvatarFallback, AvatarImage } from \"@ui-sdk/svelte/avatar\";\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Icon> = $props();\n</script>\n\n{#snippet fallback({ favicon }: { favicon: string | undefined })}\n  <Avatar>{#if favicon}<AvatarImage src={favicon} alt=\"\" />{/if}<AvatarFallback /></Avatar>\n{/snippet}\n\n<parts.Icon {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationIcon.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationIndex.svelte",
      "content": "<!-- Which source the card shows, like \"1 of 3\", 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.Index> = $props();\n</script>\n\n{#snippet fallback({ text }: { text: string })}{text}{/snippet}\n\n<parts.Index {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationIndex.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationItem.svelte",
      "content": "<!--\n  The source whose `id` is `value`. Without children, it shows its icon, title and host name, a link when its `url` is\n  safe, then its snippet.\n-->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import InlineCitationHost from \"./InlineCitationHost.svelte\";\n  import InlineCitationIcon from \"./InlineCitationIcon.svelte\";\n  import InlineCitationSnippet from \"./InlineCitationSnippet.svelte\";\n  import InlineCitationSourceTitle from \"./InlineCitationSourceTitle.svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Item> = $props();\n</script>\n\n{#snippet fallback()}\n  <parts.Link><InlineCitationIcon /><InlineCitationSourceTitle /><InlineCitationHost /></parts.Link\n  ><InlineCitationSnippet />\n{/snippet}\n\n<parts.Item {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationItem.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationNext.svelte",
      "content": "<!-- Shows the next source. -->\n<script lang=\"ts\">\n  import { CarouselNext } from \"@ui-sdk/svelte/carousel\";\n  import type { ComponentProps } from \"svelte\";\n\n  let { children = chevron, ...props }: ComponentProps<typeof CarouselNext> = $props();\n</script>\n\n<CarouselNext aria-label=\"Next source\" data-agent-hidden=\"\" data-kind-icon-button=\"\" {...props} {children} />\n\n{#snippet chevron()}\n  <!-- Lucide \"chevron-right\", see THIRD_PARTY_NOTICES.md. -->\n  <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\">\n    <path d=\"m9 18 6-6-6-6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n  </svg>\n{/snippet}\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationNext.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationPrevious.svelte",
      "content": "<!-- Shows the previous source. -->\n<script lang=\"ts\">\n  import { CarouselPrevious } from \"@ui-sdk/svelte/carousel\";\n  import type { ComponentProps } from \"svelte\";\n\n  // Previous and Next are hidden from agents, which takes the Carousel out of their snapshot: an agent pages with the\n  // citation's own `next` and `previous`.\n  let { children = chevron, ...props }: ComponentProps<typeof CarouselPrevious> = $props();\n</script>\n\n<CarouselPrevious aria-label=\"Previous source\" data-agent-hidden=\"\" data-kind-icon-button=\"\" {...props} {children} />\n\n{#snippet chevron()}\n  <!-- Lucide \"chevron-left\", see THIRD_PARTY_NOTICES.md. -->\n  <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\">\n    <path d=\"m15 18-6-6 6-6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n  </svg>\n{/snippet}\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationPrevious.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationSnippet.svelte",
      "content": "<!-- The source's `snippet`, unless you pass children. Rendered only with a `snippet`. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  let { children, ...props }: ComponentProps<typeof parts.Snippet> = $props();\n</script>\n\n{#snippet fallback({ snippet }: { snippet: string })}{snippet}{/snippet}\n\n<parts.Snippet {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationSnippet.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationSourceTitle.svelte",
      "content": "<!-- The source's `title`, 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.SourceTitle> = $props();\n</script>\n\n{#snippet fallback({ title }: { title: string })}{title}{/snippet}\n\n<parts.SourceTitle {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationSourceTitle.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/InlineCitationTrigger.svelte",
      "content": "<!-- The marker, which opens the card. Reads 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.Trigger> = $props();\n</script>\n\n{#snippet fallback({ label }: { label: string })}{label}{/snippet}\n\n<parts.Trigger {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/InlineCitationTrigger.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/index.ts",
      "content": "import type { ComponentProps } from \"svelte\";\nimport InlineCitation from \"./InlineCitation.svelte\";\nimport InlineCitationCarousel from \"./InlineCitationCarousel.svelte\";\nimport InlineCitationContent from \"./InlineCitationContent.svelte\";\nimport InlineCitationHost from \"./InlineCitationHost.svelte\";\nimport InlineCitationIcon from \"./InlineCitationIcon.svelte\";\nimport InlineCitationIndex from \"./InlineCitationIndex.svelte\";\nimport InlineCitationItem from \"./InlineCitationItem.svelte\";\nimport InlineCitationNext from \"./InlineCitationNext.svelte\";\nimport InlineCitationPrevious from \"./InlineCitationPrevious.svelte\";\nimport InlineCitationSnippet from \"./InlineCitationSnippet.svelte\";\nimport InlineCitationSourceTitle from \"./InlineCitationSourceTitle.svelte\";\nimport InlineCitationTrigger from \"./InlineCitationTrigger.svelte\";\nimport { parts } from \"./parts\";\n\n/** Links to the source's `url` in a new tab; an `a` without `href`, which is text, when the URL isn't safe. */\nexport const InlineCitationLink = parts.Link;\n\nexport {\n  InlineCitation,\n  InlineCitationCarousel,\n  InlineCitationContent,\n  InlineCitationHost,\n  InlineCitationIcon,\n  InlineCitationIndex,\n  InlineCitationItem,\n  InlineCitationNext,\n  InlineCitationPrevious,\n  InlineCitationSnippet,\n  InlineCitationSourceTitle,\n  InlineCitationTrigger,\n};\n\nexport type InlineCitationProps = ComponentProps<typeof InlineCitation>;\nexport type InlineCitationTriggerProps = ComponentProps<typeof InlineCitationTrigger>;\nexport type InlineCitationContentProps = ComponentProps<typeof InlineCitationContent>;\nexport type InlineCitationCarouselProps = ComponentProps<typeof InlineCitationCarousel>;\nexport type InlineCitationItemProps = ComponentProps<typeof InlineCitationItem>;\nexport type InlineCitationIconProps = ComponentProps<typeof InlineCitationIcon>;\nexport type InlineCitationHostProps = ComponentProps<typeof InlineCitationHost>;\nexport type InlineCitationSourceTitleProps = ComponentProps<typeof InlineCitationSourceTitle>;\nexport type InlineCitationSnippetProps = ComponentProps<typeof InlineCitationSnippet>;\nexport type InlineCitationIndexProps = ComponentProps<typeof InlineCitationIndex>;\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/index.ts"
    },
    {
      "path": "packages/agent-ui/src/svelte/inline-citation/parts.ts",
      "content": "import { inlineCitationPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/svelte/primitive\";\n\n// Every part is a `span`, so a citation is valid inside a paragraph.\nexport const parts = createParts(inlineCitationPrimitive, {\n  root: \"span\",\n  trigger: \"button\",\n  content: \"span\",\n  carousel: \"span\",\n  item: \"span\",\n  link: \"a\",\n  icon: \"span\",\n  host: \"span\",\n  \"source-title\": \"span\",\n  snippet: \"span\",\n  index: \"span\",\n});\n",
      "type": "registry:ui",
      "target": "@ui/svelte/inline-citation/parts.ts"
    }
  ],
  "meta": {
    "layer": "svelte"
  },
  "type": "registry:ui"
}
