{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "A picture in a fixed ratio that follows the theme. `src` is the picture of the light theme, `darkSrc` the one of the dark theme (without it the dark theme shows `src`). Without both (an empty string counts as none) it shows the built-in neutral placeholders (base64 data URIs, one",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Data of MediaFrame: long values (pictures as data URIs) kept out of the component file.\n\nexport const PLACEHOLDER: Record<string, string> = {\n  \"light\": \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgMzAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBzbGljZSI+PHJlY3Qgd2lkdGg9IjQwMCIgaGVpZ2h0PSIzMDAiIGZpbGw9IiNlMmU4ZjAiLz48Y2lyY2xlIGN4PSIyOTYiIGN5PSI5NiIgcj0iMzAiIGZpbGw9IiNjYmQ1ZTEiLz48cGF0aCBkPSJNMCAzMDBWMjE0bDk2LTc2IDg4IDcwIDY0LTQ4IDE1MiA5NnY0NHoiIGZpbGw9IiNjYmQ1ZTEiLz48cGF0aCBkPSJNMCAzMDB2LTUybDEyMC02MCAxMTAgNjIgNjAtMzAgMTEwIDgwdjB6IiBmaWxsPSIjOTRhM2I4IiBvcGFjaXR5PSIwLjU1Ii8+PC9zdmc+\",\n  \"dark\": \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgMzAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBzbGljZSI+PHJlY3Qgd2lkdGg9IjQwMCIgaGVpZ2h0PSIzMDAiIGZpbGw9IiMxZTI5M2IiLz48Y2lyY2xlIGN4PSIyOTYiIGN5PSI5NiIgcj0iMzAiIGZpbGw9IiMzMzQxNTUiLz48cGF0aCBkPSJNMCAzMDBWMjE0bDk2LTc2IDg4IDcwIDY0LTQ4IDE1MiA5NnY0NHoiIGZpbGw9IiMzMzQxNTUiLz48cGF0aCBkPSJNMCAzMDB2LTUybDEyMC02MCAxMTAgNjIgNjAtMzAgMTEwIDgwdjB6IiBmaWxsPSIjNDc1NTY5IiBvcGFjaXR5PSIwLjU1Ii8+PC9zdmc+\",\n};\n",
      "path": "components/media-frame.assets.ts",
      "target": "components/media-frame.assets.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n/**\n * A picture in a fixed ratio that follows the theme. `src` is the picture of the light theme, `darkSrc` the one\n * of the dark theme (without it the dark theme shows `src`). Without both (an empty string counts as none) it\n * shows the built-in neutral placeholders (base64 data URIs, one light and one dark), so a page can be laid out\n * before it has pictures; the placeholder is decorative (`alt` is empty), stands in for a real `src` and is\n * switched by the theme token. A real picture gets `alt` and loads lazily. `ratio` comes from the recipe; the\n * corners are the plain theme radius.\n */\nimport { type ReactNode } from \"react\";\nimport { Box, Image } from \"../compose\";\nimport { at, cn, urlOf, variants } from \"../utils\";\nimport { PLACEHOLDER } from \"./media-frame.assets\";\n\n/** MediaFrame: the classes of each value (shadcn/cva style). */\nexport const mediaFrameVariants = variants({\n  base: \"relative w-full overflow-hidden bg-muted text-muted-foreground inset-ring inset-ring-border rounded\",\n  variants: {\n    ratio: {\n      \"16/9\": \"aspect-video\",\n      \"4/3\": \"aspect-4/3\",\n      \"1/1\": \"aspect-square\",\n      \"3/4\": \"aspect-3/4\",\n      \"21/9\": \"aspect-21/9\",\n    },\n  },\n  defaultVariants: { ratio: \"16/9\" },\n});\n\nexport type MediaFrameProps = {\n  alt: string;\n  src?: string;\n  darkSrc?: string;\n  ratio?: \"16/9\" | \"4/3\" | \"1/1\" | \"3/4\" | \"21/9\";\n  className?: string;\n};\n\nexport function MediaFrame({ alt, src, darkSrc, ratio = \"16/9\", className }: MediaFrameProps) {\n  const lightSrc = src ? src : at(PLACEHOLDER, \"light\");\n  const nightSrc = darkSrc ? darkSrc : (src ? src : at(PLACEHOLDER, \"dark\"));\n  const shownAlt = src ? alt : \"\";\n  const loadHint = src ? \"lazy\" : undefined;\n  const decodeHint = src ? \"async\" : undefined;\n  return (\n    <Box\n      className={cn(mediaFrameVariants({ ratio: ratio }), className)}\n      data-slot=\"media-frame\"\n      data-placeholder={(src ? \"false\" : \"true\")}\n    >\n      <Image\n        src={urlOf(lightSrc, true)}\n        alt={shownAlt}\n        loading={loadHint}\n        decoding={decodeHint}\n        className=\"absolute inset-0 size-full object-cover dark:hidden\"\n        data-theme-src=\"light\"\n      />\n      <Image\n        src={urlOf(nightSrc, true)}\n        alt={shownAlt}\n        loading={loadHint}\n        decoding={decodeHint}\n        className=\"absolute inset-0 hidden size-full object-cover dark:block\"\n        data-theme-src=\"dark\"\n      />\n    </Box>\n  );\n}\n",
      "path": "components/media-frame.tsx",
      "target": "components/media-frame.tsx"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "react",
      "component"
    ]
  },
  "name": "media-frame",
  "registryDependencies": [
    "compose",
    "utils"
  ],
  "runtime": "react",
  "title": "Media Frame",
  "type": "registry:component"
}
