@k2b/ui 0.40.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/chat/ChatComposer.js +759 -570
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/inputs/ChoiceGroups.js +30 -18
- package/dist/browser/inputs/ChoiceGroups.js.map +1 -1
- package/dist/browser/inputs/Select.js +32 -19
- package/dist/browser/inputs/Select.js.map +1 -1
- package/dist/browser/inputs/SpecialInputs.js +54 -25
- package/dist/browser/inputs/SpecialInputs.js.map +1 -1
- package/dist/browser/inputs/choice.js +4 -1
- package/dist/browser/inputs/choice.js.map +1 -1
- package/dist/browser/inputs/dictation/Dictation.js +546 -0
- package/dist/browser/inputs/dictation/Dictation.js.map +1 -0
- package/dist/browser/inputs/dictation/create-dictation.js +324 -0
- package/dist/browser/inputs/dictation/create-dictation.js.map +1 -0
- package/dist/browser/inputs/dictation/dictation-messages.js +115 -0
- package/dist/browser/inputs/dictation/dictation-messages.js.map +1 -0
- package/dist/browser/inputs/dictation/text-dictation.js +152 -0
- package/dist/browser/inputs/dictation/text-dictation.js.map +1 -0
- package/dist/browser/inputs/dictation/types.js +2 -0
- package/dist/browser/inputs/dictation/types.js.map +1 -0
- package/dist/browser/inputs/icon-messages.js +29 -2
- package/dist/browser/inputs/icon-messages.js.map +1 -1
- package/dist/browser/inputs/icon-texts.js +172 -0
- package/dist/browser/inputs/icon-texts.js.map +1 -0
- package/dist/browser/inputs/index.js +2 -0
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/layout/AnchoredPopover.js +1 -1
- package/dist/browser/layout/AnchoredPopover.js.map +1 -1
- package/dist/browser/layout/SettingsModal.js +10 -5
- package/dist/browser/layout/SettingsModal.js.map +1 -1
- package/dist/browser/text-editor/TextEditor.js +74 -25
- package/dist/browser/text-editor/TextEditor.js.map +1 -1
- package/dist/browser/text-editor/dictation.js +166 -0
- package/dist/browser/text-editor/dictation.js.map +1 -0
- package/dist/browser/text-editor.js +1 -0
- package/dist/browser/text-editor.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +271 -99
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/inputs/ChoiceGroups.js +12 -3
- package/dist/ssr/inputs/ChoiceGroups.js.map +1 -1
- package/dist/ssr/inputs/Select.js +8 -2
- package/dist/ssr/inputs/Select.js.map +1 -1
- package/dist/ssr/inputs/SpecialInputs.js +54 -25
- package/dist/ssr/inputs/SpecialInputs.js.map +1 -1
- package/dist/ssr/inputs/choice.js +4 -1
- package/dist/ssr/inputs/choice.js.map +1 -1
- package/dist/ssr/inputs/dictation/Dictation.js +386 -0
- package/dist/ssr/inputs/dictation/Dictation.js.map +1 -0
- package/dist/ssr/inputs/dictation/create-dictation.js +324 -0
- package/dist/ssr/inputs/dictation/create-dictation.js.map +1 -0
- package/dist/ssr/inputs/dictation/dictation-messages.js +115 -0
- package/dist/ssr/inputs/dictation/dictation-messages.js.map +1 -0
- package/dist/ssr/inputs/dictation/text-dictation.js +152 -0
- package/dist/ssr/inputs/dictation/text-dictation.js.map +1 -0
- package/dist/ssr/inputs/dictation/types.js +2 -0
- package/dist/ssr/inputs/dictation/types.js.map +1 -0
- package/dist/ssr/inputs/icon-messages.js +29 -2
- package/dist/ssr/inputs/icon-messages.js.map +1 -1
- package/dist/ssr/inputs/icon-texts.js +172 -0
- package/dist/ssr/inputs/icon-texts.js.map +1 -0
- package/dist/ssr/inputs/index.js +2 -0
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/layout/AnchoredPopover.js +1 -1
- package/dist/ssr/layout/AnchoredPopover.js.map +1 -1
- package/dist/ssr/layout/SettingsModal.js +10 -5
- package/dist/ssr/layout/SettingsModal.js.map +1 -1
- package/dist/ssr/text-editor/TextEditor.js +74 -25
- package/dist/ssr/text-editor/TextEditor.js.map +1 -1
- package/dist/ssr/text-editor/dictation.js +166 -0
- package/dist/ssr/text-editor/dictation.js.map +1 -0
- package/dist/ssr/text-editor.js +1 -0
- package/dist/ssr/text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/chat/ChatComposer.d.ts +9 -0
- package/dist/types/inputs/SpecialInputs.d.ts +8 -0
- package/dist/types/inputs/dictation/Dictation.d.ts +26 -0
- package/dist/types/inputs/dictation/create-dictation.d.ts +77 -0
- package/dist/types/inputs/dictation/dictation-messages.d.ts +54 -0
- package/dist/types/inputs/dictation/text-dictation.d.ts +36 -0
- package/dist/types/inputs/dictation/types.d.ts +74 -0
- package/dist/types/inputs/icon-messages.d.ts +14 -0
- package/dist/types/inputs/icon-texts.d.ts +13 -0
- package/dist/types/inputs/index.d.ts +5 -0
- package/dist/types/layout/AnchoredPopover.d.ts +5 -0
- package/dist/types/text-editor/TextEditor.d.ts +10 -1
- package/dist/types/text-editor/dictation.d.ts +20 -0
- package/dist/types/text-editor.d.ts +1 -0
- package/package.json +1 -1
|
@@ -16,55 +16,60 @@ var _tmpl$ = ["<span><strong", ">", "</strong></span>"],
|
|
|
16
16
|
_tmpl$9 = ["<div class=\"k2b-chat-composer__highlight\" aria-hidden=\"true\">", "\n</div>"],
|
|
17
17
|
_tmpl$0 = "<textarea class=\"k2b-chat-composer__measure\" rows=\"1\" tabindex=\"-1\" aria-hidden=\"true\" readonly></textarea>",
|
|
18
18
|
_tmpl$1 = ["<div class=\"k2b-chat-composer__input\" role=\"group\"", ">", "<textarea class=\"", "\" rows=\"1\"", "", "></textarea>", "</div>"],
|
|
19
|
-
_tmpl$10 =
|
|
20
|
-
_tmpl$11 = ["<span class=\"
|
|
21
|
-
_tmpl$12 = ["<span class=\"k2b-chat-composer__command-
|
|
22
|
-
_tmpl$13 = ["<
|
|
23
|
-
_tmpl$14 = ["<
|
|
24
|
-
_tmpl$15 = ["<
|
|
25
|
-
_tmpl$16 = ["<
|
|
26
|
-
_tmpl$17 = ["<span class=\"k2b-message-row__quote-
|
|
27
|
-
_tmpl$18 = ["<
|
|
28
|
-
_tmpl$19 = ["<
|
|
29
|
-
_tmpl$20 = ["<
|
|
30
|
-
_tmpl$21 = ["<div role=\"status\"><i class=\"ti ti-
|
|
31
|
-
_tmpl$22 = ["<div role=\"status\">", "</div>"],
|
|
32
|
-
_tmpl$23 = ["<div
|
|
33
|
-
_tmpl$24 = ["<div class=\"k2b-chat-composer-
|
|
34
|
-
_tmpl$25 = ["<div class=\"k2b-chat-
|
|
35
|
-
_tmpl$26 = ["<div class=\"k2b-chat-
|
|
36
|
-
_tmpl$27 = ["<div class=\"k2b-chat-
|
|
37
|
-
_tmpl$28 = ["<div class=\"k2b-chat-
|
|
38
|
-
_tmpl$29 = ["<div class=\"k2b-chat-
|
|
39
|
-
_tmpl$30 = ["<
|
|
40
|
-
_tmpl$31 = ["<
|
|
41
|
-
_tmpl$32 = ["<
|
|
42
|
-
_tmpl$33 = ["<
|
|
43
|
-
_tmpl$34 = "<
|
|
44
|
-
_tmpl$35 = ["<
|
|
45
|
-
_tmpl$36 = "<
|
|
46
|
-
_tmpl$37 = ["<
|
|
47
|
-
_tmpl$38 =
|
|
48
|
-
_tmpl$39 = ["<
|
|
49
|
-
_tmpl$40 = ["<
|
|
50
|
-
_tmpl$41 = ["<
|
|
51
|
-
_tmpl$42 = ["<button type=\"button\" class=\"k2b-
|
|
52
|
-
_tmpl$43 = ["<
|
|
53
|
-
_tmpl$44 = ["<
|
|
54
|
-
_tmpl$45 = ["<
|
|
55
|
-
_tmpl$46 = ["<div class=\"k2b-chat-composer__attachment
|
|
56
|
-
_tmpl$47 = ["<
|
|
57
|
-
_tmpl$48 = ["<
|
|
58
|
-
_tmpl$49 = ["<
|
|
59
|
-
_tmpl$50 = ["<
|
|
60
|
-
_tmpl$51 = ["<
|
|
61
|
-
_tmpl$52 = ["<
|
|
62
|
-
_tmpl$53 = ["<div class=\"k2b-chat-
|
|
63
|
-
_tmpl$54 = ["<span
|
|
19
|
+
_tmpl$10 = "<span class=\"k2b-dictation-mark\"></span>",
|
|
20
|
+
_tmpl$11 = ["<span class=\"", "\">", "</span>"],
|
|
21
|
+
_tmpl$12 = ["<span class=\"k2b-chat-composer__command-detail\"", "><small", ">", "</small><small", "><i class=\"ti ti-loader-2 k2b-spin\" aria-hidden=\"true\"></i>", "</small></span>"],
|
|
22
|
+
_tmpl$13 = ["<span class=\"k2b-chat-composer__command-end\"><i class=\"ti ti-check\" aria-hidden=\"true\"></i><span class=\"k2b-sr-only\">", "</span></span>"],
|
|
23
|
+
_tmpl$14 = ["<button class=\"k2b-chat-composer__command\"", " type=\"button\" role=\"option\" tabindex=\"-1\"", "><i", " aria-hidden=\"true\"></i><span class=\"k2b-chat-composer__command-text\"><strong>", "</strong>", "</span>", "</button>"],
|
|
24
|
+
_tmpl$15 = ["<b>", "</b>"],
|
|
25
|
+
_tmpl$16 = ["<small", ">", "</small>"],
|
|
26
|
+
_tmpl$17 = ["<span class=\"k2b-message-row__quote-author\"><span class=\"k2b-sr-only\">", " </span>", "</span>"],
|
|
27
|
+
_tmpl$18 = ["<span class=\"k2b-message-row__quote-text\">", "</span>"],
|
|
28
|
+
_tmpl$19 = ["<div class=\"k2b-chat-composer-accessory\"><div", " class=\"k2b-chat-composer__commands\" role=\"listbox\"", ">", "</div></div>"],
|
|
29
|
+
_tmpl$20 = ["<label class=\"k2b-chat-composer__command-search\"><i class=\"ti ti-search\" aria-hidden=\"true\"></i><input type=\"text\" role=\"combobox\"", " aria-autocomplete=\"list\"", " aria-expanded=\"true\"", " autocomplete=\"off\" autocapitalize=\"off\" spellcheck=\"false\"", "></label>"],
|
|
30
|
+
_tmpl$21 = ["<div role=\"status\" class=\"k2b-chat-composer__loading\"><i class=\"ti ti-loader-2 k2b-spin\" aria-hidden=\"true\"></i><strong>", "</strong></div>"],
|
|
31
|
+
_tmpl$22 = ["<div role=\"status\"><i class=\"ti ti-alert-circle\"></i> ", "</div>"],
|
|
32
|
+
_tmpl$23 = ["<div role=\"status\">", "</div>"],
|
|
33
|
+
_tmpl$24 = ["<div class=\"k2b-chat-composer-accessory\" data-commands", ">", "<div", " class=\"k2b-chat-composer__commands\" role=\"listbox\"", ">", "", "", "", "", "</div></div>"],
|
|
34
|
+
_tmpl$25 = ["<div class=\"k2b-chat-composer-slot\"", "><div style=\"", "\"", ">", "</div>", "", "", "</div>"],
|
|
35
|
+
_tmpl$26 = ["<div class=\"k2b-chat-composer__hint\" aria-live=\"polite\">", "</div>"],
|
|
36
|
+
_tmpl$27 = ["<div class=\"k2b-chat-composer__attachments\" role=\"list\"", " tabindex=\"0\">", "</div>"],
|
|
37
|
+
_tmpl$28 = ["<div class=\"k2b-chat-composer__error\" role=\"alert\"><i class=\"ti ti-alert-circle\" aria-hidden=\"true\"></i>", "</div>"],
|
|
38
|
+
_tmpl$29 = ["<div class=\"k2b-chat-composer__dictation\">", "</div>"],
|
|
39
|
+
_tmpl$30 = ["<div class=\"k2b-chat-composer__row\">", "", "<div class=\"k2b-chat-composer__field\">", "<div class=\"k2b-chat-composer__field-tools\">", "", "", "", "</div></div>", "</div>"],
|
|
40
|
+
_tmpl$31 = ["<div class=\"k2b-chat-composer-shell\">", "<section class=\"", "\"", " role=\"group\"", ">", "", "", "", "", "</section><div class=\"k2b-sr-only\" role=\"status\" aria-live=\"polite\">", "</div><div class=\"k2b-chat-composer__status\" role=\"status\">", "", "</div></div>"],
|
|
41
|
+
_tmpl$32 = ["<button id=\"", "\" type=\"button\" role=\"option\" tabindex=\"-1\"", "><span class=\"k2b-chat-composer__emoji-glyph\" aria-hidden=\"true\">", "</span><strong>", "</strong>", "</button>"],
|
|
42
|
+
_tmpl$33 = ["<small>:", ":</small>"],
|
|
43
|
+
_tmpl$34 = ["<small>", "</small>"],
|
|
44
|
+
_tmpl$35 = ["<button id=\"", "\" type=\"button\" role=\"option\" tabindex=\"-1\"", "><i", " aria-hidden=\"true\"></i><strong>", "</strong>", "</button>"],
|
|
45
|
+
_tmpl$36 = "<i class=\"ti ti-loader-2 k2b-spin\" aria-hidden=\"true\"></i>",
|
|
46
|
+
_tmpl$37 = ["<div class=\"k2b-chat-composer__command-group\" role=\"group\"", "><div class=\"k2b-chat-composer__command-heading\"", " role=\"presentation\"><span>", "</span>", "</div>", "", "</div>"],
|
|
47
|
+
_tmpl$38 = "<div class=\"k2b-chat-composer__command-placeholder\" aria-hidden=\"true\"><span></span><span><span></span><span></span></span></div>",
|
|
48
|
+
_tmpl$39 = ["<span class=\"k2b-chat-composer__hint-text\">", "</span>"],
|
|
49
|
+
_tmpl$40 = ["<span class=\"k2b-chat-composer__dictation\"", "><i", " aria-hidden=\"true\"></i><span>", "</span></span>"],
|
|
50
|
+
_tmpl$41 = ["<button type=\"button\" class=\"k2b-chat-composer__hint-action\"", ">", "</button>"],
|
|
51
|
+
_tmpl$42 = ["<div class=\"k2b-chat-composer__reply\">", "<button type=\"button\" class=\"k2b-chat-composer__icon-action k2b-chat-composer__reply-cancel\"", "><i class=\"ti ti-x\" aria-hidden=\"true\"></i></button></div>"],
|
|
52
|
+
_tmpl$43 = ["<div class=\"k2b-message-row__quote\">", "</div>"],
|
|
53
|
+
_tmpl$44 = ["<button type=\"button\" class=\"k2b-message-row__quote\">", "</button>"],
|
|
54
|
+
_tmpl$45 = ["<button type=\"button\" class=\"k2b-chat-composer__attachment-remove\"", "", "><i class=\"ti ti-x\" aria-hidden=\"true\"></i></button>"],
|
|
55
|
+
_tmpl$46 = ["<div class=\"k2b-chat-composer__attachment\" role=\"listitem\"><div class=\"", "\">", "", "</div>", "</div>"],
|
|
56
|
+
_tmpl$47 = ["<img", ">"],
|
|
57
|
+
_tmpl$48 = ["<div class=\"k2b-chat-composer__attachment-identity\">", "", "</div>"],
|
|
58
|
+
_tmpl$49 = ["<a class=\"k2b-chat-composer__attachment-link\"", " target=\"_blank\" rel=\"noopener noreferrer\"", ">", "", "</a>"],
|
|
59
|
+
_tmpl$50 = ["<button type=\"button\" class=\"k2b-chat-composer__attachment-action\"", ">", "", "</button>"],
|
|
60
|
+
_tmpl$51 = ["<footer class=\"k2b-chat-composer__footer\">", "</footer>"],
|
|
61
|
+
_tmpl$52 = ["<div class=\"k2b-chat-composer__tools\">", "", "", "", "", "", "", "</div>"],
|
|
62
|
+
_tmpl$53 = ["<div class=\"k2b-chat-composer__submit\">", "", "", "", "", "", "</div>"],
|
|
63
|
+
_tmpl$54 = ["<span>", "</span>"],
|
|
64
|
+
_tmpl$55 = ["<div class=\"k2b-chat-composer__status-line\"", "><i aria-hidden=\"true\"", "></i><span>", "</span></div>"],
|
|
65
|
+
_tmpl$56 = ["<span class=\"k2b-sr-only\">", "</span>"];
|
|
64
66
|
import { batch, children, createEffect, createMemo, createSignal, createUniqueId, For, Index, on, onCleanup, onMount, Show, untrack } from "solid-js";
|
|
65
67
|
import { Dropdown } from "../actions/Dropdown";
|
|
66
68
|
import { dialogHistorySettled, holdDialogHistory } from "../feedback/dialog-core";
|
|
67
69
|
import { Tooltip } from "../feedback/Tooltip";
|
|
70
|
+
import { createDictation } from "../inputs/dictation/create-dictation";
|
|
71
|
+
import { DictationBar, DictationButton, dictationBarShown } from "../inputs/dictation/Dictation";
|
|
72
|
+
import { beginTextDictation, discardTextDictation, insertTextDictation, mapTextDictation, mapTextOffset, splitDictationSegments } from "../inputs/dictation/text-dictation";
|
|
68
73
|
import { replaceTextareaRange } from "../inputs/editor-dom";
|
|
69
74
|
import { completedEmojiShortcode, emojiInTone, emojiName, emojiShortcodeQuery, loadEmojiIndex, suggestEmoji } from "../inputs/emoji/emoji-index";
|
|
70
75
|
import { FileDropTarget } from "../inputs/FileDropTarget";
|
|
@@ -750,13 +755,126 @@ export function ChatComposer(props) {
|
|
|
750
755
|
syncCaret();
|
|
751
756
|
});
|
|
752
757
|
};
|
|
758
|
+
/** Whether the person placed the caret in this field yet; before that, dictation starts at the end. */
|
|
759
|
+
let caretPlaced = false;
|
|
753
760
|
const syncCaret = () => {
|
|
761
|
+
caretPlaced = true;
|
|
754
762
|
// One update, so no effect sees a half-moved selection (it would read as "no `/` here" and reopen a closed list).
|
|
755
763
|
batch(() => {
|
|
756
764
|
setCaret(textareaRef?.selectionStart ?? props.value.length);
|
|
757
765
|
setSelectionEnd(textareaRef?.selectionEnd ?? props.value.length);
|
|
758
766
|
});
|
|
759
767
|
};
|
|
768
|
+
// Live dictation writes at its own mark. Edits elsewhere move the mark and the dictated ranges along, and the
|
|
769
|
+
// person's own caret stays where it was while words arrive.
|
|
770
|
+
let dictated;
|
|
771
|
+
let dictatedValue = "";
|
|
772
|
+
const [dictationView, setDictationView] = createSignal();
|
|
773
|
+
let freshWords = [];
|
|
774
|
+
let freshTimer;
|
|
775
|
+
const freshMs = 1_500;
|
|
776
|
+
const showDictation = () => {
|
|
777
|
+
if (freshTimer) clearTimeout(freshTimer);
|
|
778
|
+
freshTimer = undefined;
|
|
779
|
+
if (!dictated) {
|
|
780
|
+
freshWords = [];
|
|
781
|
+
setDictationView(undefined);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
const now = performance.now();
|
|
785
|
+
freshWords = freshWords.filter(word => now - word.at < freshMs && word.to > word.from);
|
|
786
|
+
setDictationView({
|
|
787
|
+
mark: dictated.mark,
|
|
788
|
+
fresh: freshWords.map(word => [word.from, word.to])
|
|
789
|
+
});
|
|
790
|
+
if (freshWords.length) freshTimer = setTimeout(showDictation, Math.max(50, freshMs - (now - freshWords[0].at)));
|
|
791
|
+
};
|
|
792
|
+
createEffect(on(() => props.value, value => {
|
|
793
|
+
if (!dictated || value === dictatedValue) return;
|
|
794
|
+
const previous = dictatedValue;
|
|
795
|
+
dictated = mapTextDictation(dictated, previous, value);
|
|
796
|
+
freshWords = freshWords.map(word => ({
|
|
797
|
+
...word,
|
|
798
|
+
from: mapTextOffset(previous, value, word.from, true),
|
|
799
|
+
to: mapTextOffset(previous, value, word.to, false)
|
|
800
|
+
}));
|
|
801
|
+
dictatedValue = value;
|
|
802
|
+
showDictation();
|
|
803
|
+
}));
|
|
804
|
+
const writeDictated = (value, mapSelection) => {
|
|
805
|
+
const field = textareaRef;
|
|
806
|
+
const focused = field && field.ownerDocument.activeElement === field;
|
|
807
|
+
const start = field ? mapSelection(field.selectionStart) : 0;
|
|
808
|
+
const end = field ? mapSelection(field.selectionEnd) : 0;
|
|
809
|
+
dictatedValue = value;
|
|
810
|
+
edit(value);
|
|
811
|
+
autoResize();
|
|
812
|
+
if (!field || !focused) return;
|
|
813
|
+
const restore = () => field.setSelectionRange(Math.min(start, field.value.length), Math.min(end, field.value.length));
|
|
814
|
+
restore();
|
|
815
|
+
queueMicrotask(restore);
|
|
816
|
+
};
|
|
817
|
+
const liveDictation = createDictation({
|
|
818
|
+
source: {
|
|
819
|
+
start: options => props.dictation.source.start(options),
|
|
820
|
+
devices: () => props.dictation?.source.devices() ?? Promise.resolve([])
|
|
821
|
+
},
|
|
822
|
+
get alternative() {
|
|
823
|
+
return props.dictation?.alternative;
|
|
824
|
+
},
|
|
825
|
+
disabled: () => !props.dictation || editBlocked(),
|
|
826
|
+
target: {
|
|
827
|
+
begin: () => {
|
|
828
|
+
if (dictated) {
|
|
829
|
+
dictated = {
|
|
830
|
+
...dictated,
|
|
831
|
+
fresh: true
|
|
832
|
+
};
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
const field = textareaRef;
|
|
836
|
+
dictated = beginTextDictation(field && caretPlaced ? Math.min(field.selectionEnd, props.value.length) : props.value.length);
|
|
837
|
+
dictatedValue = props.value;
|
|
838
|
+
freshWords = [];
|
|
839
|
+
showDictation();
|
|
840
|
+
},
|
|
841
|
+
insert: text => {
|
|
842
|
+
if (!dictated) return;
|
|
843
|
+
const before = dictated.mark;
|
|
844
|
+
const next = insertTextDictation(dictated, props.value, text);
|
|
845
|
+
const added = next.value.length - props.value.length;
|
|
846
|
+
if (!added) return;
|
|
847
|
+
dictated = next.state;
|
|
848
|
+
freshWords.push({
|
|
849
|
+
from: next.state.mark - added,
|
|
850
|
+
to: next.state.mark,
|
|
851
|
+
at: performance.now()
|
|
852
|
+
});
|
|
853
|
+
writeDictated(next.value, offset => offset >= before ? offset + added : offset);
|
|
854
|
+
showDictation();
|
|
855
|
+
},
|
|
856
|
+
discard: () => {
|
|
857
|
+
if (!dictated) return;
|
|
858
|
+
const state = dictated;
|
|
859
|
+
const next = discardTextDictation(state, props.value);
|
|
860
|
+
dictated = undefined;
|
|
861
|
+
writeDictated(next.value, offset => {
|
|
862
|
+
let moved = offset;
|
|
863
|
+
for (const [from, to] of state.ranges) if (offset >= to) moved -= to - from;else if (offset > from) moved -= offset - from;
|
|
864
|
+
return moved;
|
|
865
|
+
});
|
|
866
|
+
showDictation();
|
|
867
|
+
},
|
|
868
|
+
end: () => {
|
|
869
|
+
dictated = undefined;
|
|
870
|
+
showDictation();
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
onCleanup(() => {
|
|
875
|
+
if (freshTimer) clearTimeout(freshTimer);
|
|
876
|
+
});
|
|
877
|
+
const dictating = () => Boolean(props.dictation) && dictationBarShown(liveDictation);
|
|
760
878
|
/** Closes the list opened from "+"; `refocus` gives the field its focus and the selection it had when "+" was pressed. */
|
|
761
879
|
const endAddSearch = refocus => {
|
|
762
880
|
const search = addSearch();
|
|
@@ -813,9 +931,17 @@ export function ChatComposer(props) {
|
|
|
813
931
|
const blocked = () => busy() || submitting();
|
|
814
932
|
/** The conversation field stays editable while a message is sent, so it keeps the focus and a phone its keyboard. */
|
|
815
933
|
const editBlocked = () => conversation() ? busy() : blocked();
|
|
934
|
+
// Dictation belongs to one draft in one editable field: another draft, a field that turns read-only or a host that
|
|
935
|
+
// drops the source ends it; the words so far stay.
|
|
936
|
+
// Memos compare values, so typing and arriving words never end it.
|
|
937
|
+
const dictationField = createMemo(() => `${Boolean(props.dictation)}:${editBlocked()}`);
|
|
938
|
+
const dictationDraft = createMemo(() => props.draftKey);
|
|
939
|
+
createEffect(on([dictationField, dictationDraft], () => liveDictation.end(), {
|
|
940
|
+
defer: true
|
|
941
|
+
}));
|
|
816
942
|
const hasDraft = () => Boolean(props.value.trim() || !running() && attachments().length > 0);
|
|
817
943
|
/** The draft may go out now, apart from a submission that is already on its way. */
|
|
818
|
-
const submittable = () => !busy() && !props.submitDisabled && hasDraft() && !(running() && runningSubmitIntent() === "steer" && mentions().length);
|
|
944
|
+
const submittable = () => !busy() && !props.submitDisabled && hasDraft() && !(props.dictation && liveDictation.active()) && !(running() && runningSubmitIntent() === "steer" && mentions().length);
|
|
819
945
|
const canSubmit = () => !submitting() && submittable();
|
|
820
946
|
const canSelectFiles = () => Boolean(props.fileSelection && !props.fileSelection.disabled && !running() && !blocked());
|
|
821
947
|
const hasAddMenu = () => Boolean(props.fileSelection || props.menuActions?.length);
|
|
@@ -1922,17 +2048,17 @@ export function ChatComposer(props) {
|
|
|
1922
2048
|
});
|
|
1923
2049
|
const field = () => _$ssr(_tmpl$1, _$ssrAttribute("aria-label", _$escape(chatMessages().messageInput, true), false), _$escape(_$createComponent(Show, {
|
|
1924
2050
|
get when() {
|
|
1925
|
-
return mentions().length > 0;
|
|
2051
|
+
return mentions().length > 0 || dictationView();
|
|
1926
2052
|
},
|
|
1927
2053
|
get children() {
|
|
1928
2054
|
return _$ssr(_tmpl$9, _$escape(_$createComponent(For, {
|
|
1929
2055
|
get each() {
|
|
1930
|
-
return chatMentionSegments(props.value, mentions());
|
|
2056
|
+
return splitDictationSegments(chatMentionSegments(props.value, mentions()), dictationView()?.fresh ?? [], dictationView()?.mark);
|
|
1931
2057
|
},
|
|
1932
|
-
children: part => _$ssr(_tmpl$10, Boolean(part.mention) ? "k2b-chat-composer__mention" : ""
|
|
2058
|
+
children: part => part.mark ? _$ssr(_tmpl$10) : _$ssr(_tmpl$11, `${Boolean(part.mention) ? "k2b-chat-composer__mention" : ""} ${Boolean(part.fresh) ? "k2b-dictation-fresh" : ""}`, _$escape(part.text))
|
|
1933
2059
|
})));
|
|
1934
2060
|
}
|
|
1935
|
-
})), mentions().length > 0 ? "k2b-chat-composer__textarea--highlighted" : "", _$ssrAttribute("value", _$escape(props.value, true), false), _$ssrAttribute("disabled", editBlocked() && openingRow() === undefined, true) + _$ssrAttribute("readonly", _$escape(openingRow(), true) !== _$escape(undefined, true), false) + _$ssrAttribute("enterkeyhint", conversation() ? "enter" : _$escape(undefined, true), false) + _$ssrAttribute("placeholder", _$escape(props.placeholder ?? (running() ? chatMessages().addGuidance : conversation() ? chatMessages().writeConversationMessage : chatMessages().writeMessage), true), false) + _$ssrAttribute("aria-label", _$escape(props.inputLabel ?? messages().message, true), false) + _$ssrAttribute("role", fieldOwnsList() ? "combobox" : _$escape(undefined, true), false) + _$ssrAttribute("aria-autocomplete", fieldOwnsList() ? "list" : _$escape(undefined, true), false) + _$ssrAttribute("aria-controls", fieldOwnsList() ? _$escape(commandListId, true) : _$escape(undefined, true), false) + _$ssrAttribute("aria-expanded", fieldOwnsList() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("aria-activedescendant", !fieldOwnsList() ? _$escape(undefined, true) : emojiOpen() || peopleOpen() ? `${_$escape(commandListId, true)}-${_$escape(selectedCommandIndex(), true)}` : selectedCommand() ? _$escape(commandOptionId(selectedCommand()), true) : _$escape(undefined, true), false), _$escape(_$createComponent(Show, {
|
|
2061
|
+
})), mentions().length > 0 || Boolean(dictationView()) ? "k2b-chat-composer__textarea--highlighted" : "", _$ssrAttribute("value", _$escape(props.value, true), false), _$ssrAttribute("disabled", editBlocked() && openingRow() === undefined, true) + _$ssrAttribute("readonly", _$escape(openingRow(), true) !== _$escape(undefined, true), false) + _$ssrAttribute("enterkeyhint", conversation() ? "enter" : _$escape(undefined, true), false) + _$ssrAttribute("placeholder", _$escape(props.placeholder ?? (running() ? chatMessages().addGuidance : conversation() ? chatMessages().writeConversationMessage : chatMessages().writeMessage), true), false) + _$ssrAttribute("aria-label", _$escape(props.inputLabel ?? messages().message, true), false) + _$ssrAttribute("role", fieldOwnsList() ? "combobox" : _$escape(undefined, true), false) + _$ssrAttribute("aria-autocomplete", fieldOwnsList() ? "list" : _$escape(undefined, true), false) + _$ssrAttribute("aria-controls", fieldOwnsList() ? _$escape(commandListId, true) : _$escape(undefined, true), false) + _$ssrAttribute("aria-expanded", fieldOwnsList() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("aria-activedescendant", !fieldOwnsList() ? _$escape(undefined, true) : emojiOpen() || peopleOpen() ? `${_$escape(commandListId, true)}-${_$escape(selectedCommandIndex(), true)}` : selectedCommand() ? _$escape(commandOptionId(selectedCommand()), true) : _$escape(undefined, true), false), _$escape(_$createComponent(Show, {
|
|
1936
2062
|
get when() {
|
|
1937
2063
|
return conversation();
|
|
1938
2064
|
},
|
|
@@ -1976,14 +2102,14 @@ export function ChatComposer(props) {
|
|
|
1976
2102
|
const title = () => command().label ?? command().name;
|
|
1977
2103
|
const opening = () => openingRow() === key;
|
|
1978
2104
|
const failure = () => openFailures()[key];
|
|
1979
|
-
return _$ssr(_tmpl$
|
|
2105
|
+
return _$ssr(_tmpl$14, _$ssrAttribute("id", _$escape(commandOptionId(command()), true), false), _$ssrAttribute("aria-selected", _$escape(selectedCommandKey(), true) === _$escape(key, true), false) + _$ssrAttribute("aria-disabled", _$escape(Boolean(command().disabled || command().reason), true), false) + _$ssrAttribute("aria-busy", opening() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("aria-describedby", command().reason ? `${_$escape(commandOptionId(command()), true)}-reason` : _$escape(undefined, true), false) + _$ssrAttribute("data-reason", command().reason ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-active", selectedCommandKey() === key ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-command-key", _$escape(key, true), false), _$ssrAttribute("class", _$escape(command().icon ?? "ti ti-slash", true), false), _$escape(_$createComponent(Show, {
|
|
1980
2106
|
get when() {
|
|
1981
2107
|
return highlight();
|
|
1982
2108
|
},
|
|
1983
2109
|
get fallback() {
|
|
1984
2110
|
return title();
|
|
1985
2111
|
},
|
|
1986
|
-
children: range => [title().slice(0, range()[0]), _$ssr(_tmpl$
|
|
2112
|
+
children: range => [title().slice(0, range()[0]), _$ssr(_tmpl$15, _$escape(title().slice(range()[0], range()[1]))), title().slice(range()[1])]
|
|
1987
2113
|
})), _$escape(_$createComponent(Show, {
|
|
1988
2114
|
get when() {
|
|
1989
2115
|
return _$memo(() => !!command().open)() && !command().reason;
|
|
@@ -1994,42 +2120,42 @@ export function ChatComposer(props) {
|
|
|
1994
2120
|
return command().reason ?? command().description;
|
|
1995
2121
|
},
|
|
1996
2122
|
get children() {
|
|
1997
|
-
return _$ssr(_tmpl$
|
|
2123
|
+
return _$ssr(_tmpl$16, _$ssrAttribute("id", command().reason ? `${_$escape(commandOptionId(command()), true)}-reason` : _$escape(undefined, true), false), _$escape(command().reason ?? command().description));
|
|
1998
2124
|
}
|
|
1999
2125
|
});
|
|
2000
2126
|
},
|
|
2001
2127
|
get children() {
|
|
2002
|
-
return _$ssr(_tmpl$
|
|
2128
|
+
return _$ssr(_tmpl$12, _$ssrAttribute("data-state", opening() ? "busy" : failure() ? "failed" : _$escape(undefined, true), false), _$ssrAttribute("aria-hidden", opening() ? "true" : _$escape(undefined, true), false), _$escape(failure() ?? command().description), _$ssrAttribute("aria-hidden", opening() ? _$escape(undefined, true) : "true", false), _$escape(command().busyLabel ?? chatMessages().commandOpening));
|
|
2003
2129
|
}
|
|
2004
2130
|
})), _$escape(_$createComponent(Show, {
|
|
2005
2131
|
get when() {
|
|
2006
2132
|
return command().selected;
|
|
2007
2133
|
},
|
|
2008
2134
|
get children() {
|
|
2009
|
-
return _$ssr(_tmpl$
|
|
2135
|
+
return _$ssr(_tmpl$13, _$escape(chatMessages().commandSelected));
|
|
2010
2136
|
}
|
|
2011
2137
|
})));
|
|
2012
2138
|
};
|
|
2013
|
-
const replyQuote = reply => [_$ssr(_tmpl$
|
|
2014
|
-
return _$ssr(_tmpl$
|
|
2139
|
+
const replyQuote = reply => [_$ssr(_tmpl$17, _$escape(chatMessages().replyingTo), _$escape(reply.author)), _$ssr(_tmpl$18, _$escape(reply.text))];
|
|
2140
|
+
return _$ssr(_tmpl$31, _$escape(_$createComponent(Show, {
|
|
2015
2141
|
get when() {
|
|
2016
2142
|
return suggestionsOpen() || hasAccessory();
|
|
2017
2143
|
},
|
|
2018
2144
|
get children() {
|
|
2019
|
-
return _$ssr(_tmpl$
|
|
2145
|
+
return _$ssr(_tmpl$25, _$ssrAttribute("data-overlay", hasAccessory() ? _$escape(undefined, true) : "true", false), _$ssrStyleProperty("visibility:", suggestionsOpen() ? "hidden" : _$escape(undefined, true)), _$ssrAttribute("inert", suggestionsOpen(), true), _$escape(accessory()), _$escape(_$createComponent(Show, {
|
|
2020
2146
|
get when() {
|
|
2021
2147
|
return emojiOpen();
|
|
2022
2148
|
},
|
|
2023
2149
|
get children() {
|
|
2024
|
-
return _$ssr(_tmpl$
|
|
2150
|
+
return _$ssr(_tmpl$19, _$ssrAttribute("id", _$escape(commandListId, true), false), _$ssrAttribute("aria-label", _$escape(chatMessages().emojiSuggestions, true), false), _$escape(_$createComponent(For, {
|
|
2025
2151
|
get each() {
|
|
2026
2152
|
return emojiMatches();
|
|
2027
2153
|
},
|
|
2028
|
-
children: (entry, index) => _$ssr(_tmpl$
|
|
2154
|
+
children: (entry, index) => _$ssr(_tmpl$32, `${_$escape(commandListId, true)}-${_$escape(index(), true)}`, _$ssrAttribute("aria-selected", _$escape(index(), true) === _$escape(selectedCommandIndex(), true), false) + _$ssrAttribute("aria-label", _$escape(emojiName(entry, locale()), true), false) + _$ssrAttribute("data-active", index() === selectedCommandIndex() ? "true" : _$escape(undefined, true), false), _$escape(emojiInTone(entry, props.emoji?.skinTone ?? 0)), _$escape(emojiName(entry, locale())), _$escape(_$createComponent(Show, {
|
|
2029
2155
|
get when() {
|
|
2030
2156
|
return entry.shortcodes[0];
|
|
2031
2157
|
},
|
|
2032
|
-
children: code => _$ssr(_tmpl$
|
|
2158
|
+
children: code => _$ssr(_tmpl$33, _$escape(code()))
|
|
2033
2159
|
})))
|
|
2034
2160
|
})));
|
|
2035
2161
|
}
|
|
@@ -2038,16 +2164,16 @@ export function ChatComposer(props) {
|
|
|
2038
2164
|
return peopleOpen();
|
|
2039
2165
|
},
|
|
2040
2166
|
get children() {
|
|
2041
|
-
return _$ssr(_tmpl$
|
|
2167
|
+
return _$ssr(_tmpl$19, _$ssrAttribute("id", _$escape(commandListId, true), false), _$ssrAttribute("aria-label", _$escape(chatMessages().peopleSuggestions, true), false), _$escape(_$createComponent(For, {
|
|
2042
2168
|
get each() {
|
|
2043
2169
|
return peopleMatches();
|
|
2044
2170
|
},
|
|
2045
|
-
children: (person, index) => _$ssr(_tmpl$
|
|
2171
|
+
children: (person, index) => _$ssr(_tmpl$35, `${_$escape(commandListId, true)}-${_$escape(index(), true)}`, _$ssrAttribute("aria-selected", _$escape(index(), true) === _$escape(selectedCommandIndex(), true), false) + _$ssrAttribute("data-active", index() === selectedCommandIndex() ? "true" : _$escape(undefined, true), false), _$ssrAttribute("class", person.agent ? "ti ti-robot" : "ti ti-user", false), _$escape(person.name), _$escape(_$createComponent(Show, {
|
|
2046
2172
|
get when() {
|
|
2047
2173
|
return person.agent;
|
|
2048
2174
|
},
|
|
2049
2175
|
get children() {
|
|
2050
|
-
return _$ssr(_tmpl$
|
|
2176
|
+
return _$ssr(_tmpl$34, _$escape(chatMessages().agentLabel));
|
|
2051
2177
|
}
|
|
2052
2178
|
})))
|
|
2053
2179
|
})));
|
|
@@ -2057,12 +2183,12 @@ export function ChatComposer(props) {
|
|
|
2057
2183
|
return commandsOpen();
|
|
2058
2184
|
},
|
|
2059
2185
|
get children() {
|
|
2060
|
-
return _$ssr(_tmpl$
|
|
2186
|
+
return _$ssr(_tmpl$24, _$ssrAttribute("data-search", addSearch() ? "" : _$escape(undefined, true), false), _$escape(_$createComponent(Show, {
|
|
2061
2187
|
get when() {
|
|
2062
2188
|
return addSearch();
|
|
2063
2189
|
},
|
|
2064
2190
|
get children() {
|
|
2065
|
-
return _$ssr(_tmpl$
|
|
2191
|
+
return _$ssr(_tmpl$20, _$ssrAttribute("value", _$escape(addQuery(), true), false) + _$ssrAttribute("placeholder", _$escape(chatMessages().commandSearch, true), false) + _$ssrAttribute("aria-label", _$escape(chatMessages().commandSearchLabel, true), false), _$ssrAttribute("aria-controls", _$escape(commandListId, true), false), _$ssrAttribute("aria-activedescendant", selectedCommand() ? _$escape(commandOptionId(selectedCommand()), true) : _$escape(undefined, true), false), _$ssrAttribute("readonly", _$escape(openingRow(), true) !== _$escape(undefined, true), false));
|
|
2066
2192
|
}
|
|
2067
2193
|
})), _$ssrAttribute("id", _$escape(commandListId, true), false), _$ssrAttribute("aria-label", _$escape(chatMessages().commands, true), false) + _$ssrAttribute("aria-busy", searching() ? "true" : _$escape(undefined, true), false), _$escape(_$createComponent(For, {
|
|
2068
2194
|
get each() {
|
|
@@ -2084,12 +2210,12 @@ export function ChatComposer(props) {
|
|
|
2084
2210
|
});
|
|
2085
2211
|
},
|
|
2086
2212
|
get children() {
|
|
2087
|
-
return _$ssr(_tmpl$
|
|
2213
|
+
return _$ssr(_tmpl$37, _$ssrAttribute("aria-labelledby", _$escape(headingId(), true), false), _$ssrAttribute("id", _$escape(headingId(), true), false), _$escape(group()?.scopeTitle ?? group()?.section?.label), _$escape(_$createComponent(Show, {
|
|
2088
2214
|
get when() {
|
|
2089
2215
|
return group()?.loading;
|
|
2090
2216
|
},
|
|
2091
2217
|
get children() {
|
|
2092
|
-
return _$ssr(_tmpl$
|
|
2218
|
+
return _$ssr(_tmpl$36);
|
|
2093
2219
|
}
|
|
2094
2220
|
})), _$escape(_$createComponent(For, {
|
|
2095
2221
|
get each() {
|
|
@@ -2102,7 +2228,7 @@ export function ChatComposer(props) {
|
|
|
2102
2228
|
length: Math.max(group()?.placeholder ? 1 : 0, group()?.pendingRows ?? 0)
|
|
2103
2229
|
});
|
|
2104
2230
|
},
|
|
2105
|
-
children: () => _$ssr(_tmpl$
|
|
2231
|
+
children: () => _$ssr(_tmpl$38)
|
|
2106
2232
|
})));
|
|
2107
2233
|
}
|
|
2108
2234
|
});
|
|
@@ -2112,21 +2238,21 @@ export function ChatComposer(props) {
|
|
|
2112
2238
|
return _$memo(() => !!(searching() && foundCommandCount() === 0))() && !commandModel().groups.some(group => group.section || group.scopeTitle);
|
|
2113
2239
|
},
|
|
2114
2240
|
get children() {
|
|
2115
|
-
return _$ssr(_tmpl$
|
|
2241
|
+
return _$ssr(_tmpl$21, _$escape(messages().loading));
|
|
2116
2242
|
}
|
|
2117
2243
|
})), _$escape(_$createComponent(Show, {
|
|
2118
2244
|
get when() {
|
|
2119
2245
|
return searchError();
|
|
2120
2246
|
},
|
|
2121
2247
|
get children() {
|
|
2122
|
-
return _$ssr(_tmpl$
|
|
2248
|
+
return _$ssr(_tmpl$22, _$escape(messages().error));
|
|
2123
2249
|
}
|
|
2124
2250
|
})), _$escape(_$createComponent(Show, {
|
|
2125
2251
|
get when() {
|
|
2126
2252
|
return _$memo(() => !!(!searching() && !searchError() && foundCommandCount() === 0))() && !commandModel().groups.some(group => group.pendingRows);
|
|
2127
2253
|
},
|
|
2128
2254
|
get children() {
|
|
2129
|
-
return _$ssr(_tmpl$
|
|
2255
|
+
return _$ssr(_tmpl$23, !parsedCommandQuery().query.trim() ? _$escape(messages().noResults) : _$escape(chatMessages().commandsNothingFound({
|
|
2130
2256
|
query: parsedCommandQuery().query.trim()
|
|
2131
2257
|
})));
|
|
2132
2258
|
}
|
|
@@ -2145,18 +2271,18 @@ export function ChatComposer(props) {
|
|
|
2145
2271
|
return showHint();
|
|
2146
2272
|
},
|
|
2147
2273
|
get children() {
|
|
2148
|
-
return _$ssr(_tmpl$
|
|
2274
|
+
return _$ssr(_tmpl$26, _$escape(_$createComponent(Show, {
|
|
2149
2275
|
get when() {
|
|
2150
2276
|
return dictationStatus();
|
|
2151
2277
|
},
|
|
2152
2278
|
get fallback() {
|
|
2153
|
-
return _$ssr(_tmpl$
|
|
2279
|
+
return _$ssr(_tmpl$39, _$escape(hint()));
|
|
2154
2280
|
},
|
|
2155
|
-
children: status => [_$ssr(_tmpl$
|
|
2281
|
+
children: status => [_$ssr(_tmpl$40, _$ssrAttribute("data-state", _$escape(dictation() ?? undefined, true), false), _$ssrAttribute("class", _$escape(status().icon, true), false), _$escape(status().text)), _$createComponent(Show, {
|
|
2156
2282
|
get when() {
|
|
2157
2283
|
return _$memo(() => dictation() === "refined")() ? props.microphone?.onRestoreOriginal : undefined;
|
|
2158
2284
|
},
|
|
2159
|
-
children: restore => _$ssr(_tmpl$
|
|
2285
|
+
children: restore => _$ssr(_tmpl$41, _$ssrAttribute("disabled", microphoneDisabled(), true), _$escape(chatMessages().restoreOriginal))
|
|
2160
2286
|
})]
|
|
2161
2287
|
})));
|
|
2162
2288
|
}
|
|
@@ -2164,30 +2290,30 @@ export function ChatComposer(props) {
|
|
|
2164
2290
|
get when() {
|
|
2165
2291
|
return props.reply;
|
|
2166
2292
|
},
|
|
2167
|
-
children: reply => _$ssr(_tmpl$
|
|
2293
|
+
children: reply => _$ssr(_tmpl$42, _$escape(_$createComponent(Show, {
|
|
2168
2294
|
get when() {
|
|
2169
2295
|
return reply().onSelect;
|
|
2170
2296
|
},
|
|
2171
2297
|
get fallback() {
|
|
2172
|
-
return _$ssr(_tmpl$
|
|
2298
|
+
return _$ssr(_tmpl$43, _$escape(replyQuote(reply())));
|
|
2173
2299
|
},
|
|
2174
|
-
children: select => _$ssr(_tmpl$
|
|
2300
|
+
children: select => _$ssr(_tmpl$44, _$escape(replyQuote(reply())))
|
|
2175
2301
|
})), _$ssrAttribute("aria-label", _$escape(chatMessages().cancelReply, true), false) + _$ssrAttribute("title", _$escape(chatMessages().cancelReply, true), false))
|
|
2176
2302
|
})), _$escape(_$createComponent(Show, {
|
|
2177
2303
|
get when() {
|
|
2178
2304
|
return attachments().length > 0;
|
|
2179
2305
|
},
|
|
2180
2306
|
get children() {
|
|
2181
|
-
return _$ssr(_tmpl$
|
|
2307
|
+
return _$ssr(_tmpl$27, _$ssrAttribute("aria-label", _$escape(chatMessages().attachments, true), false), _$escape(_$createComponent(For, {
|
|
2182
2308
|
get each() {
|
|
2183
2309
|
return attachments();
|
|
2184
2310
|
},
|
|
2185
|
-
children: attachment => _$ssr(_tmpl$
|
|
2311
|
+
children: attachment => _$ssr(_tmpl$46, `k2b-chat-composer__attachment-content ${Boolean(attachment.action) ? "k2b-chat-composer__attachment-content--action" : ""}`, _$escape(_$createComponent(Show, {
|
|
2186
2312
|
get when() {
|
|
2187
2313
|
return attachment.href;
|
|
2188
2314
|
},
|
|
2189
2315
|
get fallback() {
|
|
2190
|
-
return _$ssr(_tmpl$
|
|
2316
|
+
return _$ssr(_tmpl$48, _$escape(_$createComponent(Show, {
|
|
2191
2317
|
get when() {
|
|
2192
2318
|
return _$memo(() => attachment.kind === "image")() && attachment.previewUrl;
|
|
2193
2319
|
},
|
|
@@ -2195,11 +2321,11 @@ export function ChatComposer(props) {
|
|
|
2195
2321
|
return _$ssr(_tmpl$3, _$ssrAttribute("class", _$escape(attachmentIcon(attachment), true), false));
|
|
2196
2322
|
},
|
|
2197
2323
|
get children() {
|
|
2198
|
-
return _$ssr(_tmpl$
|
|
2324
|
+
return _$ssr(_tmpl$47, _$ssrAttribute("src", _$escape(attachment.previewUrl, true), false) + _$ssrAttribute("alt", _$escape(attachment.alt ?? "", true), false));
|
|
2199
2325
|
}
|
|
2200
2326
|
})), _$escape(renderAttachmentCopy(attachment)));
|
|
2201
2327
|
},
|
|
2202
|
-
children: href => _$ssr(_tmpl$
|
|
2328
|
+
children: href => _$ssr(_tmpl$49, _$ssrAttribute("href", _$escape(href(), true), false), _$ssrAttribute("aria-label", _$escape(chatMessages().openInNewTab({
|
|
2203
2329
|
name: attachment.name
|
|
2204
2330
|
}), true), false), _$escape(_$createComponent(Show, {
|
|
2205
2331
|
get when() {
|
|
@@ -2209,14 +2335,14 @@ export function ChatComposer(props) {
|
|
|
2209
2335
|
return _$ssr(_tmpl$3, _$ssrAttribute("class", _$escape(attachmentIcon(attachment), true), false));
|
|
2210
2336
|
},
|
|
2211
2337
|
get children() {
|
|
2212
|
-
return _$ssr(_tmpl$
|
|
2338
|
+
return _$ssr(_tmpl$47, _$ssrAttribute("src", _$escape(attachment.previewUrl, true), false) + _$ssrAttribute("alt", _$escape(attachment.alt ?? "", true), false));
|
|
2213
2339
|
}
|
|
2214
2340
|
})), _$escape(renderAttachmentCopy(attachment)))
|
|
2215
2341
|
})), _$escape(_$createComponent(Show, {
|
|
2216
2342
|
get when() {
|
|
2217
2343
|
return attachment.action;
|
|
2218
2344
|
},
|
|
2219
|
-
children: action => _$ssr(_tmpl$
|
|
2345
|
+
children: action => _$ssr(_tmpl$50, _$ssrAttribute("disabled", blocked() || action().disabled, true), _$escape(_$createComponent(Show, {
|
|
2220
2346
|
get when() {
|
|
2221
2347
|
return action().icon;
|
|
2222
2348
|
},
|
|
@@ -2227,7 +2353,7 @@ export function ChatComposer(props) {
|
|
|
2227
2353
|
return props.onAttachmentsChange;
|
|
2228
2354
|
},
|
|
2229
2355
|
get children() {
|
|
2230
|
-
return _$ssr(_tmpl$
|
|
2356
|
+
return _$ssr(_tmpl$45, _$ssrAttribute("aria-label", _$escape(selectMessages().removeNamed({
|
|
2231
2357
|
name: attachment.name
|
|
2232
2358
|
}), true), false), _$ssrAttribute("disabled", blocked(), true));
|
|
2233
2359
|
}
|
|
@@ -2244,14 +2370,14 @@ export function ChatComposer(props) {
|
|
|
2244
2370
|
return props.error;
|
|
2245
2371
|
},
|
|
2246
2372
|
get children() {
|
|
2247
|
-
return _$ssr(_tmpl$
|
|
2373
|
+
return _$ssr(_tmpl$28, _$escape(props.error));
|
|
2248
2374
|
}
|
|
2249
|
-
}), formatRow(), _$ssr(_tmpl$
|
|
2375
|
+
}), formatRow(), _$ssr(_tmpl$51, _$escape(_$createComponent(Show, {
|
|
2250
2376
|
get when() {
|
|
2251
|
-
return footer();
|
|
2377
|
+
return dictating() || footer();
|
|
2252
2378
|
},
|
|
2253
2379
|
get fallback() {
|
|
2254
|
-
return [_$ssr(_tmpl$
|
|
2380
|
+
return [_$ssr(_tmpl$52, _$escape(props.footerTools), _$escape(_$createComponent(Show, {
|
|
2255
2381
|
get when() {
|
|
2256
2382
|
return addOpensCommands();
|
|
2257
2383
|
},
|
|
@@ -2314,7 +2440,7 @@ export function ChatComposer(props) {
|
|
|
2314
2440
|
}
|
|
2315
2441
|
});
|
|
2316
2442
|
}
|
|
2317
|
-
})), _$escape(props.modelDetails)), _$ssr(_tmpl$
|
|
2443
|
+
})), _$escape(props.modelDetails)), _$ssr(_tmpl$53, _$escape(_$createComponent(For, {
|
|
2318
2444
|
get each() {
|
|
2319
2445
|
return props.contextActions;
|
|
2320
2446
|
},
|
|
@@ -2353,10 +2479,33 @@ export function ChatComposer(props) {
|
|
|
2353
2479
|
return props.onError;
|
|
2354
2480
|
}
|
|
2355
2481
|
}))
|
|
2356
|
-
})), _$escape(props.submitTools), _$escape(
|
|
2482
|
+
})), _$escape(props.submitTools), _$escape(_$createComponent(Show, {
|
|
2483
|
+
get when() {
|
|
2484
|
+
return props.dictation;
|
|
2485
|
+
},
|
|
2486
|
+
get children() {
|
|
2487
|
+
return _$createComponent(DictationButton, {
|
|
2488
|
+
dictation: liveDictation,
|
|
2489
|
+
"class": "k2b-chat-composer__icon-action",
|
|
2490
|
+
cardAnchor: () => shellRef
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
})), _$escape(microphoneControl()), _$escape(sendControl()))];
|
|
2357
2494
|
},
|
|
2358
2495
|
get children() {
|
|
2359
|
-
return
|
|
2496
|
+
return _$createComponent(Show, {
|
|
2497
|
+
get when() {
|
|
2498
|
+
return dictating();
|
|
2499
|
+
},
|
|
2500
|
+
get fallback() {
|
|
2501
|
+
return footer();
|
|
2502
|
+
},
|
|
2503
|
+
get children() {
|
|
2504
|
+
return _$createComponent(DictationBar, {
|
|
2505
|
+
dictation: liveDictation
|
|
2506
|
+
});
|
|
2507
|
+
}
|
|
2508
|
+
});
|
|
2360
2509
|
}
|
|
2361
2510
|
})))];
|
|
2362
2511
|
},
|
|
@@ -2366,9 +2515,32 @@ export function ChatComposer(props) {
|
|
|
2366
2515
|
return props.error;
|
|
2367
2516
|
},
|
|
2368
2517
|
get children() {
|
|
2369
|
-
return _$ssr(_tmpl$
|
|
2518
|
+
return _$ssr(_tmpl$28, _$escape(props.error));
|
|
2519
|
+
}
|
|
2520
|
+
}), _$createComponent(Show, {
|
|
2521
|
+
get when() {
|
|
2522
|
+
return dictating();
|
|
2523
|
+
},
|
|
2524
|
+
get fallback() {
|
|
2525
|
+
return formatRow();
|
|
2526
|
+
},
|
|
2527
|
+
get children() {
|
|
2528
|
+
return _$ssr(_tmpl$29, _$escape(_$createComponent(DictationBar, {
|
|
2529
|
+
dictation: liveDictation
|
|
2530
|
+
})));
|
|
2370
2531
|
}
|
|
2371
|
-
}),
|
|
2532
|
+
}), _$ssr(_tmpl$30, _$escape(attachControl()), _$escape(fileInput()), _$escape(field()), _$escape(formatToggle()), _$escape(emojiButton()), _$escape(_$createComponent(Show, {
|
|
2533
|
+
get when() {
|
|
2534
|
+
return props.dictation;
|
|
2535
|
+
},
|
|
2536
|
+
get children() {
|
|
2537
|
+
return _$createComponent(DictationButton, {
|
|
2538
|
+
dictation: liveDictation,
|
|
2539
|
+
"class": "k2b-chat-composer__icon-action",
|
|
2540
|
+
cardAnchor: () => shellRef
|
|
2541
|
+
});
|
|
2542
|
+
}
|
|
2543
|
+
})), _$escape(microphoneControl()), _$escape(sendControl()))];
|
|
2372
2544
|
}
|
|
2373
2545
|
})), _$escape(_$createComponent(Show, {
|
|
2374
2546
|
get when() {
|
|
@@ -2394,18 +2566,18 @@ export function ChatComposer(props) {
|
|
|
2394
2566
|
return suggestionAnnouncement();
|
|
2395
2567
|
},
|
|
2396
2568
|
keyed: true,
|
|
2397
|
-
children: announced => _$ssr(_tmpl$
|
|
2569
|
+
children: announced => _$ssr(_tmpl$54, _$escape(announced.text))
|
|
2398
2570
|
})), _$escape(_$createComponent(Show, {
|
|
2399
2571
|
get when() {
|
|
2400
2572
|
return _$memo(() => !!!suggestionsOpen())() && commandStatus();
|
|
2401
2573
|
},
|
|
2402
|
-
children: status => _$ssr(_tmpl$
|
|
2574
|
+
children: status => _$ssr(_tmpl$55, _$ssrAttribute("data-tone", _$escape(status().tone, true), false), _$ssrAttribute("class", status().tone === "busy" ? "ti ti-loader-2 k2b-spin" : status().tone === "done" ? "ti ti-check" : "ti ti-alert-circle", false), _$escape(status().text))
|
|
2403
2575
|
})), _$escape(_$createComponent(Show, {
|
|
2404
2576
|
get when() {
|
|
2405
2577
|
return _$memo(() => !!suggestionsOpen())() && announcement();
|
|
2406
2578
|
},
|
|
2407
2579
|
keyed: true,
|
|
2408
|
-
children: announced => _$ssr(_tmpl$
|
|
2580
|
+
children: announced => _$ssr(_tmpl$56, _$escape(announced.text))
|
|
2409
2581
|
})));
|
|
2410
2582
|
}
|
|
2411
2583
|
//# sourceMappingURL=ChatComposer.js.map
|