{
  "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-pref-animation/mds-pref-animation.tsx",
      "encapsulation": "shadow",
      "tag": "mds-pref-animation",
      "docs": "",
      "docsTags": [
        {
          "name": "category",
          "text": "preferences"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-pref-animation>` web component is a preference control that lets users choose how animations are presented (reduced, system-driven, or fully enabled). It is usually a child of [`<mds-pref>`](../mds-pref/AGENTS.md) and renders a labelled three-option tab group rather than any native HTML primitive.\n\n#### Semantic Behavior\n\n- **Usually inside `<mds-pref>`**: Placed as a direct default-slot child of `<mds-pref>`, which groups the preference controls in one panel; it also works on its own, since it applies and stores the preference by itself.\n- **Tab-group selection**: Renders three options (reduce / system / no-preference); the active one is driven by the `mode` value, and clicking an option sets that mode.\n- **Applies the preference globally**: Choosing a mode applies it across the whole document and persists the choice, so it is restored on later visits.\n- **Initial mode resolution**: The effective mode is resolved in order from the `mode` prop, then the persisted value, then the `system` default.\n- **Change event**: `mdsPrefChange` (detail `{ preference: 'animation' }`) fires once per change, after the new mode is applied; a pick of the mode already active and the first application on load do not emit it. It bubbles up to `<mds-pref>`; an animation change needs no reload, so it raises no reload notice.\n- **Instances stay in sync**: Instances mounted together (a hidden `<mds-pref controller>` and a visible settings panel) share the applied animation: a pick in one is mirrored by the others, which neither apply it again nor emit `mdsPrefChange`. A `pref-animation-*` class written on `<html>` by other code is mirrored the same way.\n\n#### Properties & Visual Configurations\n\n- **`mode`**: Sets which animation preference is active - `reduce` to suppress motion, `no-preference` to fully enable animations, or `system` to defer to the user's OS setting. Leave unset to fall back to the persisted or default (`system`) value.\n- **`size`**: Sizes the nested tab items (`sm` or `md`). Inside `<mds-pref>`, set it on the parent instead: the parent's `size` reaches every `mds-pref-*` child on load and when it changes, and overwrites the child's own.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-pref-animation>` 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#### Default Usage Inside `mds-pref`\n\nThe standard form. Place `<mds-pref-animation>` as a direct slot child of [`<mds-pref>`](../mds-pref/AGENTS.md). No `mode` or `size` is required - the component restores the last persisted choice and defaults to `system` on a first visit.\n\n```html\n<mds-pref>\n  <mds-pref-animation></mds-pref-animation>\n</mds-pref>\n```\n\n#### Combined Preferences Panel\n\nPlace multiple `mds-pref-*` children inside the same `<mds-pref>`. The parent forwards its `size` to every child, on load and when it changes.\n\n```html\n<mds-pref>\n  <mds-pref-animation></mds-pref-animation>\n  <mds-pref-contrast></mds-pref-contrast>\n  <mds-pref-mode></mds-pref-mode>\n  <mds-pref-consumption></mds-pref-consumption>\n</mds-pref>\n```\n\n#### Pre-selecting a Mode via `mode`\n\nPass `mode` to override the persisted value and start from a known state - for example, a first-run onboarding screen that starts with reduced motion.\n\n```html\n<mds-pref>\n  <mds-pref-animation mode=\"reduce\"></mds-pref-animation>\n</mds-pref>\n```\n\n#### Listening for Changes\n\nHandle `mdsPrefChange` when the host application needs to react - for example, to announce the new setting or trigger a soft refresh. The event fires once per change, after the new mode is applied, and not on page load: to know the mode a page starts with, read the `mode` property.\n\n```html\n<mds-pref id=\"prefs\">\n  <mds-pref-animation></mds-pref-animation>\n</mds-pref>\n\n<script>\n  document.getElementById('prefs').addEventListener('mdsPrefChange', (event) => {\n    // event.detail.preference === 'animation'\n    console.log('Preferenza animazioni aggiornata', event.detail);\n  });\n</script>\n```\n\n#### Compact Size\n\nSet `size=\"sm\"` on the parent `<mds-pref>` to shrink the tab items of every `mds-pref-*` child consistently: the parent forwards its `size` on load and on every change.\n\n```html\n<!-- In the panel: on the parent only -->\n<mds-pref size=\"sm\">\n  <mds-pref-animation></mds-pref-animation>\n  <mds-pref-contrast></mds-pref-contrast>\n</mds-pref>\n\n<!-- Acceptable when used standalone -->\n<mds-pref-animation size=\"sm\"></mds-pref-animation>\n```\n\n#### Silent Controller (Hidden Preference Sync)\n\nWhen a `<mds-pref controller>` element is placed in the DOM, it applies preferences silently without rendering any UI. `<mds-pref-animation>` inside it restores the persisted animation class on `<html>` on load without showing the tab group.\n\n```html\n<!-- Place once, near the root - no UI is rendered -->\n<mds-pref controller>\n  <mds-pref-animation></mds-pref-animation>\n</mds-pref>\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-pref-animation>`. 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 Turn Off with `mode=\"false\"` or Remove the Attribute to Reset\n\n`mode` is a string union (`reduce | system | no-preference`), not a boolean. A value outside the union, such as `\"false\"` or `\"none\"`, does not disable the component: it has no entry in the component's mode table, so it is ignored with a console warning and never stored, and the component keeps the mode it has. Removing the attribute at runtime keeps the current mode too: it does not reset it. Without `mode`, the component restores the persisted choice or falls back to `system`.\n\n```html\n<!-- INCORRECT - not a valid mode value -->\n<mds-pref-animation mode=\"false\"></mds-pref-animation>\n<mds-pref-animation mode=\"none\"></mds-pref-animation>\n\n<!-- CORRECT - use an explicit valid mode -->\n<mds-pref-animation mode=\"system\"></mds-pref-animation>\n```\n\n#### Do Not Listen to Raw `change` Events\n\n`<mds-pref-animation>` emits `mdsPrefChange`; no native `change` event is fired.\n\n```html\n<!-- INCORRECT -->\n<mds-pref id=\"prefs\">\n  <mds-pref-animation></mds-pref-animation>\n</mds-pref>\n\n<script>\n  document.getElementById('prefs').addEventListener('change', handler);\n</script>\n\n<!-- CORRECT -->\n<script>\n  document.getElementById('prefs').addEventListener('mdsPrefChange', handler);\n</script>\n```\n\n#### Do Not Hand-Roll Animation Preference Handling on `<html>`\n\nThe component already applies `pref-animation-reduce`, `pref-animation-system`, or `pref-animation-no-preference` to `<html>` and persists the choice in `localStorage`. Duplicating this logic conflicts with the component's state and causes double-writes.\n\n```css\n/* INCORRECT - duplicates the component's own logic */\nhtml.custom-reduce-motion * {\n  animation: none !important;\n}\n```\n\n```html\n<!-- CORRECT - rely on the class the component sets -->\n<!-- The component sets pref-animation-reduce on <html>;\n     target that class in your own CSS if needed -->\n```\n\n```css\n/* Extend, do not replace */\nhtml.pref-animation-reduce .my-widget {\n  transition: none;\n}\n```\n"
      },
      "props": [
        {
          "name": "mode",
          "type": "\"no-preference\" | \"reduce\" | \"system\" | undefined",
          "complexType": {
            "original": "AnimationModeType",
            "resolved": "\"no-preference\" | \"reduce\" | \"system\" | undefined",
            "references": {
              "AnimationModeType": {
                "location": "import",
                "path": "./meta/types",
                "id": "src/components/mds-pref-animation/meta/types.ts::AnimationModeType",
                "referenceLocation": "AnimationModeType"
              }
            }
          },
          "mutable": true,
          "attr": "mode",
          "reflectToAttr": true,
          "docs": "Specifies the preference mode",
          "docsTags": [],
          "values": [
            {
              "value": "no-preference",
              "type": "string"
            },
            {
              "value": "reduce",
              "type": "string"
            },
            {
              "value": "system",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "size",
          "type": "\"md\" | \"sm\" | undefined",
          "complexType": {
            "original": "TabSizeType",
            "resolved": "\"md\" | \"sm\" | undefined",
            "references": {
              "TabSizeType": {
                "location": "import",
                "path": "@type/button",
                "id": "src/type/button.ts::TabSizeType",
                "referenceLocation": "TabSizeType"
              }
            }
          },
          "mutable": false,
          "attr": "size",
          "reflectToAttr": true,
          "docs": "Sets the size of the component items nested inside it",
          "docsTags": [],
          "values": [
            {
              "value": "md",
              "type": "string"
            },
            {
              "value": "sm",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [
        {
          "event": "mdsPrefChange",
          "detail": "MdsPrefChangeEventDetail",
          "bubbles": true,
          "complexType": {
            "original": "MdsPrefChangeEventDetail",
            "resolved": "MdsPrefChangeEventDetail",
            "references": {
              "MdsPrefChangeEventDetail": {
                "location": "import",
                "path": "@event/preference",
                "id": "src/event-detail/preference.ts::MdsPrefChangeEventDetail",
                "referenceLocation": "MdsPrefChangeEventDetail"
              }
            }
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the component is triggered",
          "docsTags": []
        }
      ],
      "listeners": [],
      "styles": [],
      "slots": [],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-text",
        "mds-tab",
        "mds-tab-item"
      ],
      "dependencyGraph": {
        "mds-pref-animation": [
          "mds-text",
          "mds-tab",
          "mds-tab-item"
        ],
        "mds-tab-item": [
          "mds-button"
        ],
        "mds-button": [
          "mds-icon",
          "mds-spinner",
          "mds-text"
        ]
      },
      "storybook": "ui-preferences-animation--docs"
    }
  ]
}
