{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "share-dialog-svelte",
  "title": "Share Dialog (Svelte)",
  "description": "A Share button whose dialog chooses who can open the chat and shows the link the host makes, with Copy link.",
  "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-segmented-control-svelte"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialog.svelte",
      "content": "<!--\n  A Share button whose dialog chooses who can open the chat and shows the link the host makes, with Copy link and\n  Stop sharing. Any `children` replace the trigger and the dialog.\n-->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n  import ShareDialogContent from \"./ShareDialogContent.svelte\";\n  import ShareDialogTrigger from \"./ShareDialogTrigger.svelte\";\n\n  type RootProps = ComponentProps<typeof parts.Root>;\n\n  let {\n    open = $bindable(),\n    visibility = $bindable(),\n    children: content,\n    ...props\n  }: RootProps = $props();\n</script>\n\n<parts.Root bind:open bind:visibility {...props}>\n  {#snippet children(state: Parameters<NonNullable<RootProps[\"children\"]>>[0])}\n    {#if content}{@render content(state)}{:else}<ShareDialogTrigger /><parts.Backdrop /><ShareDialogContent />{/if}\n  {/snippet}\n</parts.Root>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialog.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogClose.svelte",
      "content": "<!-- Closes the dialog and returns focus to the trigger. \"Done\", 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.Close> = $props();\n</script>\n\n{#snippet fallback()}\n  Done\n{/snippet}\n\n<parts.Close {...props} children={children ?? fallback} />\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogClose.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogContent.svelte",
      "content": "<!-- The dialog: its title, who can open the chat, the link and its actions, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps } from \"svelte\";\n  import { parts } from \"./parts\";\n  import ShareDialogClose from \"./ShareDialogClose.svelte\";\n  import ShareDialogCopy from \"./ShareDialogCopy.svelte\";\n  import ShareDialogCreate from \"./ShareDialogCreate.svelte\";\n  import ShareDialogDescription from \"./ShareDialogDescription.svelte\";\n  import ShareDialogError from \"./ShareDialogError.svelte\";\n  import ShareDialogLink from \"./ShareDialogLink.svelte\";\n  import ShareDialogRevoke from \"./ShareDialogRevoke.svelte\";\n  import ShareDialogTitle from \"./ShareDialogTitle.svelte\";\n  import ShareDialogVisibility from \"./ShareDialogVisibility.svelte\";\n\n  type ContentProps = ComponentProps<typeof parts.Content>;\n\n  let { children: content, render: own, ...props }: ContentProps = $props();\n</script>\n\n<parts.Content {...props}>\n  <!-- A sheet sits in a full-screen viewport, which renders only while the content presents as one. -->\n  {#snippet render(handed: Parameters<NonNullable<ContentProps[\"render\"]>>[0])}\n    {#if handed.state.presentation === \"sheet\"}\n      <parts.Viewport>{@render element(handed)}</parts.Viewport>\n    {:else}\n      {@render element(handed)}\n    {/if}\n  {/snippet}\n  {#snippet children(state: Parameters<NonNullable<ContentProps[\"children\"]>>[0])}\n    {#if content}{@render content(state)}{:else}\n      <div data-share-dialog-header=\"\">\n        <ShareDialogTitle\n        /><ShareDialogDescription />\n      </div\n      ><ShareDialogVisibility\n      /><div data-share-dialog-link-row=\"\">\n        <ShareDialogCreate\n        /><ShareDialogLink\n        /><ShareDialogCopy />\n      </div\n      ><div data-share-dialog-footer=\"\">\n        <ShareDialogError\n        /><ShareDialogRevoke\n        /><ShareDialogClose />\n      </div>\n    {/if}\n  {/snippet}\n</parts.Content>\n\n{#snippet element(handed: Parameters<NonNullable<ContentProps[\"render\"]>>[0])}\n  {#if own}{@render own(handed)}{:else}<div {...handed.props}>{@render handed.children?.(handed.state)}</div>{/if}\n{/snippet}\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogContent.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogCopy.svelte",
      "content": "<!-- Copies the `link`. \"Copy link\", then \"Copied\" for 2 s, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Copy> & { children?: Snippet<[{ copied: boolean }]> };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<parts.Copy {...props}>\n  {#snippet children(state: { copied: boolean })}\n    {#if content}{@render content(state)}{:else}{state.copied ? \"Copied\" : \"Copy link\"}{/if}\n  {/snippet}\n</parts.Copy>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogCopy.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogCreate.svelte",
      "content": "<!-- Calls `onCreateLink`. \"Create link\", or \"Creating link\" with a running mark while pending, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ShareDialogActionState } from \"@kind-ui/agent-ui/core\";\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Create> & { children?: Snippet<[ShareDialogActionState]> };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<parts.Create {...props}>\n  {#snippet children(state: ShareDialogActionState)}\n    {#if content}{@render content(state)}{:else if state.pending}\n      <span aria-hidden=\"true\" data-status-mark=\"\" data-status=\"running\" data-motion={state.motion}></span>Creating link\n    {:else}Create link{/if}\n  {/snippet}\n</parts.Create>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogCreate.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogDescription.svelte",
      "content": "<!-- Who can open the chat, in words, unless you pass children. Describes the dialog. -->\n<script lang=\"ts\">\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Description> & { children?: Snippet<[{ text: string }]> };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<parts.Description {...props}>\n  {#snippet children(state: { text: string })}\n    {#if content}{@render content(state)}{:else}{state.text}{/if}\n  {/snippet}\n</parts.Description>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogDescription.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogError.svelte",
      "content": "<!-- Why the last create or revoke failed, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Error> & { children?: Snippet<[{ message: string }]> };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<parts.Error {...props}>\n  {#snippet children(state: { message: string })}\n    {#if content}{@render content(state)}{:else}{state.message}{/if}\n  {/snippet}\n</parts.Error>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogError.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogLink.svelte",
      "content": "<!-- The `link`, in a read-only UI SDK Input, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ShareDialogLinkState } from \"@kind-ui/agent-ui/core\";\n  import { Input } from \"@ui-sdk/svelte/input\";\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Link> & { children?: Snippet<[ShareDialogLinkState]> };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<parts.Link {...props}>\n  {#snippet children(input: ShareDialogLinkState)}\n    {#if content}{@render content(input)}{:else}\n      <Input value={input.value} readOnly={input.readOnly} aria-label={input[\"aria-label\"]} data-agent-hidden=\"\" />\n    {/if}\n  {/snippet}\n</parts.Link>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogLink.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogRevoke.svelte",
      "content": "<!-- Calls `onRevoke`. \"Stop sharing\", or \"Stopping\" with a running mark while pending, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ShareDialogActionState } from \"@kind-ui/agent-ui/core\";\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Revoke> & { children?: Snippet<[ShareDialogActionState]> };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<parts.Revoke {...props}>\n  {#snippet children(state: ShareDialogActionState)}\n    {#if content}{@render content(state)}{:else if state.pending}\n      <span aria-hidden=\"true\" data-status-mark=\"\" data-status=\"running\" data-motion={state.motion}></span>Stopping\n    {:else}Stop sharing{/if}\n  {/snippet}\n</parts.Revoke>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogRevoke.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogTitle.svelte",
      "content": "<!-- The dialog's title, the `dialogLabel`, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Title> & { children?: Snippet<[{ label: string }]> };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<parts.Title {...props}>\n  {#snippet children(state: { label: string })}\n    {#if content}{@render content(state)}{:else}{state.label}{/if}\n  {/snippet}\n</parts.Title>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogTitle.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogTrigger.svelte",
      "content": "<!-- Opens the dialog. Its `label`, after a share glyph, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Trigger> & { children?: Snippet<[{ label: string }]> };\n\n  let { children: content, ...props }: Props = $props();\n</script>\n\n<parts.Trigger {...props}>\n  {#snippet children(state: { label: string })}\n    {#if content}{@render content(state)}{:else}{state.label}{/if}\n  {/snippet}\n</parts.Trigger>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogTrigger.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/ShareDialogVisibility.svelte",
      "content": "<!-- \"Only you\" or \"Anyone with the link\", a UI SDK Segmented Control, unless you pass children. -->\n<script lang=\"ts\">\n  import type { ShareDialogVisibilityState } from \"@kind-ui/agent-ui/core\";\n  import type { ComponentProps, Snippet } from \"svelte\";\n  import {\n    KindSegmentedControl,\n    KindSegmentedControlIndicator,\n    KindSegmentedControlItem,\n  } from \"../internal/segmented-control/index\";\n  import { parts } from \"./parts\";\n\n  type Props = ComponentProps<typeof parts.Visibility> & { children?: Snippet<[ShareDialogVisibilityState]> };\n\n  let { children: content, ...props }: Props = $props();\n  // The control stays uncontrolled: the primitive writes its value through the controller.\n  const unbound = () => undefined;\n  const keep = () => {};\n</script>\n\n<parts.Visibility {...props}>\n  {#snippet children(control: ShareDialogVisibilityState)}\n    {#if content}{@render content(control)}{:else}\n      <!-- Hidden from agents, which use the Share Dialog's own `setVisibility`. -->\n      <KindSegmentedControl\n        controller={control.controller}\n        defaultValue={control.defaultValue}\n        bind:value={unbound, keep}\n        aria-label={control[\"aria-label\"]}\n        data-agent-hidden=\"\"\n      >\n        <KindSegmentedControlIndicator\n        />{#each control.options as option (option.value)}\n          <KindSegmentedControlItem value={option.value}>{option.label}</KindSegmentedControlItem>\n        {/each}\n      </KindSegmentedControl>\n    {/if}\n  {/snippet}\n</parts.Visibility>\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/ShareDialogVisibility.svelte"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/index.ts",
      "content": "import type { ComponentProps } from \"svelte\";\nimport { parts } from \"./parts\";\nimport ShareDialog from \"./ShareDialog.svelte\";\nimport ShareDialogClose from \"./ShareDialogClose.svelte\";\nimport ShareDialogContent from \"./ShareDialogContent.svelte\";\nimport ShareDialogCopy from \"./ShareDialogCopy.svelte\";\nimport ShareDialogCreate from \"./ShareDialogCreate.svelte\";\nimport ShareDialogDescription from \"./ShareDialogDescription.svelte\";\nimport ShareDialogError from \"./ShareDialogError.svelte\";\nimport ShareDialogLink from \"./ShareDialogLink.svelte\";\nimport ShareDialogRevoke from \"./ShareDialogRevoke.svelte\";\nimport ShareDialogTitle from \"./ShareDialogTitle.svelte\";\nimport ShareDialogTrigger from \"./ShareDialogTrigger.svelte\";\nimport ShareDialogVisibility from \"./ShareDialogVisibility.svelte\";\n\nexport {\n  ShareDialog,\n  ShareDialogClose,\n  ShareDialogContent,\n  ShareDialogCopy,\n  ShareDialogCreate,\n  ShareDialogDescription,\n  ShareDialogError,\n  ShareDialogLink,\n  ShareDialogRevoke,\n  ShareDialogTitle,\n  ShareDialogTrigger,\n  ShareDialogVisibility,\n};\n/** Dims the page behind the dialog. */\nexport const ShareDialogBackdrop = parts.Backdrop;\nexport type ShareDialogProps = ComponentProps<typeof ShareDialog>;\nexport type ShareDialogTriggerProps = ComponentProps<typeof ShareDialogTrigger>;\nexport type ShareDialogContentProps = ComponentProps<typeof ShareDialogContent>;\nexport type ShareDialogTitleProps = ComponentProps<typeof ShareDialogTitle>;\nexport type ShareDialogDescriptionProps = ComponentProps<typeof ShareDialogDescription>;\nexport type ShareDialogVisibilityProps = ComponentProps<typeof ShareDialogVisibility>;\nexport type ShareDialogLinkProps = ComponentProps<typeof ShareDialogLink>;\nexport type ShareDialogCreateProps = ComponentProps<typeof ShareDialogCreate>;\nexport type ShareDialogCopyProps = ComponentProps<typeof ShareDialogCopy>;\nexport type ShareDialogRevokeProps = ComponentProps<typeof ShareDialogRevoke>;\nexport type ShareDialogErrorProps = ComponentProps<typeof ShareDialogError>;\nexport type ShareDialogCloseProps = ComponentProps<typeof ShareDialogClose>;\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/index.ts"
    },
    {
      "path": "packages/agent-ui/src/svelte/share-dialog/parts.ts",
      "content": "import { shareDialogPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/svelte/primitive\";\n\nexport const parts = createParts(shareDialogPrimitive, {\n  root: \"div\",\n  trigger: \"button\",\n  backdrop: \"div\",\n  viewport: \"div\",\n  content: \"div\",\n  title: \"h2\",\n  description: \"p\",\n  visibility: \"div\",\n  link: \"div\",\n  create: \"button\",\n  copy: \"button\",\n  revoke: \"button\",\n  error: \"p\",\n  close: \"button\",\n});\n",
      "type": "registry:ui",
      "target": "@ui/svelte/share-dialog/parts.ts"
    }
  ],
  "meta": {
    "layer": "svelte"
  },
  "type": "registry:ui"
}
