{
  "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-url-view/mds-url-view.tsx",
      "encapsulation": "shadow",
      "tag": "mds-url-view",
      "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": "category",
          "text": "content"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-url-view>` web component renders an embedded preview of an external web page inside a framed browser-like window, wrapping a native `<iframe>` with a titled header, an identifying icon, and a dismiss control. It is the Magma way to surface remote content (typically inside a `mds-modal`) without hand-building chrome around the raw iframe.\n\n#### Semantic Behavior\n\n- **Iframe preview**: The required `src` is loaded into an internal `<iframe>`; the component is purely a presentational frame and does not proxy or sandbox the embedded document beyond the browser defaults.\n- **Domain labelling**: When no explicit `label` is provided, the header title falls back to the page's hostname (with a leading `www.` stripped), derived from `src`.\n- **Close action**: The header dismiss button emits the `mdsUrlViewClose` event and, when the component is nested inside a `mds-modal`, automatically closes that ancestor modal.\n- **Keyboard activation**: The close control can be triggered by keyboard the same way as a pointer click.\n- **Localization**: Header tooltip and ARIA strings are resolved in the active language (el / en / es / it).\n\n#### Properties & Visual Configurations\n\n- **`src`** is the only required prop and drives everything else - the iframe source, the fallback header title, and the ARIA descriptions.\n- **`label`** overrides the auto-derived hostname shown in the header when a friendlier title is wanted.\n- **`icon`** is an SVG filename slug from the Magma icon library shown at the left of the header; it defaults to a generic \"explore\" glyph when omitted.\n- **`loading`** controls iframe fetch timing: `'lazy'` (the default) defers loading until the frame approaches the viewport, while `'eager'` requests the content immediately.\n\nThis component does not expose the shared `variant` / `tone` ladders ([`agents/variants.md`](../../../../agents/variants.md)) on its own host; those props are applied internally to the child `mds-button` close control.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-url-view>` 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#### Minimal Embed Inside a Modal\n\nThe most common use: pass only the required `src` and place the component in the `window` slot of [`mds-modal`](../mds-modal/AGENTS.md). The header title falls back to the hostname extracted from `src`.\n\n```html\n<mds-modal id=\"modal-anteprima\" position=\"center\" opened>\n  <mds-url-view\n    slot=\"window\"\n    class=\"max-w-screen-tablet w-full\"\n    src=\"https://www.comune.bologna.it/\"\n  ></mds-url-view>\n</mds-modal>\n```\n\n#### Custom Header Label\n\nOverride the auto-derived hostname with a human-readable title via `label`. Use this when the URL is not self-describing or when the UI language differs from the domain name.\n\n```html\n<mds-modal id=\"modal-modulo\" position=\"center\" opened>\n  <mds-url-view\n    slot=\"window\"\n    class=\"max-w-screen-tablet w-full\"\n    src=\"https://forms.example.com/richiesta-certificato\"\n    label=\"Modulo di richiesta certificato\"\n  ></mds-url-view>\n</mds-modal>\n```\n\n#### Custom Header Icon\n\nProvide `icon` with an icon slug to replace the default \"explore\" glyph with a context-appropriate symbol.\n\n```html\n<mds-modal id=\"modal-libro\" position=\"center\" opened>\n  <mds-url-view\n    slot=\"window\"\n    class=\"max-w-screen-tablet w-full\"\n    src=\"https://books.example.com/catalogo\"\n    label=\"Catalogo libri\"\n    icon=\"mgg/google-book-large\"\n  ></mds-url-view>\n</mds-modal>\n```\n\n#### Eager Loading\n\nSet `loading=\"eager\"` when the content should start fetching immediately - for example, when the modal is already open on page load and the iframe is immediately visible.\n\n```html\n<mds-modal position=\"center\" opened>\n  <mds-url-view\n    slot=\"window\"\n    src=\"https://dashboard.example.com/\"\n    label=\"Dashboard\"\n    loading=\"eager\"\n  ></mds-url-view>\n</mds-modal>\n```\n\n#### Reacting to the Close Event\n\nListen for `mdsUrlViewClose` to update application state when the user clicks the dismiss control. When the component is inside `mds-modal` the ancestor modal is also closed automatically, but you may still need to sync your own state.\n\n```html\n<mds-modal id=\"modal-url\" position=\"center\" opened>\n  <mds-url-view\n    id=\"url-view\"\n    slot=\"window\"\n    src=\"https://servizi.example.it/portale\"\n    label=\"Portale servizi\"\n  ></mds-url-view>\n</mds-modal>\n\n<script>\n  document.querySelector('#url-view').addEventListener('mdsUrlViewClose', () => {\n    // aggiorna lo stato dell'applicazione\n    appState.urlViewOpen = false;\n  });\n</script>\n```\n\n#### Styling Customization\n\nStyle the component only through its public `--mds-url-view-*` CSS custom properties: the background, the text colour, the radius and the shadow of the container. Set them on the host or on a parent selector; use the semantic color roles via `rgb(var(--magma-<role>))` so dark mode and high-contrast modes keep working.\n\n```css\n.anteprima-documento mds-url-view {\n  --mds-url-view-background: rgb(var(--magma-wash-base));\n  --mds-url-view-color: rgb(var(--magma-text-default));\n  --mds-url-view-radius: var(--magma-radius-lg);\n  --mds-url-view-shadow: var(--shadow-xl);\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-url-view>`. 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 a Raw `<iframe>` When Magma Chrome Is Needed\n\nReaching for a bare `<iframe>` skips the header, dismiss control, accessibility labels, keyboard handling, and modal integration that `<mds-url-view>` provides. Use the component instead.\n\n```html\n<!-- INCORRECT -->\n<mds-modal position=\"center\" opened>\n  <iframe slot=\"window\" src=\"https://servizi.example.it/\" style=\"width:100%;height:80vh;\"></iframe>\n</mds-modal>\n\n<!-- CORRECT -->\n<mds-modal position=\"center\" opened>\n  <mds-url-view\n    slot=\"window\"\n    class=\"max-w-screen-tablet w-full\"\n    src=\"https://servizi.example.it/\"\n    label=\"Portale servizi\"\n  ></mds-url-view>\n</mds-modal>\n```\n\n#### Do Not Omit `src`\n\n`src` is the only required prop. Without it the iframe loads nothing, and the header title and the ARIA labels, derived from `src`, are left empty.\n\n```html\n<!-- INCORRECT -->\n<mds-url-view slot=\"window\"></mds-url-view>\n\n<!-- CORRECT -->\n<mds-url-view slot=\"window\" src=\"https://servizi.example.it/\"></mds-url-view>\n```\n\n#### Do Not Use Outside `mds-modal` Without an Explicit Close Handler\n\n`<mds-url-view>` auto-closes the nearest `mds-modal` ancestor on dismiss. Used outside a modal, the close button fires `mdsUrlViewClose` but nothing hides the component - you must listen for the event and handle visibility yourself.\n\n```html\n<!-- INCORRECT - dismiss button fires but nothing hides the component -->\n<mds-url-view src=\"https://servizi.example.it/\" label=\"Portale\"></mds-url-view>\n\n<!-- CORRECT - listen and hide manually when used standalone -->\n<div id=\"url-wrapper\">\n  <mds-url-view id=\"url-view\" src=\"https://servizi.example.it/\" label=\"Portale\"></mds-url-view>\n</div>\n<script>\n  document.querySelector('#url-view').addEventListener('mdsUrlViewClose', () => {\n    document.querySelector('#url-wrapper').hidden = true;\n  });\n</script>\n```\n\n#### Do Not Pierce the Shadow DOM to Style Internals\n\nThe supported customization surface is the four public `--mds-url-view-*` CSS custom properties. Targeting shadow internals via `::part()` on undocumented parts, `>>>`, or class-name hacks couples your code to the implementation and will break on minor releases.\n\n```css\n/* INCORRECT */\nmds-url-view >>> .header {\n  background: navy;\n}\nmds-url-view >>> .iframe {\n  border: 2px solid red;\n}\n\n/* CORRECT */\nmds-url-view {\n  --mds-url-view-background: rgb(var(--magma-accent-surface));\n  --mds-url-view-color: rgb(var(--magma-accent-fg));\n}\n```\n\n#### Do Not Pass a Relative URL to `src`\n\nThe component calls `new URL(src)` to extract the hostname for the fallback title and ARIA labels. A relative path has no hostname, so the header and the ARIA labels show the raw path instead of the domain. Always pass an absolute URL.\n\n```html\n<!-- INCORRECT -->\n<mds-url-view slot=\"window\" src=\"/portale/servizi\"></mds-url-view>\n\n<!-- CORRECT -->\n<mds-url-view slot=\"window\" src=\"https://servizi.example.it/portale\"></mds-url-view>\n```\n\n#### Do Not Use `loading=\"false\"` to Disable Lazy Loading\n\n`loading` accepts the string values `\"lazy\"` and `\"eager\"`, not booleans. `loading=\"false\"` is outside the type and is passed to the iframe as is: it loads eagerly only because the browser treats any unknown value as `eager`. Write the value you mean.\n\n```html\n<!-- INCORRECT -->\n<mds-url-view slot=\"window\" src=\"https://example.com/\" loading=\"false\"></mds-url-view>\n\n<!-- CORRECT -->\n<mds-url-view slot=\"window\" src=\"https://example.com/\" loading=\"eager\"></mds-url-view>\n```\n"
      },
      "props": [
        {
          "name": "icon",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "icon",
          "reflectToAttr": true,
          "docs": "Specifies the icon shown in the header, before the label or the domain; without it the\nheader shows the explore icon",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "label",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "label",
          "reflectToAttr": true,
          "docs": "Specifies if the window has a label",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "loading",
          "type": "\"eager\" | \"lazy\" | undefined",
          "complexType": {
            "original": "LoadingType",
            "resolved": "\"eager\" | \"lazy\" | undefined",
            "references": {
              "LoadingType": {
                "location": "import",
                "path": "@type/loading",
                "id": "src/type/loading.ts::LoadingType",
                "referenceLocation": "LoadingType"
              }
            }
          },
          "mutable": false,
          "attr": "loading",
          "reflectToAttr": true,
          "docs": "Specifies whether a browser should load an iframe immediately\nor to defer loading of images until some conditions are met.",
          "docsTags": [
            {
              "name": "default",
              "text": "'lazy'"
            }
          ],
          "default": "'lazy'",
          "values": [
            {
              "value": "eager",
              "type": "string"
            },
            {
              "value": "lazy",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "src",
          "type": "string",
          "complexType": {
            "original": "string",
            "resolved": "string",
            "references": {}
          },
          "mutable": false,
          "attr": "src",
          "reflectToAttr": true,
          "docs": "Specifies the URL to the web page",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            }
          ],
          "optional": false,
          "required": true,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [
        {
          "event": "mdsUrlViewClose",
          "detail": "void",
          "bubbles": true,
          "complexType": {
            "original": "void",
            "resolved": "void",
            "references": {}
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the close button is clicked",
          "docsTags": []
        }
      ],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-url-view-background",
          "annotation": "prop",
          "docs": "Background color of the URL view container.",
          "visibility": "public"
        },
        {
          "name": "--mds-url-view-color",
          "annotation": "prop",
          "docs": "Text color used inside the URL view.",
          "visibility": "public"
        },
        {
          "name": "--mds-url-view-header-shadow",
          "annotation": "prop",
          "docs": "Box-shadow applied to the header area of the URL view.",
          "visibility": "internal"
        },
        {
          "name": "--mds-url-view-radius",
          "annotation": "prop",
          "docs": "Border-radius applied to the URL view container.",
          "visibility": "public"
        },
        {
          "name": "--mds-url-view-shadow",
          "annotation": "prop",
          "docs": "Box-shadow applied to the entire URL view container.",
          "visibility": "public"
        }
      ],
      "slots": [],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-icon",
        "mds-text",
        "mds-button"
      ],
      "dependencyGraph": {
        "mds-url-view": [
          "mds-icon",
          "mds-text",
          "mds-button"
        ],
        "mds-button": [
          "mds-icon",
          "mds-spinner",
          "mds-text"
        ]
      },
      "storybook": "ui-url-view--docs"
    }
  ]
}
