@k2b/ui 0.18.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.
- package/README.md +3 -2
- package/dist/browser/actions/ContextMenu.js +3 -1
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/Dropdown.js +91 -46
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/FilterChip.js +4 -1
- package/dist/browser/actions/FilterChip.js.map +1 -1
- package/dist/browser/actions/GestureMenu.js +467 -0
- package/dist/browser/actions/GestureMenu.js.map +1 -0
- package/dist/browser/actions/index.js +1 -0
- package/dist/browser/actions/index.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +1255 -534
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/chat/ChatPrimitives.js +9 -3
- package/dist/browser/chat/ChatPrimitives.js.map +1 -1
- package/dist/browser/chat/ChatTimeline.js +19 -1
- package/dist/browser/chat/ChatTimeline.js.map +1 -1
- package/dist/browser/chat/chat-behavior.js +9 -0
- package/dist/browser/chat/chat-behavior.js.map +1 -1
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/chat/types.js.map +1 -1
- package/dist/browser/content/Calendar.js +579 -533
- package/dist/browser/content/Calendar.js.map +1 -1
- package/dist/browser/content/Lightbox.js +76 -40
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/MessageRow.js +2 -2
- package/dist/browser/content/MessageRow.js.map +1 -1
- package/dist/browser/content/PdfPreview.js +146 -79
- package/dist/browser/content/PdfPreview.js.map +1 -1
- package/dist/browser/content/Timeline.js +1038 -0
- package/dist/browser/content/Timeline.js.map +1 -0
- package/dist/browser/content/VideoPlayer.js +29 -9
- package/dist/browser/content/VideoPlayer.js.map +1 -1
- package/dist/browser/content/chart-inspection.js +7 -2
- package/dist/browser/content/chart-inspection.js.map +1 -1
- package/dist/browser/content/index.js +1 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/timeline-model.js +579 -0
- package/dist/browser/content/timeline-model.js.map +1 -0
- package/dist/browser/feedback/dialog-core.js +26 -14
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/inputs/ChoiceChips.js +66 -0
- package/dist/browser/inputs/ChoiceChips.js.map +1 -0
- package/dist/browser/inputs/ChoiceGroups.js +53 -12
- package/dist/browser/inputs/ChoiceGroups.js.map +1 -1
- package/dist/browser/inputs/FileInputs.js +48 -33
- package/dist/browser/inputs/FileInputs.js.map +1 -1
- package/dist/browser/inputs/SignatureInput.js +558 -0
- package/dist/browser/inputs/SignatureInput.js.map +1 -0
- package/dist/browser/inputs/TextInput.js +13 -1
- package/dist/browser/inputs/TextInput.js.map +1 -1
- package/dist/browser/inputs/emoji/EmojiPicker.js +841 -0
- package/dist/browser/inputs/emoji/EmojiPicker.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-data.js +1903 -0
- package/dist/browser/inputs/emoji/emoji-data.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-index.js +209 -0
- package/dist/browser/inputs/emoji/emoji-index.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-messages.js +64 -0
- package/dist/browser/inputs/emoji/emoji-messages.js.map +1 -0
- package/dist/browser/inputs/index.js +5 -0
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/inputs/markdown/actions.js +6 -2
- package/dist/browser/inputs/markdown/actions.js.map +1 -1
- package/dist/browser/inputs/markdown/code-zone.js +38 -2
- package/dist/browser/inputs/markdown/code-zone.js.map +1 -1
- package/dist/browser/inputs/signature-messages.js +39 -0
- package/dist/browser/inputs/signature-messages.js.map +1 -0
- package/dist/browser/inputs/signature.js +208 -0
- package/dist/browser/inputs/signature.js.map +1 -0
- package/dist/browser/internal/render-error.js +49 -0
- package/dist/browser/internal/render-error.js.map +1 -0
- package/dist/browser/intl/messages.js +102 -0
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +321 -222
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/FloatingWindow.js +4 -1
- package/dist/browser/layout/FloatingWindow.js.map +1 -1
- package/dist/browser/layout/SidebarItemPreview.js +5 -1
- package/dist/browser/layout/SidebarItemPreview.js.map +1 -1
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/surfaces/ResourceCard.js +212 -0
- package/dist/browser/surfaces/ResourceCard.js.map +1 -0
- package/dist/browser/surfaces/index.js +1 -0
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/licenses/emojibase-data.txt +21 -0
- package/dist/ssr/actions/ContextMenu.js +3 -1
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +49 -12
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/FilterChip.js +4 -1
- package/dist/ssr/actions/FilterChip.js.map +1 -1
- package/dist/ssr/actions/GestureMenu.js +411 -0
- package/dist/ssr/actions/GestureMenu.js.map +1 -0
- package/dist/ssr/actions/index.js +1 -0
- package/dist/ssr/actions/index.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +767 -214
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/chat/ChatPrimitives.js +9 -3
- package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
- package/dist/ssr/chat/ChatTimeline.js +19 -1
- package/dist/ssr/chat/ChatTimeline.js.map +1 -1
- package/dist/ssr/chat/chat-behavior.js +9 -0
- package/dist/ssr/chat/chat-behavior.js.map +1 -1
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/chat/types.js.map +1 -1
- package/dist/ssr/content/Calendar.js +183 -142
- package/dist/ssr/content/Calendar.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +19 -5
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/MessageRow.js +2 -2
- package/dist/ssr/content/MessageRow.js.map +1 -1
- package/dist/ssr/content/PdfPreview.js +77 -36
- package/dist/ssr/content/PdfPreview.js.map +1 -1
- package/dist/ssr/content/Timeline.js +804 -0
- package/dist/ssr/content/Timeline.js.map +1 -0
- package/dist/ssr/content/VideoPlayer.js +29 -9
- package/dist/ssr/content/VideoPlayer.js.map +1 -1
- package/dist/ssr/content/chart-inspection.js +7 -2
- package/dist/ssr/content/chart-inspection.js.map +1 -1
- package/dist/ssr/content/index.js +1 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/timeline-model.js +579 -0
- package/dist/ssr/content/timeline-model.js.map +1 -0
- package/dist/ssr/feedback/dialog-core.js +26 -14
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/inputs/ChoiceChips.js +66 -0
- package/dist/ssr/inputs/ChoiceChips.js.map +1 -0
- package/dist/ssr/inputs/ChoiceGroups.js +12 -4
- package/dist/ssr/inputs/ChoiceGroups.js.map +1 -1
- package/dist/ssr/inputs/FileInputs.js +19 -4
- package/dist/ssr/inputs/FileInputs.js.map +1 -1
- package/dist/ssr/inputs/SignatureInput.js +404 -0
- package/dist/ssr/inputs/SignatureInput.js.map +1 -0
- package/dist/ssr/inputs/TextInput.js +13 -1
- package/dist/ssr/inputs/TextInput.js.map +1 -1
- package/dist/ssr/inputs/emoji/EmojiPicker.js +551 -0
- package/dist/ssr/inputs/emoji/EmojiPicker.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-data.js +1903 -0
- package/dist/ssr/inputs/emoji/emoji-data.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-index.js +209 -0
- package/dist/ssr/inputs/emoji/emoji-index.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-messages.js +64 -0
- package/dist/ssr/inputs/emoji/emoji-messages.js.map +1 -0
- package/dist/ssr/inputs/index.js +5 -0
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/inputs/markdown/actions.js +6 -2
- package/dist/ssr/inputs/markdown/actions.js.map +1 -1
- package/dist/ssr/inputs/markdown/code-zone.js +38 -2
- package/dist/ssr/inputs/markdown/code-zone.js.map +1 -1
- package/dist/ssr/inputs/signature-messages.js +39 -0
- package/dist/ssr/inputs/signature-messages.js.map +1 -0
- package/dist/ssr/inputs/signature.js +208 -0
- package/dist/ssr/inputs/signature.js.map +1 -0
- package/dist/ssr/internal/render-error.js +49 -0
- package/dist/ssr/internal/render-error.js.map +1 -0
- package/dist/ssr/intl/messages.js +102 -0
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +112 -41
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/FloatingWindow.js +4 -1
- package/dist/ssr/layout/FloatingWindow.js.map +1 -1
- package/dist/ssr/layout/SidebarItemPreview.js +5 -1
- package/dist/ssr/layout/SidebarItemPreview.js.map +1 -1
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/surfaces/ResourceCard.js +115 -0
- package/dist/ssr/surfaces/ResourceCard.js.map +1 -0
- package/dist/ssr/surfaces/index.js +1 -0
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +13 -1
- package/dist/types/actions/FilterChip.d.ts +5 -0
- package/dist/types/actions/GestureMenu.d.ts +35 -0
- package/dist/types/actions/index.d.ts +2 -0
- package/dist/types/chat/ChatComposer.d.ts +27 -1
- package/dist/types/chat/chat-behavior.d.ts +15 -0
- package/dist/types/chat/index.d.ts +1 -1
- package/dist/types/chat/types.d.ts +34 -0
- package/dist/types/content/Calendar.d.ts +28 -8
- package/dist/types/content/Lightbox.d.ts +8 -0
- package/dist/types/content/Timeline.d.ts +49 -0
- package/dist/types/content/index.d.ts +4 -2
- package/dist/types/content/timeline-model.d.ts +148 -0
- package/dist/types/feedback/dialog-core.d.ts +1 -1
- package/dist/types/inputs/ChoiceChips.d.ts +20 -0
- package/dist/types/inputs/ChoiceGroups.d.ts +11 -2
- package/dist/types/inputs/FileInputs.d.ts +6 -0
- package/dist/types/inputs/SignatureInput.d.ts +22 -0
- package/dist/types/inputs/emoji/EmojiPicker.d.ts +42 -0
- package/dist/types/inputs/emoji/emoji-data.d.ts +2 -0
- package/dist/types/inputs/emoji/emoji-index.d.ts +109 -0
- package/dist/types/inputs/emoji/emoji-messages.d.ts +30 -0
- package/dist/types/inputs/index.d.ts +10 -0
- package/dist/types/inputs/markdown/actions.d.ts +2 -0
- package/dist/types/inputs/markdown/code-zone.d.ts +7 -0
- package/dist/types/inputs/signature-messages.d.ts +11 -0
- package/dist/types/inputs/signature.d.ts +72 -0
- package/dist/types/internal/render-error.d.ts +13 -0
- package/dist/types/intl/messages.d.ts +51 -0
- package/dist/types/layout/AppWorkspace.d.ts +17 -0
- package/dist/types/layout/SidebarItemPreview.d.ts +2 -0
- package/dist/types/layout/index.d.ts +1 -1
- package/dist/types/surfaces/ResourceCard.d.ts +31 -0
- package/dist/types/surfaces/index.d.ts +2 -0
- package/package.json +6 -5
|
@@ -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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"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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;MAAA;MAAA;MAAA;MAAA;MAAA;IAAA;IAAA;EAAA;AAkSrD;;AAEA;AACA,OAAO,SAAS,gBAAgB,CAAC,KAA4B,EAAe;EAC1E;IAAA;MAAA;MAAA;MAAA;MAAA;MAAA;IAAA,oCAEK,IAAI;MAAA,IAAC,IAAI;QAAA,OAAE,KAAK,CAAC,IAAI;MAAA;MAAA,UAAI,IAAI;QAAA;QAAA,oCAAe,IAAI,CAAC,CAAC;QAAA;MAAA;IAAuB;IAAA,wBACnE,KAAK,CAAC,QAAQ;IAAA,oCACpB,IAAI;MAAA,IAAC,IAAI;QAAA,OAAE,KAAK,CAAC,IAAI;MAAA;MAAA;QAAA;QAAA,wBACyB,KAAK,CAAC,IAAI;QAAA,mDAAvC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC;QAAA;MAAA;IAAA;IAAA,oCAJlC,KAAK,CAAC,KAAK,GAAG,0BAA0B,KAAK,CAAC,KAAK,EAAE,GAAG,wBAAwB;IAAA;EAAA;AAQhG;AAAC","ignoreList":[]}
|
|
@@ -16,11 +16,13 @@ var _tmpl$ = /*#__PURE__*/_$template(`<button type=button class=k2b-button data-
|
|
|
16
16
|
_tmpl$3 = /*#__PURE__*/_$template(`<span role=alert class=k2b-content-pdf-preview__notice>`),
|
|
17
17
|
_tmpl$4 = /*#__PURE__*/_$template(`<div class=k2b-content-pdf-preview__actions><!$><!/><!$><!/><!$><!/><!$><!/>`),
|
|
18
18
|
_tmpl$5 = /*#__PURE__*/_$template(`<a class=k2b-button data-variant=secondary data-size=sm target=_blank rel=noopener><i class="ti ti-external-link"aria-hidden=true></i><!$><!/>`),
|
|
19
|
-
_tmpl$6 = /*#__PURE__*/_$template(`<
|
|
20
|
-
_tmpl$7 = /*#__PURE__*/_$template(`<
|
|
21
|
-
_tmpl$8 = /*#__PURE__*/_$template(`<
|
|
22
|
-
_tmpl$9 = /*#__PURE__*/_$template(`<
|
|
19
|
+
_tmpl$6 = /*#__PURE__*/_$template(`<div class=k2b-content-pdf-preview__viewer><!$><!/><!$><!/>`),
|
|
20
|
+
_tmpl$7 = /*#__PURE__*/_$template(`<iframe class=k2b-content-pdf-preview__frame>`),
|
|
21
|
+
_tmpl$8 = /*#__PURE__*/_$template(`<button type=button class=k2b-button data-variant=secondary data-size=sm>`),
|
|
22
|
+
_tmpl$9 = /*#__PURE__*/_$template(`<h2 class=k2b-content-pdf-preview__title>`),
|
|
23
|
+
_tmpl$0 = /*#__PURE__*/_$template(`<section><div class=k2b-content-pdf-preview__toolbar><div class=k2b-content-pdf-preview__heading></div><!$><!/></div><!$><!/>`);
|
|
23
24
|
import { createSignal, onCleanup, onMount, Show } from "solid-js";
|
|
25
|
+
import { announce } from "../feedback/announce";
|
|
24
26
|
import { resolveUiMessages, useUiMessages } from "../intl/messages";
|
|
25
27
|
import Placeholder from "../surfaces/Placeholder";
|
|
26
28
|
const readErrorMessage = async response => {
|
|
@@ -44,15 +46,26 @@ export default function PdfPreview(props) {
|
|
|
44
46
|
const [error, setError] = createSignal(null);
|
|
45
47
|
const [failed, setFailed] = createSignal(false);
|
|
46
48
|
const [tabBlocked, setTabBlocked] = createSignal(false);
|
|
49
|
+
// The frame has its document only once it fires `load`; until then the loading state covers it.
|
|
50
|
+
const [drawn, setDrawn] = createSignal(false);
|
|
47
51
|
// An automatic preview shows one fixed document; the open action reuses it instead of requesting it again.
|
|
48
52
|
let shownBlob = null;
|
|
49
53
|
let openButton;
|
|
50
54
|
let frame;
|
|
55
|
+
let viewer;
|
|
51
56
|
let renderButton;
|
|
52
57
|
let errorRetryButton;
|
|
53
58
|
let disposed = false;
|
|
54
59
|
let loadGeneration = 0;
|
|
55
60
|
let openGeneration = 0;
|
|
61
|
+
|
|
62
|
+
// Without an inline PDF viewer (`navigator.pdfViewerEnabled === false`, as in Chrome on Android) a frame stays empty
|
|
63
|
+
// or downloads the file, so the viewer explains that instead and leaves the document to the open and download actions.
|
|
64
|
+
const inlineViewer = () => typeof navigator === "undefined" || navigator.pdfViewerEnabled !== false;
|
|
65
|
+
// There an automatic preview could show only that hint, so it requests nothing: the open action fetches the document
|
|
66
|
+
// when someone asks for it, and is also the retry after it fails. An on-demand preview still renders, because its
|
|
67
|
+
// request also checks the caller's input.
|
|
68
|
+
const openOnly = () => Boolean(props.autoLoad) && !inlineViewer();
|
|
56
69
|
const revokeCurrent = () => {
|
|
57
70
|
const current = url();
|
|
58
71
|
if (current) URL.revokeObjectURL(current);
|
|
@@ -88,12 +101,18 @@ export default function PdfPreview(props) {
|
|
|
88
101
|
const previousUrl = url();
|
|
89
102
|
shownBlob = blob;
|
|
90
103
|
setFailed(false);
|
|
104
|
+
setDrawn(false);
|
|
91
105
|
setUrl(nextUrl);
|
|
92
106
|
setLoading(false);
|
|
93
107
|
if (previousUrl) URL.revokeObjectURL(previousUrl);
|
|
94
|
-
// The
|
|
95
|
-
|
|
96
|
-
|
|
108
|
+
// The loading status turns into the missing-viewer hint in place and stops being a live region, so say it here.
|
|
109
|
+
if (!inlineViewer()) {
|
|
110
|
+
announce(messages().pdfPreviewNoViewer);
|
|
111
|
+
announce(messages().pdfPreviewNoViewerDescription);
|
|
112
|
+
}
|
|
113
|
+
// The shown document removes the retry action; keep keyboard focus in the actions instead of the page, or, when
|
|
114
|
+
// the host shows only the content, in the viewer, which hands it on to the document once the frame has loaded it.
|
|
115
|
+
if (retryFocused && document.activeElement === document.body) (openButton?.isConnected ? openButton : viewer)?.focus();
|
|
97
116
|
} catch (e) {
|
|
98
117
|
if (disposed || generation !== loadGeneration) return;
|
|
99
118
|
shownBlob = null;
|
|
@@ -105,9 +124,10 @@ export default function PdfPreview(props) {
|
|
|
105
124
|
}
|
|
106
125
|
};
|
|
107
126
|
onMount(() => {
|
|
108
|
-
// Hand the initial loading state to the request itself, which also covers a preview disabled by now
|
|
127
|
+
// Hand the initial loading state to the request itself, which also covers a preview disabled by now or one that
|
|
128
|
+
// leaves the document to the open action.
|
|
109
129
|
setLoading(false);
|
|
110
|
-
if (props.autoLoad) void load();
|
|
130
|
+
if (props.autoLoad && !openOnly()) void load();
|
|
111
131
|
});
|
|
112
132
|
const openInNewTab = async () => {
|
|
113
133
|
if (loading() || opening() || props.disabled?.()) return;
|
|
@@ -140,7 +160,7 @@ export default function PdfPreview(props) {
|
|
|
140
160
|
|
|
141
161
|
// With autoLoad, rendering again would show the same document: offer it only until one is shown. After a failure the
|
|
142
162
|
// default error state carries it as the retry; beside a caller's error content it stays in place while a retry loads.
|
|
143
|
-
const renderable = () => !props.autoLoad || (failed() ? Boolean(props.renderError) : !url() && !loading());
|
|
163
|
+
const renderable = () => !openOnly() && (!props.autoLoad || (failed() ? Boolean(props.renderError) : !url() && !loading()));
|
|
144
164
|
const actions = () => (() => {
|
|
145
165
|
var _el$ = _$getNextElement(_tmpl$4),
|
|
146
166
|
_el$1 = _el$.firstChild,
|
|
@@ -245,71 +265,118 @@ export default function PdfPreview(props) {
|
|
|
245
265
|
}), _el$16, _co$6);
|
|
246
266
|
return _el$;
|
|
247
267
|
})();
|
|
248
|
-
// Every state
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
268
|
+
// Every state uses one placeholder in the viewer's box, so loading changes no layout: idle and loading before a
|
|
269
|
+
// document arrives, loading over the frame until it has loaded the document, and the hint where no frame can.
|
|
270
|
+
const status = () => {
|
|
271
|
+
if (error()) return null;
|
|
272
|
+
if (!inlineViewer() && (url() || openOnly() && !loading())) return "no-viewer";
|
|
273
|
+
if (!url()) return loading() ? "loading" : "idle";
|
|
274
|
+
return drawn() ? null : "loading";
|
|
275
|
+
};
|
|
276
|
+
const viewerBox = () => // While it shows a placeholder, the viewer itself holds keyboard focus that has nowhere else to go.
|
|
277
|
+
(() => {
|
|
278
|
+
var _el$25 = _$getNextElement(_tmpl$6),
|
|
279
|
+
_el$26 = _el$25.firstChild,
|
|
280
|
+
[_el$27, _co$9] = _$getNextMarker(_el$26.nextSibling),
|
|
281
|
+
_el$28 = _el$27.nextSibling,
|
|
282
|
+
[_el$29, _co$0] = _$getNextMarker(_el$28.nextSibling);
|
|
283
|
+
_$use(element => viewer = element, _el$25);
|
|
284
|
+
_$insert(_el$25, _$createComponent(Show, {
|
|
285
|
+
get when() {
|
|
286
|
+
return _$memo(() => !!(!error() && inlineViewer()))() && url();
|
|
287
|
+
},
|
|
288
|
+
children: currentUrl => (() => {
|
|
289
|
+
var _el$30 = _$getNextElement(_tmpl$7);
|
|
290
|
+
_el$30.addEventListener("load", () => {
|
|
291
|
+
const waiting = document.activeElement === viewer;
|
|
292
|
+
setDrawn(true);
|
|
293
|
+
if (waiting) frame?.focus();
|
|
294
|
+
});
|
|
295
|
+
_$use(element => {
|
|
296
|
+
frame = element;
|
|
297
|
+
// A new frame loads its document again, also one that was shown before a failed reload.
|
|
298
|
+
setDrawn(false);
|
|
299
|
+
}, _el$30);
|
|
300
|
+
_$effect(_p$ => {
|
|
301
|
+
var _v$5 = drawn() ? "" : undefined,
|
|
302
|
+
_v$6 = !drawn(),
|
|
303
|
+
_v$7 = currentUrl(),
|
|
304
|
+
_v$8 = props.title ?? messages().pdfPreview;
|
|
305
|
+
_v$5 !== _p$.e && _$setAttribute(_el$30, "data-drawn", _p$.e = _v$5);
|
|
306
|
+
_v$6 !== _p$.t && _$setProperty(_el$30, "inert", _p$.t = _v$6);
|
|
307
|
+
_v$7 !== _p$.a && _$setAttribute(_el$30, "src", _p$.a = _v$7);
|
|
308
|
+
_v$8 !== _p$.o && _$setAttribute(_el$30, "title", _p$.o = _v$8);
|
|
309
|
+
return _p$;
|
|
310
|
+
}, {
|
|
311
|
+
e: undefined,
|
|
312
|
+
t: undefined,
|
|
313
|
+
a: undefined,
|
|
314
|
+
o: undefined
|
|
315
|
+
});
|
|
316
|
+
return _el$30;
|
|
317
|
+
})()
|
|
318
|
+
}), _el$27, _co$9);
|
|
319
|
+
_$insert(_el$25, _$createComponent(Show, {
|
|
320
|
+
get when() {
|
|
321
|
+
return error();
|
|
322
|
+
},
|
|
323
|
+
get fallback() {
|
|
324
|
+
return _$createComponent(Show, {
|
|
325
|
+
get when() {
|
|
326
|
+
return status();
|
|
327
|
+
},
|
|
328
|
+
children: state => _$createComponent(Placeholder, {
|
|
260
329
|
"class": "k2b-content-pdf-preview__placeholder",
|
|
261
330
|
get state() {
|
|
262
|
-
return
|
|
331
|
+
return state() === "loading" ? "loading" : "empty";
|
|
263
332
|
},
|
|
264
333
|
get icon() {
|
|
265
|
-
return
|
|
334
|
+
return state() === "loading" ? undefined : "ti ti-file-type-pdf";
|
|
266
335
|
},
|
|
267
336
|
get title() {
|
|
268
|
-
return _$memo(() =>
|
|
337
|
+
return _$memo(() => state() === "loading")() ? messages().loading : _$memo(() => state() === "no-viewer")() ? messages().pdfPreviewNoViewer : undefined;
|
|
269
338
|
},
|
|
270
339
|
get description() {
|
|
271
|
-
return _$memo(() =>
|
|
340
|
+
return _$memo(() => state() === "idle")() ? props.emptyText ?? messages().renderPdfPreview : _$memo(() => state() === "no-viewer")() ? messages().pdfPreviewNoViewerDescription : undefined;
|
|
272
341
|
}
|
|
273
|
-
})
|
|
342
|
+
})
|
|
343
|
+
});
|
|
344
|
+
},
|
|
345
|
+
children: message => _$createComponent(Placeholder, {
|
|
346
|
+
"class": "k2b-content-pdf-preview__placeholder",
|
|
347
|
+
state: "error",
|
|
348
|
+
get description() {
|
|
349
|
+
return message();
|
|
274
350
|
},
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
})
|
|
351
|
+
get action() {
|
|
352
|
+
return (
|
|
353
|
+
// One retry at a time: the render action moves here only where the toolbar no longer offers it, and the
|
|
354
|
+
// open action is the retry of a preview that leaves the document to it.
|
|
355
|
+
_$memo(() => !!(renderable() || openOnly()))() ? undefined : (() => {
|
|
356
|
+
var _el$31 = _$getNextElement(_tmpl$8);
|
|
357
|
+
_el$31.$$click = () => void load();
|
|
358
|
+
_$use(element => errorRetryButton = element, _el$31);
|
|
359
|
+
_$insert(_el$31, () => props.buttonLabel ?? messages().retry);
|
|
360
|
+
_$effect(() => _$setProperty(_el$31, "disabled", opening() || props.disabled?.()));
|
|
361
|
+
_$runHydrationEvents();
|
|
362
|
+
return _el$31;
|
|
363
|
+
})()
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
})
|
|
367
|
+
}), _el$29, _co$0);
|
|
368
|
+
_$effect(() => _$setAttribute(_el$25, "tabindex", status() ? -1 : undefined));
|
|
369
|
+
return _el$25;
|
|
370
|
+
})();
|
|
371
|
+
// A caller's error content replaces the whole viewer, as it brings its own layout.
|
|
372
|
+
const content = () => _$createComponent(Show, {
|
|
373
|
+
get when() {
|
|
374
|
+
return _$memo(() => !!props.renderError)() ? error() : null;
|
|
291
375
|
},
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return message();
|
|
297
|
-
},
|
|
298
|
-
get action() {
|
|
299
|
-
return (
|
|
300
|
-
// One retry at a time: the render action moves here only where the toolbar no longer offers it.
|
|
301
|
-
_$memo(() => !!renderable())() ? undefined : (() => {
|
|
302
|
-
var _el$26 = _$getNextElement(_tmpl$7);
|
|
303
|
-
_el$26.$$click = () => void load();
|
|
304
|
-
_$use(element => errorRetryButton = element, _el$26);
|
|
305
|
-
_$insert(_el$26, () => props.buttonLabel ?? messages().retry);
|
|
306
|
-
_$effect(() => _$setProperty(_el$26, "disabled", opening() || props.disabled?.()));
|
|
307
|
-
_$runHydrationEvents();
|
|
308
|
-
return _el$26;
|
|
309
|
-
})()
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
})
|
|
376
|
+
get fallback() {
|
|
377
|
+
return viewerBox();
|
|
378
|
+
},
|
|
379
|
+
children: message => props.renderError?.(message())
|
|
313
380
|
});
|
|
314
381
|
if (props.children) return props.children({
|
|
315
382
|
get actions() {
|
|
@@ -320,27 +387,27 @@ export default function PdfPreview(props) {
|
|
|
320
387
|
}
|
|
321
388
|
});
|
|
322
389
|
return (() => {
|
|
323
|
-
var _el$
|
|
324
|
-
_el$
|
|
325
|
-
_el$
|
|
326
|
-
_el$
|
|
327
|
-
[_el$
|
|
328
|
-
_el$
|
|
329
|
-
[_el$
|
|
330
|
-
_$insert(_el$
|
|
390
|
+
var _el$32 = _$getNextElement(_tmpl$0),
|
|
391
|
+
_el$33 = _el$32.firstChild,
|
|
392
|
+
_el$34 = _el$33.firstChild,
|
|
393
|
+
_el$36 = _el$34.nextSibling,
|
|
394
|
+
[_el$37, _co$1] = _$getNextMarker(_el$36.nextSibling),
|
|
395
|
+
_el$38 = _el$33.nextSibling,
|
|
396
|
+
[_el$39, _co$10] = _$getNextMarker(_el$38.nextSibling);
|
|
397
|
+
_$insert(_el$34, _$createComponent(Show, {
|
|
331
398
|
get when() {
|
|
332
399
|
return props.title;
|
|
333
400
|
},
|
|
334
401
|
get children() {
|
|
335
|
-
var _el$
|
|
336
|
-
_$insert(_el$
|
|
337
|
-
return _el$
|
|
402
|
+
var _el$35 = _$getNextElement(_tmpl$9);
|
|
403
|
+
_$insert(_el$35, () => props.title);
|
|
404
|
+
return _el$35;
|
|
338
405
|
}
|
|
339
406
|
}));
|
|
340
|
-
_$insert(_el$
|
|
341
|
-
_$insert(_el$
|
|
342
|
-
_$effect(() => _$className(_el$
|
|
343
|
-
return _el$
|
|
407
|
+
_$insert(_el$33, actions, _el$37, _co$1);
|
|
408
|
+
_$insert(_el$32, content, _el$39, _co$10);
|
|
409
|
+
_$effect(() => _$className(_el$32, `k2b-content-pdf-preview ${props.class ?? ""}`));
|
|
410
|
+
return _el$32;
|
|
344
411
|
})();
|
|
345
412
|
}
|
|
346
413
|
_$delegateEvents(["click"]);
|