@k2b/ui 0.45.0 → 0.47.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/Dropdown.js +8 -1
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/FilterChip.js +11 -5
- package/dist/browser/actions/FilterChip.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +225 -93
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/chat/ChatDecision.js +10 -6
- package/dist/browser/chat/ChatDecision.js.map +1 -1
- package/dist/browser/content/FileGrid.js +125 -99
- package/dist/browser/content/FileGrid.js.map +1 -1
- package/dist/browser/content/VirtualFeed.js +26 -21
- package/dist/browser/content/VirtualFeed.js.map +1 -1
- package/dist/browser/inputs/Combobox.js +14 -6
- package/dist/browser/inputs/Combobox.js.map +1 -1
- package/dist/browser/inputs/choice.js +36 -9
- package/dist/browser/inputs/choice.js.map +1 -1
- package/dist/browser/layout/AnchoredPopover.js +2 -1
- package/dist/browser/layout/AnchoredPopover.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +348 -444
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/AppWorkspaceSidebarItemStatus.js +113 -0
- package/dist/browser/layout/AppWorkspaceSidebarItemStatus.js.map +1 -0
- package/dist/browser/layout/DetailPanel.js +130 -108
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/DetailSections.js +1123 -0
- package/dist/browser/layout/DetailSections.js.map +1 -0
- package/dist/browser/layout/DetailsToggle.js +32 -0
- package/dist/browser/layout/DetailsToggle.js.map +1 -0
- package/dist/browser/layout/Discussion.js +3 -0
- package/dist/browser/layout/Discussion.js.map +1 -1
- package/dist/browser/layout/MobileShell.js +141 -102
- package/dist/browser/layout/MobileShell.js.map +1 -1
- package/dist/browser/layout/PageTitle.js +33 -10
- package/dist/browser/layout/PageTitle.js.map +1 -1
- package/dist/browser/layout/app-workspace-controller.js +12 -0
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/detail-sections-messages.js +127 -0
- package/dist/browser/layout/detail-sections-messages.js.map +1 -0
- package/dist/browser/layout/index.js +3 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/surfaces/Avatar.js +3 -1
- package/dist/browser/surfaces/Avatar.js.map +1 -1
- package/dist/browser/surfaces/AvatarStack.js +95 -61
- package/dist/browser/surfaces/AvatarStack.js.map +1 -1
- package/dist/browser/surfaces/ChangeList.js +77 -0
- package/dist/browser/surfaces/ChangeList.js.map +1 -0
- package/dist/browser/surfaces/index.js +2 -1
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/browser/text-editor/TextEditor.js +19 -8
- package/dist/browser/text-editor/TextEditor.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +6 -0
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/FilterChip.js +1 -1
- package/dist/ssr/actions/FilterChip.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +144 -37
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/chat/ChatDecision.js +10 -6
- package/dist/ssr/chat/ChatDecision.js.map +1 -1
- package/dist/ssr/content/FileGrid.js +36 -22
- package/dist/ssr/content/FileGrid.js.map +1 -1
- package/dist/ssr/content/VirtualFeed.js +26 -21
- package/dist/ssr/content/VirtualFeed.js.map +1 -1
- package/dist/ssr/inputs/Combobox.js +6 -3
- package/dist/ssr/inputs/Combobox.js.map +1 -1
- package/dist/ssr/inputs/choice.js +36 -9
- package/dist/ssr/inputs/choice.js.map +1 -1
- package/dist/ssr/layout/AnchoredPopover.js +2 -1
- package/dist/ssr/layout/AnchoredPopover.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +66 -132
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/AppWorkspaceSidebarItemStatus.js +76 -0
- package/dist/ssr/layout/AppWorkspaceSidebarItemStatus.js.map +1 -0
- package/dist/ssr/layout/DetailPanel.js +18 -1
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/DetailSections.js +838 -0
- package/dist/ssr/layout/DetailSections.js.map +1 -0
- package/dist/ssr/layout/DetailsToggle.js +29 -0
- package/dist/ssr/layout/DetailsToggle.js.map +1 -0
- package/dist/ssr/layout/Discussion.js +3 -0
- package/dist/ssr/layout/Discussion.js.map +1 -1
- package/dist/ssr/layout/MobileShell.js +60 -29
- package/dist/ssr/layout/MobileShell.js.map +1 -1
- package/dist/ssr/layout/PageTitle.js +29 -6
- package/dist/ssr/layout/PageTitle.js.map +1 -1
- package/dist/ssr/layout/app-workspace-controller.js +12 -0
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/detail-sections-messages.js +127 -0
- package/dist/ssr/layout/detail-sections-messages.js.map +1 -0
- package/dist/ssr/layout/index.js +3 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/surfaces/Avatar.js +3 -1
- package/dist/ssr/surfaces/Avatar.js.map +1 -1
- package/dist/ssr/surfaces/AvatarStack.js +61 -32
- package/dist/ssr/surfaces/AvatarStack.js.map +1 -1
- package/dist/ssr/surfaces/ChangeList.js +37 -0
- package/dist/ssr/surfaces/ChangeList.js.map +1 -0
- package/dist/ssr/surfaces/index.js +2 -1
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/ssr/text-editor/TextEditor.js +19 -8
- package/dist/ssr/text-editor/TextEditor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/FilterChip.d.ts +4 -0
- package/dist/types/actions/ViewTabs.d.ts +11 -1
- package/dist/types/chat/ChatDecision.d.ts +5 -0
- package/dist/types/content/FileGrid.d.ts +6 -0
- package/dist/types/inputs/Combobox.d.ts +2 -0
- package/dist/types/inputs/choice.d.ts +9 -3
- package/dist/types/layout/AppWorkspace.d.ts +2 -28
- package/dist/types/layout/AppWorkspaceSidebarItemStatus.d.ts +30 -0
- package/dist/types/layout/DetailPanel.d.ts +9 -0
- package/dist/types/layout/DetailSections.d.ts +186 -0
- package/dist/types/layout/DetailsToggle.d.ts +13 -0
- package/dist/types/layout/MobileShell.d.ts +12 -0
- package/dist/types/layout/PageTitle.d.ts +7 -0
- package/dist/types/layout/detail-sections-messages.d.ts +61 -0
- package/dist/types/layout/index.d.ts +5 -1
- package/dist/types/surfaces/Avatar.d.ts +3 -0
- package/dist/types/surfaces/AvatarStack.d.ts +20 -1
- package/dist/types/surfaces/ChangeList.d.ts +20 -0
- package/dist/types/surfaces/index.d.ts +5 -3
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["chat/ChatDecision.tsx"],"sourcesContent":["import {\n createContext,\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n For,\n type JSX,\n on,\n onCleanup,\n onMount,\n Show,\n untrack,\n useContext,\n} from \"solid-js\";\nimport { Button } from \"../actions/Button\";\nimport { Avatar } from \"../surfaces/Avatar\";\nimport { useChatMessages } from \"./chat-messages\";\nimport type {\n ChatDecisionAnswer,\n ChatDecisionReason,\n ChatDecisionState,\n ChatOutcomeLine,\n ChatOutcomeTone,\n ChatPreviewHeaderRow,\n ChatPreviewPerson,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Decision\n// ---------------------------------------------------------------------------\n\nexport type ChatDecisionProps = {\n /** `open` shows the question; every other state shows `outcome` in its place. */\n state: ChatDecisionState;\n /** The question as one sentence, usually with `ReferenceChip`s. */\n sentence: JSX.Element;\n /** Why this question is asked, in the platform's words. */\n reason: ChatDecisionReason;\n /** The thing itself, usually `Chat.Preview`. */\n preview?: JSX.Element;\n /** The main answer, named by verb and target (\"Send to Lea\"). `danger` for deletions, `primary` for requests. */\n confirm: ChatDecisionAnswer & { variant?: \"ai\" | \"primary\" | \"danger\" };\n /** The other answer (\"Don't send\"). */\n decline: ChatDecisionAnswer;\n /** An optional quiet third answer after the buttons, such as \"Yes, and don't ask again in this chat\". */\n remember?: ChatDecisionAnswer;\n /** Turns `confirm` and `remember` off; this reason replaces `reason` in the same place. */\n unavailable?: ChatDecisionReason;\n /** The result line shown in every state but `open`, usually `Chat.Outcome`. */\n outcome?: JSX.Element;\n /** Receives a rejected promise from an answer's `onSelect`. */\n onAnswerError?: (error: unknown) => void;\n anchorId?: string | number;\n class?: string;\n};\n\n/** What an outcome inside a question needs from it: whether it was just answered here, and a link press inside it. */\nconst DecisionScope = createContext<{ answered: () => boolean; pressed: () => void; released: () => void }>();\n\nconst reasonIcon = (reason: ChatDecisionReason) => reason.icon ?? \"ti ti-info-circle\";\n\n/**\n * A question the person answers in the conversation: one sentence, why it is asked, the thing itself, and two answers.\n * An answer collapses it at once to its outcome line, which takes the focus and is announced.\n */\nexport function ChatDecision(props: ChatDecisionProps): JSX.Element {\n const id = createUniqueId();\n const sentenceId = `k2b-chat-decision-${id}-sentence`;\n const reasonId = `k2b-chat-decision-${id}-reason`;\n let root: HTMLDivElement | undefined;\n let sentence: HTMLParagraphElement | undefined;\n // An answer given here moves the focus to the outcome; a click in the outcome that reopens the question moves it\n // back to the sentence. A state change from elsewhere moves no focus.\n const [answeredHere, setAnsweredHere] = createSignal(false);\n const [arrive, setArrive] = createSignal(false);\n let reopenedHere = false;\n // A press on the sentence focuses it too; only a focus moved there from elsewhere, such as a jump, lights it up.\n // The browser also focuses the sentence again when its window comes back; that is no arrival either.\n let sentencePressed = false;\n let sentenceHeldAcrossWindow = false;\n const windowLeft = () => {\n if (sentence && document.activeElement === sentence) sentenceHeldAcrossWindow = true;\n };\n onMount(() => {\n window.addEventListener(\"blur\", windowLeft);\n onCleanup(() => window.removeEventListener(\"blur\", windowLeft));\n });\n // A press counts only while its action runs: a reopen from elsewhere later must not take the focus.\n const scope = {\n answered: answeredHere,\n pressed: () => {\n reopenedHere = true;\n },\n released: () => {\n reopenedHere = false;\n },\n };\n\n // Read once: an object literal from the host builds its JSX again on every read.\n const reason = createMemo(() => props.unavailable ?? props.reason);\n const open = () => props.state === \"open\";\n\n const answer = (choice: ChatDecisionAnswer, enabled: boolean) => {\n if (!enabled || !open() || answeredHere()) return;\n setAnsweredHere(true);\n try {\n const result = choice.onSelect();\n if (result instanceof Promise) result.catch((error: unknown) => props.onAnswerError?.(error));\n } catch (error) {\n props.onAnswerError?.(error);\n }\n // A host that keeps the question open (it could not take the answer) gets working buttons back.\n queueMicrotask(() => {\n if (open()) setAnsweredHere(false);\n });\n };\n\n createEffect(\n on(\n () => props.state,\n (state, previous) => {\n if (state !== \"open\" && previous === \"open\" && answeredHere()) {\n root?.querySelector<HTMLElement>(\".k2b-chat-outcome\")?.focus({ preventScroll: true });\n }\n if (state === \"open\" && previous !== undefined && previous !== \"open\") {\n // A host that could not take an answer given here returns the question from `sending`; the outcome that held\n // the focus is gone, so the focus goes back to the sentence instead of the page.\n const active = document.activeElement;\n const failedHere = answeredHere() && previous === \"sending\" && (!active || active === document.body);\n setAnsweredHere(false);\n if (reopenedHere || failedHere) {\n sentence?.focus({ preventScroll: true });\n setArrive(true);\n }\n // Handled. Until then the marker holds through states in between, such as `sending` while a reopen loads.\n reopenedHere = false;\n }\n },\n ),\n );\n\n return (\n <div\n ref={root}\n class={`k2b-chat-decision ${props.class ?? \"\"}`}\n data-state={props.state}\n data-chat-anchor={props.anchorId !== undefined ? String(props.anchorId) : undefined}\n >\n <Show when={open()} fallback={<DecisionScope.Provider value={scope}>{props.outcome}</DecisionScope.Provider>}>\n <section class=\"k2b-chat-decision__card\" aria-labelledby={sentenceId} aria-describedby={reasonId}>\n <p\n ref={sentence}\n id={sentenceId}\n class=\"k2b-chat-decision__sentence\"\n tabindex=\"-1\"\n data-arrive={arrive() ? \"true\" : undefined}\n onPointerDown={() => {\n sentencePressed = true;\n }}\n onPointerUp={() => {\n sentencePressed = false;\n }}\n onPointerCancel={() => {\n sentencePressed = false;\n }}\n onFocus={() => {\n if (!sentencePressed && !sentenceHeldAcrossWindow) setArrive(true);\n sentencePressed = false;\n sentenceHeldAcrossWindow = false;\n }}\n onAnimationEnd={() => setArrive(false)}\n >\n {props.sentence}\n </p>\n <p id={reasonId} class=\"k2b-chat-line k2b-chat-decision__reason\" data-tone={reason().tone ?? \"neutral\"}>\n <i class={`k2b-chat-line__icon ${reasonIcon(reason())}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">{reason().text}</span>\n </p>\n {props.preview}\n <div class=\"k2b-chat-decision__answers\">\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant={props.confirm.variant ?? \"ai\"}\n disabled={Boolean(props.unavailable)}\n onClick={() => answer(props.confirm, !props.unavailable)}\n >\n <Show when={props.confirm.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {props.confirm.label}\n </Button>\n <Button class=\"k2b-chat-decision__answer\" wrap variant=\"subtle\" onClick={() => answer(props.decline, true)}>\n <Show when={props.decline.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {props.decline.label}\n </Button>\n <Show when={props.remember}>\n {(remember) => (\n <Button\n class=\"k2b-chat-decision__remember\"\n wrap\n variant=\"text\"\n disabled={Boolean(props.unavailable)}\n onClick={() => answer(remember(), !props.unavailable)}\n >\n {remember().label}\n </Button>\n )}\n </Show>\n </div>\n </section>\n </Show>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Outcome\n// ---------------------------------------------------------------------------\n\nexport type ChatOutcomeProps = {\n /**\n * Every line one flow can show, such as running and done. All of them share one cell, so the line is as high as\n * the longest and switching between them moves nothing.\n */\n lines: Readonly<Record<string, ChatOutcomeLine>>;\n /** The key of the visible line. */\n current: string;\n /** Receives an error thrown or rejected by a line's `action`. */\n onActionError?: (error: unknown) => void;\n anchorId?: string | number;\n class?: string;\n};\n\nconst OUTCOME_ICONS: Record<ChatOutcomeTone, string> = {\n running: \"ti ti-loader-2 k2b-spin\",\n done: \"ti ti-check\",\n off: \"ti ti-circle-off\",\n waiting: \"ti ti-clock\",\n warning: \"ti ti-alert-triangle\",\n error: \"ti ti-alert-circle\",\n};\n\n/** The visible words of a line, without what screen readers do not hear. */\nconst spokenText = (element: Element): string => {\n const copy = element.cloneNode(true) as Element;\n // Buttons under the line are controls, not part of what happened.\n for (const hidden of copy.querySelectorAll('[aria-hidden=\"true\"], .k2b-chat-outcome__actions')) hidden.remove();\n // The time and the link stand apart by margin only; spoken, they need a space.\n for (const part of copy.querySelectorAll(\".k2b-chat-outcome__time, .k2b-chat-outcome__link\")) part.before(\" \");\n return (copy.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n};\n\n/**\n * One line that says what happened: running, done, off, waiting, warning, or error. Changes are announced through a\n * polite live region; the line itself can take the focus.\n */\nexport function ChatOutcome(props: ChatOutcomeProps): JSX.Element {\n const scope = useContext(DecisionScope);\n // Only a line that replaces a question just answered here fades in; history renders final.\n const entering = untrack(() => scope?.answered() ?? false);\n const [live, setLive] = createSignal(\"\");\n let root: HTMLDivElement | undefined;\n let cell: HTMLDivElement | undefined;\n let pending = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n // Read once: an object literal from the host builds its JSX again on every read.\n const lines = createMemo(() => props.lines);\n const line = () => lines()[props.current];\n const tone = () => line()?.tone ?? \"off\";\n const keys = () => {\n const all = Object.keys(lines());\n return all.includes(props.current) ? all : [props.current, ...all];\n };\n\n // Empty the region first, so the same words spoken again are a change too.\n const announce = () => {\n setLive(\"\");\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => {\n const current = cell?.querySelector('[data-current=\"true\"]');\n setLive(current ? spokenText(current) : \"\");\n }, 40);\n };\n\n onMount(() => {\n if (untrack(() => scope?.answered())) announce();\n });\n createEffect(\n on(\n () => props.current,\n () => {\n // A link pressed in a line that is now hidden would leave the focus on an invisible button, which the browser\n // then drops to the page. The line itself keeps it instead.\n const active = document.activeElement;\n const hidden = active && cell?.contains(active) && !active.closest('[data-current=\"true\"]');\n if (hidden || (pending && active === document.body)) root?.focus({ preventScroll: true });\n announce();\n },\n { defer: true },\n ),\n );\n onCleanup(() => {\n if (timer) clearTimeout(timer);\n });\n\n return (\n <div\n ref={root}\n class={`k2b-chat-outcome ${props.class ?? \"\"}`}\n data-tone={tone()}\n data-chat-anchor={props.anchorId !== undefined ? String(props.anchorId) : undefined}\n data-enter={entering ? \"true\" : undefined}\n tabindex=\"-1\"\n >\n <span class=\"k2b-chat-outcome__icon\" aria-hidden=\"true\">\n <i class={line()?.icon ?? OUTCOME_ICONS[tone()]} />\n </span>\n {/* Busy is set on the words only: a live region inside a busy subtree would be held back. */}\n <div ref={cell} class=\"k2b-chat-outcome__cell\" aria-busy={tone() === \"running\" ? \"true\" : undefined}>\n <For each={keys()}>\n {(key) => {\n const entry = () => lines()[key];\n const current = () => key === props.current;\n return (\n <Show when={entry()}>\n {(item) => (\n <div\n class=\"k2b-chat-outcome__text\"\n data-current={current() ? \"true\" : undefined}\n aria-hidden={current() ? undefined : \"true\"}\n >\n {item().text}\n <Show when={item().detail}>\n {(detail) => (\n <>\n {\" \"}\n <span class=\"k2b-chat-outcome__detail\">{detail()}</span>\n </>\n )}\n </Show>\n <Show when={item().time}>{(time) => <span class=\"k2b-chat-outcome__time\">{time()}</span>}</Show>\n <Show when={item().action}>\n {(action) => (\n <Button\n class=\"k2b-chat-outcome__link\"\n wrap\n variant=\"text\"\n tabIndex={current() ? undefined : -1}\n onClick={() => {\n // A second press while the first is still running would repeat its work.\n if (pending) return;\n scope?.pressed();\n try {\n const result = action().onSelect();\n if (result instanceof Promise) {\n pending = true;\n result\n .catch((error: unknown) => props.onActionError?.(error))\n .finally(() => {\n pending = false;\n scope?.released();\n });\n return;\n }\n } catch (error) {\n props.onActionError?.(error);\n }\n scope?.released();\n }}\n >\n {action().label}\n </Button>\n )}\n </Show>\n {/* Every line keeps its buttons, hidden with its text, so the cell also reserves their row. */}\n <Show when={item().actions}>{(actions) => <div class=\"k2b-chat-outcome__actions\">{actions()}</div>}</Show>\n </div>\n )}\n </Show>\n );\n }}\n </For>\n </div>\n <span class=\"k2b-sr-only\" role=\"status\" aria-live=\"polite\">\n {live()}\n </span>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Preview\n// ---------------------------------------------------------------------------\n\nexport type ChatPreviewProps = { children: JSX.Element; class?: string };\n\n/** The thing a question is about, as calm text on the sentence's edge: no surface, no column. */\nfunction ChatPreviewRoot(props: ChatPreviewProps): JSX.Element {\n return <div class={`k2b-chat-preview ${props.class ?? \"\"}`}>{props.children}</div>;\n}\n\nexport type ChatPreviewHeaderProps = {\n /** One row per field, such as From, To, Cc, and Bcc; the label stands right before its value. */\n rows: readonly ChatPreviewHeaderRow[];\n /** A last line, such as when the message goes out. */\n note?: JSX.Element;\n};\n\nconst PreviewPeople = (props: { people: readonly ChatPreviewPerson[] }) => (\n <For each={props.people}>\n {(person, index) => (\n <>\n {index() > 0 ? \", \" : \"\"}\n <span class=\"k2b-chat-preview__person\">\n <Show when={person.name}>{(name) => <b>{name()}</b>}</Show>\n <Show when={person.address}>\n {(address) => (\n <span class=\"k2b-chat-preview__address\" data-alone={person.name ? undefined : \"true\"}>\n {address()}\n </span>\n )}\n </Show>\n </span>\n </>\n )}\n </For>\n);\n\nfunction ChatPreviewHeader(props: ChatPreviewHeaderProps): JSX.Element {\n return (\n <div class=\"k2b-chat-preview__header\">\n <dl>\n <For each={props.rows}>\n {(row) => (\n <div data-emphasis={row.emphasis ? \"true\" : undefined}>\n <dt>{row.label}</dt>\n <dd>\n <Show when={row.people}>{(people) => <PreviewPeople people={people()} />}</Show>\n {row.value}\n </dd>\n </div>\n )}\n </For>\n </dl>\n <Show when={props.note}>{(note) => <p>{note()}</p>}</Show>\n </div>\n );\n}\n\nexport type ChatPreviewTitleProps = { children: JSX.Element; meta?: JSX.Element };\n\n/** The thing's name in the text's own face, with optional quiet facts after it. */\nfunction ChatPreviewTitle(props: ChatPreviewTitleProps): JSX.Element {\n return (\n <p class=\"k2b-chat-preview__title-line\">\n <span class=\"k2b-chat-preview__title\">{props.children}</span>\n <Show when={props.meta}>\n {(meta) => (\n <>\n {\" \"}\n <span class=\"k2b-chat-preview__meta\">{meta()}</span>\n </>\n )}\n </Show>\n </p>\n );\n}\n\n/** A rule or instruction as one sentence, such as what a routine does; chips and marks may stand inside. */\nfunction ChatPreviewSentence(props: { children: JSX.Element }): JSX.Element {\n return <p class=\"k2b-chat-preview__sentence\">{props.children}</p>;\n}\n\nexport type ChatPreviewExcerptProps = {\n children: JSX.Element;\n /** Shows the whole text in place instead of the first lines, such as after `Chat.Preview.ShowAll`. */\n expanded?: boolean;\n id?: string;\n};\n\n/** The first lines of a longer text. It keeps its line breaks, shows about three lines, and fades out. */\nfunction ChatPreviewExcerpt(props: ChatPreviewExcerptProps): JSX.Element {\n return (\n <p\n class=\"k2b-chat-preview__excerpt\"\n id={props.id}\n data-expanded={props.expanded ? \"true\" : undefined}\n tabindex={props.expanded ? -1 : undefined}\n >\n {props.children}\n </p>\n );\n}\n\nexport type ChatPreviewShowAllProps = {\n /** The id of the `Chat.Preview.Excerpt` this button opens. */\n controls: string;\n onShow: () => void;\n children: JSX.Element;\n};\n\n/**\n * Shows the rest of an excerpt in place, for a text with no page of its own to open. It looks like `ReadMore`; the\n * caller removes it once the text is shown, and the focus moves to the text, so reading goes on where it was.\n */\nfunction ChatPreviewShowAll(props: ChatPreviewShowAllProps): JSX.Element {\n const show = () => {\n props.onShow();\n queueMicrotask(() => document.getElementById(props.controls)?.focus({ preventScroll: true }));\n };\n return (\n <button type=\"button\" class=\"k2b-chat-preview__more\" aria-controls={props.controls} aria-expanded=\"false\" onClick={show}>\n {props.children}\n </button>\n );\n}\n\nexport type ChatPreviewReadMoreProps = {\n href: string;\n children: JSX.Element;\n /** Tooltip, such as \"Opens exactly this version of the draft\". */\n title?: string;\n};\n\n/** Opens the whole thing at exactly the version the question shows. */\nfunction ChatPreviewReadMore(props: ChatPreviewReadMoreProps): JSX.Element {\n return (\n <a class=\"k2b-chat-preview__more\" href={props.href} title={props.title}>\n {props.children}\n </a>\n );\n}\n\nconst InList = createContext(false);\n\n/** A list of lines with a name, such as \"What the routine may do\". */\nfunction ChatPreviewLines(props: { label?: string; children: JSX.Element }): JSX.Element {\n return (\n <ul class=\"k2b-chat-preview__lines\" aria-label={props.label}>\n <InList.Provider value={true}>{props.children}</InList.Provider>\n </ul>\n );\n}\n\nexport type ChatPreviewLineProps = {\n /** Icon class; the text after it starts 1.5rem from the edge. */\n icon: string;\n /** Icon colour, such as the PDF colour of an attachment. */\n accent?: string;\n /** `muted` for limits and notes, `warning` for an application's own warning. */\n tone?: \"default\" | \"muted\" | \"warning\";\n /** Marks the whole line as new or removed. */\n mark?: \"added\" | \"removed\";\n /** Quiet facts after the text, such as a file size. */\n meta?: JSX.Element;\n children: JSX.Element;\n};\n\n/** One line led by an icon: a consequence, a right, an attachment, or a warning. */\nfunction ChatPreviewLine(props: ChatPreviewLineProps): JSX.Element {\n const inList = useContext(InList);\n const messages = useChatMessages();\n const content = () => (\n <>\n <i class={`k2b-chat-line__icon ${props.icon}`} style={props.accent ? { color: props.accent } : undefined} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">\n {/* One stable wrapper, so marking a line later never moves its mounted children. */}\n <span class=\"k2b-chat-mark\" data-change={props.mark}>\n <Show when={props.mark}>\n {(mark) => <span class=\"k2b-sr-only\">{mark() === \"added\" ? messages().markAdded : messages().markRemoved} </span>}\n </Show>\n {props.children}\n </span>\n <Show when={props.meta}>\n {(meta) => (\n <>\n {\" \"}\n <span class=\"k2b-chat-preview__meta\">{meta()}</span>\n </>\n )}\n </Show>\n </span>\n </>\n );\n const attributes = () => ({\n class: \"k2b-chat-line k2b-chat-preview__line\",\n \"data-tone\": props.tone && props.tone !== \"default\" ? props.tone : undefined,\n });\n return inList ? <li {...attributes()}>{content()}</li> : <p {...attributes()}>{content()}</p>;\n}\n\nexport type ChatPreviewPeopleProps = {\n /** The first few people; their avatars overlap at the start of the line. */\n people: readonly { name: string; src?: string | null }[];\n /** The names as text, such as \"Lea Berg, Tom Weber and 3 others\". */\n children: JSX.Element;\n};\n\nfunction ChatPreviewPeople(props: ChatPreviewPeopleProps): JSX.Element {\n return (\n <p class=\"k2b-chat-preview__people\">\n <span class=\"k2b-chat-preview__faces\" aria-hidden=\"true\">\n <For each={props.people}>{(person) => <Avatar name={person.name} src={person.src} size=\"xs\" />}</For>\n </span>\n <span>{props.children}</span>\n </p>\n );\n}\n\nexport const ChatPreview = Object.assign(ChatPreviewRoot, {\n Header: ChatPreviewHeader,\n Title: ChatPreviewTitle,\n Sentence: ChatPreviewSentence,\n Excerpt: ChatPreviewExcerpt,\n ReadMore: ChatPreviewReadMore,\n ShowAll: ChatPreviewShowAll,\n Lines: ChatPreviewLines,\n Line: ChatPreviewLine,\n People: ChatPreviewPeople,\n});\n\n// ---------------------------------------------------------------------------\n// Mark\n// ---------------------------------------------------------------------------\n\nexport type ChatMarkProps = { change: \"added\" | \"removed\"; children: JSX.Element };\n\n/** Marks new or removed words; screen readers hear \"new:\" or \"removed:\" first. */\nexport function ChatMark(props: ChatMarkProps): JSX.Element {\n const messages = useChatMessages();\n return (\n <Show\n when={props.change === \"removed\"}\n fallback={\n <mark class=\"k2b-chat-mark\" data-change=\"added\">\n <span class=\"k2b-sr-only\">{messages().markAdded} </span>\n {props.children}\n </mark>\n }\n >\n <del class=\"k2b-chat-mark\" data-change=\"removed\">\n <span class=\"k2b-sr-only\">{messages().markRemoved} </span>\n {props.children}\n </del>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SACE,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,GAAG,EAEH,EAAE,EACF,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,EACP,UAAU,QACL,UAAU;AACjB,SAAS,MAAM,QAAQ,mBAAmB;AAC1C,SAAS,MAAM,QAAQ,oBAAoB;AAC3C,SAAS,eAAe,QAAQ,iBAAiB;;AAWjD;AACA;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C,IAAI;UAAA,OAAE,MAAM,CAAC,IAAI;QAAA;QAAA,IAAE,GAAG;UAAA,OAAE,MAAM,CAAC,GAAG;QAAA;QAAE,IAAI;MAAA;IAAQ;IAAA,uBAEzF,KAAK,CAAC,QAAQ;IAAA;EAAA;AAG3B;AAEA,OAAO,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;EACxD,MAAM,EAAE,iBAAiB;EACzB,KAAK,EAAE,gBAAgB;EACvB,QAAQ,EAAE,mBAAmB;EAC7B,OAAO,EAAE,kBAAkB;EAC3B,QAAQ,EAAE,mBAAmB;EAC7B,OAAO,EAAE,kBAAkB;EAC3B,KAAK,EAAE,gBAAgB;EACvB,IAAI,EAAE,eAAe;EACrB,MAAM,EAAE;AACV,CAAC,CAAC;;AAEF;AACA;AACA;;AAIA;AACA,OAAO,SAAS,QAAQ,CAAC,KAAoB,EAAe;EAC1D,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC;EAClC,yBACG,IAAI;IAAA,IACH,IAAI;MAAA,OAAE,KAAK,CAAC,MAAM,KAAK,SAAS;IAAA;IAAA,IAChC,QAAQ;MAAA;QAAA;UAAA;UAAA;UAAA;UAAA;UAAA;UAAA;QAAA,uBAEuB,QAAQ,CAAC,CAAC,CAAC,SAAS;QAAA,uBAC9C,KAAK,CAAC,QAAQ;QAAA;MAAA;IAAA;IAAA;MAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;MAAA,uBAKU,QAAQ,CAAC,CAAC,CAAC,WAAW;MAAA,uBAChD,KAAK,CAAC,QAAQ;MAAA;IAAA;EAAA;AAIvB;AAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["chat/ChatDecision.tsx"],"sourcesContent":["import {\n createContext,\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n For,\n type JSX,\n on,\n onCleanup,\n onMount,\n Show,\n untrack,\n useContext,\n} from \"solid-js\";\nimport { Button } from \"../actions/Button\";\nimport { Avatar } from \"../surfaces/Avatar\";\nimport { useChatMessages } from \"./chat-messages\";\nimport type {\n ChatDecisionAnswer,\n ChatDecisionReason,\n ChatDecisionState,\n ChatOutcomeLine,\n ChatOutcomeTone,\n ChatPreviewHeaderRow,\n ChatPreviewPerson,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Decision\n// ---------------------------------------------------------------------------\n\nexport type ChatDecisionProps = {\n /** `open` shows the question; every other state shows `outcome` in its place. */\n state: ChatDecisionState;\n /** The question as one sentence, usually with `ReferenceChip`s. */\n sentence: JSX.Element;\n /** Why this question is asked, in the platform's words. */\n reason: ChatDecisionReason;\n /** The thing itself, usually `Chat.Preview`. */\n preview?: JSX.Element;\n /** The main answer, named by verb and target (\"Send to Lea\"). `danger` for deletions, `primary` for requests. */\n confirm: ChatDecisionAnswer & { variant?: \"ai\" | \"primary\" | \"danger\" };\n /** The other answer (\"Don't send\"). */\n decline: ChatDecisionAnswer;\n /** An optional quiet third answer after the buttons, such as \"Yes, and don't ask again in this chat\". */\n remember?: ChatDecisionAnswer;\n /** Turns `confirm` and `remember` off; this reason replaces `reason` in the same place. */\n unavailable?: ChatDecisionReason;\n /**\n * Turns every answer off until the reason clears, such as no connection, so no answer is lost on the way; this\n * reason replaces `reason` and `unavailable` in the same place.\n */\n waiting?: ChatDecisionReason;\n /** The result line shown in every state but `open`, usually `Chat.Outcome`. */\n outcome?: JSX.Element;\n /** Receives a rejected promise from an answer's `onSelect`. */\n onAnswerError?: (error: unknown) => void;\n anchorId?: string | number;\n class?: string;\n};\n\n/** What an outcome inside a question needs from it: whether it was just answered here, and a link press inside it. */\nconst DecisionScope = createContext<{ answered: () => boolean; pressed: () => void; released: () => void }>();\n\nconst reasonIcon = (reason: ChatDecisionReason) => reason.icon ?? \"ti ti-info-circle\";\n\n/**\n * A question the person answers in the conversation: one sentence, why it is asked, the thing itself, and two answers.\n * An answer collapses it at once to its outcome line, which takes the focus and is announced.\n */\nexport function ChatDecision(props: ChatDecisionProps): JSX.Element {\n const id = createUniqueId();\n const sentenceId = `k2b-chat-decision-${id}-sentence`;\n const reasonId = `k2b-chat-decision-${id}-reason`;\n let root: HTMLDivElement | undefined;\n let sentence: HTMLParagraphElement | undefined;\n // An answer given here moves the focus to the outcome; a click in the outcome that reopens the question moves it\n // back to the sentence. A state change from elsewhere moves no focus.\n const [answeredHere, setAnsweredHere] = createSignal(false);\n const [arrive, setArrive] = createSignal(false);\n let reopenedHere = false;\n // A press on the sentence focuses it too; only a focus moved there from elsewhere, such as a jump, lights it up.\n // The browser also focuses the sentence again when its window comes back; that is no arrival either.\n let sentencePressed = false;\n let sentenceHeldAcrossWindow = false;\n const windowLeft = () => {\n if (sentence && document.activeElement === sentence) sentenceHeldAcrossWindow = true;\n };\n onMount(() => {\n window.addEventListener(\"blur\", windowLeft);\n onCleanup(() => window.removeEventListener(\"blur\", windowLeft));\n });\n // A press counts only while its action runs: a reopen from elsewhere later must not take the focus.\n const scope = {\n answered: answeredHere,\n pressed: () => {\n reopenedHere = true;\n },\n released: () => {\n reopenedHere = false;\n },\n };\n\n // Read once: an object literal from the host builds its JSX again on every read.\n const reason = createMemo(() => props.waiting ?? props.unavailable ?? props.reason);\n const confirmOff = () => Boolean(props.waiting ?? props.unavailable);\n const open = () => props.state === \"open\";\n\n const answer = (choice: ChatDecisionAnswer, enabled: boolean) => {\n if (!enabled || !open() || answeredHere()) return;\n setAnsweredHere(true);\n try {\n const result = choice.onSelect();\n if (result instanceof Promise) result.catch((error: unknown) => props.onAnswerError?.(error));\n } catch (error) {\n props.onAnswerError?.(error);\n }\n // A host that keeps the question open (it could not take the answer) gets working buttons back.\n queueMicrotask(() => {\n if (open()) setAnsweredHere(false);\n });\n };\n\n createEffect(\n on(\n () => props.state,\n (state, previous) => {\n if (state !== \"open\" && previous === \"open\" && answeredHere()) {\n root?.querySelector<HTMLElement>(\".k2b-chat-outcome\")?.focus({ preventScroll: true });\n }\n if (state === \"open\" && previous !== undefined && previous !== \"open\") {\n // A host that could not take an answer given here returns the question from `sending`; the outcome that held\n // the focus is gone, so the focus goes back to the sentence instead of the page.\n const active = document.activeElement;\n const failedHere = answeredHere() && previous === \"sending\" && (!active || active === document.body);\n setAnsweredHere(false);\n if (reopenedHere || failedHere) {\n sentence?.focus({ preventScroll: true });\n setArrive(true);\n }\n // Handled. Until then the marker holds through states in between, such as `sending` while a reopen loads.\n reopenedHere = false;\n }\n },\n ),\n );\n\n return (\n <div\n ref={root}\n class={`k2b-chat-decision ${props.class ?? \"\"}`}\n data-state={props.state}\n data-chat-anchor={props.anchorId !== undefined ? String(props.anchorId) : undefined}\n >\n <Show when={open()} fallback={<DecisionScope.Provider value={scope}>{props.outcome}</DecisionScope.Provider>}>\n <section class=\"k2b-chat-decision__card\" aria-labelledby={sentenceId} aria-describedby={reasonId}>\n <p\n ref={sentence}\n id={sentenceId}\n class=\"k2b-chat-decision__sentence\"\n tabindex=\"-1\"\n data-arrive={arrive() ? \"true\" : undefined}\n onPointerDown={() => {\n sentencePressed = true;\n }}\n onPointerUp={() => {\n sentencePressed = false;\n }}\n onPointerCancel={() => {\n sentencePressed = false;\n }}\n onFocus={() => {\n if (!sentencePressed && !sentenceHeldAcrossWindow) setArrive(true);\n sentencePressed = false;\n sentenceHeldAcrossWindow = false;\n }}\n onAnimationEnd={() => setArrive(false)}\n >\n {props.sentence}\n </p>\n <p id={reasonId} class=\"k2b-chat-line k2b-chat-decision__reason\" data-tone={reason().tone ?? \"neutral\"}>\n <i class={`k2b-chat-line__icon ${reasonIcon(reason())}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">{reason().text}</span>\n </p>\n {props.preview}\n <div class=\"k2b-chat-decision__answers\">\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant={props.confirm.variant ?? \"ai\"}\n disabled={confirmOff()}\n onClick={() => answer(props.confirm, !confirmOff())}\n >\n <Show when={props.confirm.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {props.confirm.label}\n </Button>\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant=\"subtle\"\n disabled={Boolean(props.waiting)}\n onClick={() => answer(props.decline, !props.waiting)}\n >\n <Show when={props.decline.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {props.decline.label}\n </Button>\n <Show when={props.remember}>\n {(remember) => (\n <Button\n class=\"k2b-chat-decision__remember\"\n wrap\n variant=\"text\"\n disabled={confirmOff()}\n onClick={() => answer(remember(), !confirmOff())}\n >\n {remember().label}\n </Button>\n )}\n </Show>\n </div>\n </section>\n </Show>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Outcome\n// ---------------------------------------------------------------------------\n\nexport type ChatOutcomeProps = {\n /**\n * Every line one flow can show, such as running and done. All of them share one cell, so the line is as high as\n * the longest and switching between them moves nothing.\n */\n lines: Readonly<Record<string, ChatOutcomeLine>>;\n /** The key of the visible line. */\n current: string;\n /** Receives an error thrown or rejected by a line's `action`. */\n onActionError?: (error: unknown) => void;\n anchorId?: string | number;\n class?: string;\n};\n\nconst OUTCOME_ICONS: Record<ChatOutcomeTone, string> = {\n running: \"ti ti-loader-2 k2b-spin\",\n done: \"ti ti-check\",\n off: \"ti ti-circle-off\",\n waiting: \"ti ti-clock\",\n warning: \"ti ti-alert-triangle\",\n error: \"ti ti-alert-circle\",\n};\n\n/** The visible words of a line, without what screen readers do not hear. */\nconst spokenText = (element: Element): string => {\n const copy = element.cloneNode(true) as Element;\n // Buttons under the line are controls, not part of what happened.\n for (const hidden of copy.querySelectorAll('[aria-hidden=\"true\"], .k2b-chat-outcome__actions')) hidden.remove();\n // The time and the link stand apart by margin only; spoken, they need a space.\n for (const part of copy.querySelectorAll(\".k2b-chat-outcome__time, .k2b-chat-outcome__link\")) part.before(\" \");\n return (copy.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n};\n\n/**\n * One line that says what happened: running, done, off, waiting, warning, or error. Changes are announced through a\n * polite live region; the line itself can take the focus.\n */\nexport function ChatOutcome(props: ChatOutcomeProps): JSX.Element {\n const scope = useContext(DecisionScope);\n // Only a line that replaces a question just answered here fades in; history renders final.\n const entering = untrack(() => scope?.answered() ?? false);\n const [live, setLive] = createSignal(\"\");\n let root: HTMLDivElement | undefined;\n let cell: HTMLDivElement | undefined;\n let pending = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n // Read once: an object literal from the host builds its JSX again on every read.\n const lines = createMemo(() => props.lines);\n const line = () => lines()[props.current];\n const tone = () => line()?.tone ?? \"off\";\n const keys = () => {\n const all = Object.keys(lines());\n return all.includes(props.current) ? all : [props.current, ...all];\n };\n\n // Empty the region first, so the same words spoken again are a change too.\n const announce = () => {\n setLive(\"\");\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => {\n const current = cell?.querySelector('[data-current=\"true\"]');\n setLive(current ? spokenText(current) : \"\");\n }, 40);\n };\n\n onMount(() => {\n if (untrack(() => scope?.answered())) announce();\n });\n createEffect(\n on(\n () => props.current,\n () => {\n // A link pressed in a line that is now hidden would leave the focus on an invisible button, which the browser\n // then drops to the page. The line itself keeps it instead.\n const active = document.activeElement;\n const hidden = active && cell?.contains(active) && !active.closest('[data-current=\"true\"]');\n if (hidden || (pending && active === document.body)) root?.focus({ preventScroll: true });\n announce();\n },\n { defer: true },\n ),\n );\n onCleanup(() => {\n if (timer) clearTimeout(timer);\n });\n\n return (\n <div\n ref={root}\n class={`k2b-chat-outcome ${props.class ?? \"\"}`}\n data-tone={tone()}\n data-chat-anchor={props.anchorId !== undefined ? String(props.anchorId) : undefined}\n data-enter={entering ? \"true\" : undefined}\n tabindex=\"-1\"\n >\n <span class=\"k2b-chat-outcome__icon\" aria-hidden=\"true\">\n <i class={line()?.icon ?? OUTCOME_ICONS[tone()]} />\n </span>\n {/* Busy is set on the words only: a live region inside a busy subtree would be held back. */}\n <div ref={cell} class=\"k2b-chat-outcome__cell\" aria-busy={tone() === \"running\" ? \"true\" : undefined}>\n <For each={keys()}>\n {(key) => {\n const entry = () => lines()[key];\n const current = () => key === props.current;\n return (\n <Show when={entry()}>\n {(item) => (\n <div\n class=\"k2b-chat-outcome__text\"\n data-current={current() ? \"true\" : undefined}\n aria-hidden={current() ? undefined : \"true\"}\n >\n {item().text}\n <Show when={item().detail}>\n {(detail) => (\n <>\n {\" \"}\n <span class=\"k2b-chat-outcome__detail\">{detail()}</span>\n </>\n )}\n </Show>\n <Show when={item().time}>{(time) => <span class=\"k2b-chat-outcome__time\">{time()}</span>}</Show>\n <Show when={item().action}>\n {(action) => (\n <Button\n class=\"k2b-chat-outcome__link\"\n wrap\n variant=\"text\"\n tabIndex={current() ? undefined : -1}\n onClick={() => {\n // A second press while the first is still running would repeat its work.\n if (pending) return;\n scope?.pressed();\n try {\n const result = action().onSelect();\n if (result instanceof Promise) {\n pending = true;\n result\n .catch((error: unknown) => props.onActionError?.(error))\n .finally(() => {\n pending = false;\n scope?.released();\n });\n return;\n }\n } catch (error) {\n props.onActionError?.(error);\n }\n scope?.released();\n }}\n >\n {action().label}\n </Button>\n )}\n </Show>\n {/* Every line keeps its buttons, hidden with its text, so the cell also reserves their row. */}\n <Show when={item().actions}>{(actions) => <div class=\"k2b-chat-outcome__actions\">{actions()}</div>}</Show>\n </div>\n )}\n </Show>\n );\n }}\n </For>\n </div>\n <span class=\"k2b-sr-only\" role=\"status\" aria-live=\"polite\">\n {live()}\n </span>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Preview\n// ---------------------------------------------------------------------------\n\nexport type ChatPreviewProps = { children: JSX.Element; class?: string };\n\n/** The thing a question is about, as calm text on the sentence's edge: no surface, no column. */\nfunction ChatPreviewRoot(props: ChatPreviewProps): JSX.Element {\n return <div class={`k2b-chat-preview ${props.class ?? \"\"}`}>{props.children}</div>;\n}\n\nexport type ChatPreviewHeaderProps = {\n /** One row per field, such as From, To, Cc, and Bcc; the label stands right before its value. */\n rows: readonly ChatPreviewHeaderRow[];\n /** A last line, such as when the message goes out. */\n note?: JSX.Element;\n};\n\nconst PreviewPeople = (props: { people: readonly ChatPreviewPerson[] }) => (\n <For each={props.people}>\n {(person, index) => (\n <>\n {index() > 0 ? \", \" : \"\"}\n <span class=\"k2b-chat-preview__person\">\n <Show when={person.name}>{(name) => <b>{name()}</b>}</Show>\n <Show when={person.address}>\n {(address) => (\n <span class=\"k2b-chat-preview__address\" data-alone={person.name ? undefined : \"true\"}>\n {address()}\n </span>\n )}\n </Show>\n </span>\n </>\n )}\n </For>\n);\n\nfunction ChatPreviewHeader(props: ChatPreviewHeaderProps): JSX.Element {\n return (\n <div class=\"k2b-chat-preview__header\">\n <dl>\n <For each={props.rows}>\n {(row) => (\n <div data-emphasis={row.emphasis ? \"true\" : undefined}>\n <dt>{row.label}</dt>\n <dd>\n <Show when={row.people}>{(people) => <PreviewPeople people={people()} />}</Show>\n {row.value}\n </dd>\n </div>\n )}\n </For>\n </dl>\n <Show when={props.note}>{(note) => <p>{note()}</p>}</Show>\n </div>\n );\n}\n\nexport type ChatPreviewTitleProps = { children: JSX.Element; meta?: JSX.Element };\n\n/** The thing's name in the text's own face, with optional quiet facts after it. */\nfunction ChatPreviewTitle(props: ChatPreviewTitleProps): JSX.Element {\n return (\n <p class=\"k2b-chat-preview__title-line\">\n <span class=\"k2b-chat-preview__title\">{props.children}</span>\n <Show when={props.meta}>\n {(meta) => (\n <>\n {\" \"}\n <span class=\"k2b-chat-preview__meta\">{meta()}</span>\n </>\n )}\n </Show>\n </p>\n );\n}\n\n/** A rule or instruction as one sentence, such as what a routine does; chips and marks may stand inside. */\nfunction ChatPreviewSentence(props: { children: JSX.Element }): JSX.Element {\n return <p class=\"k2b-chat-preview__sentence\">{props.children}</p>;\n}\n\nexport type ChatPreviewExcerptProps = {\n children: JSX.Element;\n /** Shows the whole text in place instead of the first lines, such as after `Chat.Preview.ShowAll`. */\n expanded?: boolean;\n id?: string;\n};\n\n/** The first lines of a longer text. It keeps its line breaks, shows about three lines, and fades out. */\nfunction ChatPreviewExcerpt(props: ChatPreviewExcerptProps): JSX.Element {\n return (\n <p\n class=\"k2b-chat-preview__excerpt\"\n id={props.id}\n data-expanded={props.expanded ? \"true\" : undefined}\n tabindex={props.expanded ? -1 : undefined}\n >\n {props.children}\n </p>\n );\n}\n\nexport type ChatPreviewShowAllProps = {\n /** The id of the `Chat.Preview.Excerpt` this button opens. */\n controls: string;\n onShow: () => void;\n children: JSX.Element;\n};\n\n/**\n * Shows the rest of an excerpt in place, for a text with no page of its own to open. It looks like `ReadMore`; the\n * caller removes it once the text is shown, and the focus moves to the text, so reading goes on where it was.\n */\nfunction ChatPreviewShowAll(props: ChatPreviewShowAllProps): JSX.Element {\n const show = () => {\n props.onShow();\n queueMicrotask(() => document.getElementById(props.controls)?.focus({ preventScroll: true }));\n };\n return (\n <button type=\"button\" class=\"k2b-chat-preview__more\" aria-controls={props.controls} aria-expanded=\"false\" onClick={show}>\n {props.children}\n </button>\n );\n}\n\nexport type ChatPreviewReadMoreProps = {\n href: string;\n children: JSX.Element;\n /** Tooltip, such as \"Opens exactly this version of the draft\". */\n title?: string;\n};\n\n/** Opens the whole thing at exactly the version the question shows. */\nfunction ChatPreviewReadMore(props: ChatPreviewReadMoreProps): JSX.Element {\n return (\n <a class=\"k2b-chat-preview__more\" href={props.href} title={props.title}>\n {props.children}\n </a>\n );\n}\n\nconst InList = createContext(false);\n\n/** A list of lines with a name, such as \"What the routine may do\". */\nfunction ChatPreviewLines(props: { label?: string; children: JSX.Element }): JSX.Element {\n return (\n <ul class=\"k2b-chat-preview__lines\" aria-label={props.label}>\n <InList.Provider value={true}>{props.children}</InList.Provider>\n </ul>\n );\n}\n\nexport type ChatPreviewLineProps = {\n /** Icon class; the text after it starts 1.5rem from the edge. */\n icon: string;\n /** Icon colour, such as the PDF colour of an attachment. */\n accent?: string;\n /** `muted` for limits and notes, `warning` for an application's own warning. */\n tone?: \"default\" | \"muted\" | \"warning\";\n /** Marks the whole line as new or removed. */\n mark?: \"added\" | \"removed\";\n /** Quiet facts after the text, such as a file size. */\n meta?: JSX.Element;\n children: JSX.Element;\n};\n\n/** One line led by an icon: a consequence, a right, an attachment, or a warning. */\nfunction ChatPreviewLine(props: ChatPreviewLineProps): JSX.Element {\n const inList = useContext(InList);\n const messages = useChatMessages();\n const content = () => (\n <>\n <i class={`k2b-chat-line__icon ${props.icon}`} style={props.accent ? { color: props.accent } : undefined} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">\n {/* One stable wrapper, so marking a line later never moves its mounted children. */}\n <span class=\"k2b-chat-mark\" data-change={props.mark}>\n <Show when={props.mark}>\n {(mark) => <span class=\"k2b-sr-only\">{mark() === \"added\" ? messages().markAdded : messages().markRemoved} </span>}\n </Show>\n {props.children}\n </span>\n <Show when={props.meta}>\n {(meta) => (\n <>\n {\" \"}\n <span class=\"k2b-chat-preview__meta\">{meta()}</span>\n </>\n )}\n </Show>\n </span>\n </>\n );\n const attributes = () => ({\n class: \"k2b-chat-line k2b-chat-preview__line\",\n \"data-tone\": props.tone && props.tone !== \"default\" ? props.tone : undefined,\n });\n return inList ? <li {...attributes()}>{content()}</li> : <p {...attributes()}>{content()}</p>;\n}\n\nexport type ChatPreviewPeopleProps = {\n /** The first few people; their avatars overlap at the start of the line. */\n people: readonly { name: string; src?: string | null }[];\n /** The names as text, such as \"Lea Berg, Tom Weber and 3 others\". */\n children: JSX.Element;\n};\n\nfunction ChatPreviewPeople(props: ChatPreviewPeopleProps): JSX.Element {\n return (\n <p class=\"k2b-chat-preview__people\">\n <span class=\"k2b-chat-preview__faces\" aria-hidden=\"true\">\n <For each={props.people}>{(person) => <Avatar name={person.name} src={person.src} size=\"xs\" />}</For>\n </span>\n <span>{props.children}</span>\n </p>\n );\n}\n\nexport const ChatPreview = Object.assign(ChatPreviewRoot, {\n Header: ChatPreviewHeader,\n Title: ChatPreviewTitle,\n Sentence: ChatPreviewSentence,\n Excerpt: ChatPreviewExcerpt,\n ReadMore: ChatPreviewReadMore,\n ShowAll: ChatPreviewShowAll,\n Lines: ChatPreviewLines,\n Line: ChatPreviewLine,\n People: ChatPreviewPeople,\n});\n\n// ---------------------------------------------------------------------------\n// Mark\n// ---------------------------------------------------------------------------\n\nexport type ChatMarkProps = { change: \"added\" | \"removed\"; children: JSX.Element };\n\n/** Marks new or removed words; screen readers hear \"new:\" or \"removed:\" first. */\nexport function ChatMark(props: ChatMarkProps): JSX.Element {\n const messages = useChatMessages();\n return (\n <Show\n when={props.change === \"removed\"}\n fallback={\n <mark class=\"k2b-chat-mark\" data-change=\"added\">\n <span class=\"k2b-sr-only\">{messages().markAdded} </span>\n {props.children}\n </mark>\n }\n >\n <del class=\"k2b-chat-mark\" data-change=\"removed\">\n <span class=\"k2b-sr-only\">{messages().markRemoved} </span>\n {props.children}\n </del>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SACE,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,GAAG,EAEH,EAAE,EACF,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,EACP,UAAU,QACL,UAAU;AACjB,SAAS,MAAM,QAAQ,mBAAmB;AAC1C,SAAS,MAAM,QAAQ,oBAAoB;AAC3C,SAAS,eAAe,QAAQ,iBAAiB;;AAWjD;AACA;AACA;;AAgCA;AACA,MAAM,aAAa,GAAG,aAAa,CAAyE,CAAC;AAE7G,MAAM,UAAU,GAAI,MAA0B,IAAK,MAAM,CAAC,IAAI,IAAI,mBAAmB;;AAErF;AACA;AACA;AACA;AACA,OAAO,SAAS,YAAY,CAAC,KAAwB,EAAe;EAClE,MAAM,EAAE,GAAG,cAAc,CAAC,CAAC;EAC3B,MAAM,UAAU,GAAG,qBAAqB,EAAE,WAAW;EACrD,MAAM,QAAQ,GAAG,qBAAqB,EAAE,SAAS;EACjD,IAAI,IAAgC;EACpC,IAAI,QAA0C;EAC9C;EACA;EACA,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;EAC3D,MAAM,CAAC,M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vB,QAAQ,EAAE,mBAAmB;EAC7B,OAAO,EAAE,kBAAkB;EAC3B,QAAQ,EAAE,mBAAmB;EAC7B,OAAO,EAAE,kBAAkB;EAC3B,KAAK,EAAE,gBAAgB;EACvB,IAAI,EAAE,eAAe;EACrB,MAAM,EAAE;AACV,CAAC,CAAC;;AAEF;AACA;AACA;;AAIA;AACA,OAAO,SAAS,QAAQ,CAAC,KAAoB,EAAe;EAC1D,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC;EAClC,yBACG,IAAI;IAAA,IACH,IAAI;MAAA,OAAE,KAAK,CAAC,MAAM,KAAK,SAAS;IAAA;IAAA,IAChC,QAAQ;MAAA;QAAA;UAAA;UAAA;UAAA;UAAA;UAAA;UAAA;QAAA,uBAEuB,QAAQ,CAAC,CAAC,CAAC,SAAS;QAAA,uBAC9C,KAAK,CAAC,QAAQ;QAAA;MAAA;IAAA;IAAA;MAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;MAAA,uBAKU,QAAQ,CAAC,CAAC,CAAC,WAAW;MAAA,uBAChD,KAAK,CAAC,QAAQ;MAAA;IAAA;EAAA;AAIvB;AAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { template as _$template } from "solid-js/web";
|
|
2
2
|
import { delegateEvents as _$delegateEvents } from "solid-js/web";
|
|
3
|
-
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
4
3
|
import { runHydrationEvents as _$runHydrationEvents } from "solid-js/web";
|
|
4
|
+
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
5
5
|
import { spread as _$spread } from "solid-js/web";
|
|
6
6
|
import { memo as _$memo } from "solid-js/web";
|
|
7
7
|
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
@@ -13,15 +13,17 @@ import { use as _$use } from "solid-js/web";
|
|
|
13
13
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
14
14
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
15
15
|
var _tmpl$ = /*#__PURE__*/_$template(`<div role=grid>`),
|
|
16
|
-
_tmpl$2 = /*#__PURE__*/_$template(`<div role=row class=k2b-file-grid__row><div
|
|
17
|
-
_tmpl$3 = /*#__PURE__*/_$template(`<
|
|
18
|
-
_tmpl$4 = /*#__PURE__*/_$template(`<
|
|
19
|
-
_tmpl$5 = /*#__PURE__*/_$template(`<div
|
|
20
|
-
_tmpl$6 = /*#__PURE__*/_$template(`<button type=button class=k2b-file-
|
|
21
|
-
_tmpl$7 = /*#__PURE__*/_$template(`<div class=k2b-file-grid-
|
|
22
|
-
_tmpl$8 = /*#__PURE__*/_$template(`<
|
|
23
|
-
_tmpl$9 = /*#__PURE__*/_$template(`<
|
|
24
|
-
_tmpl$0 = /*#__PURE__*/_$template(`<
|
|
16
|
+
_tmpl$2 = /*#__PURE__*/_$template(`<div role=row class=k2b-file-grid__row><div><!$><!/><div class=k2b-file-grid__preview></div><div class=k2b-file-grid__name></div><div class=k2b-file-grid__meta></div><div class=k2b-file-grid__actions>`),
|
|
17
|
+
_tmpl$3 = /*#__PURE__*/_$template(`<span class=k2b-file-grid__check-box><i class="ti ti-check">`),
|
|
18
|
+
_tmpl$4 = /*#__PURE__*/_$template(`<span class=k2b-file-grid__check aria-hidden=true>`),
|
|
19
|
+
_tmpl$5 = /*#__PURE__*/_$template(`<div data-open-items=true role=list>`),
|
|
20
|
+
_tmpl$6 = /*#__PURE__*/_$template(`<div role=listitem class=k2b-file-grid__row><div><button type=button class=k2b-file-grid__open></button><div class=k2b-file-grid__preview></div><div class=k2b-file-grid__name></div><div class=k2b-file-grid__meta></div><div class=k2b-file-grid__actions>`),
|
|
21
|
+
_tmpl$7 = /*#__PURE__*/_$template(`<div class=k2b-file-grid-stack__toolbar>`),
|
|
22
|
+
_tmpl$8 = /*#__PURE__*/_$template(`<button type=button class=k2b-file-grid-stack__more aria-expanded=true><span></span><i class="ti ti-chevron-up"aria-hidden=true>`),
|
|
23
|
+
_tmpl$9 = /*#__PURE__*/_$template(`<div class=k2b-file-grid-stack><!$><!/><!$><!/><!$><!/>`),
|
|
24
|
+
_tmpl$0 = /*#__PURE__*/_$template(`<div class=k2b-file-grid-stack__group><div class=k2b-file-grid-stack__label><!$><!/><span class=k2b-file-grid-stack__count></span></div><!$><!/>`),
|
|
25
|
+
_tmpl$1 = /*#__PURE__*/_$template(`<span class=k2b-file-grid-stack__more-meta>`),
|
|
26
|
+
_tmpl$10 = /*#__PURE__*/_$template(`<button type=button class=k2b-file-grid-stack__more aria-expanded=false><span></span><i class="ti ti-chevron-down"aria-hidden=true></i><!$><!/>`);
|
|
25
27
|
import { createEffect, createMemo, createSignal, createUniqueId, For, Index, on, Show } from "solid-js";
|
|
26
28
|
import { useFileListMessages } from "./file-list-messages";
|
|
27
29
|
|
|
@@ -75,7 +77,9 @@ function SelectableFileGrid(props) {
|
|
|
75
77
|
return (() => {
|
|
76
78
|
var _el$2 = _$getNextElement(_tmpl$2),
|
|
77
79
|
_el$3 = _el$2.firstChild,
|
|
78
|
-
_el$
|
|
80
|
+
_el$8 = _el$3.firstChild,
|
|
81
|
+
[_el$9, _co$] = _$getNextMarker(_el$8.nextSibling),
|
|
82
|
+
_el$4 = _el$9.nextSibling,
|
|
79
83
|
_el$5 = _el$4.nextSibling,
|
|
80
84
|
_el$6 = _el$5.nextSibling,
|
|
81
85
|
_el$7 = _el$6.nextSibling;
|
|
@@ -112,6 +116,25 @@ function SelectableFileGrid(props) {
|
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
}), false, true);
|
|
119
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
120
|
+
get when() {
|
|
121
|
+
return props.checks;
|
|
122
|
+
},
|
|
123
|
+
children: checks => (() => {
|
|
124
|
+
var _el$0 = _$getNextElement(_tmpl$4);
|
|
125
|
+
_$insert(_el$0, _$createComponent(Show, {
|
|
126
|
+
get when() {
|
|
127
|
+
return checks()(row);
|
|
128
|
+
},
|
|
129
|
+
get children() {
|
|
130
|
+
var _el$1 = _$getNextElement(_tmpl$3);
|
|
131
|
+
_$effect(() => _$setAttribute(_el$1, "data-shape", props.selection.multiple ? "box" : "circle"));
|
|
132
|
+
return _el$1;
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
return _el$0;
|
|
136
|
+
})()
|
|
137
|
+
}), _el$9, _co$);
|
|
115
138
|
_$insert(_el$4, () => props.renderPreview(row));
|
|
116
139
|
_$insert(_el$5, () => props.renderLabel(row));
|
|
117
140
|
_$insert(_el$6, () => props.renderMeta?.(row));
|
|
@@ -126,14 +149,16 @@ function SelectableFileGrid(props) {
|
|
|
126
149
|
_v$2 = props.size ?? "md",
|
|
127
150
|
_v$3 = props.layout ?? "grid",
|
|
128
151
|
_v$4 = props.actionVisibility ?? "always",
|
|
129
|
-
_v$5 = props.
|
|
130
|
-
_v$6 = props.
|
|
152
|
+
_v$5 = props.checks ? "true" : undefined,
|
|
153
|
+
_v$6 = props.label,
|
|
154
|
+
_v$7 = props.selection.multiple;
|
|
131
155
|
_v$ !== _p$.e && _$className(_el$, _p$.e = _v$);
|
|
132
156
|
_v$2 !== _p$.t && _$setAttribute(_el$, "data-size", _p$.t = _v$2);
|
|
133
157
|
_v$3 !== _p$.a && _$setAttribute(_el$, "data-layout", _p$.a = _v$3);
|
|
134
158
|
_v$4 !== _p$.o && _$setAttribute(_el$, "data-action-visibility", _p$.o = _v$4);
|
|
135
|
-
_v$5 !== _p$.i && _$setAttribute(_el$, "
|
|
136
|
-
_v$6 !== _p$.n && _$setAttribute(_el$, "aria-
|
|
159
|
+
_v$5 !== _p$.i && _$setAttribute(_el$, "data-checks", _p$.i = _v$5);
|
|
160
|
+
_v$6 !== _p$.n && _$setAttribute(_el$, "aria-label", _p$.n = _v$6);
|
|
161
|
+
_v$7 !== _p$.s && _$setAttribute(_el$, "aria-multiselectable", _p$.s = _v$7);
|
|
137
162
|
return _p$;
|
|
138
163
|
}, {
|
|
139
164
|
e: undefined,
|
|
@@ -141,7 +166,8 @@ function SelectableFileGrid(props) {
|
|
|
141
166
|
a: undefined,
|
|
142
167
|
o: undefined,
|
|
143
168
|
i: undefined,
|
|
144
|
-
n: undefined
|
|
169
|
+
n: undefined,
|
|
170
|
+
s: undefined
|
|
145
171
|
});
|
|
146
172
|
return _el$;
|
|
147
173
|
})();
|
|
@@ -175,51 +201,51 @@ function OpenFileGrid(props) {
|
|
|
175
201
|
rows: full() || !limited() ? props.rows : props.rows.slice(0, props.limit)
|
|
176
202
|
}]);
|
|
177
203
|
const list = (group, labelId) => (() => {
|
|
178
|
-
var _el$
|
|
179
|
-
_$setAttribute(_el$
|
|
180
|
-
_$insert(_el$
|
|
204
|
+
var _el$10 = _$getNextElement(_tmpl$5);
|
|
205
|
+
_$setAttribute(_el$10, "aria-labelledby", labelId);
|
|
206
|
+
_$insert(_el$10, _$createComponent(For, {
|
|
181
207
|
get each() {
|
|
182
208
|
return group().rows;
|
|
183
209
|
},
|
|
184
210
|
children: row => {
|
|
185
211
|
const id = `k2b-file-grid-${createUniqueId()}`;
|
|
186
212
|
return (() => {
|
|
187
|
-
var _el$
|
|
188
|
-
_el$
|
|
189
|
-
_el$
|
|
190
|
-
_el$
|
|
191
|
-
_el$
|
|
192
|
-
_el$
|
|
193
|
-
_el$
|
|
194
|
-
_$spread(_el$
|
|
213
|
+
var _el$11 = _$getNextElement(_tmpl$6),
|
|
214
|
+
_el$12 = _el$11.firstChild,
|
|
215
|
+
_el$13 = _el$12.firstChild,
|
|
216
|
+
_el$14 = _el$13.nextSibling,
|
|
217
|
+
_el$15 = _el$14.nextSibling,
|
|
218
|
+
_el$16 = _el$15.nextSibling,
|
|
219
|
+
_el$17 = _el$16.nextSibling;
|
|
220
|
+
_$spread(_el$12, _$mergeProps(() => props.itemProps?.(row), {
|
|
195
221
|
"class": "k2b-file-grid__item"
|
|
196
222
|
}), false, true);
|
|
197
|
-
_el$
|
|
198
|
-
_el$
|
|
199
|
-
_$setAttribute(_el$
|
|
200
|
-
_$insert(_el$
|
|
201
|
-
_$setAttribute(_el$
|
|
202
|
-
_$insert(_el$
|
|
203
|
-
_$setAttribute(_el$
|
|
204
|
-
_$insert(_el$
|
|
205
|
-
_$insert(_el$
|
|
206
|
-
_$effect(() => _$setAttribute(_el$
|
|
223
|
+
_el$13.$$contextmenu = () => props.onContextMenu?.(row);
|
|
224
|
+
_el$13.$$click = () => props.onOpen(row);
|
|
225
|
+
_$setAttribute(_el$13, "aria-labelledby", `${id}-name`);
|
|
226
|
+
_$insert(_el$14, () => props.renderPreview(row));
|
|
227
|
+
_$setAttribute(_el$15, "id", `${id}-name`);
|
|
228
|
+
_$insert(_el$15, () => props.renderLabel(row));
|
|
229
|
+
_$setAttribute(_el$16, "id", `${id}-meta`);
|
|
230
|
+
_$insert(_el$16, () => props.renderMeta?.(row));
|
|
231
|
+
_$insert(_el$17, () => props.renderActions?.(row));
|
|
232
|
+
_$effect(() => _$setAttribute(_el$13, "aria-describedby", props.renderMeta ? `${id}-meta` : undefined));
|
|
207
233
|
_$runHydrationEvents();
|
|
208
|
-
return _el$
|
|
234
|
+
return _el$11;
|
|
209
235
|
})();
|
|
210
236
|
}
|
|
211
237
|
}));
|
|
212
238
|
_$effect(_p$ => {
|
|
213
|
-
var _v$
|
|
214
|
-
_v$
|
|
215
|
-
_v$
|
|
216
|
-
_v$
|
|
217
|
-
_v$
|
|
218
|
-
_v$
|
|
219
|
-
_v$
|
|
220
|
-
_v$
|
|
221
|
-
_v$
|
|
222
|
-
_v$
|
|
239
|
+
var _v$8 = `k2b-file-grid ${props.class ?? ""}`,
|
|
240
|
+
_v$9 = props.size ?? "md",
|
|
241
|
+
_v$0 = group().layout === "tiles" ? "tiles" : props.layout ?? "grid",
|
|
242
|
+
_v$1 = props.actionVisibility ?? "always",
|
|
243
|
+
_v$10 = labelId ? undefined : props.label;
|
|
244
|
+
_v$8 !== _p$.e && _$className(_el$10, _p$.e = _v$8);
|
|
245
|
+
_v$9 !== _p$.t && _$setAttribute(_el$10, "data-size", _p$.t = _v$9);
|
|
246
|
+
_v$0 !== _p$.a && _$setAttribute(_el$10, "data-layout", _p$.a = _v$0);
|
|
247
|
+
_v$1 !== _p$.o && _$setAttribute(_el$10, "data-action-visibility", _p$.o = _v$1);
|
|
248
|
+
_v$10 !== _p$.i && _$setAttribute(_el$10, "aria-label", _p$.i = _v$10);
|
|
223
249
|
return _p$;
|
|
224
250
|
}, {
|
|
225
251
|
e: undefined,
|
|
@@ -228,27 +254,27 @@ function OpenFileGrid(props) {
|
|
|
228
254
|
o: undefined,
|
|
229
255
|
i: undefined
|
|
230
256
|
});
|
|
231
|
-
return _el$
|
|
257
|
+
return _el$10;
|
|
232
258
|
})();
|
|
233
259
|
return (() => {
|
|
234
|
-
var _el$
|
|
235
|
-
_el$
|
|
236
|
-
[_el$
|
|
237
|
-
_el$
|
|
238
|
-
[_el$
|
|
239
|
-
_el$
|
|
240
|
-
[_el$
|
|
241
|
-
_$insert(_el$
|
|
260
|
+
var _el$18 = _$getNextElement(_tmpl$9),
|
|
261
|
+
_el$22 = _el$18.firstChild,
|
|
262
|
+
[_el$23, _co$2] = _$getNextMarker(_el$22.nextSibling),
|
|
263
|
+
_el$24 = _el$23.nextSibling,
|
|
264
|
+
[_el$25, _co$3] = _$getNextMarker(_el$24.nextSibling),
|
|
265
|
+
_el$26 = _el$25.nextSibling,
|
|
266
|
+
[_el$27, _co$4] = _$getNextMarker(_el$26.nextSibling);
|
|
267
|
+
_$insert(_el$18, _$createComponent(Show, {
|
|
242
268
|
get when() {
|
|
243
269
|
return _$memo(() => !!full())() && props.toolbar;
|
|
244
270
|
},
|
|
245
271
|
get children() {
|
|
246
|
-
var _el$
|
|
247
|
-
_$insert(_el$
|
|
248
|
-
return _el$
|
|
272
|
+
var _el$19 = _$getNextElement(_tmpl$7);
|
|
273
|
+
_$insert(_el$19, () => props.toolbar);
|
|
274
|
+
return _el$19;
|
|
249
275
|
}
|
|
250
|
-
}), _el$
|
|
251
|
-
_$insert(_el$
|
|
276
|
+
}), _el$23, _co$2);
|
|
277
|
+
_$insert(_el$18, _$createComponent(Index, {
|
|
252
278
|
get each() {
|
|
253
279
|
return groups();
|
|
254
280
|
},
|
|
@@ -262,23 +288,23 @@ function OpenFileGrid(props) {
|
|
|
262
288
|
return list(group);
|
|
263
289
|
},
|
|
264
290
|
get children() {
|
|
265
|
-
var _el$
|
|
266
|
-
_el$
|
|
267
|
-
_el$
|
|
268
|
-
[_el$
|
|
269
|
-
_el$
|
|
270
|
-
_el$
|
|
271
|
-
[_el$
|
|
272
|
-
_$setAttribute(_el$
|
|
273
|
-
_$insert(_el$
|
|
274
|
-
_$insert(_el$
|
|
275
|
-
_$insert(_el$
|
|
276
|
-
return _el$
|
|
291
|
+
var _el$28 = _$getNextElement(_tmpl$0),
|
|
292
|
+
_el$29 = _el$28.firstChild,
|
|
293
|
+
_el$31 = _el$29.firstChild,
|
|
294
|
+
[_el$32, _co$5] = _$getNextMarker(_el$31.nextSibling),
|
|
295
|
+
_el$30 = _el$32.nextSibling,
|
|
296
|
+
_el$33 = _el$29.nextSibling,
|
|
297
|
+
[_el$34, _co$6] = _$getNextMarker(_el$33.nextSibling);
|
|
298
|
+
_$setAttribute(_el$29, "id", labelId);
|
|
299
|
+
_$insert(_el$29, () => group().label, _el$32, _co$5);
|
|
300
|
+
_$insert(_el$30, () => group().rows.length);
|
|
301
|
+
_$insert(_el$28, () => list(group, labelId), _el$34, _co$6);
|
|
302
|
+
return _el$28;
|
|
277
303
|
}
|
|
278
304
|
});
|
|
279
305
|
}
|
|
280
|
-
}), _el$
|
|
281
|
-
_$insert(_el$
|
|
306
|
+
}), _el$25, _co$3);
|
|
307
|
+
_$insert(_el$18, _$createComponent(Show, {
|
|
282
308
|
get when() {
|
|
283
309
|
return limited();
|
|
284
310
|
},
|
|
@@ -289,46 +315,46 @@ function OpenFileGrid(props) {
|
|
|
289
315
|
},
|
|
290
316
|
get fallback() {
|
|
291
317
|
return (() => {
|
|
292
|
-
var _el$
|
|
293
|
-
_el$
|
|
294
|
-
_el$
|
|
295
|
-
_el$
|
|
296
|
-
[_el$
|
|
297
|
-
_el$
|
|
318
|
+
var _el$35 = _$getNextElement(_tmpl$10),
|
|
319
|
+
_el$36 = _el$35.firstChild,
|
|
320
|
+
_el$37 = _el$36.nextSibling,
|
|
321
|
+
_el$39 = _el$37.nextSibling,
|
|
322
|
+
[_el$40, _co$7] = _$getNextMarker(_el$39.nextSibling);
|
|
323
|
+
_el$35.$$click = () => toggle(true);
|
|
298
324
|
var _ref$3 = more;
|
|
299
|
-
typeof _ref$3 === "function" ? _$use(_ref$3, _el$
|
|
300
|
-
_$insert(_el$
|
|
325
|
+
typeof _ref$3 === "function" ? _$use(_ref$3, _el$35) : more = _el$35;
|
|
326
|
+
_$insert(_el$36, () => messages().showAll({
|
|
301
327
|
count: props.rows.length
|
|
302
328
|
}));
|
|
303
|
-
_$insert(_el$
|
|
329
|
+
_$insert(_el$35, _$createComponent(Show, {
|
|
304
330
|
get when() {
|
|
305
331
|
return props.moreMeta;
|
|
306
332
|
},
|
|
307
333
|
get children() {
|
|
308
|
-
var _el$
|
|
309
|
-
_$insert(_el$
|
|
310
|
-
return _el$
|
|
334
|
+
var _el$38 = _$getNextElement(_tmpl$1);
|
|
335
|
+
_$insert(_el$38, () => props.moreMeta);
|
|
336
|
+
return _el$38;
|
|
311
337
|
}
|
|
312
|
-
}), _el$
|
|
338
|
+
}), _el$40, _co$7);
|
|
313
339
|
_$runHydrationEvents();
|
|
314
|
-
return _el$
|
|
340
|
+
return _el$35;
|
|
315
341
|
})();
|
|
316
342
|
},
|
|
317
343
|
get children() {
|
|
318
|
-
var _el$
|
|
319
|
-
_el$
|
|
320
|
-
_el$
|
|
344
|
+
var _el$20 = _$getNextElement(_tmpl$8),
|
|
345
|
+
_el$21 = _el$20.firstChild;
|
|
346
|
+
_el$20.$$click = () => toggle(false);
|
|
321
347
|
var _ref$2 = less;
|
|
322
|
-
typeof _ref$2 === "function" ? _$use(_ref$2, _el$
|
|
323
|
-
_$insert(_el$
|
|
348
|
+
typeof _ref$2 === "function" ? _$use(_ref$2, _el$20) : less = _el$20;
|
|
349
|
+
_$insert(_el$21, () => messages().showLess);
|
|
324
350
|
_$runHydrationEvents();
|
|
325
|
-
return _el$
|
|
351
|
+
return _el$20;
|
|
326
352
|
}
|
|
327
353
|
});
|
|
328
354
|
}
|
|
329
|
-
}), _el$
|
|
330
|
-
_$effect(() => _$setAttribute(_el$
|
|
331
|
-
return _el$
|
|
355
|
+
}), _el$27, _co$4);
|
|
356
|
+
_$effect(() => _$setAttribute(_el$18, "data-expanded", full() ? "true" : undefined));
|
|
357
|
+
return _el$18;
|
|
332
358
|
})();
|
|
333
359
|
}
|
|
334
360
|
_$delegateEvents(["click", "contextmenu"]);
|