@k2b/ui 0.19.0 → 0.20.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.
Files changed (43) hide show
  1. package/dist/browser/actions/GestureMenu.js +467 -0
  2. package/dist/browser/actions/GestureMenu.js.map +1 -0
  3. package/dist/browser/actions/index.js +1 -0
  4. package/dist/browser/actions/index.js.map +1 -1
  5. package/dist/browser/chat/ChatComposer.js +3 -41
  6. package/dist/browser/chat/ChatComposer.js.map +1 -1
  7. package/dist/browser/chat/ChatPrimitives.js +9 -3
  8. package/dist/browser/chat/ChatPrimitives.js.map +1 -1
  9. package/dist/browser/chat/ChatTimeline.js +19 -1
  10. package/dist/browser/chat/ChatTimeline.js.map +1 -1
  11. package/dist/browser/content/MessageRow.js +2 -2
  12. package/dist/browser/content/MessageRow.js.map +1 -1
  13. package/dist/browser/inputs/TextInput.js +13 -1
  14. package/dist/browser/inputs/TextInput.js.map +1 -1
  15. package/dist/browser/inputs/markdown/actions.js +0 -42
  16. package/dist/browser/inputs/markdown/actions.js.map +1 -1
  17. package/dist/browser/intl/messages.js +0 -6
  18. package/dist/browser/intl/messages.js.map +1 -1
  19. package/dist/ssr/actions/GestureMenu.js +411 -0
  20. package/dist/ssr/actions/GestureMenu.js.map +1 -0
  21. package/dist/ssr/actions/index.js +1 -0
  22. package/dist/ssr/actions/index.js.map +1 -1
  23. package/dist/ssr/chat/ChatComposer.js +3 -41
  24. package/dist/ssr/chat/ChatComposer.js.map +1 -1
  25. package/dist/ssr/chat/ChatPrimitives.js +9 -3
  26. package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
  27. package/dist/ssr/chat/ChatTimeline.js +19 -1
  28. package/dist/ssr/chat/ChatTimeline.js.map +1 -1
  29. package/dist/ssr/content/MessageRow.js +2 -2
  30. package/dist/ssr/content/MessageRow.js.map +1 -1
  31. package/dist/ssr/inputs/TextInput.js +13 -1
  32. package/dist/ssr/inputs/TextInput.js.map +1 -1
  33. package/dist/ssr/inputs/markdown/actions.js +0 -42
  34. package/dist/ssr/inputs/markdown/actions.js.map +1 -1
  35. package/dist/ssr/intl/messages.js +0 -6
  36. package/dist/ssr/intl/messages.js.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/dist/types/actions/GestureMenu.d.ts +35 -0
  39. package/dist/types/actions/index.d.ts +2 -0
  40. package/dist/types/chat/ChatComposer.d.ts +4 -1
  41. package/dist/types/inputs/markdown/actions.d.ts +0 -2
  42. package/dist/types/intl/messages.d.ts +0 -3
  43. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["content/MessageRow.tsx"],"sourcesContent":["import { fileIcons } from \"@k2b/stdlib\";\nimport type { Token, Tokens } from \"marked\";\nimport { type Accessor, createMemo, createSignal, createUniqueId, For, type JSX, onCleanup, Show } from \"solid-js\";\nimport { Button, IconButton } from \"../actions/Button\";\nimport { copyText } from \"../actions/CopyButton\";\nimport { announce } from \"../feedback/announce\";\nimport { useLocale } from \"../intl/locale\";\nimport { type UiMessages, useUiMessages } from \"../intl/messages\";\nimport { ScrollArea } from \"../layout/ScrollArea\";\nimport { Avatar } from \"../surfaces/Avatar\";\nimport { createSafeMarked, createSafeRenderer, escapeHtml } from \"./MarkdownView\";\n\n/** Messages by the same author within this time continue a group. */\nconst GROUP_WINDOW_MS = 5 * 60_000;\n/**\n * A message collapses to ten lines (`.k2b-message-row__text[data-collapsed]`) when its rendered text takes more lines\n * than this. `renderedLines` counts the fewest lines the text takes at any width, so a collapsed message always hides\n * some of it.\n */\nconst COLLAPSE_LINES = 14;\n/** Visible characters that take at least one line of a message, even at its widest. */\nconst LINE_CHARS = 100;\n/** Lines at the bottom of a collapsed message that fade out, as `.k2b-message-row__text[data-collapsed]` draws them. */\nconst FADE_LINES = 2;\nconst COPIED_MS = 2_000;\n/** Links in messages may only use these schemes; other links show as their text. */\nconst LINK_PROTOCOLS = [\"https:\", \"http:\", \"mailto:\"] as const;\n/** Attachments open and load only from these schemes or from a relative URL. */\nconst ATTACHMENT_PROTOCOLS = new Set([\"https:\", \"http:\"]);\n/**\n * A picture may also show a file that is still uploading. A `blob:` URL runs in the page's origin when it is opened,\n * so links never use one.\n */\nconst PICTURE_PROTOCOLS = new Set([...ATTACHMENT_PROTOCOLS, \"blob:\"]);\n/** A grid shows this many images or videos; the last one tells how many more there are. */\nconst MEDIA_SHOWN = 4;\n/** A single image keeps its own aspect ratio within these bounds; beyond them it is cropped to fit. */\nconst MEDIA_RATIO_MIN = 0.5;\nconst MEDIA_RATIO_MAX = 3;\n\nexport type MessageRowAuthor = {\n /** Display name, shown at the start of a group and read before every message. */\n name: string;\n /** Picture URL. Without one, the avatar shows initials on the author's tint. */\n avatar?: string | null;\n /** Icon class shown instead of initials, for example for an automated author. */\n icon?: string;\n};\n\nexport type MessageRowStatus = \"pending\" | \"sent\" | \"failed\";\n\nexport type MessageRowAction = {\n id: string;\n /** Accessible name and tooltip. */\n label: string;\n /** Icon class, for example `ti ti-arrow-back-up`. */\n icon: string;\n onSelect: () => void;\n disabled?: boolean;\n};\n\nexport type MessageRowQuote = {\n /** Name of the quoted message's author. */\n author: string;\n /** Plain text of the quoted message. It shows at most two lines. */\n text: string;\n /** Opens the quoted message, for example by scrolling to it. Without it, the quote is not a control. */\n onSelect?: () => void;\n};\n\nexport type MessageRowReaction = {\n /** Stable identity of the reaction, passed to `onToggleReaction`. */\n key: string;\n emoji: string;\n count: number;\n /** The reader reacted this way; the chip shows pressed. */\n own?: boolean;\n /** Who reacted, for example \"Nora, Tobias\". Read by screen readers and shown as a tooltip. */\n label?: string;\n};\n\nexport type MessageRowThread = {\n /** Number of replies. */\n count: number;\n /** People who replied, most recent first; the bar shows up to three. */\n participants?: readonly MessageRowAuthor[];\n /** Visible time of the last reply, formatted by the caller. */\n lastReply?: string;\n lastReplyDateTime?: string | Date;\n onOpen: () => void;\n};\n\ntype MessageRowAttachmentTarget = {\n /** Opens the attachment, for example in a lightbox. Takes precedence over `href`. */\n onOpen?: () => void;\n /** Opens the attachment in a new tab. Absolute `https` or `http`, or relative. */\n href?: string;\n};\n\nexport type MessageRowMedia = MessageRowAttachmentTarget & {\n kind: \"image\" | \"video\";\n /** The image, or the poster frame of a video. Absolute `https` or `http`, relative, `blob`, or `data:image/`. */\n src: string;\n /** Describes the image or video for people who cannot see it. */\n alt: string;\n /** Stored pixel size. The row reserves the area from it, so nothing moves when the image loads. */\n width: number;\n height: number;\n /** Visible length of a video, for example \"0:42\". */\n duration?: string;\n};\n\nexport type MessageRowFile = MessageRowAttachmentTarget & {\n kind: \"file\";\n name: string;\n /** Second line, for example \"PDF · 412 KB\". */\n detail?: string;\n /** Media type, used with the name to choose the icon. */\n mediaType?: string;\n /** Icon class instead of the one chosen from the name. */\n icon?: string;\n};\n\nexport type MessageRowAttachment = MessageRowMedia | MessageRowFile;\n\nexport type MessageRowProgress = {\n /** What is happening, for example \"Writing\" or \"Searching the files\". */\n status: string;\n /** Called by \"Stop\". */\n onStop?: () => void;\n};\n\nexport type MessageRowProps = {\n author: MessageRowAuthor;\n /** Message text as Markdown. Raw HTML shows as text; links must be absolute and use `https`, `http`, or `mailto`. */\n text: string;\n /** Visible time, formatted by the caller, so server and browser render the same text. */\n time: string;\n /** Machine-readable time for the `<time>` element. */\n dateTime?: string | Date;\n /** The reader's own message: on the right in the accent tint, without avatar or name. */\n own?: boolean;\n /**\n * Starts a group with avatar, name, badge, and time. A continuation shows only its text; screen readers still hear\n * the author and time. Defaults to true; `startsMessageGroup` decides it from the previous message.\n */\n groupStart?: boolean;\n /** Shown next to the name at the start of a group, for example the kind of account. */\n badge?: JSX.Element;\n /** Send state. Sets a line of fixed height below the message: a clock, a check, or \"Not sent\" with \"Retry\". */\n status?: MessageRowStatus;\n /** Text shown in that line instead of the check once someone has read the message, for example \"Read by Nora\". */\n receipt?: string;\n /** Called by \"Retry\" while `status` is `\"failed\"`. */\n onRetry?: () => void;\n /** Shown as a toolbar over the message while it is hovered or focused. It never moves the layout. */\n actions?: readonly MessageRowAction[];\n /** The message this one answers, shown above it. */\n quote?: MessageRowQuote;\n /** Marks the message as forwarded from somewhere else. */\n forwarded?: boolean;\n /** Marks the message as edited after it was sent. */\n edited?: boolean;\n /** Shows \"This message was deleted\" instead of the text, quote, attachments, previews, and reactions. */\n deleted?: boolean;\n /** Images and videos in a grid with areas reserved from their stored size, then files as chips. */\n attachments?: readonly MessageRowAttachment[];\n /** A preview of a link in the text, supplied with its final height. */\n linkPreview?: JSX.Element;\n /** A card for an element the message refers to, such as a task or a document, supplied with its final height. */\n card?: JSX.Element;\n /**\n * Reactions in a bar of fixed height. The bar shows whenever this is set, even to an empty list, so chips that come\n * and go never change the row. Only setting it where it was unset adds a line, so pass it on own messages and on\n * messages that have or had reactions, and leave it out on others' messages that never had one.\n */\n reactions?: readonly MessageRowReaction[];\n /** Called with a reaction's `key` when the reader presses its chip. Without it, the chips are not controls. */\n onToggleReaction?: (key: string) => void;\n /** Called by \"Add reaction\" in the reaction bar, with the button to anchor a picker to. */\n onAddReaction?: (anchor: HTMLElement) => void;\n /** A bar of fixed height that opens the replies to this message. */\n thread?: MessageRowThread;\n /** The message is still being written, by a person or an automated author alike: a status line with \"Stop\". */\n progress?: MessageRowProgress;\n class?: string;\n};\n\nexport type MessageSystemRowProps = {\n /** What happened, for example \"Nora added Tobias\". */\n children: JSX.Element;\n /** Visible time, formatted by the caller. */\n time?: string;\n dateTime?: string | Date;\n /** Icon class shown before the text. */\n icon?: string;\n class?: string;\n};\n\nexport type MessageGroupEntry = {\n /** Stable identity of the author. */\n author: string;\n at: Date | number | string;\n /** System rows never belong to a group. */\n system?: boolean;\n};\n\nconst timestamp = (value: Date | number | string) => (value instanceof Date ? value.getTime() : new Date(value).getTime());\n\n/**\n * Whether a message starts a new group: there is no previous message, either is a system row, the author changes, or\n * more than five minutes passed. Also start a group where you show a separator such as a new day.\n */\nexport const startsMessageGroup = (entry: MessageGroupEntry, previous?: MessageGroupEntry | null): boolean => {\n if (!previous || entry.system || previous.system || entry.author !== previous.author) return true;\n const gap = timestamp(entry.at) - timestamp(previous.at);\n return !(gap >= 0 && gap <= GROUP_WINDOW_MS);\n};\n\n/** Text that wraps: every `LINE_CHARS` visible characters of a line take at least one line. */\nconst wrappedLines = (text: string): number =>\n text.split(\"\\n\").reduce((lines, line) => lines + Math.ceil(line.trim().length / LINE_CHARS), 0);\n\n/** What inline tokens show: a link its label, never its destination. */\nconst inlineText = (tokens: readonly Token[]): string => {\n let text = \"\";\n for (const token of tokens) {\n if (token.type === \"br\") text += \"\\n\";\n else if (\"tokens\" in token && token.tokens) text += inlineText(token.tokens);\n else if (\"text\" in token) text += token.text;\n }\n return text;\n};\n\n/**\n * The fewest lines the rendered tokens take at any width. Code never wraps, so each of its lines is one line, blank\n * ones too, and its bar one more. Link destinations and reference definitions show nothing. Decided from the text\n * alone, so the row has its final height when it mounts.\n */\nconst renderedLines = (tokens: readonly Token[]): number => {\n let lines = 0;\n for (const token of tokens) {\n switch (token.type) {\n case \"code\":\n lines += token.text.split(\"\\n\").length + 1;\n break;\n case \"list\":\n for (const item of token.items) lines += Math.max(1, renderedLines(item.tokens));\n break;\n case \"table\":\n lines += token.rows.length + (token.header.some((cell: Tokens.TableCell) => cell.text.trim()) ? 1 : 0);\n break;\n case \"paragraph\":\n case \"heading\":\n case \"text\":\n lines += wrappedLines(token.tokens ? inlineText(token.tokens) : token.text);\n break;\n case \"hr\":\n lines += 1;\n break;\n case \"space\":\n case \"def\":\n break;\n default:\n if (\"tokens\" in token && token.tokens) lines += renderedLines(token.tokens);\n else if (\"text\" in token) lines += wrappedLines(token.text);\n }\n }\n return lines;\n};\n\n/** Messages link only to absolute URLs; a relative one would lead somewhere else on every page that shows it. */\nconst isAbsoluteUrl = (href: string): boolean => {\n try {\n return new URL(href).protocol !== \"\";\n } catch {\n return false;\n }\n};\n\nconst dateTimeOf = (value: string | Date | undefined): string | undefined => {\n if (value === undefined) return undefined;\n const date = value instanceof Date ? value : new Date(value);\n return Number.isFinite(date.getTime()) ? date.toISOString() : undefined;\n};\n\n/**\n * An attachment URL the row may load or open: absolute with an allowed scheme, or relative to the page. A picture may\n * also be a `blob:` URL or a `data:image/` URL, which an image element shows without running anything.\n */\nconst attachmentUrl = (url: string | undefined, picture = false): string | undefined => {\n if (!url) return undefined;\n if (picture && /^data:image\\//i.test(url)) return url;\n try {\n return (picture ? PICTURE_PROTOCOLS : ATTACHMENT_PROTOCOLS).has(new URL(url, \"https://relative.invalid/\").protocol) ? url : undefined;\n } catch {\n return undefined;\n }\n};\n\n/** The aspect ratio a single image or video reserves, from its stored size. */\nconst mediaRatio = (media: MessageRowMedia): number => {\n const ratio = media.width > 0 && media.height > 0 ? media.width / media.height : 4 / 3;\n return Math.min(MEDIA_RATIO_MAX, Math.max(MEDIA_RATIO_MIN, ratio));\n};\n\n/** The width of a single image or video: its stored width, at most the row's media height tall, never wider than the row. */\nconst mediaWidth = (media: MessageRowMedia): string => {\n const natural = Number.isFinite(media.width) && media.width > 0 ? `${media.width}px, ` : \"\";\n return `min(100%, ${natural}calc(var(--k2b-message-media-height) * ${mediaRatio(media)}))`;\n};\n\n/** Only the `ti-*` glyph of `fileIcons`, which may add colour utilities that `@k2b/ui` does not ship. */\nconst fileIcon = (file: MessageRowFile): string =>\n file.icon ??\n `ti ${fileIcons\n .getFileIcon({ name: file.name, type: \"file\", mimeType: file.mediaType })\n .split(/\\s+/)\n .filter((token) => token.startsWith(\"ti-\"))\n .join(\" \")}`;\n\n/** A link, a button, or neither, depending on what the caller passes. */\nfunction AttachmentTarget(\n props: MessageRowAttachmentTarget & {\n class: string;\n style?: JSX.CSSProperties;\n /** Names a picture; without a link or button around it, the element becomes the image. */\n label?: string;\n children: JSX.Element;\n },\n): JSX.Element {\n return (\n <Show\n when={props.onOpen}\n fallback={\n <Show\n when={attachmentUrl(props.href)}\n fallback={\n <Show\n when={props.label}\n fallback={\n <span class={props.class} style={props.style}>\n {props.children}\n </span>\n }\n >\n {(label) => (\n <span class={props.class} style={props.style} role=\"img\" aria-label={label()}>\n {props.children}\n </span>\n )}\n </Show>\n }\n >\n {(href) => (\n <a class={props.class} style={props.style} href={href()} target=\"_blank\" rel=\"noopener noreferrer\" aria-label={props.label}>\n {props.children}\n </a>\n )}\n </Show>\n }\n >\n {(open) => (\n <button type=\"button\" class={props.class} style={props.style} aria-label={props.label} onClick={() => open()()}>\n {props.children}\n </button>\n )}\n </Show>\n );\n}\n\n/**\n * Renders the safe Markdown of `MarkdownView` with line breaks kept, absolute links only, and a copy control above\n * every code block, and counts the fewest lines it takes. An edited message that does not collapse ends with the marker.\n */\nconst renderMessage = (text: string, locale: string, messages: UiMessages, edited: boolean): { html: string; lines: number } => {\n const renderer = createSafeRenderer({ allowImages: false, linkProtocols: LINK_PROTOCOLS, linkTarget: \"_blank\", locale });\n const renderLink = renderer.link.bind(renderer);\n renderer.link = (token: Tokens.Link) => (isAbsoluteUrl(token.href) ? renderLink(token) : renderer.parser.parseInline(token.tokens));\n const renderCode = renderer.code.bind(renderer);\n renderer.code = (token: Tokens.Code) => {\n const language = token.lang?.match(/^\\S{1,24}/)?.[0];\n const block = renderCode(token).replace(/^<pre>/, '<pre tabindex=\"0\">');\n return (\n '<div class=\"k2b-message-row__code\"><div class=\"k2b-message-row__code-bar\">' +\n `<span class=\"k2b-message-row__code-label\">${escapeHtml(language ?? messages.code)}</span>` +\n '<button type=\"button\" class=\"k2b-message-row__copy\">' +\n `<span class=\"k2b-message-row__copy-idle\"><i class=\"ti ti-copy\" aria-hidden=\"true\"></i>${escapeHtml(messages.copy)}</span>` +\n `<span class=\"k2b-message-row__copy-done\"><i class=\"ti ti-check\" aria-hidden=\"true\"></i>${escapeHtml(messages.copied)}</span>` +\n `</button></div>${block}</div>`\n );\n };\n const marked = createSafeMarked(locale).setOptions({ breaks: true, renderer });\n const tokens = marked.lexer(text);\n const html = marked.parser(tokens);\n const lines = renderedLines(tokens);\n // A collapsed message would hide the end of its text, so its marker sits next to \"Show more\" instead.\n if (!edited || lines > COLLAPSE_LINES) return { html, lines };\n // The marker ends the last paragraph, so it takes no line of its own there.\n const marker = `<span class=\"k2b-message-row__edited\">${escapeHtml(messages.messageEdited)}</span>`;\n const end = html.trimEnd();\n return { html: end.endsWith(\"</p>\") ? `${end.slice(0, -4)} ${marker}</p>` : `${html}<p>${marker}</p>`, lines };\n};\n\n/**\n * One message in a conversation with many people: own messages on the right, others on the left with avatar, name,\n * and time at the start of a group. Every part has its final height when the row mounts, so a virtualized list such\n * as `VirtualFeed` keeps its positions.\n */\nexport function MessageRow(props: MessageRowProps): JSX.Element {\n const messages = useUiMessages();\n const locale = useLocale();\n const textId = `k2b-message-${createUniqueId()}`;\n const [expanded, setExpanded] = createSignal(false);\n const rendered = createMemo(() => renderMessage(props.text, locale(), messages(), Boolean(props.edited)));\n const collapsible = () => rendered().lines > COLLAPSE_LINES;\n const collapsed = () => collapsible() && !expanded();\n const groupStart = () => props.groupStart ?? true;\n const hasLine = () => props.progress !== undefined || props.status !== undefined || props.receipt !== undefined;\n const reactions = () => (props.deleted ? undefined : props.reactions);\n // Chips follow their keys, so a chip keeps its element, and focus, when the caller passes new objects for it.\n const reactionKeys = createMemo(() => reactions()?.map((reaction) => reaction.key) ?? []);\n const reactionByKey = createMemo(() => new Map(reactions()?.map((reaction) => [reaction.key, reaction])));\n const hasFooter = () => hasLine() || reactions() !== undefined;\n const writing = () => props.progress !== undefined && !props.deleted && props.text.trim() === \"\";\n const hasBubble = () => props.deleted || writing() || props.text.trim() !== \"\";\n const content = () => !props.deleted;\n const media = createMemo(() =>\n content() ? (props.attachments ?? []).filter((attachment): attachment is MessageRowMedia => attachment.kind !== \"file\") : [],\n );\n const files = createMemo(() =>\n content() ? (props.attachments ?? []).filter((attachment): attachment is MessageRowFile => attachment.kind === \"file\") : [],\n );\n const shownMedia = () => media().slice(0, MEDIA_SHOWN);\n const hiddenMedia = () => media().length - shownMedia().length;\n let text: HTMLDivElement | undefined;\n let copiedTimer: ReturnType<typeof setTimeout> | undefined;\n\n onCleanup(() => clearTimeout(copiedTimer));\n\n const copyCode = (event: MouseEvent) => {\n const button = (event.target as Element | null)?.closest?.<HTMLButtonElement>(\".k2b-message-row__copy\");\n if (!button || !text?.contains(button)) return;\n const code = button.closest(\".k2b-message-row__code\")?.querySelector(\"pre\")?.textContent ?? \"\";\n copyText(code).then(\n () => {\n for (const other of text?.querySelectorAll<HTMLElement>(\".k2b-message-row__copy[data-copied]\") ?? []) delete other.dataset.copied;\n button.dataset.copied = \"\";\n announce(messages().copied);\n clearTimeout(copiedTimer);\n copiedTimer = setTimeout(() => delete button.dataset.copied, COPIED_MS);\n },\n () => {},\n );\n };\n\n // A keyboard user who reaches a link or code block in the hidden or faded part of a collapsed message gets the whole\n // message. The collapsed text clips instead of scrolling, so the browser cannot scroll it to the target instead.\n const revealFocus = (event: FocusEvent) => {\n if (!text || !collapsed() || !(event.target instanceof Element)) return;\n const fade = text.getBoundingClientRect().bottom - FADE_LINES * Number.parseFloat(getComputedStyle(text).lineHeight);\n if (event.target.getBoundingClientRect().bottom > fade) setExpanded(true);\n };\n\n const header = () => (\n <>\n <span class=\"k2b-message-row__name\">{props.author.name}</span>\n <Show when={props.badge}>\n <span class=\"k2b-message-row__badge\">{props.badge}</span>\n </Show>\n <time class=\"k2b-message-row__time\" datetime={dateTimeOf(props.dateTime)}>\n {props.time}\n </time>\n </>\n );\n\n const quote = (value: MessageRowQuote) => (\n <>\n <i class=\"ti ti-arrow-back-up\" aria-hidden=\"true\" />\n <span class=\"k2b-message-row__quote-text\">\n <span class=\"k2b-sr-only\">{messages().messageReplyTo} </span>\n <span class=\"k2b-message-row__quote-author\">{value.author}</span> {value.text}\n </span>\n </>\n );\n\n /** The picture's description, then that it is a video and how long, then how many more the grid hides. */\n const mediaLabel = (item: MessageRowMedia, more: number) =>\n [\n item.alt,\n item.kind === \"video\" ? [messages().messageVideo, item.duration].filter(Boolean).join(\" \") : \"\",\n more > 0 ? messages().messageMoreAttachments({ count: more }) : \"\",\n ]\n .filter(Boolean)\n .join(\", \");\n\n /** A toggle button, or with no `onToggleReaction` a labelled image that also says whether the reader reacted. */\n const reactionChip = (key: string, reaction: Accessor<MessageRowReaction>) => {\n const label = (own: boolean) =>\n messages().messageReaction({ emoji: reaction().emoji, count: reaction().count, names: reaction().label, own });\n return (\n <Show\n when={props.onToggleReaction}\n fallback={\n <span\n class=\"k2b-message-row__reaction\"\n role=\"img\"\n aria-label={label(Boolean(reaction().own))}\n title={reaction().label}\n data-own={reaction().own ? \"\" : undefined}\n >\n <span aria-hidden=\"true\">{reaction().emoji}</span>\n <span aria-hidden=\"true\">{reaction().count}</span>\n </span>\n }\n >\n {(toggle) => (\n <button\n type=\"button\"\n class=\"k2b-message-row__reaction\"\n aria-pressed={reaction().own ? \"true\" : \"false\"}\n aria-label={label(false)}\n title={reaction().label}\n data-own={reaction().own ? \"\" : undefined}\n onClick={() => toggle()(key)}\n >\n <span aria-hidden=\"true\">{reaction().emoji}</span>\n <span aria-hidden=\"true\">{reaction().count}</span>\n </button>\n )}\n </Show>\n );\n };\n\n const mediaItem = (item: MessageRowMedia, index: () => number) => {\n const more = () => (index() === shownMedia().length - 1 ? hiddenMedia() : 0);\n return (\n <AttachmentTarget\n class=\"k2b-message-row__media-item\"\n style={media().length === 1 ? { \"aspect-ratio\": String(mediaRatio(item)) } : undefined}\n label={mediaLabel(item, more())}\n onOpen={item.onOpen}\n href={item.href}\n >\n <img\n src={attachmentUrl(item.src, true)}\n alt=\"\"\n width={item.width > 0 ? item.width : undefined}\n height={item.height > 0 ? item.height : undefined}\n loading=\"lazy\"\n decoding=\"async\"\n />\n <Show when={item.kind === \"video\"}>\n <span class=\"k2b-message-row__media-play\" aria-hidden=\"true\">\n <i class=\"ti ti-player-play\" />\n </span>\n <Show when={item.duration}>\n <span class=\"k2b-message-row__media-duration\" aria-hidden=\"true\">\n {item.duration}\n </span>\n </Show>\n </Show>\n <Show when={more() > 0}>\n <span class=\"k2b-message-row__media-more\" aria-hidden=\"true\">\n +{more()}\n </span>\n </Show>\n </AttachmentTarget>\n );\n };\n\n return (\n <div\n class={props.class ? `k2b-message-row ${props.class}` : \"k2b-message-row\"}\n data-own={props.own ? \"\" : undefined}\n data-group-start={groupStart() ? \"\" : undefined}\n data-status={props.status}\n data-media={media().length > 0 ? \"\" : undefined}\n >\n <Show when={!props.own}>\n <div class=\"k2b-message-row__gutter\">\n <Show when={groupStart()}>\n <span class=\"k2b-message-row__avatar\" aria-hidden=\"true\">\n <Avatar name={props.author.name} src={props.author.avatar} icon={props.author.icon} size=\"sm\" />\n </span>\n </Show>\n </div>\n </Show>\n <div class=\"k2b-message-row__body\">\n <Show\n when={groupStart()}\n fallback={\n <span class=\"k2b-sr-only\">\n {props.author.name}, {props.time}:{\" \"}\n </span>\n }\n >\n <Show\n when={!props.own}\n fallback={\n <div class=\"k2b-message-row__meta\">\n <span class=\"k2b-sr-only\">{props.author.name}, </span>\n <time class=\"k2b-message-row__time\" datetime={dateTimeOf(props.dateTime)}>\n {props.time}\n </time>\n </div>\n }\n >\n <div class=\"k2b-message-row__meta\">{header()}</div>\n </Show>\n </Show>\n <Show when={content() && props.forwarded}>\n <div class=\"k2b-message-row__marker\">\n <i class=\"ti ti-arrow-forward-up\" aria-hidden=\"true\" />\n <span>{messages().messageForwarded}</span>\n </div>\n </Show>\n <Show when={content() && props.quote}>\n {(value) => (\n <Show when={value().onSelect} fallback={<div class=\"k2b-message-row__quote\">{quote(value())}</div>}>\n {(select) => (\n <button type=\"button\" class=\"k2b-message-row__quote\" onClick={() => select()()}>\n {quote(value())}\n </button>\n )}\n </Show>\n )}\n </Show>\n <Show when={hasBubble()}>\n <div\n class=\"k2b-message-row__bubble\"\n data-deleted={props.deleted ? \"\" : undefined}\n aria-busy={props.progress && !props.deleted ? \"true\" : undefined}\n >\n <Show\n when={!props.deleted}\n fallback={\n <span class=\"k2b-message-row__deleted\">\n <i class=\"ti ti-message-off\" aria-hidden=\"true\" />\n {messages().messageDeleted}\n </span>\n }\n >\n <Show\n when={!writing()}\n fallback={\n <span class=\"k2b-message-row__writing\">\n <span class=\"k2b-chat-progress-dots\" aria-hidden=\"true\">\n <span />\n <span />\n <span />\n </span>\n </span>\n }\n >\n {/* biome-ignore lint/a11y/noStaticElementInteractions lint/a11y/useKeyWithClickEvents: the native copy buttons inside the rendered Markdown are the targets; their clicks, including from the keyboard, bubble here. */}\n <div\n ref={text}\n id={textId}\n class=\"k2b-content-markdown k2b-message-row__text\"\n data-heading-scale=\"compact\"\n data-collapsed={collapsed() ? \"\" : undefined}\n onClick={copyCode}\n onFocusIn={revealFocus}\n innerHTML={rendered().html}\n />\n <Show when={collapsible()}>\n <div class=\"k2b-message-row__more-line\">\n <Button\n variant=\"text\"\n size=\"xs\"\n class=\"k2b-message-row__more\"\n aria-expanded={expanded() ? \"true\" : \"false\"}\n aria-controls={textId}\n onClick={() => setExpanded((value) => !value)}\n >\n {expanded() ? messages().messageShowLess : messages().messageShowMore}\n </Button>\n <Show when={props.edited}>\n <span class=\"k2b-message-row__edited\">{messages().messageEdited}</span>\n </Show>\n </div>\n </Show>\n </Show>\n </Show>\n </div>\n </Show>\n {/* Without a bubble to end, the edit marker takes the bubble's place. */}\n <Show when={content() && props.edited && !hasBubble()}>\n <div class=\"k2b-message-row__marker\">\n <i class=\"ti ti-pencil\" aria-hidden=\"true\" />\n <span class=\"k2b-message-row__edited\">{messages().messageEdited}</span>\n </div>\n </Show>\n <Show when={media().length > 0}>\n <div\n class=\"k2b-message-row__media\"\n role=\"group\"\n aria-label={messages().attachments}\n data-count={Math.min(media().length, MEDIA_SHOWN)}\n style={media().length === 1 ? { width: mediaWidth(media()[0]!) } : undefined}\n >\n <For each={shownMedia()}>{(item, index) => mediaItem(item, index)}</For>\n </div>\n </Show>\n <Show when={files().length > 0}>\n <div class=\"k2b-message-row__files\">\n <For each={files()}>\n {(file) => (\n <AttachmentTarget class=\"k2b-message-row__file\" onOpen={file.onOpen} href={file.href}>\n <span class=\"k2b-message-row__file-icon\" aria-hidden=\"true\">\n <i class={fileIcon(file)} />\n </span>\n <span class=\"k2b-message-row__file-copy\">\n <span class=\"k2b-message-row__file-name\">{file.name}</span>\n <Show when={file.detail}>\n <span class=\"k2b-message-row__file-detail\">{file.detail}</span>\n </Show>\n </span>\n </AttachmentTarget>\n )}\n </For>\n </div>\n </Show>\n <Show when={content() && props.linkPreview}>\n <div class=\"k2b-message-row__slot\">{props.linkPreview}</div>\n </Show>\n <Show when={content() && props.card}>\n <div class=\"k2b-message-row__slot\">{props.card}</div>\n </Show>\n <Show when={props.thread}>\n {(thread) => (\n <button type=\"button\" class=\"k2b-message-row__thread\" onClick={() => thread().onOpen()}>\n <Show when={(thread().participants?.length ?? 0) > 0}>\n <span class=\"k2b-message-row__thread-people\" aria-hidden=\"true\">\n <For each={thread().participants?.slice(0, 3)}>\n {(person) => <Avatar name={person.name} src={person.avatar} icon={person.icon} size=\"xs\" />}\n </For>\n </span>\n </Show>\n <span class=\"k2b-message-row__thread-count\">{messages().messageReplies({ count: thread().count })}</span>\n <Show when={thread().lastReply}>\n {(time) => (\n <time class=\"k2b-message-row__thread-time\" datetime={dateTimeOf(thread().lastReplyDateTime)}>\n {messages().messageLastReply({ time: time() })}\n </time>\n )}\n </Show>\n </button>\n )}\n </Show>\n <Show when={hasFooter()}>\n <div class=\"k2b-message-row__footer\">\n <Show when={reactions()}>\n {(list) => (\n <div\n class=\"k2b-message-row__reactions\"\n role=\"group\"\n aria-label={messages().messageReactions}\n data-empty={list().length === 0 ? \"\" : undefined}\n >\n <Show when={list().length > 0}>\n {/* Chips that do not fit scroll sideways behind a fade. Read-only chips are no tab stops, so the list\n is one: a keyboard can scroll it. */}\n <ScrollArea\n orientation=\"horizontal\"\n class=\"k2b-message-row__reaction-list\"\n tabindex={props.onToggleReaction ? undefined : 0}\n >\n <For each={reactionKeys()}>\n {(key) => <Show when={reactionByKey().get(key)}>{(reaction) => reactionChip(key, reaction)}</Show>}\n </For>\n </ScrollArea>\n </Show>\n <Show when={props.onAddReaction}>\n {(add) => (\n <IconButton\n label={messages().messageAddReaction}\n size=\"xs\"\n class=\"k2b-message-row__react\"\n onClick={(event) => add()(event.currentTarget)}\n >\n <i class=\"ti ti-mood-plus\" aria-hidden=\"true\" />\n </IconButton>\n )}\n </Show>\n </div>\n )}\n </Show>\n <Show when={hasLine()}>\n <div class=\"k2b-message-row__line\">\n <Show\n when={props.progress}\n fallback={\n <>\n <Show when={props.status === \"pending\"}>\n <i class=\"ti ti-clock\" aria-hidden=\"true\" />\n <span>{messages().sending}</span>\n </Show>\n <Show when={props.status === \"failed\"}>\n <i class=\"ti ti-alert-circle\" aria-hidden=\"true\" />\n <span>{messages().messageNotSent}</span>\n <Show when={props.onRetry}>\n {(retry) => (\n <Button variant=\"text\" size=\"xs\" onClick={() => retry()()}>\n {messages().messageRetry}\n </Button>\n )}\n </Show>\n </Show>\n <Show when={props.status !== \"pending\" && props.status !== \"failed\"}>\n <Show\n when={props.receipt}\n fallback={\n <Show when={props.status === \"sent\"}>\n <i class=\"ti ti-check\" aria-hidden=\"true\" />\n <span class=\"k2b-sr-only\">{messages().messageSent}</span>\n </Show>\n }\n >\n {(receipt) => (\n <>\n <i class=\"ti ti-checks\" aria-hidden=\"true\" />\n <span class=\"k2b-message-row__receipt\">{receipt()}</span>\n </>\n )}\n </Show>\n </Show>\n </>\n }\n >\n {(progress) => (\n <>\n <i class=\"ti ti-loader-2 k2b-spin\" aria-hidden=\"true\" />\n <span class=\"k2b-message-row__line-text\">{progress().status}</span>\n <Show when={progress().onStop}>\n {(stop) => (\n <Button variant=\"text\" size=\"xs\" onClick={() => stop()()}>\n {messages().messageStop}\n </Button>\n )}\n </Show>\n </>\n )}\n </Show>\n </div>\n </Show>\n </div>\n </Show>\n </div>\n <Show when={(props.actions?.length ?? 0) > 0}>\n <div class=\"k2b-message-row__actions\" role=\"group\" aria-label={messages().messageActions}>\n <For each={props.actions}>\n {(action) => (\n <IconButton label={action.label} size=\"sm\" disabled={action.disabled} onClick={() => action.onSelect()}>\n <i class={action.icon} aria-hidden=\"true\" />\n </IconButton>\n )}\n </For>\n </div>\n </Show>\n </div>\n );\n}\n\n/** A quiet, centered line for something that happened in the conversation, such as a person joining. */\nexport function MessageSystemRow(props: MessageSystemRowProps): JSX.Element {\n return (\n <div class={props.class ? `k2b-message-system-row ${props.class}` : \"k2b-message-system-row\"}>\n <Show when={props.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n <span>{props.children}</span>\n <Show when={props.time}>\n <time datetime={dateTimeOf(props.dateTime)}>{props.time}</time>\n </Show>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,QAAQ,aAAa;AAEvC,SAAwB,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAY,SAAS,EAAE,IAAI,QAAQ,UAAU;AAClH,SAAS,MAAM,EAAE,UAAU,QAAQ,mBAAmB;AACtD,SAAS,QAAQ,QAAQ,uBAAuB;AAChD,SAAS,QAAQ,QAAQ,sBAAsB;AAC/C,SAAS,SAAS,QAAQ,gBAAgB;AAC1C,SAA0B,aAAa,QAAQ,kBAAkB;AACjE,SAAS,UAAU,QAAQ,sBAAsB;AACjD,SAAS,MAAM,QAAQ,oBAAoB;AAC3C,SAAS,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,QAAQ,gBAAgB;;AAEjF;AACA,MAAM,eAAe,GAAG,CAAC,GAAG,MAAM;AAClC;AACA;AACA;AACA;AACA;AACA,MAAM,cAAc,GAAG,EAAE;AACzB;AACA,MAAM,UAAU,GAAG,GAAG;AACtB;AACA,MAAM,UAAU,GAAG,CAAC;AACpB,MAAM,SAAS,GAAG,KAAK;AACvB;AACA,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAU;AAC9D;AACA,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAA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AAK,SAAE,GAAG,wBAAwB,qCACzF,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,KAAK,CAAC,IAAI;IAAA;IAAA,UAAI,IAAI,qDAAe,IAAI,CAAC,CAAC;EAAuB,cACnE,KAAK,CAAC,QAAQ,8BACpB,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,KAAK,CAAC,IAAI;IAAA;IAAA;MAAA,2DACJ,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,0BAAG,KAAK,CAAC,IAAI;IAAA;EAAA;AAI/D","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["content/MessageRow.tsx"],"sourcesContent":["import { fileIcons } from \"@k2b/stdlib\";\nimport type { Token, Tokens } from \"marked\";\nimport { type Accessor, createMemo, createSignal, createUniqueId, For, type JSX, onCleanup, Show } from \"solid-js\";\nimport { Button, IconButton } from \"../actions/Button\";\nimport { copyText } from \"../actions/CopyButton\";\nimport { announce } from \"../feedback/announce\";\nimport { useLocale } from \"../intl/locale\";\nimport { type UiMessages, useUiMessages } from \"../intl/messages\";\nimport { ScrollArea } from \"../layout/ScrollArea\";\nimport { Avatar } from \"../surfaces/Avatar\";\nimport { createSafeMarked, createSafeRenderer, escapeHtml } from \"./MarkdownView\";\n\n/** Messages by the same author within this time continue a group. */\nconst GROUP_WINDOW_MS = 5 * 60_000;\n/**\n * A message collapses to ten lines (`.k2b-message-row__text[data-collapsed]`) when its rendered text takes more lines\n * than this. `renderedLines` counts the fewest lines the text takes at any width, so a collapsed message always hides\n * some of it.\n */\nconst COLLAPSE_LINES = 14;\n/** Visible characters that take at least one line of a message, even at its widest. */\nconst LINE_CHARS = 100;\n/** Lines at the bottom of a collapsed message that fade out, as `.k2b-message-row__text[data-collapsed]` draws them. */\nconst FADE_LINES = 2;\nconst COPIED_MS = 2_000;\n/** Links in messages may only use these schemes; other links show as their text. */\nconst LINK_PROTOCOLS = [\"https:\", \"http:\", \"mailto:\"] as const;\n/** Attachments open and load only from these schemes or from a relative URL. */\nconst ATTACHMENT_PROTOCOLS = new Set([\"https:\", \"http:\"]);\n/**\n * A picture may also show a file that is still uploading. A `blob:` URL runs in the page's origin when it is opened,\n * so links never use one.\n */\nconst PICTURE_PROTOCOLS = new Set([...ATTACHMENT_PROTOCOLS, \"blob:\"]);\n/** A grid shows this many images or videos; the last one tells how many more there are. */\nconst MEDIA_SHOWN = 4;\n/** A single image keeps its own aspect ratio within these bounds; beyond them it is cropped to fit. */\nconst MEDIA_RATIO_MIN = 0.5;\nconst MEDIA_RATIO_MAX = 3;\n\nexport type MessageRowAuthor = {\n /** Display name, shown at the start of a group and read before every message. */\n name: string;\n /** Picture URL. Without one, the avatar shows initials on the author's tint. */\n avatar?: string | null;\n /** Icon class shown instead of initials, for example for an automated author. */\n icon?: string;\n};\n\nexport type MessageRowStatus = \"pending\" | \"sent\" | \"failed\";\n\nexport type MessageRowAction = {\n id: string;\n /** Accessible name and tooltip. */\n label: string;\n /** Icon class, for example `ti ti-arrow-back-up`. */\n icon: string;\n onSelect: () => void;\n disabled?: boolean;\n};\n\nexport type MessageRowQuote = {\n /** Name of the quoted message's author. */\n author: string;\n /** Plain text of the quoted message. It shows at most two lines. */\n text: string;\n /** Opens the quoted message, for example by scrolling to it. Without it, the quote is not a control. */\n onSelect?: () => void;\n};\n\nexport type MessageRowReaction = {\n /** Stable identity of the reaction, passed to `onToggleReaction`. */\n key: string;\n emoji: string;\n count: number;\n /** The reader reacted this way; the chip shows pressed. */\n own?: boolean;\n /** Who reacted, for example \"Nora, Tobias\". Read by screen readers and shown as a tooltip. */\n label?: string;\n};\n\nexport type MessageRowThread = {\n /** Number of replies. */\n count: number;\n /** People who replied, most recent first; the bar shows up to three. */\n participants?: readonly MessageRowAuthor[];\n /** Visible time of the last reply, formatted by the caller. */\n lastReply?: string;\n lastReplyDateTime?: string | Date;\n onOpen: () => void;\n};\n\ntype MessageRowAttachmentTarget = {\n /** Opens the attachment, for example in a lightbox. Takes precedence over `href`. */\n onOpen?: () => void;\n /** Opens the attachment in a new tab. Absolute `https` or `http`, or relative. */\n href?: string;\n};\n\nexport type MessageRowMedia = MessageRowAttachmentTarget & {\n kind: \"image\" | \"video\";\n /** The image, or the poster frame of a video. Absolute `https` or `http`, relative, `blob`, or `data:image/`. */\n src: string;\n /** Describes the image or video for people who cannot see it. */\n alt: string;\n /** Stored pixel size. The row reserves the area from it, so nothing moves when the image loads. */\n width: number;\n height: number;\n /** Visible length of a video, for example \"0:42\". */\n duration?: string;\n};\n\nexport type MessageRowFile = MessageRowAttachmentTarget & {\n kind: \"file\";\n name: string;\n /** Second line, for example \"PDF · 412 KB\". */\n detail?: string;\n /** Media type, used with the name to choose the icon. */\n mediaType?: string;\n /** Icon class instead of the one chosen from the name. */\n icon?: string;\n};\n\nexport type MessageRowAttachment = MessageRowMedia | MessageRowFile;\n\nexport type MessageRowProgress = {\n /** What is happening, for example \"Writing\" or \"Searching the files\". */\n status: string;\n /** Called by \"Stop\". */\n onStop?: () => void;\n};\n\nexport type MessageRowProps = {\n author: MessageRowAuthor;\n /** Message text as Markdown. Raw HTML shows as text; links must be absolute and use `https`, `http`, or `mailto`. */\n text: string;\n /** Visible time, formatted by the caller, so server and browser render the same text. */\n time: string;\n /** Machine-readable time for the `<time>` element. */\n dateTime?: string | Date;\n /** The reader's own message: on the right in the accent tint, without avatar or name. */\n own?: boolean;\n /**\n * Starts a group with avatar, name, badge, and time. A continuation shows only its text; screen readers still hear\n * the author and time. Defaults to true; `startsMessageGroup` decides it from the previous message.\n */\n groupStart?: boolean;\n /** Shown next to the name at the start of a group, for example the kind of account. */\n badge?: JSX.Element;\n /** Send state. Sets a line of fixed height below the message: a clock, a check, or \"Not sent\" with \"Retry\". */\n status?: MessageRowStatus;\n /** Text shown in that line instead of the check once someone has read the message, for example \"Read by Nora\". */\n receipt?: string;\n /** Called by \"Retry\" while `status` is `\"failed\"`. */\n onRetry?: () => void;\n /** Shown as a toolbar over the message while it is hovered or focused. It never moves the layout. */\n actions?: readonly MessageRowAction[];\n /** The message this one answers, shown above it. */\n quote?: MessageRowQuote;\n /** Marks the message as forwarded from somewhere else. */\n forwarded?: boolean;\n /** Marks the message as edited after it was sent. */\n edited?: boolean;\n /** Shows \"This message was deleted\" instead of the text, quote, attachments, previews, and reactions. */\n deleted?: boolean;\n /** Images and videos in a grid with areas reserved from their stored size, then files as chips. */\n attachments?: readonly MessageRowAttachment[];\n /** A preview of a link in the text, supplied with its final height. */\n linkPreview?: JSX.Element;\n /** A card for an element the message refers to, such as a task or a document, supplied with its final height. */\n card?: JSX.Element;\n /**\n * Reactions in a bar of fixed height. The bar shows whenever this is set, even to an empty list, so chips that come\n * and go never change the row. Only setting it where it was unset adds a line, so pass it on own messages and on\n * messages that have or had reactions, and leave it out on others' messages that never had one.\n */\n reactions?: readonly MessageRowReaction[];\n /** Called with a reaction's `key` when the reader presses its chip. Without it, the chips are not controls. */\n onToggleReaction?: (key: string) => void;\n /** Called by \"Add reaction\" in the reaction bar, with the button to anchor a picker to. */\n onAddReaction?: (anchor: HTMLElement) => void;\n /** A bar of fixed height that opens the replies to this message. */\n thread?: MessageRowThread;\n /** The message is still being written, by a person or an automated author alike: a status line with \"Stop\". */\n progress?: MessageRowProgress;\n class?: string;\n};\n\nexport type MessageSystemRowProps = {\n /** What happened, for example \"Nora added Tobias\". */\n children: JSX.Element;\n /** Visible time, formatted by the caller. */\n time?: string;\n dateTime?: string | Date;\n /** Icon class shown before the text. */\n icon?: string;\n class?: string;\n};\n\nexport type MessageGroupEntry = {\n /** Stable identity of the author. */\n author: string;\n at: Date | number | string;\n /** System rows never belong to a group. */\n system?: boolean;\n};\n\nconst timestamp = (value: Date | number | string) => (value instanceof Date ? value.getTime() : new Date(value).getTime());\n\n/**\n * Whether a message starts a new group: there is no previous message, either is a system row, the author changes, or\n * more than five minutes passed. Also start a group where you show a separator such as a new day.\n */\nexport const startsMessageGroup = (entry: MessageGroupEntry, previous?: MessageGroupEntry | null): boolean => {\n if (!previous || entry.system || previous.system || entry.author !== previous.author) return true;\n const gap = timestamp(entry.at) - timestamp(previous.at);\n return !(gap >= 0 && gap <= GROUP_WINDOW_MS);\n};\n\n/** Text that wraps: every `LINE_CHARS` visible characters of a line take at least one line. */\nconst wrappedLines = (text: string): number =>\n text.split(\"\\n\").reduce((lines, line) => lines + Math.ceil(line.trim().length / LINE_CHARS), 0);\n\n/** What inline tokens show: a link its label, never its destination. */\nconst inlineText = (tokens: readonly Token[]): string => {\n let text = \"\";\n for (const token of tokens) {\n if (token.type === \"br\") text += \"\\n\";\n else if (\"tokens\" in token && token.tokens) text += inlineText(token.tokens);\n else if (\"text\" in token) text += token.text;\n }\n return text;\n};\n\n/**\n * The fewest lines the rendered tokens take at any width. Code never wraps, so each of its lines is one line, blank\n * ones too, and its bar one more. Link destinations and reference definitions show nothing. Decided from the text\n * alone, so the row has its final height when it mounts.\n */\nconst renderedLines = (tokens: readonly Token[]): number => {\n let lines = 0;\n for (const token of tokens) {\n switch (token.type) {\n case \"code\":\n lines += token.text.split(\"\\n\").length + 1;\n break;\n case \"list\":\n for (const item of token.items) lines += Math.max(1, renderedLines(item.tokens));\n break;\n case \"table\":\n lines += token.rows.length + (token.header.some((cell: Tokens.TableCell) => cell.text.trim()) ? 1 : 0);\n break;\n case \"paragraph\":\n case \"heading\":\n case \"text\":\n lines += wrappedLines(token.tokens ? inlineText(token.tokens) : token.text);\n break;\n case \"hr\":\n lines += 1;\n break;\n case \"space\":\n case \"def\":\n break;\n default:\n if (\"tokens\" in token && token.tokens) lines += renderedLines(token.tokens);\n else if (\"text\" in token) lines += wrappedLines(token.text);\n }\n }\n return lines;\n};\n\n/** Messages link only to absolute URLs; a relative one would lead somewhere else on every page that shows it. */\nconst isAbsoluteUrl = (href: string): boolean => {\n try {\n return new URL(href).protocol !== \"\";\n } catch {\n return false;\n }\n};\n\nconst dateTimeOf = (value: string | Date | undefined): string | undefined => {\n if (value === undefined) return undefined;\n const date = value instanceof Date ? value : new Date(value);\n return Number.isFinite(date.getTime()) ? date.toISOString() : undefined;\n};\n\n/**\n * An attachment URL the row may load or open: absolute with an allowed scheme, or relative to the page. A picture may\n * also be a `blob:` URL or a `data:image/` URL, which an image element shows without running anything.\n */\nconst attachmentUrl = (url: string | undefined, picture = false): string | undefined => {\n if (!url) return undefined;\n if (picture && /^data:image\\//i.test(url)) return url;\n try {\n return (picture ? PICTURE_PROTOCOLS : ATTACHMENT_PROTOCOLS).has(new URL(url, \"https://relative.invalid/\").protocol) ? url : undefined;\n } catch {\n return undefined;\n }\n};\n\n/** The aspect ratio a single image or video reserves, from its stored size. */\nconst mediaRatio = (media: MessageRowMedia): number => {\n const ratio = media.width > 0 && media.height > 0 ? media.width / media.height : 4 / 3;\n return Math.min(MEDIA_RATIO_MAX, Math.max(MEDIA_RATIO_MIN, ratio));\n};\n\n/** The width of a single image or video: its stored width, at most the row's media height tall, never wider than the row. */\nconst mediaWidth = (media: MessageRowMedia): string => {\n const natural = Number.isFinite(media.width) && media.width > 0 ? `${media.width}px, ` : \"\";\n return `min(100%, ${natural}calc(var(--k2b-message-media-height) * ${mediaRatio(media)}))`;\n};\n\n/** Only the `ti-*` glyph of `fileIcons`, which may add colour utilities that `@k2b/ui` does not ship. */\nconst fileIcon = (file: MessageRowFile): string =>\n file.icon ??\n `ti ${fileIcons\n .getFileIcon({ name: file.name, type: \"file\", mimeType: file.mediaType })\n .split(/\\s+/)\n .filter((token) => token.startsWith(\"ti-\"))\n .join(\" \")}`;\n\n/** A link, a button, or neither, depending on what the caller passes. */\nfunction AttachmentTarget(\n props: MessageRowAttachmentTarget & {\n class: string;\n style?: JSX.CSSProperties;\n /** Names a picture; without a link or button around it, the element becomes the image. */\n label?: string;\n children: JSX.Element;\n },\n): JSX.Element {\n return (\n <Show\n when={props.onOpen}\n fallback={\n <Show\n when={attachmentUrl(props.href)}\n fallback={\n <Show\n when={props.label}\n fallback={\n <span class={props.class} style={props.style}>\n {props.children}\n </span>\n }\n >\n {(label) => (\n <span class={props.class} style={props.style} role=\"img\" aria-label={label()}>\n {props.children}\n </span>\n )}\n </Show>\n }\n >\n {(href) => (\n <a class={props.class} style={props.style} href={href()} target=\"_blank\" rel=\"noopener noreferrer\" aria-label={props.label}>\n {props.children}\n </a>\n )}\n </Show>\n }\n >\n {(open) => (\n <button type=\"button\" class={props.class} style={props.style} aria-label={props.label} onClick={() => open()()}>\n {props.children}\n </button>\n )}\n </Show>\n );\n}\n\n/**\n * Renders the safe Markdown of `MarkdownView` with line breaks kept, absolute links only, and a copy control above\n * every code block, and counts the fewest lines it takes. An edited message that does not collapse ends with the marker.\n */\nconst renderMessage = (text: string, locale: string, messages: UiMessages, edited: boolean): { html: string; lines: number } => {\n const renderer = createSafeRenderer({ allowImages: false, linkProtocols: LINK_PROTOCOLS, linkTarget: \"_blank\", locale });\n const renderLink = renderer.link.bind(renderer);\n renderer.link = (token: Tokens.Link) => (isAbsoluteUrl(token.href) ? renderLink(token) : renderer.parser.parseInline(token.tokens));\n const renderCode = renderer.code.bind(renderer);\n renderer.code = (token: Tokens.Code) => {\n const language = token.lang?.match(/^\\S{1,24}/)?.[0];\n const block = renderCode(token).replace(/^<pre>/, '<pre tabindex=\"0\">');\n return (\n '<div class=\"k2b-message-row__code\" data-gesture-ignore><div class=\"k2b-message-row__code-bar\">' +\n `<span class=\"k2b-message-row__code-label\">${escapeHtml(language ?? messages.code)}</span>` +\n '<button type=\"button\" class=\"k2b-message-row__copy\">' +\n `<span class=\"k2b-message-row__copy-idle\"><i class=\"ti ti-copy\" aria-hidden=\"true\"></i>${escapeHtml(messages.copy)}</span>` +\n `<span class=\"k2b-message-row__copy-done\"><i class=\"ti ti-check\" aria-hidden=\"true\"></i>${escapeHtml(messages.copied)}</span>` +\n `</button></div>${block}</div>`\n );\n };\n const marked = createSafeMarked(locale).setOptions({ breaks: true, renderer });\n const tokens = marked.lexer(text);\n const html = marked.parser(tokens);\n const lines = renderedLines(tokens);\n // A collapsed message would hide the end of its text, so its marker sits next to \"Show more\" instead.\n if (!edited || lines > COLLAPSE_LINES) return { html, lines };\n // The marker ends the last paragraph, so it takes no line of its own there.\n const marker = `<span class=\"k2b-message-row__edited\">${escapeHtml(messages.messageEdited)}</span>`;\n const end = html.trimEnd();\n return { html: end.endsWith(\"</p>\") ? `${end.slice(0, -4)} ${marker}</p>` : `${html}<p>${marker}</p>`, lines };\n};\n\n/**\n * One message in a conversation with many people: own messages on the right, others on the left with avatar, name,\n * and time at the start of a group. Every part has its final height when the row mounts, so a virtualized list such\n * as `VirtualFeed` keeps its positions.\n */\nexport function MessageRow(props: MessageRowProps): JSX.Element {\n const messages = useUiMessages();\n const locale = useLocale();\n const textId = `k2b-message-${createUniqueId()}`;\n const [expanded, setExpanded] = createSignal(false);\n const rendered = createMemo(() => renderMessage(props.text, locale(), messages(), Boolean(props.edited)));\n const collapsible = () => rendered().lines > COLLAPSE_LINES;\n const collapsed = () => collapsible() && !expanded();\n const groupStart = () => props.groupStart ?? true;\n const hasLine = () => props.progress !== undefined || props.status !== undefined || props.receipt !== undefined;\n const reactions = () => (props.deleted ? undefined : props.reactions);\n // Chips follow their keys, so a chip keeps its element, and focus, when the caller passes new objects for it.\n const reactionKeys = createMemo(() => reactions()?.map((reaction) => reaction.key) ?? []);\n const reactionByKey = createMemo(() => new Map(reactions()?.map((reaction) => [reaction.key, reaction])));\n const hasFooter = () => hasLine() || reactions() !== undefined;\n const writing = () => props.progress !== undefined && !props.deleted && props.text.trim() === \"\";\n const hasBubble = () => props.deleted || writing() || props.text.trim() !== \"\";\n const content = () => !props.deleted;\n const media = createMemo(() =>\n content() ? (props.attachments ?? []).filter((attachment): attachment is MessageRowMedia => attachment.kind !== \"file\") : [],\n );\n const files = createMemo(() =>\n content() ? (props.attachments ?? []).filter((attachment): attachment is MessageRowFile => attachment.kind === \"file\") : [],\n );\n const shownMedia = () => media().slice(0, MEDIA_SHOWN);\n const hiddenMedia = () => media().length - shownMedia().length;\n let text: HTMLDivElement | undefined;\n let copiedTimer: ReturnType<typeof setTimeout> | undefined;\n\n onCleanup(() => clearTimeout(copiedTimer));\n\n const copyCode = (event: MouseEvent) => {\n const button = (event.target as Element | null)?.closest?.<HTMLButtonElement>(\".k2b-message-row__copy\");\n if (!button || !text?.contains(button)) return;\n const code = button.closest(\".k2b-message-row__code\")?.querySelector(\"pre\")?.textContent ?? \"\";\n copyText(code).then(\n () => {\n for (const other of text?.querySelectorAll<HTMLElement>(\".k2b-message-row__copy[data-copied]\") ?? []) delete other.dataset.copied;\n button.dataset.copied = \"\";\n announce(messages().copied);\n clearTimeout(copiedTimer);\n copiedTimer = setTimeout(() => delete button.dataset.copied, COPIED_MS);\n },\n () => {},\n );\n };\n\n // A keyboard user who reaches a link or code block in the hidden or faded part of a collapsed message gets the whole\n // message. The collapsed text clips instead of scrolling, so the browser cannot scroll it to the target instead.\n const revealFocus = (event: FocusEvent) => {\n if (!text || !collapsed() || !(event.target instanceof Element)) return;\n const fade = text.getBoundingClientRect().bottom - FADE_LINES * Number.parseFloat(getComputedStyle(text).lineHeight);\n if (event.target.getBoundingClientRect().bottom > fade) setExpanded(true);\n };\n\n const header = () => (\n <>\n <span class=\"k2b-message-row__name\">{props.author.name}</span>\n <Show when={props.badge}>\n <span class=\"k2b-message-row__badge\">{props.badge}</span>\n </Show>\n <time class=\"k2b-message-row__time\" datetime={dateTimeOf(props.dateTime)}>\n {props.time}\n </time>\n </>\n );\n\n const quote = (value: MessageRowQuote) => (\n <>\n <i class=\"ti ti-arrow-back-up\" aria-hidden=\"true\" />\n <span class=\"k2b-message-row__quote-text\">\n <span class=\"k2b-sr-only\">{messages().messageReplyTo} </span>\n <span class=\"k2b-message-row__quote-author\">{value.author}</span> {value.text}\n </span>\n </>\n );\n\n /** The picture's description, then that it is a video and how long, then how many more the grid hides. */\n const mediaLabel = (item: MessageRowMedia, more: number) =>\n [\n item.alt,\n item.kind === \"video\" ? [messages().messageVideo, item.duration].filter(Boolean).join(\" \") : \"\",\n more > 0 ? messages().messageMoreAttachments({ count: more }) : \"\",\n ]\n .filter(Boolean)\n .join(\", \");\n\n /** A toggle button, or with no `onToggleReaction` a labelled image that also says whether the reader reacted. */\n const reactionChip = (key: string, reaction: Accessor<MessageRowReaction>) => {\n const label = (own: boolean) =>\n messages().messageReaction({ emoji: reaction().emoji, count: reaction().count, names: reaction().label, own });\n return (\n <Show\n when={props.onToggleReaction}\n fallback={\n <span\n class=\"k2b-message-row__reaction\"\n role=\"img\"\n aria-label={label(Boolean(reaction().own))}\n title={reaction().label}\n data-own={reaction().own ? \"\" : undefined}\n >\n <span aria-hidden=\"true\">{reaction().emoji}</span>\n <span aria-hidden=\"true\">{reaction().count}</span>\n </span>\n }\n >\n {(toggle) => (\n <button\n type=\"button\"\n class=\"k2b-message-row__reaction\"\n aria-pressed={reaction().own ? \"true\" : \"false\"}\n aria-label={label(false)}\n title={reaction().label}\n data-own={reaction().own ? \"\" : undefined}\n onClick={() => toggle()(key)}\n >\n <span aria-hidden=\"true\">{reaction().emoji}</span>\n <span aria-hidden=\"true\">{reaction().count}</span>\n </button>\n )}\n </Show>\n );\n };\n\n const mediaItem = (item: MessageRowMedia, index: () => number) => {\n const more = () => (index() === shownMedia().length - 1 ? hiddenMedia() : 0);\n return (\n <AttachmentTarget\n class=\"k2b-message-row__media-item\"\n style={media().length === 1 ? { \"aspect-ratio\": String(mediaRatio(item)) } : undefined}\n label={mediaLabel(item, more())}\n onOpen={item.onOpen}\n href={item.href}\n >\n <img\n src={attachmentUrl(item.src, true)}\n alt=\"\"\n width={item.width > 0 ? item.width : undefined}\n height={item.height > 0 ? item.height : undefined}\n loading=\"lazy\"\n decoding=\"async\"\n />\n <Show when={item.kind === \"video\"}>\n <span class=\"k2b-message-row__media-play\" aria-hidden=\"true\">\n <i class=\"ti ti-player-play\" />\n </span>\n <Show when={item.duration}>\n <span class=\"k2b-message-row__media-duration\" aria-hidden=\"true\">\n {item.duration}\n </span>\n </Show>\n </Show>\n <Show when={more() > 0}>\n <span class=\"k2b-message-row__media-more\" aria-hidden=\"true\">\n +{more()}\n </span>\n </Show>\n </AttachmentTarget>\n );\n };\n\n return (\n <div\n class={props.class ? `k2b-message-row ${props.class}` : \"k2b-message-row\"}\n data-own={props.own ? \"\" : undefined}\n data-group-start={groupStart() ? \"\" : undefined}\n data-status={props.status}\n data-media={media().length > 0 ? \"\" : undefined}\n >\n <Show when={!props.own}>\n <div class=\"k2b-message-row__gutter\">\n <Show when={groupStart()}>\n <span class=\"k2b-message-row__avatar\" aria-hidden=\"true\">\n <Avatar name={props.author.name} src={props.author.avatar} icon={props.author.icon} size=\"sm\" />\n </span>\n </Show>\n </div>\n </Show>\n <div class=\"k2b-message-row__body\">\n <Show\n when={groupStart()}\n fallback={\n <span class=\"k2b-sr-only\">\n {props.author.name}, {props.time}:{\" \"}\n </span>\n }\n >\n <Show\n when={!props.own}\n fallback={\n <div class=\"k2b-message-row__meta\">\n <span class=\"k2b-sr-only\">{props.author.name}, </span>\n <time class=\"k2b-message-row__time\" datetime={dateTimeOf(props.dateTime)}>\n {props.time}\n </time>\n </div>\n }\n >\n <div class=\"k2b-message-row__meta\">{header()}</div>\n </Show>\n </Show>\n <Show when={content() && props.forwarded}>\n <div class=\"k2b-message-row__marker\">\n <i class=\"ti ti-arrow-forward-up\" aria-hidden=\"true\" />\n <span>{messages().messageForwarded}</span>\n </div>\n </Show>\n <Show when={content() && props.quote}>\n {(value) => (\n <Show when={value().onSelect} fallback={<div class=\"k2b-message-row__quote\">{quote(value())}</div>}>\n {(select) => (\n <button type=\"button\" class=\"k2b-message-row__quote\" onClick={() => select()()}>\n {quote(value())}\n </button>\n )}\n </Show>\n )}\n </Show>\n <Show when={hasBubble()}>\n <div\n class=\"k2b-message-row__bubble\"\n data-deleted={props.deleted ? \"\" : undefined}\n aria-busy={props.progress && !props.deleted ? \"true\" : undefined}\n >\n <Show\n when={!props.deleted}\n fallback={\n <span class=\"k2b-message-row__deleted\">\n <i class=\"ti ti-message-off\" aria-hidden=\"true\" />\n {messages().messageDeleted}\n </span>\n }\n >\n <Show\n when={!writing()}\n fallback={\n <span class=\"k2b-message-row__writing\">\n <span class=\"k2b-chat-progress-dots\" aria-hidden=\"true\">\n <span />\n <span />\n <span />\n </span>\n </span>\n }\n >\n {/* biome-ignore lint/a11y/noStaticElementInteractions lint/a11y/useKeyWithClickEvents: the native copy buttons inside the rendered Markdown are the targets; their clicks, including from the keyboard, bubble here. */}\n <div\n ref={text}\n id={textId}\n class=\"k2b-content-markdown k2b-message-row__text\"\n data-heading-scale=\"compact\"\n data-collapsed={collapsed() ? \"\" : undefined}\n onClick={copyCode}\n onFocusIn={revealFocus}\n innerHTML={rendered().html}\n />\n <Show when={collapsible()}>\n <div class=\"k2b-message-row__more-line\">\n <Button\n variant=\"text\"\n size=\"xs\"\n class=\"k2b-message-row__more\"\n aria-expanded={expanded() ? \"true\" : \"false\"}\n aria-controls={textId}\n onClick={() => setExpanded((value) => !value)}\n >\n {expanded() ? messages().messageShowLess : messages().messageShowMore}\n </Button>\n <Show when={props.edited}>\n <span class=\"k2b-message-row__edited\">{messages().messageEdited}</span>\n </Show>\n </div>\n </Show>\n </Show>\n </Show>\n </div>\n </Show>\n {/* Without a bubble to end, the edit marker takes the bubble's place. */}\n <Show when={content() && props.edited && !hasBubble()}>\n <div class=\"k2b-message-row__marker\">\n <i class=\"ti ti-pencil\" aria-hidden=\"true\" />\n <span class=\"k2b-message-row__edited\">{messages().messageEdited}</span>\n </div>\n </Show>\n <Show when={media().length > 0}>\n <div\n class=\"k2b-message-row__media\"\n role=\"group\"\n aria-label={messages().attachments}\n data-count={Math.min(media().length, MEDIA_SHOWN)}\n style={media().length === 1 ? { width: mediaWidth(media()[0]!) } : undefined}\n >\n <For each={shownMedia()}>{(item, index) => mediaItem(item, index)}</For>\n </div>\n </Show>\n <Show when={files().length > 0}>\n <div class=\"k2b-message-row__files\">\n <For each={files()}>\n {(file) => (\n <AttachmentTarget class=\"k2b-message-row__file\" onOpen={file.onOpen} href={file.href}>\n <span class=\"k2b-message-row__file-icon\" aria-hidden=\"true\">\n <i class={fileIcon(file)} />\n </span>\n <span class=\"k2b-message-row__file-copy\">\n <span class=\"k2b-message-row__file-name\">{file.name}</span>\n <Show when={file.detail}>\n <span class=\"k2b-message-row__file-detail\">{file.detail}</span>\n </Show>\n </span>\n </AttachmentTarget>\n )}\n </For>\n </div>\n </Show>\n <Show when={content() && props.linkPreview}>\n <div class=\"k2b-message-row__slot\" data-gesture-ignore>\n {props.linkPreview}\n </div>\n </Show>\n <Show when={content() && props.card}>\n <div class=\"k2b-message-row__slot\" data-gesture-ignore>\n {props.card}\n </div>\n </Show>\n <Show when={props.thread}>\n {(thread) => (\n <button type=\"button\" class=\"k2b-message-row__thread\" onClick={() => thread().onOpen()}>\n <Show when={(thread().participants?.length ?? 0) > 0}>\n <span class=\"k2b-message-row__thread-people\" aria-hidden=\"true\">\n <For each={thread().participants?.slice(0, 3)}>\n {(person) => <Avatar name={person.name} src={person.avatar} icon={person.icon} size=\"xs\" />}\n </For>\n </span>\n </Show>\n <span class=\"k2b-message-row__thread-count\">{messages().messageReplies({ count: thread().count })}</span>\n <Show when={thread().lastReply}>\n {(time) => (\n <time class=\"k2b-message-row__thread-time\" datetime={dateTimeOf(thread().lastReplyDateTime)}>\n {messages().messageLastReply({ time: time() })}\n </time>\n )}\n </Show>\n </button>\n )}\n </Show>\n <Show when={hasFooter()}>\n <div class=\"k2b-message-row__footer\">\n <Show when={reactions()}>\n {(list) => (\n <div\n class=\"k2b-message-row__reactions\"\n role=\"group\"\n aria-label={messages().messageReactions}\n data-empty={list().length === 0 ? \"\" : undefined}\n >\n <Show when={list().length > 0}>\n {/* Chips that do not fit scroll sideways behind a fade. Read-only chips are no tab stops, so the list\n is one: a keyboard can scroll it. */}\n <ScrollArea\n orientation=\"horizontal\"\n class=\"k2b-message-row__reaction-list\"\n tabindex={props.onToggleReaction ? undefined : 0}\n >\n <For each={reactionKeys()}>\n {(key) => <Show when={reactionByKey().get(key)}>{(reaction) => reactionChip(key, reaction)}</Show>}\n </For>\n </ScrollArea>\n </Show>\n <Show when={props.onAddReaction}>\n {(add) => (\n <IconButton\n label={messages().messageAddReaction}\n size=\"xs\"\n class=\"k2b-message-row__react\"\n onClick={(event) => add()(event.currentTarget)}\n >\n <i class=\"ti ti-mood-plus\" aria-hidden=\"true\" />\n </IconButton>\n )}\n </Show>\n </div>\n )}\n </Show>\n <Show when={hasLine()}>\n <div class=\"k2b-message-row__line\">\n <Show\n when={props.progress}\n fallback={\n <>\n <Show when={props.status === \"pending\"}>\n <i class=\"ti ti-clock\" aria-hidden=\"true\" />\n <span>{messages().sending}</span>\n </Show>\n <Show when={props.status === \"failed\"}>\n <i class=\"ti ti-alert-circle\" aria-hidden=\"true\" />\n <span>{messages().messageNotSent}</span>\n <Show when={props.onRetry}>\n {(retry) => (\n <Button variant=\"text\" size=\"xs\" onClick={() => retry()()}>\n {messages().messageRetry}\n </Button>\n )}\n </Show>\n </Show>\n <Show when={props.status !== \"pending\" && props.status !== \"failed\"}>\n <Show\n when={props.receipt}\n fallback={\n <Show when={props.status === \"sent\"}>\n <i class=\"ti ti-check\" aria-hidden=\"true\" />\n <span class=\"k2b-sr-only\">{messages().messageSent}</span>\n </Show>\n }\n >\n {(receipt) => (\n <>\n <i class=\"ti ti-checks\" aria-hidden=\"true\" />\n <span class=\"k2b-message-row__receipt\">{receipt()}</span>\n </>\n )}\n </Show>\n </Show>\n </>\n }\n >\n {(progress) => (\n <>\n <i class=\"ti ti-loader-2 k2b-spin\" aria-hidden=\"true\" />\n <span class=\"k2b-message-row__line-text\">{progress().status}</span>\n <Show when={progress().onStop}>\n {(stop) => (\n <Button variant=\"text\" size=\"xs\" onClick={() => stop()()}>\n {messages().messageStop}\n </Button>\n )}\n </Show>\n </>\n )}\n </Show>\n </div>\n </Show>\n </div>\n </Show>\n </div>\n <Show when={(props.actions?.length ?? 0) > 0}>\n <div class=\"k2b-message-row__actions\" role=\"group\" aria-label={messages().messageActions}>\n <For each={props.actions}>\n {(action) => (\n <IconButton label={action.label} size=\"sm\" disabled={action.disabled} onClick={() => action.onSelect()}>\n <i class={action.icon} aria-hidden=\"true\" />\n </IconButton>\n )}\n </For>\n </div>\n </Show>\n </div>\n );\n}\n\n/** A quiet, centered line for something that happened in the conversation, such as a person joining. */\nexport function MessageSystemRow(props: MessageSystemRowProps): JSX.Element {\n return (\n <div class={props.class ? `k2b-message-system-row ${props.class}` : \"k2b-message-system-row\"}>\n <Show when={props.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n <span>{props.children}</span>\n <Show when={props.time}>\n <time datetime={dateTimeOf(props.dateTime)}>{props.time}</time>\n </Show>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,QAAQ,aAAa;AAEvC,SAAwB,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAY,SAAS,EAAE,IAAI,QAAQ,UAAU;AAClH,SAAS,MAAM,EAAE,UAAU,QAAQ,mBAAmB;AACtD,SAAS,QAAQ,QAAQ,uBAAuB;AAChD,SAAS,QAAQ,QAAQ,sBAAsB;AAC/C,SAAS,SAAS,QAAQ,gBAAgB;AAC1C,SAA0B,aAAa,QAAQ,kBAAkB;AACjE,SAAS,UAAU,QAAQ,sBAAsB;AACjD,SAAS,MAAM,QAAQ,oBAAoB;AAC3C,SAAS,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,QAAQ,gBAAgB;;AAEjF;AACA,MAAM,eAAe,GAAG,CAAC,GAAG,MAAM;AAClC;AACA;AACA;AACA;AACA;AACA,MAAM,cAAc,GAAG,EAAE;AACzB;AACA,MAAM,UAAU,GAAG,GAAG;AACtB;AACA,MAAM,UAAU,GAAG,CAAC;AACpB,MAAM,SAAS,GAAG,KAAK;AACvB;AACA,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAU;AAC9D;AACA,MAAM,oBAAoB,GAAG,IAAI,GAAG,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,CAAC,KAAK,GAAG,mCAA0B,KAAK,CAAC,KAAK,SAAE,GAAG,wBAAwB,qCACzF,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,KAAK,CAAC,IAAI;IAAA;IAAA,UAAI,IAAI,qDAAe,IAAI,CAAC,CAAC;EAAuB,cACnE,KAAK,CAAC,QAAQ,8BACpB,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,KAAK,CAAC,IAAI;IAAA;IAAA;MAAA,2DACJ,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,0BAAG,KAAK,CAAC,IAAI;IAAA;EAAA;AAI/D","ignoreList":[]}
