{
  "$schema": "https://next.0build.dev/schema/component.v1.json",
  "accessibility": {
    "aria": [],
    "notes": [
      "In nav mode the active link gets `aria-current=\"location\"`; it is removed from all other links."
    ]
  },
  "attributes": [
    {
      "default": "''",
      "description": "Forces a mode: `nav` highlights links whose targets scroll into view, `reveal` animates elements as they enter the viewport. When empty, the mode is inferred from the attributes and markup.",
      "from": null,
      "name": "mode",
      "property": "mode",
      "reflect": false,
      "tokens": null,
      "type": "'' | 'nav' | 'reveal'",
      "values": [
        "",
        "nav",
        "reveal"
      ]
    },
    {
      "default": "false",
      "description": "Shorthand for `mode=\"nav\"`.",
      "from": null,
      "name": "nav",
      "property": "nav",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "''",
      "description": "CSS selector for the elements to watch: the animated targets in reveal mode (default: the host), or the links in nav mode (default: owned `a[href]`).",
      "from": null,
      "name": "target",
      "property": "target",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "''",
      "description": "Animation preset(s) applied to reveal targets as they enter view; its presence also helps infer reveal mode.",
      "from": null,
      "name": "animation",
      "property": "animation",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "false",
      "description": "Keeps reveal targets visible before they enter view instead of hiding them with `opacity: 0`.",
      "from": null,
      "name": "no-hidden",
      "property": "no-hidden",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "'-1px'",
      "description": "IntersectionObserver root margin for reveal mode; the default `-1px` shrinks the viewport by a pixel.",
      "from": null,
      "name": "margin",
      "property": "margin",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "0",
      "description": "IntersectionObserver threshold (0–1) for reveal mode: the fraction of the target that must be visible to trigger.",
      "from": null,
      "name": "threshold",
      "property": "threshold",
      "reflect": false,
      "tokens": null,
      "type": "number",
      "values": null
    },
    {
      "default": "false",
      "description": "Re-runs the reveal animation every time a target re-enters view, instead of revealing once.",
      "from": null,
      "name": "repeat",
      "property": "repeat",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "0",
      "description": "Delay in milliseconds before each target reveals; targets reveal in sequence through a queue.",
      "from": null,
      "name": "delay",
      "property": "delay",
      "reflect": false,
      "tokens": null,
      "type": "number",
      "values": null
    },
    {
      "default": "0",
      "description": "Overrides the reveal animation duration in milliseconds; `0` uses the animation's own duration.",
      "from": null,
      "name": "duration",
      "property": "duration",
      "reflect": false,
      "tokens": null,
      "type": "number",
      "values": null
    },
    {
      "default": "''",
      "description": "CSS selector for the nav item that receives the active class, resolved with `closest()` from each link. `self`/`false` targets the link itself; by default the parent `<li>` is used when present.",
      "from": null,
      "name": "closest",
      "property": "closestSelector",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "'0'",
      "description": "Offset from the viewport top used to decide which nav target is active and where smooth scrolling lands; accepts a length, `%` of the viewport height, a selector, or `selector ± length`.",
      "from": null,
      "name": "offset",
      "property": "offset",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "false",
      "description": "Enables smooth scrolling to a nav target on click and updates the URL hash; falls back to instant scrolling when the user prefers reduced motion.",
      "from": null,
      "name": "scroll",
      "property": "smoothScroll",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "false",
      "description": "Also applies the active class to ancestor `li.z-parent` items that contain the active link.",
      "from": null,
      "name": "active-parent",
      "property": "active-parent",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "''",
      "description": "Adds classes to named parts as `key: classes` pairs; a plain string targets the default part.",
      "from": "Base",
      "name": "cls",
      "property": "cls",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "''",
      "description": "Adds inline styles to named parts as `key: styles` pairs; a plain string targets the default part.",
      "from": "Base",
      "name": "stl",
      "property": "stl",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    }
  ],
  "category": "navigation",
  "children": [],
  "cssClasses": [],
  "cssVars": [],
  "dataHooks": [
    {
      "appliesTo": "descendant",
      "attribute": "data-fn",
      "description": "Marks a deferred `<template>` child whose content is mounted into the container on demand.",
      "from": "Controller",
      "role": "config",
      "values": [
        "template"
      ]
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-scrollspy-class",
      "description": "Per-element override of the reveal animation classes, replacing the `animation` attribute and the `reveal`/`default` parts for that target.",
      "role": "config",
      "values": []
    }
  ],
  "events": [
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires when the active nav target changes. Detail carries `index`, `previousIndex`, `item`, `link`, `target`, and `id`.",
      "detail": {
        "fields": [
          {
            "name": "index",
            "type": "number"
          },
          {
            "name": "previousIndex",
            "type": "number"
          },
          {
            "name": "item",
            "type": "HTMLElement | null"
          },
          {
            "name": "link",
            "type": "HTMLAnchorElement | null"
          },
          {
            "name": "target",
            "type": "HTMLElement | null"
          },
          {
            "name": "id",
            "type": "string | null"
          }
        ],
        "type": "{ index: number; previousIndex: number; item: HTMLElement | null; link: HTMLAnchorElement | null; target: HTMLElement | null; id: string | null }"
      },
      "name": "z-scrollspy:active"
    },
    {
      "bubbles": true,
      "cancelable": true,
      "description": "Fires before smooth-scrolling to a nav target on click; `preventDefault()` cancels the scroll. Detail carries `index`, `item`, `link`, `target`, and `id`.",
      "detail": {
        "fields": [
          {
            "name": "index",
            "type": "number"
          },
          {
            "name": "item",
            "type": "HTMLElement"
          },
          {
            "name": "link",
            "type": "HTMLAnchorElement"
          },
          {
            "name": "target",
            "type": "HTMLElement"
          },
          {
            "name": "id",
            "type": "string"
          }
        ],
        "type": "{ index: number; item: HTMLElement; link: HTMLAnchorElement; target: HTMLElement; id: string }"
      },
      "name": "z-scrollspy:before-scroll"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires alongside `active` on every nav active-state change, with the same detail.",
      "detail": {
        "fields": [
          {
            "name": "index",
            "type": "number"
          },
          {
            "name": "previousIndex",
            "type": "number"
          },
          {
            "name": "item",
            "type": "HTMLElement | null"
          },
          {
            "name": "link",
            "type": "HTMLAnchorElement | null"
          },
          {
            "name": "target",
            "type": "HTMLElement | null"
          },
          {
            "name": "id",
            "type": "string | null"
          }
        ],
        "type": "{ index: number; previousIndex: number; item: HTMLElement | null; link: HTMLAnchorElement | null; target: HTMLElement | null; id: string | null }"
      },
      "name": "z-scrollspy:change"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires when a reveal target enters view. Detail carries `index` and `target`.",
      "detail": {
        "fields": [
          {
            "name": "index",
            "type": "number"
          },
          {
            "name": "target",
            "type": "HTMLElement"
          }
        ],
        "type": "{ index: number; target: HTMLElement }"
      },
      "name": "z-scrollspy:inview"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires when deferred template content is mounted into the container.",
      "detail": {
        "fields": [],
        "type": "Record<string, unknown>"
      },
      "from": "Controller",
      "name": "z-scrollspy:mount"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires when a reveal target leaves view (with `repeat`). Detail carries `index` and `target`.",
      "detail": {
        "fields": [
          {
            "name": "index",
            "type": "number"
          },
          {
            "name": "target",
            "type": "HTMLElement"
          }
        ],
        "type": "{ index: number; target: HTMLElement }"
      },
      "name": "z-scrollspy:outview"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires after a smooth scroll to a nav target is initiated, with the same detail as `before-scroll`.",
      "detail": {
        "fields": [
          {
            "name": "index",
            "type": "number"
          },
          {
            "name": "item",
            "type": "HTMLElement"
          },
          {
            "name": "link",
            "type": "HTMLAnchorElement"
          },
          {
            "name": "target",
            "type": "HTMLElement"
          },
          {
            "name": "id",
            "type": "string"
          }
        ],
        "type": "{ index: number; item: HTMLElement; link: HTMLAnchorElement; target: HTMLElement; id: string }"
      },
      "name": "z-scrollspy:scrolled"
    }
  ],
  "i18n": [],
  "icons": [],
  "id": "scrollspy",
  "inherits": [
    "Controller",
    "Base"
  ],
  "keyboard": [],
  "kind": "controller",
  "methods": [
    {
      "description": "Returns the index of the active nav target, or `-1` in reveal mode or when none is active.",
      "name": "activeIndex",
      "params": [],
      "returns": "number",
      "static": false
    },
    {
      "description": "Returns the reveal targets currently in view; empty in nav mode.",
      "name": "inviewElements",
      "params": [],
      "returns": "HTMLElement[]",
      "static": false
    },
    {
      "description": "Tears down and re-initializes the observers and listeners after the DOM or attributes change.",
      "name": "refresh",
      "params": [],
      "returns": "void",
      "static": false
    }
  ],
  "notes": [
    "With `mode`/`nav` unset, reveal signals (`repeat`, `delay`, `no-hidden`, `animation`, or `z-animation-*` classes) select reveal mode; nav attributes (`closest`, `scroll`, `offset`, `active-parent`), a nav container (`.z-nav`, `.z-tab`, `.z-dotnav`, `.z-thumbnav`, etc.), or owned hash links select nav mode; otherwise reveal.",
    "Reveal targets are hidden with `opacity: 0` until they enter view, unless `no-hidden` is set or the user prefers reduced motion, which reveals instantly.",
    "Nav mode watches the nearest scrollable ancestor of the targets, or the window; the last target becomes active when the scroll reaches the bottom."
  ],
  "parts": {
    "defaultClsTarget": "default",
    "defaultStlTarget": "host-inner",
    "items": [
      {
        "defaultCls": "z-active",
        "description": "Class applied to the active nav item when the `default` part is empty.",
        "foundIn": [
          "$cls"
        ],
        "key": "active",
        "supportsCls": true,
        "supportsStl": false
      },
      {
        "defaultCls": "",
        "description": "Default `cls` target. In nav mode its classes mark the active item (falling back to `active`); in reveal mode it is a fallback source of animation classes.",
        "foundIn": [
          "$cls"
        ],
        "key": "default",
        "supportsCls": true,
        "supportsStl": false
      },
      {
        "defaultCls": "z-scrollspy-inview",
        "description": "Class applied to reveal targets while they are in view.",
        "foundIn": [
          "$cls"
        ],
        "key": "inview",
        "supportsCls": true,
        "supportsStl": false
      },
      {
        "defaultCls": "",
        "description": "Source of animation classes for reveal targets, used when `animation` is empty; per-element `data-scrollspy-class` overrides both.",
        "foundIn": [
          "$cls"
        ],
        "key": "reveal",
        "supportsCls": true,
        "supportsStl": false
      }
    ]
  },
  "recipes": [],
  "related": [
    "sticky"
  ],
  "schemaVersion": 1,
  "sources": {
    "css": [
      "src/css/kit-components/scrollspy.css"
    ],
    "cssSelectors": [
      ".z-scrollspy",
      ".z-scrollspy-*"
    ],
    "ts": "src/js/controllers/components/scrollspy.ts"
  },
  "summary": "Scroll-driven behavior in two modes: nav highlights links whose sections are in view, and reveal animates elements as they enter the viewport.",
  "tag": "z-scrollspy",
  "title": "Scrollspy"
}
