@k2b/ui 0.55.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/actions/SplitButton.js +5 -7
- package/dist/browser/actions/SplitButton.js.map +1 -1
- package/dist/browser/actions/Toolbar.js +16 -7
- package/dist/browser/actions/Toolbar.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +6 -5
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +28 -27
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/content/Lightbox.js +917 -283
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/PdfPages.js +8 -3
- package/dist/browser/content/PdfPages.js.map +1 -1
- package/dist/browser/content/PdfThumbnails.js +271 -0
- package/dist/browser/content/PdfThumbnails.js.map +1 -0
- package/dist/browser/content/PdfViewer.js +11 -3
- package/dist/browser/content/PdfViewer.js.map +1 -1
- package/dist/browser/content/Timeline.js +116 -117
- package/dist/browser/content/Timeline.js.map +1 -1
- package/dist/browser/content/code-highlight.js +24 -11
- package/dist/browser/content/code-highlight.js.map +1 -1
- package/dist/browser/content/index.js +5 -1
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/lightbox-messages.js +64 -18
- package/dist/browser/content/lightbox-messages.js.map +1 -1
- package/dist/browser/content/lightbox-renderers.js +6 -0
- package/dist/browser/content/lightbox-renderers.js.map +1 -0
- package/dist/browser/content/map-view-worker.js +3 -3
- package/dist/browser/content/pdf-messages.js +16 -2
- package/dist/browser/content/pdf-messages.js.map +1 -1
- package/dist/browser/content/pdf-viewer-engine.js +15 -15
- package/dist/browser/content/pdf-viewer-worker.js +4 -5
- package/dist/browser/feedback/prompt-confirm.js +2 -0
- package/dist/browser/feedback/prompt-confirm.js.map +1 -1
- package/dist/browser/internal/truncated-title.js +9 -0
- package/dist/browser/internal/truncated-title.js.map +1 -0
- package/dist/browser/intl/messages.js +1 -1
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +3 -5
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/FloatingWindow.js +416 -122
- package/dist/browser/layout/FloatingWindow.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +3 -1
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/browser/layout/PersonPopover.js +406 -0
- package/dist/browser/layout/PersonPopover.js.map +1 -0
- package/dist/browser/layout/floating-window-geometry.js +58 -2
- package/dist/browser/layout/floating-window-geometry.js.map +1 -1
- package/dist/browser/layout/floating-window-messages.js +12 -0
- package/dist/browser/layout/floating-window-messages.js.map +1 -1
- package/dist/browser/layout/index.js +1 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/ssr/actions/CommandMenu.js +2 -2
- package/dist/ssr/actions/CommandMenu.js.map +1 -1
- package/dist/ssr/actions/SplitButton.js +5 -7
- package/dist/ssr/actions/SplitButton.js.map +1 -1
- package/dist/ssr/actions/Toolbar.js +16 -7
- package/dist/ssr/actions/Toolbar.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +6 -5
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +31 -30
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +659 -150
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/PdfPages.js +8 -3
- package/dist/ssr/content/PdfPages.js.map +1 -1
- package/dist/ssr/content/PdfThumbnails.js +189 -0
- package/dist/ssr/content/PdfThumbnails.js.map +1 -0
- package/dist/ssr/content/PdfViewer.js +11 -3
- package/dist/ssr/content/PdfViewer.js.map +1 -1
- package/dist/ssr/content/Timeline.js +2 -5
- package/dist/ssr/content/Timeline.js.map +1 -1
- package/dist/ssr/content/code-highlight.js +24 -11
- package/dist/ssr/content/code-highlight.js.map +1 -1
- package/dist/ssr/content/index.js +5 -1
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/lightbox-messages.js +64 -18
- package/dist/ssr/content/lightbox-messages.js.map +1 -1
- package/dist/ssr/content/lightbox-renderers.js +6 -0
- package/dist/ssr/content/lightbox-renderers.js.map +1 -0
- package/dist/ssr/content/pdf-messages.js +16 -2
- package/dist/ssr/content/pdf-messages.js.map +1 -1
- package/dist/ssr/feedback/prompt-confirm.js +1 -0
- package/dist/ssr/feedback/prompt-confirm.js.map +1 -1
- package/dist/ssr/inputs/ChoiceInputs.js +2 -2
- package/dist/ssr/inputs/ChoiceInputs.js.map +1 -1
- package/dist/ssr/inputs/SignatureInput.js +2 -2
- package/dist/ssr/inputs/SignatureInput.js.map +1 -1
- package/dist/ssr/inputs/markdown/SlashCommands.js +2 -2
- package/dist/ssr/inputs/markdown/SlashCommands.js.map +1 -1
- package/dist/ssr/internal/truncated-title.js +9 -0
- package/dist/ssr/internal/truncated-title.js.map +1 -0
- package/dist/ssr/intl/messages.js +1 -1
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +1 -4
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/FloatingWindow.js +286 -73
- package/dist/ssr/layout/FloatingWindow.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +1 -0
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/layout/PersonPopover.js +248 -0
- package/dist/ssr/layout/PersonPopover.js.map +1 -0
- package/dist/ssr/layout/floating-window-geometry.js +58 -2
- package/dist/ssr/layout/floating-window-geometry.js.map +1 -1
- package/dist/ssr/layout/floating-window-messages.js +12 -0
- package/dist/ssr/layout/floating-window-messages.js.map +1 -1
- package/dist/ssr/layout/index.js +1 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/SplitButton.d.ts +2 -0
- package/dist/types/actions/Toolbar.d.ts +6 -0
- package/dist/types/chat/ChatComposer.d.ts +1 -0
- package/dist/types/content/Lightbox.d.ts +54 -14
- package/dist/types/content/PdfPages.d.ts +7 -1
- package/dist/types/content/PdfThumbnails.d.ts +26 -0
- package/dist/types/content/PdfViewer.d.ts +12 -3
- package/dist/types/content/index.d.ts +4 -2
- package/dist/types/content/lightbox-messages.d.ts +31 -8
- package/dist/types/content/lightbox-renderers.d.ts +3 -0
- package/dist/types/content/pdf-messages.d.ts +7 -0
- package/dist/types/internal/truncated-title.d.ts +7 -0
- package/dist/types/layout/FloatingWindow.d.ts +29 -1
- package/dist/types/layout/PersonPopover.d.ts +70 -0
- package/dist/types/layout/floating-window-geometry.d.ts +20 -3
- package/dist/types/layout/floating-window-messages.d.ts +6 -0
- package/dist/types/layout/index.d.ts +3 -2
- package/package.json +20 -20
|
@@ -3,7 +3,7 @@ import { createComponent as _$createComponent } from "solid-js/web";
|
|
|
3
3
|
import { ssr as _$ssr } from "solid-js/web";
|
|
4
4
|
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
5
5
|
import { escape as _$escape } from "solid-js/web";
|
|
6
|
-
var _tmpl$ = ["<label class=\"k2b-dropdown__search\"><i class=\"ti ti-search\" aria-hidden=\"true\"></i><input type=\"search\" role=\"combobox\"", " aria-expanded=\"true\"", " aria-autocomplete=\"list\"", " autocomplete=\"off\" spellcheck=\"false\" enterkeyhint=\"go\"", "></label>"];
|
|
6
|
+
var _tmpl$ = ["<label class=\"k2b-dropdown__search\"><i class=\"ti ti-search\" aria-hidden=\"true\"></i><input type=\"search\" role=\"combobox\"", " aria-expanded=\"true\"", " aria-autocomplete=\"list\"", " autocomplete=\"off\" spellcheck=\"false\" enterkeyhint=\"go\"", "", "></label>"];
|
|
7
7
|
import { createEffect, createSignal, createUniqueId, on, onCleanup } from "solid-js";
|
|
8
8
|
import { replaceTextareaRange } from "../inputs/editor-dom";
|
|
9
9
|
import { CommandList, commandListKey, commandOptionId, createCommandNavigator } from "./CommandList";
|
|
@@ -138,7 +138,7 @@ function CommandMenuRoot(props) {
|
|
|
138
138
|
if (mark === "last") nav.edge("last");
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
|
-
const search = _$ssr(_tmpl$, _$ssrAttribute("aria-label", _$escape(nav.step()?.next?.label ?? props.search, true), false), _$ssrAttribute("aria-controls", _$escape(listId, true), false), _$ssrAttribute("aria-activedescendant", nav.entries()[nav.active()] && !nav.entries()[nav.active()].disabled ? _$escape(commandOptionId(listId, nav.active()), true) : _$escape(undefined, true), false), _$ssrAttribute("placeholder", _$escape(nav.step()?.next?.label ?? props.search, true), false) + _$ssrAttribute("value", _$escape(query(), true), false)
|
|
141
|
+
const search = _$ssr(_tmpl$, _$ssrAttribute("aria-label", _$escape(nav.step()?.next?.label ?? props.search, true), false), _$ssrAttribute("aria-controls", _$escape(listId, true), false), _$ssrAttribute("aria-activedescendant", nav.entries()[nav.active()] && !nav.entries()[nav.active()].disabled ? _$escape(commandOptionId(listId, nav.active()), true) : _$escape(undefined, true), false), _$ssrAttribute("placeholder", _$escape(nav.step()?.next?.label ?? props.search, true), false) + _$ssrAttribute("value", _$escape(query(), true), false), _$ssrAttribute("readonly", nav.busy(), true));
|
|
142
142
|
return _$createComponent(CommandList, {
|
|
143
143
|
navigator: nav,
|
|
144
144
|
id: listId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["actions/CommandMenu.tsx"],"sourcesContent":["import { createEffect, createSignal, createUniqueId, type JSX, on, onCleanup } from \"solid-js\";\nimport { replaceTextareaRange } from \"../inputs/editor-dom\";\nimport { CommandList, commandListKey, commandOptionId, createCommandNavigator } from \"./CommandList\";\nimport { dockCommandList, followComposer } from \"./command-dock\";\nimport { type CommandSource, commandPlace } from \"./command-items\";\nimport {\n Dropdown,\n type DropdownAnchor,\n type DropdownBody,\n type DropdownPosition,\n type DropdownReturnFocus,\n DropdownShell,\n} from \"./Dropdown\";\n\nexport type CommandMenuProps = {\n /** The same entries as `MarkdownEditor`'s `commands`, so the slash menu, a \"+\" button, and a chip offer one list. */\n items: CommandSource;\n /** Names the menu and its first list, such as \"Add to message\". */\n label: string;\n /** Names the search field and is its hint, such as \"Search commands\". A second list shows its own label there. */\n search: string;\n /**\n * The field the commands act on, such as the composer's textarea beside a \"+\" button. Its text and selection are the\n * `context` of an `onSelect`, and `context.insert` and entries with `text` write into it as typing would.\n */\n target?: HTMLTextAreaElement | HTMLInputElement;\n /**\n * The composer box the menu docks to, as the slash list does: as wide as the box, just above it, or below it when\n * there is more room there. Without it, the menu opens beside its trigger.\n */\n dock?: HTMLElement;\n /** Receives inserted text when there is no `target`, such as a snippet the host places itself. */\n onInsert?: (text: string) => void;\n /** The `CommandMenu.Trigger`; leave it out for a menu opened through `openAt` or `attach`. */\n children?: JSX.Element;\n position?: DropdownPosition;\n align?: \"start\" | \"end\";\n /** Receives `open`, which shows the menu beside `anchor` without its trigger; focus returns to `returnFocus`. */\n openAt?: (open: (anchor: DropdownAnchor, returnFocus?: DropdownReturnFocus) => void) => void;\n /** Adopts an element rendered elsewhere, such as a server-rendered chip, as the trigger. */\n attach?: () => HTMLElement | null | undefined;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n class?: string;\n};\n\n/**\n * A searchable command list beside a trigger or an anchor, with the slash menu's entries and rows: groups, icons,\n * unavailable entries with their reason, and second lists. Focus stays in the search field; Up, Down, Home, and End\n * mark, Enter and Tab choose, Escape or Backspace in an empty field go back, and Escape in the first list closes.\n */\nfunction CommandMenuRoot(props: CommandMenuProps): JSX.Element {\n const body: DropdownBody = (shell) => {\n const listId = `k2b-command-menu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, \"-\")}`;\n const [query, setQuery] = createSignal(\"\");\n let input!: HTMLInputElement;\n /** The open menu, kept while an outcome replaces the search field that finds it. */\n let menu: HTMLElement | null = null;\n /** Where the focus was when an outcome took the list's place: inside the menu, or in the target. */\n let focusInMenu = false;\n const nav = createCommandNavigator({\n items: () => props.items,\n query,\n onText: (item) => {\n // Read before closing: closing resets the list.\n const text = item.text ?? \"\";\n const target = props.target;\n shell.close(!target);\n insert(text);\n },\n context: () => {\n const target = props.target;\n const value = target?.value ?? \"\";\n const start = target?.selectionStart ?? 0;\n return {\n ...commandPlace(value, start, start),\n selection: { start, end: target?.selectionEnd ?? start },\n insert: (text: string) => insert(text),\n };\n },\n active: shell.open,\n // The focus goes back to the trigger only from inside the menu: an entry that wrote into the target, or moved\n // the focus elsewhere itself, leaves it there. An outcome keeps the menu open in the list's place: the person\n // writes on in the target, or, without one, the focus rests on the outcome until it clears.\n afterRun: (outcome) => {\n // An outcome replaces the search field before this runs, which leaves the focus on the page's body.\n const focused = document.activeElement;\n const inside = !focused || focused === document.body || Boolean(menu?.contains(focused));\n if (!outcome) return shell.close(inside);\n focusInMenu = inside && !props.target;\n if (inside && props.target) props.target.focus({ preventScroll: true });\n else if (focusInMenu)\n queueMicrotask(() => menu?.querySelector<HTMLElement>(\".k2b-command-outcome\")?.focus({ preventScroll: true }));\n },\n onStep: () => setQuery(\"\"),\n });\n /** Writes into the target at its caret, as typing would, or hands the text to `onInsert`. */\n const insert = (text: string) => {\n const target = props.target;\n if (!target) return props.onInsert?.(text);\n replaceTextareaRange(target as HTMLTextAreaElement, target.selectionStart ?? 0, target.selectionEnd ?? 0, text);\n };\n // An outcome that cleared closes the menu; the focus returns to the trigger only from inside it.\n createEffect(\n on(\n nav.outcome,\n (outcome, previous) => {\n if (menu) {\n if (outcome) menu.dataset.outcome = outcome.state;\n else delete menu.dataset.outcome;\n }\n if (!outcome && previous && shell.open()) shell.close(Boolean(menu?.contains(document.activeElement)) || focusInMenu);\n },\n { defer: true },\n ),\n );\n // Typing on in the target clears an outcome once it showed long enough; keys on the outcome itself do too. When\n // the typing opened another list for the target, such as its slash commands, the outcome gives way at once.\n createEffect(() => {\n const target = props.target;\n if (!target || !nav.outcome()) return;\n const typed = () => {\n nav.typedOn();\n queueMicrotask(() => {\n const controls = target.getAttribute(\"aria-controls\");\n if (controls && controls !== listId) nav.clearOutcome();\n });\n };\n target.addEventListener(\"input\", typed);\n onCleanup(() => target.removeEventListener(\"input\", typed));\n });\n createEffect(\n on(shell.open, (open) => {\n menu = input.closest<HTMLElement>(\".k2b-dropdown__menu\") ?? menu;\n const docked = menu;\n const dock = props.dock;\n if (open && dock && docked) {\n // A phone's keyboard moves the visible viewport, which the menu follows like the slash list.\n const follow = () => {\n if (docked.matches(\":popover-open\")) dockCommandList(docked, dock);\n };\n follow();\n const stop = followComposer(dock, follow);\n const closed = () => {\n if (!docked.matches(\":popover-open\")) {\n stop();\n docked.removeEventListener(\"toggle\", closed);\n }\n };\n docked.addEventListener(\"toggle\", closed);\n return;\n }\n if (open) {\n // The width it opened with stays its least, so filtering never narrows it.\n queueMicrotask(() => {\n if (menu?.matches(\":popover-open\")) menu.style.minWidth = `min(${menu.getBoundingClientRect().width}px, 100vw - 2rem)`;\n });\n return;\n }\n if (menu) menu.style.minWidth = \"\";\n // Closing the menu, with Escape or a press outside, stops a running command and clears its outcome.\n nav.abort();\n nav.clearOutcome();\n nav.reset();\n setQuery(\"\");\n focusInMenu = false;\n }),\n );\n shell.api({\n focus: (mark) => {\n input.focus({ preventScroll: true });\n if (mark === \"last\") nav.edge(\"last\");\n },\n });\n const search = (\n <label class=\"k2b-dropdown__search\">\n <i class=\"ti ti-search\" aria-hidden=\"true\" />\n <input\n ref={input}\n type=\"search\"\n role=\"combobox\"\n aria-label={nav.step()?.next?.label ?? props.search}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n nav.entries()[nav.active()] && !nav.entries()[nav.active()]!.disabled ? commandOptionId(listId, nav.active()) : undefined\n }\n autocomplete=\"off\"\n spellcheck={false}\n enterkeyhint=\"go\"\n placeholder={nav.step()?.next?.label ?? props.search}\n value={query()}\n // While a command runs, the list waits for it; the query keeps the running entry in view.\n readOnly={nav.busy()}\n onInput={(event) => setQuery(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (!commandListKey(nav, event, query())) return;\n // Escape that left a second list, and Tab that chose, stay inside the menu.\n event.preventDefault();\n event.stopPropagation();\n }}\n />\n </label>\n );\n return (\n <CommandList\n navigator={nav}\n id={listId}\n label={props.label}\n query={query}\n header={search}\n // After Retry or Close the focus stays where the person works: the target, or the outcome itself.\n onOutcomeAction={() => {\n if (props.target) props.target.focus({ preventScroll: true });\n else menu?.querySelector<HTMLElement>(\".k2b-command-outcome\")?.focus({ preventScroll: true });\n }}\n />\n );\n };\n\n return (\n <DropdownShell\n items={[]}\n body={body}\n label={props.label}\n menuClass=\"k2b-command-menu\"\n placeMenu={props.dock ? (menu) => dockCommandList(menu, props.dock!) : undefined}\n position={props.position}\n align={props.align}\n openAt={props.openAt}\n attach={props.attach}\n onOpenChange={props.onOpenChange}\n disabled={props.disabled}\n class={props.class}\n >\n {props.children}\n </DropdownShell>\n );\n}\n\ntype CommandMenuComponent = ((props: CommandMenuProps) => JSX.Element) & {\n Trigger: typeof Dropdown.Trigger;\n};\n\nexport const CommandMenu = CommandMenuRoot as CommandMenuComponent;\nCommandMenu.Trigger = Dropdown.Trigger;\n"],"mappings":";;;;;;AAAA,SAAS,YAAY,EAAE,YAAY,EAAE,cAAc,EAAY,EAAE,EAAE,SAAS,QAAQ,UAAU;AAC9F,SAAS,oBAAoB,QAAQ,sBAAsB;AAC3D,SAAS,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,QAAQ,eAAe;AACpG,SAAS,eAAe,EAAE,cAAc,QAAQ,gBAAgB;AAChE,SAA6B,YAAY,QAAQ,iBAAiB;AAClE,SACE,QAAQ,EAKR,aAAa,QACR,YAAY;AAkCnB;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,KAAuB,EAAe;EAC7D,MAAM,IAAkB,GAAI,KAAK,IAAK;IACpC,MAAM,MAAM,GAAG,oBAAoB,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,EAAE;IACrF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,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al, createUniqueId, type JSX, on, onCleanup } from \"solid-js\";\nimport { replaceTextareaRange } from \"../inputs/editor-dom\";\nimport { CommandList, commandListKey, commandOptionId, createCommandNavigator } from \"./CommandList\";\nimport { dockCommandList, followComposer } from \"./command-dock\";\nimport { type CommandSource, commandPlace } from \"./command-items\";\nimport {\n Dropdown,\n type DropdownAnchor,\n type DropdownBody,\n type DropdownPosition,\n type DropdownReturnFocus,\n DropdownShell,\n} from \"./Dropdown\";\n\nexport type CommandMenuProps = {\n /** The same entries as `MarkdownEditor`'s `commands`, so the slash menu, a \"+\" button, and a chip offer one list. */\n items: CommandSource;\n /** Names the menu and its first list, such as \"Add to message\". */\n label: string;\n /** Names the search field and is its hint, such as \"Search commands\". A second list shows its own label there. */\n search: string;\n /**\n * The field the commands act on, such as the composer's textarea beside a \"+\" button. Its text and selection are the\n * `context` of an `onSelect`, and `context.insert` and entries with `text` write into it as typing would.\n */\n target?: HTMLTextAreaElement | HTMLInputElement;\n /**\n * The composer box the menu docks to, as the slash list does: as wide as the box, just above it, or below it when\n * there is more room there. Without it, the menu opens beside its trigger.\n */\n dock?: HTMLElement;\n /** Receives inserted text when there is no `target`, such as a snippet the host places itself. */\n onInsert?: (text: string) => void;\n /** The `CommandMenu.Trigger`; leave it out for a menu opened through `openAt` or `attach`. */\n children?: JSX.Element;\n position?: DropdownPosition;\n align?: \"start\" | \"end\";\n /** Receives `open`, which shows the menu beside `anchor` without its trigger; focus returns to `returnFocus`. */\n openAt?: (open: (anchor: DropdownAnchor, returnFocus?: DropdownReturnFocus) => void) => void;\n /** Adopts an element rendered elsewhere, such as a server-rendered chip, as the trigger. */\n attach?: () => HTMLElement | null | undefined;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n class?: string;\n};\n\n/**\n * A searchable command list beside a trigger or an anchor, with the slash menu's entries and rows: groups, icons,\n * unavailable entries with their reason, and second lists. Focus stays in the search field; Up, Down, Home, and End\n * mark, Enter and Tab choose, Escape or Backspace in an empty field go back, and Escape in the first list closes.\n */\nfunction CommandMenuRoot(props: CommandMenuProps): JSX.Element {\n const body: DropdownBody = (shell) => {\n const listId = `k2b-command-menu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, \"-\")}`;\n const [query, setQuery] = createSignal(\"\");\n let input!: HTMLInputElement;\n /** The open menu, kept while an outcome replaces the search field that finds it. */\n let menu: HTMLElement | null = null;\n /** Where the focus was when an outcome took the list's place: inside the menu, or in the target. */\n let focusInMenu = false;\n const nav = createCommandNavigator({\n items: () => props.items,\n query,\n onText: (item) => {\n // Read before closing: closing resets the list.\n const text = item.text ?? \"\";\n const target = props.target;\n shell.close(!target);\n insert(text);\n },\n context: () => {\n const target = props.target;\n const value = target?.value ?? \"\";\n const start = target?.selectionStart ?? 0;\n return {\n ...commandPlace(value, start, start),\n selection: { start, end: target?.selectionEnd ?? start },\n insert: (text: string) => insert(text),\n };\n },\n active: shell.open,\n // The focus goes back to the trigger only from inside the menu: an entry that wrote into the target, or moved\n // the focus elsewhere itself, leaves it there. An outcome keeps the menu open in the list's place: the person\n // writes on in the target, or, without one, the focus rests on the outcome until it clears.\n afterRun: (outcome) => {\n // An outcome replaces the search field before this runs, which leaves the focus on the page's body.\n const focused = document.activeElement;\n const inside = !focused || focused === document.body || Boolean(menu?.contains(focused));\n if (!outcome) return shell.close(inside);\n focusInMenu = inside && !props.target;\n if (inside && props.target) props.target.focus({ preventScroll: true });\n else if (focusInMenu)\n queueMicrotask(() => menu?.querySelector<HTMLElement>(\".k2b-command-outcome\")?.focus({ preventScroll: true }));\n },\n onStep: () => setQuery(\"\"),\n });\n /** Writes into the target at its caret, as typing would, or hands the text to `onInsert`. */\n const insert = (text: string) => {\n const target = props.target;\n if (!target) return props.onInsert?.(text);\n replaceTextareaRange(target as HTMLTextAreaElement, target.selectionStart ?? 0, target.selectionEnd ?? 0, text);\n };\n // An outcome that cleared closes the menu; the focus returns to the trigger only from inside it.\n createEffect(\n on(\n nav.outcome,\n (outcome, previous) => {\n if (menu) {\n if (outcome) menu.dataset.outcome = outcome.state;\n else delete menu.dataset.outcome;\n }\n if (!outcome && previous && shell.open()) shell.close(Boolean(menu?.contains(document.activeElement)) || focusInMenu);\n },\n { defer: true },\n ),\n );\n // Typing on in the target clears an outcome once it showed long enough; keys on the outcome itself do too. When\n // the typing opened another list for the target, such as its slash commands, the outcome gives way at once.\n createEffect(() => {\n const target = props.target;\n if (!target || !nav.outcome()) return;\n const typed = () => {\n nav.typedOn();\n queueMicrotask(() => {\n const controls = target.getAttribute(\"aria-controls\");\n if (controls && controls !== listId) nav.clearOutcome();\n });\n };\n target.addEventListener(\"input\", typed);\n onCleanup(() => target.removeEventListener(\"input\", typed));\n });\n createEffect(\n on(shell.open, (open) => {\n menu = input.closest<HTMLElement>(\".k2b-dropdown__menu\") ?? menu;\n const docked = menu;\n const dock = props.dock;\n if (open && dock && docked) {\n // A phone's keyboard moves the visible viewport, which the menu follows like the slash list.\n const follow = () => {\n if (docked.matches(\":popover-open\")) dockCommandList(docked, dock);\n };\n follow();\n const stop = followComposer(dock, follow);\n const closed = () => {\n if (!docked.matches(\":popover-open\")) {\n stop();\n docked.removeEventListener(\"toggle\", closed);\n }\n };\n docked.addEventListener(\"toggle\", closed);\n return;\n }\n if (open) {\n // The width it opened with stays its least, so filtering never narrows it.\n queueMicrotask(() => {\n if (menu?.matches(\":popover-open\")) menu.style.minWidth = `min(${menu.getBoundingClientRect().width}px, 100vw - 2rem)`;\n });\n return;\n }\n if (menu) menu.style.minWidth = \"\";\n // Closing the menu, with Escape or a press outside, stops a running command and clears its outcome.\n nav.abort();\n nav.clearOutcome();\n nav.reset();\n setQuery(\"\");\n focusInMenu = false;\n }),\n );\n shell.api({\n focus: (mark) => {\n input.focus({ preventScroll: true });\n if (mark === \"last\") nav.edge(\"last\");\n },\n });\n const search = (\n <label class=\"k2b-dropdown__search\">\n <i class=\"ti ti-search\" aria-hidden=\"true\" />\n <input\n ref={input}\n type=\"search\"\n role=\"combobox\"\n aria-label={nav.step()?.next?.label ?? props.search}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n nav.entries()[nav.active()] && !nav.entries()[nav.active()]!.disabled ? commandOptionId(listId, nav.active()) : undefined\n }\n autocomplete=\"off\"\n spellcheck={false}\n enterkeyhint=\"go\"\n placeholder={nav.step()?.next?.label ?? props.search}\n value={query()}\n // While a command runs, the list waits for it; the query keeps the running entry in view.\n readOnly={nav.busy()}\n onInput={(event) => setQuery(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (!commandListKey(nav, event, query())) return;\n // Escape that left a second list, and Tab that chose, stay inside the menu.\n event.preventDefault();\n event.stopPropagation();\n }}\n />\n </label>\n );\n return (\n <CommandList\n navigator={nav}\n id={listId}\n label={props.label}\n query={query}\n header={search}\n // After Retry or Close the focus stays where the person works: the target, or the outcome itself.\n onOutcomeAction={() => {\n if (props.target) props.target.focus({ preventScroll: true });\n else menu?.querySelector<HTMLElement>(\".k2b-command-outcome\")?.focus({ preventScroll: true });\n }}\n />\n );\n };\n\n return (\n <DropdownShell\n items={[]}\n body={body}\n label={props.label}\n menuClass=\"k2b-command-menu\"\n placeMenu={props.dock ? (menu) => dockCommandList(menu, props.dock!) : undefined}\n position={props.position}\n align={props.align}\n openAt={props.openAt}\n attach={props.attach}\n onOpenChange={props.onOpenChange}\n disabled={props.disabled}\n class={props.class}\n >\n {props.children}\n </DropdownShell>\n );\n}\n\ntype CommandMenuComponent = ((props: CommandMenuProps) => JSX.Element) & {\n Trigger: typeof Dropdown.Trigger;\n};\n\nexport const CommandMenu = CommandMenuRoot as CommandMenuComponent;\nCommandMenu.Trigger = Dropdown.Trigger;\n"],"mappings":";;;;;;AAAA,SAAS,YAAY,EAAE,YAAY,EAAE,cAAc,EAAY,EAAE,EAAE,SAAS,QAAQ,UAAU;AAC9F,SAAS,oBAAoB,QAAQ,sBAAsB;AAC3D,SAAS,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,QAAQ,eAAe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AAY;MAAA,OAAE,KAAK,CAAC,YAAY;IAAA;IAAA,IAChC,QAAQ;MAAA,OAAE,KAAK,CAAC,QAAQ;IAAA;IAAA;MAAA,OACjB,KAAK,CAAC,KAAK;IAAA;IAAA;MAAA,OAEjB,KAAK,CAAC,QAAQ;IAAA;EAAA;AAGrB;AAMA,OAAO,MAAM,WAAW,GAAG,eAAuC;AAClE,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO","ignoreList":[]}
|
|
@@ -11,7 +11,9 @@ export function SplitButton(props) {
|
|
|
11
11
|
const [local, buttonProps] = splitProps(props, ["children", "primaryItems", "primaryMenuLabel", "menuIcon", "class", "disabled", "items", "loading", "menuLabel", "menuPosition", "menuWidth", "menuNote", "phone", "size", "variant"]);
|
|
12
12
|
const disabled = () => Boolean(local.disabled || local.loading);
|
|
13
13
|
return _$createComponent(Dropdown.Root, {
|
|
14
|
-
"class"
|
|
14
|
+
get ["class"]() {
|
|
15
|
+
return `k2b-split-button ${local.class ?? ""}`;
|
|
16
|
+
},
|
|
15
17
|
get disabled() {
|
|
16
18
|
return disabled();
|
|
17
19
|
},
|
|
@@ -40,9 +42,7 @@ export function SplitButton(props) {
|
|
|
40
42
|
},
|
|
41
43
|
get fallback() {
|
|
42
44
|
return _$createComponent(Button, _$mergeProps(buttonProps, {
|
|
43
|
-
|
|
44
|
-
return `k2b-split-button__primary ${local.class ?? ""}`;
|
|
45
|
-
},
|
|
45
|
+
"class": "k2b-split-button__primary",
|
|
46
46
|
get disabled() {
|
|
47
47
|
return local.disabled;
|
|
48
48
|
},
|
|
@@ -94,9 +94,7 @@ export function SplitButton(props) {
|
|
|
94
94
|
get label() {
|
|
95
95
|
return local.primaryMenuLabel;
|
|
96
96
|
},
|
|
97
|
-
|
|
98
|
-
return `k2b-split-button__primary ${local.class ?? ""}`;
|
|
99
|
-
},
|
|
97
|
+
"class": "k2b-split-button__primary",
|
|
100
98
|
get children() {
|
|
101
99
|
return local.children;
|
|
102
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["actions/SplitButton.tsx"],"sourcesContent":["import { type JSX, Show, splitProps } from \"solid-js\";\nimport { Button, type ButtonProps } from \"./Button\";\nimport { Dropdown, type DropdownItem, type DropdownPosition, type DropdownProps } from \"./Dropdown\";\n\nexport type SplitButtonProps = Omit<ButtonProps, \"align\"> & {\n /** Actions shown from the secondary menu trigger. */\n items: readonly DropdownItem[];\n /** Optional selection menu in place of the primary immediate action. */\n primaryItems?: readonly DropdownItem[];\n /** Accessible name for the primary selection menu. */\n primaryMenuLabel?: string;\n /** Secondary menu glyph; defaults to a chevron. */\n menuIcon?: JSX.Element;\n /** Accessible name and title for the icon-only menu trigger. */\n menuLabel: string;\n menuPosition?: DropdownPosition | (() => DropdownPosition);\n /** Exact width of both menus as a CSS length. Without it the menus size to their entries. */\n menuWidth?: string;\n /** `sheet` opens both menus as a bottom sheet on phones, as `Dropdown` does. Defaults to `menu`. */\n phone?: DropdownProps[\"phone\"];\n /** One quiet sentence below the secondary menu's entries that explains them all, as `Dropdown`'s `note`. */\n menuNote?: string;\n};\n\n/** One primary button action with a separate menu of related alternatives. */\nexport function SplitButton(props: SplitButtonProps): JSX.Element {\n const [local, buttonProps] = splitProps(props, [\n \"children\",\n \"primaryItems\",\n \"primaryMenuLabel\",\n \"menuIcon\",\n \"class\",\n \"disabled\",\n \"items\",\n \"loading\",\n \"menuLabel\",\n \"menuPosition\",\n \"menuWidth\",\n \"menuNote\",\n \"phone\",\n \"size\",\n \"variant\",\n ]);\n const disabled = () => Boolean(local.disabled || local.loading);\n\n return (\n <Dropdown.Root\n class
|
|
1
|
+
{"version":3,"names":[],"sources":["actions/SplitButton.tsx"],"sourcesContent":["import { type JSX, Show, splitProps } from \"solid-js\";\nimport { Button, type ButtonProps } from \"./Button\";\nimport { Dropdown, type DropdownItem, type DropdownPosition, type DropdownProps } from \"./Dropdown\";\n\nexport type SplitButtonProps = Omit<ButtonProps, \"align\"> & {\n /** Classes for the whole control, so host tone tokens such as `--k2b-action-solid` reach both segments. */\n class?: string;\n /** Actions shown from the secondary menu trigger. */\n items: readonly DropdownItem[];\n /** Optional selection menu in place of the primary immediate action. */\n primaryItems?: readonly DropdownItem[];\n /** Accessible name for the primary selection menu. */\n primaryMenuLabel?: string;\n /** Secondary menu glyph; defaults to a chevron. */\n menuIcon?: JSX.Element;\n /** Accessible name and title for the icon-only menu trigger. */\n menuLabel: string;\n menuPosition?: DropdownPosition | (() => DropdownPosition);\n /** Exact width of both menus as a CSS length. Without it the menus size to their entries. */\n menuWidth?: string;\n /** `sheet` opens both menus as a bottom sheet on phones, as `Dropdown` does. Defaults to `menu`. */\n phone?: DropdownProps[\"phone\"];\n /** One quiet sentence below the secondary menu's entries that explains them all, as `Dropdown`'s `note`. */\n menuNote?: string;\n};\n\n/** One primary button action with a separate menu of related alternatives. */\nexport function SplitButton(props: SplitButtonProps): JSX.Element {\n const [local, buttonProps] = splitProps(props, [\n \"children\",\n \"primaryItems\",\n \"primaryMenuLabel\",\n \"menuIcon\",\n \"class\",\n \"disabled\",\n \"items\",\n \"loading\",\n \"menuLabel\",\n \"menuPosition\",\n \"menuWidth\",\n \"menuNote\",\n \"phone\",\n \"size\",\n \"variant\",\n ]);\n const disabled = () => Boolean(local.disabled || local.loading);\n\n return (\n <Dropdown.Root\n class={`k2b-split-button ${local.class ?? \"\"}`}\n disabled={disabled()}\n items={local.items}\n label={local.menuLabel}\n note={local.menuNote}\n phone={local.phone}\n position={local.menuPosition ?? \"bottom-left\"}\n width={local.menuWidth}\n >\n <Show\n when={local.primaryItems}\n fallback={\n <Button\n {...buttonProps}\n class=\"k2b-split-button__primary\"\n disabled={local.disabled}\n loading={local.loading}\n size={local.size}\n variant={local.variant ?? \"primary\"}\n >\n {local.children}\n </Button>\n }\n >\n {(items) => (\n <Dropdown.Root\n items={items()}\n disabled={disabled()}\n class=\"k2b-split-button__primary-menu\"\n phone={local.phone}\n position={local.menuPosition ?? \"bottom-left\"}\n width={local.menuWidth}\n >\n <Dropdown.Trigger\n wrap={buttonProps.wrap}\n disabled={disabled()}\n size={local.size}\n variant={local.variant ?? \"primary\"}\n label={local.primaryMenuLabel}\n class=\"k2b-split-button__primary\"\n >\n {local.children}\n </Dropdown.Trigger>\n </Dropdown.Root>\n )}\n </Show>\n <Dropdown.Trigger\n class=\"k2b-split-button__menu-trigger\"\n disabled={disabled()}\n iconOnly\n label={local.menuLabel}\n size={local.size}\n variant={local.variant ?? \"primary\"}\n >\n {local.menuIcon ?? <i class=\"ti ti-chevron-down\" aria-hidden=\"true\" />}\n </Dropdown.Trigger>\n </Dropdown.Root>\n );\n}\n"],"mappings":";;;;;AAAA,SAAmB,IAAI,EAAE,UAAU,QAAQ,UAAU;AACrD,SAAS,MAAM,QAA0B,UAAU;AACnD,SAAS,QAAQ,QAAsE,YAAY;AAwBnG;AACA,OAAO,SAAS,WAAW,CAAC,KAAuB,EAAe;EAChE,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAC7C,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,OAAO,EACP,MAAM,EACN,SAAS,CACV,CAAC;EACF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC;EAE/D,yBACG,QAAQ,CAAC,IAAI;IAAA;MAAA,OACL,oBAAoB,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE;IAAA;IAAA,IAC9C,QAAQ;MAAA,OAAE,QAAQ,CAAC,CAAC;IAAA;IAAA,IACpB,KAAK;MAAA,OAAE,KAAK,CAAC,KAAK;IAAA;IAAA,IAClB,KAAK;MAAA,OAAE,KAAK,CAAC,SAAS;IAAA;IAAA,IACtB,IAAI;MAAA,OAAE,KAAK,CAAC,QAA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AK;gBAAA,OAAE,KAAK,CAAC,gBAAgB;cAAA;cAAA;cAAA;gBAAA,OAG5B,KAAK,CAAC,QAAQ;cAAA;YAAA;UAAA;QAAA;MAGpB,sBAEF,QAAQ,CAAC,OAAO;QAAA;QAAA,IAEf,QAAQ;UAAA,OAAE,QAAQ,CAAC,CAAC;QAAA;QACpB,QAAQ;QAAA,IACR,KAAK;UAAA,OAAE,KAAK,CAAC,SAAS;QAAA;QAAA,IACtB,IAAI;UAAA,OAAE,KAAK,CAAC,IAAI;QAAA;QAAA,IAChB,OAAO;UAAA,OAAE,KAAK,CAAC,OAAO,IAAI,SAAS;QAAA;QAAA;UAAA,OAElC,KAAK,CAAC,QAAQ,iBAAuD;QAAA;MAAA;IAAA;EAAA;AAI9E","ignoreList":[]}
|
|
@@ -253,7 +253,7 @@ const rovingFocus = (root, orientation) => {
|
|
|
253
253
|
* measuring: hiding it, even for a moment, can make the browser drop focus from it or from its open menu. An idle More
|
|
254
254
|
* stays out of the flow but keeps its box, so its width is always known.
|
|
255
255
|
*/
|
|
256
|
-
const measureOverflow = (root, more, actions, available) => {
|
|
256
|
+
const measureOverflow = (root, more, actions, available, pinned = false) => {
|
|
257
257
|
for (const element of root.querySelectorAll(`[${overflowAttribute}]`)) if (element !== more) reveal(element);
|
|
258
258
|
root.removeAttribute(compactAttribute);
|
|
259
259
|
const children = Array.from(root.children).filter(element => element instanceof HTMLElement && element !== more);
|
|
@@ -306,10 +306,11 @@ const measureOverflow = (root, more, actions, available) => {
|
|
|
306
306
|
const candidates = actions
|
|
307
307
|
// An action its application hides, even with `visibility: hidden`, must not reappear as a More row.
|
|
308
308
|
.filter(action => action.props.priority !== undefined && visible(action.element) && getComputedStyle(action.element).visibility !== "hidden").reverse().sort((a, b) => b.props.priority - a.props.priority);
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
// With rarer commands of its own, More always shows and always takes its room.
|
|
310
|
+
let movedAny = pinned;
|
|
311
|
+
tidy(pinned);
|
|
311
312
|
// Labels go before actions: a toolbar that does not fit with its labels drops them first.
|
|
312
|
-
if (used(
|
|
313
|
+
if (used(pinned) > available && root.querySelector(".k2b-toolbar__action[data-text]")) root.setAttribute(compactAttribute, "");
|
|
313
314
|
for (const action of candidates) {
|
|
314
315
|
if (used(movedAny) <= available) break;
|
|
315
316
|
hide(action.element);
|
|
@@ -346,7 +347,7 @@ export const Toolbar = Object.assign(props => {
|
|
|
346
347
|
// Cleared before measuring so the pending `visibility: hidden` does not hide every action from the check
|
|
347
348
|
// below; the whole measurement still runs before the next paint.
|
|
348
349
|
root.removeAttribute("data-overflow-pending");
|
|
349
|
-
const next = measureOverflow(root, more, ordered, available);
|
|
350
|
+
const next = measureOverflow(root, more, ordered, available, (props.moreItems?.length ?? 0) > 0);
|
|
350
351
|
setMoved(previous => previous.length === next.length && previous.every((action, index) => action === next[index]) ? previous : next);
|
|
351
352
|
navigation?.sync();
|
|
352
353
|
// Focus on an action that moved, on a menu row whose action came back, or on a More that disappeared goes to
|
|
@@ -405,7 +406,15 @@ export const Toolbar = Object.assign(props => {
|
|
|
405
406
|
mutations.disconnect();
|
|
406
407
|
});
|
|
407
408
|
});
|
|
408
|
-
|
|
409
|
+
// Actions that moved come first, in their order and in a group of their own; the host's rarer commands follow.
|
|
410
|
+
const menuItems = () => {
|
|
411
|
+
const movedItems = moved().map(action => action.item);
|
|
412
|
+
const pinnedItems = props.moreItems ?? [];
|
|
413
|
+
if (!pinnedItems.length) return movedItems;
|
|
414
|
+
return movedItems.length ? [{
|
|
415
|
+
items: movedItems
|
|
416
|
+
}, ...pinnedItems] : [...pinnedItems];
|
|
417
|
+
};
|
|
409
418
|
const content = _$createComponent(ToolbarOrientationContext.Provider, {
|
|
410
419
|
value: orientation,
|
|
411
420
|
get children() {
|
|
@@ -429,7 +438,7 @@ export const Toolbar = Object.assign(props => {
|
|
|
429
438
|
return messages().moreActions;
|
|
430
439
|
},
|
|
431
440
|
get disabled() {
|
|
432
|
-
return moved().length === 0;
|
|
441
|
+
return _$memo(() => moved().length === 0)() && !props.moreItems?.length;
|
|
433
442
|
},
|
|
434
443
|
get children() {
|
|
435
444
|
return _$createComponent(Dropdown.Trigger, {
|
|
@@ -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,EA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AAG,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,kBAAkB,QAAQ,oBAAoB;AAsEvD,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,gBAAgB,GAAG,cAAc;AACvC,MAAM,IAAI,GAAI,OAAgB,IAAK,OAAO,CAAC,YAAY,CAAC,iBAAiB,EAAE,QAAQ,CAAC;AACpF,MAAM,MAAM,GAAI,OAAgB,IAAK,OAAO,CAAC,eAAe,CAAC,iBAAiB,CAAC;;AAE/E;AACA,MAAM,YAAY,GAAG,CAAC,IAAwB,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AAQ,CAAC,CAAC,CAAC,WAAW;oBAAA;oBAAA,IAE7B,QAAQ;sBAAA,OAAE,kBAAK,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,OAAI,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM;oBAAA;oBAAA;sBAAA,yBAEzD,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":[]}
|
|
@@ -110,15 +110,16 @@ function settleViewTabs(list, edges, focused) {
|
|
|
110
110
|
* Also embedded, so it must not close over module state.
|
|
111
111
|
*
|
|
112
112
|
* A fitting strip converges by construction. It fits again only when the strip renders, web fonts finish loading, or
|
|
113
|
-
* a notification finds another width of
|
|
114
|
-
*
|
|
115
|
-
* its own width (`flex: none`), so the
|
|
113
|
+
* a notification finds another width of its room or of an entry that the last fit left shown. The room is the head
|
|
114
|
+
* lead, or outside a workspace head the strip's own root, which takes its width from its row. A fit only shows and
|
|
115
|
+
* hides entries: neither room takes width from the entries, and every entry keeps its own width (`flex: none`), so the
|
|
116
|
+
* notifications a fit causes find the widths it ended with and stop there.
|
|
116
117
|
*/
|
|
117
118
|
function watchViewTabs(list, settle, edges) {
|
|
118
119
|
if (!(list instanceof HTMLElement)) return;
|
|
119
120
|
const fits = list.hasAttribute("data-fit-room");
|
|
120
|
-
const roomOf = () => list.closest(".k2b-app-workspace__head-lead");
|
|
121
|
-
// What a fit depends on: the
|
|
121
|
+
const roomOf = () => list.closest(".k2b-app-workspace__head-lead") ?? list.closest(".k2b-view-tabs");
|
|
122
|
+
// What a fit depends on: the room's width and each shown entry's width, which fonts, icons and labels change.
|
|
122
123
|
const measured = () => [roomOf()?.clientWidth ?? -1, ...Array.from(list.children, child => child.getBoundingClientRect().width)].join(" ");
|
|
123
124
|
// A DOM property survives hydration: one observer and focus listener per reused list.
|
|
124
125
|
let watch = list.__k2bViewTabsWatch;
|