@k2b/ui 0.38.0 → 0.39.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 (31) hide show
  1. package/dist/browser/actions/Dropdown.js +42 -6
  2. package/dist/browser/actions/Dropdown.js.map +1 -1
  3. package/dist/browser/actions/SelectionToolbar.js +11 -6
  4. package/dist/browser/actions/SelectionToolbar.js.map +1 -1
  5. package/dist/browser/actions/Toolbar.js +5 -1
  6. package/dist/browser/actions/Toolbar.js.map +1 -1
  7. package/dist/browser/actions/index.js.map +1 -1
  8. package/dist/browser/chat/ChatComposer.js +11 -2
  9. package/dist/browser/chat/ChatComposer.js.map +1 -1
  10. package/dist/browser/text-editor/TextEditor.js +331 -214
  11. package/dist/browser/text-editor/TextEditor.js.map +1 -1
  12. package/dist/browser/text-editor/table.js +43 -6
  13. package/dist/browser/text-editor/table.js.map +1 -1
  14. package/dist/ssr/actions/Dropdown.js +38 -6
  15. package/dist/ssr/actions/Dropdown.js.map +1 -1
  16. package/dist/ssr/actions/SelectionToolbar.js +11 -6
  17. package/dist/ssr/actions/SelectionToolbar.js.map +1 -1
  18. package/dist/ssr/actions/Toolbar.js +5 -1
  19. package/dist/ssr/actions/Toolbar.js.map +1 -1
  20. package/dist/ssr/actions/index.js.map +1 -1
  21. package/dist/ssr/chat/ChatComposer.js +10 -2
  22. package/dist/ssr/chat/ChatComposer.js.map +1 -1
  23. package/dist/ssr/text-editor/TextEditor.js +225 -96
  24. package/dist/ssr/text-editor/TextEditor.js.map +1 -1
  25. package/dist/ssr/text-editor/table.js +43 -6
  26. package/dist/ssr/text-editor/table.js.map +1 -1
  27. package/dist/styles.css +1 -1
  28. package/dist/types/actions/Dropdown.d.ts +15 -1
  29. package/dist/types/actions/Toolbar.d.ts +6 -1
  30. package/dist/types/actions/index.d.ts +1 -1
  31. package/package.json +1 -1
