{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "generated-image-vue",
  "title": "Generated Image (Vue)",
  "description": "An image the agent is making, from progress and a blurred preview to the image, which opens full size.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/vue@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/vue/generated-image.ts",
      "content": "import { generatedImagePrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/vue/primitive\";\nimport {\n  Progress,\n  ProgressIndicator,\n  ProgressLabel,\n  ProgressTrack,\n  ProgressValue,\n} from \"@ui-sdk/vue/progress\";\nimport { type Component, defineComponent, h, type Slot, type Slots, type VNode } from \"vue\";\n\nconst parts = createParts(generatedImagePrimitive, {\n  root: \"div\",\n  frame: \"div\",\n  preview: \"img\",\n  progress: \"div\",\n  image: \"img\",\n  error: \"div\",\n  trigger: \"button\",\n  download: \"button\",\n  backdrop: \"div\",\n  content: \"div\",\n  \"full-image\": \"img\",\n  title: \"h2\",\n  close: \"button\",\n});\n\n// A part whose default slot falls back to content built from its state.\nfunction withDefault<C extends Component, State>(part: C, name: string, fallback: (state: State) => unknown) {\n  return defineComponent({\n    name,\n    inheritAttrs: false,\n    setup(_, { attrs, slots }) {\n      const fill: Slot = ({ state }) => fallback(state) as VNode[];\n      return () => h(part, attrs, { ...slots, default: slots.default ?? fill } as Slots);\n    },\n  }) as unknown as C;\n}\n\n/** The `preview`, blurred and sharpening with `progress`, while the image is on its way. */\nexport const GeneratedImagePreview = parts.Preview;\n\n/**\n * A UI SDK Progress, read as a quiet corner label like \"Creating image · 42%\" until the image loads, unless you fill\n * the default slot.\n */\nexport const GeneratedImageProgress = withDefault(\n  parts.Progress,\n  \"GeneratedImageProgress\",\n  (state: { value: number | null; label: string }) => {\n    const { value, label } = state;\n    return h(Progress, { value }, () => [\n      h(ProgressLabel, null, () => label),\n      h(ProgressValue),\n      h(ProgressTrack, null, () => h(ProgressIndicator)),\n    ]);\n  },\n);\n\n/** The image at `src`, which fades in once it loads. */\nexport const GeneratedImageImage = parts.Image;\n\n/** What went wrong, under a muted image glyph, unless you fill the default slot. */\nexport const GeneratedImageError = withDefault(\n  parts.Error,\n  \"GeneratedImageError\",\n  (state: { message: string | undefined }) => state.message,\n);\n\n/** \"View full size\": covers the loaded image and opens it in a dialog. */\nexport const GeneratedImageTrigger = parts.Trigger;\n\n/** Calls `onDownload`. Rendered while it's set and the image is loaded. */\nexport const GeneratedImageDownload = parts.Download;\n\n/** Dims the page behind the full size view. */\nexport const GeneratedImageBackdrop = parts.Backdrop;\n\n/** The image at full size, inside the dialog. */\nexport const GeneratedImageFullImage = parts.FullImage;\n\n/** The `alt`, unless you fill the default slot. Names the dialog. */\nexport const GeneratedImageTitle = withDefault(\n  parts.Title,\n  \"GeneratedImageTitle\",\n  (state: { alt: string }) => state.alt,\n);\n\n/** Closes the dialog and returns focus to the trigger. \"Close\", unless you fill the default slot. */\nexport const GeneratedImageClose = withDefault(parts.Close, \"GeneratedImageClose\", () => \"Close\");\n\n/** Keeps the image's shape in every phase. Holds the preview, progress, image, error, trigger and Download. */\nexport const GeneratedImageFrame = withDefault(parts.Frame, \"GeneratedImageFrame\", () => [\n  h(GeneratedImagePreview),\n  h(GeneratedImageImage),\n  h(GeneratedImageProgress),\n  h(GeneratedImageError),\n  h(GeneratedImageTrigger),\n  h(GeneratedImageDownload),\n]);\n\n/** The full size view: the image, its `alt` as the title, Download and Close, unless you fill the default slot. */\nexport const GeneratedImageDialog = withDefault(parts.Content, \"GeneratedImageDialog\", () => [\n  h(GeneratedImageFullImage),\n  h(\"div\", { \"data-generated-image-actions\": \"\" }, [\n    h(GeneratedImageTitle),\n    h(GeneratedImageDownload, null, () => \"Download\"),\n    h(GeneratedImageClose),\n  ]),\n]);\n\n/**\n * An image the agent is making: a frame of the image's shape that shows its progress and a blurred preview, then\n * the image, which opens full size. A filled default slot replaces the frame and the full size view.\n */\nexport const GeneratedImage = withDefault(parts.Root, \"GeneratedImage\", () => [\n  h(GeneratedImageFrame),\n  h(GeneratedImageBackdrop),\n  h(GeneratedImageDialog),\n]);\n",
      "type": "registry:ui",
      "target": "@ui/vue/generated-image.ts"
    }
  ],
  "meta": {
    "layer": "vue"
  },
  "type": "registry:ui"
}