@@ -26,6 +26,8 @@ export function TextInput(props) {
26
26
  const icon = () => local.icon ?? (local.variant === "ai" ? "ti ti-sparkles" : local.markdown ? "ti ti-markdown" : "ti ti-cursor-text");
27
27
  // A custom icon stays while typing (a search field keeps its magnifier); only the default icon switches to the pencil.
28
28
  const activeIcon = () => local.activeIcon ?? local.icon ?? (local.variant === "ai" ? "ti ti-sparkles" : "ti ti-pencil");
29
+ // Names, addresses and passwords are typed exactly: phone keyboards must not capitalize or "correct" them.
30
+ const verbatim = () => local.password || local.type === "email" || local.type === "url" || /\b(username|email|url)\b/.test(String(rest.autocomplete ?? ""));
29
31
  const input = next => local.onValueChange?.(next);
30
32
  const commit = next => local.onValueCommit?.(next);
31
33
  const clear = () => {
@@ -75,7 +77,17 @@ export function TextInput(props) {
75
77
  return multiline();
76
78
  },
77
79
  get fallback() {
78
- return _$ssrElement("input", _$mergeProps(rest, {
80
+ return _$ssrElement("input", _$mergeProps({
81
+ get autocapitalize() {
82
+ return verbatim() ? "none" : undefined;
83
+ },
84
+ get autocorrect() {
85
+ return verbatim() ? "off" : undefined;
86
+ },
87
+ get spellcheck() {
88
+ return verbatim() ? false : undefined;
89
+ }
90
+ }, rest, {
79
91
  get id() {
80
92
  return meta.controlId;
81
93
  },
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["inputs/TextInput.tsx"],"sourcesContent":["import { createSignal, type JSX, Show, splitProps } from \"solid-js\";\nimport { createFieldMeta, Field, fieldControlAria } from \"../internal/field\";\nimport { useUiMessages } from \"../intl/messages\";\nimport type { Completion } from \"./completion\";\nimport type { ValueFieldProps } from \"./field-contract\";\nimport { commitFieldValue, resolveMaybeAccessor } from \"./field-contract\";\nimport { MarkdownEditor } from \"./markdown/MarkdownEditor\";\n\nexport type TextInputProps = Omit<\n JSX.InputHTMLAttributes<HTMLInputElement>,\n \"onChange\" | \"onInput\" | \"prefix\" | \"suffix\" | \"type\" | \"value\" | keyof ValueFieldProps<string>\n> &\n ValueFieldProps<string> & {\n minLength?: number;\n maxLength?: number;\n type?: \"text\" | \"search\" | \"email\" | \"url\" | \"tel\";\n variant?: \"default\" | \"ai\";\n icon?: string;\n activeIcon?: string;\n prefix?: JSX.Element;\n suffix?: JSX.Element;\n clearable?: boolean;\n onClear?: () => void;\n clearLabel?: string;\n multiline?: boolean;\n monospace?: boolean;\n password?: boolean;\n markdown?: boolean;\n onSubmit?: () => void;\n lines?: number;\n abbreviations?: Record<string, string>;\n completions?: readonly Completion[];\n };\n\nexport function TextInput(props: TextInputProps): JSX.Element {\n const messages = useUiMessages();\n const [local, rest] = splitProps(props, [\n \"activeIcon\",\n \"aria-describedby\",\n \"aria-label\",\n \"class\",\n \"clearLabel\",\n \"clearable\",\n \"completions\",\n \"description\",\n \"error\",\n \"icon\",\n \"id\",\n \"label\",\n \"lines\",\n \"markdown\",\n \"minLength\",\n \"maxLength\",\n \"monospace\",\n \"multiline\",\n \"onClear\",\n \"onValueCommit\",\n \"onSubmit\",\n \"onValueChange\",\n \"password\",\n \"prefix\",\n \"required\",\n \"suffix\",\n \"type\",\n \"value\",\n \"variant\",\n \"abbreviations\",\n ]);\n const meta = createFieldMeta(local.id);\n const value = () => resolveMaybeAccessor(local.value) ?? \"\";\n const error = () => resolveMaybeAccessor(local.error);\n const [passwordVisible, setPasswordVisible] = createSignal(false);\n const multiline = () => Boolean(local.multiline || local.markdown);\n const icon = () => local.icon ?? (local.variant === \"ai\" ? \"ti ti-sparkles\" : local.markdown ? \"ti ti-markdown\" : \"ti ti-cursor-text\");\n // A custom icon stays while typing (a search field keeps its magnifier); only the default icon switches to the pencil.\n const activeIcon = () => local.activeIcon ?? local.icon ?? (local.variant === \"ai\" ? \"ti ti-sparkles\" : \"ti ti-pencil\");\n const input = (next: string) => local.onValueChange?.(next);\n const commit = (next: string) => local.onValueCommit?.(next);\n const clear = () => {\n if (local.onClear) {\n local.onClear();\n return;\n }\n commitFieldValue(local, \"\");\n };\n\n return (\n <Show\n when={local.markdown}\n fallback={\n <Field\n class={local.class}\n label={local.label}\n description={local.description}\n error={error()}\n meta={meta}\n required={local.required}\n disabled={rest.disabled}\n >\n <div\n class=\"k2b-input-shell k2b-text-input\"\n data-invalid={error() ? \"true\" : undefined}\n data-ai={local.variant === \"ai\" ? \"true\" : undefined}\n data-multiline={multiline() ? \"true\" : undefined}\n data-monospace={local.monospace ? \"true\" : undefined}\n style={multiline() ? { \"--k2b-editor-lines\": String(local.lines ?? 3) } : undefined}\n >\n <span class=\"k2b-input-shell__icon k2b-text-input__icon\" aria-hidden=\"true\">\n <i class={icon()} />\n <i class={activeIcon()} />\n </span>\n <Show when={local.prefix}>\n <span class=\"k2b-input-shell__affix\">{local.prefix}</span>\n </Show>\n <Show\n when={multiline()}\n fallback={\n <input\n {...rest}\n id={meta.controlId}\n class=\"k2b-input\"\n type={local.password && !passwordVisible() ? \"password\" : (local.type ?? \"text\")}\n value={value()}\n minlength={local.minLength}\n maxlength={local.maxLength}\n required={local.required}\n {...fieldControlAria(meta, local)}\n onInput={(event) => {\n input(event.currentTarget.value);\n }}\n onChange={(event) => commit(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (local.onSubmit && event.key === \"Enter\" && !event.shiftKey && !event.metaKey) {\n event.preventDefault();\n local.onSubmit();\n }\n }}\n />\n }\n >\n <textarea\n {...(rest as unknown as JSX.TextareaHTMLAttributes<HTMLTextAreaElement>)}\n id={meta.controlId}\n class=\"k2b-input k2b-text-input__textarea\"\n value={value()}\n rows={local.lines ?? 3}\n required={local.required}\n minlength={local.minLength}\n maxlength={local.maxLength}\n {...fieldControlAria(meta, local)}\n onInput={(event) => {\n input(event.currentTarget.value);\n }}\n onChange={(event) => commit(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (local.onSubmit && event.key === \"Enter\" && !event.shiftKey && !event.metaKey) {\n event.preventDefault();\n local.onSubmit();\n }\n }}\n />\n </Show>\n <Show when={local.suffix}>\n <span class=\"k2b-input-shell__affix\">{local.suffix}</span>\n </Show>\n <Show when={local.clearable && value() && !multiline() && !local.password && !rest.disabled && !rest.readOnly}>\n <button\n type=\"button\"\n class=\"k2b-input-shell__clear k2b-input-clear-action\"\n aria-label={local.clearLabel ?? messages().clear}\n onClick={clear}\n >\n <i class=\"ti ti-x\" aria-hidden=\"true\" />\n </button>\n </Show>\n <Show when={local.password && !multiline()}>\n <button\n type=\"button\"\n class=\"k2b-input-shell__clear\"\n aria-label={passwordVisible() ? messages().hidePassword : messages().showPassword}\n aria-pressed={passwordVisible()}\n disabled={rest.disabled}\n onClick={() => setPasswordVisible((visible) => !visible)}\n >\n <i class={passwordVisible() ? \"ti ti-eye-off\" : \"ti ti-eye\"} aria-hidden=\"true\" />\n </button>\n </Show>\n </div>\n </Field>\n }\n >\n <MarkdownEditor\n class={local.class}\n label={local.label}\n description={local.description}\n error={error()}\n id={meta.controlId}\n name={rest.name}\n value={value()}\n onValueChange={input}\n onValueCommit={local.onValueCommit}\n onSubmit={local.onSubmit}\n placeholder={rest.placeholder}\n disabled={rest.disabled}\n required={local.required}\n lines={local.lines}\n maxLength={local.maxLength}\n spellcheck={rest.spellcheck === undefined ? undefined : rest.spellcheck === true || rest.spellcheck === \"true\"}\n abbreviations={local.abbreviations}\n completions={local.completions}\n aria-label={local[\"aria-label\"]}\n aria-describedby={local[\"aria-describedby\"]}\n />\n </Show>\n );\n}\n\nexport default TextInput;\n"],"mappings":";;;;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AK,CAAC,CAAC;QAAA;QACd,aAAa,EAAE,KAAK;QAAA,IACpB,aAAa;UAAA,OAAE,KAAK,CAAC,aAAa;QAAA;QAAA,IAClC,QAAQ;UAAA,OAAE,KAAK,CAAC,QAAQ;QAAA;QAAA,IACxB,WAAW;UAAA,OAAE,IAAI,CAAC,WAAW;QAAA;QAAA,IAC7B,QAAQ;UAAA,OAAE,IAAI,CAAC,QAAQ;QAAA;QAAA,IACvB,QAAQ;UAAA,OAAE,KAAK,CAAC,QAAQ;QAAA;QAAA,IACxB,KAAK;UAAA,OAAE,KAAK,CAAC,KAAK;QAAA;QAAA,IAClB,SAAS;UAAA,OAAE,KAAK,CAAC,SAAS;QAAA;QAAA,IAC1B,UAAU;UAAA,OAAE,iBAAI,CAAC,UAAU,KAAK,SAAS,MAAG,SAAS,GAAG,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,KAAK,MAAM;QAAA;QAAA,IAC9G,aAAa;UAAA,OAAE,KAAK,CAAC,aAAa;QAAA;QAAA,IAClC,WAAW;UAAA,OAAE,KAAK,CAAC,WAAW;QAAA;QAAA;UAAA,OAClB,KAAK,CAAC,YAAY,CAAC;QAAA;QAAA;UAAA,OACb,KAAK,CAAC,kBAAkB,CAAC;QAAA;MAAA;IAAA;EAAA;AAInD;AAEA,eAAe,SAAS","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["inputs/TextInput.tsx"],"sourcesContent":["import { createSignal, type JSX, Show, splitProps } from \"solid-js\";\nimport { createFieldMeta, Field, fieldControlAria } from \"../internal/field\";\nimport { useUiMessages } from \"../intl/messages\";\nimport type { Completion } from \"./completion\";\nimport type { ValueFieldProps } from \"./field-contract\";\nimport { commitFieldValue, resolveMaybeAccessor } from \"./field-contract\";\nimport { MarkdownEditor } from \"./markdown/MarkdownEditor\";\n\nexport type TextInputProps = Omit<\n JSX.InputHTMLAttributes<HTMLInputElement>,\n \"onChange\" | \"onInput\" | \"prefix\" | \"suffix\" | \"type\" | \"value\" | keyof ValueFieldProps<string>\n> &\n ValueFieldProps<string> & {\n minLength?: number;\n maxLength?: number;\n type?: \"text\" | \"search\" | \"email\" | \"url\" | \"tel\";\n variant?: \"default\" | \"ai\";\n icon?: string;\n activeIcon?: string;\n prefix?: JSX.Element;\n suffix?: JSX.Element;\n clearable?: boolean;\n onClear?: () => void;\n clearLabel?: string;\n multiline?: boolean;\n monospace?: boolean;\n password?: boolean;\n markdown?: boolean;\n onSubmit?: () => void;\n lines?: number;\n abbreviations?: Record<string, string>;\n completions?: readonly Completion[];\n };\n\nexport function TextInput(props: TextInputProps): JSX.Element {\n const messages = useUiMessages();\n const [local, rest] = splitProps(props, [\n \"activeIcon\",\n \"aria-describedby\",\n \"aria-label\",\n \"class\",\n \"clearLabel\",\n \"clearable\",\n \"completions\",\n \"description\",\n \"error\",\n \"icon\",\n \"id\",\n \"label\",\n \"lines\",\n \"markdown\",\n \"minLength\",\n \"maxLength\",\n \"monospace\",\n \"multiline\",\n \"onClear\",\n \"onValueCommit\",\n \"onSubmit\",\n \"onValueChange\",\n \"password\",\n \"prefix\",\n \"required\",\n \"suffix\",\n \"type\",\n \"value\",\n \"variant\",\n \"abbreviations\",\n ]);\n const meta = createFieldMeta(local.id);\n const value = () => resolveMaybeAccessor(local.value) ?? \"\";\n const error = () => resolveMaybeAccessor(local.error);\n const [passwordVisible, setPasswordVisible] = createSignal(false);\n const multiline = () => Boolean(local.multiline || local.markdown);\n const icon = () => local.icon ?? (local.variant === \"ai\" ? \"ti ti-sparkles\" : local.markdown ? \"ti ti-markdown\" : \"ti ti-cursor-text\");\n // A custom icon stays while typing (a search field keeps its magnifier); only the default icon switches to the pencil.\n const activeIcon = () => local.activeIcon ?? local.icon ?? (local.variant === \"ai\" ? \"ti ti-sparkles\" : \"ti ti-pencil\");\n // Names, addresses and passwords are typed exactly: phone keyboards must not capitalize or \"correct\" them.\n const verbatim = () =>\n local.password || local.type === \"email\" || local.type === \"url\" || /\\b(username|email|url)\\b/.test(String(rest.autocomplete ?? \"\"));\n const input = (next: string) => local.onValueChange?.(next);\n const commit = (next: string) => local.onValueCommit?.(next);\n const clear = () => {\n if (local.onClear) {\n local.onClear();\n return;\n }\n commitFieldValue(local, \"\");\n };\n\n return (\n <Show\n when={local.markdown}\n fallback={\n <Field\n class={local.class}\n label={local.label}\n description={local.description}\n error={error()}\n meta={meta}\n required={local.required}\n disabled={rest.disabled}\n >\n <div\n class=\"k2b-input-shell k2b-text-input\"\n data-invalid={error() ? \"true\" : undefined}\n data-ai={local.variant === \"ai\" ? \"true\" : undefined}\n data-multiline={multiline() ? \"true\" : undefined}\n data-monospace={local.monospace ? \"true\" : undefined}\n style={multiline() ? { \"--k2b-editor-lines\": String(local.lines ?? 3) } : undefined}\n >\n <span class=\"k2b-input-shell__icon k2b-text-input__icon\" aria-hidden=\"true\">\n <i class={icon()} />\n <i class={activeIcon()} />\n </span>\n <Show when={local.prefix}>\n <span class=\"k2b-input-shell__affix\">{local.prefix}</span>\n </Show>\n <Show\n when={multiline()}\n fallback={\n <input\n autocapitalize={verbatim() ? \"none\" : undefined}\n autocorrect={verbatim() ? \"off\" : undefined}\n spellcheck={verbatim() ? false : undefined}\n {...rest}\n id={meta.controlId}\n class=\"k2b-input\"\n type={local.password && !passwordVisible() ? \"password\" : (local.type ?? \"text\")}\n value={value()}\n minlength={local.minLength}\n maxlength={local.maxLength}\n required={local.required}\n {...fieldControlAria(meta, local)}\n onInput={(event) => {\n input(event.currentTarget.value);\n }}\n onChange={(event) => commit(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (local.onSubmit && event.key === \"Enter\" && !event.shiftKey && !event.metaKey) {\n event.preventDefault();\n local.onSubmit();\n }\n }}\n />\n }\n >\n <textarea\n {...(rest as unknown as JSX.TextareaHTMLAttributes<HTMLTextAreaElement>)}\n id={meta.controlId}\n class=\"k2b-input k2b-text-input__textarea\"\n value={value()}\n rows={local.lines ?? 3}\n required={local.required}\n minlength={local.minLength}\n maxlength={local.maxLength}\n {...fieldControlAria(meta, local)}\n onInput={(event) => {\n input(event.currentTarget.value);\n }}\n onChange={(event) => commit(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (local.onSubmit && event.key === \"Enter\" && !event.shiftKey && !event.metaKey) {\n event.preventDefault();\n local.onSubmit();\n }\n }}\n />\n </Show>\n <Show when={local.suffix}>\n <span class=\"k2b-input-shell__affix\">{local.suffix}</span>\n </Show>\n <Show when={local.clearable && value() && !multiline() && !local.password && !rest.disabled && !rest.readOnly}>\n <button\n type=\"button\"\n class=\"k2b-input-shell__clear k2b-input-clear-action\"\n aria-label={local.clearLabel ?? messages().clear}\n onClick={clear}\n >\n <i class=\"ti ti-x\" aria-hidden=\"true\" />\n </button>\n </Show>\n <Show when={local.password && !multiline()}>\n <button\n type=\"button\"\n class=\"k2b-input-shell__clear\"\n aria-label={passwordVisible() ? messages().hidePassword : messages().showPassword}\n aria-pressed={passwordVisible()}\n disabled={rest.disabled}\n onClick={() => setPasswordVisible((visible) => !visible)}\n >\n <i class={passwordVisible() ? \"ti ti-eye-off\" : \"ti ti-eye\"} aria-hidden=\"true\" />\n </button>\n </Show>\n </div>\n </Field>\n }\n >\n <MarkdownEditor\n class={local.class}\n label={local.label}\n description={local.description}\n error={error()}\n id={meta.controlId}\n name={rest.name}\n value={value()}\n onValueChange={input}\n onValueCommit={local.onValueCommit}\n onSubmit={local.onSubmit}\n placeholder={rest.placeholder}\n disabled={rest.disabled}\n required={local.required}\n lines={local.lines}\n maxLength={local.maxLength}\n spellcheck={rest.spellcheck === undefined ? undefined : rest.spellcheck === true || rest.spellcheck === \"true\"}\n abbreviations={local.abbreviations}\n completions={local.completions}\n aria-label={local[\"aria-label\"]}\n aria-describedby={local[\"aria-describedby\"]}\n />\n </Show>\n );\n}\n\nexport default TextInput;\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,YAAY,EAAY,IAAI,EAAE,UAAU,QAAQ,UAAU;AACnE,SAAS,eAAe,EAAE,KAAK,EAAE,gBAAgB,Q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{ replaceTextareaRange as replaceRange } from "../editor-dom";
2
- import { closesCodeFence, openCodeFence } from "./code-zone";
3
2
  const lineAt = (value, position) => {
4
3
  const lineStart = value.lastIndexOf("\n", position - 1) + 1;
5
4
  const nextNewline = value.indexOf("\n", position);
@@ -117,47 +116,6 @@ export const toggleHeading = (textarea, level) => {
117
116
  textarea.setSelectionRange(caret, caret);
118
117
  };
119
118
  export const toggleBulletList = textarea => togglePrefix(textarea, "- ");
120
-
121
- /** Puts the selected lines between ``` fences. Inside a fenced block, from its opening line on, it removes that block's fences. */
122
- export const toggleCodeBlock = textarea => {
123
- const {
124
- value
125
- } = textarea;
126
- const {
127
- start,
128
- end,
129
- lines
130
- } = selectedLineRange(textarea);
131
- const open = openCodeFence(value, lineAt(value, start).lineEnd);
132
- if (open) {
133
- const bodyStart = Math.min(lineAt(value, open.start).lineEnd + 1, value.length);
134
- // An unclosed block runs to the end of the text.
135
- let bodyEnd = value.length;
136
- let blockEnd = value.length;
137
- for (let lineStart = bodyStart; lineStart < value.length;) {
138
- const {
139
- lineEnd,
140
- line
141
- } = lineAt(value, lineStart);
142
- if (closesCodeFence(line, open.marker)) {
143
- bodyEnd = Math.max(bodyStart, lineStart - 1);
144
- blockEnd = lineEnd;
145
- break;
146
- }
147
- lineStart = lineEnd + 1;
148
- }
149
- const body = value.slice(bodyStart, bodyEnd);
150
- replaceRange(textarea, open.start, blockEnd, body);
151
- textarea.setSelectionRange(open.start, open.start + body.length);
152
- return;
153
- }
154
- const body = lines.join("\n");
155
- // A fence in the selection would close a ``` block early, so the new block's fence is longer than any of them.
156
- const longest = Math.max(0, ...lines.map(line => /^(?:[ \t]*>)*[ \t]*(`{3,})/.exec(line)?.[1].length ?? 0));
157
- const fence = "`".repeat(Math.max(3, longest + 1));
158
- replaceRange(textarea, start, end, `${fence}\n${body}\n${fence}`);
159
- textarea.setSelectionRange(start + fence.length + 1, start + fence.length + 1 + body.length);
160
- };
161
119
  export const toggleQuote = textarea => togglePrefix(textarea, "> ");
162
120
  export const toggleNumberedList = textarea => {
163
121
  const {
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["inputs/markdown/actions.ts"],"sourcesContent":["import { replaceTextareaRange as replaceRange } from \"../editor-dom\";\nimport { closesCodeFence, openCodeFence } from \"./code-zone\";\n\nconst lineAt = (value: string, position: number): { lineStart: number; lineEnd: number; line: string } => {\n const lineStart = value.lastIndexOf(\"\\n\", position - 1) + 1;\n const nextNewline = value.indexOf(\"\\n\", position);\n const lineEnd = nextNewline === -1 ? value.length : nextNewline;\n return { lineStart, lineEnd, line: value.slice(lineStart, lineEnd) };\n};\n\nconst selectedLineRange = (textarea: HTMLTextAreaElement): { start: number; end: number; lines: string[] } => {\n const { value, selectionStart, selectionEnd } = textarea;\n const startLine = lineAt(value, selectionStart);\n const adjustedEnd =\n selectionEnd > selectionStart && selectionEnd > 0 && value[selectionEnd - 1] === \"\\n\" ? selectionEnd - 1 : selectionEnd;\n const endLine = lineAt(value, adjustedEnd);\n return {\n start: startLine.lineStart,\n end: endLine.lineEnd,\n lines: value.slice(startLine.lineStart, endLine.lineEnd).split(\"\\n\"),\n };\n};\n\nconst toggleInlineWrap = (textarea: HTMLTextAreaElement, marker: string, placeholder: string): void => {\n const { value, selectionStart, selectionEnd } = textarea;\n const markerLength = marker.length;\n // A one-character marker never takes half of a doubled one, so italic `*` leaves bold `**` alone.\n const doubled = (text: string, from: number, step: 1 | -1) =>\n markerLength === 1 && text[from] === marker && text[from + step] === marker && text[from + 2 * step] !== marker;\n const before = value.slice(Math.max(0, selectionStart - markerLength), selectionStart);\n const after = value.slice(selectionEnd, selectionEnd + markerLength);\n if (before === marker && after === marker && !doubled(value, selectionStart - 1, -1) && !doubled(value, selectionEnd, 1)) {\n replaceRange(textarea, selectionStart - markerLength, selectionEnd + markerLength, value.slice(selectionStart, selectionEnd));\n textarea.setSelectionRange(selectionStart - markerLength, selectionEnd - markerLength);\n return;\n }\n\n const selected = value.slice(selectionStart, selectionEnd);\n if (\n selected.length >= markerLength * 2 &&\n selected.startsWith(marker) &&\n selected.endsWith(marker) &&\n !doubled(selected, 0, 1) &&\n !doubled(selected, selected.length - 1, -1)\n ) {\n const stripped = selected.slice(markerLength, -markerLength);\n replaceRange(textarea, selectionStart, selectionEnd, stripped);\n textarea.setSelectionRange(selectionStart, selectionStart + stripped.length);\n return;\n }\n\n if (selectionStart === selectionEnd) {\n replaceRange(textarea, selectionStart, selectionEnd, marker + placeholder + marker);\n textarea.setSelectionRange(selectionStart + markerLength, selectionStart + markerLength + placeholder.length);\n } else {\n replaceRange(textarea, selectionStart, selectionEnd, marker + selected + marker);\n textarea.setSelectionRange(selectionStart + markerLength, selectionStart + markerLength + selected.length);\n }\n};\n\nexport const toggleBold = (textarea: HTMLTextAreaElement): void => toggleInlineWrap(textarea, \"**\", \"bold text\");\nexport const toggleItalic = (textarea: HTMLTextAreaElement): void => toggleInlineWrap(textarea, \"*\", \"italic text\");\nexport const toggleCode = (textarea: HTMLTextAreaElement): void => toggleInlineWrap(textarea, \"`\", \"code\");\n/** Wraps the selection in `marker`, or unwraps it; without a selection the caret lands between two markers. */\nexport const toggleInlineMarker = (textarea: HTMLTextAreaElement, marker: string): void => toggleInlineWrap(textarea, marker, \"\");\n\nexport const insertLink = (textarea: HTMLTextAreaElement, url?: string): void => {\n const { value, selectionStart, selectionEnd } = textarea;\n const selected = value.slice(selectionStart, selectionEnd);\n const label = selected || \"link\";\n const finalUrl = url ?? \"\";\n replaceRange(textarea, selectionStart, selectionEnd, `[${label}](${finalUrl})`);\n if (finalUrl) {\n textarea.setSelectionRange(selectionStart + 1, selectionStart + 1 + label.length);\n } else {\n const caret = selectionStart + label.length + 3;\n textarea.setSelectionRange(caret, caret);\n }\n};\n\nconst togglePrefix = (textarea: HTMLTextAreaElement, prefix: string): void => {\n const { start, end, lines } = selectedLineRange(textarea);\n const parts = lines.map((line) => {\n const match = /^(\\s*)(.*)$/.exec(line)!;\n return { indent: match[1]!, body: match[2]! };\n });\n const remove = parts.every(({ body }) => body.startsWith(prefix));\n const replacement = parts.map(({ indent, body }) => (remove ? indent + body.slice(prefix.length) : indent + prefix + body)).join(\"\\n\");\n replaceRange(textarea, start, end, replacement);\n textarea.setSelectionRange(start, start + replacement.length);\n};\n\nexport const toggleHeading = (textarea: HTMLTextAreaElement, level: 1 | 2 | 3): void => {\n const oldCaret = textarea.selectionStart;\n const { lineStart, lineEnd, line } = lineAt(textarea.value, oldCaret);\n const prefix = `${\"#\".repeat(level)} `;\n const existing = /^(#{1,6})\\s/.exec(line);\n const next =\n existing?.[1]?.length === level ? line.slice(existing[0].length) : existing ? prefix + line.slice(existing[0].length) : prefix + line;\n replaceRange(textarea, lineStart, lineEnd, next);\n const desired = Math.max(lineStart, oldCaret + next.length - line.length);\n const caret = Math.min(desired, lineStart + next.length);\n textarea.setSelectionRange(caret, caret);\n};\n\nexport const toggleBulletList = (textarea: HTMLTextAreaElement): void => togglePrefix(textarea, \"- \");\n\n/** Puts the selected lines between ``` fences. Inside a fenced block, from its opening line on, it removes that block's fences. */\nexport const toggleCodeBlock = (textarea: HTMLTextAreaElement): void => {\n const { value } = textarea;\n const { start, end, lines } = selectedLineRange(textarea);\n const open = openCodeFence(value, lineAt(value, start).lineEnd);\n if (open) {\n const bodyStart = Math.min(lineAt(value, open.start).lineEnd + 1, value.length);\n // An unclosed block runs to the end of the text.\n let bodyEnd = value.length;\n let blockEnd = value.length;\n for (let lineStart = bodyStart; lineStart < value.length; ) {\n const { lineEnd, line } = lineAt(value, lineStart);\n if (closesCodeFence(line, open.marker)) {\n bodyEnd = Math.max(bodyStart, lineStart - 1);\n blockEnd = lineEnd;\n break;\n }\n lineStart = lineEnd + 1;\n }\n const body = value.slice(bodyStart, bodyEnd);\n replaceRange(textarea, open.start, blockEnd, body);\n textarea.setSelectionRange(open.start, open.start + body.length);\n return;\n }\n const body = lines.join(\"\\n\");\n // A fence in the selection would close a ``` block early, so the new block's fence is longer than any of them.\n const longest = Math.max(0, ...lines.map((line) => /^(?:[ \\t]*>)*[ \\t]*(`{3,})/.exec(line)?.[1]!.length ?? 0));\n const fence = \"`\".repeat(Math.max(3, longest + 1));\n replaceRange(textarea, start, end, `${fence}\\n${body}\\n${fence}`);\n textarea.setSelectionRange(start + fence.length + 1, start + fence.length + 1 + body.length);\n};\n\nexport const toggleQuote = (textarea: HTMLTextAreaElement): void => togglePrefix(textarea, \"> \");\n\nexport const toggleNumberedList = (textarea: HTMLTextAreaElement): void => {\n const { start, end, lines } = selectedLineRange(textarea);\n const parts = lines.map((line) => {\n const match = /^(\\s*)(\\d+\\.\\s)?(.*)$/.exec(line)!;\n return {\n indent: match[1] ?? \"\",\n marker: match[2],\n body: match[3] ?? \"\",\n };\n });\n const remove = parts.every(({ marker }) => Boolean(marker));\n const replacement = parts.map(({ indent, body }, index) => (remove ? indent + body : `${indent}${index + 1}. ${body}`)).join(\"\\n\");\n replaceRange(textarea, start, end, replacement);\n textarea.setSelectionRange(start, start + replacement.length);\n};\n"],"mappings":"AAAA,SAAS,oBAAoB,IAAI,YAAY,QAAQ,eAAe;AACpE,SAAS,eAAe,EAAE,aAAa,QAAQ,aAAa;AAE5D,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,QAAgB,KAA2D;EACxG,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC;EAC3D,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;EACjD,MAAM,OAAO,GAAG,WAAW,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,WAAW;EAC/D,OAAO;IAAE,SAAS;IAAE,OAAO;IAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO;EAAE,CAAC;AACtE,CAAC;AAED,MAAM,iBAAiB,GAAI,QAA6B,IAAsD;EAC5G,MAAM;IAAE,KAAK;IAAE,cAAc;IAAE;EAAa,CAAC,GAA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inputs/markdown/actions.ts"],"sourcesContent":["import { replaceTextareaRange as replaceRange } from \"../editor-dom\";\n\nconst lineAt = (value: string, position: number): { lineStart: number; lineEnd: number; line: string } => {\n const lineStart = value.lastIndexOf(\"\\n\", position - 1) + 1;\n const nextNewline = value.indexOf(\"\\n\", position);\n const lineEnd = nextNewline === -1 ? value.length : nextNewline;\n return { lineStart, lineEnd, line: value.slice(lineStart, lineEnd) };\n};\n\nconst selectedLineRange = (textarea: HTMLTextAreaElement): { start: number; end: number; lines: string[] } => {\n const { value, selectionStart, selectionEnd } = textarea;\n const startLine = lineAt(value, selectionStart);\n const adjustedEnd =\n selectionEnd > selectionStart && selectionEnd > 0 && value[selectionEnd - 1] === \"\\n\" ? selectionEnd - 1 : selectionEnd;\n const endLine = lineAt(value, adjustedEnd);\n return {\n start: startLine.lineStart,\n end: endLine.lineEnd,\n lines: value.slice(startLine.lineStart, endLine.lineEnd).split(\"\\n\"),\n };\n};\n\nconst toggleInlineWrap = (textarea: HTMLTextAreaElement, marker: string, placeholder: string): void => {\n const { value, selectionStart, selectionEnd } = textarea;\n const markerLength = marker.length;\n // A one-character marker never takes half of a doubled one, so italic `*` leaves bold `**` alone.\n const doubled = (text: string, from: number, step: 1 | -1) =>\n markerLength === 1 && text[from] === marker && text[from + step] === marker && text[from + 2 * step] !== marker;\n const before = value.slice(Math.max(0, selectionStart - markerLength), selectionStart);\n const after = value.slice(selectionEnd, selectionEnd + markerLength);\n if (before === marker && after === marker && !doubled(value, selectionStart - 1, -1) && !doubled(value, selectionEnd, 1)) {\n replaceRange(textarea, selectionStart - markerLength, selectionEnd + markerLength, value.slice(selectionStart, selectionEnd));\n textarea.setSelectionRange(selectionStart - markerLength, selectionEnd - markerLength);\n return;\n }\n\n const selected = value.slice(selectionStart, selectionEnd);\n if (\n selected.length >= markerLength * 2 &&\n selected.startsWith(marker) &&\n selected.endsWith(marker) &&\n !doubled(selected, 0, 1) &&\n !doubled(selected, selected.length - 1, -1)\n ) {\n const stripped = selected.slice(markerLength, -markerLength);\n replaceRange(textarea, selectionStart, selectionEnd, stripped);\n textarea.setSelectionRange(selectionStart, selectionStart + stripped.length);\n return;\n }\n\n if (selectionStart === selectionEnd) {\n replaceRange(textarea, selectionStart, selectionEnd, marker + placeholder + marker);\n textarea.setSelectionRange(selectionStart + markerLength, selectionStart + markerLength + placeholder.length);\n } else {\n replaceRange(textarea, selectionStart, selectionEnd, marker + selected + marker);\n textarea.setSelectionRange(selectionStart + markerLength, selectionStart + markerLength + selected.length);\n }\n};\n\nexport const toggleBold = (textarea: HTMLTextAreaElement): void => toggleInlineWrap(textarea, \"**\", \"bold text\");\nexport const toggleItalic = (textarea: HTMLTextAreaElement): void => toggleInlineWrap(textarea, \"*\", \"italic text\");\nexport const toggleCode = (textarea: HTMLTextAreaElement): void => toggleInlineWrap(textarea, \"`\", \"code\");\n/** Wraps the selection in `marker`, or unwraps it; without a selection the caret lands between two markers. */\nexport const toggleInlineMarker = (textarea: HTMLTextAreaElement, marker: string): void => toggleInlineWrap(textarea, marker, \"\");\n\nexport const insertLink = (textarea: HTMLTextAreaElement, url?: string): void => {\n const { value, selectionStart, selectionEnd } = textarea;\n const selected = value.slice(selectionStart, selectionEnd);\n const label = selected || \"link\";\n const finalUrl = url ?? \"\";\n replaceRange(textarea, selectionStart, selectionEnd, `[${label}](${finalUrl})`);\n if (finalUrl) {\n textarea.setSelectionRange(selectionStart + 1, selectionStart + 1 + label.length);\n } else {\n const caret = selectionStart + label.length + 3;\n textarea.setSelectionRange(caret, caret);\n }\n};\n\nconst togglePrefix = (textarea: HTMLTextAreaElement, prefix: string): void => {\n const { start, end, lines } = selectedLineRange(textarea);\n const parts = lines.map((line) => {\n const match = /^(\\s*)(.*)$/.exec(line)!;\n return { indent: match[1]!, body: match[2]! };\n });\n const remove = parts.every(({ body }) => body.startsWith(prefix));\n const replacement = parts.map(({ indent, body }) => (remove ? indent + body.slice(prefix.length) : indent + prefix + body)).join(\"\\n\");\n replaceRange(textarea, start, end, replacement);\n textarea.setSelectionRange(start, start + replacement.length);\n};\n\nexport const toggleHeading = (textarea: HTMLTextAreaElement, level: 1 | 2 | 3): void => {\n const oldCaret = textarea.selectionStart;\n const { lineStart, lineEnd, line } = lineAt(textarea.value, oldCaret);\n const prefix = `${\"#\".repeat(level)} `;\n const existing = /^(#{1,6})\\s/.exec(line);\n const next =\n existing?.[1]?.length === level ? line.slice(existing[0].length) : existing ? prefix + line.slice(existing[0].length) : prefix + line;\n replaceRange(textarea, lineStart, lineEnd, next);\n const desired = Math.max(lineStart, oldCaret + next.length - line.length);\n const caret = Math.min(desired, lineStart + next.length);\n textarea.setSelectionRange(caret, caret);\n};\n\nexport const toggleBulletList = (textarea: HTMLTextAreaElement): void => togglePrefix(textarea, \"- \");\n\nexport const toggleQuote = (textarea: HTMLTextAreaElement): void => togglePrefix(textarea, \"> \");\n\nexport const toggleNumberedList = (textarea: HTMLTextAreaElement): void => {\n const { start, end, lines } = selectedLineRange(textarea);\n const parts = lines.map((line) => {\n const match = /^(\\s*)(\\d+\\.\\s)?(.*)$/.exec(line)!;\n return {\n indent: match[1] ?? \"\",\n marker: match[2],\n body: match[3] ?? \"\",\n };\n });\n const remove = parts.every(({ marker }) => Boolean(marker));\n const replacement = parts.map(({ indent, body }, index) => (remove ? indent + body : `${indent}${index + 1}. ${body}`)).join(\"\\n\");\n replaceRange(textarea, start, end, replacement);\n textarea.setSelectionRange(start, start + replacement.length);\n};\n"],"mappings":"AAAA,SAAS,oBAAoB,IAAI,YAAY,QAAQ,eAAe;AAEpE,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,QAAgB,KAA2D;EACxG,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC;EAC3D,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;EACjD,MAAM,OAAO,GAAG,WAAW,KAAK,CAAC,CAAC,GAAG,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AAC,QAAQ,CAAC;EACzD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAE,IAAI,IAAK;IAChC,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAE;IACjD,OAAO;MACL,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE;MACtB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;MAChB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI;IACpB,CAAC;EACH,CAAC,CAAC;EACF,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAAE;EAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;EAC3D,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAAE,MAAM;IAAE;EAAK,CAAC,EAAE,KAAK,KAAM,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,MAAM,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,EAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;EAClI,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,CAAC;EAC/C,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC;AAC/D,CAAC","ignoreList":[]}
@@ -495,9 +495,6 @@ const uiMessages = i18n.define({
495
495
  writeMessage: "Write a message or type / ...",
496
496
  writeConversationMessage: "Write a message",
497
497
  composerFormatting: "Formatting",
498
- strikethroughShortcut: "Strikethrough (Ctrl/Cmd+Shift+X)",
499
- codeBlock: "Code block",
500
- insertLink: "Link",
501
498
  insertEmoji: "Insert emoji",
502
499
  emojiSuggestions: "Emoji suggestions",
503
500
  dictate: "Dictate",
@@ -1150,9 +1147,6 @@ const uiMessages = i18n.define({
1150
1147
  writeMessage: "Nachricht schreiben oder / eingeben ...",
1151
1148
  writeConversationMessage: "Nachricht schreiben",
1152
1149
  composerFormatting: "Formatierung",
1153
- strikethroughShortcut: "Durchgestrichen (Strg/Cmd+Umschalt+X)",
1154
- codeBlock: "Codeblock",
1155
- insertLink: "Link",
1156
1150
  insertEmoji: "Emoji einfügen",
1157
1151
  emojiSuggestions: "Emoji-Vorschläge",
1158
1152
  dictate: "Diktieren",