{
  "$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/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Source: packages/compose-gen/specs/patterns/media-frame.json\n\npackage blocks\n\nimport (\n\t\"github.com/ui8kit/codegen/generated/templ/ui/box\"\n\t\"github.com/ui8kit/codegen/generated/templ/compose\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/image\"\n\tuiutils \"github.com/ui8kit/codegen/generated/templ/orgutils\"\n)\n\n// MediaFrameProps are the props of MediaFrame; the values are the JSON shapes of the TypeScript props.\ntype MediaFrameProps struct {\n\tAlt any `json:\"alt\"`\n\tSrc any `json:\"src\"`\n\tDarkSrc any `json:\"darkSrc\"`\n\tRatio any `json:\"ratio\"`\n\tClass string `json:\"className\"`\n}\n\nvar mediaFramePlaceholder = map[string]any{\n\t\"light\": \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgMzAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBzbGljZSI+PHJlY3Qgd2lkdGg9IjQwMCIgaGVpZ2h0PSIzMDAiIGZpbGw9IiNlMmU4ZjAiLz48Y2lyY2xlIGN4PSIyOTYiIGN5PSI5NiIgcj0iMzAiIGZpbGw9IiNjYmQ1ZTEiLz48cGF0aCBkPSJNMCAzMDBWMjE0bDk2LTc2IDg4IDcwIDY0LTQ4IDE1MiA5NnY0NHoiIGZpbGw9IiNjYmQ1ZTEiLz48cGF0aCBkPSJNMCAzMDB2LTUybDEyMC02MCAxMTAgNjIgNjAtMzAgMTEwIDgwdjB6IiBmaWxsPSIjOTRhM2I4IiBvcGFjaXR5PSIwLjU1Ii8+PC9zdmc+\",\n\t\"dark\": \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgMzAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBzbGljZSI+PHJlY3Qgd2lkdGg9IjQwMCIgaGVpZ2h0PSIzMDAiIGZpbGw9IiMxZTI5M2IiLz48Y2lyY2xlIGN4PSIyOTYiIGN5PSI5NiIgcj0iMzAiIGZpbGw9IiMzMzQxNTUiLz48cGF0aCBkPSJNMCAzMDBWMjE0bDk2LTc2IDg4IDcwIDY0LTQ4IDE1MiA5NnY0NHoiIGZpbGw9IiMzMzQxNTUiLz48cGF0aCBkPSJNMCAzMDB2LTUybDEyMC02MCAxMTAgNjIgNjAtMzAgMTEwIDgwdjB6IiBmaWxsPSIjNDc1NTY5IiBvcGFjaXR5PSIwLjU1Ii8+PC9zdmc+\",\n}\n\n// 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 light and one dark), so a page can be laid out before it has pictures; the placeholder is decorative (`alt` is empty), stands in for a real `src` and is switched by the theme token. A real picture gets `alt` and loads lazily. `ratio` comes from the recipe; the corners are the plain theme radius.\ntempl MediaFrame(p MediaFrameProps) {\n\t{{ vAlt := p.Alt }}\n\t{{ vSrc := p.Src }}\n\t{{ vDarkSrc := p.DarkSrc }}\n\t{{ vRatio := uiutils.Def(p.Ratio, \"16/9\") }}\n\t{{ vLightSrc := any(uiutils.Cond(uiutils.T(vSrc), vSrc, uiutils.At(mediaFramePlaceholder, \"light\"))) }}\n\t{{ vNightSrc := any(uiutils.Cond(uiutils.T(vDarkSrc), vDarkSrc, uiutils.Cond(uiutils.T(vSrc), vSrc, uiutils.At(mediaFramePlaceholder, \"dark\")))) }}\n\t{{ vShownAlt := any(uiutils.Cond(uiutils.T(vSrc), vAlt, \"\")) }}\n\t{{ vLoadHint := any(uiutils.Cond(uiutils.T(vSrc), \"lazy\", nil)) }}\n\t{{ vDecodeHint := any(uiutils.Cond(uiutils.T(vSrc), \"async\", nil)) }}\n\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv(recipeMediaFrame.Of(map[string]any{\"ratio\": vRatio}), p.Class)), Attrs: uiutils.Attrs(\"data-slot\", \"media-frame\", \"data-placeholder\", uiutils.Cond(uiutils.T(vSrc), \"false\", \"true\"))}}) {\n\t\t@compose.Image(compose.ImageProps{ImageProps: image.ImageProps{Src: uiutils.URL(vLightSrc, true), Alt: uiutils.S(vShownAlt), Loading: uiutils.S(vLoadHint), Decoding: uiutils.S(vDecodeHint), Class: \"absolute inset-0 size-full object-cover dark:hidden\", Attrs: uiutils.Attrs(\"data-theme-src\", \"light\")}})\n\t\t@compose.Image(compose.ImageProps{ImageProps: image.ImageProps{Src: uiutils.URL(vNightSrc, true), Alt: uiutils.S(vShownAlt), Loading: uiutils.S(vLoadHint), Decoding: uiutils.S(vDecodeHint), Class: \"absolute inset-0 hidden size-full object-cover dark:block\", Attrs: uiutils.Attrs(\"data-theme-src\", \"dark\")}})\n\t}\n}\n",
      "path": "blocks/media-frame.templ",
      "target": "blocks/media-frame.templ"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "templ",
      "component"
    ]
  },
  "name": "media-frame",
  "registryDependencies": [
    "box",
    "image",
    "kit-box",
    "kit-image",
    "presets",
    "utils"
  ],
  "runtime": "templ",
  "title": "Media Frame",
  "type": "registry:component"
}
