{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "docs-01",
  "title": "Docs page",
  "description": "A docs page in its own frame with a sidebar you can search, sections with their counts, a Copy page split button, installation by command or by hand, callouts, previous and next and an On this page rail that follows the reading; the sidebar becomes a sheet on phones. Pick a package manager and only the words that run the command roll to the new ones.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/breadcrumb.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/copy-button.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/inline-sheet.json",
    "https://ui.ndekocode.dev/r/input.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/motion-word-roll.json",
    "https://ui.ndekocode.dev/r/recipes.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/tabs.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/toggle-group.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/docs/docs-01/index.tsx",
      "content": "'use client';\n\nimport { useCallback, useEffect, useId, useRef, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport {\n  ArrowLeftIcon,\n  ArrowRightIcon,\n  MenuIcon,\n  TriangleAlertIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { FOCUS_RING } from '@/registry/ndeko/lib/recipes';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport {\n  Breadcrumb,\n  BreadcrumbItem,\n  BreadcrumbLink,\n  BreadcrumbList,\n  BreadcrumbPage,\n  BreadcrumbSeparator,\n} from '@/registry/ndeko/ui/breadcrumb';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\nimport { InlineSheet } from '@/registry/ndeko/ui/inline-sheet';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport { CopyPage } from './copy-page';\nimport {\n  CHECK_CODE,\n  CHECK_TEXT,\n  DOCS,\n  HEADINGS,\n  KEY_CODE,\n  KEYS_TEXT,\n  KEYS_WARNING,\n  NEXT,\n  NEXT_STEPS,\n  PAGE,\n  PREVIOUS,\n  REQUIREMENTS,\n  type Manager,\n} from './data';\nimport { DocsNav } from './docs-nav';\nimport { CodeLine, initCommandOf, Install } from './install';\nimport { OnThisPage } from './on-this-page';\nimport { pageTextOf, type TextFormat } from './page-text';\nimport {\n  INITIAL,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  SCRIPT,\n  TOP,\n  type InstallTab,\n} from './session';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\n/** A heading counts as read once it rises above this line of the frame. */\nconst READ_LINE_PX = 96;\n\n/** Where a heading lands after a jump, just under the read line. */\nconst LANDING_PX = 64;\n\nconst COPIED_FOR_MS = 1600;\n\n/** The width of the `@3xl` container step, where the sidebar takes the place of the sheet. */\nconst SIDEBAR_FROM_PX = 768;\n\nconst FIRST_HEADING = HEADINGS[0].id;\n\nconst CARD =\n  'bg-card hairline-ring ring-border dark:bg-foreground/[0.03] rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.04)]';\n\nfunction scrollBehaviorOf(shouldReduceMotion: boolean): ScrollBehavior {\n  if (shouldReduceMotion) {\n    return 'auto';\n  }\n  return 'smooth';\n}\n\nfunction readHeadingOf(frame: HTMLElement) {\n  const frameTop = frame.getBoundingClientRect().top;\n  const headings = frame.querySelectorAll<HTMLElement>('[data-heading]');\n  let active = FIRST_HEADING;\n  for (const heading of headings) {\n    const top = heading.getBoundingClientRect().top - frameTop;\n    const isRead = top <= READ_LINE_PX;\n    const id = heading.dataset.heading;\n    if (isRead && id) {\n      active = id;\n    }\n  }\n  return active;\n}\n\nfunction titleOfHeading(headingId: string) {\n  const heading = HEADINGS.find((candidate) => candidate.id === headingId);\n  return heading?.title ?? '';\n}\n\ntype SectionProps = {\n  headingId: string;\n  headingIdOf: (headingId: string) => string;\n  children: React.ReactNode;\n};\n\nfunction Section({ headingId, headingIdOf, children }: SectionProps) {\n  return (\n    <section className='flex flex-col gap-4'>\n      <h2\n        id={headingIdOf(headingId)}\n        data-heading={headingId}\n        tabIndex={-1}\n        className={cn(\n          'rounded-sm text-xl font-semibold text-balance',\n          FOCUS_RING\n        )}\n      >\n        {titleOfHeading(headingId)}\n      </h2>\n      {children}\n    </section>\n  );\n}\n\nexport default function Docs01() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n    takeOver,\n  } = useSession(SESSION);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const baseId = useId();\n  const frameRef = useRef<HTMLDivElement>(null);\n  const pendingFrame = useRef<number | null>(null);\n  const [activeId, setActiveId] = useState(FIRST_HEADING);\n  const [isSheetOpen, setIsSheetOpen] = useState(false);\n  const message = spokenUnless(isAutoplaying, state.spoken);\n  const canReplay = isFinished && !isAutoplaying;\n\n  const headingIdOf = useCallback(\n    (headingId: string) => `${baseId}-${headingId}`,\n    [baseId]\n  );\n\n  const scrollFrameTo = useCallback(\n    (headingId: string) => {\n      const frame = frameRef.current;\n      const behavior = scrollBehaviorOf(shouldReduceMotion);\n      if (!frame) {\n        return null;\n      }\n      if (headingId === TOP) {\n        frame.scrollTo({ top: 0, behavior });\n        return null;\n      }\n      const selector = `[data-heading=\"${headingId}\"]`;\n      const heading = frame.querySelector<HTMLElement>(selector);\n      if (!heading) {\n        return null;\n      }\n      const headingTop = heading.getBoundingClientRect().top;\n      const frameTop = frame.getBoundingClientRect().top;\n      const top = headingTop - frameTop + frame.scrollTop - LANDING_PX;\n      frame.scrollTo({ top, behavior });\n      return heading;\n    },\n    [shouldReduceMotion]\n  );\n\n  const closeSheet = useCallback(() => {\n    setIsSheetOpen(false);\n    requestAnimationFrame(() => {\n      const trigger = ref.current?.querySelector<HTMLElement>(\n        '[data-sheet-trigger]'\n      );\n      trigger?.focus();\n    });\n  }, [ref]);\n\n  /** The sheet leaves the focus to whoever opened it: a person who did lands on its search. */\n  function openSheet() {\n    setIsSheetOpen(true);\n    requestAnimationFrame(() => {\n      const search = ref.current?.querySelector<HTMLElement>(\n        '[data-sheet-nav] input'\n      );\n      search?.focus();\n    });\n  }\n\n  useEffect(() => {\n    if (state.readRequest === 0) {\n      return;\n    }\n    scrollFrameTo(state.readTo);\n  }, [state.readRequest, state.readTo, scrollFrameTo]);\n\n  /** Once the docs are wide enough for the sidebar, the sheet has nothing left to hold. */\n  useEffect(() => {\n    const root = ref.current;\n    if (!isSheetOpen || !root) {\n      return;\n    }\n    const observer = new ResizeObserver(() => {\n      const isWide = root.clientWidth >= SIDEBAR_FROM_PX;\n      if (isWide) {\n        setIsSheetOpen(false);\n      }\n    });\n    observer.observe(root);\n    return () => observer.disconnect();\n  }, [isSheetOpen, ref]);\n\n  useEffect(() => {\n    if (!state.isCommandCopied) {\n      return;\n    }\n    const timer = setTimeout(() => {\n      act({ type: 'commandReset' });\n    }, COPIED_FOR_MS);\n    return () => clearTimeout(timer);\n  }, [state.isCommandCopied, act]);\n\n  useEffect(() => {\n    if (!state.isPageCopied) {\n      return;\n    }\n    const timer = setTimeout(() => {\n      act({ type: 'pageReset' });\n    }, COPIED_FOR_MS);\n    return () => clearTimeout(timer);\n  }, [state.isPageCopied, act]);\n\n  useEffect(() => {\n    return () => {\n      const frameRequest = pendingFrame.current;\n      if (frameRequest !== null) {\n        cancelAnimationFrame(frameRequest);\n      }\n    };\n  }, []);\n\n  function measureReading() {\n    pendingFrame.current = null;\n    const frame = frameRef.current;\n    if (frame) {\n      const readId = readHeadingOf(frame);\n      setActiveId(readId);\n    }\n  }\n\n  /** The rail follows the scroll at most once a frame. */\n  function followReading() {\n    if (pendingFrame.current !== null) {\n      return;\n    }\n    pendingFrame.current = requestAnimationFrame(measureReading);\n  }\n\n  function yieldToWheel() {\n    if (isAutoplaying) {\n      takeOver();\n    }\n  }\n\n  /** A jump also hands the focus to the heading, so the keyboard reads on from there. */\n  function jumpTo(headingId: string) {\n    const heading = scrollFrameTo(headingId);\n    heading?.focus({ preventScroll: true });\n  }\n\n  async function copyCommand() {\n    try {\n      const command = initCommandOf(state.manager);\n      await navigator.clipboard.writeText(command);\n    } catch {\n      return;\n    }\n    act({ type: 'commandCopied' });\n  }\n\n  async function copyPage(format: TextFormat) {\n    const text = pageTextOf(state.manager, format);\n    try {\n      await navigator.clipboard.writeText(text);\n    } catch {\n      return;\n    }\n    act({ type: 'pageCopied', format });\n  }\n\n  function openInNewTab() {\n    const address = new URL(PAGE.href, window.location.href);\n    window.open(address.href, '_blank', 'noopener,noreferrer');\n  }\n\n  function replay() {\n    frameRef.current?.scrollTo({ top: 0 });\n    restart();\n  }\n\n  const nav = (\n    <DocsNav\n      query={state.navQuery}\n      pressed={pressed}\n      onSearch={(query) => act({ type: 'navSearched', query })}\n    />\n  );\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-background text-foreground @container relative flex h-dvh min-h-[36rem] w-full flex-col overflow-hidden'\n      >\n        <header\n          inert={isSheetOpen}\n          className='hairline-b border-border flex h-14 shrink-0 items-center gap-3 px-4 @2xl:px-6'\n        >\n          <Button\n            type='button'\n            variant='ghost'\n            size='icon'\n            aria-label='Open the docs menu'\n            data-sheet-trigger\n            onClick={openSheet}\n            className='text-muted-foreground -ms-1.5 @3xl:hidden'\n          >\n            <MenuIcon />\n          </Button>\n          <a\n            href={DOCS.homeHref}\n            className={cn(\n              'flex items-center gap-2 rounded-md text-sm font-semibold',\n              FOCUS_RING\n            )}\n          >\n            <CompanyMark seed={DOCS.product} size='lg' />\n            {DOCS.product}\n            <span className='text-muted-foreground font-normal'>Docs</span>\n          </a>\n          <Badge variant='secondary' className='tabular-nums'>\n            {DOCS.version}\n          </Badge>\n          <span className='flex-1' />\n          <ReplayButton isShown={canReplay} onReplay={replay} label='Replay' />\n        </header>\n\n        <div inert={isSheetOpen} className='flex min-h-0 flex-1'>\n          <aside className='hairline-r border-border hidden w-64 shrink-0 overflow-y-auto p-4 @3xl:block'>\n            {nav}\n          </aside>\n\n          <div\n            ref={frameRef}\n            onScroll={followReading}\n            onWheel={yieldToWheel}\n            className='relative min-h-0 flex-1 overflow-y-auto overscroll-contain'\n          >\n            <div className='mx-auto grid max-w-5xl gap-10 px-4 py-8 @2xl:px-8 @5xl:grid-cols-[minmax(0,1fr)_11rem]'>\n              <article className='flex min-w-0 flex-col gap-10'>\n                <header className='flex flex-col gap-4'>\n                  <Breadcrumb>\n                    <BreadcrumbList>\n                      <BreadcrumbItem>\n                        <BreadcrumbLink href={DOCS.homeHref}>\n                          Docs\n                        </BreadcrumbLink>\n                      </BreadcrumbItem>\n                      <BreadcrumbSeparator />\n                      <BreadcrumbItem>\n                        <BreadcrumbLink href={DOCS.sectionHref}>\n                          {PAGE.section}\n                        </BreadcrumbLink>\n                      </BreadcrumbItem>\n                      <BreadcrumbSeparator />\n                      <BreadcrumbItem>\n                        <BreadcrumbPage>{PAGE.title}</BreadcrumbPage>\n                      </BreadcrumbItem>\n                    </BreadcrumbList>\n                  </Breadcrumb>\n                  <div className='flex flex-wrap items-center justify-between gap-3'>\n                    <h1 className='text-2xl font-semibold text-balance @sm:text-3xl'>\n                      {PAGE.title}\n                    </h1>\n                    <CopyPage\n                      isCopied={state.isPageCopied}\n                      onCopy={copyPage}\n                      onOpenInNewTab={openInNewTab}\n                    />\n                  </div>\n                  <p className='text-muted-foreground text-base leading-7 text-pretty'>\n                    {PAGE.lead}\n                  </p>\n                </header>\n\n                <Section headingId='requirements' headingIdOf={headingIdOf}>\n                  <ul className='flex flex-col gap-2 text-[15px] leading-6'>\n                    {REQUIREMENTS.map((line) => (\n                      <li key={line} className='flex items-baseline gap-3'>\n                        <span\n                          aria-hidden='true'\n                          className='bg-foreground/30 size-1.5 shrink-0 translate-y-[-0.15em] rounded-full'\n                        />\n                        {line}\n                      </li>\n                    ))}\n                  </ul>\n                </Section>\n\n                <Section headingId='install' headingIdOf={headingIdOf}>\n                  <Install\n                    manager={state.manager}\n                    tab={state.installTab}\n                    isCommandCopied={state.isCommandCopied}\n                    pressed={pressed}\n                    onPickManager={(manager: Manager) =>\n                      act({ type: 'managerPicked', manager })\n                    }\n                    onPickTab={(tab: InstallTab) =>\n                      act({ type: 'tabPicked', tab })\n                    }\n                    onCopyCommand={copyCommand}\n                  />\n                </Section>\n\n                <Section headingId='keys' headingIdOf={headingIdOf}>\n                  <p className='text-[15px] leading-7 text-pretty'>\n                    {KEYS_TEXT}\n                  </p>\n                  <CodeLine code={KEY_CODE} />\n                  <p className='bg-warning/10 flex items-start gap-3 rounded-xl px-4 py-3 text-[13px] leading-5'>\n                    <TriangleAlertIcon className='text-warning-foreground mt-px size-4 shrink-0' />\n                    <span>{KEYS_WARNING}</span>\n                  </p>\n                </Section>\n\n                <Section headingId='check' headingIdOf={headingIdOf}>\n                  <p className='text-[15px] leading-7 text-pretty'>\n                    {CHECK_TEXT}\n                  </p>\n                  <CodeLine code={CHECK_CODE} />\n                </Section>\n\n                <Section headingId='next' headingIdOf={headingIdOf}>\n                  <ul className='flex flex-col'>\n                    {NEXT_STEPS.map((step) => (\n                      <li key={step.id}>\n                        <a\n                          href={step.href}\n                          className={cn(\n                            'group text-primary-ink inline-flex items-center gap-1.5 rounded-sm py-1 text-[15px] font-medium underline-offset-4 hover:underline',\n                            FOCUS_RING\n                          )}\n                        >\n                          {step.title}\n                          <ArrowRightIcon className='size-4 transition-transform duration-100 group-hover:translate-x-0.5' />\n                        </a>\n                      </li>\n                    ))}\n                  </ul>\n                </Section>\n\n                <nav\n                  aria-label='Previous and next pages'\n                  className='grid gap-3 @lg:grid-cols-2'\n                >\n                  <a\n                    href={PREVIOUS.href}\n                    className={cn(\n                      CARD,\n                      'group hover:bg-foreground/[0.02] flex flex-col gap-1 p-4 transition-colors duration-100',\n                      FOCUS_RING\n                    )}\n                  >\n                    <span className='text-muted-foreground flex items-center gap-1 text-xs'>\n                      <ArrowLeftIcon className='size-3.5 transition-transform duration-100 group-hover:-translate-x-0.5' />\n                      Previous\n                    </span>\n                    <span className='text-sm font-medium'>\n                      {PREVIOUS.title}\n                    </span>\n                  </a>\n                  <a\n                    href={NEXT.href}\n                    className={cn(\n                      CARD,\n                      'group hover:bg-foreground/[0.02] flex flex-col gap-1 p-4 transition-colors duration-100 @lg:items-end @lg:text-end',\n                      FOCUS_RING\n                    )}\n                  >\n                    <span className='text-muted-foreground flex items-center gap-1 text-xs'>\n                      Next\n                      <ArrowRightIcon className='size-3.5 transition-transform duration-100 group-hover:translate-x-0.5' />\n                    </span>\n                    <span className='text-sm font-medium'>{NEXT.title}</span>\n                  </a>\n                </nav>\n              </article>\n\n              <aside className='hidden @5xl:block'>\n                <div className='sticky top-6'>\n                  <OnThisPage\n                    activeId={activeId}\n                    headingIdOf={headingIdOf}\n                    onJump={jumpTo}\n                  />\n                </div>\n              </aside>\n            </div>\n          </div>\n        </div>\n\n        <InlineSheet\n          side='start'\n          isOpen={isSheetOpen}\n          onClose={closeSheet}\n          label='Docs'\n          closeLabel='Close the docs menu'\n          className='z-40 @3xl:hidden'\n          panelClassName='gap-2 overflow-y-auto p-3'\n        >\n          <div data-sheet-nav className='px-1 pb-2'>\n            <DocsNav\n              query={state.navQuery}\n              pressed={pressed}\n              onSearch={(query) => act({ type: 'navSearched', query })}\n              onPick={closeSheet}\n            />\n          </div>\n        </InlineSheet>\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/docs/docs-01/docs-nav.tsx",
      "content": "'use client';\n\nimport { useId, useRef } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { SearchIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { FOCUS_RING } from '@/registry/ndeko/lib/recipes';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Input } from '@/registry/ndeko/ui/input';\n\nimport { DOCS, NAV } from './data';\nimport { itemsMatching, markedPartsOf, wordsOf } from './match';\n\nfunction currentOf(isCurrent: boolean): 'page' | undefined {\n  if (isCurrent) {\n    return 'page';\n  }\n  return undefined;\n}\n\nfunction Marked({ text, words }: { text: string; words: string[] }) {\n  const parts = markedPartsOf(text, words);\n\n  return (\n    <>\n      {parts.map((part) => {\n        if (part.isMatch) {\n          return (\n            <mark\n              key={part.key}\n              className='bg-primary/15 text-foreground rounded-[3px]'\n            >\n              {part.text}\n            </mark>\n          );\n        }\n        return <span key={part.key}>{part.text}</span>;\n      })}\n    </>\n  );\n}\n\ntype DocsNavProps = {\n  query: string;\n  pressed: string | null;\n  onSearch: (query: string) => void;\n  /** Called when a page is picked, so a sheet that holds the list can close. */\n  onPick?: () => void;\n};\n\nexport function DocsNav({ query, pressed, onSearch, onPick }: DocsNavProps) {\n  const inputRef = useRef<HTMLInputElement>(null);\n  const searchId = useId();\n  const baseId = useId();\n  const words = wordsOf(query);\n  const isSearching = words.length > 0;\n  const hasQuery = query !== '';\n  const sections = NAV.map((section) => ({\n    section,\n    items: itemsMatching(section.items, words),\n  }));\n  const shown = sections.filter((entry) => entry.items.length > 0);\n  const isEmpty = isSearching && shown.length === 0;\n\n  function clearOnEscape(event: React.KeyboardEvent<HTMLInputElement>) {\n    const clears = event.key === 'Escape' && hasQuery;\n    if (!clears) {\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    onSearch('');\n  }\n\n  /** The clear control leaves with the search it cleared, so its field takes the focus back. */\n  function clearSearch() {\n    onSearch('');\n    inputRef.current?.focus();\n  }\n\n  /** The empty state leaves with the search too: a keyboard goes back to the field. */\n  function showEveryPage(event: React.MouseEvent<HTMLButtonElement>) {\n    onSearch('');\n    const isFromKeyboard = event.currentTarget.matches(':focus-visible');\n    if (isFromKeyboard) {\n      inputRef.current?.focus();\n    }\n  }\n\n  return (\n    <nav aria-label='Documentation' className='flex flex-col gap-5'>\n      <div className='relative'>\n        <label htmlFor={searchId} className='sr-only'>\n          Search the docs\n        </label>\n        <SearchIcon className='text-muted-foreground pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2' />\n        <Input\n          ref={inputRef}\n          id={searchId}\n          type='search'\n          autoComplete='off'\n          spellCheck={false}\n          placeholder='Search the docs'\n          value={query}\n          onChange={(event) => onSearch(event.target.value)}\n          onKeyDown={clearOnEscape}\n          className='ps-8 pe-8'\n        />\n        {hasQuery && (\n          <Button\n            type='button'\n            variant='ghost'\n            size='icon-sm'\n            aria-label='Clear the search'\n            onClick={clearSearch}\n            className={cn(\n              'text-muted-foreground absolute end-1 top-1/2 size-6 -translate-y-1/2',\n              pressedQuietOf(pressed === 'nav-clear')\n            )}\n          >\n            <XIcon className='size-3.5' />\n          </Button>\n        )}\n      </div>\n\n      {shown.map(({ section, items }) => {\n        const titleId = `${baseId}-${section.id}`;\n        return (\n          <section\n            key={section.id}\n            aria-labelledby={titleId}\n            className='flex flex-col gap-1'\n          >\n            <h3 className='text-muted-foreground flex items-center justify-between gap-2 px-2 text-xs font-medium'>\n              <span id={titleId}>{section.title}</span>\n              <MotionNumber value={items.length} className='tabular-nums' />\n            </h3>\n            <ul className='flex flex-col'>\n              {items.map((item) => {\n                const isCurrent = item.id === DOCS.currentId;\n                return (\n                  <li key={item.id}>\n                    <a\n                      href={item.href}\n                      aria-current={currentOf(isCurrent)}\n                      onClick={onPick}\n                      className={cn(\n                        'text-muted-foreground hover:bg-foreground/[0.04] hover:text-foreground block rounded-md px-2 py-1.5 text-[13px] transition-colors duration-100',\n                        isCurrent && 'bg-foreground/[0.06] text-foreground',\n                        FOCUS_RING\n                      )}\n                    >\n                      <Marked text={item.title} words={words} />\n                    </a>\n                  </li>\n                );\n              })}\n            </ul>\n          </section>\n        );\n      })}\n\n      {isEmpty && (\n        <div className='flex flex-col items-start gap-2 px-2'>\n          <p className='text-muted-foreground text-[13px] text-pretty'>\n            No page title holds “{query.trim()}”.\n          </p>\n          <button\n            type='button'\n            onClick={showEveryPage}\n            className={cn(\n              'text-primary-ink rounded-sm text-xs font-medium underline-offset-4 hover:underline',\n              FOCUS_RING\n            )}\n          >\n            Show every page\n          </button>\n        </div>\n      )}\n    </nav>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/docs-nav.tsx"
    },
    {
      "path": "registry/ndeko/blocks/docs/docs-01/install.tsx",
      "content": "'use client';\n\nimport { WordRoll, type WordRollWord } from '@/components/core/word-roll';\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { CheckIcon, CopyIcon, InfoIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { CopyButton } from '@/registry/ndeko/ui/copy-button';\nimport { Tabs, TabsList, TabsPanel, TabsTab } from '@/registry/ndeko/ui/tabs';\nimport { ToggleGroup, ToggleGroupItem } from '@/registry/ndeko/ui/toggle-group';\n\nimport {\n  ADDER,\n  INIT_ARGS,\n  MANAGERS,\n  MANUAL_STEPS,\n  PACKAGE,\n  RUNNER,\n  type Manager,\n} from './data';\nimport type { InstallTab } from './session';\n\nconst THUMB =\n  'bg-card shadow-[0_1px_2px_rgb(0_0_0/0.08)] hairline-ring ring-foreground/10 dark:bg-foreground/[0.09] dark:ring-foreground/15';\n\nconst CODE_TRAY = 'bg-foreground/[0.04] rounded-lg';\n\n/** The words before the package keep their key while the package manager changes, so only they roll. */\nfunction commandWordsOf(lead: string, rest: string): WordRollWord[] {\n  return [\n    { key: `lead-${lead}`, text: lead, node: lead },\n    { key: 'rest', text: rest, node: rest },\n  ];\n}\n\nexport function initCommandOf(manager: Manager) {\n  return `${RUNNER[manager]} ${INIT_ARGS}`;\n}\n\nexport function addCommandOf(manager: Manager) {\n  return `${ADDER[manager]} ${PACKAGE}`;\n}\n\nfunction copyLabelOf(isCopied: boolean) {\n  if (isCopied) {\n    return 'Copied';\n  }\n  return 'Copy the command';\n}\n\nfunction managerOf(values: unknown[]) {\n  const [value] = values;\n  const option = MANAGERS.find((candidate) => candidate.value === value);\n  return option?.value;\n}\n\nfunction tabOf(value: unknown): InstallTab | null {\n  if (value === 'cli') {\n    return 'cli';\n  }\n  if (value === 'manual') {\n    return 'manual';\n  }\n  return null;\n}\n\nexport function CodeLine({ code }: { code: string }) {\n  return (\n    <div className='relative'>\n      <pre\n        className={cn(\n          CODE_TRAY,\n          'relative overflow-x-auto py-2.5 ps-3 pe-10 font-mono text-[12.5px] leading-relaxed'\n        )}\n      >\n        <code>{code}</code>\n      </pre>\n      <CopyButton\n        text={code}\n        label='Copy the code'\n        className='absolute end-1.5 top-1.5'\n      />\n    </div>\n  );\n}\n\ntype InstallProps = {\n  manager: Manager;\n  tab: InstallTab;\n  isCommandCopied: boolean;\n  pressed: string | null;\n  onPickManager: (manager: Manager) => void;\n  onPickTab: (tab: InstallTab) => void;\n  onCopyCommand: () => void;\n};\n\nexport function Install({\n  manager,\n  tab,\n  isCommandCopied,\n  pressed,\n  onPickManager,\n  onPickTab,\n  onCopyCommand,\n}: InstallProps) {\n  const initWords = commandWordsOf(RUNNER[manager], INIT_ARGS);\n  const addWords = commandWordsOf(ADDER[manager], PACKAGE);\n\n  function pickManager(values: unknown[]) {\n    const picked = managerOf(values);\n    if (picked) {\n      onPickManager(picked);\n    }\n  }\n\n  function pickTab(value: unknown) {\n    const picked = tabOf(value);\n    if (picked) {\n      onPickTab(picked);\n    }\n  }\n\n  return (\n    <Tabs value={tab} onValueChange={pickTab} className='gap-4'>\n      <div className='flex flex-wrap items-center justify-between gap-3'>\n        <TabsList variant='segmented'>\n          <TabsTab\n            value='cli'\n            className={pressedQuietOf(pressed === 'tab-cli')}\n          >\n            Command line\n          </TabsTab>\n          <TabsTab\n            value='manual'\n            className={pressedQuietOf(pressed === 'tab-manual')}\n          >\n            By hand\n          </TabsTab>\n        </TabsList>\n        <ToggleGroup\n          aria-label='Package manager'\n          value={[manager]}\n          onValueChange={pickManager}\n          travel\n          indicatorClassName={THUMB}\n          className='bg-foreground/[0.04] rounded-lg p-0.5'\n        >\n          {MANAGERS.map((option) => (\n            <ToggleGroupItem\n              key={option.value}\n              value={option.value}\n              className={cn(\n                'h-6 rounded-md px-2.5 font-mono text-xs',\n                pressedQuietOf(pressed === `pm-${option.value}`)\n              )}\n            >\n              {option.label}\n            </ToggleGroupItem>\n          ))}\n        </ToggleGroup>\n      </div>\n\n      <TabsPanel value='cli' className='flex flex-col gap-3'>\n        <div\n          className={cn(\n            CODE_TRAY,\n            'relative flex items-center gap-2 py-1.5 ps-3 pe-1.5 font-mono text-[13px]'\n          )}\n        >\n          <span aria-hidden='true' className='text-muted-foreground'>\n            $\n          </span>\n          <code className='relative min-w-0 flex-1 overflow-x-auto py-1 whitespace-nowrap'>\n            <WordRoll words={initWords} />\n          </code>\n          <Button\n            type='button'\n            variant='ghost'\n            size='icon-sm'\n            aria-label={copyLabelOf(isCommandCopied)}\n            onClick={onCopyCommand}\n            className={cn(\n              'text-muted-foreground size-7',\n              pressedQuietOf(pressed === 'copy-command')\n            )}\n          >\n            <Swap swapKey={String(isCommandCopied)}>\n              {isCommandCopied && <CheckIcon className='size-3.5' />}\n              {!isCommandCopied && <CopyIcon className='size-3.5' />}\n            </Swap>\n          </Button>\n        </div>\n        <p className='bg-info/10 flex items-start gap-3 rounded-xl px-4 py-3 text-[13px] leading-5'>\n          <InfoIcon className='text-info-foreground mt-px size-4 shrink-0' />\n          <span>\n            The command adds the package, writes the provider into your app and\n            asks before it changes a file.\n          </span>\n        </p>\n      </TabsPanel>\n\n      <TabsPanel value='manual'>\n        <ol className='flex flex-col gap-5'>\n          {MANUAL_STEPS.map((step, index) => {\n            const isPackageStep = step.id === 'package';\n            return (\n              <li key={step.id} className='flex gap-3'>\n                <span className='keycap-3d text-muted-foreground flex size-6 shrink-0 items-center justify-center rounded-md text-xs font-medium tabular-nums'>\n                  {index + 1}\n                </span>\n                <div className='flex min-w-0 flex-1 flex-col gap-2'>\n                  <p className='pt-0.5 text-[13px] leading-5'>{step.title}</p>\n                  {isPackageStep && (\n                    <div className='relative'>\n                      <div\n                        className={cn(\n                          CODE_TRAY,\n                          'relative overflow-x-auto py-2.5 ps-3 pe-10 font-mono text-[12.5px] whitespace-nowrap'\n                        )}\n                      >\n                        <WordRoll words={addWords} />\n                      </div>\n                      <CopyButton\n                        text={addCommandOf(manager)}\n                        label='Copy the command'\n                        className='absolute end-1.5 top-1.5'\n                      />\n                    </div>\n                  )}\n                  {step.code && <CodeLine code={step.code} />}\n                </div>\n              </li>\n            );\n          })}\n        </ol>\n      </TabsPanel>\n    </Tabs>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/install.tsx"
    },
    {
      "path": "registry/ndeko/blocks/docs/docs-01/copy-page.tsx",
      "content": "'use client';\n\nimport {\n  CheckIcon,\n  ChevronDownIcon,\n  CopyIcon,\n  ExternalLinkIcon,\n  FileTextIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\nimport type { TextFormat } from './page-text';\n\ntype CopyPageProps = {\n  isCopied: boolean;\n  onCopy: (format: TextFormat) => void;\n  onOpenInNewTab: () => void;\n};\n\nexport function CopyPage({ isCopied, onCopy, onOpenInNewTab }: CopyPageProps) {\n  return (\n    <div className='inline-flex shrink-0 items-center'>\n      <Button\n        type='button'\n        variant='outline'\n        size='sm'\n        onClick={() => onCopy('plain')}\n        className='rounded-none rounded-s-full focus-visible:z-10'\n      >\n        <Swap swapKey={String(isCopied)}>\n          {isCopied && <CheckIcon className='size-3.5' />}\n          {!isCopied && <CopyIcon className='size-3.5' />}\n        </Swap>\n        Copy page\n      </Button>\n      <DropdownMenu>\n        <DropdownMenuTrigger\n          render={\n            <Button\n              type='button'\n              variant='outline'\n              size='sm'\n              aria-label='Other ways to use this page'\n              className='-ms-px rounded-none rounded-e-full px-2 focus-visible:z-10'\n            />\n          }\n        >\n          <ChevronDownIcon className='size-3.5' />\n        </DropdownMenuTrigger>\n        <DropdownMenuContent align='end' className='min-w-48'>\n          <DropdownMenuItem onClick={() => onCopy('markdown')}>\n            <FileTextIcon />\n            Copy as Markdown\n          </DropdownMenuItem>\n          <DropdownMenuItem onClick={onOpenInNewTab}>\n            <ExternalLinkIcon />\n            Open in a new tab\n          </DropdownMenuItem>\n        </DropdownMenuContent>\n      </DropdownMenu>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/copy-page.tsx"
    },
    {
      "path": "registry/ndeko/blocks/docs/docs-01/on-this-page.tsx",
      "content": "'use client';\n\nimport { motion, type Transition } from 'motion/react';\nimport { useId } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { INSTANT, SPRING } from '@/registry/ndeko/lib/motion-presets';\nimport { FOCUS_RING } from '@/registry/ndeko/lib/recipes';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport { HEADINGS } from './data';\n\nfunction travelOf(shouldReduceMotion: boolean): Transition {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return SPRING;\n}\n\nfunction currentOf(isActive: boolean): 'location' | undefined {\n  if (isActive) {\n    return 'location';\n  }\n  return undefined;\n}\n\ntype OnThisPageProps = {\n  activeId: string;\n  headingIdOf: (headingId: string) => string;\n  onJump: (headingId: string) => void;\n};\n\nexport function OnThisPage({ activeId, headingIdOf, onJump }: OnThisPageProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const markerId = useId();\n\n  return (\n    <nav aria-label='On this page' className='flex flex-col gap-3'>\n      <p className='text-muted-foreground text-xs font-medium'>On this page</p>\n      <ol className='hairline-l border-border flex flex-col'>\n        {HEADINGS.map((heading) => {\n          const isActive = heading.id === activeId;\n          return (\n            <li key={heading.id} className='relative'>\n              {isActive && (\n                <motion.span\n                  layoutId={markerId}\n                  transition={travelOf(shouldReduceMotion)}\n                  className='bg-primary absolute inset-y-1.5 -start-px w-0.5 rounded-full'\n                />\n              )}\n              <a\n                href={`#${headingIdOf(heading.id)}`}\n                aria-current={currentOf(isActive)}\n                onClick={(event) => {\n                  event.preventDefault();\n                  onJump(heading.id);\n                }}\n                className={cn(\n                  'text-muted-foreground hover:text-foreground block rounded-sm py-1.5 ps-3 text-[13px] transition-colors duration-150',\n                  isActive && 'text-foreground',\n                  FOCUS_RING\n                )}\n              >\n                {heading.title}\n              </a>\n            </li>\n          );\n        })}\n      </ol>\n    </nav>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/on-this-page.tsx"
    },
    {
      "path": "registry/ndeko/blocks/docs/docs-01/page-text.ts",
      "content": "import {\n  ADDER,\n  CHECK_CODE,\n  CHECK_TEXT,\n  INIT_ARGS,\n  KEY_CODE,\n  KEYS_TEXT,\n  KEYS_WARNING,\n  MANUAL_STEPS,\n  NEXT_STEPS,\n  PACKAGE,\n  PAGE,\n  REQUIREMENTS,\n  RUNNER,\n  type Manager,\n} from './data';\n\nexport type TextFormat = 'plain' | 'markdown';\n\nfunction headingOf(text: string, level: number, format: TextFormat) {\n  if (format === 'plain') {\n    return text;\n  }\n  const marks = '#'.repeat(level);\n  return `${marks} ${text}`;\n}\n\nfunction codeOf(code: string, language: string, format: TextFormat) {\n  if (format === 'plain') {\n    return code;\n  }\n  return ['```' + language, code, '```'].join('\\n');\n}\n\nfunction bulletOf(text: string, format: TextFormat) {\n  if (format === 'plain') {\n    return text;\n  }\n  return `- ${text}`;\n}\n\nfunction manualLinesOf(manager: Manager, format: TextFormat) {\n  const lines: string[] = [];\n  MANUAL_STEPS.forEach((step, index) => {\n    lines.push(`${index + 1}. ${step.title}`);\n    if (step.id === 'package') {\n      const command = `${ADDER[manager]} ${PACKAGE}`;\n      lines.push(codeOf(command, 'sh', format));\n    }\n    if (step.code) {\n      lines.push(codeOf(step.code, 'tsx', format));\n    }\n  });\n  return lines;\n}\n\nexport function pageTextOf(manager: Manager, format: TextFormat) {\n  const initCommand = `${RUNNER[manager]} ${INIT_ARGS}`;\n  const requirements = REQUIREMENTS.map((line) => bulletOf(line, format));\n  const nextSteps = NEXT_STEPS.map((step) => bulletOf(step.title, format));\n  const manualLines = manualLinesOf(manager, format);\n  const blocks = [\n    headingOf(PAGE.title, 1, format),\n    PAGE.lead,\n    headingOf('Requirements', 2, format),\n    requirements.join('\\n'),\n    headingOf('Install', 2, format),\n    'With the command line:',\n    codeOf(initCommand, 'sh', format),\n    'By hand:',\n    manualLines.join('\\n'),\n    headingOf('Add your keys', 2, format),\n    KEYS_TEXT,\n    codeOf(KEY_CODE, 'sh', format),\n    KEYS_WARNING,\n    headingOf('Check that it works', 2, format),\n    CHECK_TEXT,\n    codeOf(CHECK_CODE, 'tsx', format),\n    headingOf('Next steps', 2, format),\n    nextSteps.join('\\n'),\n  ];\n  return blocks.join('\\n\\n');\n}\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/page-text.ts"
    },
    {
      "path": "registry/ndeko/blocks/docs/docs-01/match.ts",
      "content": "import type { NavItem } from './data';\n\nexport type MarkedPart = {\n  key: string;\n  text: string;\n  isMatch: boolean;\n};\n\ntype Range = {\n  start: number;\n  end: number;\n};\n\n/** A single letter matches nearly every page, so a word counts from two letters. */\nconst MIN_WORD_LENGTH = 2;\n\nexport function wordsOf(query: string) {\n  const lowered = query.toLowerCase();\n  const pieces = lowered.split(/\\s+/);\n  return pieces.filter((piece) => piece.length >= MIN_WORD_LENGTH);\n}\n\nfunction rangesOfWord(lowered: string, word: string) {\n  const ranges: Range[] = [];\n  let start = lowered.indexOf(word);\n  while (start !== -1) {\n    const end = start + word.length;\n    ranges.push({ start, end });\n    start = lowered.indexOf(word, end);\n  }\n  return ranges;\n}\n\nfunction byStart(first: Range, second: Range) {\n  return first.start - second.start;\n}\n\nfunction mergedRanges(ranges: Range[]) {\n  const sorted = [...ranges].sort(byStart);\n  const merged: Range[] = [];\n  for (const range of sorted) {\n    const last = merged.at(-1);\n    const overlaps = last !== undefined && range.start <= last.end;\n    if (overlaps) {\n      last.end = Math.max(last.end, range.end);\n      continue;\n    }\n    merged.push({ ...range });\n  }\n  return merged;\n}\n\nexport function markedPartsOf(text: string, words: string[]) {\n  const lowered = text.toLowerCase();\n  const ranges = words.flatMap((word) => rangesOfWord(lowered, word));\n  const parts: MarkedPart[] = [];\n  let cursor = 0;\n  for (const range of mergedRanges(ranges)) {\n    if (range.start > cursor) {\n      const plain = text.slice(cursor, range.start);\n      parts.push({ key: String(cursor), text: plain, isMatch: false });\n    }\n    const match = text.slice(range.start, range.end);\n    parts.push({ key: String(range.start), text: match, isMatch: true });\n    cursor = range.end;\n  }\n  if (cursor < text.length) {\n    const rest = text.slice(cursor);\n    parts.push({ key: String(cursor), text: rest, isMatch: false });\n  }\n  return parts;\n}\n\n/** The pages of a section whose title holds every typed word, or all of them without a search. */\nexport function itemsMatching(items: NavItem[], words: string[]) {\n  if (words.length === 0) {\n    return items;\n  }\n  return items.filter((item) => {\n    const title = item.title.toLowerCase();\n    return words.every((word) => title.includes(word));\n  });\n}\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/match.ts"
    },
    {
      "path": "registry/ndeko/blocks/docs/docs-01/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\nimport { keyDelayOf, prefixesOf } from '@/registry/ndeko/lib/demonstration';\n\nimport type { Manager } from './data';\nimport type { TextFormat } from './page-text';\n\nexport type InstallTab = 'cli' | 'manual';\n\nexport type DocsState = {\n  manager: Manager;\n  installTab: InstallTab;\n  isCommandCopied: boolean;\n  isPageCopied: boolean;\n  navQuery: string;\n  /** The heading the demonstration scrolls the frame to, or the top of the page. */\n  readTo: string;\n  /** Counts the requests, so asking twice for the same place still scrolls. */\n  readRequest: number;\n  spoken: string;\n};\n\nexport type DocsAction =\n  | { type: 'managerPicked'; manager: Manager }\n  | { type: 'tabPicked'; tab: InstallTab }\n  | { type: 'commandCopied' }\n  | { type: 'commandReset' }\n  | { type: 'pageCopied'; format: TextFormat }\n  | { type: 'pageReset' }\n  | { type: 'navSearched'; query: string }\n  | { type: 'readTo'; heading: string };\n\ntype Step = SessionStep<DocsState, DocsAction>;\n\nexport const TOP = 'top';\n\nexport const INITIAL: DocsState = {\n  manager: 'pnpm',\n  installTab: 'cli',\n  isCommandCopied: false,\n  isPageCopied: false,\n  navQuery: '',\n  readTo: TOP,\n  readRequest: 0,\n  spoken: '',\n};\n\nfunction copiedLineOf(format: TextFormat) {\n  if (format === 'markdown') {\n    return 'Page copied as Markdown';\n  }\n  return 'Page copied';\n}\n\nexport function reducer(state: DocsState, action: DocsAction): DocsState {\n  switch (action.type) {\n    case 'managerPicked':\n      return { ...state, manager: action.manager, isCommandCopied: false };\n    case 'tabPicked':\n      return { ...state, installTab: action.tab };\n    case 'commandCopied':\n      return { ...state, isCommandCopied: true, spoken: 'Command copied' };\n    case 'commandReset':\n      return { ...state, isCommandCopied: false };\n    case 'pageCopied':\n      return {\n        ...state,\n        isPageCopied: true,\n        spoken: copiedLineOf(action.format),\n      };\n    case 'pageReset':\n      return { ...state, isPageCopied: false };\n    case 'navSearched':\n      return { ...state, navQuery: action.query };\n    case 'readTo':\n      return {\n        ...state,\n        readTo: action.heading,\n        readRequest: state.readRequest + 1,\n      };\n  }\n}\n\nconst KEY_MS = 110;\n\nfunction navTyping(text: string, startAfter: number): Step[] {\n  const prefixes = prefixesOf(text);\n  return prefixes.map((value, index) => ({\n    after: keyDelayOf(index, startAfter, KEY_MS),\n    by: 'demo',\n    action: { type: 'navSearched', query: value },\n  }));\n}\n\nfunction manager(after: number, value: Manager): Step {\n  return {\n    after,\n    by: 'demo',\n    press: `pm-${value}`,\n    action: { type: 'managerPicked', manager: value },\n  };\n}\n\nfunction tab(after: number, value: InstallTab): Step {\n  return {\n    after,\n    by: 'demo',\n    press: `tab-${value}`,\n    action: { type: 'tabPicked', tab: value },\n  };\n}\n\nfunction readTo(after: number, heading: string): Step {\n  return { after, by: 'demo', action: { type: 'readTo', heading } };\n}\n\n/**\n * A developer switches the command to their package manager, copies it, reads the manual steps\n * further down, looks for the flag pages in the sidebar, and puts everything back as it was.\n */\nexport const SCRIPT: Step[] = [\n  manager(1500, 'npm'),\n  manager(1300, 'bun'),\n  {\n    after: 1200,\n    by: 'demo',\n    press: 'copy-command',\n    action: { type: 'commandCopied' },\n  },\n  tab(1800, 'manual'),\n  readTo(1800, 'keys'),\n  readTo(1700, 'check'),\n  ...navTyping('flag', 1400),\n  {\n    after: 2400,\n    by: 'demo',\n    press: 'nav-clear',\n    action: { type: 'navSearched', query: '' },\n  },\n  readTo(1300, TOP),\n  tab(1100, 'cli'),\n  manager(1000, 'pnpm'),\n];\n\nexport const RESTING: DocsState = INITIAL;\n\nexport const LOOP_AFTER_MS = 2200;\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/docs/docs-01/data.ts",
      "content": "export type Manager = 'pnpm' | 'npm' | 'yarn' | 'bun';\n\nexport type NavItem = {\n  id: string;\n  title: string;\n  href: string;\n};\n\nexport type NavSection = {\n  id: string;\n  title: string;\n  items: NavItem[];\n};\n\nexport type ManualStep = {\n  id: string;\n  title: string;\n  code?: string;\n};\n\nexport const DOCS = {\n  product: 'Brindle',\n  version: 'v3',\n  homeHref: '#',\n  sectionHref: '#getting-started',\n  currentId: 'installation',\n};\n\nexport const PAGE = {\n  title: 'Installation',\n  section: 'Getting started',\n  lead: 'Add Brindle to a React app in a few minutes. Let the command line write the setup for you, or follow the four steps by hand.',\n  href: '#installation',\n};\n\nexport const MANAGERS: { value: Manager; label: string }[] = [\n  { value: 'pnpm', label: 'pnpm' },\n  { value: 'npm', label: 'npm' },\n  { value: 'yarn', label: 'yarn' },\n  { value: 'bun', label: 'bun' },\n];\n\n/** The words that run a package without installing it, for each package manager. */\nexport const RUNNER: Record<Manager, string> = {\n  pnpm: 'pnpm dlx',\n  npm: 'npx',\n  yarn: 'yarn dlx',\n  bun: 'bunx',\n};\n\n/** The words that add a package to the project, for each package manager. */\nexport const ADDER: Record<Manager, string> = {\n  pnpm: 'pnpm add',\n  npm: 'npm install',\n  yarn: 'yarn add',\n  bun: 'bun add',\n};\n\nexport const INIT_ARGS = 'brindle init';\n\nexport const PACKAGE = '@brindle/react';\n\nexport const MANUAL_STEPS: ManualStep[] = [\n  {\n    id: 'package',\n    title: 'Add the package to your project.',\n  },\n  {\n    id: 'key',\n    title: 'Put the client key of your project in your environment.',\n    code: 'NEXT_PUBLIC_BRINDLE_KEY=brindle_pk_live_9f2c',\n  },\n  {\n    id: 'provider',\n    title: 'Wrap your app in the provider, once, near its root.',\n    code: '<FlagProvider clientKey={process.env.NEXT_PUBLIC_BRINDLE_KEY}>\\n  <App />\\n</FlagProvider>',\n  },\n  {\n    id: 'read',\n    title: 'Read a flag where you need it.',\n    code: \"const showNewCheckout = useFlag('new-checkout');\",\n  },\n];\n\nexport const CHECK_CODE = \"const showNewCheckout = useFlag('new-checkout');\";\n\nexport const KEY_CODE = 'NEXT_PUBLIC_BRINDLE_KEY=brindle_pk_live_9f2c';\n\nexport const KEYS_TEXT =\n  'Copy the client key from Settings, then Keys, and put it in your environment. The provider reads it once, when the app starts.';\n\nexport const KEYS_WARNING =\n  'Only the client key belongs in the browser. The server key starts with brindle_sk_ and stays on your server.';\n\nexport const CHECK_TEXT =\n  'Read a flag in any component, open your app and turn the flag on in the dashboard: the page follows without a reload.';\n\nexport const HEADINGS = [\n  { id: 'requirements', title: 'Requirements' },\n  { id: 'install', title: 'Install' },\n  { id: 'keys', title: 'Add your keys' },\n  { id: 'check', title: 'Check that it works' },\n  { id: 'next', title: 'Next steps' },\n];\n\nexport const REQUIREMENTS = [\n  'React 18 or later',\n  'Node 20 or later to run the command line',\n  'A Brindle project and its client key, under Settings, then Keys',\n];\n\nexport const NEXT_STEPS: NavItem[] = [\n  { id: 'quick-start', title: 'Quick start', href: '#quick-start' },\n  { id: 'targeting', title: 'Targeting rules', href: '#targeting-rules' },\n  { id: 'ssr', title: 'Server rendering', href: '#server-rendering' },\n];\n\nexport const PREVIOUS: NavItem = {\n  id: 'introduction',\n  title: 'Introduction',\n  href: '#introduction',\n};\n\nexport const NEXT: NavItem = {\n  id: 'quick-start',\n  title: 'Quick start',\n  href: '#quick-start',\n};\n\nexport const NAV: NavSection[] = [\n  {\n    id: 'start',\n    title: 'Getting started',\n    items: [\n      { id: 'introduction', title: 'Introduction', href: '#introduction' },\n      { id: 'installation', title: 'Installation', href: '#installation' },\n      { id: 'quick-start', title: 'Quick start', href: '#quick-start' },\n      {\n        id: 'project-structure',\n        title: 'Project structure',\n        href: '#project-structure',\n      },\n    ],\n  },\n  {\n    id: 'flags',\n    title: 'Flags',\n    items: [\n      { id: 'create-flag', title: 'Create a flag', href: '#create-a-flag' },\n      {\n        id: 'targeting-rules',\n        title: 'Targeting rules',\n        href: '#targeting-rules',\n      },\n      {\n        id: 'percentage-rollouts',\n        title: 'Percentage rollouts',\n        href: '#percentage-rollouts',\n      },\n      { id: 'kill-switches', title: 'Kill switches', href: '#kill-switches' },\n      {\n        id: 'flag-lifecycle',\n        title: 'Flag lifecycle',\n        href: '#flag-lifecycle',\n      },\n      {\n        id: 'stale-flags',\n        title: 'Clean up stale flags',\n        href: '#stale-flags',\n      },\n    ],\n  },\n  {\n    id: 'sdks',\n    title: 'SDKs',\n    items: [\n      { id: 'react', title: 'React', href: '#sdk-react' },\n      { id: 'next', title: 'Next.js', href: '#sdk-next' },\n      { id: 'node', title: 'Node', href: '#sdk-node' },\n      { id: 'edge', title: 'Edge runtimes', href: '#sdk-edge' },\n    ],\n  },\n  {\n    id: 'api',\n    title: 'API reference',\n    items: [\n      { id: 'flag-provider', title: 'FlagProvider', href: '#flag-provider' },\n      { id: 'use-flag', title: 'useFlag', href: '#use-flag' },\n      {\n        id: 'evaluation-context',\n        title: 'Evaluation context',\n        href: '#evaluation-context',\n      },\n      { id: 'events', title: 'Events', href: '#events' },\n      { id: 'errors', title: 'Errors', href: '#errors' },\n    ],\n  },\n  {\n    id: 'guides',\n    title: 'Guides',\n    items: [\n      {\n        id: 'testing-flags',\n        title: 'Testing with flags',\n        href: '#testing-with-flags',\n      },\n      {\n        id: 'server-rendering',\n        title: 'Server rendering',\n        href: '#server-rendering',\n      },\n      {\n        id: 'migrating',\n        title: 'Moving flags out of config files',\n        href: '#moving-flags',\n      },\n    ],\n  },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/docs-01/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "docs"
  ],
  "type": "registry:block"
}