{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "changelog-02",
  "title": "Changelog by month",
  "description": "Entries grouped under sticky month headers inside their own scroll frame, a month jump that follows the scroll, type filters with counts, details that open in place and a link to copy for every entry.",
  "dependencies": [
    "date-fns",
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/motion-word-roll.json",
    "https://ui.ndekocode.dev/r/replay-button.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",
    "https://ui.ndekocode.dev/r/words.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/index.tsx",
      "content": "'use client';\n\nimport { AnimatePresence } from 'motion/react';\nimport { useEffect, useRef } 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 { countOf } from '@/registry/ndeko/lib/words';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport { ENTRIES, SECTION } from './data';\nimport { EntryRow } from './entry-row';\nimport { TypeFilters } from './filters';\nimport { entryCountOf, groupsOf } from './groups';\nimport { linkOf, useLinkedEntry } from './hash';\nimport { MonthNav } from './month-nav';\nimport {\n  COPIED_MS,\n  INITIAL,\n  LOOP_AFTER_MS,\n  monthKeyOf,\n  reducer,\n  RESTING,\n  SCRIPT,\n} from './session';\nimport { useMonthSpy } from './use-month-spy';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\n/** An entry stops under the sticky month heading instead of behind it. */\nconst HEADING_HEIGHT_PX = 56;\n\nfunction scrollBehaviorOf(shouldReduceMotion: boolean): ScrollBehavior {\n  if (shouldReduceMotion) {\n    return 'auto';\n  }\n  return 'smooth';\n}\n\nfunction offsetOf(jumpKey: string) {\n  if (jumpKey.startsWith('entry-')) {\n    return HEADING_HEIGHT_PX;\n  }\n  return 0;\n}\n\nexport default function Changelog02() {\n  const {\n    ref,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n    takeOver,\n  } = useSession(SESSION);\n  const frameRef = useRef<HTMLDivElement>(null);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const linkedFromAddress = useLinkedEntry();\n  const groups = groupsOf(state.filter);\n  const monthsKey = groups.map((group) => group.id).join(',');\n  const spiedId = useMonthSpy(frameRef, monthsKey);\n  const firstId = groups[0]?.id ?? null;\n  const activeId = spiedId ?? firstId;\n  const shownCount = entryCountOf(groups);\n  const { copiedId, jumpKey, jumpRequest } = state;\n  const copyLine = 'Link copied';\n  const countLine = `${countOf(shownCount, 'update')} shown`;\n  let line = countLine;\n  if (copiedId !== null) {\n    line = copyLine;\n  }\n  const message = spokenUnless(isAutoplaying, line);\n  const canReplay = isFinished && !isAutoplaying;\n\n  useEffect(() => {\n    if (linkedFromAddress === null) {\n      return;\n    }\n    takeOver();\n    act({ type: 'linked', id: linkedFromAddress });\n  }, [linkedFromAddress, takeOver, act]);\n\n  useEffect(() => {\n    if (jumpRequest === 0 || jumpKey === null) {\n      return;\n    }\n    const frame = frameRef.current;\n    const target = frame?.querySelector<HTMLElement>(\n      `[data-anchor=\"${jumpKey}\"]`\n    );\n    if (!frame || !target) {\n      return;\n    }\n    const top = target.offsetTop - offsetOf(jumpKey);\n    const behavior = scrollBehaviorOf(shouldReduceMotion);\n    frame.scrollTo({ top, behavior });\n  }, [jumpKey, jumpRequest, shouldReduceMotion]);\n\n  useEffect(() => {\n    if (copiedId === null) {\n      return;\n    }\n    const timer = setTimeout(() => act({ type: 'copyCleared' }), COPIED_MS);\n    return () => clearTimeout(timer);\n  }, [copiedId, act]);\n\n  async function copyLink(entryId: string) {\n    try {\n      await navigator.clipboard.writeText(linkOf(entryId));\n    } catch {\n      return;\n    }\n    act({ type: 'copied', id: entryId });\n  }\n\n  /** A wheel or a trackpad scrolling the frame is a person reading: the demonstration stops for good. */\n  function yieldToWheel() {\n    if (isAutoplaying) {\n      takeOver();\n    }\n  }\n\n  function replay() {\n    frameRef.current?.scrollTo({ top: 0 });\n    restart();\n  }\n\n  return (\n    <div\n      ref={ref}\n      className='bg-background text-foreground @container flex h-dvh min-h-[34rem] w-full flex-col'\n    >\n      <header className='shrink-0 px-4 pt-6 pb-3 @2xl:px-8 @2xl:pt-8'>\n        <div className='mx-auto flex w-full max-w-3xl flex-col gap-4'>\n          <div className='flex items-start justify-between gap-3'>\n            <div className='flex flex-col gap-1'>\n              <h2 className='text-2xl font-semibold text-balance'>\n                {SECTION.title}\n              </h2>\n              <p className='text-muted-foreground text-[13px]'>\n                {SECTION.description}\n              </p>\n            </div>\n            <div className='flex shrink-0 items-center gap-2'>\n              <ReplayButton\n                isShown={canReplay}\n                onReplay={replay}\n                label='Replay'\n              />\n              <Badge variant='secondary'>{SECTION.badge}</Badge>\n            </div>\n          </div>\n          <div className='flex flex-wrap items-center justify-between gap-3'>\n            <TypeFilters\n              filter={state.filter}\n              pressed={pressed}\n              onPick={(filter) => act({ type: 'filterPicked', filter })}\n            />\n            <MonthNav\n              groups={groups}\n              activeId={activeId}\n              pressed={pressed}\n              onJump={(monthId) =>\n                act({ type: 'jumped', key: monthKeyOf(monthId) })\n              }\n            />\n          </div>\n        </div>\n      </header>\n      <div\n        ref={frameRef}\n        onWheel={yieldToWheel}\n        tabIndex={0}\n        role='region'\n        aria-label='Release notes'\n        className='focus-visible:ring-ring/25 relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 outline-none focus-visible:ring-[3px] focus-visible:ring-inset @2xl:px-8'\n      >\n        <div className='mx-auto max-w-3xl pb-16'>\n          {groups.map((group) => (\n            <section\n              key={group.id}\n              data-month={group.id}\n              data-anchor={monthKeyOf(group.id)}\n              aria-labelledby={`${group.id}-heading`}\n            >\n              <h3\n                id={`${group.id}-heading`}\n                className='bg-background sticky top-0 z-10 flex items-baseline gap-2 py-3 text-sm font-semibold'\n              >\n                {group.label}\n                <span className='text-muted-foreground text-xs font-normal tabular-nums'>\n                  {countOf(group.entries.length, 'update')}\n                </span>\n              </h3>\n              <ol>\n                <AnimatePresence initial={false}>\n                  {group.entries.map((entry) => (\n                    <EntryRow\n                      key={entry.id}\n                      entry={entry}\n                      isOpen={state.openIds.includes(entry.id)}\n                      isCopied={copiedId === entry.id}\n                      pressed={pressed}\n                      onToggle={(id) => act({ type: 'toggled', id })}\n                      onCopy={copyLink}\n                    />\n                  ))}\n                </AnimatePresence>\n              </ol>\n            </section>\n          ))}\n          {groups.length === 0 && (\n            <div className='flex flex-col items-start gap-3 py-8'>\n              <p className='text-muted-foreground text-sm'>\n                No updates of this kind yet, out of {ENTRIES.length} in all.\n              </p>\n              <Button\n                variant='outline'\n                onClick={() => act({ type: 'filterPicked', filter: 'all' })}\n              >\n                Show every update\n              </Button>\n            </div>\n          )}\n        </div>\n      </div>\n      <LiveRegion message={message} />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/entry-row.tsx",
      "content": "'use client';\n\nimport { motion } from 'motion/react';\nimport { useId } from 'react';\n\nimport { WordRoll } from '@/components/core/word-roll';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport {\n  CheckIcon,\n  ChevronDownIcon,\n  LinkIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap, Fold } from '@/registry/ndeko/ui/chat-motion';\nimport { Chip } from '@/registry/ndeko/ui/chip';\n\nimport { KIND_STYLES, type Entry } from './data';\nimport { dayLabelOf } from './groups';\nimport { anchorOf } from './hash';\nimport { entryKeyOf } from './session';\n\nconst DETAIL_LABELS = ['Show details', 'Hide details'];\n\nfunction detailLabelOf(isOpen: boolean) {\n  if (isOpen) {\n    return 'Hide details';\n  }\n  return 'Show details';\n}\n\nfunction chevronClassOf(isOpen: boolean) {\n  if (isOpen) {\n    return 'rotate-180';\n  }\n  return undefined;\n}\n\ntype EntryRowProps = {\n  entry: Entry;\n  isOpen: boolean;\n  isCopied: boolean;\n  pressed: string | null;\n  onToggle: (entryId: string) => void;\n  onCopy: (entryId: string) => void;\n};\n\nexport function EntryRow({\n  entry,\n  isOpen,\n  isCopied,\n  pressed,\n  onToggle,\n  onCopy,\n}: EntryRowProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const detailsId = useId();\n  const kind = KIND_STYLES[entry.kind];\n  const detailLabel = detailLabelOf(isOpen);\n\n  return (\n    <motion.li\n      id={anchorOf(entry.id)}\n      data-anchor={entryKeyOf(entry.id)}\n      {...rowPresenceOf(shouldReduceMotion)}\n      className='overflow-hidden'\n    >\n      <article className='grid gap-2 px-1.5 py-4 @2xl:grid-cols-[6rem_minmax(0,1fr)] @2xl:gap-6'>\n        <time\n          dateTime={entry.date}\n          className='text-muted-foreground text-[13px] tabular-nums @2xl:pt-1'\n        >\n          {dayLabelOf(entry.date)}\n        </time>\n        <div className='flex min-w-0 flex-col gap-2'>\n          <div className='flex items-start gap-2'>\n            <h4 className='min-w-0 flex-1 text-base font-semibold text-balance'>\n              {entry.title}\n            </h4>\n            <Button\n              type='button'\n              variant='ghost'\n              size='icon-sm'\n              aria-label={`Copy the link to ${entry.title}`}\n              onClick={() => onCopy(entry.id)}\n              className={cn(\n                'text-muted-foreground shrink-0',\n                pressedQuietOf(pressed === `copy-${entry.id}`)\n              )}\n            >\n              <Swap swapKey={String(isCopied)}>\n                {isCopied && <CheckIcon />}\n                {!isCopied && <LinkIcon />}\n              </Swap>\n            </Button>\n          </div>\n          <div>\n            <Chip color={kind.color}>{kind.label}</Chip>\n          </div>\n          <p className='text-muted-foreground text-sm text-pretty'>\n            {entry.summary}\n          </p>\n          <Fold open={isOpen} id={detailsId}>\n            <ul className='flex flex-col gap-1.5 pt-1 text-[13px]'>\n              {entry.changes.map((change) => (\n                <li key={change} className='flex items-baseline gap-2.5'>\n                  <span\n                    aria-hidden='true'\n                    className='bg-foreground/25 size-1 shrink-0 -translate-y-[0.2em] rounded-full'\n                  />\n                  {change}\n                </li>\n              ))}\n            </ul>\n          </Fold>\n          <Button\n            type='button'\n            variant='ghost'\n            size='sm'\n            aria-expanded={isOpen}\n            aria-controls={detailsId}\n            onClick={() => onToggle(entry.id)}\n            className={cn(\n              'text-primary-ink self-start',\n              pressedQuietOf(pressed === `toggle-${entry.id}`)\n            )}\n          >\n            <WordRoll text={detailLabel} labels={DETAIL_LABELS} />\n            <ChevronDownIcon\n              className={cn(\n                'transition-transform duration-200 ease-(--ease-out-strong)',\n                chevronClassOf(isOpen)\n              )}\n            />\n          </Button>\n        </div>\n      </article>\n    </motion.li>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/entry-row.tsx"
    },
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/filters.tsx",
      "content": "'use client';\n\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { ToggleGroup, ToggleGroupItem } from '@/registry/ndeko/ui/toggle-group';\n\nimport { FILTERS, type TypeFilter } from './data';\nimport { countOfKind } from './groups';\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\nfunction filterOf(value: unknown) {\n  const filter = FILTERS.find((candidate) => candidate.id === value);\n  return filter?.id;\n}\n\ntype TypeFiltersProps = {\n  filter: TypeFilter;\n  pressed: string | null;\n  onPick: (filter: TypeFilter) => void;\n};\n\nexport function TypeFilters({ filter, pressed, onPick }: TypeFiltersProps) {\n  const pressedValues = [filter];\n\n  function changeFilter(nextValues: unknown[]) {\n    const [next] = nextValues;\n    const picked = filterOf(next);\n    if (picked) {\n      onPick(picked);\n    }\n  }\n\n  return (\n    <div className='relative -mx-4 overflow-x-auto px-4 @2xl:mx-0 @2xl:px-0'>\n      <ToggleGroup\n        aria-label='Kind of change'\n        value={pressedValues}\n        onValueChange={changeFilter}\n        travel\n        size='sm'\n        indicatorClassName={THUMB}\n        className='bg-foreground/[0.05] rounded-lg p-0.5'\n      >\n        {FILTERS.map((item) => (\n          <ToggleGroupItem\n            key={item.id}\n            value={item.id}\n            className={cn(\n              'h-7 gap-1.5 rounded-md px-2.5 text-xs',\n              pressedQuietOf(pressed === `filter-${item.id}`)\n            )}\n          >\n            {item.label}\n            <span className='text-muted-foreground tabular-nums'>\n              {countOfKind(item.id)}\n            </span>\n          </ToggleGroupItem>\n        ))}\n      </ToggleGroup>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/filters.tsx"
    },
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/month-nav.tsx",
      "content": "'use client';\n\nimport { useEffect, useRef } from 'react';\n\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { ToggleGroup, ToggleGroupItem } from '@/registry/ndeko/ui/toggle-group';\n\nimport type { MonthGroup } from './groups';\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\ntype MonthNavProps = {\n  groups: MonthGroup[];\n  activeId: string | null;\n  pressed: string | null;\n  onJump: (monthId: string) => void;\n};\n\n/** The strip keeps the active month in view by moving itself, never the page. */\nfunction centerActive(strip: HTMLElement) {\n  const active = strip.querySelector<HTMLElement>('[data-pressed]');\n  if (!active) {\n    return;\n  }\n  const middle = active.offsetLeft + active.offsetWidth / 2;\n  const left = middle - strip.clientWidth / 2;\n  strip.scrollTo({ left, behavior: 'smooth' });\n}\n\nexport function MonthNav({ groups, activeId, pressed, onJump }: MonthNavProps) {\n  const stripRef = useRef<HTMLDivElement>(null);\n  const pressedValues = [activeId ?? ''];\n\n  useEffect(() => {\n    const strip = stripRef.current;\n    if (strip) {\n      centerActive(strip);\n    }\n  }, [activeId]);\n\n  function changeMonth(nextValues: unknown[]) {\n    const [next] = nextValues;\n    const group = groups.find((candidate) => candidate.id === next);\n    if (group) {\n      onJump(group.id);\n    }\n  }\n\n  return (\n    <nav aria-label='Jump to a month' className='min-w-0'>\n      <div\n        ref={stripRef}\n        className='relative -mx-4 overflow-x-auto px-4 @2xl:mx-0 @2xl:px-0'\n      >\n        <ToggleGroup\n          aria-label='Months'\n          value={pressedValues}\n          onValueChange={changeMonth}\n          travel\n          size='sm'\n          indicatorClassName={THUMB}\n          className='bg-foreground/[0.05] rounded-lg p-0.5'\n        >\n          {groups.map((group) => (\n            <ToggleGroupItem\n              key={group.id}\n              value={group.id}\n              className={cn(\n                'h-7 rounded-md px-2.5 text-xs',\n                pressedQuietOf(pressed === `month-${group.id}`)\n              )}\n            >\n              {group.label}\n            </ToggleGroupItem>\n          ))}\n        </ToggleGroup>\n      </div>\n    </nav>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/month-nav.tsx"
    },
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/use-month-spy.ts",
      "content": "'use client';\n\nimport { useEffect, useState, type RefObject } from 'react';\n\nconst BOTTOM_TOLERANCE_PX = 2;\n\nfunction isAtBottom(frame: HTMLElement) {\n  const reach = frame.scrollTop + frame.clientHeight;\n  return reach >= frame.scrollHeight - BOTTOM_TOLERANCE_PX;\n}\n\n/**\n * The month under the top of the frame, followed as it scrolls. `monthsKey` changes when the\n * months on show do, so the sections are watched again.\n */\nexport function useMonthSpy(\n  frameRef: RefObject<HTMLElement | null>,\n  monthsKey: string\n) {\n  const [activeId, setActiveId] = useState<string | null>(null);\n\n  useEffect(() => {\n    const frame = frameRef.current;\n    if (!frame) {\n      return;\n    }\n    const sections = Array.from(\n      frame.querySelectorAll<HTMLElement>('[data-month]')\n    );\n    const inBand = new Set<string>();\n\n    function settle() {\n      const first = sections.find((section) => {\n        const id = section.dataset.month ?? '';\n        return inBand.has(id);\n      });\n      if (first?.dataset.month) {\n        setActiveId(first.dataset.month);\n      }\n    }\n\n    const observer = new IntersectionObserver(\n      (entries) => {\n        for (const entry of entries) {\n          const id = entry.target.getAttribute('data-month') ?? '';\n          if (entry.isIntersecting) {\n            inBand.add(id);\n          } else {\n            inBand.delete(id);\n          }\n        }\n        settle();\n      },\n      { root: frame, rootMargin: '0px 0px -70% 0px', threshold: 0 }\n    );\n    sections.forEach((section) => observer.observe(section));\n\n    const markEnd = () => {\n      const last = sections.at(-1);\n      const monthId = last?.dataset.month;\n      if (monthId && isAtBottom(frame)) {\n        setActiveId(monthId);\n      }\n    };\n\n    frame.addEventListener('scroll', markEnd, { passive: true });\n    return () => {\n      observer.disconnect();\n      frame.removeEventListener('scroll', markEnd);\n    };\n  }, [frameRef, monthsKey]);\n\n  return activeId;\n}\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/use-month-spy.ts"
    },
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/groups.ts",
      "content": "import { format, parseISO } from 'date-fns';\n\nimport { ENTRIES, type ChangeKind, type Entry, type TypeFilter } from './data';\n\nexport type MonthGroup = {\n  id: string;\n  label: string;\n  entries: Entry[];\n};\n\nconst MONTH_PATTERN = 'MMMM yyyy';\n\nconst DAY_PATTERN = 'd MMM';\n\nexport function monthIdOf(date: string) {\n  return date.slice(0, 7);\n}\n\nexport function monthLabelOf(monthId: string) {\n  const parsed = parseISO(`${monthId}-01`);\n  return format(parsed, MONTH_PATTERN);\n}\n\nexport function dayLabelOf(date: string) {\n  const parsed = parseISO(date);\n  return format(parsed, DAY_PATTERN);\n}\n\nfunction matches(entry: Entry, filter: TypeFilter) {\n  if (filter === 'all') {\n    return true;\n  }\n  return entry.kind === filter;\n}\n\n/** Entries in the order of the list, grouped by month, the months that hold none left out. */\nexport function groupsOf(filter: TypeFilter): MonthGroup[] {\n  const groups: MonthGroup[] = [];\n  for (const entry of ENTRIES) {\n    if (!matches(entry, filter)) {\n      continue;\n    }\n    const id = monthIdOf(entry.date);\n    const last = groups.at(-1);\n    if (last?.id === id) {\n      last.entries.push(entry);\n      continue;\n    }\n    groups.push({ id, label: monthLabelOf(id), entries: [entry] });\n  }\n  return groups;\n}\n\nexport function entryCountOf(groups: MonthGroup[]) {\n  let total = 0;\n  for (const group of groups) {\n    total += group.entries.length;\n  }\n  return total;\n}\n\nexport function countOfKind(kind: ChangeKind | 'all') {\n  if (kind === 'all') {\n    return ENTRIES.length;\n  }\n  const ofKind = ENTRIES.filter((entry) => entry.kind === kind);\n  return ofKind.length;\n}\n\nexport function entryOf(id: string) {\n  return ENTRIES.find((entry) => entry.id === id);\n}\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/groups.ts"
    },
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/hash.ts",
      "content": "import { useSyncExternalStore } from 'react';\n\nimport { ENTRIES } from './data';\n\nconst ANCHOR_PREFIX = 'changelog-';\n\nexport function anchorOf(entryId: string) {\n  return `${ANCHOR_PREFIX}${entryId}`;\n}\n\nexport function entryIdOfHash(hash: string) {\n  const anchor = hash.replace('#', '');\n  const found = ENTRIES.find((entry) => anchorOf(entry.id) === anchor);\n  return found?.id ?? null;\n}\n\nexport function linkOf(entryId: string) {\n  const { origin, pathname } = window.location;\n  return `${origin}${pathname}#${anchorOf(entryId)}`;\n}\n\nfunction subscribe(onChange: () => void) {\n  window.addEventListener('hashchange', onChange);\n  return () => window.removeEventListener('hashchange', onChange);\n}\n\nfunction currentHash() {\n  return window.location.hash;\n}\n\nfunction serverHash() {\n  return '';\n}\n\nexport function useLinkedEntry() {\n  const hash = useSyncExternalStore(subscribe, currentHash, serverHash);\n  return entryIdOfHash(hash);\n}\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/hash.ts"
    },
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\n\nimport type { TypeFilter } from './data';\nimport { entryOf, monthIdOf } from './groups';\n\nexport type LogState = {\n  filter: TypeFilter;\n  openIds: string[];\n  copiedId: string | null;\n  jumpKey: string | null;\n  /** Counts the requests, so asking twice for the same place still scrolls. */\n  jumpRequest: number;\n};\n\nexport type LogAction =\n  | { type: 'filterPicked'; filter: TypeFilter }\n  | { type: 'toggled'; id: string }\n  | { type: 'copied'; id: string }\n  | { type: 'copyCleared' }\n  | { type: 'jumped'; key: string }\n  | { type: 'linked'; id: string };\n\ntype Step = SessionStep<LogState, LogAction>;\n\nexport const INITIAL: LogState = {\n  filter: 'all',\n  openIds: [],\n  copiedId: null,\n  jumpKey: null,\n  jumpRequest: 0,\n};\n\nexport function monthKeyOf(monthId: string) {\n  return `month-${monthId}`;\n}\n\nexport function entryKeyOf(entryId: string) {\n  return `entry-${entryId}`;\n}\n\nfunction toggled(openIds: string[], id: string) {\n  if (openIds.includes(id)) {\n    return openIds.filter((openId) => openId !== id);\n  }\n  return [...openIds, id];\n}\n\nfunction linked(state: LogState, id: string): LogState {\n  const entry = entryOf(id);\n  const isKnown = entry !== undefined;\n  if (!isKnown) {\n    return state;\n  }\n  return {\n    ...state,\n    filter: 'all',\n    openIds: [...state.openIds.filter((openId) => openId !== id), id],\n    jumpKey: entryKeyOf(id),\n    jumpRequest: state.jumpRequest + 1,\n  };\n}\n\nexport function reducer(state: LogState, action: LogAction): LogState {\n  switch (action.type) {\n    case 'filterPicked':\n      return { ...state, filter: action.filter };\n    case 'toggled':\n      return { ...state, openIds: toggled(state.openIds, action.id) };\n    case 'copied':\n      return { ...state, copiedId: action.id };\n    case 'copyCleared':\n      return { ...state, copiedId: null };\n    case 'jumped':\n      return {\n        ...state,\n        jumpKey: action.key,\n        jumpRequest: state.jumpRequest + 1,\n      };\n    case 'linked':\n      return linked(state, action.id);\n  }\n}\n\nexport const COPIED_MS = 1600;\n\nconst AUGUST = monthIdOf('2026-08-26');\n\nconst OCTOBER = monthIdOf('2026-10-27');\n\n/**\n * Someone jumps to August, opens an entry and copies its link, narrows the list to the fixes,\n * comes back to everything and returns to the newest month.\n */\nexport const SCRIPT: Step[] = [\n  {\n    after: 2000,\n    by: 'demo',\n    press: `month-${AUGUST}`,\n    action: { type: 'jumped', key: monthKeyOf(AUGUST) },\n  },\n  {\n    after: 2200,\n    by: 'demo',\n    press: 'toggle-weekly-digest',\n    action: { type: 'toggled', id: 'weekly-digest' },\n  },\n  {\n    after: 1900,\n    by: 'demo',\n    press: 'copy-weekly-digest',\n    action: { type: 'copied', id: 'weekly-digest' },\n  },\n  {\n    after: 2600,\n    by: 'demo',\n    press: 'filter-fixed',\n    action: { type: 'filterPicked', filter: 'fixed' },\n  },\n  {\n    after: 2600,\n    by: 'demo',\n    press: 'filter-all',\n    action: { type: 'filterPicked', filter: 'all' },\n  },\n  {\n    after: 1200,\n    by: 'demo',\n    press: `month-${OCTOBER}`,\n    action: { type: 'jumped', key: monthKeyOf(OCTOBER) },\n  },\n];\n\n/** Under reduced motion the newest month is on top with one entry open. */\nexport const RESTING: LogState = {\n  ...INITIAL,\n  openIds: ['quiet-hours'],\n};\n\nexport const LOOP_AFTER_MS = 2800;\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/changelog/changelog-02/data.ts",
      "content": "export type ChangeKind = 'new' | 'improved' | 'fixed';\n\nexport type TypeFilter = ChangeKind | 'all';\n\nexport type Entry = {\n  id: string;\n  date: string;\n  title: string;\n  kind: ChangeKind;\n  summary: string;\n  changes: string[];\n};\n\nexport const KIND_STYLES: Record<ChangeKind, { label: string; color: string }> =\n  {\n    new: { label: 'New', color: 'var(--primary)' },\n    improved: { label: 'Improved', color: 'var(--info)' },\n    fixed: { label: 'Fixed', color: 'var(--success)' },\n  };\n\nexport const FILTERS: { id: TypeFilter; label: string }[] = [\n  { id: 'all', label: 'All' },\n  { id: 'new', label: 'New' },\n  { id: 'improved', label: 'Improved' },\n  { id: 'fixed', label: 'Fixed' },\n];\n\nexport const SECTION = {\n  title: 'Tidepool changelog',\n  description: 'What changed in the shared calendar, by month.',\n  badge: 'Sample release notes',\n};\n\nexport const ENTRIES: Entry[] = [\n  {\n    id: 'quiet-hours',\n    date: '2026-10-27',\n    title: 'Quiet hours for every teammate',\n    kind: 'new',\n    summary:\n      'Set the hours you do not want invites, and Tidepool proposes other times for the people who write to you.',\n    changes: [\n      'Pick your quiet hours once, in your profile',\n      'An invite inside them shows a gentle warning to its sender',\n      'Suggested times skip them automatically',\n    ],\n  },\n  {\n    id: 'zone-strip',\n    date: '2026-10-14',\n    title: 'A time zone strip on every invite',\n    kind: 'improved',\n    summary:\n      'Add up to four cities and see each guest’s local time right on the invite.',\n    changes: [\n      'Pick cities such as Kinshasa, Lisbon or Nairobi',\n      'Hours outside working time are dimmed',\n      'The strip remembers your last four cities',\n    ],\n  },\n  {\n    id: 'recurring-shift',\n    date: '2026-10-06',\n    title: 'Recurring events keep their place after a clock change',\n    kind: 'fixed',\n    summary:\n      'A weekly event no longer moves by an hour for people whose region changes its clocks.',\n    changes: [\n      'Events follow the time zone of their owner',\n      'Existing series were repaired in place',\n    ],\n  },\n  {\n    id: 'room-search',\n    date: '2026-09-23',\n    title: 'Find a room by what it has',\n    kind: 'new',\n    summary:\n      'Search for a free room that has a screen, a whiteboard or enough chairs.',\n    changes: [\n      'Filter by equipment and by seats',\n      'Rooms that fit are listed first',\n      'Booking a room adds it to the invite',\n    ],\n  },\n  {\n    id: 'agenda-notes',\n    date: '2026-09-09',\n    title: 'Agenda notes follow the event',\n    kind: 'improved',\n    summary:\n      'Notes written before a meeting stay with it when it moves to another day.',\n    changes: [\n      'Notes carry over when an event is rescheduled',\n      'Guests see the latest notes in the invite',\n    ],\n  },\n  {\n    id: 'holiday-copies',\n    date: '2026-09-02',\n    title: 'Imported calendars no longer double their holidays',\n    kind: 'fixed',\n    summary:\n      'Public holidays imported from a file are matched with the ones already there.',\n    changes: [\n      'Duplicate holidays are merged on import',\n      'A summary lists what was merged',\n    ],\n  },\n  {\n    id: 'weekly-digest',\n    date: '2026-08-26',\n    title: 'A weekly digest of what changed',\n    kind: 'new',\n    summary:\n      'One email on Monday with the events that moved, were added or were cancelled this week.',\n    changes: [\n      'Choose the day and the time it arrives',\n      'Only your own calendars are included',\n      'Turn it off from the email itself',\n    ],\n  },\n  {\n    id: 'midnight-drag',\n    date: '2026-08-18',\n    title: 'Dragging an event across midnight keeps its length',\n    kind: 'fixed',\n    summary:\n      'An event dragged past midnight used to lose an hour. It now keeps the length it had.',\n    changes: [\n      'The new end time is shown while you drag',\n      'Events of a whole day are not affected',\n    ],\n  },\n  {\n    id: 'arrow-keys',\n    date: '2026-08-05',\n    title: 'Move between days with the arrow keys',\n    kind: 'improved',\n    summary:\n      'The day view answers to the arrow keys, so a keyboard is enough to plan a week.',\n    changes: [\n      'Left and right change the day',\n      'Up and down move through the hours',\n      'Enter opens the event under the cursor',\n    ],\n  },\n  {\n    id: 'file-import',\n    date: '2026-07-21',\n    title: 'Bring a calendar in from a file',\n    kind: 'new',\n    summary:\n      'Drop a calendar file and choose which events to keep before anything is added.',\n    changes: [\n      'A preview lists every event found in the file',\n      'Untick the ones you do not want',\n    ],\n  },\n  {\n    id: 'declined-flash',\n    date: '2026-07-08',\n    title: 'Declined invites no longer flash back',\n    kind: 'fixed',\n    summary:\n      'An invite you declined used to appear again for a second before it left the list.',\n    changes: ['The list updates once, when the answer is saved'],\n  },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/changelog-02/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "changelog"
  ],
  "type": "registry:block"
}