@@ -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 { 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 the bottom of its column. Defaults to `inline`. */\n variant?: \"inline\" | \"floating\";\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 /** Shortcut hint, tooltip suffix, and aria-keyshortcuts; does not register a shortcut handler. */\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 disabled?: boolean;\n onClick?: () => void;\n};\nexport type ToolbarLabelProps = { children: JSX.Element; class?: string };\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\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\";\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 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 data-priority={props.priority}\n disabled={props.disabled}\n onClick={() => props.onClick?.()}\n >\n <i class={props.icon} aria-hidden=\"true\" />\n <Show when={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 <span class={`k2b-toolbar__label ${props.class ?? \"\"}`}>{props.children}</span>\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 const available = items();\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 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 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 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 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 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 }\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 <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-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 </ToolbarOrientationContext.Provider>\n );\n return floating ? (\n <div ref={strip} class=\"k2b-toolbar-float\">\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 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,SAAS,QAAQ,gBAAgB;AAC1C,SAAS,cAAc,EAA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A,IACR,KAAK;kBAAA,OAAE,QAAQ,CAAC,CAAC,CAAC,WAAW;gBAAA;gBAAA,IAE7B,QAAQ;kBAAA,OAAE,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC;gBAAA;gBAAA;kBAAA,yBAE7B,QAAQ,CAAC,OAAO;oBAAe,QAAQ;oBAAA,IAAC,KAAK;sBAAA,OAAE,QAAQ,CAAC,CAAC,CAAC,WAAW;oBAAA;oBAAA;sBAAA;oBAAA;kBAAA;gBAAA;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA,EASnF;EACD,OAAO,QAAQ,2BAEV,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;AAErB,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 { 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 the bottom of its column. Defaults to `inline`. */\n variant?: \"inline\" | \"floating\";\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 disabled?: boolean;\n onClick?: () => void;\n};\nexport type ToolbarLabelProps = { children: JSX.Element; class?: string };\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/** 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\";\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 data-priority={props.priority}\n disabled={props.disabled}\n onClick={() => props.onClick?.()}\n >\n <i class={props.icon} aria-hidden=\"true\" />\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 <span class={`k2b-toolbar__label ${props.class ?? \"\"}`}>{props.children}</span>\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 const available = items();\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 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 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 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 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 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 }\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 <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-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 </ToolbarOrientationContext.Provider>\n );\n return floating ? (\n <div ref={strip} class=\"k2b-toolbar-float\">\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 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,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;AA0CvD,MAAM,yBAAmD,GAAG,MAAM,YAAY;AAC9E,MAAM,yBAAyB,GAAG,aAAa,CAAC,yBAAyB,CAAC;AAC1E;AACA,OAAO,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC;;AAEtD;;AAEA,MAAM,qBAAqB,GAAG,aAAa,CAA2C,CAAC;AACvF,MAAM,iBAAiB,GAAG,eAAe;AACzC,MAAM,IAAI,GAAI,OAAgB,IAAK,OAAO,CAAC,Y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BAAA;gBAAA;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA,EASnF;EACD,OAAO,QAAQ,2BAEV,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;AAErB,eAAe,OAAO","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["actions/index.ts"],"sourcesContent":["export type { ButtonAlign, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant, IconButtonLinkProps, IconButtonProps } from \"./Button\";\nexport { Button, ButtonLink, IconButton, IconButtonLink } from \"./Button\";\nexport type { ContextMenuProps } from \"./ContextMenu\";\nexport { ContextMenu } from \"./ContextMenu\";\nexport type { CopyButtonProps, CopyButtonValue } from \"./CopyButton\";\nexport { CopyButton } from \"./CopyButton\";\nexport type { DisclosureProps } from \"./Disclosure\";\nexport { Disclosure } from \"./Disclosure\";\nexport type { DragPayload, DragSourceProps, DropTargetProps } from \"./DragAndDrop\";\nexport { activeDrag, DragSource, DropTarget, useKeyboardDrag } from \"./DragAndDrop\";\nexport type {\n DropdownAction,\n DropdownActionBase,\n DropdownChoice,\n DropdownItemProps,\n DropdownPosition,\n DropdownProps,\n DropdownSection,\n DropdownTriggerProps,\n} from \"./Dropdown\";\nexport { Dropdown, DropdownItem, dropdownPosition } from \"./Dropdown\";\nexport type { FilterChipOption, FilterChipProps, FilterChipSection, FilterToggleProps } from \"./FilterChip\";\nexport { FilterChip, FilterToggle } from \"./FilterChip\";\nexport type { GestureKind, GestureMenuAction, GestureMenuItem, GestureMenuProps, GestureMenuSection } from \"./GestureMenu\";\nexport { GestureMenu } from \"./GestureMenu\";\nexport type { RemoveButtonProps } from \"./RemoveButton\";\nexport { RemoveButton } from \"./RemoveButton\";\nexport type { SegmentedControlProps, SegmentOption } from \"./SegmentedControl\";\nexport { SegmentedControl } from \"./SegmentedControl\";\nexport type { SelectionToolbarProps } from \"./SelectionToolbar\";\nexport { SelectionToolbar } from \"./SelectionToolbar\";\nexport type { SplitButtonProps } from \"./SplitButton\";\nexport { SplitButton } from \"./SplitButton\";\nexport type {\n SpotlightButtonProps,\n SpotlightButtonVariant,\n SpotlightSearchOptions,\n SpotlightSearchResolver,\n} from \"./SpotlightSearch\";\nexport {\n openSpotlightSearch,\n SpotlightButton,\n} from \"./SpotlightSearch\";\nexport type { TabOption, TabsItemProps, TabsProps } from \"./Tabs\";\nexport { Tabs } from \"./Tabs\";\nexport type { ToolbarActionProps, ToolbarGroupProps, ToolbarLabelProps, ToolbarProps, ToolbarSeparatorProps } from \"./Toolbar\";\nexport { Toolbar } from \"./Toolbar\";\nexport type { ViewTab, ViewTabsProps } from \"./ViewTabs\";\nexport { ViewTabs } from \"./ViewTabs\";\n"],"mappings":"AACA,SAAS,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,QAAQ,UAAU;AAEzE,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,UAAU,QAAQ,cAAc;AAEzC,SAAS,UAAU,QAAQ,cAAc;AAEzC,SAAS,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,QAAQ,eAAe;AAWnF,SAAS,QAAQ,EAAE,YAAY,EAAE,gBAAgB,QAAQ,YAAY;AAErE,SAAS,UAAU,EAAE,YAAY,QAAQ,cAAc;AAEvD,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,YAAY,QAAQ,gBAAgB;AAE7C,SAAS,gBAAgB,QAAQ,oBAAoB;AAErD,SAAS,gBAAgB,QAAQ,oBAAoB;AAErD,SAAS,WAAW,QAAQ,eAAe;AAO3C,SACE,mBAAmB,EACnB,eAAe,QACV,mBAAmB;AAE1B,SAAS,IAAI,QAAQ,QAAQ;AAE7B,SAAS,OAAO,QAAQ,WAAW;AAEnC,SAAS,QAAQ,QAAQ,YAAY","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["actions/index.ts"],"sourcesContent":["export type { ButtonAlign, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant, IconButtonLinkProps, IconButtonProps } from \"./Button\";\nexport { Button, ButtonLink, IconButton, IconButtonLink } from \"./Button\";\nexport type { ContextMenuProps } from \"./ContextMenu\";\nexport { ContextMenu } from \"./ContextMenu\";\nexport type { CopyButtonProps, CopyButtonValue } from \"./CopyButton\";\nexport { CopyButton } from \"./CopyButton\";\nexport type { DisclosureProps } from \"./Disclosure\";\nexport { Disclosure } from \"./Disclosure\";\nexport type { DragPayload, DragSourceProps, DropTargetProps } from \"./DragAndDrop\";\nexport { activeDrag, DragSource, DropTarget, useKeyboardDrag } from \"./DragAndDrop\";\nexport type {\n DropdownAction,\n DropdownActionBase,\n DropdownAnchor,\n DropdownChoice,\n DropdownItemProps,\n DropdownPosition,\n DropdownProps,\n DropdownReturnFocus,\n DropdownSection,\n DropdownTriggerProps,\n} from \"./Dropdown\";\nexport { Dropdown, DropdownItem, dropdownPosition } from \"./Dropdown\";\nexport type { FilterChipOption, FilterChipProps, FilterChipSection, FilterToggleProps } from \"./FilterChip\";\nexport { FilterChip, FilterToggle } from \"./FilterChip\";\nexport type { GestureKind, GestureMenuAction, GestureMenuItem, GestureMenuProps, GestureMenuSection } from \"./GestureMenu\";\nexport { GestureMenu } from \"./GestureMenu\";\nexport type { RemoveButtonProps } from \"./RemoveButton\";\nexport { RemoveButton } from \"./RemoveButton\";\nexport type { SegmentedControlProps, SegmentOption } from \"./SegmentedControl\";\nexport { SegmentedControl } from \"./SegmentedControl\";\nexport type { SelectionToolbarProps } from \"./SelectionToolbar\";\nexport { SelectionToolbar } from \"./SelectionToolbar\";\nexport type { SplitButtonProps } from \"./SplitButton\";\nexport { SplitButton } from \"./SplitButton\";\nexport type {\n SpotlightButtonProps,\n SpotlightButtonVariant,\n SpotlightSearchOptions,\n SpotlightSearchResolver,\n} from \"./SpotlightSearch\";\nexport {\n openSpotlightSearch,\n SpotlightButton,\n} from \"./SpotlightSearch\";\nexport type { TabOption, TabsItemProps, TabsProps } from \"./Tabs\";\nexport { Tabs } from \"./Tabs\";\nexport type { ToolbarActionProps, ToolbarGroupProps, ToolbarLabelProps, ToolbarProps, ToolbarSeparatorProps } from \"./Toolbar\";\nexport { Toolbar } from \"./Toolbar\";\nexport type { ViewTab, ViewTabsProps } from \"./ViewTabs\";\nexport { ViewTabs } from \"./ViewTabs\";\n"],"mappings":"AACA,SAAS,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,QAAQ,UAAU;AAEzE,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,UAAU,QAAQ,cAAc;AAEzC,SAAS,UAAU,QAAQ,cAAc;AAEzC,SAAS,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,QAAQ,eAAe;AAanF,SAAS,QAAQ,EAAE,YAAY,EAAE,gBAAgB,QAAQ,YAAY;AAErE,SAAS,UAAU,EAAE,YAAY,QAAQ,cAAc;AAEvD,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,YAAY,QAAQ,gBAAgB;AAE7C,SAAS,gBAAgB,QAAQ,oBAAoB;AAErD,SAAS,gBAAgB,QAAQ,oBAAoB;AAErD,SAAS,WAAW,QAAQ,eAAe;AAO3C,SACE,mBAAmB,EACnB,eAAe,QACV,mBAAmB;AAE1B,SAAS,IAAI,QAAQ,QAAQ;AAE7B,SAAS,OAAO,QAAQ,WAAW;AAEnC,SAAS,QAAQ,QAAQ,YAAY","ignoreList":[]}
@@ -404,7 +404,10 @@ export function ChatComposer(props) {
404
404
  const fixed = new Set((props.commandSections ?? []).filter(section => section.fixedWhileOpen).map(section => section.id));
405
405
  return commands.filter(command => !fixed.has(command.section ?? "") || keys.has(chatCommandKey(command)));
406
406
  });
