{
  "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-keyboard/mds-keyboard.tsx",
      "encapsulation": "shadow",
      "tag": "mds-keyboard",
      "docs": "",
      "docsTags": [
        {
          "name": "slot",
          "text": "- Add `mds-keyboard-key` elements or `components` to this slot."
        },
        {
          "name": "category",
          "text": "tags"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-keyboard>` web component renders a keyboard shortcut as a row of physical-looking keycaps, acting as the compound parent for one or more slotted `<mds-keyboard-key>` children. It has no direct HTML equivalent; it visualizes a key combination (e.g. `Ctrl + C`) and can optionally let the user verify that combination by typing it.\n\n#### Semantic Behavior\n\n- **Default slot is the key sequence**: The component projects slotted `<mds-keyboard-key>` elements and automatically inserts a `+` separator between consecutive keys.\n- **Compound parent**: It reads each child key's `name` to build the expected combination; during a test the children are toggled to their `pressed` state.\n- **Test mode (`try`)**: When enabled the component appends a trigger button and a tooltip; clicking the button (or pressing Enter or Space on it) captures keystrokes and, at the first release of a key pressed during the test, compares the typed combination against the slotted keys, in any order. The release of the key that started the test is not part of it.\n- **Result feedback**: A pass shows a \"done\" icon, a fail shows a \"close\" icon, and the tooltip surfaces the localized success or error message; the outcome is also reflected on the host via the `test` attribute.\n- **Localization**: Trigger label, tooltip copy, and error messages resolve through the locale system (el/en/es/it).\n\n#### Properties & Visual Configurations\n\nThis component does not use the shared `variant` / `tone` ladders from [`agents/variants.md`](../../../../agents/variants.md).\n\n#### Other behavioral props\n\n- **`try`** opts the keyboard into interactive verification mode. Enable it only when you want the user to be able to confirm a shortcut by typing it; leave it unset for a purely presentational shortcut display.\n- **`test`** reflects the verification outcome (`'pass'` / `'fail'`) onto the host. It is primarily driven by the test flow and is mainly useful as a styling/state hook rather than a value you set yourself.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-keyboard>` 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#### Single Key Display\n\nThe simplest use: one `<mds-keyboard-key>` child inside `<mds-keyboard>`. The `name` attribute selects a key from the built-in key dictionary; the component renders the physical-looking keycap with the key's alias (e.g. `F1`, `Ctrl`).\n\n```html\n<mds-keyboard>\n  <mds-keyboard-key name=\"f1\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Multi-Key Shortcut Combination\n\nSlot two or more `<mds-keyboard-key>` elements. The component automatically inserts a `+` separator between consecutive keys, so you never need to add it manually.\n\n```html\n<mds-keyboard>\n  <mds-keyboard-key name=\"control\"></mds-keyboard-key>\n  <mds-keyboard-key name=\"s\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Specifying Key Side (Left / Right Modifier)\n\nUse the side-specific `name` values (`controlleft`, `controlright`, `shiftleft`, `shiftright`, `commandleft`, `commandright`, etc.) when the shortcut must be typed with a specific hand. The keycap renders a small positional indicator.\n\n```html\n<!-- Only the left Shift key is accepted during a test -->\n<mds-keyboard try>\n  <mds-keyboard-key name=\"shiftleft\"></mds-keyboard-key>\n  <mds-keyboard-key name=\"d\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Interactive Verification Mode (`try`)\n\nAdd the `try` attribute to let the user confirm the shortcut by typing it. A trigger button appears; clicking it puts the component into capture mode. The keys can be pressed in any order, all held down together: at the first key release the component reflects the outcome (`pass` / `fail`) on the `test` attribute and shows a localized tooltip.\n\n```html\n<mds-keyboard try>\n  <mds-keyboard-key name=\"command\"></mds-keyboard-key>\n  <mds-keyboard-key name=\"z\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Shortcut Reference Table\n\nEmbed `<mds-keyboard>` inside a `<mds-table>` to build a keyboard-shortcut reference sheet. Each row pairs the visual shortcut with its description.\n\n```html\n<mds-table>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Combinazione\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Azione\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell>\n        <mds-keyboard>\n          <mds-keyboard-key name=\"control\"></mds-keyboard-key>\n          <mds-keyboard-key name=\"c\"></mds-keyboard-key>\n        </mds-keyboard>\n      </mds-table-cell>\n      <mds-table-cell><mds-text>Copia</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell>\n        <mds-keyboard>\n          <mds-keyboard-key name=\"control\"></mds-keyboard-key>\n          <mds-keyboard-key name=\"v\"></mds-keyboard-key>\n        </mds-keyboard>\n      </mds-table-cell>\n      <mds-table-cell><mds-text>Incolla</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell>\n        <mds-keyboard>\n          <mds-keyboard-key name=\"control\"></mds-keyboard-key>\n          <mds-keyboard-key name=\"z\"></mds-keyboard-key>\n        </mds-keyboard>\n      </mds-table-cell>\n      <mds-table-cell><mds-text>Annulla</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Reading the `test` Outcome Attribute\n\nWhen `try` is set the `test` attribute is reflected onto the host as `\"pass\"` or `\"fail\"` after each attempt. Use it as a CSS attribute selector, or observe the attribute from JavaScript to drive follow-on UI (the component emits no event).\n\n```html\n<mds-keyboard id=\"shortcut-ctrl-s\" try>\n  <mds-keyboard-key name=\"control\"></mds-keyboard-key>\n  <mds-keyboard-key name=\"s\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n```javascript\nconst keyboard = document.querySelector('#shortcut-ctrl-s');\nnew MutationObserver(() => {\n  if (keyboard.getAttribute('test') === 'pass') {\n    console.log('Combinazione corretta!');\n  }\n}).observe(keyboard, { attributes: true, attributeFilter: ['test'] });\n```\n\n#### Styling Customization\n\nAdjust colors and padding only through the public `--mds-keyboard-*` CSS custom properties; the keys take their colours from the theme. Use the semantic color roles via `rgb(var(--magma-<role>))` ([`agents/color.md`](../../../../agents/color.md)) so dark mode continues to work.\n\n```css\n.custom-keyboard mds-keyboard {\n  --mds-keyboard-background: rgb(var(--magma-surface-inverse));\n  --mds-keyboard-color: rgb(var(--magma-on-inverse));\n  --mds-keyboard-padding: calc(var(--spacing) * 300);\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-keyboard>`. 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 Slot Raw Text or `<kbd>` Elements\n\nThe default slot expects `<mds-keyboard-key>` children only. Slotting plain text, `<kbd>`, or other HTML breaks the separator injection logic and the test-mode key matching.\n\n```html\n<!-- INCORRECT -->\n<mds-keyboard>\n  <kbd>Ctrl</kbd>\n  <kbd>S</kbd>\n</mds-keyboard>\n\n<!-- CORRECT -->\n<mds-keyboard>\n  <mds-keyboard-key name=\"control\"></mds-keyboard-key>\n  <mds-keyboard-key name=\"s\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Do Not Add `+` Separators Manually\n\nThe component inserts a styled `+` between consecutive keys automatically. Adding your own separator duplicates it and breaks the visual rhythm.\n\n```html\n<!-- INCORRECT -->\n<mds-keyboard>\n  <mds-keyboard-key name=\"control\"></mds-keyboard-key>\n  <span>+</span>\n  <mds-keyboard-key name=\"c\"></mds-keyboard-key>\n</mds-keyboard>\n\n<!-- CORRECT -->\n<mds-keyboard>\n  <mds-keyboard-key name=\"control\"></mds-keyboard-key>\n  <mds-keyboard-key name=\"c\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Do Not Set `try=\"false\"` to Disable Test Mode\n\n`try` is a boolean attribute: remove it (or leave it unset) to keep the component in display-only mode. A string value is fragile: `\"false\"` is read as `false` on this component, but the attribute stays on the element until the component renders (attribute selectors and scripts reading it see it set). Never write a boolean as a string.\n\n```html\n<!-- INCORRECT -->\n<mds-keyboard try=\"false\">\n  <mds-keyboard-key name=\"escape\"></mds-keyboard-key>\n</mds-keyboard>\n\n<!-- CORRECT -->\n<mds-keyboard>\n  <mds-keyboard-key name=\"escape\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Do Not Set `test` as a Static Attribute to Signal State\n\n`test` is a reflected output prop driven by the component's own verification flow. Setting it as a static HTML attribute paints the pass / fail state without any attempt behind it, and the next attempt overwrites it.\n\n```html\n<!-- INCORRECT -->\n<mds-keyboard test=\"pass\">\n  <mds-keyboard-key name=\"enter\"></mds-keyboard-key>\n</mds-keyboard>\n\n<!-- CORRECT -->\n<mds-keyboard try>\n  <mds-keyboard-key name=\"enter\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Do Not Use `<mds-keyboard-key>` Outside `<mds-keyboard>`\n\n`<mds-keyboard-key>` is a compound child and communicates with the parent via the Stencil DOM tree. Rendering it standalone loses the compound layout, the `+` separator, and test-mode driven `pressed` toggling.\n\n```html\n<!-- INCORRECT -->\n<mds-keyboard-key name=\"tab\"></mds-keyboard-key>\n\n<!-- CORRECT -->\n<mds-keyboard>\n  <mds-keyboard-key name=\"tab\"></mds-keyboard-key>\n</mds-keyboard>\n```\n\n#### Do Not Customize Colors with Raw CSS Values Instead of Tokens\n\nSetting `--mds-keyboard-background` or `--mds-keyboard-color` to a raw hex or `rgba()` literal bypasses the palette layer and breaks dark mode. Always use a semantic color role, `rgb(var(--magma-<role>))` ([`agents/color.md`](../../../../agents/color.md)).\n\n```css\n/* INCORRECT */\nmds-keyboard {\n  --mds-keyboard-background: #1a1a2e;\n  --mds-keyboard-color: #e0e0e0;\n}\n\n/* CORRECT */\nmds-keyboard {\n  --mds-keyboard-background: rgb(var(--magma-surface-inverse));\n  --mds-keyboard-color: rgb(var(--magma-on-inverse));\n}\n```\n"
      },
      "props": [
        {
          "name": "test",
          "type": "\"fail\" | \"pass\" | undefined",
          "complexType": {
            "original": "KeyboardTest",
            "resolved": "\"fail\" | \"pass\" | undefined",
            "references": {
              "KeyboardTest": {
                "location": "import",
                "path": "./meta/type",
                "id": "src/components/mds-keyboard/meta/type.ts::KeyboardTest",
                "referenceLocation": "KeyboardTest"
              }
            }
          },
          "mutable": true,
          "attr": "test",
          "reflectToAttr": true,
          "docs": "Shows the keyboard key combination test result",
          "docsTags": [],
          "values": [
            {
              "value": "fail",
              "type": "string"
            },
            {
              "value": "pass",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "try",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "try",
          "reflectToAttr": true,
          "docs": "Sets if the keyboard key combination test is enabled",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-keyboard-background",
          "annotation": "prop",
          "docs": "Set the background color of the keyboard area.",
          "visibility": "public"
        },
        {
          "name": "--mds-keyboard-background-default",
          "annotation": "prop",
          "docs": "`private` Set the default background color of the keyboard area.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-background-fail",
          "annotation": "prop",
          "docs": "Set the background color of the keyboard area when the test fails.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-background-pass",
          "annotation": "prop",
          "docs": "Set the background color of the keyboard area when the test passes.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-color",
          "annotation": "prop",
          "docs": "Set the text color of the keyboard area, will impact on `mds-keyboard-key` component.",
          "visibility": "public"
        },
        {
          "name": "--mds-keyboard-fill-fail",
          "annotation": "prop",
          "docs": "Set the fill color of the combination-checker button when the test fails.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-fill-pass",
          "annotation": "prop",
          "docs": "Set the fill color of the combination-checker button when the test passes.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-illumination-dark",
          "annotation": "prop",
          "docs": "Set the dark illumination.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-illumination-dark-opacity",
          "annotation": "prop",
          "docs": "Set the opacity of the dark illumination.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-illumination-dark-size",
          "annotation": "prop",
          "docs": "Set the size of the dark illumination.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-illumination-light",
          "annotation": "prop",
          "docs": "Set the light illumination.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-illumination-light-opacity",
          "annotation": "prop",
          "docs": "Set the opacity of the light illumination.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-illumination-light-size",
          "annotation": "prop",
          "docs": "Set the size of the light illumination.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-illumination-shadow",
          "annotation": "prop",
          "docs": "Set the shadow of the keyboard area.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-key-background",
          "annotation": "prop",
          "docs": "Set the background color of the keyboard key.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-key-illumination-dark-opacity",
          "annotation": "prop",
          "docs": "Set the opacity of the dark illumination of the keyboard key.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-key-illumination-light-opacity",
          "annotation": "prop",
          "docs": "Set the opacity of the light illumination of the keyboard key.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-key-illumination-shadow",
          "annotation": "prop",
          "docs": "Set the shadow of the keyboard key.",
          "visibility": "internal"
        },
        {
          "name": "--mds-keyboard-padding",
          "annotation": "prop",
          "docs": "Set the padding of the keyboard area.",
          "visibility": "public"
        },
        {
          "name": "--mds-keyboard-spinner-duration",
          "annotation": "prop",
          "docs": "Set the duration of the spinner animation.",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Add `mds-keyboard-key` elements or `components` to this slot."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-text",
        "mds-button",
        "mds-tooltip"
      ],
      "dependencyGraph": {
        "mds-keyboard": [
          "mds-text",
          "mds-button",
          "mds-tooltip"
        ],
        "mds-button": [
          "mds-icon",
          "mds-spinner",
          "mds-text"
        ],
        "mds-tooltip": [
          "mds-text"
        ]
      },
      "storybook": "ui-keyboard--docs"
    }
  ]
}
