{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "reel-layout",
  "type": "registry:item",
  "title": "Reel Layout",
  "description": "A row that scrolls sideways: cards, photos, episodes. Each child is `item` wide and snaps into place. The row is a labelled region that takes focus, so arrow keys scroll it; `controls` adds previous and next buttons that move one item at a time, and are disabled at either end.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "layout"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/reel-layout.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/reel-layout.js",
      "content": "// Generated by zubra from reel-layout.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 = \"reel-layout\";\n\nexport default $define(tag, {\n  props: {\n    \"item\": { attribute: \"item\", default: \"16rem\", required: false },\n    \"gap\": { attribute: \"gap\", default: \"1rem\", required: false },\n    \"label\": { attribute: \"label\", default: \"Items\", required: false },\n    \"controls\": { attribute: \"controls\", 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 (reel-layout) to ([data-zb-slotted=\\\"reel-layout\\\"]) {\\n  :scope { display: block; }\\n  .reel-wrap { display: grid; gap: 0.5rem; }\\n  .reel-row { display: grid; grid-auto-flow: column; grid-auto-columns: var(--item); gap: var(--gap); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: 0; padding-bottom: 0.5rem; scrollbar-width: thin; scrollbar-color: var(--border, #d4d4d8) transparent; }\\n  \\n  .reel-row:focus-visible { outline: 2px solid var(--ring, #a1a1aa); outline-offset: -2px; border-radius: calc(var(--radius, 0.625rem) * 0.4); }\\n  .reel-controls { display: flex; justify-content: flex-end; gap: 0.4rem; }\\n  .reel-controls button { width: 2.25rem; height: 2.25rem; border: 1px solid var(--border, #e4e4e7); border-radius: 50%; background: var(--background, #fff); color: var(--foreground, #18181b); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; }\\n  .reel-controls button:hover:not(:disabled) { background: var(--accent, #f4f4f5); }\\n  .reel-controls button:disabled { opacity: 0.4; cursor: default; }\\n  .reel-controls button:focus-visible { outline: 2px solid var(--ring, #a1a1aa); outline-offset: 2px; }\\n}\\n@scope (reel-layout) {\\n.reel-row > :where([data-zb-slotted=\\\"reel-layout\\\"]):is(*) { scroll-snap-align: start; }\\n}\\n}\\n\",\n  template: \"\\n  <div class=\\\"reel-wrap\\\">\\n    <!--[--><!--]-->\\n    <div class=\\\"reel-row\\\" role=\\\"region\\\" tabindex=\\\"0\\\"><!--[--><!--]--></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  const reel = __zubraState(null)\n  const atStart = __zubraState(true)\n  const atEnd = __zubraState(false)\n\n  onMount(() => {\n    const update = () => {\n      __zubraAssign(atStart, reel.get().scrollLeft <= 1)\n      __zubraAssign(atEnd, reel.get().scrollLeft + reel.get().clientWidth >= reel.get().scrollWidth - 1)\n    }\n    update()\n    // Children added or removed move the ends.\n    const children = new MutationObserver(update)\n    children.observe(reel.get(), { childList: true })\n    const sizes = new ResizeObserver(update)\n    sizes.observe(reel.get())\n    reel.get().addEventListener('scroll', update, { passive: true })\n    return () => { children.disconnect(); sizes.disconnect(); reel.get().removeEventListener('scroll', update) }\n  })\n\n  function step(direction) {\n    const first = reel.get().children[0]\n    const distance = first ? first.getBoundingClientRect().width + parseFloat(getComputedStyle(reel.get()).columnGap || \"0\") : reel.get().clientWidth\n    reel.get().scrollBy({ left: direction * distance, behavior: matchMedia(\"(prefers-reduced-motion: reduce)\").matches ? \"auto\" : \"smooth\" })\n  }\n    return [\n      { path: [0, 0], when: () => $p.controls, blocks: [{ template: \"<div class=\\\"reel-controls\\\">\\n      <button type=\\\"button\\\" aria-label=\\\"Previous\\\">‹</button>\\n      <button type=\\\"button\\\" aria-label=\\\"Next\\\">›</button>\\n    </div>\", parts: () => [{ path: [0, 0], attribute: \"disabled\", boolean: true, value: () => $r(atStart) }, { path: [0, 0], on: \"click\", handler: () => (() => step(-1)) }, { path: [0, 1], attribute: \"disabled\", boolean: true, value: () => $r(atEnd) }, { path: [0, 1], on: \"click\", handler: () => (() => step(1)) }] }, null] },\n      { path: [0, 1], ref: () => (($el) => (__zubraAssign(reel, $el))) },\n      { path: [0, 1], attribute: \"aria-label\", value: () => $p.label },\n      { path: [0, 1], style: \"--item\", value: () => $p.item },\n      { path: [0, 1], style: \"--gap\", value: () => $p.gap },\n      { path: [0, 1, 0], slot: \"default\", fallback: null },\n    ];\n  },\n});\n"
    }
  ]
}