407
- const commandModel = createMemo(() => chatCommandListModel({
407
+ // While a pointer is down on a row, the list keeps the rows it showed at the press: rows arriving then would move the
408
+ // pressed row away from under the pointer, and the release would land beside it (#2079). They show after the release.
409
+ const [holdingRows, setHoldingRows] = createSignal(false);
410
+ const liveCommandModel = createMemo(() => chatCommandListModel({
408
411
  query: commandQuery()?.query ?? "",
409
412
  scopes: props.commandScopes,
410
413
  sections: props.commandSections,
@@ -415,6 +418,7 @@ export function ChatComposer(props) {
415
418
  searching: searching(),
416
419
  fallback: commandFallbackRow()
417
420
  }));
421
+ const commandModel = createMemo(previous => holdingRows() && previous ? previous : liveCommandModel());
418
422
  const commandMatches = createMemo(() => commandQuery() ? commandModel().rows.map(row => row.command) : []);
419
423
  /** Rows that matched; an unscoped fallback row only follows them. */
420
424
  const foundCommandCount = () => commandMatches().length - (commandModel().fallback ? 1 : 0);
@@ -1944,7 +1948,9 @@ export function ChatComposer(props) {
1944
1948
  const release = event => {
1945
1949
  const pressed = pressedCommand;
1946
1950
  pressedCommand = undefined;
1947
- if (!pressed || pressed.row.isConnected || event.type !== "pointerup") return;
1951
+ // After this release's click, which the browser dispatches in the same task.
1952
+ if (holdingRows()) setTimeout(() => setHoldingRows(false));
1953
+ if (!pressed || pressed.row.isConnected || !(event instanceof PointerEvent) || event.type !== "pointerup") return;
1948
1954
  const under = document.elementFromPoint(event.clientX, event.clientY)?.closest("[data-command-key]");
1949
1955
  if (!under || under.dataset.commandKey !== pressed.key || !shellRef?.contains(under)) return;
1950
1956
  const command = commandRowMap().get(pressed.key)?.command;
@@ -1952,9 +1958,11 @@ export function ChatComposer(props) {
1952
1958
  };
1953
1959
  window.addEventListener("pointerup", release, true);
1954
1960
  window.addEventListener("pointercancel", release, true);
1961
+ window.addEventListener("blur", release);
1955
1962
  onCleanup(() => {
1956
1963
  window.removeEventListener("pointerup", release, true);
1957
1964
  window.removeEventListener("pointercancel", release, true);
1965
+ window.removeEventListener("blur", release);
1958
1966
  });
1959
1967
  });
1960
1968
  // Rows are keyed by the command's key, not its object: hosts rebuild their command objects whenever their inputs change,