{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "reveal-on-scroll",
  "type": "registry:item",
  "title": "Reveal On Scroll",
  "description": "Content that animates into place the first time it scrolls into view: fade, rise, blur, scale or slide (`effect`), each child after the last with `stagger`. Without JavaScript, or for visitors who asked for less motion, it's simply there; `again` replays it each time.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "motion"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/reveal-on-scroll.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/reveal-on-scroll.js",
      "content": "// Generated by zubra from reveal-on-scroll.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { onMount } from '@zubra/runtime';\nimport { state as __zubraState, computed as __zubraComputed } from \"@zubra/runtime\";\n\nexport const tag = \"reveal-on-scroll\";\n\nexport default $define(tag, {\n  props: {\n    \"effect\": { attribute: \"effect\", default: \"fade-up\", required: false },\n    \"stagger\": { attribute: \"stagger\", default: 0, required: false },\n    \"threshold\": { attribute: \"threshold\", default: 0.2, required: false },\n    \"again\": { attribute: \"again\", default: false, required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [\"default\"],\n  events: [],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (reveal-on-scroll) to ([data-zb-slotted=\\\"reveal-on-scroll\\\"]) {\\n  :scope { display: block; }\\n  .reveal-waiting { opacity: 0; }\\n}\\n}\\n\",\n  template: \"\\n  <div class=\\\"reveal-frame\\\">\\n    <div class=\\\"reveal-content\\\"><!--[--><!--]--></div>\\n  </div>\\n\",\n  setup($p, $emit) {\nfunction __zubraAssign(signal, value) { signal.set(value); return value }\nfunction __zubraUpdate(signal, delta, prefix) { const old = signal.get(); signal.set(old + delta); return prefix ? old + delta : old }\n                                                                                                           \n                                          \n\n  const frame = __zubraState(null)\n  const EFFECTS = {\n    \"fade\": { opacity: 0 },\n    \"fade-up\": { opacity: 0, translate: \"0 1.25rem\" },\n    \"fade-down\": { opacity: 0, translate: \"0 -1.25rem\" },\n    \"blur\": { opacity: 0, filter: \"blur(10px)\" },\n    \"scale\": { opacity: 0, scale: \"0.94\" },\n    \"slide-left\": { opacity: 0, translate: \"2rem 0\" },\n    \"slide-right\": { opacity: 0, translate: \"-2rem 0\" },\n  }\n\n  onMount(() => {\n    const reduced = globalThis.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches\n    if (reduced || !(\"IntersectionObserver\" in globalThis)) return\n    const style = getComputedStyle(frame.get())\n    const ms = (name, fallback) => {\n      const time = /^\\s*([\\d.]+)(ms|s)\\s*$/.exec(style.getPropertyValue(name))\n      return time ? Number(time[1]) * (time[2] === \"s\" ? 1000 : 1) : fallback\n    }\n    const targets = () => ($p.stagger > 0 ? [...frame.get().querySelectorAll(\":scope > .reveal-content > *\")] : [frame.get()])\n    const hide = () => frame.get().classList.add(\"reveal-waiting\")\n    hide()\n    const watcher = new IntersectionObserver((entries) => {\n      for (const entry of entries) {\n        if (entry.isIntersecting) {\n          frame.get().classList.remove(\"reveal-waiting\")\n          targets().forEach((target, index) => target.animate([EFFECTS[$p.effect] ?? EFFECTS[\"fade-up\"], {}], {\n            duration: ms(\"--duration-slower\", 700),\n            delay: index * $p.stagger,\n            easing: style.getPropertyValue(\"--ease-out\").trim() || \"ease-out\",\n            fill: \"backwards\",\n          }))\n          if (!$p.again) watcher.disconnect()\n        } else if ($p.again) {\n          for (const target of targets()) target.getAnimations().forEach((animation) => animation.cancel())\n          hide()\n        }\n      }\n    }, { threshold: Math.min(1, Math.max(0, $p.threshold)) })\n    watcher.observe(frame.get())\n    return () => watcher.disconnect()\n  })\n    return [\n      { path: [0], ref: () => (($el) => (__zubraAssign(frame, $el))) },\n      { path: [0, 0, 0], slot: \"default\", fallback: null },\n    ];\n  },\n});\n"
    }
  ]
}
