@k2b/ui 0.55.0 → 0.56.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 (88) hide show
  1. package/dist/browser/actions/Toolbar.js +16 -7
  2. package/dist/browser/actions/Toolbar.js.map +1 -1
  3. package/dist/browser/chat/ChatComposer.js +28 -27
  4. package/dist/browser/chat/ChatComposer.js.map +1 -1
  5. package/dist/browser/content/Lightbox.js +917 -283
  6. package/dist/browser/content/Lightbox.js.map +1 -1
  7. package/dist/browser/content/PdfPages.js +8 -3
  8. package/dist/browser/content/PdfPages.js.map +1 -1
  9. package/dist/browser/content/PdfThumbnails.js +271 -0
  10. package/dist/browser/content/PdfThumbnails.js.map +1 -0
  11. package/dist/browser/content/PdfViewer.js +11 -3
  12. package/dist/browser/content/PdfViewer.js.map +1 -1
  13. package/dist/browser/content/Timeline.js +116 -117
  14. package/dist/browser/content/Timeline.js.map +1 -1
  15. package/dist/browser/content/code-highlight.js +24 -11
  16. package/dist/browser/content/code-highlight.js.map +1 -1
  17. package/dist/browser/content/index.js +5 -1
  18. package/dist/browser/content/index.js.map +1 -1
  19. package/dist/browser/content/lightbox-messages.js +64 -18
  20. package/dist/browser/content/lightbox-messages.js.map +1 -1
  21. package/dist/browser/content/lightbox-renderers.js +6 -0
  22. package/dist/browser/content/lightbox-renderers.js.map +1 -0
  23. package/dist/browser/content/map-view-worker.js +3 -3
  24. package/dist/browser/content/pdf-messages.js +16 -2
  25. package/dist/browser/content/pdf-messages.js.map +1 -1
  26. package/dist/browser/content/pdf-viewer-engine.js +15 -15
  27. package/dist/browser/content/pdf-viewer-worker.js +4 -5
  28. package/dist/browser/feedback/prompt-confirm.js +2 -0
  29. package/dist/browser/feedback/prompt-confirm.js.map +1 -1
  30. package/dist/browser/internal/truncated-title.js +9 -0
  31. package/dist/browser/internal/truncated-title.js.map +1 -0
  32. package/dist/browser/layout/DetailPanel.js +3 -5
  33. package/dist/browser/layout/DetailPanel.js.map +1 -1
  34. package/dist/browser/layout/PanelDialog.js +3 -1
  35. package/dist/browser/layout/PanelDialog.js.map +1 -1
  36. package/dist/ssr/actions/CommandMenu.js +2 -2
  37. package/dist/ssr/actions/CommandMenu.js.map +1 -1
  38. package/dist/ssr/actions/Toolbar.js +16 -7
  39. package/dist/ssr/actions/Toolbar.js.map +1 -1
  40. package/dist/ssr/chat/ChatComposer.js +31 -30
  41. package/dist/ssr/chat/ChatComposer.js.map +1 -1
  42. package/dist/ssr/content/Lightbox.js +659 -150
  43. package/dist/ssr/content/Lightbox.js.map +1 -1
  44. package/dist/ssr/content/PdfPages.js +8 -3
  45. package/dist/ssr/content/PdfPages.js.map +1 -1
  46. package/dist/ssr/content/PdfThumbnails.js +189 -0
  47. package/dist/ssr/content/PdfThumbnails.js.map +1 -0
  48. package/dist/ssr/content/PdfViewer.js +11 -3
  49. package/dist/ssr/content/PdfViewer.js.map +1 -1
  50. package/dist/ssr/content/Timeline.js +2 -5
  51. package/dist/ssr/content/Timeline.js.map +1 -1
  52. package/dist/ssr/content/code-highlight.js +24 -11
  53. package/dist/ssr/content/code-highlight.js.map +1 -1
  54. package/dist/ssr/content/index.js +5 -1
  55. package/dist/ssr/content/index.js.map +1 -1
  56. package/dist/ssr/content/lightbox-messages.js +64 -18
  57. package/dist/ssr/content/lightbox-messages.js.map +1 -1
  58. package/dist/ssr/content/lightbox-renderers.js +6 -0
  59. package/dist/ssr/content/lightbox-renderers.js.map +1 -0
  60. package/dist/ssr/content/pdf-messages.js +16 -2
  61. package/dist/ssr/content/pdf-messages.js.map +1 -1
  62. package/dist/ssr/feedback/prompt-confirm.js +1 -0
  63. package/dist/ssr/feedback/prompt-confirm.js.map +1 -1
  64. package/dist/ssr/inputs/ChoiceInputs.js +2 -2
  65. package/dist/ssr/inputs/ChoiceInputs.js.map +1 -1
  66. package/dist/ssr/inputs/SignatureInput.js +2 -2
  67. package/dist/ssr/inputs/SignatureInput.js.map +1 -1
  68. package/dist/ssr/inputs/markdown/SlashCommands.js +2 -2
  69. package/dist/ssr/inputs/markdown/SlashCommands.js.map +1 -1
  70. package/dist/ssr/internal/truncated-title.js +9 -0
  71. package/dist/ssr/internal/truncated-title.js.map +1 -0
  72. package/dist/ssr/layout/DetailPanel.js +1 -4
  73. package/dist/ssr/layout/DetailPanel.js.map +1 -1
  74. package/dist/ssr/layout/PanelDialog.js +1 -0
  75. package/dist/ssr/layout/PanelDialog.js.map +1 -1
  76. package/dist/styles.css +1 -1
  77. package/dist/types/actions/Toolbar.d.ts +6 -0
  78. package/dist/types/chat/ChatComposer.d.ts +1 -0
  79. package/dist/types/content/Lightbox.d.ts +54 -14
  80. package/dist/types/content/PdfPages.d.ts +7 -1
  81. package/dist/types/content/PdfThumbnails.d.ts +26 -0
  82. package/dist/types/content/PdfViewer.d.ts +12 -3
  83. package/dist/types/content/index.d.ts +4 -2
  84. package/dist/types/content/lightbox-messages.d.ts +31 -8
  85. package/dist/types/content/lightbox-renderers.d.ts +3 -0
  86. package/dist/types/content/pdf-messages.d.ts +7 -0
  87. package/dist/types/internal/truncated-title.d.ts +7 -0
  88. package/package.json +20 -20
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["actions/Toolbar.tsx"],"sourcesContent":["import { createContext, createEffect, createSignal, type JSX, onCleanup, onMount, Show, sharedConfig, useContext } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { Kbd } from \"../content/Kbd\";\nimport { announce } from \"../feedback/announce\";\nimport { useLocale } from \"../intl/locale\";\nimport { formatShortcut, type KeyboardPlatform, keyboardPlatform } from \"../intl/shortcut\";\nimport { IconButton } from \"./Button\";\nimport { Dropdown, type DropdownAction } from \"./Dropdown\";\nimport { useToolbarMessages } from \"./toolbar-messages\";\n\nexport type ToolbarProps = {\n children: JSX.Element;\n label: string;\n orientation?: \"horizontal\" | \"vertical\";\n wrap?: boolean;\n /** `floating` floats the toolbar at an edge of its column. Defaults to `inline`. */\n variant?: \"inline\" | \"floating\";\n /** The edge a floating toolbar sticks to while its column scrolls. Defaults to `bottom`. */\n edge?: \"top\" | \"bottom\";\n /**\n * `danger` makes a floating toolbar the one red pill of a stopped state, such as an editor that can no longer save.\n * It spans its row in place of the usual pills, and screen readers announce its labels at once. Inline toolbars\n * ignore it.\n */\n tone?: \"danger\";\n class?: string;\n};\n\nexport type ToolbarActionProps = {\n /** Accessible name, tooltip text, and the row label in the More menu. */\n label: string;\n /** Icon class, such as \"ti ti-archive\". */\n icon: string;\n /**\n * Shortcut hint below the icon, tooltip suffix, and aria-keyshortcuts; does not register a shortcut handler.\n * SelectionToolbar's compact actions keep only the tooltip suffix and aria-keyshortcuts.\n */\n keys?: string;\n /** 1 is most important. Larger numbers move first; ties move later DOM actions first. Omit to keep fixed. */\n priority?: number;\n /**\n * Shows the label beside the icon while a floating toolbar has room. When it gets narrow, these labels go first,\n * every action keeps its icon, and only then do actions move into More.\n */\n text?: boolean;\n disabled?: boolean;\n /** Makes the action a toggle and exposes its state as `aria-pressed`, such as Bold over bold text. */\n pressed?: boolean;\n onClick?: () => void;\n};\nexport type ToolbarLabelProps = {\n children: JSX.Element;\n /**\n * Follows the label while it fits, such as the reason after \"Not saved\". A narrow toolbar hides it whole before\n * actions give up their labels; screen readers always read it.\n */\n detail?: JSX.Element;\n class?: string;\n};\n\nexport type ToolbarGroupProps = { children: JSX.Element; label?: string; class?: string };\nexport type ToolbarSeparatorProps = { class?: string };\n\ntype ToolbarComponent = ((props: ToolbarProps) => JSX.Element) & {\n Action: (props: ToolbarActionProps) => JSX.Element;\n Label: (props: ToolbarLabelProps) => JSX.Element;\n Group: (props: ToolbarGroupProps) => JSX.Element;\n Separator: (props: ToolbarSeparatorProps) => JSX.Element;\n Spacer: () => JSX.Element;\n};\n\ntype ToolbarOrientation = NonNullable<ToolbarProps[\"orientation\"]>;\n\nconst defaultToolbarOrientation: () => ToolbarOrientation = () => \"horizontal\";\nconst ToolbarOrientationContext = createContext(defaultToolbarOrientation);\n/** True inside a floating `tone=\"danger\"` toolbar, whose labels announce themselves. */\nconst ToolbarDangerContext = createContext(false);\n/** False where actions are icon-sized, such as SelectionToolbar: no room below the icon for a hint. Package-internal. */\nexport const ToolbarHintsContext = createContext(true);\n\n// `item` is created once per action: the More menu keys its rows by identity, so a remeasure keeps a focused row.\ntype RegisteredAction = { element: HTMLButtonElement; props: ToolbarActionProps; item: DropdownAction };\nconst ToolbarActionsContext = createContext<(action: RegisteredAction) => () => void>();\nconst overflowAttribute = \"data-overflow\";\n/** Set on a floating toolbar whose action labels gave way to icons for lack of room. */\nconst compactAttribute = \"data-compact\";\nconst hide = (element: Element) => element.setAttribute(overflowAttribute, \"hidden\");\nconst reveal = (element: Element) => element.removeAttribute(overflowAttribute);\n\n// ARIA uses language-independent key names, unlike the translated tooltip and caps.\nconst ariaShortcut = (keys: string | undefined, platform: KeyboardPlatform): string | undefined => {\n if (!keys || !formatShortcut(keys, { platform, locale: \"en\" }).keys.length) return undefined;\n const input = keys.trim().toLowerCase();\n const plus = input === \"+\" || input.endsWith(\"++\");\n const parts = (plus ? input.slice(0, -1) : input).split(\"+\");\n // ARIA separates keys with \"+\", so the plus key itself is named \"plus\".\n const key = plus ? \"plus\" : parts.pop() || \"space\";\n if (plus) parts.pop();\n const names: Record<string, string> = {\n mod: platform === \"apple\" ? \"Meta\" : \"Control\",\n ctrl: \"Control\",\n alt: \"Alt\",\n shift: \"Shift\",\n meta: \"Meta\",\n arrowup: \"ArrowUp\",\n arrowdown: \"ArrowDown\",\n arrowleft: \"ArrowLeft\",\n arrowright: \"ArrowRight\",\n escape: \"Escape\",\n esc: \"Escape\",\n backspace: \"Backspace\",\n enter: \"Enter\",\n delete: \"Delete\",\n space: \"Space\",\n tab: \"Tab\",\n home: \"Home\",\n end: \"End\",\n pageup: \"PageUp\",\n pagedown: \"PageDown\",\n plus: \"plus\",\n };\n const final = key.length === 1 || /^f(?:[1-9]|1[0-2])$/.test(key) ? key.toUpperCase() : names[key];\n return final ? [...new Set(parts.map((part) => names[part])), final].join(\"+\") : undefined;\n};\n\nconst ToolbarAction = (props: ToolbarActionProps): JSX.Element => {\n const register = useContext(ToolbarActionsContext);\n const hints = useContext(ToolbarHintsContext);\n const locale = useLocale();\n const [platform, setPlatform] = createSignal<KeyboardPlatform>(isServer || sharedConfig.context ? \"other\" : keyboardPlatform());\n onMount(() => setPlatform(keyboardPlatform()));\n const tooltip = () => {\n const shortcut = props.keys ? formatShortcut(props.keys, { platform: platform(), locale: locale() }).label : \"\";\n return shortcut ? `${props.label} (${shortcut})` : props.label;\n };\n return (\n <IconButton\n ref={(element) => {\n const item: DropdownAction = {\n get label() {\n return props.label;\n },\n get icon() {\n return props.icon;\n },\n get disabled() {\n return props.disabled;\n },\n action: () => props.onClick?.(),\n };\n const unregister = register?.({ element, props, item });\n if (unregister) onCleanup(unregister);\n }}\n class=\"k2b-toolbar__action\"\n label={props.label}\n variant=\"ghost\"\n tooltip={tooltip()}\n aria-keyshortcuts={ariaShortcut(props.keys, platform())}\n aria-pressed={props.pressed === undefined ? undefined : props.pressed ? \"true\" : \"false\"}\n data-priority={props.priority}\n data-text={props.text ? \"\" : undefined}\n disabled={props.disabled}\n onClick={() => props.onClick?.()}\n >\n <i class={props.icon} aria-hidden=\"true\" />\n <Show when={props.text}>\n <span class=\"k2b-toolbar__text\" aria-hidden=\"true\">\n {props.label}\n </span>\n </Show>\n <Show when={hints && props.keys}>{(keys) => <Kbd keys={keys()} class=\"k2b-kbd-hint k2b-toolbar__hint\" />}</Show>\n </IconButton>\n );\n};\n\nconst ToolbarLabel = (props: ToolbarLabelProps): JSX.Element => {\n const danger = useContext(ToolbarDangerContext);\n let label!: HTMLSpanElement;\n // The shared assertive live region exists before the text arrives, so the message is read reliably, also when the\n // pill appears with it or its text changes later.\n onMount(() => {\n if (!danger) return;\n let spoken = \"\";\n const speak = () => {\n const text = label.textContent?.replace(/\\s+/g, \" \").trim() ?? \"\";\n if (text === spoken) return;\n spoken = text;\n announce(text, { politeness: \"assertive\" });\n };\n speak();\n const observer = new MutationObserver(speak);\n observer.observe(label, { childList: true, subtree: true, characterData: true });\n onCleanup(() => observer.disconnect());\n });\n return (\n <span ref={label} class={`k2b-toolbar__label ${props.class ?? \"\"}`} data-detail={props.detail ? \"\" : undefined}>\n <Show when={props.detail} fallback={props.children}>\n <span class=\"k2b-toolbar__label-main\">{props.children}</span>\n <span class=\"k2b-toolbar__label-detail\">{props.detail}</span>\n </Show>\n </span>\n );\n};\n\nconst ToolbarGroup = (props: ToolbarGroupProps): JSX.Element => (\n <div class={`k2b-toolbar__group ${props.class ?? \"\"}`} role=\"group\" aria-label={props.label}>\n {props.children}\n </div>\n);\n\nconst ToolbarSeparator = (props: ToolbarSeparatorProps): JSX.Element => {\n const toolbarOrientation = useContext(ToolbarOrientationContext);\n const separatorOrientation = () => (toolbarOrientation() === \"horizontal\" ? \"vertical\" : \"horizontal\");\n\n return (\n <span\n class={`k2b-toolbar__separator ${props.class ?? \"\"}`}\n role=\"separator\"\n aria-orientation={separatorOrientation()}\n data-orientation={separatorOrientation()}\n />\n );\n};\n\nconst ToolbarSpacer = (): JSX.Element => <span class=\"k2b-toolbar__spacer\" aria-hidden=\"true\" />;\n\nconst rovingFocus = (root: HTMLDivElement, orientation: () => ToolbarOrientation) => {\n let last: HTMLElement | undefined;\n const setLast = (item: HTMLElement | undefined) => {\n if (item === last) return;\n if (last) resizeObserver.unobserve(last);\n last = item;\n if (last) resizeObserver.observe(last);\n };\n const controls = () =>\n Array.from(root.querySelectorAll<HTMLElement>(\"button, a[href], input, select, textarea, [tabindex]\")).filter((item) => {\n if (\n item.matches(\"textarea, select\") ||\n item.isContentEditable ||\n (item.matches(\"input\") && !/^(button|checkbox|reset|submit|image|color|file)$/i.test(item.getAttribute(\"type\") ?? \"text\"))\n )\n return false;\n const nested = item.closest('[role=\"menu\"], [role=\"listbox\"], [role=\"dialog\"], [popover]');\n return !nested || !root.contains(nested);\n });\n const items = () =>\n controls().filter(\n (item) => !item.matches(\":disabled\") && !item.closest('[data-overflow=\"hidden\"]') && item.getClientRects().length > 0,\n );\n const sync = () => {\n // A toolbar that is still hidden, such as a SelectionToolbar about to show, keeps one stop: otherwise Tab right\n // after it shows would pass it before the next measure.\n const shown = items();\n const available = shown.length\n ? shown\n : controls().filter((item) => !item.matches(\":disabled\") && !item.closest('[data-overflow=\"hidden\"]'));\n if (!last || !available.includes(last)) setLast(available[0]);\n for (const item of controls()) item.tabIndex = item === last ? 0 : -1;\n };\n const focusin = (event: FocusEvent) => {\n if (event.target instanceof HTMLElement && items().includes(event.target)) {\n setLast(event.target);\n sync();\n }\n };\n const keydown = (event: KeyboardEvent) => {\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const available = items();\n const target = event.target;\n if (!(target instanceof HTMLElement) || !available.includes(target)) return;\n const forward = orientation() === \"vertical\" ? \"ArrowDown\" : getComputedStyle(root).direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = orientation() === \"vertical\" ? \"ArrowUp\" : forward === \"ArrowRight\" ? \"ArrowLeft\" : \"ArrowRight\";\n const index = available.indexOf(target);\n const next =\n event.key === \"Home\"\n ? 0\n : event.key === \"End\"\n ? available.length - 1\n : event.key === forward\n ? (index + 1) % available.length\n : event.key === backward\n ? (index + available.length - 1) % available.length\n : -1;\n if (next < 0) return;\n event.preventDefault();\n setLast(available[next]);\n sync();\n last?.focus();\n };\n const observer = new MutationObserver(sync);\n observer.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\"disabled\", \"hidden\", \"class\", \"style\", overflowAttribute],\n });\n const resizeObserver = new ResizeObserver(sync);\n resizeObserver.observe(root);\n root.addEventListener(\"focusin\", focusin);\n sync();\n return {\n keydown,\n sync,\n cleanup: () => {\n observer.disconnect();\n resizeObserver.disconnect();\n root.removeEventListener(\"focusin\", focusin);\n },\n };\n};\n\n/**\n * All measurement writes are DOM attributes: reactive writes do not flush during onMount. More is never toggled while\n * measuring: hiding it, even for a moment, can make the browser drop focus from it or from its open menu. An idle More\n * stays out of the flow but keeps its box, so its width is always known.\n */\nconst measureOverflow = (\n root: HTMLDivElement,\n more: HTMLDivElement,\n actions: RegisteredAction[],\n available: number,\n): RegisteredAction[] => {\n for (const element of root.querySelectorAll(`[${overflowAttribute}]`)) if (element !== more) reveal(element);\n root.removeAttribute(compactAttribute);\n const children = Array.from(root.children).filter(\n (element): element is HTMLElement => element instanceof HTMLElement && element !== more,\n );\n const visible = (element: Element) => !element.matches(\"[popover]\") && element.getClientRects().length > 0;\n const separator = (element: Element) => element.classList.contains(\"k2b-toolbar__separator\");\n const item = (element: Element) => !separator(element) && !element.classList.contains(\"k2b-toolbar__spacer\");\n // Separators are tidied in DOM order with More, the last control, counted as shown when `withMore` is set.\n const all = Array.from(root.children).filter((element): element is HTMLElement => element instanceof HTMLElement);\n const tidy = (withMore: boolean) => {\n for (const group of root.querySelectorAll(\".k2b-toolbar__group\")) {\n reveal(group);\n if (!Array.from(group.children).some(visible)) hide(group);\n }\n for (const child of children) if (separator(child)) reveal(child);\n const shown = (element: HTMLElement) => (element === more ? withMore : visible(element));\n let preceding = false;\n for (let index = 0; index < all.length; index++) {\n const child = all[index]!;\n if (!shown(child)) continue;\n if (separator(child)) {\n const following = all.slice(index + 1).some((next) => item(next) && shown(next));\n if (!preceding || !following) hide(child);\n else preceding = false;\n } else if (item(child)) preceding = true;\n }\n };\n const style = getComputedStyle(root);\n const edges = [style.paddingLeft, style.paddingRight, style.borderLeftWidth, style.borderRightWidth].reduce(\n (sum, value) => sum + (Number.parseFloat(value) || 0),\n 0,\n );\n const gap = Number.parseFloat(style.columnGap) || 0;\n // A label may shrink in an overfull pill; measure its untruncated width (up to its cap) so actions move before the\n // count or title truncates.\n const width = (child: HTMLElement) => {\n // Separators carry inline margins, which bounding boxes leave out.\n const childStyle = getComputedStyle(child);\n // A spacer takes whatever room is left, so it needs only its minimum.\n if (child.classList.contains(\"k2b-toolbar__spacer\")) return Number.parseFloat(childStyle.minWidth) || 0;\n const box =\n child.getBoundingClientRect().width +\n (Number.parseFloat(childStyle.marginLeft) || 0) +\n (Number.parseFloat(childStyle.marginRight) || 0);\n if (!child.classList.contains(\"k2b-toolbar__label\")) return box;\n // A detail only takes leftover room: the label needs its main text and padding.\n const main = child.querySelector<HTMLElement>(\":scope > .k2b-toolbar__label-main\");\n if (main)\n return (\n main.scrollWidth +\n (Number.parseFloat(childStyle.paddingLeft) || 0) +\n (Number.parseFloat(childStyle.paddingRight) || 0) +\n (Number.parseFloat(childStyle.marginLeft) || 0) +\n (Number.parseFloat(childStyle.marginRight) || 0)\n );\n const cap = Number.parseFloat(childStyle.maxWidth);\n return Math.max(box, Math.min(child.scrollWidth, Number.isNaN(cap) ? Number.POSITIVE_INFINITY : cap));\n };\n const moreWidth = width(more) + gap;\n const used = (withMore: boolean) => {\n const shown = children.filter(visible);\n return shown.reduce((sum, child) => sum + width(child), edges) + gap * Math.max(0, shown.length - 1) + (withMore ? moreWidth : 0);\n };\n // Stable sort retains DOM order for the menu, but removes later actions first on a priority tie.\n const candidates = actions\n // An action its application hides, even with `visibility: hidden`, must not reappear as a More row.\n .filter(\n (action) =>\n action.props.priority !== undefined && visible(action.element) && getComputedStyle(action.element).visibility !== \"hidden\",\n )\n .reverse()\n .sort((a, b) => b.props.priority! - a.props.priority!);\n let movedAny = false;\n tidy(false);\n // Labels go before actions: a toolbar that does not fit with its labels drops them first.\n if (used(false) > available && root.querySelector(\".k2b-toolbar__action[data-text]\")) root.setAttribute(compactAttribute, \"\");\n for (const action of candidates) {\n if (used(movedAny) <= available) break;\n hide(action.element);\n movedAny = true;\n tidy(true);\n }\n // More changes only here, and only when its state changes.\n if (movedAny) reveal(more);\n else if (!more.hasAttribute(overflowAttribute)) hide(more);\n return actions.filter((action) => action.element.hasAttribute(overflowAttribute));\n};\n\nexport const Toolbar = Object.assign(\n (props: ToolbarProps): JSX.Element => {\n // The variant decides the DOM shape, so it is read once.\n const floating = props.variant === \"floating\";\n const danger = () => (floating && props.tone === \"danger\" ? \"danger\" : undefined);\n const orientation = () => (floating ? \"horizontal\" : (props.orientation ?? \"horizontal\"));\n const messages = useToolbarMessages();\n const actions = new Set<RegisteredAction>();\n const [revision, setRevision] = createSignal(0);\n const [moved, setMoved] = createSignal<RegisteredAction[]>([]);\n let root!: HTMLDivElement;\n let strip: HTMLDivElement | undefined;\n let more: HTMLDivElement | undefined;\n let trigger: HTMLButtonElement | undefined;\n let mounted = false;\n let navigation: ReturnType<typeof rovingFocus> | undefined;\n // Only the floating variant moves actions into More; inline toolbars keep every action in place.\n const measure = () => {\n if (!mounted || !strip || !more) return;\n const style = getComputedStyle(strip);\n const available = strip.clientWidth - Number.parseFloat(style.paddingLeft) - Number.parseFloat(style.paddingRight);\n if (available <= 0) return;\n const ordered = [...actions].sort((a, b) =>\n a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1,\n );\n const focused = document.activeElement;\n // Cleared before measuring so the pending `visibility: hidden` does not hide every action from the check\n // below; the whole measurement still runs before the next paint.\n root.removeAttribute(\"data-overflow-pending\");\n const next = measureOverflow(root, more, ordered, available);\n setMoved((previous) =>\n previous.length === next.length && previous.every((action, index) => action === next[index]) ? previous : next,\n );\n navigation?.sync();\n // Focus on an action that moved, on a menu row whose action came back, or on a More that disappeared goes to\n // More, or to the toolbar's tab stop when nothing is left in More. Inside an effect the menu rows update after\n // this function returns, so the check waits for that flush; a microtask still runs before the next paint.\n queueMicrotask(() => {\n // A toolbar unmounted meanwhile, as its view closes, owns no focus any more.\n if (!mounted) return;\n const lost =\n next.some((action) => action.element === focused) ||\n (focused instanceof HTMLElement && !focused.isConnected) ||\n (focused === trigger && !next.length);\n if (lost) (next.length ? trigger : root.querySelector<HTMLElement>('[tabindex=\"0\"]'))?.focus();\n });\n };\n const register = (action: RegisteredAction) => {\n actions.add(action);\n setRevision((value) => value + 1);\n return () => {\n actions.delete(action);\n setRevision((value) => value + 1);\n };\n };\n if (floating)\n createEffect(() => {\n revision();\n for (const action of actions) {\n // Content and priority changes can affect intrinsic widths as well as menu rows.\n void action.props.priority;\n void action.props.label;\n void action.props.icon;\n void action.props.keys;\n void action.props.text;\n }\n measure();\n });\n onMount(() => {\n mounted = true;\n navigation = rovingFocus(root, orientation);\n onCleanup(() => {\n mounted = false;\n navigation?.cleanup();\n });\n if (!strip) return;\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(strip);\n observer.observe(root);\n const mutations = new MutationObserver(measure);\n // Visibility an application sets also counts. Measurement writes only data attributes, which stay unobserved.\n mutations.observe(root, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\"hidden\", \"class\", \"style\"],\n });\n onCleanup(() => {\n observer.disconnect();\n mutations.disconnect();\n });\n });\n const menuItems = (): DropdownAction[] => moved().map((action) => action.item);\n const content = (\n <ToolbarOrientationContext.Provider value={orientation}>\n <ToolbarDangerContext.Provider value={!!danger()}>\n <ToolbarActionsContext.Provider value={floating ? register : undefined}>\n <div\n ref={root}\n onKeyDown={(event) => navigation?.keydown(event)}\n class={`k2b-toolbar ${props.class ?? \"\"}`}\n role=\"toolbar\"\n aria-label={props.label}\n aria-orientation={orientation()}\n data-orientation={orientation()}\n data-variant={floating ? \"floating\" : undefined}\n data-tone={danger()}\n data-wrap={!floating && props.wrap ? \"true\" : undefined}\n data-overflow-pending={floating ? \"\" : undefined}\n >\n {props.children}\n <Show when={floating}>\n <div ref={more} class=\"k2b-toolbar__more\" data-overflow=\"hidden\">\n <Dropdown.Root\n items={menuItems()}\n position=\"top-left\"\n label={messages().moreActions}\n // An open menu closes when its last row returns to the toolbar.\n disabled={moved().length === 0}\n >\n <Dropdown.Trigger ref={trigger} iconOnly label={messages().moreActions}>\n <i class=\"ti ti-dots\" aria-hidden=\"true\" />\n </Dropdown.Trigger>\n </Dropdown.Root>\n </div>\n </Show>\n </div>\n </ToolbarActionsContext.Provider>\n </ToolbarDangerContext.Provider>\n </ToolbarOrientationContext.Provider>\n );\n return floating ? (\n <div ref={strip} class=\"k2b-toolbar-float\" data-edge={props.edge === \"top\" ? \"top\" : undefined} data-tone={danger()}>\n {content}\n </div>\n ) : (\n content\n );\n },\n { Action: ToolbarAction, Label: ToolbarLabel, Group: ToolbarGroup, Separator: ToolbarSeparator, Spacer: ToolbarSpacer },\n) as ToolbarComponent;\n\nexport type ToolbarDockProps = { children: JSX.Element; class?: string };\n\n/**\n * One floating row at the bottom of a column for several floating toolbars: the first sits at the start edge, the last\n * at the end edge, and each moves its own actions into More when the row gets narrow. Content scrolls beneath the row\n * and still ends above it.\n */\nexport const ToolbarDock = (props: ToolbarDockProps): JSX.Element => (\n <div class={props.class ? `k2b-toolbar-dock ${props.class}` : \"k2b-toolbar-dock\"}>{props.children}</div>\n);\n\nexport default Toolbar;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa,EAAE,YAAY,EAAE,YAAY,EAAY,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,QAAQ,UAAU;AAClI,SAAS,QAAQ,QAAQ,cAAc;AACvC,SAAS,GAAG,QAAQ,gBAAgB;AACpC,SAAS,QAAQ,QAAQ,sBAAsB;AAC/C,SAAS,SAAS,QAAQ,gBAAgB;AAC1C,SAAS,cAAc,EAAyB,gBAAgB,QAAQ,kBAAkB;AAC1F,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,QAAQ,QAA6B,YAAY;AAC1D,SAAS,kBAAkB,QAAQ,oBAAoB;AAiEvD,MAAM,yBAAmD,GAAG,MAAM,YAAY;AAC9E,MAAM,yBAAyB,GAAG,aAAa,CAAC,yBAAyB,CAAC;AAC1E;AACA,MAAM,oBAAoB,GAAG,aAAa,CAAC,KAAK,CAAC;AACjD;AACA,OAAO,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC;;AAEtD;;AAEA,MAAM,qBAAqB,GAAG,aAAa,CAA2C,CAAC;AACvF,MAAM,iBAAiB,GAAG,eAAe;AACzC;AACA,MAAM,gBAA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QAAQ,CAAC,OAAO;wBAAe,QAAQ;wBAAA,IAAC,KAAK;0BAAA,OAAE,QAAQ,CAAC,CAAC,CAAC,WAAW;wBAAA;wBAAA;0BAAA;wBAAA;sBAAA;oBAAA;kBAAA;gBAAA;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA,EAUrF;EACD,OAAO,QAAQ,+CACyC,KAAK,CAAC,IAAI,KAAK,KAAK,GAAG,KAAK,YAAG,SAAS,uDAAa,MAAM,CAAC,CAAC,0BAChH,OAAO,KAGV,OACD;AACH,CAAC,EACD;EAAE,MAAM,EAAE,aAAa;EAAE,KAAK,EAAE,YAAY;EAAE,KAAK,EAAE,YAAY;EAAE,SAAS,EAAE,gBAAgB;EAAE,MAAM,EAAE;AAAc,CACxH,CAAqB;AAIrB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,WAAW,GAAI,KAAuB,4CACrC,KAAK,CAAC,KAAK,GAAG,6BAAoB,KAAK,CAAC,KAAK,SAAE,GAAG,kBAAkB,mBAAG,KAAK,CAAC,QAAQ,EAClG;AAED,eAAe,OAAO","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["actions/Toolbar.tsx"],"sourcesContent":["import { createContext, createEffect, createSignal, type JSX, onCleanup, onMount, Show, sharedConfig, useContext } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { Kbd } from \"../content/Kbd\";\nimport { announce } from \"../feedback/announce\";\nimport { useLocale } from \"../intl/locale\";\nimport { formatShortcut, type KeyboardPlatform, keyboardPlatform } from \"../intl/shortcut\";\nimport { IconButton } from \"./Button\";\nimport { Dropdown, type DropdownAction, type DropdownItem } from \"./Dropdown\";\nimport { useToolbarMessages } from \"./toolbar-messages\";\n\nexport type ToolbarProps = {\n children: JSX.Element;\n label: string;\n orientation?: \"horizontal\" | \"vertical\";\n wrap?: boolean;\n /** `floating` floats the toolbar at an edge of its column. Defaults to `inline`. */\n variant?: \"inline\" | \"floating\";\n /** The edge a floating toolbar sticks to while its column scrolls. Defaults to `bottom`. */\n edge?: \"top\" | \"bottom\";\n /**\n * `danger` makes a floating toolbar the one red pill of a stopped state, such as an editor that can no longer save.\n * It spans its row in place of the usual pills, and screen readers announce its labels at once. Inline toolbars\n * ignore it.\n */\n tone?: \"danger\";\n /**\n * Rarer commands of a floating toolbar that always live in More, such as Copy to or Move to trash for a selection.\n * More then always shows; actions that move there on a narrow row come first, these follow in their own group.\n */\n moreItems?: readonly DropdownItem[];\n class?: string;\n};\n\nexport type ToolbarActionProps = {\n /** Accessible name, tooltip text, and the row label in the More menu. */\n label: string;\n /** Icon class, such as \"ti ti-archive\". */\n icon: string;\n /**\n * Shortcut hint below the icon, tooltip suffix, and aria-keyshortcuts; does not register a shortcut handler.\n * SelectionToolbar's compact actions keep only the tooltip suffix and aria-keyshortcuts.\n */\n keys?: string;\n /** 1 is most important. Larger numbers move first; ties move later DOM actions first. Omit to keep fixed. */\n priority?: number;\n /**\n * Shows the label beside the icon while a floating toolbar has room. When it gets narrow, these labels go first,\n * every action keeps its icon, and only then do actions move into More.\n */\n text?: boolean;\n disabled?: boolean;\n /** Makes the action a toggle and exposes its state as `aria-pressed`, such as Bold over bold text. */\n pressed?: boolean;\n onClick?: () => void;\n};\nexport type ToolbarLabelProps = {\n children: JSX.Element;\n /**\n * Follows the label while it fits, such as the reason after \"Not saved\". A narrow toolbar hides it whole before\n * actions give up their labels; screen readers always read it.\n */\n detail?: JSX.Element;\n class?: string;\n};\n\nexport type ToolbarGroupProps = { children: JSX.Element; label?: string; class?: string };\nexport type ToolbarSeparatorProps = { class?: string };\n\ntype ToolbarComponent = ((props: ToolbarProps) => JSX.Element) & {\n Action: (props: ToolbarActionProps) => JSX.Element;\n Label: (props: ToolbarLabelProps) => JSX.Element;\n Group: (props: ToolbarGroupProps) => JSX.Element;\n Separator: (props: ToolbarSeparatorProps) => JSX.Element;\n Spacer: () => JSX.Element;\n};\n\ntype ToolbarOrientation = NonNullable<ToolbarProps[\"orientation\"]>;\n\nconst defaultToolbarOrientation: () => ToolbarOrientation = () => \"horizontal\";\nconst ToolbarOrientationContext = createContext(defaultToolbarOrientation);\n/** True inside a floating `tone=\"danger\"` toolbar, whose labels announce themselves. */\nconst ToolbarDangerContext = createContext(false);\n/** False where actions are icon-sized, such as SelectionToolbar: no room below the icon for a hint. Package-internal. */\nexport const ToolbarHintsContext = createContext(true);\n\n// `item` is created once per action: the More menu keys its rows by identity, so a remeasure keeps a focused row.\ntype RegisteredAction = { element: HTMLButtonElement; props: ToolbarActionProps; item: DropdownAction };\nconst ToolbarActionsContext = createContext<(action: RegisteredAction) => () => void>();\nconst overflowAttribute = \"data-overflow\";\n/** Set on a floating toolbar whose action labels gave way to icons for lack of room. */\nconst compactAttribute = \"data-compact\";\nconst hide = (element: Element) => element.setAttribute(overflowAttribute, \"hidden\");\nconst reveal = (element: Element) => element.removeAttribute(overflowAttribute);\n\n// ARIA uses language-independent key names, unlike the translated tooltip and caps.\nconst ariaShortcut = (keys: string | undefined, platform: KeyboardPlatform): string | undefined => {\n if (!keys || !formatShortcut(keys, { platform, locale: \"en\" }).keys.length) return undefined;\n const input = keys.trim().toLowerCase();\n const plus = input === \"+\" || input.endsWith(\"++\");\n const parts = (plus ? input.slice(0, -1) : input).split(\"+\");\n // ARIA separates keys with \"+\", so the plus key itself is named \"plus\".\n const key = plus ? \"plus\" : parts.pop() || \"space\";\n if (plus) parts.pop();\n const names: Record<string, string> = {\n mod: platform === \"apple\" ? \"Meta\" : \"Control\",\n ctrl: \"Control\",\n alt: \"Alt\",\n shift: \"Shift\",\n meta: \"Meta\",\n arrowup: \"ArrowUp\",\n arrowdown: \"ArrowDown\",\n arrowleft: \"ArrowLeft\",\n arrowright: \"ArrowRight\",\n escape: \"Escape\",\n esc: \"Escape\",\n backspace: \"Backspace\",\n enter: \"Enter\",\n delete: \"Delete\",\n space: \"Space\",\n tab: \"Tab\",\n home: \"Home\",\n end: \"End\",\n pageup: \"PageUp\",\n pagedown: \"PageDown\",\n plus: \"plus\",\n };\n const final = key.length === 1 || /^f(?:[1-9]|1[0-2])$/.test(key) ? key.toUpperCase() : names[key];\n return final ? [...new Set(parts.map((part) => names[part])), final].join(\"+\") : undefined;\n};\n\nconst ToolbarAction = (props: ToolbarActionProps): JSX.Element => {\n const register = useContext(ToolbarActionsContext);\n const hints = useContext(ToolbarHintsContext);\n const locale = useLocale();\n const [platform, setPlatform] = createSignal<KeyboardPlatform>(isServer || sharedConfig.context ? \"other\" : keyboardPlatform());\n onMount(() => setPlatform(keyboardPlatform()));\n const tooltip = () => {\n const shortcut = props.keys ? formatShortcut(props.keys, { platform: platform(), locale: locale() }).label : \"\";\n return shortcut ? `${props.label} (${shortcut})` : props.label;\n };\n return (\n <IconButton\n ref={(element) => {\n const item: DropdownAction = {\n get label() {\n return props.label;\n },\n get icon() {\n return props.icon;\n },\n get disabled() {\n return props.disabled;\n },\n action: () => props.onClick?.(),\n };\n const unregister = register?.({ element, props, item });\n if (unregister) onCleanup(unregister);\n }}\n class=\"k2b-toolbar__action\"\n label={props.label}\n variant=\"ghost\"\n tooltip={tooltip()}\n aria-keyshortcuts={ariaShortcut(props.keys, platform())}\n aria-pressed={props.pressed === undefined ? undefined : props.pressed ? \"true\" : \"false\"}\n data-priority={props.priority}\n data-text={props.text ? \"\" : undefined}\n disabled={props.disabled}\n onClick={() => props.onClick?.()}\n >\n <i class={props.icon} aria-hidden=\"true\" />\n <Show when={props.text}>\n <span class=\"k2b-toolbar__text\" aria-hidden=\"true\">\n {props.label}\n </span>\n </Show>\n <Show when={hints && props.keys}>{(keys) => <Kbd keys={keys()} class=\"k2b-kbd-hint k2b-toolbar__hint\" />}</Show>\n </IconButton>\n );\n};\n\nconst ToolbarLabel = (props: ToolbarLabelProps): JSX.Element => {\n const danger = useContext(ToolbarDangerContext);\n let label!: HTMLSpanElement;\n // The shared assertive live region exists before the text arrives, so the message is read reliably, also when the\n // pill appears with it or its text changes later.\n onMount(() => {\n if (!danger) return;\n let spoken = \"\";\n const speak = () => {\n const text = label.textContent?.replace(/\\s+/g, \" \").trim() ?? \"\";\n if (text === spoken) return;\n spoken = text;\n announce(text, { politeness: \"assertive\" });\n };\n speak();\n const observer = new MutationObserver(speak);\n observer.observe(label, { childList: true, subtree: true, characterData: true });\n onCleanup(() => observer.disconnect());\n });\n return (\n <span ref={label} class={`k2b-toolbar__label ${props.class ?? \"\"}`} data-detail={props.detail ? \"\" : undefined}>\n <Show when={props.detail} fallback={props.children}>\n <span class=\"k2b-toolbar__label-main\">{props.children}</span>\n <span class=\"k2b-toolbar__label-detail\">{props.detail}</span>\n </Show>\n </span>\n );\n};\n\nconst ToolbarGroup = (props: ToolbarGroupProps): JSX.Element => (\n <div class={`k2b-toolbar__group ${props.class ?? \"\"}`} role=\"group\" aria-label={props.label}>\n {props.children}\n </div>\n);\n\nconst ToolbarSeparator = (props: ToolbarSeparatorProps): JSX.Element => {\n const toolbarOrientation = useContext(ToolbarOrientationContext);\n const separatorOrientation = () => (toolbarOrientation() === \"horizontal\" ? \"vertical\" : \"horizontal\");\n\n return (\n <span\n class={`k2b-toolbar__separator ${props.class ?? \"\"}`}\n role=\"separator\"\n aria-orientation={separatorOrientation()}\n data-orientation={separatorOrientation()}\n />\n );\n};\n\nconst ToolbarSpacer = (): JSX.Element => <span class=\"k2b-toolbar__spacer\" aria-hidden=\"true\" />;\n\nconst rovingFocus = (root: HTMLDivElement, orientation: () => ToolbarOrientation) => {\n let last: HTMLElement | undefined;\n const setLast = (item: HTMLElement | undefined) => {\n if (item === last) return;\n if (last) resizeObserver.unobserve(last);\n last = item;\n if (last) resizeObserver.observe(last);\n };\n const controls = () =>\n Array.from(root.querySelectorAll<HTMLElement>(\"button, a[href], input, select, textarea, [tabindex]\")).filter((item) => {\n if (\n item.matches(\"textarea, select\") ||\n item.isContentEditable ||\n (item.matches(\"input\") && !/^(button|checkbox|reset|submit|image|color|file)$/i.test(item.getAttribute(\"type\") ?? \"text\"))\n )\n return false;\n const nested = item.closest('[role=\"menu\"], [role=\"listbox\"], [role=\"dialog\"], [popover]');\n return !nested || !root.contains(nested);\n });\n const items = () =>\n controls().filter(\n (item) => !item.matches(\":disabled\") && !item.closest('[data-overflow=\"hidden\"]') && item.getClientRects().length > 0,\n );\n const sync = () => {\n // A toolbar that is still hidden, such as a SelectionToolbar about to show, keeps one stop: otherwise Tab right\n // after it shows would pass it before the next measure.\n const shown = items();\n const available = shown.length\n ? shown\n : controls().filter((item) => !item.matches(\":disabled\") && !item.closest('[data-overflow=\"hidden\"]'));\n if (!last || !available.includes(last)) setLast(available[0]);\n for (const item of controls()) item.tabIndex = item === last ? 0 : -1;\n };\n const focusin = (event: FocusEvent) => {\n if (event.target instanceof HTMLElement && items().includes(event.target)) {\n setLast(event.target);\n sync();\n }\n };\n const keydown = (event: KeyboardEvent) => {\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const available = items();\n const target = event.target;\n if (!(target instanceof HTMLElement) || !available.includes(target)) return;\n const forward = orientation() === \"vertical\" ? \"ArrowDown\" : getComputedStyle(root).direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = orientation() === \"vertical\" ? \"ArrowUp\" : forward === \"ArrowRight\" ? \"ArrowLeft\" : \"ArrowRight\";\n const index = available.indexOf(target);\n const next =\n event.key === \"Home\"\n ? 0\n : event.key === \"End\"\n ? available.length - 1\n : event.key === forward\n ? (index + 1) % available.length\n : event.key === backward\n ? (index + available.length - 1) % available.length\n : -1;\n if (next < 0) return;\n event.preventDefault();\n setLast(available[next]);\n sync();\n last?.focus();\n };\n const observer = new MutationObserver(sync);\n observer.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\"disabled\", \"hidden\", \"class\", \"style\", overflowAttribute],\n });\n const resizeObserver = new ResizeObserver(sync);\n resizeObserver.observe(root);\n root.addEventListener(\"focusin\", focusin);\n sync();\n return {\n keydown,\n sync,\n cleanup: () => {\n observer.disconnect();\n resizeObserver.disconnect();\n root.removeEventListener(\"focusin\", focusin);\n },\n };\n};\n\n/**\n * All measurement writes are DOM attributes: reactive writes do not flush during onMount. More is never toggled while\n * measuring: hiding it, even for a moment, can make the browser drop focus from it or from its open menu. An idle More\n * stays out of the flow but keeps its box, so its width is always known.\n */\nconst measureOverflow = (\n root: HTMLDivElement,\n more: HTMLDivElement,\n actions: RegisteredAction[],\n available: number,\n pinned = false,\n): RegisteredAction[] => {\n for (const element of root.querySelectorAll(`[${overflowAttribute}]`)) if (element !== more) reveal(element);\n root.removeAttribute(compactAttribute);\n const children = Array.from(root.children).filter(\n (element): element is HTMLElement => element instanceof HTMLElement && element !== more,\n );\n const visible = (element: Element) => !element.matches(\"[popover]\") && element.getClientRects().length > 0;\n const separator = (element: Element) => element.classList.contains(\"k2b-toolbar__separator\");\n const item = (element: Element) => !separator(element) && !element.classList.contains(\"k2b-toolbar__spacer\");\n // Separators are tidied in DOM order with More, the last control, counted as shown when `withMore` is set.\n const all = Array.from(root.children).filter((element): element is HTMLElement => element instanceof HTMLElement);\n const tidy = (withMore: boolean) => {\n for (const group of root.querySelectorAll(\".k2b-toolbar__group\")) {\n reveal(group);\n if (!Array.from(group.children).some(visible)) hide(group);\n }\n for (const child of children) if (separator(child)) reveal(child);\n const shown = (element: HTMLElement) => (element === more ? withMore : visible(element));\n let preceding = false;\n for (let index = 0; index < all.length; index++) {\n const child = all[index]!;\n if (!shown(child)) continue;\n if (separator(child)) {\n const following = all.slice(index + 1).some((next) => item(next) && shown(next));\n if (!preceding || !following) hide(child);\n else preceding = false;\n } else if (item(child)) preceding = true;\n }\n };\n const style = getComputedStyle(root);\n const edges = [style.paddingLeft, style.paddingRight, style.borderLeftWidth, style.borderRightWidth].reduce(\n (sum, value) => sum + (Number.parseFloat(value) || 0),\n 0,\n );\n const gap = Number.parseFloat(style.columnGap) || 0;\n // A label may shrink in an overfull pill; measure its untruncated width (up to its cap) so actions move before the\n // count or title truncates.\n const width = (child: HTMLElement) => {\n // Separators carry inline margins, which bounding boxes leave out.\n const childStyle = getComputedStyle(child);\n // A spacer takes whatever room is left, so it needs only its minimum.\n if (child.classList.contains(\"k2b-toolbar__spacer\")) return Number.parseFloat(childStyle.minWidth) || 0;\n const box =\n child.getBoundingClientRect().width +\n (Number.parseFloat(childStyle.marginLeft) || 0) +\n (Number.parseFloat(childStyle.marginRight) || 0);\n if (!child.classList.contains(\"k2b-toolbar__label\")) return box;\n // A detail only takes leftover room: the label needs its main text and padding.\n const main = child.querySelector<HTMLElement>(\":scope > .k2b-toolbar__label-main\");\n if (main)\n return (\n main.scrollWidth +\n (Number.parseFloat(childStyle.paddingLeft) || 0) +\n (Number.parseFloat(childStyle.paddingRight) || 0) +\n (Number.parseFloat(childStyle.marginLeft) || 0) +\n (Number.parseFloat(childStyle.marginRight) || 0)\n );\n const cap = Number.parseFloat(childStyle.maxWidth);\n return Math.max(box, Math.min(child.scrollWidth, Number.isNaN(cap) ? Number.POSITIVE_INFINITY : cap));\n };\n const moreWidth = width(more) + gap;\n const used = (withMore: boolean) => {\n const shown = children.filter(visible);\n return shown.reduce((sum, child) => sum + width(child), edges) + gap * Math.max(0, shown.length - 1) + (withMore ? moreWidth : 0);\n };\n // Stable sort retains DOM order for the menu, but removes later actions first on a priority tie.\n const candidates = actions\n // An action its application hides, even with `visibility: hidden`, must not reappear as a More row.\n .filter(\n (action) =>\n action.props.priority !== undefined && visible(action.element) && getComputedStyle(action.element).visibility !== \"hidden\",\n )\n .reverse()\n .sort((a, b) => b.props.priority! - a.props.priority!);\n // With rarer commands of its own, More always shows and always takes its room.\n let movedAny = pinned;\n tidy(pinned);\n // Labels go before actions: a toolbar that does not fit with its labels drops them first.\n if (used(pinned) > available && root.querySelector(\".k2b-toolbar__action[data-text]\")) root.setAttribute(compactAttribute, \"\");\n for (const action of candidates) {\n if (used(movedAny) <= available) break;\n hide(action.element);\n movedAny = true;\n tidy(true);\n }\n // More changes only here, and only when its state changes.\n if (movedAny) reveal(more);\n else if (!more.hasAttribute(overflowAttribute)) hide(more);\n return actions.filter((action) => action.element.hasAttribute(overflowAttribute));\n};\n\nexport const Toolbar = Object.assign(\n (props: ToolbarProps): JSX.Element => {\n // The variant decides the DOM shape, so it is read once.\n const floating = props.variant === \"floating\";\n const danger = () => (floating && props.tone === \"danger\" ? \"danger\" : undefined);\n const orientation = () => (floating ? \"horizontal\" : (props.orientation ?? \"horizontal\"));\n const messages = useToolbarMessages();\n const actions = new Set<RegisteredAction>();\n const [revision, setRevision] = createSignal(0);\n const [moved, setMoved] = createSignal<RegisteredAction[]>([]);\n let root!: HTMLDivElement;\n let strip: HTMLDivElement | undefined;\n let more: HTMLDivElement | undefined;\n let trigger: HTMLButtonElement | undefined;\n let mounted = false;\n let navigation: ReturnType<typeof rovingFocus> | undefined;\n // Only the floating variant moves actions into More; inline toolbars keep every action in place.\n const measure = () => {\n if (!mounted || !strip || !more) return;\n const style = getComputedStyle(strip);\n const available = strip.clientWidth - Number.parseFloat(style.paddingLeft) - Number.parseFloat(style.paddingRight);\n if (available <= 0) return;\n const ordered = [...actions].sort((a, b) =>\n a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1,\n );\n const focused = document.activeElement;\n // Cleared before measuring so the pending `visibility: hidden` does not hide every action from the check\n // below; the whole measurement still runs before the next paint.\n root.removeAttribute(\"data-overflow-pending\");\n const next = measureOverflow(root, more, ordered, available, (props.moreItems?.length ?? 0) > 0);\n setMoved((previous) =>\n previous.length === next.length && previous.every((action, index) => action === next[index]) ? previous : next,\n );\n navigation?.sync();\n // Focus on an action that moved, on a menu row whose action came back, or on a More that disappeared goes to\n // More, or to the toolbar's tab stop when nothing is left in More. Inside an effect the menu rows update after\n // this function returns, so the check waits for that flush; a microtask still runs before the next paint.\n queueMicrotask(() => {\n // A toolbar unmounted meanwhile, as its view closes, owns no focus any more.\n if (!mounted) return;\n const lost =\n next.some((action) => action.element === focused) ||\n (focused instanceof HTMLElement && !focused.isConnected) ||\n (focused === trigger && !next.length);\n if (lost) (next.length ? trigger : root.querySelector<HTMLElement>('[tabindex=\"0\"]'))?.focus();\n });\n };\n const register = (action: RegisteredAction) => {\n actions.add(action);\n setRevision((value) => value + 1);\n return () => {\n actions.delete(action);\n setRevision((value) => value + 1);\n };\n };\n if (floating)\n createEffect(() => {\n revision();\n for (const action of actions) {\n // Content and priority changes can affect intrinsic widths as well as menu rows.\n void action.props.priority;\n void action.props.label;\n void action.props.icon;\n void action.props.keys;\n void action.props.text;\n }\n measure();\n });\n onMount(() => {\n mounted = true;\n navigation = rovingFocus(root, orientation);\n onCleanup(() => {\n mounted = false;\n navigation?.cleanup();\n });\n if (!strip) return;\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(strip);\n observer.observe(root);\n const mutations = new MutationObserver(measure);\n // Visibility an application sets also counts. Measurement writes only data attributes, which stay unobserved.\n mutations.observe(root, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\"hidden\", \"class\", \"style\"],\n });\n onCleanup(() => {\n observer.disconnect();\n mutations.disconnect();\n });\n });\n // Actions that moved come first, in their order and in a group of their own; the host's rarer commands follow.\n const menuItems = (): DropdownItem[] => {\n const movedItems = moved().map((action) => action.item);\n const pinnedItems = props.moreItems ?? [];\n if (!pinnedItems.length) return movedItems;\n return movedItems.length ? [{ items: movedItems }, ...pinnedItems] : [...pinnedItems];\n };\n const content = (\n <ToolbarOrientationContext.Provider value={orientation}>\n <ToolbarDangerContext.Provider value={!!danger()}>\n <ToolbarActionsContext.Provider value={floating ? register : undefined}>\n <div\n ref={root}\n onKeyDown={(event) => navigation?.keydown(event)}\n class={`k2b-toolbar ${props.class ?? \"\"}`}\n role=\"toolbar\"\n aria-label={props.label}\n aria-orientation={orientation()}\n data-orientation={orientation()}\n data-variant={floating ? \"floating\" : undefined}\n data-tone={danger()}\n data-wrap={!floating && props.wrap ? \"true\" : undefined}\n data-overflow-pending={floating ? \"\" : undefined}\n >\n {props.children}\n <Show when={floating}>\n <div ref={more} class=\"k2b-toolbar__more\" data-overflow=\"hidden\">\n <Dropdown.Root\n items={menuItems()}\n position=\"top-left\"\n label={messages().moreActions}\n // An open menu closes when its last row returns to the toolbar.\n disabled={moved().length === 0 && !props.moreItems?.length}\n >\n <Dropdown.Trigger ref={trigger} iconOnly label={messages().moreActions}>\n <i class=\"ti ti-dots\" aria-hidden=\"true\" />\n </Dropdown.Trigger>\n </Dropdown.Root>\n </div>\n </Show>\n </div>\n </ToolbarActionsContext.Provider>\n </ToolbarDangerContext.Provider>\n </ToolbarOrientationContext.Provider>\n );\n return floating ? (\n <div ref={strip} class=\"k2b-toolbar-float\" data-edge={props.edge === \"top\" ? \"top\" : undefined} data-tone={danger()}>\n {content}\n </div>\n ) : (\n content\n );\n },\n { Action: ToolbarAction, Label: ToolbarLabel, Group: ToolbarGroup, Separator: ToolbarSeparator, Spacer: ToolbarSpacer },\n) as ToolbarComponent;\n\nexport type ToolbarDockProps = { children: JSX.Element; class?: string };\n\n/**\n * One floating row at the bottom of a column for several floating toolbars: the first sits at the start edge, the last\n * at the end edge, and each moves its own actions into More when the row gets narrow. Content scrolls beneath the row\n * and still ends above it.\n */\nexport const ToolbarDock = (props: ToolbarDockProps): JSX.Element => (\n <div class={props.class ? `k2b-toolbar-dock ${props.class}` : \"k2b-toolbar-dock\"}>{props.children}</div>\n);\n\nexport default Toolbar;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa,EAAE,YAAY,EAAE,YAAY,EAAY,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,QAAQ,UAAU;AAClI,SAAS,QAAQ,QAAQ,cAAc;AACvC,SAAS,GAAG,QAAQ,gBAAgB;AACpC,SAAS,QAAQ,QAAQ,sBAAsB;AAC/C,SAAS,SAAS,QAAQ,gBAAgB;AAC1C,SAAS,cAAc,EAAyB,gBAAgB,QAAQ,kBAAkB;AAC1F,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,QAAQ,QAAgD,YAAY;AAC7E,SAAS,kBAA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CAAqB;AAIrB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,WAAW,GAAI,KAAuB,4CACrC,KAAK,CAAC,KAAK,GAAG,6BAAoB,KAAK,CAAC,KAAK,SAAE,GAAG,kBAAkB,mBAAG,KAAK,CAAC,QAAQ,EAClG;AAED,eAAe,OAAO","ignoreList":[]}
@@ -15,7 +15,7 @@ var _tmpl$ = ["<span><strong", ">", "</strong></span>"],
15
15
  _tmpl$8 = ["<div class=\"k2b-chat-composer__microphone\">", "", "</div>"],
