{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sources-list",
  "type": "registry:block",
  "title": "Sources list",
  "description": "The numbered sources behind a snapshot: host and path of each address (the path cut), what kind of source it is said in words, and the day it was fetched. Addresses are untrusted: shown as text, opened only if http(s), in a new tab with noopener nofollow. An empty list draws nothing.",
  "categories": [
    "snapshot"
  ],
  "dependencies": [
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/kit-snapshot.json"
  ],
  "files": [
    {
      "path": "src/blocks/sources-list/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/sources-list/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, t } from '../_shared/schema';\nimport { kindWordsSchema, sourceSchema } from '../_shared/snapshot-schema';\n\nconst schema = z.object({\n  /** The list's heading (\"Sources\"). */\n  title: t(60),\n  /** Where the advice came from, in the order it is numbered; item markers [1] [2] elsewhere point at these. */\n  sources: z.array(sourceSchema).max(40),\n  numbered: z.boolean(),\n  /** How each kind is said; a missing word uses the English default. */\n  kindWords: kindWordsSchema,\n});\n\nexport const spec = defineSpec({\n  type: 'sources-list',\n  aliases: ['snapshot/sources'],\n  name: 'Sources list',\n  category: 'snapshot',\n  role: 'body',\n  description: 'The numbered sources behind a snapshot: host and path of each address (the path cut), what kind of source it is said in words, and the day it was fetched. Addresses are untrusted: shown as text, opened only if http(s), in a new tab with noopener nofollow. An empty list draws nothing.',\n  schema,\n  defaults: {\n    title: 'Name the list',\n    numbered: true,\n    sources: [\n      { id: 'src_1', url: 'https://acme.example/services/bookkeeping', kind: 'crawl', fetchedAt: '2026-10-10T09:12:00Z' },\n      { id: 'src_2', url: 'https://search.example/?q=accountants+in+leeds', kind: 'search', fetchedAt: '2026-10-10T09:13:30Z' },\n      { id: 'src_3', url: 'https://assistant.example/answers/4821', kind: 'ai_answer', fetchedAt: '2026-10-10T09:14:05Z' },\n    ],\n    kindWords: { crawl: 'Page read', search: 'Search', ai_answer: 'AI answer', dataset: 'Dataset', brief: 'Brief' },\n  },\n});\n"
    },
    {
      "path": "src/blocks/sources-list/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/sources-list/index.tsx",
      "content": "import { useId } from 'react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { Container, Section, useEditing } from '../_shared/kit';\nimport { KIND_WORDS, SOURCE_KINDS, SourceRows } from '../_shared/snapshot-kit';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\nfunction SourcesList({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  const kindWords = { ...KIND_WORDS, ...props.kindWords } as Record<(typeof SOURCE_KINDS)[number], string>;\n  if (!props.sources.length && !editing) return null;\n  return (\n    <Section labelledBy={id} className=\"py-6 @3xl:py-8\">\n      <Container width=\"narrow\">\n        <div id={id}>\n          <Text path={['title']} value={props.title} as=\"h2\" className=\"text-kh-heading font-semibold\" />\n        </div>\n        {editing && (\n          <p className=\"mt-2 flex flex-wrap gap-3 text-kh-caption text-kh-muted\">\n            {SOURCE_KINDS.map((k) => <Text key={k} path={['kindWords', k]} value={kindWords[k]} as=\"span\" />)}\n          </p>\n        )}\n        <SourceRows sources={props.sources} idPrefix={id} numbered={props.numbered} kindWords={kindWords} className=\"mt-3\" />\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(SourcesList);\n"
    }
  ]
}
