{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "onboarding-01",
  "title": "Onboarding checklist",
  "description": "First-run steps on a card for a corner of the dashboard: pressing the action of the current step draws its check, the ring fills and the next step unlocks and opens, Snooze folds the card into a pill that keeps the count, and the last step turns it into a short message that fades on its own.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "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/demonstration.json",
    "https://ui.ndekocode.dev/r/drawn-check.json",
    "https://ui.ndekocode.dev/r/icons.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/replay-button.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/use-timeouts.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/onboarding/onboarding-01/index.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion, type Variants } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { useTimeouts } from '@/registry/ndeko/hooks/use-timeouts';\nimport {\n  pressedQuietOf,\n  spokenUnless,\n} from '@/registry/ndeko/lib/demonstration';\nimport { InboxIcon } from '@/registry/ndeko/lib/icons';\nimport {\n  EASE_OUT_STRONG,\n  risePresenceOf,\n  SPRING,\n} from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\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 { ChecklistCard } from './checklist-card';\nimport { STEPS, WORKSPACE, type StepId } from './data';\nimport { ProgressRing } from './progress-ring';\nimport {\n  COMPLETE_FOR_MS,\n  INITIAL,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  SCRIPT,\n  TOTAL,\n  type ChecklistState,\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/** How the card leaves: folded into its pill, closed by a person, or faded once everything is done. */\ntype Leaving = 'fold' | 'close' | 'fade';\n\nconst FOLD_AWAY = {\n  opacity: 0,\n  scale: 0.6,\n  transition: { duration: 0.18, ease: EASE_OUT_STRONG },\n};\n\nconst CLOSE = {\n  opacity: 0,\n  scale: 0.96,\n  transition: { duration: 0.14, ease: EASE_OUT_STRONG },\n};\n\nconst FADE_AWAY = { opacity: 0, transition: { duration: 0.5 } };\n\nfunction exitOf(leaving: Leaving) {\n  if (leaving === 'fold') {\n    return FOLD_AWAY;\n  }\n  if (leaving === 'fade') {\n    return FADE_AWAY;\n  }\n  return CLOSE;\n}\n\nconst CARD: Variants = {\n  hidden: { opacity: 0, scale: 0.96 },\n  shown: { opacity: 1, scale: 1, transition: SPRING },\n  gone: exitOf,\n};\n\nconst PILL: Variants = {\n  hidden: { opacity: 0, scale: 0.8 },\n  shown: { opacity: 1, scale: 1, transition: SPRING },\n  gone: CLOSE,\n};\n\n/** Reduced motion keeps the fades and drops the folding. */\nconst STILL: Variants = {\n  hidden: { opacity: 0 },\n  shown: { opacity: 1 },\n  gone: { opacity: 0 },\n};\n\nfunction variantsOf(shouldReduceMotion: boolean, variants: Variants) {\n  if (shouldReduceMotion) {\n    return STILL;\n  }\n  return variants;\n}\n\nfunction leavingOf(state: ChecklistState): Leaving {\n  if (state.view === 'pill') {\n    return 'fold';\n  }\n  const isAllDone = state.done.length === TOTAL;\n  if (isAllDone) {\n    return 'fade';\n  }\n  return 'close';\n}\n\n/** The step after this one, which opens when this one is done. */\nfunction stepAfter(id: StepId) {\n  const index = STEPS.findIndex((step) => step.id === id);\n  const next = STEPS[index + 1];\n  return next?.id ?? null;\n}\n\nexport default function Onboarding01() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const { schedule, clearAll } = useTimeouts();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const guidePresence = risePresenceOf(shouldReduceMotion);\n  const doneCount = state.done.length;\n  const isComplete = state.view === 'complete';\n  const showsCard = state.view === 'card' || isComplete;\n  const showsPill = state.view === 'pill';\n  const isPutAway = state.view === 'gone';\n  const leaving = leavingOf(state);\n  const message = spokenUnless(isAutoplaying, state.spoken);\n  const canReplay = isFinished && !isAutoplaying;\n\n  function focusLater(selector: string) {\n    requestAnimationFrame(() => {\n      const target = ref.current?.querySelector<HTMLElement>(selector);\n      target?.focus();\n    });\n  }\n\n  /** The button of the current step when there is one, the first step otherwise. */\n  function focusGuide() {\n    requestAnimationFrame(() => {\n      const root = ref.current;\n      const action = root?.querySelector<HTMLElement>('[data-step-cta]');\n      const firstRow = root?.querySelector<HTMLElement>('[data-step-row]');\n      const target = action ?? firstRow;\n      target?.focus();\n    });\n  }\n\n  /** The message leaves on its own: a focus that sat on it goes to the button that brings the guide back. */\n  function fadeCompletion() {\n    const completion = ref.current?.querySelector('[data-complete]');\n    const hadFocus = completion === document.activeElement;\n    act({ type: 'completionFaded', source: 'person' });\n    if (completion && hadFocus) {\n      focusLater('[data-setup-guide]');\n    }\n  }\n\n  /** The button that was pressed folds away with its step, so the focus goes to the button of the next one. */\n  function complete(id: StepId) {\n    const nextId = stepAfter(id);\n    act({ type: 'stepCompleted', id, source: 'person' });\n    if (nextId === null) {\n      focusLater('[data-complete]');\n      schedule(fadeCompletion, COMPLETE_FOR_MS);\n      return;\n    }\n    focusLater(`[data-step-cta=\"${nextId}\"]`);\n  }\n\n  function snooze() {\n    act({ type: 'snoozed' });\n    focusLater('[data-pill]');\n  }\n\n  function resume() {\n    act({ type: 'resumed' });\n    focusGuide();\n  }\n\n  function dismiss() {\n    act({ type: 'dismissed' });\n    focusLater('[data-setup-guide]');\n  }\n\n  /** A message that waits to fade belongs to the round it came up in. */\n  function replay() {\n    clearAll();\n    restart();\n  }\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-background text-foreground @container relative flex min-h-dvh w-full flex-col'\n      >\n        <header className='flex h-14 shrink-0 items-center gap-2.5 px-4'>\n          <CompanyMark seed={WORKSPACE.name} size='lg' />\n          <p className='min-w-0 flex-1 truncate text-sm font-medium'>\n            {WORKSPACE.name}\n          </p>\n          <ReplayButton isShown={canReplay} onReplay={replay} label='Replay' />\n          <AnimatePresence initial={false}>\n            {isPutAway && (\n              <motion.span\n                key='setup-guide'\n                className='inline-flex'\n                {...guidePresence}\n              >\n                <Button\n                  type='button'\n                  variant='outline'\n                  size='sm'\n                  data-setup-guide\n                  onClick={resume}\n                >\n                  Setup guide\n                  <span className='text-muted-foreground tabular-nums'>\n                    {doneCount} of {TOTAL}\n                  </span>\n                </Button>\n              </motion.span>\n            )}\n          </AnimatePresence>\n        </header>\n\n        <main className='flex flex-1 flex-col gap-4 p-4 pt-2 @md:px-6'>\n          <h1 className='text-lg font-semibold'>Home</h1>\n          <div className='hairline-border border-foreground/20 flex flex-col items-start gap-2 rounded-xl border-dashed p-5'>\n            <span\n              aria-hidden='true'\n              className='keycap-3d text-muted-foreground mb-1 inline-flex size-10 items-center justify-center rounded-lg'\n            >\n              <InboxIcon className='size-5' />\n            </span>\n            <p className='text-sm font-medium'>No agent has run yet</p>\n            <p className='text-muted-foreground max-w-sm text-[13px] leading-relaxed text-pretty'>\n              Runs, requests and results show up on this page once your first\n              agent has done its first job\n            </p>\n          </div>\n        </main>\n\n        <div className='pointer-events-none absolute inset-x-3 bottom-3 z-10 flex justify-end @md:inset-x-auto @md:end-4 @md:bottom-4'>\n          <AnimatePresence initial={false} mode='popLayout' custom={leaving}>\n            {showsCard && (\n              <motion.section\n                key='card'\n                aria-label='Setup guide'\n                variants={variantsOf(shouldReduceMotion, CARD)}\n                custom={leaving}\n                initial='hidden'\n                animate='shown'\n                exit='gone'\n                className='surface-raised pointer-events-auto w-full origin-bottom-right rounded-xl @md:w-[22rem]'\n              >\n                <ChecklistCard\n                  done={state.done}\n                  openId={state.openId}\n                  howToId={state.howToId}\n                  isComplete={isComplete}\n                  pressed={pressed}\n                  onToggle={(id) => act({ type: 'stepToggled', id })}\n                  onToggleHowTo={(id) => act({ type: 'howToToggled', id })}\n                  onComplete={complete}\n                  onSnooze={snooze}\n                  onDismiss={dismiss}\n                />\n              </motion.section>\n            )}\n            {showsPill && (\n              <motion.button\n                key='pill'\n                type='button'\n                data-pill\n                aria-label={`Open the setup guide: ${doneCount} of ${TOTAL} steps done`}\n                variants={variantsOf(shouldReduceMotion, PILL)}\n                initial='hidden'\n                animate='shown'\n                exit='gone'\n                onClick={resume}\n                className={cn(\n                  'surface-raised focus-visible:ring-ring pointer-events-auto flex h-9 origin-bottom-right cursor-pointer items-center gap-2 rounded-full ps-2 pe-3.5 text-xs font-medium transition-[background-color,scale] duration-150 outline-none focus-visible:ring-2',\n                  pressedQuietOf(pressed === 'pill')\n                )}\n              >\n                <ProgressRing done={doneCount} total={TOTAL} size='sm' />\n                Setup\n                <span className='text-muted-foreground tabular-nums'>\n                  {doneCount} of {TOTAL}\n                </span>\n              </motion.button>\n            )}\n          </AnimatePresence>\n        </div>\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/onboarding-01/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/onboarding/onboarding-01/checklist-card.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport {\n  pressedQuietOf,\n  pressedSolidOf,\n} from '@/registry/ndeko/lib/demonstration';\nimport { ChevronDownIcon, LockIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Fold, Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { DrawnCheck } from '@/registry/ndeko/ui/drawn-check';\n\nimport { CalmCheck } from './calm-check';\nimport { STEPS, WORKSPACE, type SetupStep, type StepId } from './data';\nimport { ProgressRing } from './progress-ring';\nimport { statusOf, TOTAL, type StepStatus } from './session';\n\nconst NUMBER =\n  'inline-flex size-[18px] items-center justify-center rounded-full text-[11px] leading-none font-medium tabular-nums';\n\nconst ROW =\n  'focus-visible:ring-ring/25 flex h-10 w-full items-center gap-2.5 rounded-lg px-2 text-start outline-none transition-colors duration-150 focus-visible:ring-[3px]';\n\nconst HOW_TO_TOGGLE =\n  'text-primary-ink focus-visible:ring-ring/25 -mx-1 flex h-6 w-fit cursor-pointer items-center gap-1 rounded-sm px-1 text-xs font-medium outline-none transition-[background-color,scale] duration-150 hover:bg-foreground/[0.05] focus-visible:ring-[3px]';\n\nfunction rowToneOf(status: StepStatus) {\n  if (status === 'locked') {\n    return 'text-muted-foreground cursor-not-allowed';\n  }\n  return 'hover:bg-foreground/[0.04] cursor-pointer';\n}\n\nfunction chevronTurnOf(isOpen: boolean) {\n  if (isOpen) {\n    return 'rotate-180';\n  }\n  return 'rotate-0';\n}\n\nfunction stepsLeftLineOf(left: number) {\n  if (left === 0) {\n    return 'Every step is done';\n  }\n  if (left === 1) {\n    return '1 step left';\n  }\n  return `${left} steps left`;\n}\n\ntype StepMarkProps = {\n  status: StepStatus;\n  number: number;\n};\n\n/** The number becomes a check when the step is done. Steps that are done when the page loads show their check at once. */\nfunction StepMark({ status, number }: StepMarkProps) {\n  return (\n    <Swap swapKey={status} className='size-[18px] shrink-0 justify-center'>\n      {status === 'done' && (\n        <DrawnCheck tone='success' entrance='draw' pace='calm' />\n      )}\n      {status === 'current' && (\n        <span className={cn(NUMBER, 'bg-primary text-primary-foreground')}>\n          {number}\n        </span>\n      )}\n      {status === 'locked' && (\n        <span\n          className={cn(NUMBER, 'bg-foreground/[0.06] text-muted-foreground')}\n        >\n          {number}\n        </span>\n      )}\n    </Swap>\n  );\n}\n\ntype StepRowProps = {\n  step: SetupStep;\n  number: number;\n  status: StepStatus;\n  isOpen: boolean;\n  isHowToOpen: boolean;\n  pressed: string | null;\n  onToggle: (id: StepId) => void;\n  onToggleHowTo: (id: StepId) => void;\n  onComplete: (id: StepId) => void;\n};\n\nfunction StepRow({\n  step,\n  number,\n  status,\n  isOpen,\n  isHowToOpen,\n  pressed,\n  onToggle,\n  onToggleHowTo,\n  onComplete,\n}: StepRowProps) {\n  const bodyId = useId();\n  const howToId = useId();\n  const isLocked = status === 'locked';\n  const isCurrent = status === 'current';\n  const hasAction = isCurrent && step.action !== undefined;\n\n  return (\n    <li>\n      <button\n        type='button'\n        data-step-row={step.id}\n        aria-expanded={isOpen}\n        aria-controls={bodyId}\n        disabled={isLocked}\n        onClick={() => onToggle(step.id)}\n        className={cn(ROW, rowToneOf(status))}\n      >\n        <StepMark status={status} number={number} />\n        <span className='min-w-0 flex-1 truncate text-[13px] font-medium'>\n          {step.title}\n        </span>\n        {isLocked && (\n          <LockIcon aria-hidden='true' className='size-3.5 shrink-0' />\n        )}\n        {isLocked && <span className='sr-only'>Locked</span>}\n        {!isLocked && (\n          <ChevronDownIcon\n            aria-hidden='true'\n            className={cn(\n              'text-muted-foreground size-3.5 shrink-0 transition-[rotate] duration-200 ease-(--ease-out-strong)',\n              chevronTurnOf(isOpen)\n            )}\n          />\n        )}\n      </button>\n      <Fold open={isOpen} id={bodyId}>\n        <div className='flex flex-col items-start gap-2.5 ps-[2.375rem] pe-2 pb-2.5'>\n          <p className='text-muted-foreground text-xs leading-5 text-pretty'>\n            {step.detail}\n          </p>\n          {step.howTo && (\n            <div className='flex w-full flex-col'>\n              <button\n                type='button'\n                aria-expanded={isHowToOpen}\n                aria-controls={howToId}\n                onClick={() => onToggleHowTo(step.id)}\n                className={cn(\n                  HOW_TO_TOGGLE,\n                  pressedQuietOf(pressed === `howto-${step.id}`)\n                )}\n              >\n                How it works\n                <ChevronDownIcon\n                  aria-hidden='true'\n                  className={cn(\n                    'size-3.5 transition-[rotate] duration-200 ease-(--ease-out-strong)',\n                    chevronTurnOf(isHowToOpen)\n                  )}\n                />\n              </button>\n              <Fold open={isHowToOpen} id={howToId}>\n                <ol className='text-muted-foreground flex list-decimal flex-col gap-1 ps-4 pt-1.5 text-xs leading-5 marker:tabular-nums'>\n                  {step.howTo.map((line) => (\n                    <li key={line} className='ps-0.5'>\n                      {line}\n                    </li>\n                  ))}\n                </ol>\n              </Fold>\n            </div>\n          )}\n          {hasAction && (\n            <Button\n              type='button'\n              size='sm'\n              data-step-cta={step.id}\n              onClick={() => onComplete(step.id)}\n              className={pressedSolidOf(pressed === `cta-${step.id}`)}\n            >\n              {step.action}\n            </Button>\n          )}\n        </div>\n      </Fold>\n    </li>\n  );\n}\n\ntype RevealProps = {\n  isOpen: boolean;\n  children: React.ReactNode;\n};\n\nfunction rowsOf(isOpen: boolean) {\n  if (isOpen) {\n    return 'grid-rows-[1fr] opacity-100';\n  }\n  return 'grid-rows-[0fr] opacity-0';\n}\n\n/**\n * A part of the card that opens to the height of what it holds. The row of a grid does it, so the\n * steps inside keep folding at their own pace without a second measure chasing them.\n */\nfunction Reveal({ isOpen, children }: RevealProps) {\n  return (\n    <div\n      className={cn(\n        'grid transition-[grid-template-rows,opacity] duration-300 ease-(--ease-out-strong)',\n        rowsOf(isOpen)\n      )}\n    >\n      <div inert={!isOpen} className='min-h-0 overflow-hidden'>\n        {children}\n      </div>\n    </div>\n  );\n}\n\nexport type ChecklistCardProps = {\n  done: StepId[];\n  openId: StepId | null;\n  howToId: StepId | null;\n  /** Every step is done and the card says so before it leaves. */\n  isComplete: boolean;\n  pressed: string | null;\n  onToggle: (id: StepId) => void;\n  onToggleHowTo: (id: StepId) => void;\n  onComplete: (id: StepId) => void;\n  onSnooze: () => void;\n  onDismiss: () => void;\n};\n\n/** The card closes over its steps and opens on its closing message: it is the same card, saying something shorter. */\nexport function ChecklistCard({\n  done,\n  openId,\n  howToId,\n  isComplete,\n  pressed,\n  onToggle,\n  onToggleHowTo,\n  onComplete,\n  onSnooze,\n  onDismiss,\n}: ChecklistCardProps) {\n  const headingId = useId();\n  const doneCount = done.length;\n  const left = TOTAL - doneCount;\n\n  return (\n    <>\n      <Reveal isOpen={isComplete}>\n        {isComplete && (\n          <div\n            data-complete\n            tabIndex={-1}\n            className='flex items-center gap-3 p-4 outline-none'\n          >\n            <CalmCheck />\n            <div className='flex min-w-0 flex-col gap-0.5'>\n              <p className='text-sm font-medium'>{WORKSPACE.name} is set up</p>\n              <p className='text-muted-foreground text-xs text-pretty'>\n                This guide stays under Setup guide in the top bar\n              </p>\n            </div>\n          </div>\n        )}\n      </Reveal>\n      <Reveal isOpen={!isComplete}>\n        <header className='flex items-center gap-3 p-3.5 pb-2'>\n          <ProgressRing done={doneCount} total={TOTAL}>\n            <MotionNumber\n              value={doneCount}\n              className='text-xs leading-none font-semibold'\n            />\n          </ProgressRing>\n          <div className='flex min-w-0 flex-1 flex-col gap-0.5'>\n            <h2 id={headingId} className='truncate text-sm font-medium'>\n              Set up {WORKSPACE.name}\n            </h2>\n            <p className='text-muted-foreground text-xs tabular-nums'>\n              <span className='sr-only'>\n                {doneCount} of {TOTAL} steps done.{' '}\n              </span>\n              {stepsLeftLineOf(left)}\n            </p>\n          </div>\n        </header>\n        <ol aria-labelledby={headingId} className='flex flex-col px-1.5'>\n          {STEPS.map((step, index) => (\n            <StepRow\n              key={step.id}\n              step={step}\n              number={index + 1}\n              status={statusOf(done, step.id)}\n              isOpen={openId === step.id}\n              isHowToOpen={howToId === step.id}\n              pressed={pressed}\n              onToggle={onToggle}\n              onToggleHowTo={onToggleHowTo}\n              onComplete={onComplete}\n            />\n          ))}\n        </ol>\n        <footer className='flex items-center justify-end gap-1 p-1.5 pt-1'>\n          <Button\n            type='button'\n            variant='ghost'\n            size='sm'\n            data-snooze\n            onClick={onSnooze}\n            className={cn(\n              'text-muted-foreground',\n              pressedQuietOf(pressed === 'snooze')\n            )}\n          >\n            Snooze\n          </Button>\n          <Button\n            type='button'\n            variant='ghost'\n            size='sm'\n            onClick={onDismiss}\n            className='text-muted-foreground'\n          >\n            Dismiss\n          </Button>\n        </footer>\n      </Reveal>\n    </>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/onboarding-01/checklist-card.tsx"
    },
    {
      "path": "registry/ndeko/blocks/onboarding/onboarding-01/progress-ring.tsx",
      "content": "import { cn } from '@/registry/ndeko/lib/utils';\n\nexport type ProgressRingSize = 'sm' | 'md';\n\nconst SIZE_CLASS: Record<ProgressRingSize, string> = {\n  sm: 'size-5',\n  md: 'size-9',\n};\n\nconst STROKE_WIDTH: Record<ProgressRingSize, number> = {\n  sm: 5,\n  md: 3,\n};\n\nconst VIEW = 36;\n\nconst CENTRE = VIEW / 2;\n\nconst RADIUS = 15;\n\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS;\n\n/** The part of the ring that stays empty. No step yet counts as nothing done. */\nfunction emptyLengthOf(done: number, total: number) {\n  if (total <= 0) {\n    return CIRCUMFERENCE;\n  }\n  const share = Math.min(1, done / total);\n  return CIRCUMFERENCE * (1 - share);\n}\n\ntype ProgressRingProps = {\n  done: number;\n  total: number;\n  size?: ProgressRingSize;\n  className?: string;\n  /** What sits in the middle of the ring: a count, or nothing. */\n  children?: React.ReactNode;\n};\n\n/**\n * A ring that fills as steps are done. The stroke eases to its new length once per step, which is\n * the only time it is painted again. With nothing done the stroke is hidden: a round cap would\n * leave a dot.\n */\nexport function ProgressRing({\n  done,\n  total,\n  size = 'md',\n  className,\n  children,\n}: ProgressRingProps) {\n  const strokeWidth = STROKE_WIDTH[size];\n  const isEmpty = done <= 0;\n\n  return (\n    <span\n      className={cn(\n        'relative inline-flex shrink-0 items-center justify-center',\n        SIZE_CLASS[size],\n        className\n      )}\n    >\n      <svg\n        aria-hidden='true'\n        viewBox={`0 0 ${VIEW} ${VIEW}`}\n        className='absolute inset-0 size-full -rotate-90'\n      >\n        <circle\n          cx={CENTRE}\n          cy={CENTRE}\n          r={RADIUS}\n          fill='none'\n          strokeWidth={strokeWidth}\n          className='stroke-foreground/10'\n        />\n        <circle\n          cx={CENTRE}\n          cy={CENTRE}\n          r={RADIUS}\n          fill='none'\n          strokeWidth={strokeWidth}\n          strokeLinecap='round'\n          strokeDasharray={CIRCUMFERENCE}\n          strokeDashoffset={emptyLengthOf(done, total)}\n          className={cn(\n            'stroke-primary transition-[stroke-dashoffset] duration-500 ease-(--ease-out-strong)',\n            isEmpty && 'invisible'\n          )}\n        />\n      </svg>\n      {children}\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/onboarding-01/progress-ring.tsx"
    },
    {
      "path": "registry/ndeko/blocks/onboarding/onboarding-01/calm-check.tsx",
      "content": "'use client';\n\nimport { motion } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { EASE_OUT_STRONG } from '@/registry/ndeko/lib/motion-presets';\n\nconst CHECK_PATH = 'M2.6 6.4 4.9 8.7 9.5 3.6';\n\nconst DRAW = { duration: 0.32, ease: EASE_OUT_STRONG, delay: 0.1 };\n\nconst DRAWN = { pathLength: 1 };\n\nconst NOT_DRAWN = { pathLength: 0 };\n\nfunction strokeStartOf(shouldReduceMotion: boolean) {\n  if (shouldReduceMotion) {\n    return DRAWN;\n  }\n  return NOT_DRAWN;\n}\n\n/** The larger mark of the message that says every step is done. Reduced motion shows it drawn. */\nexport function CalmCheck() {\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  return (\n    <span className='bg-success/10 text-success-foreground flex size-10 shrink-0 items-center justify-center rounded-full'>\n      <svg aria-hidden='true' viewBox='0 0 12 12' className='size-5'>\n        <motion.path\n          d={CHECK_PATH}\n          fill='none'\n          stroke='currentColor'\n          strokeWidth={1.4}\n          strokeLinecap='round'\n          strokeLinejoin='round'\n          initial={strokeStartOf(shouldReduceMotion)}\n          animate={DRAWN}\n          transition={DRAW}\n        />\n      </svg>\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/onboarding-01/calm-check.tsx"
    },
    {
      "path": "registry/ndeko/blocks/onboarding/onboarding-01/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\n\nimport { DONE_AT_FIRST, stepOf, STEPS, WORKSPACE, type StepId } from './data';\n\n/** The guide is a card, a pill once snoozed, a short message once every step is done, or put away. */\nexport type View = 'card' | 'pill' | 'complete' | 'gone';\n\nexport type Source = 'demo' | 'person';\n\nexport type StepStatus = 'done' | 'current' | 'locked';\n\nexport type ChecklistState = {\n  /** The steps that are done, in the order they were done. */\n  done: StepId[];\n  openId: StepId | null;\n  /** The how-to that is unfolded inside the open step. */\n  howToId: StepId | null;\n  view: View;\n  /** Who did the last step: the message that follows only fades for the one who brought it up. */\n  completedBy: Source | null;\n  spoken: string;\n};\n\nexport type ChecklistAction =\n  | { type: 'stepToggled'; id: StepId }\n  | { type: 'howToToggled'; id: StepId }\n  | { type: 'stepCompleted'; id: StepId; source: Source }\n  | { type: 'snoozed' }\n  | { type: 'resumed' }\n  | { type: 'dismissed' }\n  | { type: 'completionFaded'; source: Source };\n\ntype Step = SessionStep<ChecklistState, ChecklistAction>;\n\nexport const TOTAL = STEPS.length;\n\n/** The steps are done in order: the first one that is not done is the current one. */\nexport function currentOf(done: StepId[]) {\n  const current = STEPS.find((step) => !done.includes(step.id));\n  return current?.id ?? null;\n}\n\nexport function statusOf(done: StepId[], id: StepId): StepStatus {\n  if (done.includes(id)) {\n    return 'done';\n  }\n  if (currentOf(done) === id) {\n    return 'current';\n  }\n  return 'locked';\n}\n\nexport const INITIAL: ChecklistState = {\n  done: DONE_AT_FIRST,\n  openId: currentOf(DONE_AT_FIRST),\n  howToId: null,\n  view: 'card',\n  completedBy: null,\n  spoken: '',\n};\n\nfunction stepToggled(state: ChecklistState, id: StepId): ChecklistState {\n  const isLocked = statusOf(state.done, id) === 'locked';\n  if (isLocked) {\n    return state;\n  }\n  if (state.openId === id) {\n    return { ...state, openId: null, howToId: null };\n  }\n  return { ...state, openId: id, howToId: null };\n}\n\nfunction howToToggled(state: ChecklistState, id: StepId): ChecklistState {\n  if (state.openId !== id) {\n    return state;\n  }\n  if (state.howToId === id) {\n    return { ...state, howToId: null };\n  }\n  return { ...state, howToId: id };\n}\n\n/** Doing the current step ticks it, and the next one unlocks and opens. After the last one the card says so. */\nfunction stepCompleted(\n  state: ChecklistState,\n  id: StepId,\n  source: Source\n): ChecklistState {\n  if (currentOf(state.done) !== id) {\n    return state;\n  }\n  const done = [...state.done, id];\n  const nextId = currentOf(done);\n  if (nextId === null) {\n    return {\n      ...state,\n      done,\n      openId: null,\n      howToId: null,\n      view: 'complete',\n      completedBy: source,\n      spoken: `All ${TOTAL} steps done. ${WORKSPACE.name} is set up`,\n    };\n  }\n  const title = stepOf(id).title;\n  const nextTitle = stepOf(nextId).title;\n  const spoken = `${title}: done, ${done.length} of ${TOTAL}. Next: ${nextTitle}`;\n  return { ...state, done, openId: nextId, howToId: null, spoken };\n}\n\nfunction snoozed(state: ChecklistState): ChecklistState {\n  if (state.view !== 'card') {\n    return state;\n  }\n  return { ...state, view: 'pill', spoken: 'Setup guide snoozed' };\n}\n\nfunction resumed(state: ChecklistState): ChecklistState {\n  const isPutAway = state.view === 'pill' || state.view === 'gone';\n  if (!isPutAway) {\n    return state;\n  }\n  return {\n    ...state,\n    view: 'card',\n    openId: currentOf(state.done),\n    howToId: null,\n    spoken: 'Setup guide opened',\n  };\n}\n\nfunction dismissed(state: ChecklistState): ChecklistState {\n  if (state.view === 'gone') {\n    return state;\n  }\n  const spoken = 'Setup guide dismissed. It stays in the top bar';\n  return { ...state, view: 'gone', spoken };\n}\n\nfunction completionFaded(\n  state: ChecklistState,\n  source: Source\n): ChecklistState {\n  const isShowingMessage = state.view === 'complete';\n  const isItsOwn = state.completedBy === source;\n  if (!isShowingMessage || !isItsOwn) {\n    return state;\n  }\n  return { ...state, view: 'gone', spoken: '' };\n}\n\nexport function reducer(\n  state: ChecklistState,\n  action: ChecklistAction\n): ChecklistState {\n  switch (action.type) {\n    case 'stepToggled':\n      return stepToggled(state, action.id);\n    case 'howToToggled':\n      return howToToggled(state, action.id);\n    case 'stepCompleted':\n      return stepCompleted(state, action.id, action.source);\n    case 'snoozed':\n      return snoozed(state);\n    case 'resumed':\n      return resumed(state);\n    case 'dismissed':\n      return dismissed(state);\n    case 'completionFaded':\n      return completionFaded(state, action.source);\n  }\n}\n\n/** How long the message that everything is done stays before the card fades. */\nexport const COMPLETE_FOR_MS = 3600;\n\nfunction completes(after: number, id: StepId): Step {\n  return {\n    after,\n    by: 'demo',\n    press: `cta-${id}`,\n    action: { type: 'stepCompleted', id, source: 'demo' },\n  };\n}\n\n/** Two steps are done with their how-to read first: the state the guide rests in. */\nconst FIRST_STEPS: Step[] = [\n  {\n    after: 1500,\n    by: 'demo',\n    press: 'howto-invite',\n    action: { type: 'howToToggled', id: 'invite' },\n  },\n  completes(2300, 'invite'),\n];\n\n/**\n * A person does every step, so they are the demonstration's: the guide is snoozed into its pill and\n * brought back, then the last steps are done. The fade that follows is the card's own doing, and it\n * plays even when a person took over while the message was up.\n */\nexport const SCRIPT: Step[] = [\n  ...FIRST_STEPS,\n  completes(2000, 'source'),\n  { after: 1700, by: 'demo', press: 'snooze', action: { type: 'snoozed' } },\n  { after: 1900, by: 'demo', press: 'pill', action: { type: 'resumed' } },\n  completes(1500, 'agent'),\n  completes(1700, 'run'),\n  {\n    after: COMPLETE_FOR_MS,\n    action: { type: 'completionFaded', source: 'demo' },\n  },\n];\n\nfunction endOf(script: Step[]) {\n  let state = INITIAL;\n  for (const step of script) {\n    state = reducer(state, step.action);\n  }\n  return state;\n}\n\n/** Under reduced motion two of five steps are done and the third is open, with its button to press. */\nexport const RESTING: ChecklistState = { ...endOf(FIRST_STEPS), spoken: '' };\n\nexport const LOOP_AFTER_MS = 2200;\n",
      "type": "registry:component",
      "target": "components/blocks/onboarding-01/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/onboarding/onboarding-01/data.ts",
      "content": "/** An invented workspace on its first day. */\nexport const WORKSPACE = { name: 'Solway Books' };\n\nexport type StepId = 'workspace' | 'invite' | 'source' | 'agent' | 'run';\n\nexport type SetupStep = {\n  id: StepId;\n  title: string;\n  detail: string;\n  /** What the button of the step says. A step that is done from the start has none. */\n  action?: string;\n  /** A short how-to, for the steps that need one. */\n  howTo?: string[];\n};\n\nexport const STEPS: SetupStep[] = [\n  {\n    id: 'workspace',\n    title: 'Create your workspace',\n    detail: 'Solway Books was created when you signed up',\n  },\n  {\n    id: 'invite',\n    title: 'Invite a teammate',\n    detail: 'Agents are easier to trust when someone else reads their work',\n    action: 'Invite teammates',\n    howTo: [\n      'Open Members from the sidebar',\n      'Add an address and pick a role',\n      'They join from the link in their email',\n    ],\n  },\n  {\n    id: 'source',\n    title: 'Connect a data source',\n    detail: 'An agent reads from the tools you connect. One is enough to start',\n    action: 'Connect a source',\n    howTo: [\n      'Pick a tool under Integrations',\n      'Sign in to it and choose what to share',\n      'The first sync runs in the background',\n    ],\n  },\n  {\n    id: 'agent',\n    title: 'Create your first agent',\n    detail: 'Give it a name and one job, said in a sentence',\n    action: 'Create an agent',\n  },\n  {\n    id: 'run',\n    title: 'Run it once',\n    detail: 'Watch the first run and approve what it asks for',\n    action: 'Start a run',\n    howTo: [\n      'Open the agent and press Run',\n      'Approve or deny each request it makes',\n      'Read the result, then let it run on its own',\n    ],\n  },\n];\n\n/** The steps that are behind a person who has just signed up. */\nexport const DONE_AT_FIRST: StepId[] = ['workspace'];\n\nconst FALLBACK_STEP = STEPS[0];\n\nexport function stepOf(id: StepId) {\n  const step = STEPS.find((candidate) => candidate.id === id);\n  return step ?? FALLBACK_STEP;\n}\n",
      "type": "registry:component",
      "target": "components/blocks/onboarding-01/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "onboarding"
  ],
  "type": "registry:block"
}