{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "review-page-note",
  "type": "registry:block",
  "title": "Review, page note",
  "description": "One page of a site review: its name and address, the page as it is now beside what we propose and why, up to five notes marked keep, change, add or remove (said in words, with a shape), and an optional screenshot of the page now with a visible caption. Fields left empty are hidden, never filled with sample text; src/review/map.ts fills them from a Canvas review page (docs/review-blocks.md).",
  "categories": [
    "review"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/button.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/kit-invalid.json",
    "https://ui.klarhimmel.com/r/text-link.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/review-page-note/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/review-page-note/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, media, req, t } from '../_shared/schema';\n\nconst TYPES = ['keep', 'change', 'add', 'remove'] as const;\n\nconst schema = z.object({\n  eyebrow: t(60),\n  pageName: req(80),\n  pageUrl: t(200),\n  /** The crawled address of the page as it is now (page.review.source). */\n  sourceUrl: t(300),\n  nowTitle: req(40),\n  /** What we saw on the page as it is now (page.review.note of a \"now\" page). */\n  nowText: t(300),\n  proposedTitle: req(40),\n  /** Why the proposed page looks like it does (page.review.note of a \"proposed\" page). */\n  proposedText: t(300),\n  /** The pages this one replaces or merges, in words (page.review.from). */\n  replaces: t(160),\n  notesTitle: req(60),\n  /** How each kind of note is said in words (never colour alone). */\n  typeWords: z.object({ keep: req(20), change: req(20), add: req(20), remove: req(20) }),\n  notes: z.array(z.object({ type: z.enum(TYPES), text: req(240) })).max(5),\n  /** A screenshot of the page as it is now; the caption below it is always shown. */\n  screenshot: media,\n  screenshotCaption: t(160),\n});\n\nexport const spec = defineSpec({\n  type: 'review-page-note',\n  headingSlot: 'pageName',\n  aliases: ['review/page-note'],\n  name: 'Review, page note',\n  category: 'review',\n  strict: true, // a real customer's review: invalid props show an invalid notice, never the sample copy\n  role: 'body',\n  description: 'One page of a site review: its name and address, the page as it is now beside what we propose and why, up to five notes marked keep, change, add or remove (said in words, with a shape), and an optional screenshot of the page now with a visible caption. Fields left empty are hidden, never filled with sample text; src/review/map.ts fills them from a Canvas review page (docs/review-blocks.md).',\n  schema,\n  defaults: {\n    eyebrow: 'Name the topic',\n    pageName: 'Name the page',\n    pageUrl: '/om-oss/',\n    sourceUrl: 'https://exempel.example/om-oss/',\n    nowTitle: 'As is',\n    nowText: 'Say in two sentences what the page holds today, what a visitor cannot find on it, and what gets in the way.',\n    proposedTitle: 'Suggested',\n    proposedText: 'Say in two sentences what the page should hold instead and how it helps the visitor act.',\n    replaces: 'Replaces: name the old pages',\n    notesTitle: 'Name the list of notes',\n    typeWords: { keep: 'Keep', change: 'Change', add: 'Add', remove: 'Remove' },\n    notes: [\n      { type: 'keep', text: 'Say what to keep on the page, and why it works' },\n      { type: 'change', text: 'Say what to change on the page, and how it should read' },\n      { type: 'add', text: 'Say what to add to the page, and where it should sit' },\n      { type: 'remove', text: 'Say what to remove from the page, and why a visitor does not need it' },\n    ],\n    screenshot: { src: '', alt: 'A screenshot of the current page, as a visitor first sees it' },\n    screenshotCaption: 'Say what the picture shows and when it was captured',\n  },\n});\n"
    },
    {
      "path": "src/blocks/review-page-note/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/review-page-note/index.tsx",
      "content": "import { useId } from 'react';\nimport { ArrowUpRight, CircleMinus, CirclePlus, Equal, Pencil } from 'lucide-react';\nimport { Media, Text, withHeadingLevel } from '../../editing';\nimport { safeHref } from '../../ui/button';\nimport { linkClass } from '../../ui/text-link';\nimport { InvalidNotice } from '../_shared/invalid-kit';\nimport { Container, Eyebrow, Opt, Section, useEditing } from '../_shared/kit';\nimport { cn } from '../../lib/utils';\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\n// Each note type is a word and a shape: a tick-equal for keep, a pencil for change, plus and minus for add and remove.\nconst TYPE = {\n  keep: { Icon: Equal, cls: 'bg-kh-surface-2 text-kh-ink' },\n  change: { Icon: Pencil, cls: 'bg-kh-accent-soft text-kh-accent-ink' },\n  add: { Icon: CirclePlus, cls: 'bg-kh-accent-soft text-kh-accent-ink' },\n  remove: { Icon: CircleMinus, cls: 'bg-kh-surface-2 text-kh-muted' },\n} as const;\n\nfunction ReviewPageNote({ props }: BlockProps<Props>) {\n  // strict: invalid props are never replaced by the sample copy\n  if (!spec.schema.safeParse(props).success) return <InvalidNotice title=\"This review could not be shown\" />;\n  const id = useId();\n  const editing = useEditing();\n  const hasShot = !!props.screenshot.src;\n  return (\n    <Section labelledBy={id}>\n      <Container width=\"narrow\" className=\"@4xl:max-w-kh-page\">\n        <Eyebrow path={['eyebrow']} value={props.eyebrow} />\n        <div id={id}>\n          <Text path={['pageName']} value={props.pageName} as=\"h2\" className=\"text-kh-title font-semibold\" />\n        </div>\n        <p className=\"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-kh-small text-kh-muted\">\n          <Opt path={['pageUrl']} value={props.pageUrl} as=\"code\" className=\"font-kh-mono\" placeholder=\"/path/\" />\n          {(props.sourceUrl || editing) && (\n            <a href={safeHref(props.sourceUrl)} className={cn(linkClass(), 'inline-flex min-h-6 items-center gap-1 break-all')}>\n              <Text path={['sourceUrl']} value={props.sourceUrl} as=\"span\" placeholder=\"Crawled address\" />\n              <ArrowUpRight aria-hidden className=\"size-3.5\" />\n            </a>\n          )}\n        </p>\n\n        <div className={cn('mt-8 grid gap-4', props.nowText && (props.proposedText || props.replaces) && '@3xl:grid-cols-2')}>\n          {(props.nowText || editing) && (\n            <div className=\"rounded-kh-xl border border-kh-line bg-kh-surface p-6\">\n              <Text path={['nowTitle']} value={props.nowTitle} as=\"h3\" className=\"text-kh-small font-medium text-kh-muted\" />\n              <Opt path={['nowText']} value={props.nowText} multiline className=\"mt-3 text-kh-body\" placeholder=\"What is there now\" />\n            </div>\n          )}\n          {(props.proposedText || props.replaces || editing) && (\n            <div className=\"rounded-kh-xl border border-kh-accent bg-kh-accent-soft p-6\">\n              <Text path={['proposedTitle']} value={props.proposedTitle} as=\"h3\" className=\"text-kh-small font-medium text-kh-accent-ink\" />\n              <Opt path={['proposedText']} value={props.proposedText} multiline className=\"mt-3 text-kh-body\" placeholder=\"What we propose and why\" />\n              <Opt path={['replaces']} value={props.replaces} className=\"mt-4 text-kh-caption text-kh-muted\" placeholder=\"Replaces\" />\n            </div>\n          )}\n        </div>\n\n        {(props.notes.length > 0 || editing) && (\n          <Text path={['notesTitle']} value={props.notesTitle} as=\"h3\" className=\"mt-10 text-kh-heading font-semibold\" />\n        )}\n        {editing && (\n          <p className=\"mt-2 flex flex-wrap gap-3 text-kh-caption text-kh-muted\">\n            {(['keep', 'change', 'add', 'remove'] as const).map((k) => (\n              <Text key={k} path={['typeWords', k]} value={props.typeWords[k]} as=\"span\" />\n            ))}\n          </p>\n        )}\n        {props.notes.length > 0 && <ul className=\"mt-4 divide-y divide-kh-line border-y border-kh-line\">\n          {props.notes.map((n, i) => {\n            const { Icon, cls } = TYPE[n.type];\n            return (\n              <li key={i} className=\"grid items-start gap-x-6 gap-y-2 py-4 @2xl:grid-cols-[8rem_1fr]\">\n                <span className={cn('inline-flex w-fit items-center gap-1.5 rounded-kh-pill px-3 py-1 text-kh-small font-medium', cls)}>\n                  <Icon aria-hidden strokeWidth={1.75} className=\"size-4\" />\n                  <Text path={['typeWords', n.type]} value={props.typeWords[n.type]} as=\"span\" />\n                </span>\n                <Text path={['notes', i, 'text']} value={n.text} as=\"p\" multiline className=\"text-kh-body\" />\n              </li>\n            );\n          })}\n        </ul>}\n\n        {(hasShot || editing) && (\n          <figure className=\"mt-10\">\n            <Media path={['screenshot']} value={props.screenshot} ratio=\"16/10\" className=\"rounded-kh-xl border border-kh-line\" />\n            <Opt path={['screenshotCaption']} value={props.screenshotCaption} as=\"figcaption\" className=\"mt-3 text-kh-small text-kh-muted\" placeholder=\"Caption\" />\n          </figure>\n        )}\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(ReviewPageNote, 'pageName');\n"
    }
  ]
}