16
16
  _tmpl$9 = ["<div class=\"k2b-chat-composer__highlight\" aria-hidden=\"true\">", "\n</div>"],
17
17
  _tmpl$0 = "<textarea class=\"k2b-chat-composer__measure\" rows=\"1\" tabindex=\"-1\" aria-hidden=\"true\" readonly></textarea>",
18
- _tmpl$1 = ["<div class=\"k2b-chat-composer__input\" role=\"group\"", ">", "<textarea class=\"", "\" rows=\"1\"", "", "></textarea>", "</div>"],
18
+ _tmpl$1 = ["<div class=\"k2b-chat-composer__input\" role=\"group\"", ">", "<textarea class=\"", "\" rows=\"1\"", "", "", "></textarea>", "</div>"],
19
19
  _tmpl$10 = "<span class=\"k2b-dictation-mark\"></span>",
20
20
  _tmpl$11 = ["<span class=\"", "\">", "</span>"],
21
21
  _tmpl$12 = ["<span class=\"k2b-chat-composer__command-detail\"", "><small", ">", "</small><small", "><i class=\"ti ti-loader-2 k2b-spin\" aria-hidden=\"true\"></i>", "</small></span>"],
@@ -176,6 +176,8 @@ const swallowTap = down => {
176
176
  const attachmentIcon = attachment => attachment.icon ?? (attachment.kind === "image" ? "ti ti-photo" : attachment.kind === "resource" ? "ti ti-link" : "ti ti-file");
177
177
  const hasContent = items => items.some(item => item != null && typeof item !== "boolean" && item !== "");
178
178
  export function ChatComposer(props) {
179
+ // A parent that recomputes the same key keeps the same draft: only a new value resets what belongs to the old one.
180
+ const draftKey = createMemo(() => props.draftKey);
179
181
  const accessory = children(() => props.accessory);
180
182
  const hasAccessory = () => hasContent(accessory.toArray());
181
183
  const hint = children(() => props.hint);
@@ -372,13 +374,13 @@ export function ChatComposer(props) {
372
374
  });
373
375
  const openingStart = createMemo(() => commandQuery()?.start);
374
376
  createEffect(() => {
375
- props.draftKey;
377
+ draftKey();
376
378
  const start = openingStart();
377
379
  if (start !== undefined) setCommandOpening(opening => opening + 1);
378
380
  });
379
381
  // A failed `open` row says so for the rest of its list opening.
380
382
  createEffect(() => {
381
- props.draftKey;
383
+ draftKey();
382
384
  commandOpening();
383
385
  setOpenFailures({});
384
386
  });
@@ -400,7 +402,7 @@ export function ChatComposer(props) {
400
402
  // Rows of a `fixedWhileOpen` section are the ones it had when this `/` opened the list; later ones wait for the next
401
403
  // `/`. A retry row starts another opening in the same open list, so it does not count.
402
404
  const fixedCommandKeys = createMemo(() => {
403
- props.draftKey;
405
+ draftKey();
404
406
  if (openingStart() === undefined) return undefined;
405
407
  return untrack(() => {
406
408
  const fixed = new Set((props.commandSections ?? []).filter(section => section.fixedWhileOpen).map(section => section.id));
@@ -435,7 +437,7 @@ export function ChatComposer(props) {
435
437
  const currentCommandQuery = createMemo(() => caretCommandToken()?.query);
436
438
  // Arrow marking belongs to one token in one draft; another draft or `/` starts at the top row again.
437
439
  createEffect(() => {
438
- props.draftKey;
440
+ draftKey();
439
441
  caretCommandStart();
440
442
  currentCommandQuery();
441
443
  setCommandMoved(false);
@@ -484,15 +486,15 @@ export function ChatComposer(props) {
484
486
  // cancels too, unless the opener announced that next move with `follow()`: its busy line moves to the status line,
485
487
  // and Escape still cancels there. Any later unannounced draft change cancels.
486
488
  createEffect(() => {
487
- const draftKey = props.draftKey;
489
+ const key = draftKey();
488
490
  const open = commandsOpen();
489
491
  const row = openingRow();
490
492
  const run = openingRun;
491
493
  if (!run || row === undefined) return;
492
- if (draftKey !== run.key) {
494
+ if (key !== run.key) {
493
495
  if (run.follow) {
494
496
  run.follow = false;
495
- run.key = draftKey;
497
+ run.key = key;
496
498
  run.moved = true;
497
499
  showCommandStatus({
498
500
  tone: "busy",
@@ -602,7 +604,7 @@ export function ChatComposer(props) {
602
604
  onCleanup(() => window.removeEventListener("pointerdown", onPointerDown, true));
603
605
  });
604
606
  createEffect(() => {
605
- props.draftKey;
607
+ draftKey();
606
608
  const token = commandQuery();
607
609
  setSearchError(false);
608
610
  if (!token || !props.searchCommands) {
@@ -693,7 +695,7 @@ export function ChatComposer(props) {
693
695
  const history = [];
694
696
  let historyIndex = -1;
695
697
  createEffect(() => {
696
- props.draftKey;
698
+ draftKey();
697
699
  untrack(() => {
698
700
  history.length = 0;
699
701
  historyIndex = -1;
@@ -940,8 +942,7 @@ export function ChatComposer(props) {
940
942
  // drops the source ends it; the words so far stay.
941
943
  // Memos compare values, so typing and arriving words never end it.
942
944
  const dictationField = createMemo(() => `${Boolean(props.dictation)}:${editBlocked()}`);
943
- const dictationDraft = createMemo(() => props.draftKey);
944
- createEffect(on([dictationField, dictationDraft], () => liveDictation.end(), {
945
+ createEffect(on([dictationField, draftKey], () => liveDictation.end(), {
945
946
  defer: true
946
947
  }));
947
948
  const hasDraft = () => Boolean(props.value.trim() || !running() && attachments().length > 0);
@@ -1100,7 +1101,7 @@ export function ChatComposer(props) {
1100
1101
  */
1101
1102
  const attachFilesFromCommand = (token, selection) => {
1102
1103
  if (!canSelectFiles()) return;
1103
- const key = props.draftKey;
1104
+ const key = draftKey();
1104
1105
  const previous = snapshot();
1105
1106
  const previousHistory = {
1106
1107
  entries: [...history],
@@ -1110,7 +1111,7 @@ export function ChatComposer(props) {
1110
1111
  edit(nextValue, reconcileChatMentions(props.value, nextValue, mentions()));
1111
1112
  setDismissed(true);
1112
1113
  chooseFiles(() => {
1113
- if (props.draftKey !== key || props.value !== nextValue) return;
1114
+ if (draftKey() !== key || props.value !== nextValue) return;
1114
1115
  setDismissed(true);
1115
1116
  props.onValueChange(previous.value);
1116
1117
  props.onMentionsChange?.(previous.mentions);
@@ -1123,7 +1124,7 @@ export function ChatComposer(props) {
1123
1124
  });
1124
1125
  });
1125
1126
  queueMicrotask(() => {
1126
- if (props.draftKey !== key || props.value !== nextValue) return;
1127
+ if (draftKey() !== key || props.value !== nextValue) return;
1127
1128
  textareaRef?.setSelectionRange(token.start, token.start);
1128
1129
  syncCaret();
1129
1130
  });
@@ -1145,7 +1146,7 @@ export function ChatComposer(props) {
1145
1146
  };
1146
1147
  const submit = async () => {
1147
1148
  if (!canSubmit()) return;
1148
- const key = props.draftKey;
1149
+ const key = draftKey();
1149
1150
  setSubmitting(true);
1150
1151
  try {
1151
1152
  if (isTouchOnly()) {
@@ -1153,7 +1154,7 @@ export function ChatComposer(props) {
1153
1154
  // The sheet's Back entry leaves first, so a submit handler that navigates finds the history settled.
1154
1155
  await dialogHistorySettled();
1155
1156
  // A draft that another one replaced, or that may no longer go out, is not sent and keeps its text.
1156
- if (disposed || props.draftKey !== key || !submittable()) return;
1157
+ if (disposed || draftKey() !== key || !submittable()) return;
1157
1158
  }
1158
1159
  const intent = running() ? runningSubmitIntent() : "send";
1159
1160
  const previousValue = props.value;
@@ -1244,7 +1245,7 @@ export function ChatComposer(props) {
1244
1245
  // From "+" a reference joins the text at the caret, apart from a word right before it.
1245
1246
  const lead = value => fromAdd && token.start > 0 && !/\s/.test(value[token.start - 1] ?? "") ? " " : "";
1246
1247
  const previous = snapshot();
1247
- const key = props.draftKey;
1248
+ const key = draftKey();
1248
1249
  const replacement = command.mention ? lead(props.value) + command.mention.name + " " : "";
1249
1250
  const nextValue = props.value.slice(0, token.start) + replacement + props.value.slice(token.end);
1250
1251
  const nextMentions = reconcileChatMentions(props.value, nextValue, mentions());
@@ -1268,7 +1269,7 @@ export function ChatComposer(props) {
1268
1269
  let restored = false;
1269
1270
  let mentioned;
1270
1271
  const restore = () => {
1271
- if (props.draftKey !== key || props.value !== nextValue) return;
1272
+ if (draftKey() !== key || props.value !== nextValue) return;
1272
1273
  setDismissed(true);
1273
1274
  props.onValueChange(previous.value);
1274
1275
  props.onMentionsChange?.(previous.mentions);
@@ -1285,7 +1286,7 @@ export function ChatComposer(props) {
1285
1286
  if (heldHistory && command.action) {
1286
1287
  await dialogHistorySettled();
1287
1288
  // Another draft or no composer any more: the command does not run against it.
1288
- if (disposed || props.draftKey !== key) return;
1289
+ if (disposed || draftKey() !== key) return;
1289
1290
  }
1290
1291
  const result = await command.action?.({
1291
1292
  setValue: value => edit(value),
@@ -1301,7 +1302,7 @@ export function ChatComposer(props) {
1301
1302
  showCommandStatus();
1302
1303
  } else if (result && "mention" in result) {
1303
1304
  // One undo step from the token to the reference, as if the row had been a reference itself.
1304
- if (props.draftKey === key && props.value === nextValue) {
1305
+ if (draftKey() === key && props.value === nextValue) {
1305
1306
  restore();
1306
1307
  restored = false;
1307
1308
  const name = result.mention.name;
@@ -1344,9 +1345,9 @@ export function ChatComposer(props) {
1344
1345
  if (commandStatus()?.tone === "busy") showCommandStatus();
1345
1346
  setExecuting(false);
1346
1347
  }
1347
- if (submitRequested && props.draftKey === key) await submit();
1348
+ if (submitRequested && draftKey() === key) await submit();
1348
1349
  queueMicrotask(() => {
1349
- if (props.draftKey !== key) return;
1350
+ if (draftKey() !== key) return;
1350
1351
  if (restored || props.value === nextValue || mentioned && props.value === mentioned.value) {
1351
1352
  const position = restored ? token.end : mentioned?.caret ?? token.start + replacement.length;
1352
1353
  textareaRef?.setSelectionRange(restored && addSelection ? addSelection.start : position, restored && addSelection ? addSelection.end : position);
@@ -1362,13 +1363,13 @@ export function ChatComposer(props) {
1362
1363
  * stays in the row while the list is still there, otherwise the status line says it, so it never ends in silence.
1363
1364
  */
1364
1365
  const openFromCommand = async (command, open, token) => {
1365
- const key = props.draftKey;
1366
+ const key = draftKey();
1366
1367
  const row = chatCommandKey(command);
1367
1368
  const value = props.value;
1368
1369
  const nextValue = value.slice(0, token.start) + value.slice(token.end);
1369
1370
  const nextMentions = reconcileChatMentions(value, nextValue, mentions());
1370
1371
  // Still the same draft and `/…`, so the row is where the person chose it.
1371
- const inPlace = () => !disposed && props.draftKey === key && props.value === value && commandQuery()?.start === token.start;
1372
+ const inPlace = () => !disposed && draftKey() === key && props.value === value && commandQuery()?.start === token.start;
1372
1373
  const heldHistory = commandSheetHeld();
1373
1374
  // Closing the list or leaving the composer cancels the opening; the row ends at once, without waiting for it.
1374
1375
  const controller = new AbortController();
@@ -1430,15 +1431,15 @@ export function ChatComposer(props) {
1430
1431
  // Success: the token leaves and the list closes in the same step that ends the opening, so a phone sheet never
1431
1432
  // takes its Back entry again while the page navigates.
1432
1433
  batch(() => {
1433
- if (!disposed && props.draftKey === key && props.value === value) {
1434
+ if (!disposed && draftKey() === key && props.value === value) {
1434
1435
  edit(nextValue, nextMentions);
1435
1436
  setDismissed(true);
1436
1437
  }
1437
- endAddSearch(!disposed && props.draftKey === key);
1438
+ endAddSearch(!disposed && draftKey() === key);
1438
1439
  finish(true);
1439
1440
  });
1440
1441
  queueMicrotask(() => {
1441
- if (disposed || props.draftKey !== key || props.value !== nextValue) return;
1442
+ if (disposed || draftKey() !== key || props.value !== nextValue) return;
1442
1443
  textareaRef?.setSelectionRange(token.start, token.start);
1443
1444
  syncCaret();
1444
1445
  autoResize();
@@ -2063,7 +2064,7 @@ export function ChatComposer(props) {
2063
2064
  children: part => part.mark ? _$ssr(_tmpl$10) : _$ssr(_tmpl$11, `${Boolean(part.mention) ? "k2b-chat-composer__mention" : ""} ${Boolean(part.fresh) ? "k2b-dictation-fresh" : ""}`, _$escape(part.text))
2064
2065
  })));
2065
2066
  }
2066
- })), mentions().length > 0 || Boolean(dictationView()) ? "k2b-chat-composer__textarea--highlighted" : "", _$ssrAttribute("value", _$escape(props.value, true), false), _$ssrAttribute("disabled", editBlocked() && openingRow() === undefined, true) + _$ssrAttribute("readonly", _$escape(openingRow(), true) !== _$escape(undefined, true), false) + _$ssrAttribute("enterkeyhint", conversation() ? "enter" : _$escape(undefined, true), false) + _$ssrAttribute("placeholder", _$escape(props.placeholder ?? (running() ? chatMessages().addGuidance : conversation() ? chatMessages().writeConversationMessage : chatMessages().writeMessage), true), false) + _$ssrAttribute("aria-label", _$escape(props.inputLabel ?? messages().message, true), false) + _$ssrAttribute("role", fieldOwnsList() ? "combobox" : _$escape(undefined, true), false) + _$ssrAttribute("aria-autocomplete", fieldOwnsList() ? "list" : _$escape(undefined, true), false) + _$ssrAttribute("aria-controls", fieldOwnsList() ? _$escape(commandListId, true) : _$escape(undefined, true), false) + _$ssrAttribute("aria-expanded", fieldOwnsList() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("aria-activedescendant", !fieldOwnsList() ? _$escape(undefined, true) : emojiOpen() || peopleOpen() ? `${_$escape(commandListId, true)}-${_$escape(selectedCommandIndex(), true)}` : selectedCommand() ? _$escape(commandOptionId(selectedCommand()), true) : _$escape(undefined, true), false), _$escape(_$createComponent(Show, {
2067
+ })), mentions().length > 0 || Boolean(dictationView()) ? "k2b-chat-composer__textarea--highlighted" : "", _$ssrAttribute("value", _$escape(props.value, true), false), _$ssrAttribute("disabled", editBlocked() && openingRow() === undefined, true), _$ssrAttribute("readonly", openingRow() !== undefined, true) + _$ssrAttribute("enterkeyhint", conversation() ? "enter" : _$escape(undefined, true), false) + _$ssrAttribute("placeholder", _$escape(props.placeholder ?? (running() ? chatMessages().addGuidance : conversation() ? chatMessages().writeConversationMessage : chatMessages().writeMessage), true), false) + _$ssrAttribute("aria-label", _$escape(props.inputLabel ?? messages().message, true), false) + _$ssrAttribute("role", fieldOwnsList() ? "combobox" : _$escape(undefined, true), false) + _$ssrAttribute("aria-autocomplete", fieldOwnsList() ? "list" : _$escape(undefined, true), false) + _$ssrAttribute("aria-controls", fieldOwnsList() ? _$escape(commandListId, true) : _$escape(undefined, true), false) + _$ssrAttribute("aria-expanded", fieldOwnsList() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("aria-activedescendant", !fieldOwnsList() ? _$escape(undefined, true) : emojiOpen() || peopleOpen() ? `${_$escape(commandListId, true)}-${_$escape(selectedCommandIndex(), true)}` : selectedCommand() ? _$escape(commandOptionId(selectedCommand()), true) : _$escape(undefined, true), false), _$escape(_$createComponent(Show, {
2067
2068
  get when() {
2068
2069
  return conversation();
2069
2070
  },
@@ -2193,7 +2194,7 @@ export function ChatComposer(props) {
2193
2194
  return addSearch();
2194
2195
  },
2195
2196
  get children() {
2196
- return _$ssr(_tmpl$20, _$ssrAttribute("value", _$escape(addQuery(), true), false) + _$ssrAttribute("placeholder", _$escape(chatMessages().commandSearch, true), false) + _$ssrAttribute("aria-label", _$escape(chatMessages().commandSearchLabel, true), false), _$ssrAttribute("aria-controls", _$escape(commandListId, true), false), _$ssrAttribute("aria-activedescendant", selectedCommand() ? _$escape(commandOptionId(selectedCommand()), true) : _$escape(undefined, true), false), _$ssrAttribute("readonly", _$escape(openingRow(), true) !== _$escape(undefined, true), false));
2197
+ return _$ssr(_tmpl$20, _$ssrAttribute("value", _$escape(addQuery(), true), false) + _$ssrAttribute("placeholder", _$escape(chatMessages().commandSearch, true), false) + _$ssrAttribute("aria-label", _$escape(chatMessages().commandSearchLabel, true), false), _$ssrAttribute("aria-controls", _$escape(commandListId, true), false), _$ssrAttribute("aria-activedescendant", selectedCommand() ? _$escape(commandOptionId(selectedCommand()), true) : _$escape(undefined, true), false), _$ssrAttribute("readonly", openingRow() !== undefined, true));
2197
2198
  }
2198
2199
  })), _$ssrAttribute("id", _$escape(commandListId, true), false), _$ssrAttribute("aria-label", _$escape(chatMessages().commands, true), false) + _$ssrAttribute("aria-busy", searching() ? "true" : _$escape(undefined, true), false), _$escape(_$createComponent(For, {
2199
2200
  get each() {