@k2b/ui 0.63.0 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/browser/actions/DragAndDrop.js +26 -5
  2. package/dist/browser/actions/DragAndDrop.js.map +1 -1
  3. package/dist/browser/actions/DropOverlay.js +76 -0
  4. package/dist/browser/actions/DropOverlay.js.map +1 -0
  5. package/dist/browser/actions/SortableList.js +338 -85
  6. package/dist/browser/actions/SortableList.js.map +1 -1
  7. package/dist/browser/actions/drag-and-drop-keyboard.js +211 -0
  8. package/dist/browser/actions/drag-and-drop-keyboard.js.map +1 -0
  9. package/dist/browser/actions/drag-and-drop-messages.js +21 -25
  10. package/dist/browser/actions/drag-and-drop-messages.js.map +1 -1
  11. package/dist/browser/actions/drag-and-drop.js +206 -184
  12. package/dist/browser/actions/drag-and-drop.js.map +1 -1
  13. package/dist/browser/actions/drop-overlay-pages.js +54 -0
  14. package/dist/browser/actions/drop-overlay-pages.js.map +1 -0
  15. package/dist/browser/actions/drop-overlay-view.js +318 -0
  16. package/dist/browser/actions/drop-overlay-view.js.map +1 -0
  17. package/dist/browser/actions/index.js +4 -2
  18. package/dist/browser/actions/index.js.map +1 -1
  19. package/dist/browser/actions/preload-when-idle.js +15 -0
  20. package/dist/browser/actions/preload-when-idle.js.map +1 -0
  21. package/dist/browser/actions/sortable-board.js +107 -0
  22. package/dist/browser/actions/sortable-board.js.map +1 -0
  23. package/dist/browser/actions/sortable-keyboard.js +202 -0
  24. package/dist/browser/actions/sortable-keyboard.js.map +1 -0
  25. package/dist/browser/actions/sortable-list-messages.js +23 -11
  26. package/dist/browser/actions/sortable-list-messages.js.map +1 -1
  27. package/dist/browser/actions/sortable-place.js +26 -0
  28. package/dist/browser/actions/sortable-place.js.map +1 -0
  29. package/dist/browser/chat/ChatDecision.js +499 -463
  30. package/dist/browser/chat/ChatDecision.js.map +1 -1
  31. package/dist/browser/chat/ChatDecisionField.js +311 -0
  32. package/dist/browser/chat/ChatDecisionField.js.map +1 -0
  33. package/dist/browser/chat/index.js +2 -0
  34. package/dist/browser/chat/index.js.map +1 -1
  35. package/dist/browser/chat/types.js.map +1 -1
  36. package/dist/browser/chat-decision-field.js +6 -0
  37. package/dist/browser/chat-decision-field.js.map +1 -0
  38. package/dist/browser/content/DataTable.js +81 -48
  39. package/dist/browser/content/DataTable.js.map +1 -1
  40. package/dist/browser/content/MessageRow.js +139 -115
  41. package/dist/browser/content/MessageRow.js.map +1 -1
  42. package/dist/browser/feedback/dialog-core.js +57 -11
  43. package/dist/browser/feedback/dialog-core.js.map +1 -1
  44. package/dist/browser/inputs/DatePicker.js +369 -716
  45. package/dist/browser/inputs/DatePicker.js.map +1 -1
  46. package/dist/browser/inputs/FileInputs.js +1 -1
  47. package/dist/browser/inputs/FileInputs.js.map +1 -1
  48. package/dist/browser/inputs/NumberInput.js +125 -46
  49. package/dist/browser/inputs/NumberInput.js.map +1 -1
  50. package/dist/browser/inputs/PeriodPicker.js +9 -4
  51. package/dist/browser/inputs/PeriodPicker.js.map +1 -1
  52. package/dist/browser/inputs/TextInput.js +3 -3
  53. package/dist/browser/inputs/TextInput.js.map +1 -1
  54. package/dist/browser/inputs/date-picker-panel.js +420 -0
  55. package/dist/browser/inputs/date-picker-panel.js.map +1 -0
  56. package/dist/browser/inputs/image-crop.js +1 -1
  57. package/dist/browser/inputs/image-crop.js.map +1 -1
  58. package/dist/browser/inputs/image-tools.js +4 -0
  59. package/dist/browser/inputs/image-tools.js.map +1 -0
  60. package/dist/browser/inputs/input-messages.js +8 -2
  61. package/dist/browser/inputs/input-messages.js.map +1 -1
  62. package/dist/ssr/actions/DragAndDrop.js +26 -5
  63. package/dist/ssr/actions/DragAndDrop.js.map +1 -1
  64. package/dist/ssr/actions/DropOverlay.js +69 -0
  65. package/dist/ssr/actions/DropOverlay.js.map +1 -0
  66. package/dist/ssr/actions/SortableList.js +293 -71
  67. package/dist/ssr/actions/SortableList.js.map +1 -1
  68. package/dist/ssr/actions/drag-and-drop-keyboard.js +211 -0
  69. package/dist/ssr/actions/drag-and-drop-keyboard.js.map +1 -0
  70. package/dist/ssr/actions/drag-and-drop-messages.js +21 -25
  71. package/dist/ssr/actions/drag-and-drop-messages.js.map +1 -1
  72. package/dist/ssr/actions/drag-and-drop.js +206 -184
  73. package/dist/ssr/actions/drag-and-drop.js.map +1 -1
  74. package/dist/ssr/actions/drop-overlay-pages.js +54 -0
  75. package/dist/ssr/actions/drop-overlay-pages.js.map +1 -0
  76. package/dist/ssr/actions/drop-overlay-view.js +225 -0
  77. package/dist/ssr/actions/drop-overlay-view.js.map +1 -0
  78. package/dist/ssr/actions/index.js +4 -2
  79. package/dist/ssr/actions/index.js.map +1 -1
  80. package/dist/ssr/actions/preload-when-idle.js +15 -0
  81. package/dist/ssr/actions/preload-when-idle.js.map +1 -0
  82. package/dist/ssr/actions/sortable-board.js +107 -0
  83. package/dist/ssr/actions/sortable-board.js.map +1 -0
  84. package/dist/ssr/actions/sortable-keyboard.js +202 -0
  85. package/dist/ssr/actions/sortable-keyboard.js.map +1 -0
  86. package/dist/ssr/actions/sortable-list-messages.js +23 -11
  87. package/dist/ssr/actions/sortable-list-messages.js.map +1 -1
  88. package/dist/ssr/actions/sortable-place.js +26 -0
  89. package/dist/ssr/actions/sortable-place.js.map +1 -0
  90. package/dist/ssr/chat/ChatDecision.js +256 -228
  91. package/dist/ssr/chat/ChatDecision.js.map +1 -1
  92. package/dist/ssr/chat/ChatDecisionField.js +206 -0
  93. package/dist/ssr/chat/ChatDecisionField.js.map +1 -0
  94. package/dist/ssr/chat/index.js +2 -0
  95. package/dist/ssr/chat/index.js.map +1 -1
  96. package/dist/ssr/chat/types.js.map +1 -1
  97. package/dist/ssr/chat-decision-field.js +6 -0
  98. package/dist/ssr/chat-decision-field.js.map +1 -0
  99. package/dist/ssr/content/DataTable.js +56 -23
  100. package/dist/ssr/content/DataTable.js.map +1 -1
  101. package/dist/ssr/content/MessageRow.js +30 -10
  102. package/dist/ssr/content/MessageRow.js.map +1 -1
  103. package/dist/ssr/feedback/dialog-core.js +57 -11
  104. package/dist/ssr/feedback/dialog-core.js.map +1 -1
  105. package/dist/ssr/inputs/DatePicker.js +94 -263
  106. package/dist/ssr/inputs/DatePicker.js.map +1 -1
  107. package/dist/ssr/inputs/FileInputs.js +1 -1
  108. package/dist/ssr/inputs/FileInputs.js.map +1 -1
  109. package/dist/ssr/inputs/NumberInput.js +114 -44
  110. package/dist/ssr/inputs/NumberInput.js.map +1 -1
  111. package/dist/ssr/inputs/PeriodPicker.js +9 -4
  112. package/dist/ssr/inputs/PeriodPicker.js.map +1 -1
  113. package/dist/ssr/inputs/TextInput.js +3 -3
  114. package/dist/ssr/inputs/TextInput.js.map +1 -1
  115. package/dist/ssr/inputs/date-picker-panel.js +233 -0
  116. package/dist/ssr/inputs/date-picker-panel.js.map +1 -0
  117. package/dist/ssr/inputs/image-crop.js +1 -1
  118. package/dist/ssr/inputs/image-crop.js.map +1 -1
  119. package/dist/ssr/inputs/image-tools.js +4 -0
  120. package/dist/ssr/inputs/image-tools.js.map +1 -0
  121. package/dist/ssr/inputs/input-messages.js +8 -2
  122. package/dist/ssr/inputs/input-messages.js.map +1 -1
  123. package/dist/styles.css +1 -1
  124. package/dist/types/actions/DragAndDrop.d.ts +17 -2
  125. package/dist/types/actions/DropOverlay.d.ts +46 -0
  126. package/dist/types/actions/SortableList.d.ts +36 -6
  127. package/dist/types/actions/drag-and-drop-keyboard.d.ts +4 -0
  128. package/dist/types/actions/drag-and-drop-messages.d.ts +8 -10
  129. package/dist/types/actions/drag-and-drop.d.ts +62 -4
  130. package/dist/types/actions/drop-overlay-pages.d.ts +22 -0
  131. package/dist/types/actions/drop-overlay-view.d.ts +12 -0
  132. package/dist/types/actions/index.d.ts +8 -4
  133. package/dist/types/actions/preload-when-idle.d.ts +5 -0
  134. package/dist/types/actions/sortable-board.d.ts +69 -0
  135. package/dist/types/actions/sortable-keyboard.d.ts +7 -0
  136. package/dist/types/actions/sortable-list-messages.d.ts +10 -3
  137. package/dist/types/actions/sortable-place.d.ts +16 -0
  138. package/dist/types/chat/ChatDecision.d.ts +28 -4
  139. package/dist/types/chat/ChatDecisionField.d.ts +45 -0
  140. package/dist/types/chat/index.d.ts +1 -0
  141. package/dist/types/chat/types.d.ts +9 -0
  142. package/dist/types/chat-decision-field.d.ts +5 -0
  143. package/dist/types/content/MessageRow.d.ts +11 -0
  144. package/dist/types/inputs/DatePicker.d.ts +3 -21
  145. package/dist/types/inputs/TextInput.d.ts +2 -0
  146. package/dist/types/inputs/date-picker-panel.d.ts +29 -0
  147. package/dist/types/inputs/image-tools.d.ts +1 -0
  148. package/dist/types/inputs/input-messages.d.ts +4 -1
  149. package/package.json +9 -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, ButtonLink } from \"../actions/Button\";\nimport { Checkbox } from \"../inputs/Checkbox\";\nimport type {\n ChatDecisionAnswer,\n ChatDecisionFact,\n ChatDecisionReason,\n ChatDecisionState,\n ChatOutcomeLine,\n ChatOutcomeTone,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Decision\n// ---------------------------------------------------------------------------\n\nexport type ChatDecisionProps = {\n /** `open` shows the question; every other state shows the head and `outcome` in its place. */\n state: ChatDecisionState;\n /**\n * `approve` asks for the answer. `edit` is the same card while the person still changes its details: a raised\n * island instead of the tinted ground, the details editable, and `confirm` moves on to `approve`. Both have the same\n * size, so switching moves nothing.\n */\n mode?: \"approve\" | \"edit\";\n /** What the card is, such as \"Approval\" with `ti ti-shield-check`, or \"Draft\" with `ti ti-pencil`. */\n kind: { label: string; icon: string };\n /** Who asks: the app's name and icon, its icon tile in `accent`. */\n source: { name: string; icon: string; accent?: string };\n /**\n * The state as a word with its icon at the end of the head. A closed question always has one; an open one has one when\n * the question itself has a state, such as a version that waits for an administrator.\n */\n status?: { label: string; icon: string; tone: ChatOutcomeTone };\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 /**\n * The thing itself on the surface colour, under its own label such as \"Details from Mail\". `note` is one quiet line\n * under it that holds for every such question, such as what Cloud checked.\n */\n /**\n * The thing itself under its label, such as \"Details from Code\"; `context` is a quiet addition after it, such as\n * \"compared with version 4\", and `note` one quiet line under the details.\n */\n details?: { label: string; context?: string; content: JSX.Element; note?: { text: string; icon?: string } };\n /** Lines after the details, each with its icon, such as what happens now and what holds until then. */\n notes?: readonly ChatDecisionReason[];\n /** Quiet facts at the start of the answer row, such as when the question expires. */\n meta?: readonly ChatDecisionFact[];\n /** The main answer, named by verb and target (\"Send to Lea\"); the only filled button. */\n confirm?: ChatDecisionAnswer;\n /** The other answer (\"Don't send\"). */\n decline?: ChatDecisionAnswer;\n /** A quiet text answer before the others, such as \"Change\" back to `edit`. It turns off with `waiting` only. */\n back?: ChatDecisionAnswer;\n /** A quiet text link before the answers, such as \"See everything\" on the thing's own page. */\n link?: { label: string; href: string };\n /** Further answers on the surface colour before `decline`, such as \"Withdraw\". They turn off with `waiting` only. */\n more?: readonly ChatDecisionAnswer[];\n /**\n * A checkbox in the answer row, such as \"Don't ask again here\". Checked, `confirm` calls this answer's `onSelect`\n * instead of its own.\n */\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 /**\n * Lines the facts keep where they wrap under the answers, for a question whose facts change while it stays open, such\n * as work that waits, runs and stops: the question then keeps its height between those states.\n */\n factLines?: 1 | 2;\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: what it is and who asks, one sentence, why it is asked, the thing itself, and the\n * answers. It has one look in every place: a tinted ground in the AI colour, its own AI primary colour, no rules. An\n * answer collapses it at once to its head and one 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 const [remembered, setRemembered] = createSignal(false);\n const editing = () => (props.mode ?? \"approve\") === \"edit\";\n let root: HTMLElement | 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 // The answer whose promise still runs. Until it settles the question takes no answer at all, so a second press, a\n // held key or another answer sends nothing twice.\n const [pending, setPending] = createSignal<string>();\n // Counts answers; a reopen by the host ends the running one, so its late settle cannot unlock a newer answer.\n let runs = 0;\n const select = (key: string, choice: ChatDecisionAnswer, settled: (async: boolean) => void) => {\n let result: void | Promise<void>;\n try {\n result = choice.onSelect();\n } catch (error) {\n props.onAnswerError?.(error);\n settled(false);\n return;\n }\n if (!(result instanceof Promise)) {\n settled(false);\n return;\n }\n const run = ++runs;\n setPending(key);\n result\n .catch((error: unknown) => props.onAnswerError?.(error))\n .finally(() => {\n if (run !== runs) return;\n setPending(undefined);\n settled(true);\n });\n };\n\n const answer = (key: string, choice: ChatDecisionAnswer, enabled: boolean) => {\n if (!enabled || !open() || answeredHere() || pending()) return;\n setAnsweredHere(true);\n // A host that keeps the question open (it could not take the answer) gets working buttons back.\n const release = () => {\n if (open()) setAnsweredHere(false);\n };\n select(key, choice, (async) => (async ? release() : queueMicrotask(release)));\n };\n const answerOff = () => (pending() ? \"true\" : undefined);\n const answerBusy = (key: string) => (pending() === key ? \"true\" : undefined);\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 // The host could not take the answer: the question takes answers again, even if its promise never settles.\n runs++;\n setPending(undefined);\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 // A switch between editing and approving made here keeps the person on the question, now with its new words.\n createEffect(\n on(\n editing,\n () => {\n if (root?.contains(document.activeElement) && document.activeElement !== sentence) sentence?.focus({ preventScroll: true });\n },\n { defer: true },\n ),\n );\n\n const confirm = () => {\n if (props.confirm?.busy) return;\n const chosen = props.remember && remembered() && !editing() ? props.remember : props.confirm;\n if (chosen) answer(\"confirm\", chosen, !confirmOff());\n };\n\n return (\n <section\n ref={root}\n class={`k2b-chat-decision ${props.class ?? \"\"}`}\n data-state={props.state}\n data-mode={open() && editing() ? \"edit\" : \"approve\"}\n data-k2b-primary=\"ai\"\n data-fact-lines={props.factLines === 2 ? \"2\" : undefined}\n data-chat-anchor={props.anchorId !== undefined ? String(props.anchorId) : undefined}\n aria-labelledby={open() ? sentenceId : undefined}\n aria-describedby={open() ? reasonId : undefined}\n aria-label={open() ? undefined : `${props.kind.label} · ${props.source.name}${props.status ? `: ${props.status.label}` : \"\"}`}\n >\n <div class=\"k2b-chat-decision__head\">\n <i class={`k2b-chat-decision__kind-icon ${props.kind.icon}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-decision__kind\">{props.kind.label}</span>\n <span aria-hidden=\"true\">·</span>\n <span class=\"k2b-chat-decision__source\">\n <span class=\"k2b-chat-decision__tile k2b-icon-tile\" style={props.source.accent ? { color: props.source.accent } : undefined}>\n <i class={props.source.icon} aria-hidden=\"true\" />\n </span>\n {props.source.name}\n </span>\n <Show when={props.status}>\n {(status) => (\n <span class=\"k2b-chat-decision__status\" data-tone={status().tone}>\n <i class={status().icon} aria-hidden=\"true\" />\n {status().label}\n </span>\n )}\n </Show>\n </div>\n <Show when={open()} fallback={<DecisionScope.Provider value={scope}>{props.outcome}</DecisionScope.Provider>}>\n <>\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 <Show when={props.details}>\n {(details) => (\n <div class=\"k2b-chat-decision__details\">\n <p class=\"k2b-chat-decision__details-label\">\n <span\n class=\"k2b-chat-decision__tile k2b-icon-tile\"\n style={props.source.accent ? { color: props.source.accent } : undefined}\n >\n <i class={props.source.icon} aria-hidden=\"true\" />\n </span>\n <span>\n <strong>{details().label}</strong>\n <Show when={details().context}>\n {(context) => <span class=\"k2b-chat-decision__details-context\"> · {context()}</span>}\n </Show>\n </span>\n </p>\n {details().content}\n <Show when={details().note}>\n {(note) => (\n <p class=\"k2b-chat-decision__details-note\">\n <i class={note().icon ?? \"ti ti-info-circle\"} aria-hidden=\"true\" />\n {note().text}\n </p>\n )}\n </Show>\n </div>\n )}\n </Show>\n <Show when={(props.notes?.length ?? 0) > 0}>\n <div class=\"k2b-chat-decision__notes\">\n <For each={props.notes}>\n {(note) => (\n <p class=\"k2b-chat-line k2b-chat-decision__note\" data-tone={note.tone ?? \"neutral\"}>\n <i class={`k2b-chat-line__icon ${reasonIcon(note)}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">{note.text}</span>\n </p>\n )}\n </For>\n </div>\n </Show>\n <div class=\"k2b-chat-decision__answers\">\n <Show when={(props.meta?.length ?? 0) > 0 || (props.remember && !editing())}>\n <span class=\"k2b-chat-decision__meta\">\n <For each={props.meta ?? []}>\n {(item) => (\n <span class=\"k2b-chat-decision__fact\" data-tone={item.tone ?? \"neutral\"}>\n <i class={item.icon} aria-hidden=\"true\" />\n {item.text}\n </span>\n )}\n </For>\n <Show when={!editing() ? props.remember : undefined}>\n {(remember) => (\n <Checkbox\n class=\"k2b-chat-decision__remember\"\n label={remember().label}\n value={remembered()}\n disabled={confirmOff()}\n onValueChange={(value) => setRemembered(value)}\n />\n )}\n </Show>\n </span>\n </Show>\n <span class=\"k2b-chat-decision__buttons\">\n <Show when={props.back}>\n {(back) => (\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant=\"text\"\n disabled={Boolean(props.waiting)}\n aria-disabled={answerOff()}\n aria-busy={answerBusy(\"back\")}\n onClick={() => {\n if (!props.waiting && !pending()) select(\"back\", back(), () => undefined);\n }}\n >\n <Show when={back().icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {back().label}\n </Button>\n )}\n </Show>\n <For each={props.more ?? []}>\n {(more, index) => (\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant=\"secondary\"\n disabled={Boolean(props.waiting)}\n aria-disabled={answerOff()}\n aria-busy={answerBusy(`more-${index()}`)}\n onClick={() => {\n if (!props.waiting && !pending()) select(`more-${index()}`, more, () => undefined);\n }}\n >\n <Show when={more.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {more.label}\n </Button>\n )}\n </For>\n <Show when={props.decline}>\n {(decline) => (\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant={editing() ? \"text\" : \"secondary\"}\n disabled={Boolean(props.waiting)}\n aria-disabled={answerOff()}\n aria-busy={answerBusy(\"decline\")}\n onClick={() => answer(\"decline\", decline(), !props.waiting)}\n >\n <Show when={decline().icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {decline().label}\n </Button>\n )}\n </Show>\n <Show when={props.confirm}>\n {(confirmAnswer) => (\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant={editing() ? \"secondary\" : \"ai\"}\n disabled={confirmOff()}\n aria-disabled={confirmAnswer().busy ? \"true\" : answerOff()}\n aria-busy={confirmAnswer().busy ? \"true\" : answerBusy(\"confirm\")}\n data-busy={confirmAnswer().busy || pending() === \"confirm\" ? \"\" : undefined}\n onClick={confirm}\n >\n <Show when={confirmAnswer().icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {confirmAnswer().label}\n </Button>\n )}\n </Show>\n {/* A link to read everything comes last, after the answers: it leaves the question, it does not answer it. */}\n <Show when={props.link}>\n {(link) => (\n <ButtonLink class=\"k2b-chat-decision__answer\" wrap variant=\"text\" href={link().href}>\n {link().label}\n </ButtonLink>\n )}\n </Show>\n </span>\n </div>\n </>\n </Show>\n </section>\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"],"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,EAAE,UAAU,QAAQ,mBAAmB;AACtD,SAAS,QAAQ,QAAQ,oBAAoB;;AAU7C;AACA;AACA;;AAwEA;AACA,MAAM,aAAa,GAAG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AC,aAAa,GAAG,KAAK,CAAC,CAAC,CACvD,OAAO,CAAC,MAAM;oBACb,OAAO,GAAG,KAAK;oBACf,KAAK,EAAE,QAAQ,CAAC,CAAC;kBACnB,CAAC,CAAC;kBACJ;gBACF;cACF,CAAC,CAAC,OAAO,KAAK,EAAE;gBACd,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC;cAC9B;cACA,KAAK,EAAE,QAAQ,CAAC,CAAC;YACnB,CAAC;YAAA;cAAA,OAEA,MAAM,CAAC,CAAC,CAAC,KAAK;YAAA;UAAA;QAElB,gCAGF,IAAI;UAAA,IAAC,IAAI;YAAA,OAAE,IAAI,CAAC,CAAC,CAAC,OAAO;UAAA;UAAA,UAAI,OAAO,6BAA6C,OAAO,CAAC,CAAC;QAAO;MAErG;IAGP;EAAC,cAIF,IAAI,CAAC,CAAC;AAIf","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, ButtonLink } from \"../actions/Button\";\nimport { Checkbox } from \"../inputs/Checkbox\";\nimport type {\n ChatDecisionAnswer,\n ChatDecisionFact,\n ChatDecisionReason,\n ChatDecisionState,\n ChatOutcomeLine,\n ChatOutcomeTone,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Decision\n// ---------------------------------------------------------------------------\n\nexport type ChatDecisionProps = {\n /** `open` shows the question; every other state shows the head and `outcome` in its place. */\n state: ChatDecisionState;\n /**\n * `approve` asks for the answer. `edit` is the same card while the person still changes its details: a raised\n * island instead of the tinted ground, the details editable, and `confirm` moves on to `approve`. Both have the same\n * size, so switching moves nothing.\n */\n mode?: \"approve\" | \"edit\";\n /** What the card is, such as \"Approval\" with `ti ti-shield-check`, or \"Draft\" with `ti ti-pencil`. */\n kind: { label: string; icon: string };\n /** Who asks: the app's name and icon, its icon tile in `accent`. Without it the head names only what the card is. */\n source?: { name: string; icon: string; accent?: string };\n /**\n * The state as a word with its icon at the end of the head. A closed question always has one; an open one has one when\n * the question itself has a state, such as a version that waits for an administrator.\n */\n status?: { label: string; icon: string; tone: ChatOutcomeTone };\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. A question with an `entry` may say it there instead. */\n reason?: ChatDecisionReason;\n /**\n * The thing itself on the surface colour, under its own label such as \"Details from Mail\". `note` is one quiet line\n * under it that holds for every such question, such as what Cloud checked.\n */\n /**\n * The thing itself under its label, such as \"Details from Code\"; `context` is a quiet addition after it, such as\n * \"compared with version 4\", and `note` one quiet line under the details.\n */\n details?: { label: string; context?: string; content: JSX.Element; note?: { text: string; icon?: string } };\n /** Lines after the details, each with its icon, such as what happens now and what holds until then. */\n notes?: readonly ChatDecisionReason[];\n /** Quiet facts at the start of the answer row, such as when the question expires. */\n meta?: readonly ChatDecisionFact[];\n /** The main answer, named by verb and target (\"Send to Lea\"); the only filled button. */\n confirm?: ChatDecisionAnswer;\n /** The other answer (\"Don't send\"). */\n decline?: ChatDecisionAnswer;\n /** A quiet text answer before the others, such as \"Change\" back to `edit`. It turns off with `waiting` only. */\n back?: ChatDecisionAnswer;\n /** A quiet text link before the answers, such as \"See everything\" on the thing's own page. */\n link?: { label: string; href: string };\n /** Further answers on the surface colour before `decline`, such as \"Withdraw\". They turn off with `waiting` only. */\n more?: readonly ChatDecisionAnswer[];\n /**\n * A checkbox in the answer row, such as \"Don't ask again here\". Checked, `confirm` calls this answer's `onSelect`\n * instead of its own.\n */\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 /**\n * Takes the answer row's place, such as `ChatDecisionField` for a question that asks for one value. `meta`, `back`,\n * `more`, `link`, `remember`, `confirm` and `decline` of the question are then not shown; the entry brings its own.\n */\n entry?: JSX.Element;\n /** Receives a rejected promise from an answer's `onSelect`. */\n onAnswerError?: (error: unknown) => void;\n /**\n * Lines the facts keep where they wrap under the answers, for a question whose facts change while it stays open, such\n * as work that waits, runs and stops: the question then keeps its height between those states.\n */\n factLines?: 1 | 2;\n anchorId?: string | number;\n class?: string;\n};\n\n/**\n * What an outcome inside a question needs from it: whether it was just answered here, and a link press inside it. An\n * `entry` also answers through it, reads which answers are off, and turns the question into the island.\n */\nexport const DecisionScope = createContext<{\n answered: () => boolean;\n pressed: () => void;\n released: () => void;\n /** Answers like the question's own buttons, under its own `key`, through the same guard: one answer at a time. */\n answer: (key: string, choice: ChatDecisionAnswer, enabled: boolean) => void;\n /** The key of the answer whose promise still runs; until it settles every answer of the question waits. */\n pending: () => string | undefined;\n /** `all` while `waiting`, `confirm` while `unavailable`. */\n off: () => \"all\" | \"confirm\" | undefined;\n /** Turns the question into the raised island of `edit` for good. */\n edit: () => void;\n}>();\n\nconst reasonIcon = (reason: ChatDecisionReason) => reason.icon ?? \"ti ti-info-circle\";\n\n/**\n * A question the person answers: what it is and who asks, one sentence, why it is asked, the thing itself, and the\n * answers. It has one look in every place: a tinted ground in the AI colour, its own AI primary colour, no rules. An\n * answer collapses it at once to its head and one 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 const [remembered, setRemembered] = createSignal(false);\n const editing = () => (props.mode ?? \"approve\") === \"edit\";\n let root: HTMLElement | 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\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 // The answer whose promise still runs. Until it settles the question takes no answer at all, so a second press, a\n // held key or another answer sends nothing twice.\n const [pending, setPending] = createSignal<string>();\n // Counts answers; a reopen by the host ends the running one, so its late settle cannot unlock a newer answer.\n let runs = 0;\n const select = (key: string, choice: ChatDecisionAnswer, settled: (async: boolean) => void) => {\n let result: void | Promise<void>;\n try {\n result = choice.onSelect();\n } catch (error) {\n props.onAnswerError?.(error);\n settled(false);\n return;\n }\n if (!(result instanceof Promise)) {\n settled(false);\n return;\n }\n const run = ++runs;\n setPending(key);\n result\n .catch((error: unknown) => props.onAnswerError?.(error))\n .finally(() => {\n if (run !== runs) return;\n setPending(undefined);\n settled(true);\n });\n };\n\n const answer = (key: string, choice: ChatDecisionAnswer, enabled: boolean) => {\n if (!enabled || !open() || answeredHere() || pending()) return;\n setAnsweredHere(true);\n // A host that keeps the question open (it could not take the answer) gets working buttons back.\n const release = () => {\n if (open()) setAnsweredHere(false);\n };\n select(key, choice, (async) => (async ? release() : queueMicrotask(release)));\n };\n const answerOff = () => (pending() ? \"true\" : undefined);\n const answerBusy = (key: string) => (pending() === key ? \"true\" : undefined);\n const [entryEditing, setEntryEditing] = createSignal(false);\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 answer,\n pending,\n off: () => (props.waiting ? \"all\" : props.unavailable ? \"confirm\" : undefined),\n edit: () => setEntryEditing(true),\n } as const;\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 // The host could not take the answer: the question takes answers again, even if its promise never settles.\n runs++;\n setPending(undefined);\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 // A switch between editing and approving made here keeps the person on the question, now with its new words.\n createEffect(\n on(\n editing,\n () => {\n if (root?.contains(document.activeElement) && document.activeElement !== sentence) sentence?.focus({ preventScroll: true });\n },\n { defer: true },\n ),\n );\n\n const confirm = () => {\n if (props.confirm?.busy) return;\n const chosen = props.remember && remembered() && !editing() ? props.remember : props.confirm;\n if (chosen) answer(\"confirm\", chosen, !confirmOff());\n };\n\n return (\n <section\n ref={root}\n class={`k2b-chat-decision ${props.class ?? \"\"}`}\n data-state={props.state}\n data-mode={open() && (editing() || entryEditing()) ? \"edit\" : \"approve\"}\n data-k2b-primary=\"ai\"\n data-fact-lines={props.factLines === 2 ? \"2\" : undefined}\n data-chat-anchor={props.anchorId !== undefined ? String(props.anchorId) : undefined}\n aria-labelledby={open() ? sentenceId : undefined}\n aria-describedby={open() && reason() ? reasonId : undefined}\n aria-label={\n open()\n ? undefined\n : `${props.kind.label}${props.source ? ` · ${props.source.name}` : \"\"}${props.status ? `: ${props.status.label}` : \"\"}`\n }\n >\n <div class=\"k2b-chat-decision__head\">\n <i class={`k2b-chat-decision__kind-icon ${props.kind.icon}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-decision__kind\">{props.kind.label}</span>\n <Show when={props.source}>\n {(source) => (\n <>\n <span aria-hidden=\"true\">·</span>\n <span class=\"k2b-chat-decision__source\">\n <span class=\"k2b-chat-decision__tile k2b-icon-tile\" style={source().accent ? { color: source().accent } : undefined}>\n <i class={source().icon} aria-hidden=\"true\" />\n </span>\n {source().name}\n </span>\n </>\n )}\n </Show>\n <Show when={props.status}>\n {(status) => (\n <span class=\"k2b-chat-decision__status\" data-tone={status().tone}>\n <i class={status().icon} aria-hidden=\"true\" />\n {status().label}\n </span>\n )}\n </Show>\n </div>\n <DecisionScope.Provider value={scope}>\n <Show when={open()} fallback={props.outcome}>\n <>\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 <Show when={reason()}>\n {(shown) => (\n <p id={reasonId} class=\"k2b-chat-line k2b-chat-decision__reason\" data-tone={shown().tone ?? \"neutral\"}>\n <i class={`k2b-chat-line__icon ${reasonIcon(shown())}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">{shown().text}</span>\n </p>\n )}\n </Show>\n <Show when={props.details}>\n {(details) => (\n <div class=\"k2b-chat-decision__details\">\n <p class=\"k2b-chat-decision__details-label\">\n <span\n class=\"k2b-chat-decision__tile k2b-icon-tile\"\n style={props.source?.accent ? { color: props.source.accent } : undefined}\n >\n <i class={props.source?.icon} aria-hidden=\"true\" />\n </span>\n <span>\n <strong>{details().label}</strong>\n <Show when={details().context}>\n {(context) => <span class=\"k2b-chat-decision__details-context\"> · {context()}</span>}\n </Show>\n </span>\n </p>\n {details().content}\n <Show when={details().note}>\n {(note) => (\n <p class=\"k2b-chat-decision__details-note\">\n <i class={note().icon ?? \"ti ti-info-circle\"} aria-hidden=\"true\" />\n {note().text}\n </p>\n )}\n </Show>\n </div>\n )}\n </Show>\n <Show when={(props.notes?.length ?? 0) > 0}>\n <div class=\"k2b-chat-decision__notes\">\n <For each={props.notes}>\n {(note) => (\n <p class=\"k2b-chat-line k2b-chat-decision__note\" data-tone={note.tone ?? \"neutral\"}>\n <i class={`k2b-chat-line__icon ${reasonIcon(note)}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">{note.text}</span>\n </p>\n )}\n </For>\n </div>\n </Show>\n {/* The entry is read inside the provider only: reading it creates it, and it needs its question. */}\n <Show\n when={props.entry}\n fallback={\n <div class=\"k2b-chat-decision__answers\">\n <Show when={(props.meta?.length ?? 0) > 0 || (props.remember && !editing())}>\n <span class=\"k2b-chat-decision__meta\">\n <For each={props.meta ?? []}>\n {(item) => (\n <span class=\"k2b-chat-decision__fact\" data-tone={item.tone ?? \"neutral\"}>\n <i class={item.icon} aria-hidden=\"true\" />\n {item.text}\n </span>\n )}\n </For>\n <Show when={!editing() ? props.remember : undefined}>\n {(remember) => (\n <Checkbox\n class=\"k2b-chat-decision__remember\"\n label={remember().label}\n value={remembered()}\n disabled={confirmOff()}\n onValueChange={(value) => setRemembered(value)}\n />\n )}\n </Show>\n </span>\n </Show>\n <span class=\"k2b-chat-decision__buttons\">\n <Show when={props.back}>\n {(back) => (\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant=\"text\"\n disabled={Boolean(props.waiting)}\n aria-disabled={answerOff()}\n aria-busy={answerBusy(\"back\")}\n onClick={() => {\n if (!props.waiting && !pending()) select(\"back\", back(), () => undefined);\n }}\n >\n <Show when={back().icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {back().label}\n </Button>\n )}\n </Show>\n <For each={props.more ?? []}>\n {(more, index) => (\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant=\"secondary\"\n disabled={Boolean(props.waiting)}\n aria-disabled={answerOff()}\n aria-busy={answerBusy(`more-${index()}`)}\n onClick={() => {\n if (!props.waiting && !pending()) select(`more-${index()}`, more, () => undefined);\n }}\n >\n <Show when={more.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {more.label}\n </Button>\n )}\n </For>\n <Show when={props.decline}>\n {(decline) => (\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant={editing() ? \"text\" : \"secondary\"}\n disabled={Boolean(props.waiting)}\n aria-disabled={answerOff()}\n aria-busy={answerBusy(\"decline\")}\n onClick={() => answer(\"decline\", decline(), !props.waiting)}\n >\n <Show when={decline().icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {decline().label}\n </Button>\n )}\n </Show>\n <Show when={props.confirm}>\n {(confirmAnswer) => (\n <Button\n class=\"k2b-chat-decision__answer\"\n wrap\n variant={editing() ? \"secondary\" : \"ai\"}\n disabled={confirmOff()}\n aria-disabled={confirmAnswer().busy ? \"true\" : answerOff()}\n aria-busy={confirmAnswer().busy ? \"true\" : answerBusy(\"confirm\")}\n data-busy={confirmAnswer().busy || pending() === \"confirm\" ? \"\" : undefined}\n onClick={confirm}\n >\n <Show when={confirmAnswer().icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {confirmAnswer().label}\n </Button>\n )}\n </Show>\n {/* A link to read everything comes last, after the answers: it leaves the question, it does not answer it. */}\n <Show when={props.link}>\n {(link) => (\n <ButtonLink class=\"k2b-chat-decision__answer\" wrap variant=\"text\" href={link().href}>\n {link().label}\n </ButtonLink>\n )}\n </Show>\n </span>\n </div>\n }\n >\n {(entry) => entry()}\n </Show>\n </>\n </Show>\n </DecisionScope.Provider>\n </section>\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. */\nexport const 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"],"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,EAAE,UAAU,QAAQ,mBAAmB;AACtD,SAAS,QAAQ,QAAQ,oBAAoB;;AAU7C;AACA;AACA;;AA6EA;AACA;AACA;AACA;AACA,OAAO,MAAM,aAAa,GAAG,aAAa,CAYvC,CAAC;AAEJ,MAAM,UAAU,GAAI,MAA0B,IAAK,MAAM,CAAC,IAAI,IAAI,mBAAmB;;AAErF;AACA;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,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,YAAY,CAAC,KAAK,C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ACvF,IAAI;UAAA,IAAC,IAAI;YAAA,OAAE,IAAI,CAAC,CAAC,CAAC,MAAM;UAAA;UAAA,UACrB,MAAM,sBACL,MAAM;YAAA;YAEL,IAAI;YACJ,OAAO;YAAA,IACP,QAAQ;cAAA,OAAE,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC;YAAA;YACpC,OAAO,EAAE,MAAM;cACb;cACA,IAAI,OAAO,EAAE;cACb,KAAK,EAAE,OAAO,CAAC,CAAC;cAChB,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;gBAClC,IAAI,MAAM,YAAY,OAAO,EAAE;kBAC7B,OAAO,GAAG,IAAI;kBACd,MAAM,CACH,KAAK,CAAE,KAAc,IAAK,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC,CACvD,OAAO,CAAC,MAAM;oBACb,OAAO,GAAG,KAAK;oBACf,KAAK,EAAE,QAAQ,CAAC,CAAC;kBACnB,CAAC,CAAC;kBACJ;gBACF;cACF,CAAC,CAAC,OAAO,KAAK,EAAE;gBACd,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC;cAC9B;cACA,KAAK,EAAE,QAAQ,CAAC,CAAC;YACnB,CAAC;YAAA;cAAA,OAEA,MAAM,CAAC,CAAC,CAAC,KAAK;YAAA;UAAA;QAElB,gCAGF,IAAI;UAAA,IAAC,IAAI;YAAA,OAAE,IAAI,CAAC,CAAC,CAAC,OAAO;UAAA;UAAA,UAAI,OAAO,6BAA6C,OAAO,CAAC,CAAC;QAAO;MAErG;IAGP;EAAC,cAIF,IAAI,CAAC,CAAC;AAIf","ignoreList":[]}
