{
  "timestamp": "2026-11-19T09:33:56",
  "compiler": {
    "name": "@stencil/core",
    "version": "4.45.4",
    "typescriptVersion": "5.8.3"
  },
  "storybook": "https://magma-design-system.github.io/magma/storybook/",
  "studio": "https://magma-design-system.github.io/magma/studio/",
  "components": [
    {
      "filePath": "src/components/mds-card-media/mds-card-media.tsx",
      "encapsulation": "shadow",
      "tag": "mds-card-media",
      "docs": "This is a web-component from Maggioli Design System [Magma](https://magma.maggiolicloud.it), built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScript framework you are using.",
      "docsTags": [
        {
          "name": "slot",
          "text": "- Add `HTML elements` or `components` to this slot, it is **recommended** to add `mds-img` element or other component which represents media contents."
        },
        {
          "name": "slot",
          "text": "content - Add `text string`, `HTML elements` or `components` to this slot, contents will be shown in front of the media element."
        },
        {
          "name": "part",
          "text": "content - The layer in front of the media that holds the `content` slot"
        },
        {
          "name": "parent",
          "text": "mds-card"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-card-media>` web component is the media region of a [`<mds-card>`](../mds-card/AGENTS.md): it wraps an image, video or other visual asset and provides an optional overlay layer for text or controls rendered on top of that asset. It is a layout child with no HTML primitive equivalent - it exists purely to occupy and style the card's `media` region.\n\n#### Semantic Behavior\n\n- **Compound child only**: `<mds-card-media>` is designed to live as a direct child of `<mds-card>` and must not be used standalone or mixed in as a different card region.\n- **Self-slotting into the parent**: It lands in the card's `media` region automatically without the author setting any `slot`, and its presence is factored into the card layout.\n- **Two-layer composition**: The default slot holds the media asset itself (recommended `mds-img` or another media component), while the named `content` slot overlays that asset, bottom-aligned and centered, so overlay text/actions float in front of the media.\n- **No interactive state**: The component holds no props, state, events, ARIA roles or focus behavior of its own - it is a passive presentational wrapper, and any semantics come from the elements slotted into it.\n\n#### Slot semantics and layout role\n\n`<mds-card-media>` exposes no configurable properties; its behavior is entirely defined by its two slots and its position inside the card.\n\n- **default slot**: the media surface. Place the actual visual asset here (an `mds-img`, video, or equivalent component). This layer fills the host.\n- **`content` slot**: an overlay layer (exposed as the `content` shadow part) positioned over the media, aligned to the bottom and horizontally centered, intended for captions, titles, or action controls that should appear in front of the media rather than beside it.\n\nThe host paints a neutral background, so the media region keeps a defined surface even before its asset loads. Neither this component nor the parent card uses the shared variant/tone system of [`agents/variants.md`](../../../../agents/variants.md).\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-card-media>` component, ordered from most common to most specialized. The examples assume a working knowledge of the shared component rules in [`agents/conventions.md`](../../../../agents/conventions.md).\n\n#### Basic Media Region with `mds-img`\n\nPlace `<mds-card-media>` as a direct child of `<mds-card>`. No `slot` attribute is needed - the component self-assigns into the card's `media` region. Put the visual asset in the default slot; `mds-img` is the recommended choice.\n\n```html\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/copertina.jpg\" alt=\"Copertina articolo\"></mds-img>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Media with an Overlay Caption via the `content` Slot\n\nUse the named `content` slot for text or controls that should float in front of the media asset. The overlay is absolutely positioned over the media, bottom-aligned and horizontally centered.\n\n```html\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/evento.jpg\" alt=\"Evento annuale\"></mds-img>\n    <mds-text slot=\"content\" typography=\"label\">12 giugno 2026</mds-text>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Media with an Overlay Action Control\n\nThe `content` slot accepts any element or component. Use it to place a badge, chip, or button on top of the media when the design calls for an interactive overlay.\n\n```html\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/prodotto.jpg\" alt=\"Scheda prodotto\"></mds-img>\n    <mds-badge slot=\"content\" label=\"Novita'\" variant=\"info\" tone=\"strong\"></mds-badge>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Card with All Regions Composed Together\n\n`<mds-card-media>` composes alongside `mds-card-header`, `mds-card-content`, and `mds-card-footer` inside `mds-card`. Each region self-assigns its slot; the card drives the responsive layout automatically unless `disable-auto-grid` is set.\n\n```html\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/notizia.jpg\" alt=\"Immagine della notizia\"></mds-img>\n  </mds-card-media>\n  <mds-card-header>\n    <mds-text typography=\"h6\">Titolo della notizia</mds-text>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Descrizione breve della notizia.</mds-text>\n  </mds-card-content>\n  <mds-card-footer>\n    <mds-button label=\"Leggi di piu'\" variant=\"primary\" tone=\"text\"></mds-button>\n  </mds-card-footer>\n</mds-card>\n```\n\n#### Video in the Default Slot\n\nThe default slot accepts any media element or component. Use a native `<video>` when the design calls for motion content rather than a still image.\n\n```html\n<mds-card>\n  <mds-card-media>\n    <video src=\"/media/presentazione.mp4\" autoplay muted loop playsinline></video>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Styling the Overlay Part via `::part(content)`\n\nThe `content` overlay div is exposed as the `content` shadow part. Use it for layout adjustments that the host's positioning rules do not cover - for example, changing alignment or adding a gradient scrim. Set the style on the host or a parent selector; do not pierce shadow DOM with `>>>` or undocumented class names.\n\n```css\n.card-destacada mds-card-media::part(content) {\n  align-items: flex-start;\n  background: linear-gradient(to top, rgb(var(--magma-backdrop-color) / 0.7), transparent);\n  padding: calc(var(--spacing) * 600);\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-card-media>`. Each entry pairs the wrong form with the right one and a one-line reason. System-wide rules (boolean-as-string, shadow piercing, Tailwind color utilities, raw native event listening) live in [`agents/mistakes.md`](../../../../agents/mistakes.md) - they apply here too but are not repeated.\n\n#### Do Not Use `<mds-card-media>` Outside `<mds-card>`\n\n`<mds-card-media>` is a compound child designed to live inside `<mds-card>`. Using it standalone produces unstyled output and breaks the card layout algorithm, which derives its responsive grid from the presence of its region children.\n\n```html\n<!-- INCORRECT -->\n<mds-card-media>\n  <mds-img src=\"/img/foto.jpg\" alt=\"Foto\"></mds-img>\n</mds-card-media>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/foto.jpg\" alt=\"Foto\"></mds-img>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Do Not Set `slot=\"media\"` Manually\n\n`<mds-card-media>` self-assigns into the card's `media` region via its internal `Host slot=\"media\"`. Adding `slot=\"media\"` on the element is redundant and signals a misunderstanding of the component's self-slotting contract.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-media slot=\"media\">\n    <mds-img src=\"/img/copertina.jpg\" alt=\"Copertina\"></mds-img>\n  </mds-card-media>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/copertina.jpg\" alt=\"Copertina\"></mds-img>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Do Not Put the Overlay Text in the Default Slot\n\nText or controls that should appear in front of the media must go in the `content` named slot. Content placed in the default slot is stacked below the media asset (the host is a grid), not overlaid on it.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/foto.jpg\" alt=\"Foto\"></mds-img>\n    <mds-text>Didascalia</mds-text>\n  </mds-card-media>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/foto.jpg\" alt=\"Foto\"></mds-img>\n    <mds-text slot=\"content\">Didascalia</mds-text>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Do Not Place `<mds-card-media>` Inside a Wrapper Element\n\n`mds-card` reads its direct children to compute the layout grid and has no default slot. Wrapping `<mds-card-media>` in a `<div>` or any other element without a `slot` hides it from that detection pass and leaves it out of every region: it is not rendered at all.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <div class=\"media-wrapper\">\n    <mds-card-media>\n      <mds-img src=\"/img/foto.jpg\" alt=\"Foto\"></mds-img>\n    </mds-card-media>\n  </div>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/foto.jpg\" alt=\"Foto\"></mds-img>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Do Not Use a Raw `<img>` Instead of `<mds-img>`\n\nPlacing a raw `<img>` in the default slot works visually but bypasses the lazy loading, error state, consumption-preference handling, and accessible-name fallback that `mds-img` provides.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-media>\n    <img src=\"/img/prodotto.jpg\" alt=\"Prodotto\">\n  </mds-card-media>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/img/prodotto.jpg\" alt=\"Prodotto\"></mds-img>\n  </mds-card-media>\n</mds-card>\n```\n\n#### Do Not Pierce Shadow DOM to Style the Overlay Container\n\nThe `content` div inside the shadow root is exposed as the `content` shadow part. Use `::part(content)` for style overrides, not `>>>`, `/deep/`, or internal class selectors - the latter couple your code to the implementation and break on minor releases.\n\n```css\n/* INCORRECT */\nmds-card-media >>> .content {\n  align-items: flex-start;\n}\n\n/* CORRECT */\nmds-card-media::part(content) {\n  align-items: flex-start;\n}\n```\n"
      },
      "props": [],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [],
      "slots": [
        {
          "name": "",
          "docs": "Add `HTML elements` or `components` to this slot, it is **recommended** to add `mds-img` element or other component which represents media contents."
        },
        {
          "name": "content",
          "docs": "Add `text string`, `HTML elements` or `components` to this slot, contents will be shown in front of the media element."
        }
      ],
      "parts": [
        {
          "name": "content",
          "docs": "The layer in front of the media that holds the `content` slot"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "layout-card-media--docs"
    }
  ]
}
