@bettercms-ai/kit 4.1.1 → 4.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.ts +8 -0
- package/dist/context.js.map +1 -1
- package/dist/controls/rich-text/block-tool.d.ts +1 -1
- package/dist/controls/rich-text/block-tool.js +1 -1
- package/dist/controls/rich-text/block-tool.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +3 -1
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/catalog.d.ts +26 -3
- package/dist/controls/rich-text/catalog.js +239 -58
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/codec.d.ts +1 -1
- package/dist/controls/rich-text/codec.js +2 -1
- package/dist/controls/rich-text/codec.js.map +1 -1
- package/dist/controls/rich-text/dom.js +8 -3
- package/dist/controls/rich-text/dom.js.map +1 -1
- package/dist/controls/rich-text/editor.js +32 -6
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/rewriteSelection.d.ts +25 -0
- package/dist/controls/rich-text/rewriteSelection.js +28 -0
- package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
- package/dist/controls/rich-text/slash-preview.js +18 -5
- package/dist/controls/rich-text/slash-preview.js.map +1 -1
- package/dist/controls/rich-text/table-grid.js +26 -21
- package/dist/controls/rich-text/table-grid.js.map +1 -1
- package/dist/controls/rich-text/toolbar.js +1 -0
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/text.js +1 -1
- package/dist/controls/text.js.map +1 -1
- package/dist/engine/field-shell.js +8 -4
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +3 -2
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.js +4 -3
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +2 -2
- package/dist/engine/item-list.js.map +1 -1
- package/dist/engine/schema-form.d.ts +2 -0
- package/dist/engine/schema-form.js +2 -0
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/kit.css +6 -32
- package/dist/lib/reduced-motion.d.ts +1 -0
- package/dist/lib/reduced-motion.js +19 -0
- package/dist/lib/reduced-motion.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme.css +100 -0
- package/dist/tokens.css +6 -0
- package/dist/ui/content-fields.js +3 -2
- package/dist/ui/content-fields.js.map +1 -1
- package/dist/ui/controls.js +3 -2
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/floating-panel.js +3 -2
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/foundations.js +3 -2
- package/dist/ui/foundations.js.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/inspector.d.ts +22 -4
- package/dist/ui/inspector.js +72 -27
- package/dist/ui/inspector.js.map +1 -1
- package/dist/ui/tab.js +3 -2
- package/dist/ui/tab.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","names":[],"sources":["../../../src/controls/rich-text/catalog.tsx"],"sourcesContent":["/**\n * RICH TEXT · the block catalogue shared by the toolbar Insert menu, the gutter \"+\" and the \"/\" slash menu (V2 HEAD\n * controls/rich-text/catalog.tsx, CPO D55).\n *\n * browse Text · Media · Data, grouped, then one quiet \"More components N\" row that opens the components the\n * field may embed (V2 HEAD catalog.tsx MORE), with its own search and a way back (\"All blocks\")\n * search every block and every embeddable component in one list: recently used first among the strong matches,\n * then by match (label, aliases, then description)\n * no match \"No match.\"\n *\n * Only the blocks the field accepts are offered (`features`, from the host's codec: each block is offered only where\n * the field's stored shape has a place for it). Not in this catalogue, and why:\n * (none: every V2 block has a stored form now, plan RT0–RT8; each is offered only where the field's codec declares it)\n *\n * Components come from the host (KitServices.useInsertableComponents: the project's components, narrowed to the ones\n * the field's config accepts), handed in through CatalogComponentsProvider. Without that service none is offered.\n * Deviation from V2: the library has no inline / page-section placement, so every component sits in one\n * \"Components\" group (V2: \"Article\" and \"Page sections\"), and no live preview flyout is drawn beside a row.\n */\nimport * as React from \"react\";\nimport {\n IconChartBar, IconClick, IconCode, IconColumns2, IconNews, IconSuperscript, IconUserCircle, IconLayoutGrid, IconListCheck, IconListTree,\n IconArrowLeft, IconBlockquote, IconChevronLeft, IconChevronRight, IconComponents, IconFileText, IconH1, IconH2, IconH3, IconH4, IconH5, IconH6, IconInfoCircle, IconLayoutNavbarCollapse, IconList, IconListDetails, IconListNumbers, IconPhoto,\n IconPilcrow, IconQuote, IconSearch, IconSeparatorHorizontal, IconTable, IconTerminal2, IconVideo,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { AI_COMMANDS, useKitLook, type AiCommandKind } from \"../../context\";\nimport { PopoverContent } from \"../../ui/overlay\";\nimport type { RichTextFeature } from \"./codec\";\nimport type { KitInsertableComponent } from \"../component-services\";\nimport { SlashPreviewCard } from \"./slash-preview\";\n\nexport type BasicId =\n | \"p\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"quote\" | \"pullquote\" | \"callout\" | \"toggle\" | \"takeaways\" | \"ul\" | \"ol\" | \"code\" | \"hr\"\n | \"image\" | \"video\" | \"file\" | \"table\" | \"task\" | \"button\" | \"gallery\" | \"embed\" | \"toc\" | \"footnote\" | \"columns\" | \"related\" | \"author\" | \"stats\";\n\nexport interface CatalogItem {\n key: string;\n /** a basic block (absent on a component, the More components row and the way back) */\n id?: BasicId;\n /** component: embeds `component`; folder: opens More components; back: returns to every block */\n kind?: \"component\" | \"folder\" | \"back\" | \"ai\";\n /** look \"v16\": a \"BetterCMS AI\" command (the AI view's rows) */\n ai?: AiCommandKind;\n component?: KitInsertableComponent;\n /** the folder row's component count */\n count?: number;\n label: string;\n description: string;\n icon: React.ReactNode;\n /** extra words that find it */\n aliases?: string[];\n /** why it can't be picked here (a component this field refuses): shown in place of the description */\n disabled?: string;\n /** look \"v16\": what to type in the body to get it (\"##\", \"```\"), shown at the end of its row */\n hint?: string;\n}\n\nconst i = (I: React.ComponentType<{ stroke?: number }>) => <I stroke={1.5} />;\ntype Row = [BasicId, string, string, React.ReactNode, string[]?];\n/** The Markdown the editor turns into each block as it is typed (ops.ts liveMarkdown, enterCodeFence): the row's key hint. */\nconst HINTS: Partial<Record<BasicId, string>> = { h1: \"#\", h2: \"##\", h3: \"###\", h4: \"####\", h5: \"#####\", h6: \"######\", ul: \"-\", ol: \"1.\", quote: \">\", code: \"```\", hr: \"---\" };\nconst rows = (list: Row[]): CatalogItem[] => list.map(([id, label, description, icon, aliases]) => ({ key: id, id, label, description, icon, aliases, hint: HINTS[id] }));\n\nconst TEXT = rows([\n [\"p\", \"Text\", \"Plain body text\", i(IconPilcrow), [\"paragraph\", \"body\"]],\n [\"h2\", \"Heading 2\", \"Section heading\", i(IconH2), [\"title\", \"subtitle\"]],\n [\"h3\", \"Heading 3\", \"Subsection heading\", i(IconH3)],\n [\"h4\", \"Heading 4\", \"Minor heading\", i(IconH4)],\n [\"quote\", \"Quote\", \"A quoted passage\", i(IconBlockquote), [\"blockquote\"]],\n [\"pullquote\", \"Pull quote\", \"A highlighted line with who said it\", i(IconQuote), [\"pq\", \"testimonial\", \"attribution\"]],\n [\"ul\", \"List\", \"Bulleted list\", i(IconList), [\"bullets\", \"bulleted list\", \"unordered\"]],\n [\"ol\", \"Numbered list\", \"Ordered steps\", i(IconListNumbers), [\"ordered\", \"steps\"]],\n [\"toggle\", \"Toggle\", \"Collapsible title and body\", i(IconLayoutNavbarCollapse), [\"accordion\", \"details\", \"collapse\"]],\n [\"callout\", \"Callout\", \"A highlighted note with a tone\", i(IconInfoCircle), [\"note\", \"tip\", \"warning\", \"aside\"]],\n [\"takeaways\", \"Key takeaways\", \"The story in a few points\", i(IconListDetails), [\"summary\", \"tldr\", \"tl;dr\", \"highlights\"]],\n [\"hr\", \"Divider\", \"A line between parts\", i(IconSeparatorHorizontal), [\"line\", \"separator\", \"rule\"]],\n [\"code\", \"Code\", \"Monospaced snippet\", i(IconTerminal2), [\"code block\", \"snippet\", \"pre\"]],\n [\"footnote\", \"Footnote\", \"A numbered note at the end\", i(IconSuperscript), [\"fn\", \"reference\", \"citation\", \"source\"]],\n]);\nconst MEDIA = rows([\n [\"image\", \"Image\", \"Image with alt text and caption\", i(IconPhoto), [\"img\", \"picture\", \"photo\"]],\n [\"gallery\", \"Gallery\", \"Several images as a grid or carousel\", i(IconLayoutGrid), [\"images\", \"photos\", \"carousel\", \"slideshow\"]],\n [\"video\", \"Video\", \"A YouTube, Vimeo or video file link\", i(IconVideo), [\"mp4\", \"youtube\", \"yt\", \"vimeo\", \"clip\", \"movie\"]],\n [\"embed\", \"Embed\", \"YouTube, X, CodePen, Figma, maps or audio\", i(IconCode), [\"yt\", \"youtube\", \"vimeo\", \"x\", \"tweet\", \"twitter\", \"codepen\", \"figma\", \"map\", \"maps\", \"spotify\", \"podcast\", \"audio\", \"iframe\"]],\n [\"file\", \"File\", \"A downloadable PDF or file\", i(IconFileText), [\"pdf\", \"download\", \"attachment\"]],\n]);\n/** V2 catalog.tsx ARTICLE: article blocks written in the body itself (the rest land with plan RT6–RT8). */\nconst ARTICLE = rows([\n [\"related\", \"Related posts\", \"More stories, picked or automatic\", i(IconNews), [\"related stories\", \"read next\", \"more stories\"]],\n [\"toc\", \"Table of contents\", \"Built from the headings\", i(IconListTree), [\"contents\", \"outline\", \"index\"]],\n [\"author\", \"Author bio\", \"Photo, name and short bio\", i(IconUserCircle), [\"bio\", \"byline\", \"about the author\"]],\n]);\nconst DATA = rows([\n [\"table\", \"Table\", \"Rows and columns\", i(IconTable), [\"grid\", \"data\", \"comparison\", \"spreadsheet\"]],\n // prototype content.jsx:1266\n [\"stats\", \"Stats\", \"Big numbers in a row\", i(IconChartBar), [\"numbers\", \"metrics\", \"kpi\", \"figures\"]],\n]);\n/** Found by search, not listed: rare in a body (H1 is the page title). */\nconst SEARCH_ONLY = rows([\n [\"h1\", \"Heading 1\", \"Largest heading\", i(IconH1)],\n [\"h5\", \"Heading 5\", \"Smallest heading\", i(IconH5)],\n [\"h6\", \"Heading 6\", \"Eyebrow heading\", i(IconH6)],\n // V2 catalog.tsx:89, :91 (rare in a story, so found by search)\n [\"task\", \"Checklist\", \"To-do list with checkboxes\", i(IconListCheck), [\"todo\", \"checkbox\"]],\n [\"columns\", \"Columns\", \"Side by side text\", i(IconColumns2), [\"layout\"]],\n [\"button\", \"Button\", \"A call to action link\", i(IconClick), [\"link button\"]],\n]);\n\n/** The feature a block needs (Text needs none). */\nconst NEEDS: Record<BasicId, RichTextFeature | null> = {\n p: null, h1: \"h1\", h2: \"h2\", h3: \"h3\", h4: \"h4\", h5: \"h5\", h6: \"h6\", quote: \"blockquote\", ul: \"ul\", ol: \"ol\", code: \"pre\", hr: \"hr\", image: \"image\",\n pullquote: \"pullquote\", takeaways: \"takeaways\", callout: \"callout\", toggle: \"toggle\", video: \"video\", file: \"file\", table: \"table\",\n task: \"checklist\", button: \"button\", gallery: \"gallery\", embed: \"embed\", toc: \"toc\",\n footnote: \"footnote\", columns: \"columns\", related: \"related\", author: \"author\", stats: \"stats\",\n};\nconst MORE: CatalogItem = { key: \"more\", kind: \"folder\", label: \"More blocks\", description: \"Shared across your site\", icon: i(IconComponents) };\nconst BACK: CatalogItem = { key: \"back\", kind: \"back\", label: \"All blocks\", description: \"\", icon: i(IconArrowLeft) };\n/* Look \"v16\" AI icons (prototype content.jsx:52-62 AIP): every stroke is its own path, so each part moves on its own\n when the row is highlighted (kit.css `.kit-aii`). */\nconst AI_PATHS: Record<AiCommandKind | \"ai\", [string, string][]> = {\n ai: [[\"star\", \"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z\"], [\"p1\", \"M20 3v4M22 5h-4\"], [\"p2\", \"M4 17v2M5 18H3\"]],\n prompt: [[\"pen\", \"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854zM15 5l3 3\"], [\"ul\", \"M12 20h9\"]],\n continue: [[\"l\", \"M3 6h18M3 12h12\"], [\"l3\", \"M3 18h8\"], [\"arr\", \"M14 18h7M18 15l3 3-3 3\"]],\n improve: [[\"wand\", \"M21.64 3.64l-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72M14 7l3 3\"], [\"s1\", \"M5 6v4M7 8H3\"], [\"s2\", \"M19 14v4M21 16h-4\"], [\"s3\", \"M10 2v2M11 3H9\"]],\n shorter: [[\"tr\", \"M14 10l7-7M20 10h-6V4\"], [\"bl\", \"M3 21l7-7M4 14h6v6\"]],\n summarize: [[\"l1\", \"M3 5h11\"], [\"l2\", \"M3 10h11\"], [\"l3\", \"M3 15h7\"], [\"l4\", \"M3 20h5\"], [\"arr\", \"M18 9v11M15 17l3 3 3-3\"]],\n translate: [[\"g\", \"M5 8l6 6M4 14l6-6 2-3M2 5h12M7 2h1\"], [\"a\", \"M22 22l-5-10-5 10M14 18h6\"]],\n spelling: [[\"a\", \"M6 16l6-12 6 12M8 12h8\"], [\"ck\", \"M16 20l2 2 4-4\"]],\n};\nconst DRAWN = new Set([\"ul\", \"l3\", \"ck\"]);\nconst AiIcon = ({ n }: { n: AiCommandKind | \"ai\" }) => (\n <svg className={`kit-aii kit-aii-${n}`} width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n {AI_PATHS[n].map(([c, d]) => (\n <path key={c} className={c} d={d} pathLength={DRAWN.has(c) ? 1 : undefined} />\n ))}\n </svg>\n);\n/** The slash menu's Featured row: opens the AI view. */\nconst AI_ROW: CatalogItem = { key: \"ai\", kind: \"ai\", label: \"BetterCMS AI\", description: \"Write and edit with AI\", icon: <AiIcon n=\"ai\" />, aliases: [\"ai\", \"write\", \"assistant\"] };\nconst AI_ITEMS: CatalogItem[] = AI_COMMANDS.map((c) => ({ key: `ai:${c.id}`, ai: c.id, label: c.label, description: c.description, icon: <AiIcon n={c.id} /> }));\nconst componentRow = (c: KitInsertableComponent): CatalogItem => ({\n key: `c:${c.id}`,\n kind: \"component\",\n component: c,\n label: c.name,\n description: c.disabled || c.description || \"Shared across your site\",\n icon: c.thumb ? <img src={c.thumb} alt=\"\" loading=\"lazy\" className=\"size-full rounded-[inherit] object-cover\" /> : i(IconComponents),\n ...(c.disabled ? { disabled: c.disabled } : {}),\n});\n\n/** The components this field may embed, as the host answered (KitServices.useInsertableComponents). */\nexport interface CatalogComponents {\n components: KitInsertableComponent[];\n loading?: boolean;\n error?: string;\n}\nconst ComponentsContext = React.createContext<CatalogComponents | null>(null);\nexport const CatalogComponentsProvider = ComponentsContext.Provider;\n/** The components this field may embed (a component card's Swap component). */\nexport const useCatalogComponents = () => React.useContext(ComponentsContext);\n\nexport const blockAllowed = (id: BasicId, allows: (f: RichTextFeature) => boolean) => {\n const need = NEEDS[id];\n return !need || allows(need);\n};\n\n/* ── Recently used (per person, CPO D55): this browser's storage; a browser that keeps none just has no recents ── */\nconst RECENTS_KEY = \"kit-rt-insert-recents\";\nlet recents: string[] = (() => {\n try {\n const v = JSON.parse(globalThis.localStorage?.getItem(RECENTS_KEY) ?? \"[]\") as unknown;\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : [];\n } catch {\n return [];\n }\n})();\nconst recentSubs = new Set<() => void>();\n/** Remember a pick so search ranks it first next time. */\nexport function noteRecent(it: CatalogItem) {\n recents = [it.key, ...recents.filter((k) => k !== it.key)].slice(0, 12);\n try {\n globalThis.localStorage?.setItem(RECENTS_KEY, JSON.stringify(recents));\n } catch {\n /* storage is off: recents last for this session */\n }\n recentSubs.forEach((s) => s());\n}\nfunction useRecents() {\n return React.useSyncExternalStore(\n (cb) => {\n recentSubs.add(cb);\n return () => recentSubs.delete(cb);\n },\n () => recents,\n () => recents,\n );\n}\n\nexport interface CatalogSection {\n title: string | null;\n items: CatalogItem[];\n}\n\n/** 5 exact (label, id or alias) · 4 label or alias starts with it · 3 a word of the label starts with it · 2 inside the\n * label · 1 the description. */\nconst score = (q: string, it: CatalogItem) => {\n const l = it.label.toLowerCase();\n const al = it.aliases ?? [];\n if (l === q || it.id === q || al.includes(q)) return 5;\n if (l.startsWith(q) || al.some((a) => a.startsWith(q))) return 4;\n if (l.split(/[\\s-]+/).some((w) => w.startsWith(q))) return 3;\n if (l.includes(q)) return 2;\n return it.description.toLowerCase().includes(q) ? 1 : 0;\n};\n/**\n * Ranked by match, then by recently used among blocks the query names EXACTLY (label, id or alias), then catalogue\n * order. Recency used to outrank the match itself, so \"/heading\" took the H3 used last over Heading 2, \"/list\" the\n * numbered list over List, and \"/image\" a gallery over Image.\n */\nconst rank = (q: string, list: CatalogItem[], recent: string[]) =>\n list\n .map((it, i) => {\n const s = score(q, it);\n const r = recent.indexOf(it.key);\n return { it, s, r: s === 5 && r >= 0 ? r : 999, i };\n })\n .filter((x) => x.s > 0)\n .sort((a, b) => b.s - a.s || a.r - b.r || a.i - b.i)\n .map((x) => x.it);\n\n/**\n * `folder`: the More components view (its way back first, then the components, searched by `query`).\n * `aiOffered`: the \"BetterCMS AI\" Featured row leads the list (look \"v16\", the host has an AI command service);\n * `aiView`: its view (the way back, then the seven commands).\n */\nexport function useCatalog(query: string, allows: (f: RichTextFeature) => boolean, folder = false, own?: CatalogComponents | null, aiOffered = false, aiView = false) {\n const recent = useRecents();\n const provided = React.useContext(ComponentsContext);\n // the editor reads its own list (it renders the provider, so cannot read it)\n const lib = own === undefined ? provided : own;\n return React.useMemo(() => {\n const q = query.trim().toLowerCase().replace(/^\\//, \"\");\n const keep = (list: CatalogItem[]) => list.filter((it) => !it.id || blockAllowed(it.id, allows));\n const comps = (lib?.components ?? []).map(componentRow);\n // the folder counts what can go in; a refused component is listed inside with its reason\n const pickable = comps.filter((c) => !c.disabled).length;\n let sections: CatalogSection[];\n let noMatch = false;\n let emptyText = \"No match.\";\n if (aiView) sections = [{ title: null, items: [BACK] }, { title: \"BetterCMS AI\", items: AI_ITEMS }];\n else if (folder) {\n const found = q ? rank(q, comps, recent) : comps;\n noMatch = !!q && !!comps.length && !found.length;\n if (!comps.length) emptyText = lib?.error ?? (lib?.loading ? \"Loading blocks…\" : \"This field takes no blocks.\");\n sections = [{ title: null, items: [BACK] }, { title: \"Blocks\", items: found }];\n } else if (q) {\n const found = rank(q, [...(aiOffered ? [AI_ROW] : []), ...keep(TEXT), ...keep(MEDIA), ...keep(DATA), ...keep(ARTICLE), ...keep(SEARCH_ONLY), ...comps], recent);\n noMatch = !found.length;\n sections = [{ title: null, items: found }];\n } else\n sections = [\n { title: \"Featured\", items: aiOffered ? [AI_ROW] : [] },\n { title: \"Text\", items: keep(TEXT) },\n { title: \"Media\", items: keep(MEDIA) },\n { title: \"Data\", items: keep(DATA) },\n { title: \"Article\", items: keep(ARTICLE) },\n // offered while the list loads or failed too: opening it says which\n { title: null, items: lib && (comps.length || lib.loading || lib.error) ? [{ ...MORE, ...(pickable ? { count: pickable } : {}) }] : [] },\n ];\n sections = sections.filter((s) => s.items.length);\n const flat = sections.flatMap((s) => s.items);\n const empty = !flat.some((it) => it.kind !== \"back\");\n return { sections, flat, empty, noMatch, emptyText };\n }, [query, allows, recent, lib, folder, aiOffered, aiView]);\n}\n\n/* ── The list ───────────────────────────────────────────────────────────\n * Browsing: compact one-line rows (icon · name), grouped. Search results add the one-line description. */\nexport function CatalogList({\n sections,\n flat,\n active,\n onHover,\n onPick,\n empty,\n emptyText = \"No match.\",\n noMatch,\n detail,\n listId,\n className,\n query,\n}: {\n sections: CatalogSection[];\n flat: CatalogItem[];\n active: number;\n onHover: (i: number) => void;\n onPick: (it: CatalogItem) => void;\n empty: boolean;\n /** what an empty list says (\"No match.\", or why More components has none) */\n emptyText?: string;\n noMatch?: boolean;\n /** show each row's description (search results, More components) */\n detail?: boolean;\n listId: string;\n className?: string;\n /** look \"v16\": the search text, echoed in the empty line (Nothing matches “…”) */\n query?: string;\n}) {\n const v16 = useKitLook() === \"v16\";\n const box = React.useRef<HTMLDivElement>(null);\n React.useEffect(() => {\n // scroll only the list (scrollIntoView would also scroll the page behind a floating menu)\n const b = box.current;\n const row = b?.querySelector<HTMLElement>(`[data-idx=\"${active}\"]`);\n if (!b || !row) return;\n if (row.offsetTop < b.scrollTop) b.scrollTop = row.offsetTop - 6;\n else if (row.offsetTop + row.offsetHeight > b.scrollTop + b.clientHeight) b.scrollTop = row.offsetTop + row.offsetHeight - b.clientHeight + 6;\n }, [active]);\n return (\n <div ref={box} id={listId} role=\"listbox\" aria-label=\"Blocks\" className={cn(\"relative overflow-y-auto\", v16 ? \"max-h-[344px] px-1 pb-1 [scrollbar-width:thin]\" : \"max-h-[320px] p-1.5\", className)}>\n {noMatch ? <div className={v16 ? \"px-2 py-3 text-[13px] text-kit-group-sub\" : \"px-2 pb-1 pt-1.5 text-kit-sm text-kit-fg-3\"}>{v16 && query?.trim() ? `Nothing matches “${query.trim()}”` : \"No match.\"}</div> : null}\n {sections.map((s, si) => (\n <div\n key={s.title ?? `s${si}`}\n role=\"group\"\n aria-label={s.title ?? undefined}\n className={cn(!s.title && si > 0 && s.items[0]?.kind === \"folder\" && \"mt-1.5 border-t border-kit-line-subtle pt-1.5\")}\n >\n {s.title ? <div className={v16 ? \"px-2 pb-1 pt-2.5 text-[11px] font-medium leading-4 text-kit-group-sub\" : \"px-2 pb-0.5 pt-2 text-kit-2xs font-medium text-kit-fg-3\"}>{s.title}</div> : null}\n {s.items.map((it) => {\n const idx = flat.indexOf(it);\n const on = idx === active;\n const desc = detail && it.kind !== \"back\" && it.kind !== \"folder\" ? it.description : \"\";\n /* Look \"v16\" (prototype content.jsx:1246-1251, content.css:242-244, 279-283): every row is 44 high with a 32\n white tile, a 13/18 medium title over its 12/16 description, and the key hint or a chevron at the end;\n the way back is a 32 high \"Back to all blocks\" line. */\n if (v16) {\n const common = {\n type: \"button\" as const,\n role: \"option\" as const,\n \"aria-selected\": on,\n \"aria-disabled\": it.disabled ? true : undefined,\n \"data-idx\": idx,\n id: `${listId}-${idx}`,\n onMouseDown: (e: React.MouseEvent) => e.preventDefault(),\n onMouseMove: () => !on && onHover(idx),\n onClick: () => !it.disabled && onPick(it),\n };\n if (it.kind === \"back\")\n return (\n <button key={it.key} {...common} className={cn(\"mt-1 flex h-8 w-full items-center gap-1.5 rounded-[6px] px-2 text-left text-[12px] font-medium text-kit-insp-tip-body\", on && \"bg-kit-insp-card\")}>\n <IconChevronLeft aria-hidden className=\"size-3.5 shrink-0\" stroke={1.8} />\n Back to all blocks\n </button>\n );\n return (\n <button key={it.key} {...common} className={cn(\"flex h-11 w-full items-center gap-2.5 rounded-[6px] px-1.5 text-left\", on && \"bg-kit-insp-card\", it.disabled && \"cursor-default opacity-60\")}>\n <span className=\"grid size-8 shrink-0 place-items-center overflow-hidden rounded-[6px] bg-kit-insp-tip-bg text-kit-insp-tip-body shadow-[inset_0_0_0_1px_var(--kit-insp-line)] [&_svg]:size-4\">{it.icon}</span>\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <b className=\"truncate text-[13px] font-medium leading-[18px] text-kit-insp-tip-title\">{it.label}</b>\n {it.description ? <small className=\"truncate text-[12px] leading-4 text-kit-group-sub\">{it.description}</small> : null}\n </span>\n {it.count != null ? <span className=\"text-[12px] leading-4 tabular-nums text-kit-group-sub\">{it.count}</span> : null}\n {it.kind === \"folder\" || it.kind === \"ai\" ? (\n <IconChevronRight aria-hidden className=\"size-3.5 shrink-0 text-kit-insp-faint\" stroke={1.8} />\n ) : it.hint ? (\n <kbd className=\"shrink-0 font-kit-sans text-[12px] leading-4 text-kit-group-sub\">{it.hint}</kbd>\n ) : null}\n </button>\n );\n }\n return (\n <button\n key={it.key}\n type=\"button\"\n role=\"option\"\n aria-selected={on}\n aria-disabled={it.disabled ? true : undefined}\n aria-description={!desc && it.description ? it.description : undefined}\n data-idx={idx}\n id={`${listId}-${idx}`}\n onMouseDown={(e) => e.preventDefault()}\n onMouseMove={() => !on && onHover(idx)}\n onClick={() => !it.disabled && onPick(it)}\n className={cn(\n \"flex w-full items-center gap-2 rounded-kit-md px-2 text-left transition-colors motion-reduce:transition-none\",\n desc ? \"py-1.5\" : \"h-8\",\n it.kind === \"back\" ? \"text-kit-fg-2\" : it.disabled ? \"cursor-default text-kit-fg-3\" : \"text-kit-fg\",\n on && \"bg-kit-hover text-kit-fg\",\n )}\n >\n <span className={cn(\"flex shrink-0 items-center justify-center text-kit-fg-2 [&_svg]:size-4\", desc ? \"size-7 rounded-kit-md border border-kit-line bg-kit-control-bg\" : \"size-5\")}>\n {it.icon}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-kit-sm\">{it.label}</span>\n {desc ? <span className=\"block truncate text-kit-xs text-kit-fg-3\">{desc}</span> : null}\n </span>\n {it.count != null ? <span className=\"text-kit-2xs tabular-nums text-kit-fg-3\">{it.count}</span> : null}\n {it.kind === \"folder\" ? <IconChevronRight className=\"size-3.5 shrink-0 text-kit-fg-3\" stroke={1.5} aria-hidden /> : null}\n </button>\n );\n })}\n </div>\n ))}\n {/* a search with no result says \"No match.\" once, in the line above (V2 catalog.tsx:263) */}\n {empty && !noMatch ? <div className={v16 ? \"px-2 py-3 text-[13px] text-kit-group-sub\" : \"px-2 py-6 text-center text-kit-sm text-kit-fg-3\"}>{emptyText}</div> : null}\n </div>\n );\n}\n\nconst Footer = () => (\n <div data-hint=\"shortcuts\" className=\"flex h-7 shrink-0 items-center border-t border-kit-line px-3 text-kit-2xs text-kit-fg-3\">\n <span>\n <kbd className=\"font-kit-sans\">↵</kbd> select · type to search\n </span>\n </div>\n);\n\n/** Shared keyboard model: ↑↓ wrap, Home/End, Enter / Tab, → into More components. Returns true when handled. */\nexport function catalogKey(\n e: React.KeyboardEvent | KeyboardEvent,\n flat: CatalogItem[],\n active: number,\n setActive: (i: number) => void,\n pick: (it: CatalogItem) => void,\n homeEnd = true,\n) {\n const n = flat.length;\n if (!n) return false;\n if (e.key === \"ArrowDown\") return setActive((active + 1) % n), true;\n if (e.key === \"ArrowUp\") return setActive((active - 1 + n) % n), true;\n if (homeEnd && e.key === \"Home\") return setActive(0), true;\n if (homeEnd && e.key === \"End\") return setActive(n - 1), true;\n if (e.key === \"ArrowRight\" && (flat[active]?.kind === \"folder\" || flat[active]?.kind === \"ai\")) return pick(flat[active]), true;\n if (e.key === \"Enter\" || e.key === \"Tab\") {\n const it = flat[active];\n if (it && !it.disabled) pick(it);\n return true;\n }\n return false;\n}\n\n/* ── Insert menu (popover content for the toolbar \"Insert\" and the gutter \"+\") ─ */\nexport function InsertMenuContent({\n onInsert,\n allows,\n keepFocusOnClose,\n align = \"start\",\n side = \"bottom\",\n}: {\n onInsert: (it: CatalogItem) => void;\n allows: (f: RichTextFeature) => boolean;\n /** after an insert the caret stays in the editor: the menu gives no focus back to its trigger */\n keepFocusOnClose?: () => boolean;\n align?: \"start\" | \"center\" | \"end\";\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n}) {\n const [q, setQ] = React.useState(\"\");\n const [active, setActive] = React.useState(0);\n const input = React.useRef<HTMLInputElement>(null);\n const listId = React.useId();\n const [folder, setFolder] = React.useState(false);\n const { sections, flat, empty, emptyText, noMatch } = useCatalog(q, allows, folder);\n const v16 = useKitLook() === \"v16\";\n /* look v16 (prototype content.jsx:1268-1300, content.css:482): the site's blocks open in a 300 wide panel beside the\n 280 menu (hover or → on the row, ← or Esc closes it) instead of replacing the list */\n const [sideOpen, setSideOpen] = React.useState(false);\n /* the side panel opens to the left when it would cross the window's right edge (prototype content.jsx:1273-1274,\n content.css:588 .ce-ins.flip): measured as it mounts, before paint */\n const [sideFlip, setSideFlip] = React.useState(false);\n const sideRef = React.useCallback((el: HTMLDivElement | null) => {\n const menu = el?.parentElement;\n if (!menu) return;\n setSideFlip(menu.getBoundingClientRect().right + 6 + 300 > window.innerWidth - 8);\n }, []);\n const [sActive, setSActive] = React.useState(0);\n const sideCat = useCatalog(\"\", allows, true);\n const sideFlat = sideCat.flat.filter((it) => it.kind !== \"back\");\n const sideId = React.useId();\n const useSide = v16 && !q;\n // in More components the first row is the way back: the first component starts active\n React.useEffect(() => setActive(folder && flat.length > 1 ? 1 : 0), [q, folder]); // eslint-disable-line react-hooks/exhaustive-deps\n const leave = () => {\n setFolder(false);\n setQ(\"\");\n input.current?.focus();\n };\n const pick = (it: CatalogItem) => {\n if (it.kind === \"folder\" && useSide) {\n setSideOpen(true);\n setSActive(0);\n } else if (it.kind === \"folder\") {\n setFolder(true);\n setQ(\"\");\n input.current?.focus();\n } else if (it.kind === \"back\") leave();\n else onInsert(it);\n };\n return (\n <PopoverContent\n side={side}\n align={align}\n className={v16 ? \"relative flex max-h-[420px] w-[280px] flex-col rounded-[10px] !border-0 !bg-kit-insp-tip-bg p-0 !shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_12px_28px_rgb(0_0_0/0.12)] ![backdrop-filter:none]\" : \"flex max-h-[420px] w-[320px] flex-col overflow-hidden p-0\"}\n initialFocus={input}\n finalFocus={keepFocusOnClose ? () => !keepFocusOnClose() : undefined}\n // Esc in More components steps back to every block, wherever focus sits in the menu (the list scrolls, so the\n // browser can focus it): caught before the popover's own Esc, which would close it\n onKeyDownCapture={(e) => {\n if (useSide && sideOpen && e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n setSideOpen(false);\n return;\n }\n if (!folder || e.key !== \"Escape\") return;\n e.preventDefault();\n e.stopPropagation();\n leave();\n }}\n >\n <div className={cn(\"flex h-10 shrink-0 items-center gap-2 border-b px-3\", v16 ? \"border-kit-insp-divider\" : \"border-kit-line\")}>\n <IconSearch className={v16 ? \"size-3.5 shrink-0 text-kit-group-sub\" : \"size-4 shrink-0 text-kit-fg-3\"} stroke={v16 ? 1.8 : 1.5} aria-hidden />\n <input\n ref={input}\n value={q}\n onChange={(e) => setQ(e.target.value)}\n onKeyDown={(e) => {\n if (useSide && sideOpen) {\n if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n setSideOpen(false);\n } else if (catalogKey(e, sideFlat, sActive, setSActive, pick, true)) e.preventDefault();\n return;\n }\n if (useSide && e.key === \"ArrowRight\" && flat[active]?.kind === \"folder\") {\n e.preventDefault();\n setSideOpen(true);\n setSActive(0);\n return;\n }\n if (folder && e.key === \"Backspace\" && !q) {\n // ⌫ in an empty search steps back to every block (Esc: the popup's capture above)\n e.preventDefault();\n e.stopPropagation();\n leave();\n } else if (catalogKey(e, flat, active, setActive, pick, !q)) e.preventDefault();\n }}\n role=\"combobox\"\n aria-expanded\n aria-controls={listId}\n aria-activedescendant={flat.length ? `${listId}-${active}` : undefined}\n aria-label={folder ? \"Search blocks\" : \"Search or pick a block\"}\n placeholder={folder ? \"Search blocks\" : \"Search or pick a block\"}\n className=\"h-full min-w-0 flex-1 bg-transparent text-kit-sm text-kit-fg outline-none placeholder:text-kit-fg-3 focus-visible:shadow-none\"\n />\n </div>\n <CatalogList\n sections={sections}\n flat={flat}\n active={active}\n onHover={(i: number) => {\n setActive(i);\n if (useSide) setSideOpen(flat[i]?.kind === \"folder\");\n }}\n onPick={pick}\n empty={empty}\n emptyText={emptyText}\n noMatch={noMatch}\n detail={!!q || folder}\n listId={listId}\n query={q}\n className=\"min-h-0 flex-1\"\n />\n {v16 ? null : <Footer />}\n {useSide && sideOpen ? (\n <div\n ref={sideRef}\n role=\"menu\"\n aria-label=\"Blocks for this site\"\n className={cn(\n \"absolute top-0 flex max-h-[420px] w-[300px] flex-col overflow-hidden rounded-[10px] bg-kit-insp-tip-bg shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_12px_28px_rgb(0_0_0/0.12)] motion-safe:animate-[kit-fade-in_150ms_ease-out]\",\n sideFlip ? \"right-full mr-1.5\" : \"left-full ml-1.5\",\n )}\n >\n <CatalogList\n sections={[{ title: \"Blocks for this site\", items: sideFlat }]}\n flat={sideFlat}\n active={sActive}\n onHover={setSActive}\n onPick={pick}\n empty={!sideFlat.length}\n emptyText={sideCat.emptyText}\n detail\n listId={sideId}\n className=\"min-h-0 flex-1\"\n />\n </div>\n ) : null}\n </PopoverContent>\n );\n}\n\n/* ── Slash menu panel (positioned by the editor; never takes focus) ── */\nexport function SlashMenuPanel({\n query,\n folder = false,\n active,\n setActive,\n onPick,\n allows,\n maxHeight,\n aiOffered = false,\n aiView = false,\n}: {\n /** look \"v16\": the \"BetterCMS AI\" Featured row is offered (the host has an AI command service) */\n aiOffered?: boolean;\n /** look \"v16\": the AI view (the editor keeps it with the rest of the slash state) */\n aiView?: boolean;\n /** the room the editor found for the menu (collision-aware); the list scrolls inside it */\n maxHeight?: number;\n query: string;\n /** the More components view (the editor keeps it with the rest of the slash state) */\n folder?: boolean;\n active: number;\n setActive: (i: number) => void;\n onPick: (it: CatalogItem) => void;\n allows: (f: RichTextFeature) => boolean;\n}) {\n const listId = React.useId();\n const { sections, flat, empty, emptyText, noMatch } = useCatalog(query, allows, folder, undefined, aiOffered, aiView);\n const v16 = useKitLook() === \"v16\";\n const panelRef = React.useRef<HTMLDivElement>(null);\n const [pvTop, setPvTop] = React.useState(0);\n // the preview card stands level with the highlighted row (prototype content.jsx:1240: row top - menu top - 6)\n React.useLayoutEffect(() => {\n if (!v16) return;\n const panel = panelRef.current;\n const row = panel?.querySelector<HTMLElement>(`[data-idx=\"${active}\"]`);\n if (!panel || !row) return;\n setPvTop(Math.max(0, Math.round(row.getBoundingClientRect().top - panel.getBoundingClientRect().top - 6)));\n }, [v16, active, query, folder, aiView]);\n /* Look \"v16\" (prototype content.jsx:1243-1252, content.css:236-241): 300 wide, white, radius 10; a 40 high line with\n a search glyph and what was typed (or \"Search or pick a block\"); 44 high rows; no footer; the hover preview card\n (F2107) 6px to the right. */\n if (v16)\n return (\n <div data-kit-scope=\"\" className=\"relative w-[300px]\" onMouseDown={(e) => e.preventDefault()}>\n <div\n ref={panelRef}\n className=\"flex w-[300px] flex-col overflow-hidden rounded-[10px] bg-kit-insp-tip-bg shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_12px_28px_rgb(0_0_0/0.12)]\"\n style={maxHeight ? { maxHeight } : undefined}\n >\n <div className=\"flex h-10 shrink-0 items-center gap-2 border-b border-kit-insp-divider px-3 text-[13px]\">\n <IconSearch aria-hidden className=\"size-3.5 shrink-0 text-kit-group-sub\" stroke={1.8} />\n {query ? <b className=\"min-w-0 flex-1 truncate font-normal text-kit-insp-tip-title\">{query}</b> : <span className=\"min-w-0 flex-1 truncate text-kit-group-sub\">{folder ? \"Search blocks\" : \"Search or pick a block\"}</span>}\n </div>\n <CatalogList sections={sections} flat={flat} active={active} onHover={setActive} onPick={onPick} empty={empty} emptyText={emptyText} noMatch={noMatch} detail listId={listId} query={query} className=\"min-h-0 flex-1\" />\n </div>\n <SlashPreviewCard item={flat[active]} top={pvTop} />\n </div>\n );\n return (\n <div\n data-kit-scope=\"\"\n className=\"glass-strong flex w-[320px] flex-col overflow-hidden rounded-kit-xl border border-kit-line\"\n style={maxHeight ? { maxHeight } : undefined}\n onMouseDown={(e) => e.preventDefault()}\n >\n <div className=\"flex h-8 shrink-0 items-center gap-2 border-b border-kit-line px-3 text-kit-sm\">\n <span className={cn(\"flex-1 truncate\", query ? \"text-kit-fg\" : \"text-kit-fg-3\")}>{query ? `${folder ? \"More blocks · \" : \"\"}/${query}` : folder ? \"More blocks\" : \"Type to search\"}</span>\n <kbd data-hint=\"shortcuts\" className=\"font-kit-sans text-kit-2xs text-kit-fg-3\">\n esc\n </kbd>\n </div>\n <CatalogList\n sections={sections}\n flat={flat}\n active={active}\n onHover={setActive}\n onPick={onPick}\n empty={empty}\n emptyText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,UAAA,CACE,oBAAC,QAAD;KAAM,WAAW,GAAG,mBAAmB,QAAQ,gBAAgB,eAAe;KAAI,UAAA,QAAQ,GAAG,SAAS,mBAAmB,GAAG,GAAG,UAAU,SAAS,gBAAgB;IAAuB,CAAA,GACzL,oBAAC,OAAD;KAAK,aAAU;KAAY,WAAU;KAA2C,UAAA;IAE3E,CAAA,CACF;;GACL,oBAAC,aAAD;IACY;IACJ;IACE;IACR,SAAS;IACD;IACD;IACI;IACF;IACT,QAAQ,CAAC,CAAC,SAAS;IACX;IACR,WAAU;GACX,CAAA;GACD,oBAAC,QAAD,CAAS,CAAA;EACN;;AAET"}
|
|
1
|
+
{"version":3,"file":"catalog.js","names":[],"sources":["../../../src/controls/rich-text/catalog.tsx"],"sourcesContent":["/**\n * RICH TEXT · the block catalogue shared by the toolbar Insert menu, the gutter \"+\" and the \"/\" slash menu (V2 HEAD\n * controls/rich-text/catalog.tsx, CPO D55).\n *\n * browse Text · Media · Data, grouped, then one quiet \"More components N\" row that opens the components the\n * field may embed (V2 HEAD catalog.tsx MORE), with its own search and a way back (\"All blocks\")\n * search every block and every embeddable component in one list: recently used first among the strong matches,\n * then by match (label, aliases, then description)\n * no match \"No match.\"\n *\n * Only the blocks the field accepts are offered (`features`, from the host's codec: each block is offered only where\n * the field's stored shape has a place for it). Not in this catalogue, and why:\n * (none: every V2 block has a stored form now, plan RT0–RT8; each is offered only where the field's codec declares it)\n *\n * Components come from the host (KitServices.useInsertableComponents: the project's components, narrowed to the ones\n * the field's config accepts), handed in through CatalogComponentsProvider. Without that service none is offered.\n * Deviation from V2: the library has no inline / page-section placement, so every component sits in one\n * \"Components\" group (V2: \"Article\" and \"Page sections\"), and no live preview flyout is drawn beside a row.\n */\nimport * as React from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport {\n IconChartBar, IconClick, IconCode, IconColumns2, IconNews, IconSuperscript, IconUserCircle, IconLayoutGrid, IconListCheck, IconListTree,\n IconArrowLeft, IconBlockquote, IconChevronLeft, IconChevronRight, IconComponents, IconFileText, IconH1, IconH2, IconH3, IconH4, IconH5, IconH6, IconInfoCircle, IconLayoutNavbarCollapse, IconList, IconListDetails, IconListNumbers, IconPhoto,\n IconPilcrow, IconQuote, IconSearch, IconSeparatorHorizontal, IconTable, IconTerminal2, IconVideo,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { AI_COMMANDS, useKitLook, useKitServices, type AiCommandKind } from \"../../context\";\nimport { PopoverContent } from \"../../ui/overlay\";\nimport { platformKeys } from \"../../ui/shortcut-hint\";\nimport type { RichTextFeature } from \"./codec\";\nimport type { KitInsertableComponent } from \"../component-services\";\nimport { SlashPreviewCard } from \"./slash-preview\";\nimport { useKitReducedMotion } from \"../../lib/reduced-motion\";\n\nexport type BasicId =\n | \"p\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"quote\" | \"pullquote\" | \"callout\" | \"toggle\" | \"takeaways\" | \"ul\" | \"ol\" | \"code\" | \"hr\"\n | \"image\" | \"video\" | \"file\" | \"table\" | \"task\" | \"button\" | \"gallery\" | \"embed\" | \"toc\" | \"footnote\" | \"columns\" | \"related\" | \"author\" | \"stats\";\n\nexport interface CatalogItem {\n key: string;\n /** a basic block (absent on a component, the More components row and the way back) */\n id?: BasicId;\n /** component: embeds `component`; folder: opens More components; back: returns to every block */\n kind?: \"component\" | \"folder\" | \"back\" | \"ai\";\n /** look \"v16\": a \"BetterCMS AI\" command (the AI view's rows) */\n ai?: AiCommandKind;\n component?: KitInsertableComponent;\n /** the folder row's component count */\n count?: number;\n label: string;\n description: string;\n icon: React.ReactNode;\n /** extra words that find it */\n aliases?: string[];\n /** why it can't be picked here (a component this field refuses): shown in place of the description */\n disabled?: string;\n /** look \"v16\": what to type in the body to get it (\"##\", \"```\"), shown at the end of its row */\n hint?: string;\n}\n\nconst i = (I: React.ComponentType<{ stroke?: number }>) => <I stroke={1.5} />;\ntype Row = [BasicId, string, string, React.ReactNode, string[]?];\n/** The Markdown the editor turns into each block as it is typed (ops.ts liveMarkdown, enterCodeFence), or the key that\n * makes it: the row's key hint. Only shortcuts the editor really has: \"[] \" (checklist.tsx checklistShortcut, when the\n * field allows a checklist; the row is listed only then) and ⌘⌥0 (editor.tsx onKeyDown Digit0, always a paragraph). */\nconst HINTS: Partial<Record<BasicId, string>> = { p: \"⌘⌥0\", h1: \"#\", h2: \"##\", h3: \"###\", h4: \"####\", h5: \"#####\", h6: \"######\", ul: \"-\", ol: \"1.\", quote: \">\", code: \"```\", hr: \"---\", task: \"[]\" };\n/** A key hint as this platform writes it (\"⌘⌥0\" → \"Ctrl+Alt+0\" off Apple; Markdown hints are unchanged). */\nexport const hintText = (hint: string) => platformKeys(hint);\nconst rows = (list: Row[]): CatalogItem[] => list.map(([id, label, description, icon, aliases]) => ({ key: id, id, label, description, icon, aliases, hint: HINTS[id] }));\n\nconst TEXT = rows([\n [\"p\", \"Text\", \"Plain body text\", i(IconPilcrow), [\"paragraph\", \"body\"]],\n [\"h2\", \"Heading 2\", \"Section heading\", i(IconH2), [\"title\", \"subtitle\"]],\n [\"h3\", \"Heading 3\", \"Subsection heading\", i(IconH3)],\n [\"h4\", \"Heading 4\", \"Minor heading\", i(IconH4)],\n [\"quote\", \"Quote\", \"A quoted passage\", i(IconBlockquote), [\"blockquote\"]],\n [\"pullquote\", \"Pull quote\", \"A highlighted line with who said it\", i(IconQuote), [\"pq\", \"testimonial\", \"attribution\"]],\n [\"ul\", \"List\", \"Bulleted list\", i(IconList), [\"bullets\", \"bulleted list\", \"unordered\"]],\n [\"ol\", \"Numbered list\", \"Ordered steps\", i(IconListNumbers), [\"ordered\", \"steps\"]],\n [\"toggle\", \"Toggle\", \"Collapsible title and body\", i(IconLayoutNavbarCollapse), [\"accordion\", \"details\", \"collapse\"]],\n [\"callout\", \"Callout\", \"A highlighted note with a tone\", i(IconInfoCircle), [\"note\", \"tip\", \"warning\", \"aside\"]],\n [\"takeaways\", \"Key takeaways\", \"The story in a few points\", i(IconListDetails), [\"summary\", \"tldr\", \"tl;dr\", \"highlights\"]],\n [\"hr\", \"Divider\", \"A line between parts\", i(IconSeparatorHorizontal), [\"line\", \"separator\", \"rule\"]],\n [\"code\", \"Code\", \"Monospaced snippet\", i(IconTerminal2), [\"code block\", \"snippet\", \"pre\"]],\n [\"footnote\", \"Footnote\", \"A numbered note at the end\", i(IconSuperscript), [\"fn\", \"reference\", \"citation\", \"source\"]],\n]);\nconst MEDIA = rows([\n [\"image\", \"Image\", \"Image with alt text and caption\", i(IconPhoto), [\"img\", \"picture\", \"photo\"]],\n [\"gallery\", \"Gallery\", \"Several images as a grid or carousel\", i(IconLayoutGrid), [\"images\", \"photos\", \"carousel\", \"slideshow\"]],\n [\"video\", \"Video\", \"A YouTube, Vimeo or video file link\", i(IconVideo), [\"mp4\", \"youtube\", \"yt\", \"vimeo\", \"clip\", \"movie\"]],\n [\"embed\", \"Embed\", \"YouTube, X, CodePen, Figma, maps or audio\", i(IconCode), [\"yt\", \"youtube\", \"vimeo\", \"x\", \"tweet\", \"twitter\", \"codepen\", \"figma\", \"map\", \"maps\", \"spotify\", \"podcast\", \"audio\", \"iframe\"]],\n [\"file\", \"File\", \"A downloadable PDF or file\", i(IconFileText), [\"pdf\", \"download\", \"attachment\"]],\n]);\n/** V2 catalog.tsx ARTICLE: article blocks written in the body itself (the rest land with plan RT6–RT8). */\nconst ARTICLE = rows([\n [\"related\", \"Related posts\", \"More stories, picked or automatic\", i(IconNews), [\"related stories\", \"read next\", \"more stories\"]],\n [\"toc\", \"Table of contents\", \"Built from the headings\", i(IconListTree), [\"contents\", \"outline\", \"index\"]],\n [\"author\", \"Author bio\", \"Photo, name and short bio\", i(IconUserCircle), [\"bio\", \"byline\", \"about the author\"]],\n]);\nconst DATA = rows([\n [\"table\", \"Table\", \"Rows and columns\", i(IconTable), [\"grid\", \"data\", \"comparison\", \"spreadsheet\"]],\n // prototype content.jsx:1266\n [\"stats\", \"Stats\", \"Big numbers in a row\", i(IconChartBar), [\"numbers\", \"metrics\", \"kpi\", \"figures\"]],\n]);\n/** Found by search, not listed: rare in a body (H1 is the page title). */\nconst SEARCH_ONLY = rows([\n [\"h1\", \"Heading 1\", \"Largest heading\", i(IconH1)],\n [\"h5\", \"Heading 5\", \"Smallest heading\", i(IconH5)],\n [\"h6\", \"Heading 6\", \"Eyebrow heading\", i(IconH6)],\n // V2 catalog.tsx:89, :91 (rare in a story, so found by search)\n [\"task\", \"Checklist\", \"To-do list with checkboxes\", i(IconListCheck), [\"todo\", \"checkbox\"]],\n [\"columns\", \"Columns\", \"Side by side text\", i(IconColumns2), [\"layout\"]],\n [\"button\", \"Button\", \"A call to action link\", i(IconClick), [\"link button\"]],\n]);\n\n/** The feature a block needs (Text needs none). */\nconst NEEDS: Record<BasicId, RichTextFeature | null> = {\n p: null, h1: \"h1\", h2: \"h2\", h3: \"h3\", h4: \"h4\", h5: \"h5\", h6: \"h6\", quote: \"blockquote\", ul: \"ul\", ol: \"ol\", code: \"pre\", hr: \"hr\", image: \"image\",\n pullquote: \"pullquote\", takeaways: \"takeaways\", callout: \"callout\", toggle: \"toggle\", video: \"video\", file: \"file\", table: \"table\",\n task: \"checklist\", button: \"button\", gallery: \"gallery\", embed: \"embed\", toc: \"toc\",\n footnote: \"footnote\", columns: \"columns\", related: \"related\", author: \"author\", stats: \"stats\",\n};\nconst MORE: CatalogItem = { key: \"more\", kind: \"folder\", label: \"More blocks\", description: \"Shared across your site\", icon: i(IconComponents) };\nconst BACK: CatalogItem = { key: \"back\", kind: \"back\", label: \"All blocks\", description: \"\", icon: i(IconArrowLeft) };\n/* Look \"v16\" Insert ▾ (prototype content.jsx:1263-1267 INSERT): a short curated list in the prototype's words. The full\n catalogue stays in the slash menu. */\nconst INSERT_MEDIA: [BasicId, string, string][] = [\n [\"image\", \"Image\", \"Upload or pick from Media\"],\n [\"video\", \"Video\", \"YouTube, Vimeo or a file\"],\n [\"file\", \"File\", \"A download link\"],\n];\nconst INSERT_DATA: [BasicId, string, string][] = [\n [\"table\", \"Table\", \"Rows and columns\"],\n [\"stats\", \"Stats\", \"Big numbers in a row\"],\n [\"code\", \"Code block\", \"Code with highlighting\"],\n [\"callout\", \"Callout\", \"A highlighted note\"],\n [\"toggle\", \"Toggle\", \"Hide details under a heading\"],\n [\"hr\", \"Divider\", \"A line between parts\"],\n];\nconst SITE_BLOCKS: CatalogItem = { ...MORE, label: \"Site blocks\", description: \"Sections built for this site\" };\n/* Look \"v16\" AI icons (prototype content.jsx:52-62 AIP): every stroke is its own path, so each part moves on its own\n when the row is highlighted (theme.css `.kit-aii`). */\nconst AI_PATHS: Record<AiCommandKind | \"ai\", [string, string][]> = {\n ai: [[\"star\", \"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z\"], [\"p1\", \"M20 3v4M22 5h-4\"], [\"p2\", \"M4 17v2M5 18H3\"]],\n prompt: [[\"pen\", \"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854zM15 5l3 3\"], [\"ul\", \"M12 20h9\"]],\n continue: [[\"l\", \"M3 6h18M3 12h12\"], [\"l3\", \"M3 18h8\"], [\"arr\", \"M14 18h7M18 15l3 3-3 3\"]],\n improve: [[\"wand\", \"M21.64 3.64l-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72M14 7l3 3\"], [\"s1\", \"M5 6v4M7 8H3\"], [\"s2\", \"M19 14v4M21 16h-4\"], [\"s3\", \"M10 2v2M11 3H9\"]],\n shorter: [[\"tr\", \"M14 10l7-7M20 10h-6V4\"], [\"bl\", \"M3 21l7-7M4 14h6v6\"]],\n summarize: [[\"l1\", \"M3 5h11\"], [\"l2\", \"M3 10h11\"], [\"l3\", \"M3 15h7\"], [\"l4\", \"M3 20h5\"], [\"arr\", \"M18 9v11M15 17l3 3 3-3\"]],\n translate: [[\"g\", \"M5 8l6 6M4 14l6-6 2-3M2 5h12M7 2h1\"], [\"a\", \"M22 22l-5-10-5 10M14 18h6\"]],\n spelling: [[\"a\", \"M6 16l6-12 6 12M8 12h8\"], [\"ck\", \"M16 20l2 2 4-4\"]],\n};\nconst DRAWN = new Set([\"ul\", \"l3\", \"ck\"]);\n/** kit-ai-move's offset per stroke (prototype content.css:247-278), set on the path itself: component-local, not a token. */\nconst MOVE: Record<string, [string, string]> = {\n \"prompt.pen\": [\"1.7px\", \"-1.7px\"],\n \"continue.arr\": [\"2.5px\", \"0px\"],\n \"shorter.tr\": [\"-1.7px\", \"1.7px\"],\n \"shorter.bl\": [\"1.7px\", \"-1.7px\"],\n \"summarize.l1\": [\"0px\", \"-1.7px\"],\n \"summarize.l2\": [\"0px\", \"-1.7px\"],\n \"summarize.l3\": [\"0px\", \"-1.7px\"],\n \"summarize.l4\": [\"0px\", \"-1.7px\"],\n \"summarize.arr\": [\"0px\", \"2px\"],\n \"translate.g\": [\"-1px\", \"-1.7px\"],\n \"translate.a\": [\"1px\", \"1.7px\"],\n \"spelling.a\": [\"0px\", \"-1.4px\"],\n};\nconst AiIcon = ({ n }: { n: AiCommandKind | \"ai\" }) => (\n <svg className={`kit-aii kit-aii-${n}`} width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n {AI_PATHS[n].map(([c, d]) => {\n const move = MOVE[`${n}.${c}`];\n return <path key={c} className={c} d={d} pathLength={DRAWN.has(c) ? 1 : undefined} style={move ? ({ \"--dx\": move[0], \"--dy\": move[1] } as React.CSSProperties) : undefined} />;\n })}\n </svg>\n);\n/** The slash menu's Featured row: opens the AI view. */\nconst AI_ROW: CatalogItem = { key: \"ai\", kind: \"ai\", label: \"BetterCMS AI\", description: \"Write and edit with AI\", icon: <AiIcon n=\"ai\" />, aliases: [\"ai\", \"write\", \"assistant\"] };\nconst AI_ITEMS: CatalogItem[] = AI_COMMANDS.map((c) => ({ key: `ai:${c.id}`, ai: c.id, label: c.label, description: c.description, icon: <AiIcon n={c.id} /> }));\nconst componentRow = (c: KitInsertableComponent): CatalogItem => ({\n key: `c:${c.id}`,\n kind: \"component\",\n component: c,\n label: c.name,\n description: c.disabled || c.description || \"Shared across your site\",\n icon: c.thumb ? <img src={c.thumb} alt=\"\" loading=\"lazy\" className=\"size-full rounded-[inherit] object-cover\" /> : i(IconComponents),\n ...(c.disabled ? { disabled: c.disabled } : {}),\n});\n\n/** The components this field may embed, as the host answered (KitServices.useInsertableComponents). */\nexport interface CatalogComponents {\n components: KitInsertableComponent[];\n loading?: boolean;\n error?: string;\n}\nconst ComponentsContext = React.createContext<CatalogComponents | null>(null);\nexport const CatalogComponentsProvider = ComponentsContext.Provider;\n/** The components this field may embed (a component card's Swap component). */\nexport const useCatalogComponents = () => React.useContext(ComponentsContext);\n\nexport const blockAllowed = (id: BasicId, allows: (f: RichTextFeature) => boolean) => {\n const need = NEEDS[id];\n return !need || allows(need);\n};\n\n/* ── Recently used (per person, CPO D55): this browser's storage; a browser that keeps none just has no recents ── */\nconst RECENTS_KEY = \"kit-rt-insert-recents\";\nlet recents: string[] = (() => {\n try {\n const v = JSON.parse(globalThis.localStorage?.getItem(RECENTS_KEY) ?? \"[]\") as unknown;\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : [];\n } catch {\n return [];\n }\n})();\nconst recentSubs = new Set<() => void>();\n/** Remember a pick so search ranks it first next time. */\nexport function noteRecent(it: CatalogItem) {\n recents = [it.key, ...recents.filter((k) => k !== it.key)].slice(0, 12);\n try {\n globalThis.localStorage?.setItem(RECENTS_KEY, JSON.stringify(recents));\n } catch {\n /* storage is off: recents last for this session */\n }\n recentSubs.forEach((s) => s());\n}\nfunction useRecents() {\n return React.useSyncExternalStore(\n (cb) => {\n recentSubs.add(cb);\n return () => recentSubs.delete(cb);\n },\n () => recents,\n () => recents,\n );\n}\n\nexport interface CatalogSection {\n title: string | null;\n items: CatalogItem[];\n}\n\n/** 5 exact (label, id or alias) · 4 label or alias starts with it · 3 a word of the label starts with it · 2 inside the\n * label · 1 the description. */\nconst score = (q: string, it: CatalogItem) => {\n const l = it.label.toLowerCase();\n const al = it.aliases ?? [];\n if (l === q || it.id === q || al.includes(q)) return 5;\n if (l.startsWith(q) || al.some((a) => a.startsWith(q))) return 4;\n if (l.split(/[\\s-]+/).some((w) => w.startsWith(q))) return 3;\n if (l.includes(q)) return 2;\n return it.description.toLowerCase().includes(q) ? 1 : 0;\n};\n/**\n * Ranked by match, then by recently used among blocks the query names EXACTLY (label, id or alias), then catalogue\n * order. Recency used to outrank the match itself, so \"/heading\" took the H3 used last over Heading 2, \"/list\" the\n * numbered list over List, and \"/image\" a gallery over Image.\n */\nconst rank = (q: string, list: CatalogItem[], recent: string[]) =>\n list\n .map((it, i) => {\n const s = score(q, it);\n const r = recent.indexOf(it.key);\n return { it, s, r: s === 5 && r >= 0 ? r : 999, i };\n })\n .filter((x) => x.s > 0)\n .sort((a, b) => b.s - a.s || a.r - b.r || a.i - b.i)\n .map((x) => x.it);\n\n/**\n * `folder`: the More components view (its way back first, then the components, searched by `query`).\n * `aiOffered`: the \"BetterCMS AI\" Featured row leads the list (look \"v16\", the host has an AI command service);\n * `aiView`: its view (the way back, then the commands: all seven, or the host's `KitServices.aiCommandKinds` in\n * AI_COMMANDS order; when that leaves none there is no AI row at all).\n */\nexport function useCatalog(query: string, allows: (f: RichTextFeature) => boolean, folder = false, own?: CatalogComponents | null, aiOffered = false, aiView = false) {\n const recent = useRecents();\n const kinds = useKitServices().aiCommandKinds;\n const aiItems = React.useMemo(() => (kinds ? AI_ITEMS.filter((it) => kinds.includes(it.ai!)) : AI_ITEMS), [kinds]);\n const ai = aiOffered && aiItems.length > 0;\n const provided = React.useContext(ComponentsContext);\n // the editor reads its own list (it renders the provider, so cannot read it)\n const lib = own === undefined ? provided : own;\n return React.useMemo(() => {\n const q = query.trim().toLowerCase().replace(/^\\//, \"\");\n const keep = (list: CatalogItem[]) => list.filter((it) => !it.id || blockAllowed(it.id, allows));\n const comps = (lib?.components ?? []).map(componentRow);\n // the folder counts what can go in; a refused component is listed inside with its reason\n const pickable = comps.filter((c) => !c.disabled).length;\n let sections: CatalogSection[];\n let noMatch = false;\n let emptyText = \"No match.\";\n if (aiView && ai) sections = [{ title: null, items: [BACK] }, { title: \"BetterCMS AI\", items: aiItems }];\n else if (folder) {\n const found = q ? rank(q, comps, recent) : comps;\n noMatch = !!q && !!comps.length && !found.length;\n if (!comps.length) emptyText = lib?.error ?? (lib?.loading ? \"Loading blocks…\" : \"This field takes no blocks.\");\n sections = [{ title: null, items: [BACK] }, { title: \"Blocks\", items: found }];\n } else if (q) {\n const found = rank(q, [...(ai ? [AI_ROW] : []), ...keep(TEXT), ...keep(MEDIA), ...keep(DATA), ...keep(ARTICLE), ...keep(SEARCH_ONLY), ...comps], recent);\n noMatch = !found.length;\n sections = [{ title: null, items: found }];\n } else\n sections = [\n { title: \"Featured\", items: ai ? [AI_ROW] : [] },\n { title: \"Text\", items: keep(TEXT) },\n { title: \"Media\", items: keep(MEDIA) },\n { title: \"Data\", items: keep(DATA) },\n { title: \"Article\", items: keep(ARTICLE) },\n // offered while the list loads or failed too: opening it says which\n { title: null, items: lib && (comps.length || lib.loading || lib.error) ? [{ ...MORE, ...(pickable ? { count: pickable } : {}) }] : [] },\n ];\n sections = sections.filter((s) => s.items.length);\n const flat = sections.flatMap((s) => s.items);\n const empty = !flat.some((it) => it.kind !== \"back\");\n return { sections, flat, empty, noMatch, emptyText };\n }, [query, allows, recent, lib, folder, ai, aiItems, aiView]);\n}\n\n/**\n * Look \"v16\" Insert ▾ (prototype content.jsx:1263-1306): no search. \"Site blocks · Sections built for this site\" first,\n * only when the host has site blocks (its component list has some, or is still loading); then Media; then Data and\n * layout. Rows the field does not allow are left out.\n */\nexport function insertCatalog(allows: (f: RichTextFeature) => boolean, lib: CatalogComponents | null) {\n const byId = new Map([...TEXT, ...MEDIA, ...DATA, ...ARTICLE, ...SEARCH_ONLY].map((it) => [it.id, it]));\n const pick = (list: [BasicId, string, string][]) =>\n list.filter(([id]) => byId.has(id) && blockAllowed(id, allows)).map(([id, label, description]) => ({ ...byId.get(id)!, label, description }));\n const site = !!lib && (!!lib.components.length || !!lib.loading);\n const sections: CatalogSection[] = [\n { title: null, items: site ? [SITE_BLOCKS] : [] },\n { title: \"Media\", items: pick(INSERT_MEDIA) },\n { title: \"Data and layout\", items: pick(INSERT_DATA) },\n ].filter((sec) => sec.items.length);\n const flat = sections.flatMap((sec) => sec.items);\n return { sections, flat, empty: !flat.length, noMatch: false, emptyText: \"This field takes no blocks.\" };\n}\n\n/* ── The list ───────────────────────────────────────────────────────────\n * Browsing: compact one-line rows (icon · name), grouped. Search results add the one-line description. */\nexport function CatalogList({\n sections,\n flat,\n active,\n onHover,\n onPick,\n empty,\n emptyText = \"No match.\",\n noMatch,\n detail,\n listId,\n className,\n query,\n playIcon = null,\n onListKeyDown,\n listRef,\n}: {\n sections: CatalogSection[];\n flat: CatalogItem[];\n active: number;\n onHover: (i: number) => void;\n onPick: (it: CatalogItem) => void;\n empty: boolean;\n /** what an empty list says (\"No match.\", or why More components has none) */\n emptyText?: string;\n noMatch?: boolean;\n /** show each row's description (search results, More components) */\n detail?: boolean;\n listId: string;\n className?: string;\n /** look \"v16\": the search text, echoed in the empty line (Nothing matches “…”) */\n query?: string;\n /** look \"v16\": the row whose AI icon plays once now (the row the AI view opens on); hover plays the rest */\n playIcon?: number | null;\n /** a menu with no search box: the list itself takes focus and the keys (it points at the active row) */\n onListKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;\n listRef?: React.RefObject<HTMLDivElement | null>;\n}) {\n const v16 = useKitLook() === \"v16\";\n const own = React.useRef<HTMLDivElement>(null);\n const box = listRef ?? own;\n React.useEffect(() => {\n // scroll only the list (scrollIntoView would also scroll the page behind a floating menu)\n const b = box.current;\n const row = b?.querySelector<HTMLElement>(`[data-idx=\"${active}\"]`);\n if (!b || !row) return;\n if (row.offsetTop < b.scrollTop) b.scrollTop = row.offsetTop - 6;\n else if (row.offsetTop + row.offsetHeight > b.scrollTop + b.clientHeight) b.scrollTop = row.offsetTop + row.offsetHeight - b.clientHeight + 6;\n }, [active]);\n return (\n <div\n ref={box}\n id={listId}\n role=\"listbox\"\n aria-label=\"Blocks\"\n {...(onListKeyDown ? { tabIndex: -1, onKeyDown: onListKeyDown, \"aria-activedescendant\": flat.length ? `${listId}-${active}` : undefined } : {})}\n className={cn(\"relative overflow-y-auto\", v16 ? \"max-h-[344px] px-1 pb-1 [scrollbar-width:thin]\" : \"max-h-[320px] p-1.5\", onListKeyDown && \"outline-none\", className)}\n >\n {noMatch ? <div className={v16 ? \"px-2 py-3 text-[13px] text-kit-group-sub\" : \"px-2 pb-1 pt-1.5 text-kit-sm text-kit-fg-3\"}>{v16 && query?.trim() ? `Nothing matches “${query.trim()}”` : \"No match.\"}</div> : null}\n {sections.map((s, si) => (\n <div\n key={s.title ?? `s${si}`}\n role=\"group\"\n aria-label={s.title ?? undefined}\n className={cn(!s.title && si > 0 && s.items[0]?.kind === \"folder\" && \"mt-1.5 border-t border-kit-line-subtle pt-1.5\")}\n >\n {s.title ? <div className={v16 ? \"px-2 pb-1 pt-2.5 text-[11px] font-medium leading-4 text-kit-group-sub\" : \"px-2 pb-0.5 pt-2 text-kit-2xs font-medium text-kit-fg-3\"}>{s.title}</div> : null}\n {s.items.map((it) => {\n const idx = flat.indexOf(it);\n const on = idx === active;\n const desc = detail && it.kind !== \"back\" && it.kind !== \"folder\" ? it.description : \"\";\n /* Look \"v16\" (prototype content.jsx:1246-1251, content.css:242-244, 279-283): every row is 44 high with a 32\n white tile, a 13/18 medium title over its 12/16 description, and the key hint or a chevron at the end;\n the way back is a 32 high \"Back to all blocks\" line. */\n if (v16) {\n const common = {\n type: \"button\" as const,\n role: \"option\" as const,\n \"aria-selected\": on,\n \"aria-disabled\": it.disabled ? true : undefined,\n \"data-idx\": idx,\n \"data-aii-entry\": idx === playIcon ? \"\" : undefined,\n id: `${listId}-${idx}`,\n onMouseDown: (e: React.MouseEvent) => e.preventDefault(),\n onMouseMove: () => !on && onHover(idx),\n onClick: () => !it.disabled && onPick(it),\n };\n if (it.kind === \"back\")\n return (\n <button key={it.key} {...common} className={cn(\"mt-1 flex h-8 w-full items-center gap-1.5 rounded-[6px] px-2 text-left text-[12px] font-medium text-kit-insp-tip-body\", on && \"bg-kit-insp-card\")}>\n <IconChevronLeft aria-hidden className=\"size-3.5 shrink-0\" stroke={1.8} />\n Back to all blocks\n </button>\n );\n return (\n <button key={it.key} {...common} className={cn(\"flex h-11 w-full items-center gap-2.5 rounded-[6px] px-1.5 text-left\", on && \"bg-kit-insp-card\", it.disabled && \"cursor-default opacity-60\")}>\n <span className=\"grid size-8 shrink-0 place-items-center overflow-hidden rounded-[6px] bg-kit-insp-tip-bg text-kit-insp-tip-body shadow-[inset_0_0_0_1px_var(--kit-insp-line)] [&_svg]:size-4\">{it.icon}</span>\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <b className=\"truncate text-[13px] font-medium leading-[18px] text-kit-insp-tip-title\">{it.label}</b>\n {it.description ? <small className=\"truncate text-[12px] leading-4 text-kit-group-sub\">{it.description}</small> : null}\n </span>\n {it.count != null ? <span className=\"text-[12px] leading-4 tabular-nums text-kit-group-sub\">{it.count}</span> : null}\n {it.kind === \"folder\" || it.kind === \"ai\" ? (\n <IconChevronRight aria-hidden className=\"size-3.5 shrink-0 text-kit-insp-faint\" stroke={1.8} />\n ) : it.hint ? (\n <kbd data-hint=\"shortcuts\" className=\"shrink-0 font-kit-sans text-[12px] leading-4 text-kit-group-sub\">{hintText(it.hint)}</kbd>\n ) : null}\n </button>\n );\n }\n return (\n <button\n key={it.key}\n type=\"button\"\n role=\"option\"\n aria-selected={on}\n aria-disabled={it.disabled ? true : undefined}\n aria-description={!desc && it.description ? it.description : undefined}\n data-idx={idx}\n id={`${listId}-${idx}`}\n onMouseDown={(e) => e.preventDefault()}\n onMouseMove={() => !on && onHover(idx)}\n onClick={() => !it.disabled && onPick(it)}\n className={cn(\n \"flex w-full items-center gap-2 rounded-kit-md px-2 text-left transition-colors motion-reduce:transition-none\",\n desc ? \"py-1.5\" : \"h-8\",\n it.kind === \"back\" ? \"text-kit-fg-2\" : it.disabled ? \"cursor-default text-kit-fg-3\" : \"text-kit-fg\",\n on && \"bg-kit-hover text-kit-fg\",\n )}\n >\n <span className={cn(\"flex shrink-0 items-center justify-center text-kit-fg-2 [&_svg]:size-4\", desc ? \"size-7 rounded-kit-md border border-kit-line bg-kit-control-bg\" : \"size-5\")}>\n {it.icon}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-kit-sm\">{it.label}</span>\n {desc ? <span className=\"block truncate text-kit-xs text-kit-fg-3\">{desc}</span> : null}\n </span>\n {it.count != null ? <span className=\"text-kit-2xs tabular-nums text-kit-fg-3\">{it.count}</span> : null}\n {it.kind === \"folder\" ? <IconChevronRight className=\"size-3.5 shrink-0 text-kit-fg-3\" stroke={1.5} aria-hidden /> : null}\n </button>\n );\n })}\n </div>\n ))}\n {/* a search with no result says \"No match.\" once, in the line above (V2 catalog.tsx:263) */}\n {empty && !noMatch ? <div className={v16 ? \"px-2 py-3 text-[13px] text-kit-group-sub\" : \"px-2 py-6 text-center text-kit-sm text-kit-fg-3\"}>{emptyText}</div> : null}\n </div>\n );\n}\n\nconst Footer = () => (\n <div data-hint=\"shortcuts\" className=\"flex h-7 shrink-0 items-center border-t border-kit-line px-3 text-kit-2xs text-kit-fg-3\">\n <span>\n <kbd className=\"font-kit-sans\">↵</kbd> select · type to search\n </span>\n </div>\n);\n\n/** Shared keyboard model: ↑↓ wrap, Home/End, Enter / Tab, → into More components. Returns true when handled. */\nexport function catalogKey(\n e: React.KeyboardEvent | KeyboardEvent,\n flat: CatalogItem[],\n active: number,\n setActive: (i: number) => void,\n pick: (it: CatalogItem) => void,\n homeEnd = true,\n) {\n const n = flat.length;\n if (!n) return false;\n if (e.key === \"ArrowDown\") return setActive((active + 1) % n), true;\n if (e.key === \"ArrowUp\") return setActive((active - 1 + n) % n), true;\n if (homeEnd && e.key === \"Home\") return setActive(0), true;\n if (homeEnd && e.key === \"End\") return setActive(n - 1), true;\n if (e.key === \"ArrowRight\" && (flat[active]?.kind === \"folder\" || flat[active]?.kind === \"ai\")) return pick(flat[active]), true;\n if (e.key === \"Enter\" || e.key === \"Tab\") {\n const it = flat[active];\n if (it && !it.disabled) pick(it);\n return true;\n }\n return false;\n}\n\n/* ── Insert menu (popover content for the toolbar \"Insert\" and the gutter \"+\") ─ */\nexport function InsertMenuContent({\n onInsert,\n allows,\n keepFocusOnClose,\n align = \"start\",\n side = \"bottom\",\n list = \"full\",\n}: {\n onInsert: (it: CatalogItem) => void;\n allows: (f: RichTextFeature) => boolean;\n /** after an insert the caret stays in the editor: the menu gives no focus back to its trigger */\n keepFocusOnClose?: () => boolean;\n align?: \"start\" | \"center\" | \"end\";\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n /** look \"v16\": \"curated\" is the toolbar's Insert ▾ (prototype content.jsx:1263-1306: no search, Site blocks, Media,\n * Data and layout); \"full\" (default) is the whole searchable catalogue. Other looks always show the full one. */\n list?: \"full\" | \"curated\";\n}) {\n const [q, setQ] = React.useState(\"\");\n const [active, setActive] = React.useState(0);\n const input = React.useRef<HTMLInputElement>(null);\n const listRef = React.useRef<HTMLDivElement>(null);\n const listId = React.useId();\n const [folder, setFolder] = React.useState(false);\n const full = useCatalog(q, allows, folder);\n const v16 = useKitLook() === \"v16\";\n const curated = v16 && list === \"curated\";\n const lib = React.useContext(ComponentsContext);\n const short = React.useMemo(() => (curated ? insertCatalog(allows, lib) : null), [curated, allows, lib]);\n const { sections, flat, empty, emptyText, noMatch } = short ?? full;\n const reduce = !!useKitReducedMotion();\n /* look v16 (prototype content.jsx:1268-1300, content.css:482): the site's blocks open in a 300 wide panel beside the\n 280 menu (hover or → on the row, ← or Esc closes it) instead of replacing the list */\n const [sideOpen, setSideOpen] = React.useState(false);\n /* the side panel opens to the left when it would cross the window's right edge (prototype content.jsx:1273-1274,\n content.css:588 .ce-ins.flip): measured from the menu as it opens, so its entrance travels the right way */\n const [sideFlip, setSideFlip] = React.useState(false);\n const [sActive, setSActive] = React.useState(0);\n const openSide = () => {\n const menu = document.getElementById(listId)?.parentElement;\n if (menu) setSideFlip(menu.getBoundingClientRect().right + 6 + 300 > window.innerWidth - 8);\n setSideOpen(true);\n setSActive(0);\n };\n const sideCat = useCatalog(\"\", allows, true);\n const sideFlat = sideCat.flat.filter((it) => it.kind !== \"back\");\n const sideId = React.useId();\n const useSide = v16 && !q;\n // in More components the first row is the way back: the first component starts active\n React.useEffect(() => setActive(folder && flat.length > 1 ? 1 : 0), [q, folder]); // eslint-disable-line react-hooks/exhaustive-deps\n const leave = () => {\n setFolder(false);\n setQ(\"\");\n input.current?.focus();\n };\n const pick = (it: CatalogItem) => {\n if (it.kind === \"folder\" && useSide) openSide();\n else if (it.kind === \"folder\") {\n setFolder(true);\n setQ(\"\");\n input.current?.focus();\n } else if (it.kind === \"back\") leave();\n else onInsert(it);\n };\n const onKey = (e: React.KeyboardEvent) => {\n if (useSide && sideOpen) {\n if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n setSideOpen(false);\n } else if (catalogKey(e, sideFlat, sActive, setSActive, pick, true)) e.preventDefault();\n return;\n }\n if (useSide && e.key === \"ArrowRight\" && flat[active]?.kind === \"folder\") {\n e.preventDefault();\n openSide();\n return;\n }\n if (folder && e.key === \"Backspace\" && !q) {\n // ⌫ in an empty search steps back to every block (Esc: the popup's capture above)\n e.preventDefault();\n e.stopPropagation();\n leave();\n } else if (catalogKey(e, flat, active, setActive, pick, !q)) e.preventDefault();\n };\n // the side panel (look v16): in from 4px toward the menu with a fade (150ms), out in 100ms; reduced: the fade only\n const sideX = reduce ? 0 : sideFlip ? 4 : -4;\n return (\n <PopoverContent\n side={side}\n align={align}\n className={v16 ? \"relative flex max-h-[420px] w-[280px] flex-col rounded-[10px] !border-0 !bg-kit-insp-tip-bg p-0 !shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_12px_28px_rgb(0_0_0/0.12)] ![backdrop-filter:none]\" : \"flex max-h-[420px] w-[320px] flex-col overflow-hidden p-0\"}\n initialFocus={curated ? listRef : input}\n finalFocus={keepFocusOnClose ? () => !keepFocusOnClose() : undefined}\n // Esc in More components steps back to every block, wherever focus sits in the menu (the list scrolls, so the\n // browser can focus it): caught before the popover's own Esc, which would close it\n onKeyDownCapture={(e) => {\n if (useSide && sideOpen && e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n setSideOpen(false);\n return;\n }\n if (!folder || e.key !== \"Escape\") return;\n e.preventDefault();\n e.stopPropagation();\n leave();\n }}\n >\n {curated ? null : (\n <div className={cn(\"flex h-10 shrink-0 items-center gap-2 border-b px-3\", v16 ? \"border-kit-insp-divider\" : \"border-kit-line\")}>\n <IconSearch className={v16 ? \"size-3.5 shrink-0 text-kit-group-sub\" : \"size-4 shrink-0 text-kit-fg-3\"} stroke={v16 ? 1.8 : 1.5} aria-hidden />\n <input\n ref={input}\n value={q}\n onChange={(e) => setQ(e.target.value)}\n onKeyDown={onKey}\n role=\"combobox\"\n aria-expanded\n aria-controls={listId}\n aria-activedescendant={flat.length ? `${listId}-${active}` : undefined}\n aria-label={folder ? \"Search blocks\" : \"Search or pick a block\"}\n placeholder={folder ? \"Search blocks\" : \"Search or pick a block\"}\n className=\"h-full min-w-0 flex-1 bg-transparent text-kit-sm text-kit-fg outline-none placeholder:text-kit-fg-3 focus-visible:shadow-none\"\n />\n </div>\n )}\n <CatalogList\n sections={sections}\n flat={flat}\n active={active}\n onHover={(i: number) => {\n setActive(i);\n if (!useSide) return;\n if (flat[i]?.kind !== \"folder\") setSideOpen(false);\n else if (!sideOpen) openSide();\n }}\n onPick={pick}\n empty={empty}\n emptyText={emptyText}\n noMatch={noMatch}\n detail={!!q || folder}\n listId={listId}\n query={q}\n className={cn(\"min-h-0 flex-1\", curated && \"pt-1\")}\n {...(curated ? { onListKeyDown: onKey, listRef } : {})}\n />\n {v16 ? null : <Footer />}\n <AnimatePresence>\n {useSide && sideOpen ? (\n <motion.div\n key=\"side\"\n role=\"menu\"\n aria-label=\"Blocks for this site\"\n initial={{ opacity: 0, x: sideX }}\n animate={{ opacity: 1, x: 0, transition: { duration: 0.15, ease: \"easeOut\" } }}\n exit={{ opacity: 0, x: sideX, transition: { duration: 0.1, ease: \"easeIn\" } }}\n className={cn(\n \"absolute top-0 flex max-h-[420px] w-[300px] flex-col overflow-hidden rounded-[10px] bg-kit-insp-tip-bg shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_12px_28px_rgb(0_0_0/0.12)]\",\n sideFlip ? \"right-full mr-1.5\" : \"left-full ml-1.5\",\n )}\n >\n <CatalogList\n sections={[{ title: \"Blocks for this site\", items: sideFlat }]}\n flat={sideFlat}\n active={sActive}\n onHover={setSActive}\n onPick={pick}\n empty={!sideFlat.length}\n emptyText={sideCat.emptyText}\n detail\n listId={sideId}\n className=\"min-h-0 flex-1\"\n />\n </motion.div>\n ) : null}\n </AnimatePresence>\n </PopoverContent>\n );\n}\n\n/* ── Slash menu panel (positioned by the editor; never takes focus) ── */\nexport function SlashMenuPanel({\n query,\n folder = false,\n active,\n setActive,\n onPick,\n allows,\n maxHeight,\n aiOffered = false,\n aiView = false,\n}: {\n /** look \"v16\": the \"BetterCMS AI\" Featured row is offered (the host has an AI command service) */\n aiOffered?: boolean;\n /** look \"v16\": the AI view (the editor keeps it with the rest of the slash state) */\n aiView?: boolean;\n /** the room the editor found for the menu (collision-aware); the list scrolls inside it */\n maxHeight?: number;\n query: string;\n /** the More components view (the editor keeps it with the rest of the slash state) */\n folder?: boolean;\n active: number;\n setActive: (i: number) => void;\n onPick: (it: CatalogItem) => void;\n allows: (f: RichTextFeature) => boolean;\n}) {\n const listId = React.useId();\n const { sections, flat, empty, emptyText, noMatch } = useCatalog(query, allows, folder, undefined, aiOffered, aiView);\n const v16 = useKitLook() === \"v16\";\n /* M28/F42: entering the AI view plays the icon of the row it opens on, once (arrow keys never do; hover does) */\n const reduce = !!useKitReducedMotion();\n const [wasAi, setWasAi] = React.useState(aiView);\n const [aiEntry, setAiEntry] = React.useState<number | null>(null);\n if (wasAi !== aiView) {\n setWasAi(aiView);\n setAiEntry(aiView && !reduce ? active : null);\n }\n const panelRef = React.useRef<HTMLDivElement>(null);\n const [pvTop, setPvTop] = React.useState(0);\n // the preview card stands level with the highlighted row (prototype content.jsx:1240: row top - menu top - 6)\n React.useLayoutEffect(() => {\n if (!v16) return;\n const panel = panelRef.current;\n const row = panel?.querySelector<HTMLElement>(`[data-idx=\"${active}\"]`);\n if (!panel || !row) return;\n setPvTop(Math.max(0, Math.round(row.getBoundingClientRect().top - panel.getBoundingClientRect().top - 6)));\n }, [v16, active, query, folder, aiView]);\n /* Look \"v16\" (prototype content.jsx:1243-1252, content.css:236-241): 300 wide, white, radius 10; a 40 high line with\n a search glyph and what was typed (or \"Search or pick a block\"); 44 high rows; no footer; the hover preview card\n (F2107) 6px to the right. */\n if (v16)\n return (\n <div data-kit-scope=\"\" className=\"relative w-[300px]\" onMouseDown={(e) => e.preventDefault()}>\n <div\n ref={panelRef}\n className=\"flex w-[300px] flex-col overflow-hidden rounded-[10px] bg-kit-insp-tip-bg shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_12px_28px_rgb(0_0_0/0.12)]\"\n style={maxHeight ? { maxHeight } : undefined}\n >\n <div className=\"flex h-10 shrink-0 items-center gap-2 border-b border-kit-insp-divider px-3 text-[13px]\">\n <IconSearch aria-hidden className=\"size-3.5 shrink-0 text-kit-group-sub\" stroke={1.8} />\n {query ? <b className=\"min-w-0 flex-1 truncate font-normal text-kit-insp-tip-title\">{query}</b> : <span className=\"min-w-0 flex-1 truncate text-kit-group-sub\">{folder ? \"Search blocks\" : \"Search or pick a block\"}</span>}\n </div>\n <CatalogList sections={sections} flat={flat} active={active} onHover={setActive} onPick={onPick} empty={empty} emptyText={emptyText} noMatch={noMatch} detail listId={listId} query={query} playIcon={aiEntry} className=\"min-h-0 flex-1\" />\n </div>\n <SlashPreviewCard item={flat[active]} top={pvTop} />\n </div>\n );\n return (\n <div\n data-kit-scope=\"\"\n className=\"glass-strong flex w-[320px] flex-col overflow-hidden rounded-kit-xl border border-kit-line\"\n style={maxHeight ? { maxHeight } : undefined}\n onMouseDown={(e) => e.preventDefault()}\n >\n <div className=\"flex h-8 shrink-0 items-center gap-2 border-b border-kit-line px-3 text-kit-sm\">\n <span className={cn(\"flex-1 truncate\", query ? \"text-kit-fg\" : \"text-kit-fg-3\")}>{query ? `${folder ? \"More blocks · \" : \"\"}/${query}` : folder ? \"More blocks\" : \"Type to search\"}</span>\n <kbd data-hint=\"shortcuts\" className=\"font-kit-sans text-kit-2xs text-kit-fg-3\">\n esc\n </kbd>\n </div>\n <CatalogList\n sections={sections}\n flat={flat}\n active={active}\n onHover={setActive}\n onPick={onPick}\n empty={empty}\n emptyText={emptyText}\n noMatch={noMatch}\n detail={!!query || folder}\n listId={listId}\n className=\"max-h-[300px] min-h-0 flex-1\"\n />\n <Footer />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAM,KAAK,MAAgD,oBAAC,GAAD,EAAG,QAAQ,IAAM,CAAA;;;;AAK5E,IAAM,QAA0C;CAAE,GAAG;CAAO,IAAI;CAAK,IAAI;CAAM,IAAI;CAAO,IAAI;CAAQ,IAAI;CAAS,IAAI;CAAU,IAAI;CAA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,UAAA,SAAS,kBAAkB;IAA+B,CAAA,CACvN;GACL,CAAA,GAAA,oBAAC,aAAD;IAAuB;IAAgB;IAAc;IAAQ,SAAS;IAAmB;IAAe;IAAkB;IAAoB;IAAS,QAAA;IAAe;IAAe;IAAO,UAAU;IAAS,WAAU;GAAkB,CAAA,CACxO;EACL,CAAA,GAAA,oBAAC,kBAAD;GAAkB,MAAM,KAAK;GAAS,KAAK;EAAQ,CAAA,CAChD;;CAET,OACE,qBAAC,OAAD;EACE,kBAAe;EACf,WAAU;EACV,OAAO,YAAY,EAAE,UAAU,IAAI,KAAA;EACnC,cAAc,MAAM,EAAE,eAAe;EAJvC,UAAA;GAME,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,QAAD;KAAM,WAAW,GAAG,mBAAmB,QAAQ,gBAAgB,eAAe;KAAI,UAAA,QAAQ,GAAG,SAAS,mBAAmB,GAAG,GAAG,UAAU,SAAS,gBAAgB;IAAuB,CAAA,GACzL,oBAAC,OAAD;KAAK,aAAU;KAAY,WAAU;KAA2C,UAAA;IAE3E,CAAA,CACF;;GACL,oBAAC,aAAD;IACY;IACJ;IACE;IACR,SAAS;IACD;IACD;IACI;IACF;IACT,QAAQ,CAAC,CAAC,SAAS;IACX;IACR,WAAU;GACX,CAAA;GACD,oBAAC,QAAD,CAAS,CAAA;EACN;;AAET"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import type { FieldPath, FieldSchema } from "../../schema/types";
|
|
14
14
|
import type { UnknownValue } from "../unknown-value";
|
|
15
15
|
/** What a field may hold, in the editor's vocabulary. The editor offers nothing outside it. */
|
|
16
|
-
export type RichTextFeature = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "blockquote" | "ul" | "ol" | "pre" | "hr" | "bold" | "italic" | "underline" | "strike" | "sup" | "sub" | "code" | "link" | "image" | "table" | "pullquote" | "takeaways" | "callout" | "toggle" | "video" | "file" | "checklist" | "button" | "embed" | "gallery" | "toc" | "footnote" | "columns" | "author" | "related" | "embedAspect" | "stats" | "calloutStyle";
|
|
16
|
+
export type RichTextFeature = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "blockquote" | "ul" | "ol" | "pre" | "hr" | "bold" | "italic" | "underline" | "strike" | "sup" | "sub" | "code" | "link" | "image" | "table" | "pullquote" | "takeaways" | "callout" | "toggle" | "video" | "file" | "checklist" | "button" | "embed" | "gallery" | "toc" | "footnote" | "columns" | "author" | "related" | "embedAspect" | "stats" | "calloutStyle" | "tableFit";
|
|
17
17
|
export declare const ALL_FEATURES: readonly RichTextFeature[];
|
|
18
18
|
export interface RichTextRead {
|
|
19
19
|
/** the HTML the editor opens on */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.js","names":[],"sources":["../../../src/controls/rich-text/codec.ts"],"sourcesContent":["/**\n * RICH TEXT · the storage contract between the kit editor and its host.\n *\n * The V2 editor edits HTML (contentEditable). Production stores Portable Text, in the shape the classic editor of the\n * same surface writes (a block array for an entry field, the `{ content, html }` envelope for a component prop). The\n * conversion lives in the host, which owns the real converters, schema conformance and the field's Accept config; the\n * kit never imports them. A host with no codec gets a held field (read-only, with the reason), never a guess.\n *\n * The control opens a value only when it survives the trip editor → codec unchanged (`same`), so nothing the HTML\n * editor cannot hold (a checklist's ticks, a link's rel, an image's layout) is dropped by a first keystroke: such a\n * value is edited by the host's own control instead, with the reason named.\n */\nimport type { FieldPath, FieldSchema } from \"../../schema/types\";\nimport type { UnknownValue } from \"../unknown-value\";\n\n/** What a field may hold, in the editor's vocabulary. The editor offers nothing outside it. */\nexport type RichTextFeature =\n | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"\n | \"blockquote\" | \"ul\" | \"ol\" | \"pre\" | \"hr\"\n | \"bold\" | \"italic\" | \"underline\" | \"strike\" | \"sup\" | \"sub\" | \"code\"\n | \"link\" | \"image\"\n /* blocks, each stored as its own Portable Text block (see dom.ts) */\n | \"table\" | \"pullquote\" | \"takeaways\" | \"callout\" | \"toggle\" | \"video\" | \"file\"\n /* a task list (PT listItem \"check\" + checked) and a call-to-action link (the link markDef with button: true) */\n | \"checklist\" | \"button\"\n /* V2's article blocks, each a Portable Text block of its own (plan RT3–RT5): embed, gallery, table of contents */\n | \"embed\" | \"gallery\" | \"toc\"\n /* plan RT6–RT8: a footnote (inline, in the text), columns of text, an author bio and related posts (references) */\n | \"footnote\" | \"columns\" | \"author\" | \"related\"\n /* an embed's Shape (aspect): the host declares it once its stored embed keeps one (plan RT3) */\n | \"embedAspect\"\n /* prototype editor-v16 Stats: a row of number cards (dom.ts StatsModel; the host declares it once it stores one) */\n | \"stats\"\n /* look v16 callout: the \"note\" tone and \"No icon\" (`data-icon=\"none\"`), declared once the stored callout keeps them */\n | \"calloutStyle\";\n\nexport const ALL_FEATURES: readonly RichTextFeature[] = [\n \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"blockquote\", \"ul\", \"ol\", \"pre\", \"hr\", \"bold\", \"italic\", \"underline\", \"strike\", \"sup\", \"sub\", \"code\", \"link\", \"image\",\n \"table\", \"pullquote\", \"takeaways\", \"callout\", \"toggle\", \"video\", \"file\", \"checklist\", \"button\", \"embed\", \"gallery\", \"toc\", \"footnote\", \"columns\", \"author\", \"related\", \"embedAspect\", \"stats\", \"calloutStyle\",\n];\n\nexport interface RichTextRead {\n /** the HTML the editor opens on */\n html: string;\n /** the stored value as the classic editor would open it (compared against the editor's round trip) */\n seed: unknown;\n /** what this value already cannot carry from an earlier editor, in words (\"2 links\"); shown before the first edit */\n losses: string[];\n /** what the field accepts */\n features: RichTextFeature[];\n /** one paragraph, stored inline (allowMultipleParagraphs: false) */\n single: boolean;\n /** links may open in a new tab */\n newTab: boolean;\n /**\n * the styles, marks and lists the value holds that the field no longer declares: kept by every write, flagged above\n * the editor with change-to and remove (H4; see `remap`). Absent or empty = none.\n */\n undeclared?: UnknownValue[];\n /**\n * Where an author bio and related posts point (plan RT8), from the field's config: the authors and posts collections,\n * and the entry being edited (left out of the automatic related modes). Author bio is offered only with `authors`.\n * `topic: false`: the posts collection has no tags or category field, so \"Same topic\" cannot rank there (the entry\n * write refuses it, relatedPosts.no_topic_field); a new block is Newest and Same topic is not offered. Absent = has one.\n */\n /** `postsNoun`: what one post is called (the posts collection's singular, \"story\"), so Hand-picked says \"Create new story\" */\n references?: { authors?: string; posts?: string; entryId?: string; topic?: boolean; postsNoun?: string };\n}\n\nexport interface RichTextWrite {\n /** the value to store, in the surface's own shape */\n value: unknown;\n /** what the stored shape would drop from this HTML, in words; non-empty = the write is refused */\n losses: string[];\n}\n\nexport interface RichTextAt {\n field: FieldSchema;\n path: FieldPath;\n}\n\nexport interface KitRichTextCodec {\n read(value: unknown, at: RichTextAt): RichTextRead;\n /** `prev` is the stored value being replaced (its keys are reused so an edit does not re-key the document) */\n write(html: string, at: RichTextAt, prev: unknown): RichTextWrite;\n /** the same document, ignoring keys, span splits and storage wrapper */\n same(a: unknown, b: unknown): boolean;\n /** the stored value with one `undeclared` value (its `key`) changed to `to`, or removed (`to` null); the words stay */\n remap?(value: unknown, at: RichTextAt, key: string, to: string | null): unknown;\n}\n\ndeclare module \"../../context\" {\n interface KitServices {\n /**\n * Stored rich text ↔ the HTML the kit editor edits (see controls/rich-text/codec.ts). Absent → a rich text field\n * is held (read-only, with the reason).\n */\n richText?: KitRichTextCodec;\n }\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"codec.js","names":[],"sources":["../../../src/controls/rich-text/codec.ts"],"sourcesContent":["/**\n * RICH TEXT · the storage contract between the kit editor and its host.\n *\n * The V2 editor edits HTML (contentEditable). Production stores Portable Text, in the shape the classic editor of the\n * same surface writes (a block array for an entry field, the `{ content, html }` envelope for a component prop). The\n * conversion lives in the host, which owns the real converters, schema conformance and the field's Accept config; the\n * kit never imports them. A host with no codec gets a held field (read-only, with the reason), never a guess.\n *\n * The control opens a value only when it survives the trip editor → codec unchanged (`same`), so nothing the HTML\n * editor cannot hold (a checklist's ticks, a link's rel, an image's layout) is dropped by a first keystroke: such a\n * value is edited by the host's own control instead, with the reason named.\n */\nimport type { FieldPath, FieldSchema } from \"../../schema/types\";\nimport type { UnknownValue } from \"../unknown-value\";\n\n/** What a field may hold, in the editor's vocabulary. The editor offers nothing outside it. */\nexport type RichTextFeature =\n | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"\n | \"blockquote\" | \"ul\" | \"ol\" | \"pre\" | \"hr\"\n | \"bold\" | \"italic\" | \"underline\" | \"strike\" | \"sup\" | \"sub\" | \"code\"\n | \"link\" | \"image\"\n /* blocks, each stored as its own Portable Text block (see dom.ts) */\n | \"table\" | \"pullquote\" | \"takeaways\" | \"callout\" | \"toggle\" | \"video\" | \"file\"\n /* a task list (PT listItem \"check\" + checked) and a call-to-action link (the link markDef with button: true) */\n | \"checklist\" | \"button\"\n /* V2's article blocks, each a Portable Text block of its own (plan RT3–RT5): embed, gallery, table of contents */\n | \"embed\" | \"gallery\" | \"toc\"\n /* plan RT6–RT8: a footnote (inline, in the text), columns of text, an author bio and related posts (references) */\n | \"footnote\" | \"columns\" | \"author\" | \"related\"\n /* an embed's Shape (aspect): the host declares it once its stored embed keeps one (plan RT3) */\n | \"embedAspect\"\n /* prototype editor-v16 Stats: a row of number cards (dom.ts StatsModel; the host declares it once it stores one) */\n | \"stats\"\n /* look v16 callout: the \"note\" tone and \"No icon\" (`data-icon=\"none\"`), declared once the stored callout keeps them */\n | \"calloutStyle\"\n /* the table's \"Fit to width\" (`design.fit`, `data-fit=\"true\"`), declared once the stored table keeps it (REQ-KIT-3).\n Absent: the toggle hides; a stored data-fit still passes through untouched. */\n | \"tableFit\";\n\nexport const ALL_FEATURES: readonly RichTextFeature[] = [\n \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"blockquote\", \"ul\", \"ol\", \"pre\", \"hr\", \"bold\", \"italic\", \"underline\", \"strike\", \"sup\", \"sub\", \"code\", \"link\", \"image\",\n \"table\", \"pullquote\", \"takeaways\", \"callout\", \"toggle\", \"video\", \"file\", \"checklist\", \"button\", \"embed\", \"gallery\", \"toc\", \"footnote\", \"columns\", \"author\", \"related\", \"embedAspect\", \"stats\", \"calloutStyle\", \"tableFit\",\n];\n\nexport interface RichTextRead {\n /** the HTML the editor opens on */\n html: string;\n /** the stored value as the classic editor would open it (compared against the editor's round trip) */\n seed: unknown;\n /** what this value already cannot carry from an earlier editor, in words (\"2 links\"); shown before the first edit */\n losses: string[];\n /** what the field accepts */\n features: RichTextFeature[];\n /** one paragraph, stored inline (allowMultipleParagraphs: false) */\n single: boolean;\n /** links may open in a new tab */\n newTab: boolean;\n /**\n * the styles, marks and lists the value holds that the field no longer declares: kept by every write, flagged above\n * the editor with change-to and remove (H4; see `remap`). Absent or empty = none.\n */\n undeclared?: UnknownValue[];\n /**\n * Where an author bio and related posts point (plan RT8), from the field's config: the authors and posts collections,\n * and the entry being edited (left out of the automatic related modes). Author bio is offered only with `authors`.\n * `topic: false`: the posts collection has no tags or category field, so \"Same topic\" cannot rank there (the entry\n * write refuses it, relatedPosts.no_topic_field); a new block is Newest and Same topic is not offered. Absent = has one.\n */\n /** `postsNoun`: what one post is called (the posts collection's singular, \"story\"), so Hand-picked says \"Create new story\" */\n references?: { authors?: string; posts?: string; entryId?: string; topic?: boolean; postsNoun?: string };\n}\n\nexport interface RichTextWrite {\n /** the value to store, in the surface's own shape */\n value: unknown;\n /** what the stored shape would drop from this HTML, in words; non-empty = the write is refused */\n losses: string[];\n}\n\nexport interface RichTextAt {\n field: FieldSchema;\n path: FieldPath;\n}\n\nexport interface KitRichTextCodec {\n read(value: unknown, at: RichTextAt): RichTextRead;\n /** `prev` is the stored value being replaced (its keys are reused so an edit does not re-key the document) */\n write(html: string, at: RichTextAt, prev: unknown): RichTextWrite;\n /** the same document, ignoring keys, span splits and storage wrapper */\n same(a: unknown, b: unknown): boolean;\n /** the stored value with one `undeclared` value (its `key`) changed to `to`, or removed (`to` null); the words stay */\n remap?(value: unknown, at: RichTextAt, key: string, to: string | null): unknown;\n}\n\ndeclare module \"../../context\" {\n interface KitServices {\n /**\n * Stored rich text ↔ the HTML the kit editor edits (see controls/rich-text/codec.ts). Absent → a rich text field\n * is held (read-only, with the reason).\n */\n richText?: KitRichTextCodec;\n }\n}\n"],"mappings":";AAuCA,IAAa,eAA2C;CACtD;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAc;CAAM;CAAM;CAAO;CAAM;CAAQ;CAAU;CAAa;CAAU;CAAO;CAAO;CAAQ;CAAQ;CAClJ;CAAS;CAAa;CAAa;CAAW;CAAU;CAAS;CAAQ;CAAa;CAAU;CAAS;CAAW;CAAO;CAAY;CAAW;CAAU;CAAW;CAAe;CAAS;CAAgB;AACjN"}
|
|
@@ -601,6 +601,10 @@ function parseStoredTable(src) {
|
|
|
601
601
|
...t.design,
|
|
602
602
|
sticky: true
|
|
603
603
|
};
|
|
604
|
+
if (fig?.getAttribute("data-fit") === "true") t.design = {
|
|
605
|
+
...t.design,
|
|
606
|
+
fit: true
|
|
607
|
+
};
|
|
604
608
|
const ld = fig?.getAttribute("data-jsonld");
|
|
605
609
|
if (ld === "ItemList" || ld === "Dataset" || ld === "Offers") {
|
|
606
610
|
const axis = fig?.getAttribute("data-jsonld-axis");
|
|
@@ -804,7 +808,8 @@ function renderStoredTable(input) {
|
|
|
804
808
|
const ld = t.jsonLd && t.jsonLd.type !== "none" ? t.jsonLd : null;
|
|
805
809
|
const resp = t.design?.responsive === "stack" || t.design?.responsive === "cards" ? t.design.responsive : null;
|
|
806
810
|
const sticky = !!t.design?.sticky;
|
|
807
|
-
|
|
811
|
+
const fit = !!t.design?.fit;
|
|
812
|
+
if (!caption && !notes && !footnotes.length && !colRuns.length && !rowRuns.length && !sortable && !filter && !ld && !resp && !sticky && !fit && !typed) {
|
|
808
813
|
const out = ["<table>"];
|
|
809
814
|
if (t.headerRow) out.push(`<thead>${headRow}</thead>`);
|
|
810
815
|
out.push(`${body.length || !tfoot ? `<tbody>${body.map(rowHtml).join("")}</tbody>` : ""}${tfoot}</table>`);
|
|
@@ -824,8 +829,8 @@ function renderStoredTable(input) {
|
|
|
824
829
|
else if (body.length) out.push(`<tbody>${body.map(rowHtml).join("")}</tbody>`);
|
|
825
830
|
out.push(`${tfoot}</table>`);
|
|
826
831
|
const html = out.join("");
|
|
827
|
-
if (!notes && !footnotes.length && !filter && !ld && !resp && !sticky) return html;
|
|
828
|
-
const designAttrs = `${resp ? ` data-responsive="${resp}"` : ""}${sticky ? " data-sticky=\"true\"" : ""}`;
|
|
832
|
+
if (!notes && !footnotes.length && !filter && !ld && !resp && !sticky && !fit) return html;
|
|
833
|
+
const designAttrs = `${resp ? ` data-responsive="${resp}"` : ""}${sticky ? " data-sticky=\"true\"" : ""}${fit ? " data-fit=\"true\"" : ""}`;
|
|
829
834
|
const ldAttrs = ld ? ` data-jsonld="${ld.type}"${ld.axis ? ` data-jsonld-axis="${ld.axis}"` : ""}${ld.priceRow ? ` data-jsonld-price="${escAttr(ld.priceRow)}"` : ""}` : "";
|
|
830
835
|
return `<figure data-rt="table"${designAttrs}${filter ? " data-filter=\"true\"" : ""}${ldAttrs}>${html}${footnotes.length ? `<div class="bt-notes" id="${escAttr(notesId)}">${notes ? `<p data-notes>${esc(notes)}</p>` : ""}<ol data-footnotes>${footnotes.map((f, i) => `<li id="${escAttr(t.id ?? "tbl")}-fn-${i + 1}" data-key="${escAttr(f._key)}">${esc(f.text)}</li>`).join("")}</ol></div>` : notes ? `<p data-notes id="${escAttr(notesId)}">${esc(notes)}</p>` : ""}</figure>`;
|
|
831
836
|
}
|