@@ -0,0 +1,206 @@
1
+ import { memo as _$memo } from "solid-js/web";
2
+ import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
3
+ import { ssr as _$ssr } from "solid-js/web";
4
+ import { escape as _$escape } from "solid-js/web";
5
+ import { createComponent as _$createComponent } from "solid-js/web";
6
+ var _tmpl$ = ["<span class=\"k2b-chat-decision__faces\"><span class=\"k2b-chat-decision__face\" data-current=\"true\">", "", "</span>", "</span>"],
7
+ _tmpl$2 = ["<i", " aria-hidden=\"true\"></i>"],
8
+ _tmpl$3 = ["<span class=\"k2b-chat-decision__face\" aria-hidden=\"true\">", "", "</span>"],
9
+ _tmpl$4 = ["<i", "></i>"],
10
+ _tmpl$5 = ["<div class=\"k2b-chat-decision__details\"><div class=\"k2b-chat-decision__facts\">", "</div></div>"],
11
+ _tmpl$6 = ["<div class=\"k2b-chat-decision__entry\"><div class=\"k2b-chat-decision__field\">", "</div>", "<p class=\"k2b-chat-decision__line-cell\">", "</p>", "<span class=\"k2b-sr-only\" role=\"status\" aria-live=\"polite\">", "</span></div>"],
12
+ _tmpl$7 = ["<p class=\"k2b-chat-line k2b-chat-decision__fact-line\"", "><i class=\"", "\" aria-hidden=\"true\"></i><span class=\"k2b-chat-line__text\">", "</span></p>"],
13
+ _tmpl$8 = ["<span", " class=\"k2b-chat-line k2b-chat-decision__line\"", "><i class=\"", "\" aria-hidden=\"true\"></i><span class=\"k2b-chat-line__text\">", "</span></span>"];
14
+ import { createEffect, createMemo, createSignal, createUniqueId, For, on, onCleanup, Show, useContext } from "solid-js";
15
+ import { Button } from "../actions/Button";
16
+ import { TextInput } from "../inputs/TextInput";
17
+ import { DecisionScope, spokenText } from "./ChatDecision";
18
+ /** An answer's label with every other label it can take in the same cell; only the current one is seen and named. */
19
+ const faces = choice => _$ssr(_tmpl$, _$escape(_$createComponent(Show, {
20
+ get when() {
21
+ return choice.icon;
22
+ },
23
+ children: icon => _$ssr(_tmpl$2, _$ssrAttribute("class", _$escape(icon(), true), false))
24
+ })), _$escape(choice.label), _$escape(_$createComponent(For, {
25
+ get each() {
26
+ return (choice.alternates ?? []).filter(alternate => alternate.label !== choice.label);
27
+ },
28
+ children: alternate => _$ssr(_tmpl$3, _$escape(_$createComponent(Show, {
29
+ get when() {
30
+ return alternate.icon;
31
+ },
32
+ children: icon => _$ssr(_tmpl$4, _$ssrAttribute("class", _$escape(icon(), true), false))
33
+ })), _$escape(alternate.label))
34
+ })));
35
+
36
+ /**
37
+ * The answer row of a `Chat.Decision` that asks for one value, passed as its `entry`: a password field with an eye, one
38
+ * line under it, the filled answer beside the field, and a quiet one beside the line. Every line and every label shares
39
+ * one cell, so no state moves anything. Typing, or the focus in the field, turns the question into the raised island
40
+ * for good.
41
+ */
42
+ export function ChatDecisionField(props) {
43
+ const question = useContext(DecisionScope);
44
+ const id = createUniqueId();
45
+ // A running answer holds the question: the field and the eye lock like `disabled`, the answers stay focusable but
46
+ // take nothing, as the question's own buttons do.
47
+ const pending = () => question?.pending();
48
+ const locked = () => Boolean(props.disabled) || Boolean(pending());
49
+ const confirmOff = () => Boolean(question?.off()) || Boolean(props.disabled);
50
+ const declineOff = () => question?.off() === "all" || Boolean(props.disabled);
51
+ const keys = createMemo(() => {
52
+ const all = Object.keys(props.lines);
53
+ return all.includes(props.current) ? all : [props.current, ...all];
54
+ });
55
+ const lineId = key => `k2b-chat-decision-field-${id}-${keys().indexOf(key)}`;
56
+ let input;
57
+ let cell;
58
+
59
+ // A value, typed or given, makes the question the island; in the browser only, so the server page matches the first frame.
60
+ createEffect(() => {
61
+ if (props.value !== "") question?.edit();
62
+ });
63
+ const [live, setLive] = createSignal("");
64
+ let timer;
65
+ onCleanup(() => {
66
+ if (timer) clearTimeout(timer);
67
+ });
68
+ // One live region: a new line is spoken once, and the same words again are a change too.
69
+ createEffect(on(() => props.current, () => {
70
+ setLive("");
71
+ if (timer) clearTimeout(timer);
72
+ timer = setTimeout(() => {
73
+ const line = cell?.querySelector('[data-current="true"]');
74
+ setLive(line ? spokenText(line) : "");
75
+ }, 40);
76
+ }, {
77
+ defer: true
78
+ }));
79
+ // A value that cannot be taken sends the focus back into the field, unless the person is somewhere else by now.
80
+ createEffect(on(() => Boolean(props.invalid), invalid => {
81
+ if (!invalid) return;
82
+ const active = document.activeElement;
83
+ if (!active || active === document.body || input?.closest(".k2b-chat-decision")?.contains(active)) input?.focus({
84
+ preventScroll: true
85
+ });
86
+ }, {
87
+ defer: true
88
+ }));
89
+
90
+ // The lock takes the focus from the field; a question that stays open afterwards, such as after a failed save,
91
+ // gives it back, unless the person is somewhere else by now.
92
+ createEffect(on(() => Boolean(pending()), (running, was) => {
93
+ if (running || !was) return;
94
+ const active = document.activeElement;
95
+ if (!active || active === document.body) input?.focus({
96
+ preventScroll: true
97
+ });
98
+ }, {
99
+ defer: true
100
+ }));
101
+ const confirm = () => {
102
+ if (props.confirm.busy) return;
103
+ if (question) question.answer("confirm", props.confirm, !confirmOff());else if (!confirmOff()) void props.confirm.onSelect();
104
+ };
105
+ const decline = choice => {
106
+ if (question) question.answer("decline", choice, !declineOff());else if (!declineOff()) void choice.onSelect();
107
+ };
108
+ return [_$createComponent(Show, {
109
+ get when() {
110
+ return (props.facts?.length ?? 0) > 0;
111
+ },
112
+ get children() {
113
+ return _$ssr(_tmpl$5, _$escape(_$createComponent(For, {
114
+ get each() {
115
+ return props.facts;
116
+ },
117
+ children: line => _$ssr(_tmpl$7, _$ssrAttribute("data-tone", _$escape(line.tone ?? "neutral", true), false), `k2b-chat-line__icon ${_$escape(line.icon ?? "ti ti-info-circle", true)}`, _$escape(line.text))
118
+ })));
119
+ }
120
+ }), _$ssr(_tmpl$6, _$escape(_$createComponent(TextInput, {
121
+ get ["aria-label"]() {
122
+ return props.label;
123
+ },
124
+ password: true,
125
+ get revealLabel() {
126
+ return props.revealLabel;
127
+ },
128
+ get value() {
129
+ return props.value;
130
+ },
131
+ onValueChange: value => props.onValueChange(value),
132
+ onSubmit: confirm,
133
+ get placeholder() {
134
+ return props.placeholder;
135
+ },
136
+ get disabled() {
137
+ return locked();
138
+ },
139
+ get error() {
140
+ return _$memo(() => !!props.invalid)() ? props.lines[props.current]?.text : undefined;
141
+ },
142
+ get externalErrorId() {
143
+ return _$memo(() => !!props.invalid)() ? lineId(props.current) : undefined;
144
+ },
145
+ get ["aria-describedby"]() {
146
+ return _$memo(() => !!props.invalid)() ? undefined : lineId(props.current);
147
+ },
148
+ autocomplete: "new-password",
149
+ "data-1p-ignore": "",
150
+ "data-lpignore": "true",
151
+ "data-bwignore": "",
152
+ "data-form-type": "other",
153
+ spellcheck: false
154
+ })), _$escape(_$createComponent(Button, {
155
+ "class": "k2b-chat-decision__answer k2b-chat-decision__confirm",
156
+ variant: "ai",
157
+ get disabled() {
158
+ return confirmOff();
159
+ },
160
+ get ["aria-disabled"]() {
161
+ return props.confirm.busy || pending() ? "true" : undefined;
162
+ },
163
+ get ["aria-busy"]() {
164
+ return props.confirm.busy || pending() === "confirm" ? "true" : undefined;
165
+ },
166
+ get ["data-busy"]() {
167
+ return props.confirm.busy || pending() === "confirm" ? "" : undefined;
168
+ },
169
+ onClick: confirm,
170
+ get children() {
171
+ return faces(props.confirm);
172
+ }
173
+ })), _$escape(_$createComponent(For, {
174
+ get each() {
175
+ return keys();
176
+ },
177
+ children: key => _$createComponent(Show, {
178
+ get when() {
179
+ return props.lines[key];
180
+ },
181
+ children: line => _$ssr(_tmpl$8, _$ssrAttribute("id", _$escape(lineId(key), true), false), _$ssrAttribute("data-tone", _$escape(line().tone ?? "neutral", true), false) + _$ssrAttribute("data-current", key === props.current ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("aria-hidden", key === props.current ? _$escape(undefined, true) : "true", false), `k2b-chat-line__icon ${_$escape(line().icon ?? "ti ti-info-circle", true)}`, _$escape(line().text))
182
+ })
183
+ })), _$escape(_$createComponent(Show, {
184
+ get when() {
185
+ return props.decline;
186
+ },
187
+ children: choice => _$createComponent(Button, {
188
+ "class": "k2b-chat-decision__answer k2b-chat-decision__decline",
189
+ variant: "text",
190
+ get disabled() {
191
+ return declineOff();
192
+ },
193
+ get ["aria-disabled"]() {
194
+ return pending() ? "true" : undefined;
195
+ },
196
+ get ["aria-busy"]() {
197
+ return pending() === "decline" ? "true" : undefined;
198
+ },
199
+ onClick: () => decline(choice()),
200
+ get children() {
201
+ return faces(choice());
202
+ }
203
+ })
204
+ })), _$escape(live()))];
205
+ }
206
+ //# sourceMappingURL=ChatDecisionField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["chat/ChatDecisionField.tsx"],"sourcesContent":["import { createEffect, createMemo, createSignal, createUniqueId, For, type JSX, on, onCleanup, Show, useContext } from \"solid-js\";\nimport { Button } from \"../actions/Button\";\nimport { TextInput } from \"../inputs/TextInput\";\nimport { DecisionScope, spokenText } from \"./ChatDecision\";\nimport type { ChatDecisionAnswer, ChatDecisionReason } from \"./types\";\n\nexport type ChatDecisionFieldProps = {\n /** Facts with their icons on the surface colour above the field, such as where the value goes; no label needed. */\n facts?: readonly ChatDecisionReason[];\n /** The field's name for screen readers, such as \"Value for Parcel_API\"; the sentence already names it visibly. */\n label: string;\n /** The value stays with the caller; the field never keeps, logs, or writes it into an attribute. */\n value: string;\n onValueChange: (value: string) => void;\n placeholder?: string;\n /** The eye's fixed name, such as \"Show value\"; `aria-pressed` tells whether the value shows. */\n revealLabel?: string;\n /**\n * Every line one flow can show under the field, such as where the value goes, an error, or \"Open in another window\".\n * All of them share one cell, so the question keeps its height between them. A change is announced once.\n */\n lines: Readonly<Record<string, ChatDecisionReason>>;\n /** The key of the visible line. */\n current: string;\n /** The value cannot be taken as it is: a red edge, and the field takes the focus back from the answers. */\n invalid?: boolean;\n /**\n * Locks the field, the eye and both answers, such as while another window holds the question. While an answer's\n * promise runs, the question locks them by itself.\n */\n disabled?: boolean;\n /** Receives the input, for a host that moves the focus into the field, such as after a jump to the question. */\n inputRef?: (input: HTMLInputElement) => void;\n /**\n * The main answer, filled, beside the field, such as \"Save securely\". A promise it returns locks the field, the eye\n * and both answers until it settles and keeps the question answered here, so an outcome set before it settles takes\n * the focus. A question still open afterwards gives the focus back to the field.\n */\n confirm: ChatDecisionAnswer;\n /** The quiet answer in the AI colour under it, such as \"Decline\". */\n decline?: ChatDecisionAnswer;\n};\n\n/** An answer's label with every other label it can take in the same cell; only the current one is seen and named. */\nconst faces = (choice: ChatDecisionAnswer) => (\n <span class=\"k2b-chat-decision__faces\">\n <span class=\"k2b-chat-decision__face\" data-current=\"true\">\n <Show when={choice.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n {choice.label}\n </span>\n <For each={(choice.alternates ?? []).filter((alternate) => alternate.label !== choice.label)}>\n {(alternate) => (\n <span class=\"k2b-chat-decision__face\" aria-hidden=\"true\">\n <Show when={alternate.icon}>{(icon) => <i class={icon()} />}</Show>\n {alternate.label}\n </span>\n )}\n </For>\n </span>\n);\n\n/**\n * The answer row of a `Chat.Decision` that asks for one value, passed as its `entry`: a password field with an eye, one\n * line under it, the filled answer beside the field, and a quiet one beside the line. Every line and every label shares\n * one cell, so no state moves anything. Typing, or the focus in the field, turns the question into the raised island\n * for good.\n */\nexport function ChatDecisionField(props: ChatDecisionFieldProps): JSX.Element {\n const question = useContext(DecisionScope);\n const id = createUniqueId();\n // A running answer holds the question: the field and the eye lock like `disabled`, the answers stay focusable but\n // take nothing, as the question's own buttons do.\n const pending = () => question?.pending();\n const locked = () => Boolean(props.disabled) || Boolean(pending());\n const confirmOff = () => Boolean(question?.off()) || Boolean(props.disabled);\n const declineOff = () => question?.off() === \"all\" || Boolean(props.disabled);\n const keys = createMemo(() => {\n const all = Object.keys(props.lines);\n return all.includes(props.current) ? all : [props.current, ...all];\n });\n const lineId = (key: string) => `k2b-chat-decision-field-${id}-${keys().indexOf(key)}`;\n let input: HTMLInputElement | undefined;\n let cell: HTMLParagraphElement | undefined;\n\n // A value, typed or given, makes the question the island; in the browser only, so the server page matches the first frame.\n createEffect(() => {\n if (props.value !== \"\") question?.edit();\n });\n\n const [live, setLive] = createSignal(\"\");\n let timer: ReturnType<typeof setTimeout> | undefined;\n onCleanup(() => {\n if (timer) clearTimeout(timer);\n });\n // One live region: a new line is spoken once, and the same words again are a change too.\n createEffect(\n on(\n () => props.current,\n () => {\n setLive(\"\");\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => {\n const line = cell?.querySelector('[data-current=\"true\"]');\n setLive(line ? spokenText(line) : \"\");\n }, 40);\n },\n { defer: true },\n ),\n );\n // A value that cannot be taken sends the focus back into the field, unless the person is somewhere else by now.\n createEffect(\n on(\n () => Boolean(props.invalid),\n (invalid) => {\n if (!invalid) return;\n const active = document.activeElement;\n if (!active || active === document.body || input?.closest(\".k2b-chat-decision\")?.contains(active))\n input?.focus({ preventScroll: true });\n },\n { defer: true },\n ),\n );\n\n // The lock takes the focus from the field; a question that stays open afterwards, such as after a failed save,\n // gives it back, unless the person is somewhere else by now.\n createEffect(\n on(\n () => Boolean(pending()),\n (running, was) => {\n if (running || !was) return;\n const active = document.activeElement;\n if (!active || active === document.body) input?.focus({ preventScroll: true });\n },\n { defer: true },\n ),\n );\n\n const confirm = () => {\n if (props.confirm.busy) return;\n if (question) question.answer(\"confirm\", props.confirm, !confirmOff());\n else if (!confirmOff()) void props.confirm.onSelect();\n };\n const decline = (choice: ChatDecisionAnswer) => {\n if (question) question.answer(\"decline\", choice, !declineOff());\n else if (!declineOff()) void choice.onSelect();\n };\n\n return (\n <>\n <Show when={(props.facts?.length ?? 0) > 0}>\n <div class=\"k2b-chat-decision__details\">\n <div class=\"k2b-chat-decision__facts\">\n <For each={props.facts}>\n {(line) => (\n <p class=\"k2b-chat-line k2b-chat-decision__fact-line\" data-tone={line.tone ?? \"neutral\"}>\n <i class={`k2b-chat-line__icon ${line.icon ?? \"ti ti-info-circle\"}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">{line.text}</span>\n </p>\n )}\n </For>\n </div>\n </div>\n </Show>\n <div class=\"k2b-chat-decision__entry\">\n <div class=\"k2b-chat-decision__field\" onFocusIn={() => question?.edit()}>\n <TextInput\n aria-label={props.label}\n password\n revealLabel={props.revealLabel}\n value={props.value}\n onValueChange={(value) => props.onValueChange(value)}\n onSubmit={confirm}\n placeholder={props.placeholder}\n disabled={locked()}\n error={props.invalid ? props.lines[props.current]?.text : undefined}\n externalErrorId={props.invalid ? lineId(props.current) : undefined}\n aria-describedby={props.invalid ? undefined : lineId(props.current)}\n // A new secret, never a saved password: browsers do not fill it, and password managers neither fill nor offer to keep it.\n autocomplete=\"new-password\"\n data-1p-ignore=\"\"\n data-lpignore=\"true\"\n data-bwignore=\"\"\n data-form-type=\"other\"\n spellcheck={false}\n ref={(element: HTMLInputElement) => {\n input = element;\n props.inputRef?.(element);\n }}\n />\n </div>\n <Button\n class=\"k2b-chat-decision__answer k2b-chat-decision__confirm\"\n variant=\"ai\"\n disabled={confirmOff()}\n aria-disabled={props.confirm.busy || pending() ? \"true\" : undefined}\n aria-busy={props.confirm.busy || pending() === \"confirm\" ? \"true\" : undefined}\n data-busy={props.confirm.busy || pending() === \"confirm\" ? \"\" : undefined}\n onClick={confirm}\n >\n {faces(props.confirm)}\n </Button>\n <p ref={cell} class=\"k2b-chat-decision__line-cell\">\n <For each={keys()}>\n {(key) => (\n <Show when={props.lines[key]}>\n {(line) => (\n <span\n id={lineId(key)}\n class=\"k2b-chat-line k2b-chat-decision__line\"\n data-tone={line().tone ?? \"neutral\"}\n data-current={key === props.current ? \"true\" : undefined}\n aria-hidden={key === props.current ? undefined : \"true\"}\n >\n <i class={`k2b-chat-line__icon ${line().icon ?? \"ti ti-info-circle\"}`} aria-hidden=\"true\" />\n <span class=\"k2b-chat-line__text\">{line().text}</span>\n </span>\n )}\n </Show>\n )}\n </For>\n </p>\n <Show when={props.decline}>\n {(choice) => (\n <Button\n class=\"k2b-chat-decision__answer k2b-chat-decision__decline\"\n variant=\"text\"\n disabled={declineOff()}\n aria-disabled={pending() ? \"true\" : undefined}\n aria-busy={pending() === \"decline\" ? \"true\" : undefined}\n onClick={() => decline(choice())}\n >\n {faces(choice())}\n </Button>\n )}\n </Show>\n <span class=\"k2b-sr-only\" role=\"status\" aria-live=\"polite\">\n {live()}\n </span>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,EAAE,UAAU,EAAE,Y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M,GAAG,SAAS;MAAA;MAAA;QAAA,OAClC,OAAO,CAAC,CAAC,KAAK,SAAS,GAAG,MAAM,GAAG,SAAS;MAAA;MACvD,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;MAAA;QAAA,OAE/B,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;MAAA;IAAA;EAEnB,cAGA,IAAI,CAAC,CAAC;AAKjB","ignoreList":[]}
@@ -7,6 +7,8 @@ import { ChatActivity, ChatActivityToggle, ChatContextUsage, ChatMessage } from
7
7
  import { ChatRoot } from "./ChatRoot";
8
8
  import { ChatTimeline } from "./ChatTimeline";
9
9
  export { ChatComposerQuotes } from "./ChatComposerQuotes";
10
+ // Not a member of `Chat`: a page loads it only where a question asks for a value.
11
+ export { ChatDecisionField } from "./ChatDecisionField";
10
12
  export { formatChatTokens } from "./ChatPrimitives";
11
13
  /**
12
14
  * Portable, controlled chat surface. Applications own storage, streaming,
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["chat/index.ts"],"sourcesContent":["export type { ChatContextPanelProps, ChatContextPopupProps } from \"./ChatContextPopup\";\n\nimport { ChatContextPanel, ChatContextPopup } from \"./ChatContextPopup\";\nimport { ChatTaskList, ChatTasks } from \"./ChatTasks\";\n\nexport type { ChatTask, ChatTaskListProps, ChatTasksProps } from \"./ChatTasks\";\n\nimport { ChatActivityWords } from \"./ChatActivityWords\";\nimport { ChatComposer } from \"./ChatComposer\";\nimport { ChatDecision, ChatOutcome } from \"./ChatDecision\";\nimport { ChatActivity, ChatActivityToggle, ChatContextUsage, ChatMessage } from \"./ChatPrimitives\";\nimport { ChatRoot } from \"./ChatRoot\";\nimport { ChatTimeline } from \"./ChatTimeline\";\n\nexport type { ChatActivityWordsProps } from \"./ChatActivityWords\";\nexport type {\n ChatCommand,\n ChatCommandContext,\n ChatCommandDraft,\n ChatCommandOpenResult,\n ChatCommandResult,\n ChatCommandScope,\n ChatCommandSearch,\n ChatCommandSection,\n ChatComposerPeople,\n ChatComposerProps,\n ChatComposerQuote,\n ChatComposerReply,\n ChatComposerSuggestion,\n ChatFileSelection,\n ChatPasteHandler,\n ChatPersonSuggestion,\n} from \"./ChatComposer\";\nexport { ChatComposerQuotes } from \"./ChatComposerQuotes\";\nexport type { ChatDecisionProps, ChatOutcomeProps } from \"./ChatDecision\";\nexport type {\n ChatActivityMetaTone,\n ChatActivityProps,\n ChatActivityToggleProps,\n ChatContextUsageProps,\n ChatMessageProps,\n} from \"./ChatPrimitives\";\nexport { formatChatTokens } from \"./ChatPrimitives\";\nexport type { ChatRootProps } from \"./ChatRoot\";\nexport type { ChatActivityItem, ChatMessageItem, ChatTimelineItem, ChatTimelineProps } from \"./ChatTimeline\";\nexport type {\n ChatAction,\n ChatActivityTone,\n ChatAttachment,\n ChatComposerEmoji,\n ChatComposerMicrophone,\n ChatComposerState,\n ChatContextUsageData,\n ChatDecisionAnswer,\n ChatDecisionFact,\n ChatDecisionReason,\n ChatDecisionState,\n ChatDictationState,\n ChatMention,\n ChatMessageStatus,\n ChatModelOption,\n ChatOutcomeLine,\n ChatOutcomeTone,\n ChatRole,\n ChatSubmitInput,\n ChatSubmitIntent,\n ChatUsage,\n ChatUsageSection,\n} from \"./types\";\n\n/**\n * Portable, controlled chat surface. Applications own storage, streaming,\n * authorization, rich message rendering, and domain actions.\n */\nexport const Chat = Object.assign(ChatRoot, {\n Tasks: ChatTasks,\n TaskList: ChatTaskList,\n Timeline: ChatTimeline,\n Message: ChatMessage,\n Activity: Object.assign(ChatActivity, { Toggle: ChatActivityToggle, Words: ChatActivityWords }),\n Composer: ChatComposer,\n ContextUsage: ChatContextUsage,\n ContextPopup: ChatContextPopup,\n ContextPanel: ChatContextPanel,\n Decision: ChatDecision,\n Outcome: ChatOutcome,\n});\n\nexport { matchesChatCommand } from \"./command-search\";\nexport { reconcileChatMentions } from \"./composer-document\";\n\nexport { type ReactionPeopleInput, reactionPeople } from \"./reaction-people\";\n"],"mappings":"AAEA,SAAS,gBAAgB,EAAE,gBAAgB,QAAQ,oBAAoB;AACvE,SAAS,YAAY,EAAE,SAAS,QAAQ,aAAa;AAIrD,SAAS,iBAAiB,QAAQ,qBAAqB;AACvD,SAAS,YAAY,QAAQ,gBAAgB;AAC7C,SAAS,YAAY,EAAE,WAAW,QAAQ,gBAAgB;AAC1D,SAAS,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,QAAQ,kBAAkB;AAClG,SAAS,QAAQ,QAAQ,YAAY;AACrC,SAAS,YAAY,QAAQ,gBAAgB;AAqB7C,SAAS,kBAAkB,QAAQ,sBAAsB;AASzD,SAAS,gBAAgB,QAAQ,kBAAkB;AA4BnD;AACA;AACA;AACA;AACA,OAAO,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;EAC1C,KAAK,EAAE,SAAS;EAChB,QAAQ,EAAE,YAAY;EACtB,QAAQ,EAAE,YAAY;EACtB,OAAO,EAAE,WAAW;EACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;IAAE,MAAM,EAAE,kBAAkB;IAAE,KAAK,EAAE;EAAkB,CAAC,CAAC;EAC/F,QAAQ,EAAE,YAAY;EACtB,YAAY,EAAE,gBAAgB;EAC9B,YAAY,EAAE,gBAAgB;EAC9B,YAAY,EAAE,gBAAgB;EAC9B,QAAQ,EAAE,YAAY;EACtB,OAAO,EAAE;AACX,CAAC,CAAC;AAEF,SAAS,kBAAkB,QAAQ,kBAAkB;AACrD,SAAS,qBAAqB,QAAQ,qBAAqB;AAE3D,SAAmC,cAAc,QAAQ,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["chat/index.ts"],"sourcesContent":["export type { ChatContextPanelProps, ChatContextPopupProps } from \"./ChatContextPopup\";\n\nimport { ChatContextPanel, ChatContextPopup } from \"./ChatContextPopup\";\nimport { ChatTaskList, ChatTasks } from \"./ChatTasks\";\n\nexport type { ChatTask, ChatTaskListProps, ChatTasksProps } from \"./ChatTasks\";\n\nimport { ChatActivityWords } from \"./ChatActivityWords\";\nimport { ChatComposer } from \"./ChatComposer\";\nimport { ChatDecision, ChatOutcome } from \"./ChatDecision\";\nimport { ChatActivity, ChatActivityToggle, ChatContextUsage, ChatMessage } from \"./ChatPrimitives\";\nimport { ChatRoot } from \"./ChatRoot\";\nimport { ChatTimeline } from \"./ChatTimeline\";\n\nexport type { ChatActivityWordsProps } from \"./ChatActivityWords\";\nexport type {\n ChatCommand,\n ChatCommandContext,\n ChatCommandDraft,\n ChatCommandOpenResult,\n ChatCommandResult,\n ChatCommandScope,\n ChatCommandSearch,\n ChatCommandSection,\n ChatComposerPeople,\n ChatComposerProps,\n ChatComposerQuote,\n ChatComposerReply,\n ChatComposerSuggestion,\n ChatFileSelection,\n ChatPasteHandler,\n ChatPersonSuggestion,\n} from \"./ChatComposer\";\nexport { ChatComposerQuotes } from \"./ChatComposerQuotes\";\nexport type { ChatDecisionProps, ChatOutcomeProps } from \"./ChatDecision\";\n// Not a member of `Chat`: a page loads it only where a question asks for a value.\nexport { ChatDecisionField, type ChatDecisionFieldProps } from \"./ChatDecisionField\";\nexport type {\n ChatActivityMetaTone,\n ChatActivityProps,\n ChatActivityToggleProps,\n ChatContextUsageProps,\n ChatMessageProps,\n} from \"./ChatPrimitives\";\nexport { formatChatTokens } from \"./ChatPrimitives\";\nexport type { ChatRootProps } from \"./ChatRoot\";\nexport type { ChatActivityItem, ChatMessageItem, ChatTimelineItem, ChatTimelineProps } from \"./ChatTimeline\";\nexport type {\n ChatAction,\n ChatActivityTone,\n ChatAttachment,\n ChatComposerEmoji,\n ChatComposerMicrophone,\n ChatComposerState,\n ChatContextUsageData,\n ChatDecisionAnswer,\n ChatDecisionFact,\n ChatDecisionReason,\n ChatDecisionState,\n ChatDictationState,\n ChatMention,\n ChatMessageStatus,\n ChatModelOption,\n ChatOutcomeLine,\n ChatOutcomeTone,\n ChatRole,\n ChatSubmitInput,\n ChatSubmitIntent,\n ChatUsage,\n ChatUsageSection,\n} from \"./types\";\n\n/**\n * Portable, controlled chat surface. Applications own storage, streaming,\n * authorization, rich message rendering, and domain actions.\n */\nexport const Chat = Object.assign(ChatRoot, {\n Tasks: ChatTasks,\n TaskList: ChatTaskList,\n Timeline: ChatTimeline,\n Message: ChatMessage,\n Activity: Object.assign(ChatActivity, { Toggle: ChatActivityToggle, Words: ChatActivityWords }),\n Composer: ChatComposer,\n ContextUsage: ChatContextUsage,\n ContextPopup: ChatContextPopup,\n ContextPanel: ChatContextPanel,\n Decision: ChatDecision,\n Outcome: ChatOutcome,\n});\n\nexport { matchesChatCommand } from \"./command-search\";\nexport { reconcileChatMentions } from \"./composer-document\";\n\nexport { type ReactionPeopleInput, reactionPeople } from \"./reaction-people\";\n"],"mappings":"AAEA,SAAS,gBAAgB,EAAE,gBAAgB,QAAQ,oBAAoB;AACvE,SAAS,YAAY,EAAE,SAAS,QAAQ,aAAa;AAIrD,SAAS,iBAAiB,QAAQ,qBAAqB;AACvD,SAAS,YAAY,QAAQ,gBAAgB;AAC7C,SAAS,YAAY,EAAE,WAAW,QAAQ,gBAAgB;AAC1D,SAAS,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,QAAQ,kBAAkB;AAClG,SAAS,QAAQ,QAAQ,YAAY;AACrC,SAAS,YAAY,QAAQ,gBAAgB;AAqB7C,SAAS,kBAAkB,QAAQ,sBAAsB;AAEzD;AACA,SAAS,iBAAiB,QAAqC,qBAAqB;AAQpF,SAAS,gBAAgB,QAAQ,kBAAkB;AA4BnD;AACA;AACA;AACA;AACA,OAAO,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;EAC1C,KAAK,EAAE,SAAS;EAChB,QAAQ,EAAE,YAAY;EACtB,QAAQ,EAAE,YAAY;EACtB,OAAO,EAAE,WAAW;EACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;IAAE,MAAM,EAAE,kBAAkB;IAAE,KAAK,EAAE;EAAkB,CAAC,CAAC;EAC/F,QAAQ,EAAE,YAAY;EACtB,YAAY,EAAE,gBAAgB;EAC9B,YAAY,EAAE,gBAAgB;EAC9B,YAAY,EAAE,gBAAgB;EAC9B,QAAQ,EAAE,YAAY;EACtB,OAAO,EAAE;AACX,CAAC,CAAC;AAEF,SAAS,kBAAkB,QAAQ,kBAAkB;AACrD,SAAS,qBAAqB,QAAQ,qBAAqB;AAE3D,SAAmC,cAAc,QAAQ,mBAAmB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["chat/types.ts"],"sourcesContent":["import type { JSX } from \"solid-js\";\nimport type { EmojiSkinTone } from \"../inputs/emoji/emoji-index\";\n\nexport type ChatRole = \"user\" | \"assistant\" | \"system\" | \"tool\";\n\nexport type ChatMessageStatus = \"pending\" | \"streaming\" | \"complete\" | \"error\";\n\n/** `warning` marks a partial result or an outcome that is not yet known. */\nexport type ChatActivityTone = \"neutral\" | \"ai\" | \"success\" | \"warning\" | \"danger\";\n\n/** `open` asks; `sending` while the answer is on its way; `decided` once answered; `expired` when it ran out. */\nexport type ChatDecisionState = \"open\" | \"sending\" | \"decided\" | \"expired\";\n\n/** One answer of a question. Set the question's state in `onSelect` before awaiting anything, so it collapses at once. */\nexport type ChatDecisionAnswer = {\n label: string;\n /** Icon class, for example `ti ti-send`. */\n icon?: string;\n /**\n * The answer was given and Cloud works on it for an unknown time, such as switching something on while the question\n * stays in place. A shimmer runs over the filled button and it takes no second press. Only `confirm` reads it.\n */\n busy?: boolean;\n /** A returned promise holds every answer of the question until it settles; then they work again while it stays open. */\n onSelect: () => void | Promise<void>;\n};\n\n/**\n * A quiet fact in the answer row, such as when the question expires; `success` and `warning` colour it as a result,\n * `ai` as work Gustav does by himself, such as a revision that waits or runs.\n */\nexport type ChatDecisionFact = { text: string; icon: string; tone?: \"neutral\" | \"success\" | \"warning\" | \"danger\" | \"ai\" };\n\n/** Why a question is asked, or why its main answer is off. */\nexport type ChatDecisionReason = {\n text: JSX.Element;\n /** Icon class; the text after it starts 1.5rem from the edge. */\n icon?: string;\n /** `danger` for deletions, `warning` for outside content and limits. */\n tone?: \"neutral\" | \"danger\" | \"warning\";\n};\n\nexport type ChatOutcomeTone = \"running\" | \"done\" | \"off\" | \"waiting\" | \"warning\" | \"error\";\n\n/** One text of an outcome flow. */\nexport type ChatOutcomeLine = {\n tone: ChatOutcomeTone;\n /** What happened, as one sentence, usually with `ReferenceChip`s. */\n text: JSX.Element;\n /** A quiet second sentence, such as \"You declined.\" */\n detail?: JSX.Element;\n /** A formatted time after the text. */\n time?: string;\n /** Replaces the tone's icon, for example `ti ti-clock-x` for an expired question. */\n icon?: string;\n /** One text link after the line, such as \"Ask again\". */\n action?: { label: string; onSelect: () => void | Promise<void> };\n /** Small buttons under the line. Shown while this line is current; otherwise hidden but still reserving their row. */\n actions?: JSX.Element;\n};\n\ntype ChatActionBase = {\n id: string;\n label: string;\n icon?: string;\n variant?: \"danger\";\n disabled?: boolean;\n /** Why the action is off. An icon-only action shows it as its tooltip while `disabled`. */\n disabledReason?: string;\n /** Toggle state for persistent message actions such as feedback. */\n pressed?: boolean;\n /** Semantic foreground for selected feedback actions, without a persistent background. */\n pressedTone?: \"success\" | \"danger\";\n /** With inline actions, listed in the trailing \"More\" menu instead of as its own icon button. */\n overflow?: boolean;\n};\n\n/** Exactly one executable behavior for every chat action. */\nexport type ChatAction = ChatActionBase &\n ({ onSelect: () => void | Promise<void>; copyText?: never } | { copyText: string; onSelect?: never });\n\nexport type ChatAttachment = {\n id: string;\n name: string;\n size?: number;\n kind?: \"file\" | \"image\" | \"resource\";\n icon?: string;\n previewUrl?: string;\n alt?: string;\n /** Optional destination represented by this attachment. */\n href?: string;\n /** Opaque application-owned payload returned unchanged with ChatSubmitInput. */\n data?: unknown;\n /** Optional application-owned action presented below the attachment label. */\n action?: ChatAction;\n /**\n * Upload progress in percent while the attachment uploads, such as a draft that saves its files before sending. The\n * line below the label shows a ring and the percentage instead of `action`.\n */\n progress?: number;\n};\n\nexport type ChatUsage = {\n input?: number;\n output?: number;\n total?: number;\n};\n\nexport type ChatContextUsageData = {\n usage?: ChatUsage | null;\n loopUsage?: ChatUsage | null;\n contextWindow?: number;\n modelLabel?: string;\n /** One short line under the context bar, such as what happens when the context is full. */\n note?: JSX.Element;\n};\n\n/**\n * One application-owned part of the usage control, such as a budget. The control keeps one ring: it shows the highest\n * share of all parts and turns to the warning colour once a part reaches its `warnAt`.\n */\nexport type ChatUsageSection = {\n id: string;\n /** Heading in the details, such as \"Your budget\". */\n title: string;\n /** Used share in percent, or null while it is not known. */\n percent?: number | null;\n /** Share from which this part warns. Defaults to 80. */\n warnAt?: number;\n /** Short text after the heading, such as \"86% used\". */\n value?: string;\n /** This part in the trigger's accessible label, such as \"Budget 86% used\". */\n summary: string;\n /** Details below the heading: bars, `dl` rows, `p` notes, and `.k2b-chat-usage__row` lines with a small action. */\n content?: JSX.Element;\n /** Runs each time the details open, for example to refresh this part. */\n onOpen?: () => void;\n};\n\nexport type ChatModelOption = {\n id: string;\n label: string;\n description?: string;\n image?: string;\n icon?: string;\n capabilities?: readonly string[];\n};\n\nexport type ChatComposerState = \"idle\" | \"submitting\" | \"running\" | \"stopping\";\n\nexport type ChatSubmitIntent = \"send\" | \"steer\" | \"queue\";\n\nexport type ChatSubmitInput = {\n intent: ChatSubmitIntent;\n text: string;\n attachments: readonly ChatAttachment[];\n mentions?: readonly ChatMention[];\n};\n\n/** Ranges use UTF-16 offsets into the untrimmed composer text. Payloads stay application-owned. */\nexport type ChatMention = { start: number; end: number; attachment: ChatAttachment };\n\n/**\n * Live dictation as the caller runs it: `listening` while speech arrives, `refining` after the stop until the refined\n * text replaced it, `refined` afterwards, `unrefined` when the raw text stays, and `interrupted` when the connection\n * ended early and the text so far stays.\n */\nexport type ChatDictationState = \"listening\" | \"refining\" | \"refined\" | \"unrefined\" | \"interrupted\";\n\n/** The composer's microphone. Dictation comes first; a voice message is the deliberate second action. */\nexport type ChatComposerMicrophone = {\n /** A tap starts or stops live dictation. Without it, a tap opens the microphone menu. */\n onDictate?: () => void;\n /** Holding the microphone, or \"Record voice message\" in its menu. Omit it where recording is not available. */\n onVoiceMessage?: () => void;\n /** The dictation state, shown on the microphone and in the hint line. */\n dictation?: ChatDictationState | null;\n /** Offered as \"Restore original\" while `dictation` is `refined`. */\n onRestoreOriginal?: () => void;\n disabled?: boolean;\n};\n\n/**\n * The composer's emoji button and `:shortcode` completion. Typing a colon and two letters suggests emoji by their\n * English or German name or GitHub shortcode; a complete `:thumbsup:` becomes 👍 when its closing colon is typed.\n */\nexport type ChatComposerEmoji = {\n /** Opens the emoji choice next to `anchor`, usually `EmojiPicker.Popover`; `insert` puts the chosen text at the caret. */\n onOpen: (context: { anchor: HTMLElement; insert: (text: string) => void }) => void;\n /** The skin tone of completed emoji that have one, as in the picker. */\n skinTone?: EmojiSkinTone;\n /** Called with each emoji the completion inserted, for example to remember it with `rememberEmoji`. */\n onPick?: (emoji: string) => void;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["chat/types.ts"],"sourcesContent":["import type { JSX } from \"solid-js\";\nimport type { EmojiSkinTone } from \"../inputs/emoji/emoji-index\";\n\nexport type ChatRole = \"user\" | \"assistant\" | \"system\" | \"tool\";\n\nexport type ChatMessageStatus = \"pending\" | \"streaming\" | \"complete\" | \"error\";\n\n/** `warning` marks a partial result or an outcome that is not yet known. */\nexport type ChatActivityTone = \"neutral\" | \"ai\" | \"success\" | \"warning\" | \"danger\";\n\n/** `open` asks; `sending` while the answer is on its way; `decided` once answered; `expired` when it ran out. */\nexport type ChatDecisionState = \"open\" | \"sending\" | \"decided\" | \"expired\";\n\n/** One answer of a question. Set the question's state in `onSelect` before awaiting anything, so it collapses at once. */\nexport type ChatDecisionAnswer = {\n label: string;\n /** Icon class, for example `ti ti-send`. */\n icon?: string;\n /**\n * The answer was given and Cloud works on it for an unknown time, such as switching something on while the question\n * stays in place. A shimmer runs over the filled button and it takes no second press. Only `confirm` reads it.\n */\n busy?: boolean;\n /**\n * The other labels this answer can take while its question stays open, such as \"Saving …\" and \"Try again\" beside\n * \"Save\". All of them share one cell, so the button keeps the width of the widest and a switch moves nothing. Read\n * by the answers of `ChatDecisionField`.\n */\n alternates?: readonly { label: string; icon?: string }[];\n /** A returned promise holds every answer of the question until it settles; then they work again while it stays open. */\n onSelect: () => void | Promise<void>;\n};\n\n/**\n * A quiet fact in the answer row, such as when the question expires; `success` and `warning` colour it as a result,\n * `ai` as work Gustav does by himself, such as a revision that waits or runs.\n */\nexport type ChatDecisionFact = { text: string; icon: string; tone?: \"neutral\" | \"success\" | \"warning\" | \"danger\" | \"ai\" };\n\n/** Why a question is asked, or why its main answer is off. */\nexport type ChatDecisionReason = {\n text: JSX.Element;\n /** Icon class; the text after it starts 1.5rem from the edge. */\n icon?: string;\n /** `danger` for deletions, `warning` for outside content and limits. */\n tone?: \"neutral\" | \"danger\" | \"warning\";\n};\n\nexport type ChatOutcomeTone = \"running\" | \"done\" | \"off\" | \"waiting\" | \"warning\" | \"error\";\n\n/** One text of an outcome flow. */\nexport type ChatOutcomeLine = {\n tone: ChatOutcomeTone;\n /** What happened, as one sentence, usually with `ReferenceChip`s. */\n text: JSX.Element;\n /** A quiet second sentence, such as \"You declined.\" */\n detail?: JSX.Element;\n /** A formatted time after the text. */\n time?: string;\n /** Replaces the tone's icon, for example `ti ti-clock-x` for an expired question. */\n icon?: string;\n /** One text link after the line, such as \"Ask again\". */\n action?: { label: string; onSelect: () => void | Promise<void> };\n /** Small buttons under the line. Shown while this line is current; otherwise hidden but still reserving their row. */\n actions?: JSX.Element;\n};\n\ntype ChatActionBase = {\n id: string;\n label: string;\n icon?: string;\n variant?: \"danger\";\n disabled?: boolean;\n /** Why the action is off. An icon-only action shows it as its tooltip while `disabled`. */\n disabledReason?: string;\n /** Toggle state for persistent message actions such as feedback. */\n pressed?: boolean;\n /** Semantic foreground for selected feedback actions, without a persistent background. */\n pressedTone?: \"success\" | \"danger\";\n /** With inline actions, listed in the trailing \"More\" menu instead of as its own icon button. */\n overflow?: boolean;\n};\n\n/** Exactly one executable behavior for every chat action. */\nexport type ChatAction = ChatActionBase &\n ({ onSelect: () => void | Promise<void>; copyText?: never } | { copyText: string; onSelect?: never });\n\nexport type ChatAttachment = {\n id: string;\n name: string;\n size?: number;\n kind?: \"file\" | \"image\" | \"resource\";\n icon?: string;\n previewUrl?: string;\n alt?: string;\n /** Optional destination represented by this attachment. */\n href?: string;\n /** Opaque application-owned payload returned unchanged with ChatSubmitInput. */\n data?: unknown;\n /** Optional application-owned action presented below the attachment label. */\n action?: ChatAction;\n /**\n * Upload progress in percent while the attachment uploads, such as a draft that saves its files before sending. The\n * line below the label shows a ring and the percentage instead of `action`.\n */\n progress?: number;\n};\n\nexport type ChatUsage = {\n input?: number;\n output?: number;\n total?: number;\n};\n\nexport type ChatContextUsageData = {\n usage?: ChatUsage | null;\n loopUsage?: ChatUsage | null;\n contextWindow?: number;\n modelLabel?: string;\n /** One short line under the context bar, such as what happens when the context is full. */\n note?: JSX.Element;\n};\n\n/**\n * One application-owned part of the usage control, such as a budget. The control keeps one ring: it shows the highest\n * share of all parts and turns to the warning colour once a part reaches its `warnAt`.\n */\nexport type ChatUsageSection = {\n id: string;\n /** Heading in the details, such as \"Your budget\". */\n title: string;\n /** Used share in percent, or null while it is not known. */\n percent?: number | null;\n /** Share from which this part warns. Defaults to 80. */\n warnAt?: number;\n /** Short text after the heading, such as \"86% used\". */\n value?: string;\n /** This part in the trigger's accessible label, such as \"Budget 86% used\". */\n summary: string;\n /** Details below the heading: bars, `dl` rows, `p` notes, and `.k2b-chat-usage__row` lines with a small action. */\n content?: JSX.Element;\n /** Runs each time the details open, for example to refresh this part. */\n onOpen?: () => void;\n};\n\nexport type ChatModelOption = {\n id: string;\n label: string;\n description?: string;\n image?: string;\n icon?: string;\n capabilities?: readonly string[];\n};\n\nexport type ChatComposerState = \"idle\" | \"submitting\" | \"running\" | \"stopping\";\n\nexport type ChatSubmitIntent = \"send\" | \"steer\" | \"queue\";\n\nexport type ChatSubmitInput = {\n intent: ChatSubmitIntent;\n text: string;\n attachments: readonly ChatAttachment[];\n mentions?: readonly ChatMention[];\n};\n\n/** Ranges use UTF-16 offsets into the untrimmed composer text. Payloads stay application-owned. */\nexport type ChatMention = { start: number; end: number; attachment: ChatAttachment };\n\n/**\n * Live dictation as the caller runs it: `listening` while speech arrives, `refining` after the stop until the refined\n * text replaced it, `refined` afterwards, `unrefined` when the raw text stays, and `interrupted` when the connection\n * ended early and the text so far stays.\n */\nexport type ChatDictationState = \"listening\" | \"refining\" | \"refined\" | \"unrefined\" | \"interrupted\";\n\n/** The composer's microphone. Dictation comes first; a voice message is the deliberate second action. */\nexport type ChatComposerMicrophone = {\n /** A tap starts or stops live dictation. Without it, a tap opens the microphone menu. */\n onDictate?: () => void;\n /** Holding the microphone, or \"Record voice message\" in its menu. Omit it where recording is not available. */\n onVoiceMessage?: () => void;\n /** The dictation state, shown on the microphone and in the hint line. */\n dictation?: ChatDictationState | null;\n /** Offered as \"Restore original\" while `dictation` is `refined`. */\n onRestoreOriginal?: () => void;\n disabled?: boolean;\n};\n\n/**\n * The composer's emoji button and `:shortcode` completion. Typing a colon and two letters suggests emoji by their\n * English or German name or GitHub shortcode; a complete `:thumbsup:` becomes 👍 when its closing colon is typed.\n */\nexport type ChatComposerEmoji = {\n /** Opens the emoji choice next to `anchor`, usually `EmojiPicker.Popover`; `insert` puts the chosen text at the caret. */\n onOpen: (context: { anchor: HTMLElement; insert: (text: string) => void }) => void;\n /** The skin tone of completed emoji that have one, as in the picker. */\n skinTone?: EmojiSkinTone;\n /** Called with each emoji the completion inserted, for example to remember it with `rememberEmoji`. */\n onPick?: (emoji: string) => void;\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A separate entry for code that loads a question with a field on demand. Imported from here, it stays out of an
3
+ * island's first JavaScript, because the main entry no longer has to keep it.
4
+ */
5
+ export { ChatDecisionField } from "./chat/ChatDecisionField";
6
+ //# sourceMappingURL=chat-decision-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["chat-decision-field.ts"],"sourcesContent":["/**\n * A separate entry for code that loads a question with a field on demand. Imported from here, it stays out of an\n * island's first JavaScript, because the main entry no longer has to keep it.\n */\nexport { ChatDecisionField, type ChatDecisionFieldProps } from \"./chat/ChatDecisionField\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAAS,iBAAiB,QAAqC,0BAA0B","ignoreList":[]}