@k2b/ui 0.17.0 → 0.19.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/README.md +3 -2
- package/dist/browser/actions/ContextMenu.js +3 -1
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/Dropdown.js +91 -46
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/FilterChip.js +4 -1
- package/dist/browser/actions/FilterChip.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +1311 -565
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/chat/ChatPrimitives.js +9 -6
- package/dist/browser/chat/ChatPrimitives.js.map +1 -1
- package/dist/browser/chat/chat-behavior.js +9 -0
- package/dist/browser/chat/chat-behavior.js.map +1 -1
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/chat/types.js.map +1 -1
- package/dist/browser/content/Calendar.js +579 -533
- package/dist/browser/content/Calendar.js.map +1 -1
- package/dist/browser/content/FileView.js +62 -36
- package/dist/browser/content/FileView.js.map +1 -1
- package/dist/browser/content/Lightbox.js +76 -40
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/MarkdownView.js +9 -3
- package/dist/browser/content/MarkdownView.js.map +1 -1
- package/dist/browser/content/PdfPreview.js +146 -79
- package/dist/browser/content/PdfPreview.js.map +1 -1
- package/dist/browser/content/Timeline.js +1038 -0
- package/dist/browser/content/Timeline.js.map +1 -0
- package/dist/browser/content/VideoPlayer.js +299 -0
- package/dist/browser/content/VideoPlayer.js.map +1 -0
- package/dist/browser/content/chart-inspection.js +7 -2
- package/dist/browser/content/chart-inspection.js.map +1 -1
- package/dist/browser/content/file-view-preview.js +2 -2
- package/dist/browser/content/file-view-preview.js.map +1 -1
- package/dist/browser/content/index.js +3 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/markdown-links.js +178 -0
- package/dist/browser/content/markdown-links.js.map +1 -0
- package/dist/browser/content/timeline-model.js +579 -0
- package/dist/browser/content/timeline-model.js.map +1 -0
- package/dist/browser/feedback/dialog-core.js +26 -14
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/inputs/ChoiceChips.js +66 -0
- package/dist/browser/inputs/ChoiceChips.js.map +1 -0
- package/dist/browser/inputs/ChoiceGroups.js +53 -12
- package/dist/browser/inputs/ChoiceGroups.js.map +1 -1
- package/dist/browser/inputs/FileDropTarget.js +129 -0
- package/dist/browser/inputs/FileDropTarget.js.map +1 -0
- package/dist/browser/inputs/FileInputs.js +84 -43
- package/dist/browser/inputs/FileInputs.js.map +1 -1
- package/dist/browser/inputs/SignatureInput.js +558 -0
- package/dist/browser/inputs/SignatureInput.js.map +1 -0
- package/dist/browser/inputs/emoji/EmojiPicker.js +841 -0
- package/dist/browser/inputs/emoji/EmojiPicker.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-data.js +1903 -0
- package/dist/browser/inputs/emoji/emoji-data.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-index.js +209 -0
- package/dist/browser/inputs/emoji/emoji-index.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-messages.js +64 -0
- package/dist/browser/inputs/emoji/emoji-messages.js.map +1 -0
- package/dist/browser/inputs/file-drop.js +338 -0
- package/dist/browser/inputs/file-drop.js.map +1 -0
- package/dist/browser/inputs/index.js +6 -0
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/inputs/markdown/MarkdownEditor.js +72 -78
- package/dist/browser/inputs/markdown/MarkdownEditor.js.map +1 -1
- package/dist/browser/inputs/markdown/actions.js +48 -2
- package/dist/browser/inputs/markdown/actions.js.map +1 -1
- package/dist/browser/inputs/markdown/code-zone.js +38 -2
- package/dist/browser/inputs/markdown/code-zone.js.map +1 -1
- package/dist/browser/inputs/signature-messages.js +39 -0
- package/dist/browser/inputs/signature-messages.js.map +1 -0
- package/dist/browser/inputs/signature.js +208 -0
- package/dist/browser/inputs/signature.js.map +1 -0
- package/dist/browser/internal/render-error.js +49 -0
- package/dist/browser/internal/render-error.js.map +1 -0
- package/dist/browser/intl/messages.js +205 -4
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +483 -218
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/FloatingWindow.js +4 -1
- package/dist/browser/layout/FloatingWindow.js.map +1 -1
- package/dist/browser/layout/Navigation.js +274 -197
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/SidebarItemPreview.js +5 -1
- package/dist/browser/layout/SidebarItemPreview.js.map +1 -1
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/navigation-model.js +2 -0
- package/dist/browser/layout/navigation-model.js.map +1 -1
- package/dist/browser/surfaces/NoticeCard.js +47 -44
- package/dist/browser/surfaces/NoticeCard.js.map +1 -1
- package/dist/browser/surfaces/ResourceCard.js +212 -0
- package/dist/browser/surfaces/ResourceCard.js.map +1 -0
- package/dist/browser/surfaces/index.js +1 -0
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/licenses/emojibase-data.txt +21 -0
- package/dist/ssr/actions/ContextMenu.js +3 -1
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +49 -12
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/FilterChip.js +4 -1
- package/dist/ssr/actions/FilterChip.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +823 -221
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/chat/ChatPrimitives.js +9 -6
- package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
- package/dist/ssr/chat/chat-behavior.js +9 -0
- package/dist/ssr/chat/chat-behavior.js.map +1 -1
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/chat/types.js.map +1 -1
- package/dist/ssr/content/Calendar.js +183 -142
- package/dist/ssr/content/Calendar.js.map +1 -1
- package/dist/ssr/content/FileView.js +30 -6
- package/dist/ssr/content/FileView.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +19 -5
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/MarkdownView.js +9 -3
- package/dist/ssr/content/MarkdownView.js.map +1 -1
- package/dist/ssr/content/PdfPreview.js +77 -36
- package/dist/ssr/content/PdfPreview.js.map +1 -1
- package/dist/ssr/content/Timeline.js +804 -0
- package/dist/ssr/content/Timeline.js.map +1 -0
- package/dist/ssr/content/VideoPlayer.js +228 -0
- package/dist/ssr/content/VideoPlayer.js.map +1 -0
- package/dist/ssr/content/chart-inspection.js +7 -2
- package/dist/ssr/content/chart-inspection.js.map +1 -1
- package/dist/ssr/content/file-view-preview.js +2 -2
- package/dist/ssr/content/file-view-preview.js.map +1 -1
- package/dist/ssr/content/index.js +3 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/markdown-links.js +178 -0
- package/dist/ssr/content/markdown-links.js.map +1 -0
- package/dist/ssr/content/timeline-model.js +579 -0
- package/dist/ssr/content/timeline-model.js.map +1 -0
- package/dist/ssr/feedback/dialog-core.js +26 -14
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/inputs/ChoiceChips.js +66 -0
- package/dist/ssr/inputs/ChoiceChips.js.map +1 -0
- package/dist/ssr/inputs/ChoiceGroups.js +12 -4
- package/dist/ssr/inputs/ChoiceGroups.js.map +1 -1
- package/dist/ssr/inputs/FileDropTarget.js +103 -0
- package/dist/ssr/inputs/FileDropTarget.js.map +1 -0
- package/dist/ssr/inputs/FileInputs.js +49 -12
- package/dist/ssr/inputs/FileInputs.js.map +1 -1
- package/dist/ssr/inputs/SignatureInput.js +404 -0
- package/dist/ssr/inputs/SignatureInput.js.map +1 -0
- package/dist/ssr/inputs/emoji/EmojiPicker.js +551 -0
- package/dist/ssr/inputs/emoji/EmojiPicker.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-data.js +1903 -0
- package/dist/ssr/inputs/emoji/emoji-data.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-index.js +209 -0
- package/dist/ssr/inputs/emoji/emoji-index.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-messages.js +64 -0
- package/dist/ssr/inputs/emoji/emoji-messages.js.map +1 -0
- package/dist/ssr/inputs/file-drop.js +338 -0
- package/dist/ssr/inputs/file-drop.js.map +1 -0
- package/dist/ssr/inputs/index.js +6 -0
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/inputs/markdown/MarkdownEditor.js +14 -2
- package/dist/ssr/inputs/markdown/MarkdownEditor.js.map +1 -1
- package/dist/ssr/inputs/markdown/actions.js +48 -2
- package/dist/ssr/inputs/markdown/actions.js.map +1 -1
- package/dist/ssr/inputs/markdown/code-zone.js +38 -2
- package/dist/ssr/inputs/markdown/code-zone.js.map +1 -1
- package/dist/ssr/inputs/signature-messages.js +39 -0
- package/dist/ssr/inputs/signature-messages.js.map +1 -0
- package/dist/ssr/inputs/signature.js +208 -0
- package/dist/ssr/inputs/signature.js.map +1 -0
- package/dist/ssr/internal/render-error.js +49 -0
- package/dist/ssr/internal/render-error.js.map +1 -0
- package/dist/ssr/intl/messages.js +205 -4
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +264 -47
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/FloatingWindow.js +4 -1
- package/dist/ssr/layout/FloatingWindow.js.map +1 -1
- package/dist/ssr/layout/Navigation.js +169 -122
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/SidebarItemPreview.js +5 -1
- package/dist/ssr/layout/SidebarItemPreview.js.map +1 -1
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/navigation-model.js +2 -0
- package/dist/ssr/layout/navigation-model.js.map +1 -1
- package/dist/ssr/surfaces/NoticeCard.js +17 -12
- package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
- package/dist/ssr/surfaces/ResourceCard.js +115 -0
- package/dist/ssr/surfaces/ResourceCard.js.map +1 -0
- package/dist/ssr/surfaces/index.js +1 -0
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +13 -1
- package/dist/types/actions/FilterChip.d.ts +5 -0
- package/dist/types/chat/ChatComposer.d.ts +24 -1
- package/dist/types/chat/ChatPrimitives.d.ts +1 -1
- package/dist/types/chat/chat-behavior.d.ts +15 -0
- package/dist/types/chat/index.d.ts +1 -1
- package/dist/types/chat/types.d.ts +34 -0
- package/dist/types/content/Calendar.d.ts +28 -8
- package/dist/types/content/Lightbox.d.ts +8 -0
- package/dist/types/content/Timeline.d.ts +49 -0
- package/dist/types/content/VideoPlayer.d.ts +41 -0
- package/dist/types/content/index.d.ts +6 -2
- package/dist/types/content/markdown-links.d.ts +66 -0
- package/dist/types/content/timeline-model.d.ts +148 -0
- package/dist/types/feedback/dialog-core.d.ts +1 -1
- package/dist/types/inputs/ChoiceChips.d.ts +20 -0
- package/dist/types/inputs/ChoiceGroups.d.ts +11 -2
- package/dist/types/inputs/FileDropTarget.d.ts +23 -0
- package/dist/types/inputs/FileInputs.d.ts +8 -0
- package/dist/types/inputs/SignatureInput.d.ts +22 -0
- package/dist/types/inputs/emoji/EmojiPicker.d.ts +42 -0
- package/dist/types/inputs/emoji/emoji-data.d.ts +2 -0
- package/dist/types/inputs/emoji/emoji-index.d.ts +109 -0
- package/dist/types/inputs/emoji/emoji-messages.d.ts +30 -0
- package/dist/types/inputs/file-drop.d.ts +80 -0
- package/dist/types/inputs/index.d.ts +12 -0
- package/dist/types/inputs/markdown/actions.d.ts +4 -0
- package/dist/types/inputs/markdown/code-zone.d.ts +7 -0
- package/dist/types/inputs/signature-messages.d.ts +11 -0
- package/dist/types/inputs/signature.d.ts +72 -0
- package/dist/types/internal/render-error.d.ts +13 -0
- package/dist/types/intl/messages.d.ts +101 -0
- package/dist/types/layout/AppWorkspace.d.ts +38 -0
- package/dist/types/layout/SidebarItemPreview.d.ts +2 -0
- package/dist/types/layout/index.d.ts +2 -2
- package/dist/types/layout/navigation-model.d.ts +18 -0
- package/dist/types/surfaces/ResourceCard.d.ts +31 -0
- package/dist/types/surfaces/index.d.ts +2 -0
- package/package.json +5 -4
|
@@ -1,67 +1,166 @@
|
|
|
1
1
|
import { template as _$template } from "solid-js/web";
|
|
2
2
|
import { delegateEvents as _$delegateEvents } from "solid-js/web";
|
|
3
3
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
4
|
-
import { className as _$className } from "solid-js/web";
|
|
5
|
-
import { runHydrationEvents as _$runHydrationEvents } from "solid-js/web";
|
|
6
|
-
import { setProperty as _$setProperty } from "solid-js/web";
|
|
7
4
|
import { setStyleProperty as _$setStyleProperty } from "solid-js/web";
|
|
5
|
+
import { runHydrationEvents as _$runHydrationEvents } from "solid-js/web";
|
|
8
6
|
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
7
|
+
import { memo as _$memo } from "solid-js/web";
|
|
8
|
+
import { className as _$className } from "solid-js/web";
|
|
9
9
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
10
|
+
import { setProperty as _$setProperty } from "solid-js/web";
|
|
10
11
|
import { use as _$use } from "solid-js/web";
|
|
11
|
-
import { memo as _$memo } from "solid-js/web";
|
|
12
12
|
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
13
13
|
import { effect as _$effect } from "solid-js/web";
|
|
14
14
|
import { getNextElement as _$getNextElement } from "solid-js/web";
|
|
15
15
|
import { insert as _$insert } from "solid-js/web";
|
|
16
16
|
var _tmpl$ = /*#__PURE__*/_$template(`<span><strong>`),
|
|
17
|
-
_tmpl$2 = /*#__PURE__*/_$template(`<
|
|
18
|
-
_tmpl$3 = /*#__PURE__*/_$template(`<
|
|
19
|
-
_tmpl$4 = /*#__PURE__*/_$template(`<
|
|
20
|
-
_tmpl$5 = /*#__PURE__*/_$template(`<div class=k2b-chat-
|
|
21
|
-
_tmpl$6 = /*#__PURE__*/_$template(`<
|
|
22
|
-
_tmpl$7 = /*#__PURE__*/_$template(`<
|
|
23
|
-
_tmpl$8 = /*#__PURE__*/_$template(`<div class=k2b-chat-
|
|
17
|
+
_tmpl$2 = /*#__PURE__*/_$template(`<input class=k2b-sr-only type=file tabindex=-1 aria-hidden=true>`),
|
|
18
|
+
_tmpl$3 = /*#__PURE__*/_$template(`<i aria-hidden=true>`),
|
|
19
|
+
_tmpl$4 = /*#__PURE__*/_$template(`<i class="ti ti-letter-case"aria-hidden=true>`),
|
|
20
|
+
_tmpl$5 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__format role=group>`),
|
|
21
|
+
_tmpl$6 = /*#__PURE__*/_$template(`<i class="ti ti-mood-smile"aria-hidden=true>`),
|
|
22
|
+
_tmpl$7 = /*#__PURE__*/_$template(`<i class="ti ti-chevron-up"aria-hidden=true>`),
|
|
23
|
+
_tmpl$8 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__microphone><!$><!/><!$><!/>`),
|
|
24
24
|
_tmpl$9 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__highlight aria-hidden=true><!$><!/>\n`),
|
|
25
|
-
_tmpl$0 = /*#__PURE__*/_$template(`<
|
|
26
|
-
_tmpl$1 = /*#__PURE__*/_$template(`<div class=k2b-chat-
|
|
27
|
-
_tmpl$10 = /*#__PURE__*/_$template(`<
|
|
28
|
-
_tmpl$11 = /*#__PURE__*/_$template(`<
|
|
29
|
-
_tmpl$12 = /*#__PURE__*/_$template(`<div class=k2b-chat-
|
|
30
|
-
_tmpl$13 = /*#__PURE__*/_$template(`<
|
|
31
|
-
_tmpl$14 = /*#__PURE__*/_$template(`<div
|
|
32
|
-
_tmpl$15 = /*#__PURE__*/_$template(`<
|
|
33
|
-
_tmpl$16 = /*#__PURE__*/_$template(`<
|
|
34
|
-
_tmpl$17 = /*#__PURE__*/_$template(`<
|
|
35
|
-
_tmpl$18 = /*#__PURE__*/_$template(`<
|
|
36
|
-
_tmpl$19 = /*#__PURE__*/_$template(`<i class="ti ti-
|
|
37
|
-
_tmpl$20 = /*#__PURE__*/_$template(`<
|
|
38
|
-
_tmpl$21 = /*#__PURE__*/_$template(`<div class=k2b-chat-
|
|
39
|
-
_tmpl$22 = /*#__PURE__*/_$template(`<
|
|
25
|
+
_tmpl$0 = /*#__PURE__*/_$template(`<textarea class=k2b-chat-composer__measure rows=1 tabindex=-1 aria-hidden=true readonly>`),
|
|
26
|
+
_tmpl$1 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__input role=group><!$><!/><textarea rows=1></textarea><!$><!/>`),
|
|
27
|
+
_tmpl$10 = /*#__PURE__*/_$template(`<span>`),
|
|
28
|
+
_tmpl$11 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-accessory><div class=k2b-chat-composer__commands role=listbox>`),
|
|
29
|
+
_tmpl$12 = /*#__PURE__*/_$template(`<div role=status class=k2b-chat-composer__loading><i class="ti ti-loader-2 k2b-spin"aria-hidden=true></i><strong>`),
|
|
30
|
+
_tmpl$13 = /*#__PURE__*/_$template(`<div role=status><i class="ti ti-alert-circle"></i> <!$><!/>`),
|
|
31
|
+
_tmpl$14 = /*#__PURE__*/_$template(`<div role=status>`),
|
|
32
|
+
_tmpl$15 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-accessory><div class=k2b-chat-composer__commands role=listbox><!$><!/><!$><!/><!$><!/><!$><!/>`),
|
|
33
|
+
_tmpl$16 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-slot><div></div><!$><!/><!$><!/>`),
|
|
34
|
+
_tmpl$17 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__hint aria-live=polite>`),
|
|
35
|
+
_tmpl$18 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachments role=list tabindex=0>`),
|
|
36
|
+
_tmpl$19 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__error role=alert><i class="ti ti-alert-circle"aria-hidden=true></i><!$><!/>`),
|
|
37
|
+
_tmpl$20 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__row><!$><!/><!$><!/><div class=k2b-chat-composer__field><!$><!/><div class=k2b-chat-composer__field-tools><!$><!/><!$><!/><!$><!/></div></div><!$><!/>`),
|
|
38
|
+
_tmpl$21 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-shell><!$><!/><section role=group><!$><!/><!$><!/><!$><!/><!$><!/>`),
|
|
39
|
+
_tmpl$22 = /*#__PURE__*/_$template(`<button type=button role=option tabindex=-1><span class=k2b-chat-composer__emoji-glyph aria-hidden=true></span><strong></strong><!$><!/>`),
|
|
40
|
+
_tmpl$23 = /*#__PURE__*/_$template(`<small>:<!$><!/>:`),
|
|
41
|
+
_tmpl$24 = /*#__PURE__*/_$template(`<button type=button role=option tabindex=-1><i aria-hidden=true></i><strong></strong><small>`),
|
|
42
|
+
_tmpl$25 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__hint-text>`),
|
|
43
|
+
_tmpl$26 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__dictation><i aria-hidden=true></i><span>`),
|
|
44
|
+
_tmpl$27 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__hint-action>`),
|
|
45
|
+
_tmpl$28 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-remove><i class="ti ti-x"aria-hidden=true>`),
|
|
46
|
+
_tmpl$29 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment role=listitem><div class=k2b-chat-composer__attachment-content><!$><!/><!$><!/></div><!$><!/>`),
|
|
47
|
+
_tmpl$30 = /*#__PURE__*/_$template(`<img>`),
|
|
48
|
+
_tmpl$31 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment-identity><!$><!/><!$><!/>`),
|
|
49
|
+
_tmpl$32 = /*#__PURE__*/_$template(`<a class=k2b-chat-composer__attachment-link target=_blank rel="noopener noreferrer"><!$><!/><!$><!/>`),
|
|
50
|
+
_tmpl$33 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-action><!$><!/><!$><!/>`),
|
|
51
|
+
_tmpl$34 = /*#__PURE__*/_$template(`<footer class=k2b-chat-composer__footer>`),
|
|
52
|
+
_tmpl$35 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__tools><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
|
|
53
|
+
_tmpl$36 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__submit><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`);
|
|
40
54
|
import { children, createEffect, createMemo, createSignal, createUniqueId, For, onCleanup, onMount, Show, untrack } from "solid-js";
|
|
41
55
|
import { Dropdown } from "../actions/Dropdown";
|
|
42
56
|
import { Tooltip } from "../feedback/Tooltip";
|
|
57
|
+
import { replaceTextareaRange } from "../inputs/editor-dom";
|
|
58
|
+
import { completedEmojiShortcode, emojiInTone, emojiName, emojiShortcodeQuery, loadEmojiIndex, suggestEmoji } from "../inputs/emoji/emoji-index";
|
|
59
|
+
import { FileDropTarget } from "../inputs/FileDropTarget";
|
|
60
|
+
import { toggleBulletList, toggleCodeBlock, toggleInlineMarker, toggleQuote } from "../inputs/markdown/actions";
|
|
61
|
+
import { openCodeFence } from "../inputs/markdown/code-zone";
|
|
43
62
|
import { SelectChip } from "../inputs/SelectChip";
|
|
63
|
+
import { useLocale } from "../intl/locale";
|
|
44
64
|
import { useUiMessages } from "../intl/messages";
|
|
45
65
|
import { ChatContextUsage as ContextUsage } from "./ChatPrimitives";
|
|
46
|
-
import { executeChatAction, nextChatCommandIndex, reportChatFailure, runChatSubmission } from "./chat-behavior";
|
|
66
|
+
import { conversationEnterAction, executeChatAction, nextChatCommandIndex, reportChatFailure, runChatSubmission } from "./chat-behavior";
|
|
47
67
|
import { chatCommandQuery, chatMentionSegments, reconcileChatMentions } from "./composer-document";
|
|
48
68
|
const composerMaxInputHeight = 309;
|
|
69
|
+
/** Emoji suggestions for a `:shortcode`, as many as fit the list without scrolling on a phone. */
|
|
70
|
+
const emojiSuggestionLimit = 8;
|
|
49
71
|
// Keep editor undo text within approximately 2 MiB, plus the current edit.
|
|
50
72
|
const composerUndoBudgetChars = 1_000_000;
|
|
73
|
+
const insertComposerLink = textarea => {
|
|
74
|
+
const {
|
|
75
|
+
value,
|
|
76
|
+
selectionStart,
|
|
77
|
+
selectionEnd
|
|
78
|
+
} = textarea;
|
|
79
|
+
const label = value.slice(selectionStart, selectionEnd);
|
|
80
|
+
replaceTextareaRange(textarea, selectionStart, selectionEnd, `[${label}]()`);
|
|
81
|
+
// Without a selection the label comes first, otherwise the address.
|
|
82
|
+
const caret = label ? selectionStart + label.length + 3 : selectionStart + 1;
|
|
83
|
+
textarea.setSelectionRange(caret, caret);
|
|
84
|
+
};
|
|
85
|
+
const formatTools = [{
|
|
86
|
+
id: "bold",
|
|
87
|
+
icon: "ti ti-bold",
|
|
88
|
+
label: m => m.boldShortcut,
|
|
89
|
+
run: textarea => toggleInlineMarker(textarea, "**"),
|
|
90
|
+
key: "b"
|
|
91
|
+
}, {
|
|
92
|
+
id: "italic",
|
|
93
|
+
icon: "ti ti-italic",
|
|
94
|
+
label: m => m.italicShortcut,
|
|
95
|
+
run: textarea => toggleInlineMarker(textarea, "*"),
|
|
96
|
+
key: "i"
|
|
97
|
+
}, {
|
|
98
|
+
id: "strikethrough",
|
|
99
|
+
icon: "ti ti-strikethrough",
|
|
100
|
+
label: m => m.strikethroughShortcut,
|
|
101
|
+
run: textarea => toggleInlineMarker(textarea, "~~"),
|
|
102
|
+
shiftCode: "KeyX"
|
|
103
|
+
}, {
|
|
104
|
+
id: "code",
|
|
105
|
+
icon: "ti ti-code",
|
|
106
|
+
label: m => m.inlineCodeShortcut,
|
|
107
|
+
run: textarea => toggleInlineMarker(textarea, "`"),
|
|
108
|
+
key: "e"
|
|
109
|
+
}, {
|
|
110
|
+
id: "code-block",
|
|
111
|
+
icon: "ti ti-source-code",
|
|
112
|
+
label: m => m.codeBlock,
|
|
113
|
+
run: toggleCodeBlock
|
|
114
|
+
}, {
|
|
115
|
+
id: "bullet-list",
|
|
116
|
+
icon: "ti ti-list",
|
|
117
|
+
label: m => m.bulletListShortcut,
|
|
118
|
+
run: toggleBulletList,
|
|
119
|
+
shiftCode: "Digit8"
|
|
120
|
+
}, {
|
|
121
|
+
id: "quote",
|
|
122
|
+
icon: "ti ti-quote",
|
|
123
|
+
label: m => m.quote,
|
|
124
|
+
run: toggleQuote
|
|
125
|
+
}, {
|
|
126
|
+
id: "link",
|
|
127
|
+
icon: "ti ti-link",
|
|
128
|
+
label: m => m.insertLink,
|
|
129
|
+
run: insertComposerLink
|
|
130
|
+
}];
|
|
131
|
+
const formatShortcut = event => {
|
|
132
|
+
if (event.altKey || !(event.ctrlKey || event.metaKey)) return undefined;
|
|
133
|
+
return formatTools.find(tool => event.shiftKey ? tool.shiftCode === event.code : tool.key === event.key.toLowerCase());
|
|
134
|
+
};
|
|
135
|
+
const touchOnlyQuery = "(any-pointer: coarse) and (not (any-pointer: fine))";
|
|
136
|
+
const isTouchOnly = () => typeof matchMedia === "function" && matchMedia(touchOnlyQuery).matches;
|
|
137
|
+
/** How long a press on the microphone lasts before it asks for a voice message instead of dictation. */
|
|
138
|
+
const microphoneHoldMs = 500;
|
|
139
|
+
/** Keeps the field focused (and a phone's keyboard open) when a composer button is pressed with a mouse or finger. */
|
|
140
|
+
const keepFieldFocus = event => event.preventDefault();
|
|
51
141
|
const attachmentIcon = attachment => attachment.icon ?? (attachment.kind === "image" ? "ti ti-photo" : attachment.kind === "resource" ? "ti ti-link" : "ti ti-file");
|
|
142
|
+
const hasContent = items => items.some(item => item != null && typeof item !== "boolean" && item !== "");
|
|
52
143
|
export function ChatComposer(props) {
|
|
53
144
|
const accessory = children(() => props.accessory);
|
|
54
|
-
const hasAccessory = () => accessory.toArray()
|
|
145
|
+
const hasAccessory = () => hasContent(accessory.toArray());
|
|
146
|
+
const hint = children(() => props.hint);
|
|
55
147
|
const messages = useUiMessages();
|
|
56
148
|
const commandListId = `k2b-chat-commands-${createUniqueId().replace(/[^A-Za-z0-9_-]/g, "-")}`;
|
|
149
|
+
const formatGroupId = `${commandListId}-format`;
|
|
57
150
|
const [selectedCommandIndex, setSelectedCommandIndex] = createSignal(0);
|
|
58
|
-
const [dragActive, setDragActive] = createSignal(false);
|
|
59
151
|
const [addingFiles, setAddingFiles] = createSignal(false);
|
|
60
152
|
const [submitting, setSubmitting] = createSignal(false);
|
|
61
153
|
let composerRef;
|
|
62
154
|
let textareaRef;
|
|
63
155
|
let fileInputRef;
|
|
156
|
+
let measureRef;
|
|
157
|
+
let microphoneRef;
|
|
64
158
|
let sawRunning = props.state === "running";
|
|
159
|
+
const conversation = () => props.variant === "conversation";
|
|
160
|
+
const [formattingOpen, setFormattingOpen] = createSignal(false);
|
|
161
|
+
const [microphoneMenuOpen, setMicrophoneMenuOpen] = createSignal(false);
|
|
162
|
+
const dictation = () => props.microphone?.dictation ?? null;
|
|
163
|
+
const showHint = () => conversation() || dictation() !== null || hasContent(hint.toArray());
|
|
65
164
|
const state = () => props.state ?? "idle";
|
|
66
165
|
const running = () => state() === "running";
|
|
67
166
|
const stopping = () => state() === "stopping";
|
|
@@ -78,15 +177,29 @@ export function ChatComposer(props) {
|
|
|
78
177
|
let highlightRef;
|
|
79
178
|
let commandListRef;
|
|
80
179
|
const mentions = () => props.mentions ?? [];
|
|
180
|
+
const locale = useLocale();
|
|
181
|
+
const [emojiIndex, setEmojiIndex] = createSignal();
|
|
182
|
+
const emojiQuery = createMemo(() => !props.emoji || dismissed() || composing() ? null : emojiShortcodeQuery(props.value, caret(), selectionEnd()));
|
|
183
|
+
// The emoji data loads with the first `:shortcode`; a failed load only means no suggestions.
|
|
184
|
+
createEffect(() => {
|
|
185
|
+
if (emojiQuery() && !emojiIndex()) loadEmojiIndex().then(setEmojiIndex, () => undefined);
|
|
186
|
+
});
|
|
187
|
+
const emojiMatches = createMemo(() => {
|
|
188
|
+
const token = emojiQuery();
|
|
189
|
+
const index = emojiIndex();
|
|
190
|
+
return token && index ? suggestEmoji(index, token.query, emojiSuggestionLimit) : [];
|
|
191
|
+
});
|
|
192
|
+
const emojiOpen = () => emojiMatches().length > 0;
|
|
81
193
|
const commandQuery = createMemo(() => dismissed() || composing() ? null : chatCommandQuery(props.value, caret(), selectionEnd()));
|
|
82
194
|
const commandMatches = createMemo(() => {
|
|
83
195
|
const token = commandQuery();
|
|
84
196
|
if (!token) return [];
|
|
85
197
|
return [...(props.commands ?? []).filter(command => command.name.toLowerCase().includes(token.query.toLowerCase())), ...searchResults()];
|
|
86
198
|
});
|
|
87
|
-
const commandsOpen = () => Boolean(commandQuery() && (props.commands?.length || props.searchCommands));
|
|
199
|
+
const commandsOpen = () => Boolean(!emojiOpen() && commandQuery() && (props.commands?.length || props.searchCommands));
|
|
200
|
+
const suggestionsOpen = () => commandsOpen() || emojiOpen();
|
|
88
201
|
createEffect(() => {
|
|
89
|
-
if (!
|
|
202
|
+
if (!suggestionsOpen()) return;
|
|
90
203
|
let disposed = false;
|
|
91
204
|
const measure = () => {
|
|
92
205
|
if (disposed || !commandListRef) return;
|
|
@@ -183,7 +296,10 @@ export function ChatComposer(props) {
|
|
|
183
296
|
setSelectionEnd(textareaRef?.selectionEnd ?? props.value.length);
|
|
184
297
|
};
|
|
185
298
|
const selectedCommand = () => commandMatches()[selectedCommandIndex()];
|
|
186
|
-
const
|
|
299
|
+
const busy = () => Boolean(props.disabled || stopping() || state() === "submitting" || executing() || addingFiles());
|
|
300
|
+
const blocked = () => busy() || submitting();
|
|
301
|
+
/** The conversation field stays editable while a message is sent, so it keeps the focus and a phone its keyboard. */
|
|
302
|
+
const editBlocked = () => conversation() ? busy() : blocked();
|
|
187
303
|
const hasDraft = () => Boolean(props.value.trim() || !running() && attachments().length > 0);
|
|
188
304
|
const canSubmit = () => !blocked() && hasDraft() && !(running() && runningSubmitIntent() === "steer" && mentions().length);
|
|
189
305
|
const canSelectFiles = () => Boolean(props.fileSelection && !props.fileSelection.disabled && !running() && !blocked());
|
|
@@ -203,7 +319,7 @@ export function ChatComposer(props) {
|
|
|
203
319
|
icon: addingFiles() ? "ti ti-loader-2 k2b-spin" : "ti ti-paperclip",
|
|
204
320
|
label: props.fileSelection.label ?? messages().attachFiles,
|
|
205
321
|
disabled: !canSelectFiles(),
|
|
206
|
-
action: () =>
|
|
322
|
+
action: () => chooseFiles()
|
|
207
323
|
});
|
|
208
324
|
}
|
|
209
325
|
for (const action of props.menuActions ?? []) {
|
|
@@ -219,6 +335,14 @@ export function ChatComposer(props) {
|
|
|
219
335
|
};
|
|
220
336
|
const autoResize = () => {
|
|
221
337
|
if (!textareaRef) return;
|
|
338
|
+
if (conversation()) {
|
|
339
|
+
// A hidden copy measures the text. Collapsing the field itself would shrink the composer for a frame, and
|
|
340
|
+
// WebKit then clamps the scroll position of the conversation above it. CSS caps the height.
|
|
341
|
+
if (!measureRef) return;
|
|
342
|
+
measureRef.value = textareaRef.value;
|
|
343
|
+
textareaRef.style.height = `${measureRef.scrollHeight}px`;
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
222
346
|
textareaRef.style.height = "auto";
|
|
223
347
|
textareaRef.style.height = `${Math.min(textareaRef.scrollHeight, composerMaxInputHeight)}px`;
|
|
224
348
|
};
|
|
@@ -226,14 +350,22 @@ export function ChatComposer(props) {
|
|
|
226
350
|
onMount(() => {
|
|
227
351
|
autoResize();
|
|
228
352
|
if (props.focusToken !== undefined) focus();
|
|
353
|
+
// The copy follows the field's width, so a narrower composer measures more lines.
|
|
354
|
+
if (measureRef && typeof ResizeObserver === "function") {
|
|
355
|
+
const observer = new ResizeObserver(() => autoResize());
|
|
356
|
+
observer.observe(measureRef);
|
|
357
|
+
onCleanup(() => observer.disconnect());
|
|
358
|
+
}
|
|
229
359
|
});
|
|
230
360
|
createEffect(() => {
|
|
231
361
|
commandMatches();
|
|
362
|
+
emojiMatches();
|
|
232
363
|
setSelectedCommandIndex(0);
|
|
233
364
|
});
|
|
234
365
|
createEffect(() => {
|
|
235
366
|
const index = selectedCommandIndex();
|
|
236
367
|
commandMatches();
|
|
368
|
+
emojiMatches();
|
|
237
369
|
queueMicrotask(() => {
|
|
238
370
|
const list = commandListRef;
|
|
239
371
|
const item = list?.querySelector(`[id="${commandListId}-${index}"]`);
|
|
@@ -269,6 +401,13 @@ export function ChatComposer(props) {
|
|
|
269
401
|
_$effect(() => _$setAttribute(_el$2, "title", attachment.name));
|
|
270
402
|
return _el$;
|
|
271
403
|
})();
|
|
404
|
+
const chooseFiles = () => {
|
|
405
|
+
const selection = props.fileSelection;
|
|
406
|
+
if (!selection?.choose) return fileInputRef?.click();
|
|
407
|
+
selection.choose().then(
|
|
408
|
+
// A single-file composer keeps the first chosen file, as its file dialog and drops do.
|
|
409
|
+
files => void runFiles(selection.multiple === false ? files.slice(0, 1) : files), error => (props.fileSelection?.onError ?? props.onError)?.(error));
|
|
410
|
+
};
|
|
272
411
|
const runFiles = async files => {
|
|
273
412
|
if (!canSelectFiles()) return;
|
|
274
413
|
const selected = Array.from(files);
|
|
@@ -306,8 +445,17 @@ export function ChatComposer(props) {
|
|
|
306
445
|
},
|
|
307
446
|
perform: () => props.onSubmit(input),
|
|
308
447
|
restore: () => {
|
|
309
|
-
|
|
310
|
-
|
|
448
|
+
// Text typed while the submission ran stays, after the returned draft. Its mentions are read first, because
|
|
449
|
+
// an application may already move them when the text changes.
|
|
450
|
+
const typed = props.value;
|
|
451
|
+
const typedMentions = mentions();
|
|
452
|
+
const shift = previousValue.length + 1;
|
|
453
|
+
props.onValueChange(typed ? `${previousValue}\n${typed}` : previousValue);
|
|
454
|
+
props.onMentionsChange?.(typed ? [...previousMentions, ...typedMentions.map(mention => ({
|
|
455
|
+
...mention,
|
|
456
|
+
start: mention.start + shift,
|
|
457
|
+
end: mention.end + shift
|
|
458
|
+
}))] : previousMentions);
|
|
311
459
|
if (intent !== "steer") setAttachments(previousAttachments);
|
|
312
460
|
},
|
|
313
461
|
onError: props.onError
|
|
@@ -364,13 +512,74 @@ export function ChatComposer(props) {
|
|
|
364
512
|
focus();
|
|
365
513
|
});
|
|
366
514
|
};
|
|
515
|
+
|
|
516
|
+
/** Replaces `start`–`end` with the emoji through the editing path, so the browser's undo restores the shortcode. */
|
|
517
|
+
const insertEmoji = (start, end, emoji) => {
|
|
518
|
+
if (!textareaRef || editBlocked()) return;
|
|
519
|
+
replaceTextareaRange(textareaRef, start, end, emoji);
|
|
520
|
+
syncCaret();
|
|
521
|
+
reportChatFailure(() => props.emoji?.onPick?.(emoji), props.onError);
|
|
522
|
+
};
|
|
523
|
+
const pickEmojiSuggestion = position => {
|
|
524
|
+
const token = emojiQuery();
|
|
525
|
+
const entry = emojiMatches()[position];
|
|
526
|
+
if (!token || !entry) return;
|
|
527
|
+
insertEmoji(token.start, token.end, emojiInTone(entry, props.emoji?.skinTone ?? 0));
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* A typed colon loads the emoji data, and the closing colon of a known `:shortcode:` turns it into its emoji. A
|
|
531
|
+
* shortcode closed before the data arrived turns when it arrives, as long as nothing changed in the meantime.
|
|
532
|
+
*/
|
|
533
|
+
const completeShortcode = () => {
|
|
534
|
+
const textarea = textareaRef;
|
|
535
|
+
if (!props.emoji || !textarea) return;
|
|
536
|
+
const {
|
|
537
|
+
value,
|
|
538
|
+
selectionStart: caret
|
|
539
|
+
} = textarea;
|
|
540
|
+
const completed = completedEmojiShortcode(value, caret);
|
|
541
|
+
const convert = index => {
|
|
542
|
+
const entry = completed && index.byShortcode.get(completed.shortcode.toLowerCase());
|
|
543
|
+
if (completed && entry) insertEmoji(completed.start, completed.end, emojiInTone(entry, props.emoji?.skinTone ?? 0));
|
|
544
|
+
};
|
|
545
|
+
const index = emojiIndex();
|
|
546
|
+
if (index) {
|
|
547
|
+
convert(index);
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
loadEmojiIndex().then(loaded => {
|
|
551
|
+
setEmojiIndex(loaded);
|
|
552
|
+
const untouched = textarea.value === value && textarea.selectionStart === caret && textarea.selectionEnd === caret;
|
|
553
|
+
if (untouched && textarea.matches(":focus")) convert(loaded);
|
|
554
|
+
}, () => undefined);
|
|
555
|
+
};
|
|
367
556
|
const onKeyDown = event => {
|
|
368
|
-
|
|
557
|
+
// WebKit ends the composition before the keydown of the Enter that confirms it; that keydown keeps keyCode 229.
|
|
558
|
+
if (event.isComposing || event.keyCode === 229 || composing()) return;
|
|
369
559
|
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "z") {
|
|
370
560
|
event.preventDefault();
|
|
371
561
|
restoreHistory(event.shiftKey ? 1 : -1);
|
|
372
562
|
return;
|
|
373
563
|
}
|
|
564
|
+
if (emojiOpen()) {
|
|
565
|
+
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
566
|
+
event.preventDefault();
|
|
567
|
+
setSelectedCommandIndex(index => nextChatCommandIndex(index, emojiMatches().length, event.key === "ArrowUp" ? -1 : 1));
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
// Only a plain Enter or Tab picks: Shift+Enter still breaks the line, Shift+Tab still moves the focus back.
|
|
571
|
+
const plain = !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
572
|
+
if (plain && (event.key === "Enter" || event.key === "Tab")) {
|
|
573
|
+
event.preventDefault();
|
|
574
|
+
pickEmojiSuggestion(selectedCommandIndex());
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
if (event.key === "Escape") {
|
|
578
|
+
event.preventDefault();
|
|
579
|
+
setDismissed(true);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
374
583
|
const matches = commandMatches();
|
|
375
584
|
if (commandsOpen()) {
|
|
376
585
|
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
@@ -378,7 +587,8 @@ export function ChatComposer(props) {
|
|
|
378
587
|
setSelectedCommandIndex(index => nextChatCommandIndex(index, matches.length, event.key === "ArrowUp" ? -1 : 1));
|
|
379
588
|
return;
|
|
380
589
|
}
|
|
381
|
-
|
|
590
|
+
// Ctrl/⌘+Enter sends, also while suggestions are open.
|
|
591
|
+
if ((event.key === "Tab" || event.key === "Enter" && !event.ctrlKey && !event.metaKey) && matches.length > 0) {
|
|
382
592
|
event.preventDefault();
|
|
383
593
|
const command = selectedCommand();
|
|
384
594
|
if (command) void executeCommand(command);
|
|
@@ -390,79 +600,700 @@ export function ChatComposer(props) {
|
|
|
390
600
|
return;
|
|
391
601
|
}
|
|
392
602
|
}
|
|
393
|
-
|
|
603
|
+
const format = props.formatting && textareaRef ? formatShortcut(event) : undefined;
|
|
604
|
+
if (format && textareaRef) {
|
|
605
|
+
event.preventDefault();
|
|
606
|
+
format.run(textareaRef);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
if (event.key !== "Enter") return;
|
|
610
|
+
if (conversation()) {
|
|
611
|
+
const action = conversationEnterAction(event, {
|
|
612
|
+
sendKey: props.sendKey ?? "enter",
|
|
613
|
+
touchOnly: isTouchOnly(),
|
|
614
|
+
inCodeBlock: openCodeFence(props.value, textareaRef?.selectionStart ?? props.value.length) !== null
|
|
615
|
+
});
|
|
616
|
+
if (action === "send") {
|
|
617
|
+
event.preventDefault();
|
|
618
|
+
void submit();
|
|
619
|
+
}
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
const send = props.sendKey === "mod-enter" ? event.ctrlKey || event.metaKey : !event.shiftKey;
|
|
623
|
+
if (send && !event.isComposing) {
|
|
394
624
|
event.preventDefault();
|
|
395
625
|
void submit();
|
|
396
626
|
}
|
|
397
627
|
};
|
|
628
|
+
const insertText = text => {
|
|
629
|
+
if (!textareaRef || editBlocked()) return;
|
|
630
|
+
replaceTextareaRange(textareaRef, textareaRef.selectionStart, textareaRef.selectionEnd, text);
|
|
631
|
+
};
|
|
632
|
+
let holdTimer;
|
|
633
|
+
let held = false;
|
|
634
|
+
const releaseHold = () => {
|
|
635
|
+
clearTimeout(holdTimer);
|
|
636
|
+
holdTimer = undefined;
|
|
637
|
+
};
|
|
638
|
+
onCleanup(releaseHold);
|
|
639
|
+
const microphoneDisabled = () => Boolean(props.microphone?.disabled || blocked() || dictation() === "refining");
|
|
640
|
+
const microphoneItems = () => {
|
|
641
|
+
const microphone = props.microphone;
|
|
642
|
+
const items = [];
|
|
643
|
+
if (microphone?.onDictate) {
|
|
644
|
+
const dictate = microphone.onDictate;
|
|
645
|
+
items.push({
|
|
646
|
+
icon: "ti ti-microphone",
|
|
647
|
+
label: messages().dictate,
|
|
648
|
+
action: () => reportChatFailure(dictate, props.onError)
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
if (microphone?.onVoiceMessage) {
|
|
652
|
+
const record = microphone.onVoiceMessage;
|
|
653
|
+
items.push({
|
|
654
|
+
icon: "ti ti-player-record",
|
|
655
|
+
label: messages().recordVoiceMessage,
|
|
656
|
+
action: () => reportChatFailure(record, props.onError)
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
return items;
|
|
660
|
+
};
|
|
661
|
+
const dictationStatus = () => {
|
|
662
|
+
switch (dictation()) {
|
|
663
|
+
case "listening":
|
|
664
|
+
return {
|
|
665
|
+
icon: "ti ti-microphone",
|
|
666
|
+
text: messages().dictationListening
|
|
667
|
+
};
|
|
668
|
+
case "refining":
|
|
669
|
+
return {
|
|
670
|
+
icon: "ti ti-loader-2 k2b-spin",
|
|
671
|
+
text: messages().dictationRefining
|
|
672
|
+
};
|
|
673
|
+
case "refined":
|
|
674
|
+
return {
|
|
675
|
+
icon: "ti ti-sparkles",
|
|
676
|
+
text: messages().dictationRefined
|
|
677
|
+
};
|
|
678
|
+
case "unrefined":
|
|
679
|
+
return {
|
|
680
|
+
icon: "ti ti-microphone",
|
|
681
|
+
text: messages().dictationUnrefined
|
|
682
|
+
};
|
|
683
|
+
case "interrupted":
|
|
684
|
+
return {
|
|
685
|
+
icon: "ti ti-alert-triangle",
|
|
686
|
+
text: messages().dictationInterrupted
|
|
687
|
+
};
|
|
688
|
+
default:
|
|
689
|
+
return null;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
const fileInput = () => _$createComponent(Show, {
|
|
693
|
+
get when() {
|
|
694
|
+
return props.fileSelection;
|
|
695
|
+
},
|
|
696
|
+
get children() {
|
|
697
|
+
var _el$3 = _$getNextElement(_tmpl$2);
|
|
698
|
+
_el$3.addEventListener("change", event => {
|
|
699
|
+
if (event.currentTarget.files?.length) void runFiles(event.currentTarget.files);
|
|
700
|
+
});
|
|
701
|
+
var _ref$ = fileInputRef;
|
|
702
|
+
typeof _ref$ === "function" ? _$use(_ref$, _el$3) : fileInputRef = _el$3;
|
|
703
|
+
_$effect(_p$ => {
|
|
704
|
+
var _v$ = props.fileSelection?.accept,
|
|
705
|
+
_v$2 = props.fileSelection?.multiple ?? true;
|
|
706
|
+
_v$ !== _p$.e && _$setAttribute(_el$3, "accept", _p$.e = _v$);
|
|
707
|
+
_v$2 !== _p$.t && _$setProperty(_el$3, "multiple", _p$.t = _v$2);
|
|
708
|
+
return _p$;
|
|
709
|
+
}, {
|
|
710
|
+
e: undefined,
|
|
711
|
+
t: undefined
|
|
712
|
+
});
|
|
713
|
+
return _el$3;
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
const addMenu = (icon, extraClass = "") => _$createComponent(Dropdown.Root, {
|
|
717
|
+
position: "top-right",
|
|
718
|
+
get label() {
|
|
719
|
+
return messages().addToChat;
|
|
720
|
+
},
|
|
721
|
+
get items() {
|
|
722
|
+
return menuItems();
|
|
723
|
+
},
|
|
724
|
+
get disabled() {
|
|
725
|
+
return blocked();
|
|
726
|
+
},
|
|
727
|
+
get children() {
|
|
728
|
+
return _$createComponent(Dropdown.Trigger, {
|
|
729
|
+
appearance: "plain",
|
|
730
|
+
"class": `k2b-chat-composer__icon-action${extraClass}`,
|
|
731
|
+
get label() {
|
|
732
|
+
return messages().addToChat;
|
|
733
|
+
},
|
|
734
|
+
get tooltip() {
|
|
735
|
+
return messages().addToChat;
|
|
736
|
+
},
|
|
737
|
+
get children() {
|
|
738
|
+
var _el$4 = _$getNextElement(_tmpl$3);
|
|
739
|
+
_$className(_el$4, icon);
|
|
740
|
+
return _el$4;
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
/** The conversation's attach button opens the file choice directly; other actions turn it into the add menu. */
|
|
747
|
+
const attachControl = () => _$createComponent(Show, {
|
|
748
|
+
get when() {
|
|
749
|
+
return props.menuActions?.length;
|
|
750
|
+
},
|
|
751
|
+
get fallback() {
|
|
752
|
+
return _$createComponent(Show, {
|
|
753
|
+
get when() {
|
|
754
|
+
return props.fileSelection;
|
|
755
|
+
},
|
|
756
|
+
children: selection => _$createComponent(Tooltip.Trigger, {
|
|
757
|
+
type: "button",
|
|
758
|
+
"class": "k2b-chat-composer__icon-action k2b-chat-composer__attach",
|
|
759
|
+
get ["aria-label"]() {
|
|
760
|
+
return selection().label ?? messages().attachFiles;
|
|
761
|
+
},
|
|
762
|
+
get content() {
|
|
763
|
+
return selection().label ?? messages().attachFiles;
|
|
764
|
+
},
|
|
765
|
+
get disabled() {
|
|
766
|
+
return !canSelectFiles();
|
|
767
|
+
},
|
|
768
|
+
onClick: chooseFiles,
|
|
769
|
+
get children() {
|
|
770
|
+
var _el$5 = _$getNextElement(_tmpl$3);
|
|
771
|
+
_$effect(() => _$className(_el$5, addingFiles() ? "ti ti-loader-2 k2b-spin" : "ti ti-paperclip"));
|
|
772
|
+
return _el$5;
|
|
773
|
+
}
|
|
774
|
+
})
|
|
775
|
+
});
|
|
776
|
+
},
|
|
777
|
+
get children() {
|
|
778
|
+
return addMenu("ti ti-plus", " k2b-chat-composer__attach");
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
const formatToggle = () => _$createComponent(Show, {
|
|
782
|
+
get when() {
|
|
783
|
+
return props.formatting;
|
|
784
|
+
},
|
|
785
|
+
get children() {
|
|
786
|
+
return _$createComponent(Tooltip.Trigger, {
|
|
787
|
+
type: "button",
|
|
788
|
+
"class": "k2b-chat-composer__icon-action k2b-chat-composer__format-toggle",
|
|
789
|
+
get ["aria-label"]() {
|
|
790
|
+
return messages().composerFormatting;
|
|
791
|
+
},
|
|
792
|
+
get ["aria-pressed"]() {
|
|
793
|
+
return formattingOpen();
|
|
794
|
+
},
|
|
795
|
+
get ["aria-controls"]() {
|
|
796
|
+
return formattingOpen() ? formatGroupId : undefined;
|
|
797
|
+
},
|
|
798
|
+
get content() {
|
|
799
|
+
return messages().composerFormatting;
|
|
800
|
+
},
|
|
801
|
+
onMouseDown: keepFieldFocus,
|
|
802
|
+
onClick: () => setFormattingOpen(open => !open),
|
|
803
|
+
get children() {
|
|
804
|
+
return _$getNextElement(_tmpl$4);
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
/** One row of fixed height. It shows every button at once, also on a phone, so nothing hides behind a scroll. */
|
|
811
|
+
const formatRow = () => _$createComponent(Show, {
|
|
812
|
+
get when() {
|
|
813
|
+
return _$memo(() => !!props.formatting)() && formattingOpen();
|
|
814
|
+
},
|
|
815
|
+
get children() {
|
|
816
|
+
var _el$7 = _$getNextElement(_tmpl$5);
|
|
817
|
+
_$setAttribute(_el$7, "id", formatGroupId);
|
|
818
|
+
_$insert(_el$7, _$createComponent(For, {
|
|
819
|
+
each: formatTools,
|
|
820
|
+
children: tool => _$createComponent(Tooltip.Trigger, {
|
|
821
|
+
type: "button",
|
|
822
|
+
"class": "k2b-chat-composer__icon-action",
|
|
823
|
+
get ["aria-label"]() {
|
|
824
|
+
return tool.label(messages());
|
|
825
|
+
},
|
|
826
|
+
get content() {
|
|
827
|
+
return tool.label(messages());
|
|
828
|
+
},
|
|
829
|
+
get disabled() {
|
|
830
|
+
return editBlocked();
|
|
831
|
+
},
|
|
832
|
+
onMouseDown: keepFieldFocus,
|
|
833
|
+
onClick: () => {
|
|
834
|
+
if (textareaRef) tool.run(textareaRef);
|
|
835
|
+
},
|
|
836
|
+
get children() {
|
|
837
|
+
var _el$8 = _$getNextElement(_tmpl$3);
|
|
838
|
+
_$effect(() => _$className(_el$8, tool.icon));
|
|
839
|
+
return _el$8;
|
|
840
|
+
}
|
|
841
|
+
})
|
|
842
|
+
}));
|
|
843
|
+
_$effect(() => _$setAttribute(_el$7, "aria-label", messages().composerFormatting));
|
|
844
|
+
return _el$7;
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
const emojiButton = () => _$createComponent(Show, {
|
|
848
|
+
get when() {
|
|
849
|
+
return props.emoji;
|
|
850
|
+
},
|
|
851
|
+
children: emoji => _$createComponent(Tooltip.Trigger, {
|
|
852
|
+
type: "button",
|
|
853
|
+
"class": "k2b-chat-composer__icon-action k2b-chat-composer__emoji",
|
|
854
|
+
get ["aria-label"]() {
|
|
855
|
+
return messages().insertEmoji;
|
|
856
|
+
},
|
|
857
|
+
get content() {
|
|
858
|
+
return messages().insertEmoji;
|
|
859
|
+
},
|
|
860
|
+
get disabled() {
|
|
861
|
+
return editBlocked();
|
|
862
|
+
},
|
|
863
|
+
onMouseDown: keepFieldFocus,
|
|
864
|
+
onClick: event => {
|
|
865
|
+
const anchor = event.currentTarget;
|
|
866
|
+
reportChatFailure(() => emoji().onOpen({
|
|
867
|
+
anchor,
|
|
868
|
+
insert: insertText
|
|
869
|
+
}), props.onError);
|
|
870
|
+
},
|
|
871
|
+
get children() {
|
|
872
|
+
return _$getNextElement(_tmpl$6);
|
|
873
|
+
}
|
|
874
|
+
})
|
|
875
|
+
});
|
|
876
|
+
const microphoneControl = () => _$createComponent(Show, {
|
|
877
|
+
get when() {
|
|
878
|
+
return _$memo(() => !!(props.microphone?.onDictate || props.microphone?.onVoiceMessage))() ? props.microphone : undefined;
|
|
879
|
+
},
|
|
880
|
+
children: microphone => (() => {
|
|
881
|
+
var _el$0 = _$getNextElement(_tmpl$8),
|
|
882
|
+
_el$11 = _el$0.firstChild,
|
|
883
|
+
[_el$12, _co$] = _$getNextMarker(_el$11.nextSibling),
|
|
884
|
+
_el$13 = _el$12.nextSibling,
|
|
885
|
+
[_el$14, _co$2] = _$getNextMarker(_el$13.nextSibling);
|
|
886
|
+
var _ref$2 = microphoneRef;
|
|
887
|
+
typeof _ref$2 === "function" ? _$use(_ref$2, _el$0) : microphoneRef = _el$0;
|
|
888
|
+
_$insert(_el$0, _$createComponent(Tooltip.Trigger, {
|
|
889
|
+
type: "button",
|
|
890
|
+
"class": "k2b-chat-composer__icon-action k2b-chat-composer__microphone-button",
|
|
891
|
+
get ["data-state"]() {
|
|
892
|
+
return dictation() ?? undefined;
|
|
893
|
+
},
|
|
894
|
+
get disabled() {
|
|
895
|
+
return microphoneDisabled();
|
|
896
|
+
},
|
|
897
|
+
get ["aria-pressed"]() {
|
|
898
|
+
return _$memo(() => !!microphone().onDictate)() ? dictation() === "listening" : undefined;
|
|
899
|
+
},
|
|
900
|
+
get ["aria-haspopup"]() {
|
|
901
|
+
return microphone().onDictate ? undefined : "menu";
|
|
902
|
+
},
|
|
903
|
+
get ["aria-expanded"]() {
|
|
904
|
+
return _$memo(() => !!microphone().onDictate)() ? undefined : microphoneMenuOpen();
|
|
905
|
+
},
|
|
906
|
+
get ["aria-label"]() {
|
|
907
|
+
return _$memo(() => !!microphone().onDictate)() ? messages().dictate : messages().recordVoiceMessage;
|
|
908
|
+
},
|
|
909
|
+
get content() {
|
|
910
|
+
return _$memo(() => dictation() === "listening")() ? messages().stopDictation : _$memo(() => !!microphone().onDictate)() ? _$memo(() => !!microphone().onVoiceMessage)() ? messages().dictateOrHold : messages().dictate : messages().recordVoiceMessage;
|
|
911
|
+
},
|
|
912
|
+
onMouseDown: keepFieldFocus,
|
|
913
|
+
onContextMenu: event => event.preventDefault(),
|
|
914
|
+
onPointerDown: event => {
|
|
915
|
+
held = false;
|
|
916
|
+
releaseHold();
|
|
917
|
+
const record = microphone().onVoiceMessage;
|
|
918
|
+
if (event.button !== 0 || !record || dictation() === "listening") return;
|
|
919
|
+
holdTimer = setTimeout(() => {
|
|
920
|
+
// The composer may have become blocked, or recording withdrawn, during the press.
|
|
921
|
+
const current = props.microphone?.onVoiceMessage;
|
|
922
|
+
if (!current || microphoneDisabled()) return;
|
|
923
|
+
held = true;
|
|
924
|
+
reportChatFailure(current, props.onError);
|
|
925
|
+
}, microphoneHoldMs);
|
|
926
|
+
},
|
|
927
|
+
onPointerUp: releaseHold,
|
|
928
|
+
onPointerCancel: releaseHold,
|
|
929
|
+
onPointerLeave: releaseHold,
|
|
930
|
+
onClick: event => {
|
|
931
|
+
// A press that already asked for a voice message ends here; a key press never holds.
|
|
932
|
+
if (held) {
|
|
933
|
+
held = false;
|
|
934
|
+
if (event.detail > 0) return;
|
|
935
|
+
}
|
|
936
|
+
const dictate = microphone().onDictate;
|
|
937
|
+
if (dictate) {
|
|
938
|
+
reportChatFailure(dictate, props.onError);
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
setMicrophoneMenuOpen(true);
|
|
942
|
+
// From the keyboard it opens the menu like a menu button: the focus moves to the first item.
|
|
943
|
+
if (event.detail === 0) {
|
|
944
|
+
queueMicrotask(() => microphoneRef?.querySelector('[role="menuitem"]:not(:disabled)')?.focus());
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
get children() {
|
|
948
|
+
var _el$1 = _$getNextElement(_tmpl$3);
|
|
949
|
+
_$effect(() => _$className(_el$1, dictation() === "listening" ? "ti ti-player-stop" : dictation() === "refining" ? "ti ti-loader-2 k2b-spin" : "ti ti-microphone"));
|
|
950
|
+
return _el$1;
|
|
951
|
+
}
|
|
952
|
+
}), _el$12, _co$);
|
|
953
|
+
_$insert(_el$0, _$createComponent(Show, {
|
|
954
|
+
get when() {
|
|
955
|
+
return microphone().onVoiceMessage;
|
|
956
|
+
},
|
|
957
|
+
get children() {
|
|
958
|
+
return _$createComponent(Dropdown.Root, {
|
|
959
|
+
position: "top-left",
|
|
960
|
+
get label() {
|
|
961
|
+
return messages().microphoneOptions;
|
|
962
|
+
},
|
|
963
|
+
get items() {
|
|
964
|
+
return microphoneItems();
|
|
965
|
+
},
|
|
966
|
+
get disabled() {
|
|
967
|
+
return microphoneDisabled();
|
|
968
|
+
},
|
|
969
|
+
get open() {
|
|
970
|
+
return microphoneMenuOpen();
|
|
971
|
+
},
|
|
972
|
+
onOpenChange: setMicrophoneMenuOpen,
|
|
973
|
+
get children() {
|
|
974
|
+
return _$createComponent(Dropdown.Trigger, {
|
|
975
|
+
appearance: "plain",
|
|
976
|
+
"class": "k2b-chat-composer__icon-action k2b-chat-composer__microphone-menu",
|
|
977
|
+
get label() {
|
|
978
|
+
return messages().microphoneOptions;
|
|
979
|
+
},
|
|
980
|
+
get tooltip() {
|
|
981
|
+
return messages().microphoneOptions;
|
|
982
|
+
},
|
|
983
|
+
get children() {
|
|
984
|
+
return _$getNextElement(_tmpl$7);
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
}), _el$14, _co$2);
|
|
991
|
+
return _el$0;
|
|
992
|
+
})()
|
|
993
|
+
});
|
|
994
|
+
const sendControl = () => _$createComponent(Show, {
|
|
995
|
+
get when() {
|
|
996
|
+
return _$memo(() => !!(running() && !hasDraft()))() && props.onStop;
|
|
997
|
+
},
|
|
998
|
+
get fallback() {
|
|
999
|
+
return _$createComponent(Tooltip.Trigger, {
|
|
1000
|
+
type: "button",
|
|
1001
|
+
"class": "k2b-chat-composer__send",
|
|
1002
|
+
get disabled() {
|
|
1003
|
+
return !canSubmit();
|
|
1004
|
+
},
|
|
1005
|
+
onMouseDown: event => {
|
|
1006
|
+
if (conversation()) keepFieldFocus(event);
|
|
1007
|
+
},
|
|
1008
|
+
get ["aria-label"]() {
|
|
1009
|
+
return _$memo(() => !!submitting())() ? _$memo(() => !!running())() ? _$memo(() => runningSubmitIntent() === "queue")() ? messages().queueing : messages().steering : messages().sending : _$memo(() => !!running())() ? _$memo(() => runningSubmitIntent() === "queue")() ? messages().queueMessage : messages().steerResponse : messages().sendMessage;
|
|
1010
|
+
},
|
|
1011
|
+
get content() {
|
|
1012
|
+
return _$memo(() => !!running())() ? _$memo(() => runningSubmitIntent() === "queue")() ? messages().queueMessage : messages().steerResponse : messages().sendMessage;
|
|
1013
|
+
},
|
|
1014
|
+
onClick: () => void submit(),
|
|
1015
|
+
get children() {
|
|
1016
|
+
var _el$16 = _$getNextElement(_tmpl$3);
|
|
1017
|
+
_$effect(() => _$className(_el$16, submitting() ? "ti ti-loader-2 k2b-spin" : conversation() ? "ti ti-send" : "ti ti-arrow-up"));
|
|
1018
|
+
return _el$16;
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
},
|
|
1022
|
+
get children() {
|
|
1023
|
+
return _$createComponent(Tooltip.Trigger, {
|
|
1024
|
+
type: "button",
|
|
1025
|
+
"class": "k2b-chat-composer__stop",
|
|
1026
|
+
get disabled() {
|
|
1027
|
+
return stopping();
|
|
1028
|
+
},
|
|
1029
|
+
get ["aria-label"]() {
|
|
1030
|
+
return _$memo(() => !!stopping())() ? messages().stopping : messages().stopResponse;
|
|
1031
|
+
},
|
|
1032
|
+
get content() {
|
|
1033
|
+
return messages().stopResponse;
|
|
1034
|
+
},
|
|
1035
|
+
onClick: () => reportChatFailure(() => props.onStop?.(), props.onError),
|
|
1036
|
+
get children() {
|
|
1037
|
+
var _el$15 = _$getNextElement(_tmpl$3);
|
|
1038
|
+
_$effect(() => _$className(_el$15, stopping() ? "ti ti-loader-2 k2b-spin" : "ti ti-player-stop"));
|
|
1039
|
+
return _el$15;
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
1044
|
+
const field = () => (() => {
|
|
1045
|
+
var _el$17 = _$getNextElement(_tmpl$1),
|
|
1046
|
+
_el$24 = _el$17.firstChild,
|
|
1047
|
+
[_el$25, _co$4] = _$getNextMarker(_el$24.nextSibling),
|
|
1048
|
+
_el$22 = _el$25.nextSibling,
|
|
1049
|
+
_el$26 = _el$22.nextSibling,
|
|
1050
|
+
[_el$27, _co$5] = _$getNextMarker(_el$26.nextSibling);
|
|
1051
|
+
_$insert(_el$17, _$createComponent(Show, {
|
|
1052
|
+
get when() {
|
|
1053
|
+
return mentions().length > 0;
|
|
1054
|
+
},
|
|
1055
|
+
get children() {
|
|
1056
|
+
var _el$18 = _$getNextElement(_tmpl$9),
|
|
1057
|
+
_el$20 = _el$18.firstChild,
|
|
1058
|
+
[_el$21, _co$3] = _$getNextMarker(_el$20.nextSibling),
|
|
1059
|
+
_el$19 = _el$21.nextSibling;
|
|
1060
|
+
var _ref$3 = highlightRef;
|
|
1061
|
+
typeof _ref$3 === "function" ? _$use(_ref$3, _el$18) : highlightRef = _el$18;
|
|
1062
|
+
_$insert(_el$18, _$createComponent(For, {
|
|
1063
|
+
get each() {
|
|
1064
|
+
return chatMentionSegments(props.value, mentions());
|
|
1065
|
+
},
|
|
1066
|
+
children: part => (() => {
|
|
1067
|
+
var _el$28 = _$getNextElement(_tmpl$10);
|
|
1068
|
+
_$insert(_el$28, () => part.text);
|
|
1069
|
+
_$effect(() => _el$28.classList.toggle("k2b-chat-composer__mention", !!Boolean(part.mention)));
|
|
1070
|
+
return _el$28;
|
|
1071
|
+
})()
|
|
1072
|
+
}), _el$21, _co$3);
|
|
1073
|
+
return _el$18;
|
|
1074
|
+
}
|
|
1075
|
+
}), _el$25, _co$4);
|
|
1076
|
+
_el$22.$$keydown = onKeyDown;
|
|
1077
|
+
_el$22.$$beforeinput = event => {
|
|
1078
|
+
if (event.inputType === "historyUndo" || event.inputType === "historyRedo") {
|
|
1079
|
+
event.preventDefault();
|
|
1080
|
+
restoreHistory(event.inputType === "historyUndo" ? -1 : 1);
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
_el$22.addEventListener("scroll", () => {
|
|
1084
|
+
if (highlightRef && textareaRef) highlightRef.scrollTop = textareaRef.scrollTop;
|
|
1085
|
+
});
|
|
1086
|
+
_el$22.addEventListener("compositionend", () => {
|
|
1087
|
+
setComposing(false);
|
|
1088
|
+
syncCaret();
|
|
1089
|
+
});
|
|
1090
|
+
_el$22.addEventListener("compositionstart", () => setComposing(true));
|
|
1091
|
+
_el$22.$$keyup = syncCaret;
|
|
1092
|
+
_el$22.$$click = () => {
|
|
1093
|
+
setDismissed(false);
|
|
1094
|
+
syncCaret();
|
|
1095
|
+
};
|
|
1096
|
+
_el$22.addEventListener("blur", () => setDismissed(true));
|
|
1097
|
+
_el$22.addEventListener("select", syncCaret);
|
|
1098
|
+
_el$22.addEventListener("paste", event => {
|
|
1099
|
+
const clipboardData = event.clipboardData;
|
|
1100
|
+
if (canSelectFiles() && clipboardData?.files.length) {
|
|
1101
|
+
event.preventDefault();
|
|
1102
|
+
void runFiles(clipboardData.files);
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
props.onPaste?.(event);
|
|
1106
|
+
});
|
|
1107
|
+
_el$22.$$input = event => {
|
|
1108
|
+
edit(event.currentTarget.value);
|
|
1109
|
+
syncCaret();
|
|
1110
|
+
autoResize();
|
|
1111
|
+
const input = event;
|
|
1112
|
+
if (input.inputType === "insertText" && input.data === ":") queueMicrotask(completeShortcode);
|
|
1113
|
+
};
|
|
1114
|
+
var _ref$4 = textareaRef;
|
|
1115
|
+
typeof _ref$4 === "function" ? _$use(_ref$4, _el$22) : textareaRef = _el$22;
|
|
1116
|
+
_$insert(_el$17, _$createComponent(Show, {
|
|
1117
|
+
get when() {
|
|
1118
|
+
return conversation();
|
|
1119
|
+
},
|
|
1120
|
+
get children() {
|
|
1121
|
+
var _el$23 = _$getNextElement(_tmpl$0);
|
|
1122
|
+
var _ref$5 = measureRef;
|
|
1123
|
+
typeof _ref$5 === "function" ? _$use(_ref$5, _el$23) : measureRef = _el$23;
|
|
1124
|
+
return _el$23;
|
|
1125
|
+
}
|
|
1126
|
+
}), _el$27, _co$5);
|
|
1127
|
+
_$effect(_p$ => {
|
|
1128
|
+
var _v$3 = messages().messageInput,
|
|
1129
|
+
_v$4 = !!(mentions().length > 0),
|
|
1130
|
+
_v$5 = editBlocked(),
|
|
1131
|
+
_v$6 = conversation() ? "enter" : undefined,
|
|
1132
|
+
_v$7 = props.placeholder ?? (running() ? messages().addGuidance : conversation() ? messages().writeConversationMessage : messages().writeMessage),
|
|
1133
|
+
_v$8 = props.inputLabel ?? messages().message,
|
|
1134
|
+
_v$9 = suggestionsOpen() ? "combobox" : undefined,
|
|
1135
|
+
_v$0 = suggestionsOpen() ? "list" : undefined,
|
|
1136
|
+
_v$1 = suggestionsOpen() ? commandListId : undefined,
|
|
1137
|
+
_v$10 = suggestionsOpen() ? "true" : undefined,
|
|
1138
|
+
_v$11 = (emojiOpen() ? emojiMatches()[selectedCommandIndex()] : selectedCommand()) ? `${commandListId}-${selectedCommandIndex()}` : undefined;
|
|
1139
|
+
_v$3 !== _p$.e && _$setAttribute(_el$17, "aria-label", _p$.e = _v$3);
|
|
1140
|
+
_v$4 !== _p$.t && _el$22.classList.toggle("k2b-chat-composer__textarea--highlighted", _p$.t = _v$4);
|
|
1141
|
+
_v$5 !== _p$.a && _$setProperty(_el$22, "disabled", _p$.a = _v$5);
|
|
1142
|
+
_v$6 !== _p$.o && _$setAttribute(_el$22, "enterkeyhint", _p$.o = _v$6);
|
|
1143
|
+
_v$7 !== _p$.i && _$setAttribute(_el$22, "placeholder", _p$.i = _v$7);
|
|
1144
|
+
_v$8 !== _p$.n && _$setAttribute(_el$22, "aria-label", _p$.n = _v$8);
|
|
1145
|
+
_v$9 !== _p$.s && _$setAttribute(_el$22, "role", _p$.s = _v$9);
|
|
1146
|
+
_v$0 !== _p$.h && _$setAttribute(_el$22, "aria-autocomplete", _p$.h = _v$0);
|
|
1147
|
+
_v$1 !== _p$.r && _$setAttribute(_el$22, "aria-controls", _p$.r = _v$1);
|
|
1148
|
+
_v$10 !== _p$.d && _$setAttribute(_el$22, "aria-expanded", _p$.d = _v$10);
|
|
1149
|
+
_v$11 !== _p$.l && _$setAttribute(_el$22, "aria-activedescendant", _p$.l = _v$11);
|
|
1150
|
+
return _p$;
|
|
1151
|
+
}, {
|
|
1152
|
+
e: undefined,
|
|
1153
|
+
t: undefined,
|
|
1154
|
+
a: undefined,
|
|
1155
|
+
o: undefined,
|
|
1156
|
+
i: undefined,
|
|
1157
|
+
n: undefined,
|
|
1158
|
+
s: undefined,
|
|
1159
|
+
h: undefined,
|
|
1160
|
+
r: undefined,
|
|
1161
|
+
d: undefined,
|
|
1162
|
+
l: undefined
|
|
1163
|
+
});
|
|
1164
|
+
_$effect(() => _$setProperty(_el$22, "value", props.value));
|
|
1165
|
+
_$runHydrationEvents();
|
|
1166
|
+
return _el$17;
|
|
1167
|
+
})();
|
|
398
1168
|
return (() => {
|
|
399
|
-
var _el$
|
|
400
|
-
_el$
|
|
401
|
-
[_el$
|
|
402
|
-
_el$
|
|
403
|
-
_el$
|
|
404
|
-
[_el$
|
|
405
|
-
_el$
|
|
406
|
-
_el$
|
|
407
|
-
|
|
408
|
-
_el$
|
|
409
|
-
|
|
410
|
-
_el$
|
|
411
|
-
|
|
412
|
-
[_el$46, _co$10] = _$getNextMarker(_el$45.nextSibling),
|
|
413
|
-
_el$42 = _el$46.nextSibling;
|
|
414
|
-
_$insert(_el$3, _$createComponent(Show, {
|
|
1169
|
+
var _el$29 = _$getNextElement(_tmpl$21),
|
|
1170
|
+
_el$89 = _el$29.firstChild,
|
|
1171
|
+
[_el$90, _co$23] = _$getNextMarker(_el$89.nextSibling),
|
|
1172
|
+
_el$57 = _el$90.nextSibling,
|
|
1173
|
+
_el$81 = _el$57.firstChild,
|
|
1174
|
+
[_el$82, _co$19] = _$getNextMarker(_el$81.nextSibling),
|
|
1175
|
+
_el$83 = _el$82.nextSibling,
|
|
1176
|
+
[_el$84, _co$20] = _$getNextMarker(_el$83.nextSibling),
|
|
1177
|
+
_el$85 = _el$84.nextSibling,
|
|
1178
|
+
[_el$86, _co$21] = _$getNextMarker(_el$85.nextSibling),
|
|
1179
|
+
_el$87 = _el$86.nextSibling,
|
|
1180
|
+
[_el$88, _co$22] = _$getNextMarker(_el$87.nextSibling);
|
|
1181
|
+
_$insert(_el$29, _$createComponent(Show, {
|
|
415
1182
|
get when() {
|
|
416
|
-
return
|
|
1183
|
+
return suggestionsOpen() || hasAccessory();
|
|
417
1184
|
},
|
|
418
1185
|
get children() {
|
|
419
|
-
var _el$
|
|
420
|
-
_el$
|
|
421
|
-
_el$
|
|
422
|
-
[_el$
|
|
423
|
-
|
|
424
|
-
|
|
1186
|
+
var _el$30 = _$getNextElement(_tmpl$16),
|
|
1187
|
+
_el$31 = _el$30.firstChild,
|
|
1188
|
+
_el$53 = _el$31.nextSibling,
|
|
1189
|
+
[_el$54, _co$1] = _$getNextMarker(_el$53.nextSibling),
|
|
1190
|
+
_el$55 = _el$54.nextSibling,
|
|
1191
|
+
[_el$56, _co$10] = _$getNextMarker(_el$55.nextSibling);
|
|
1192
|
+
_$insert(_el$31, accessory);
|
|
1193
|
+
_$insert(_el$30, _$createComponent(Show, {
|
|
1194
|
+
get when() {
|
|
1195
|
+
return emojiOpen();
|
|
1196
|
+
},
|
|
1197
|
+
get children() {
|
|
1198
|
+
var _el$32 = _$getNextElement(_tmpl$11),
|
|
1199
|
+
_el$33 = _el$32.firstChild;
|
|
1200
|
+
var _ref$6 = commandListRef;
|
|
1201
|
+
typeof _ref$6 === "function" ? _$use(_ref$6, _el$33) : commandListRef = _el$33;
|
|
1202
|
+
_$setAttribute(_el$33, "id", commandListId);
|
|
1203
|
+
_$insert(_el$33, _$createComponent(For, {
|
|
1204
|
+
get each() {
|
|
1205
|
+
return emojiMatches();
|
|
1206
|
+
},
|
|
1207
|
+
children: (entry, index) => (() => {
|
|
1208
|
+
var _el$91 = _$getNextElement(_tmpl$22),
|
|
1209
|
+
_el$92 = _el$91.firstChild,
|
|
1210
|
+
_el$93 = _el$92.nextSibling,
|
|
1211
|
+
_el$94 = _el$93.nextSibling,
|
|
1212
|
+
[_el$95, _co$24] = _$getNextMarker(_el$94.nextSibling);
|
|
1213
|
+
_el$91.$$click = () => pickEmojiSuggestion(index());
|
|
1214
|
+
_el$91.$$pointerdown = event => event.preventDefault();
|
|
1215
|
+
_$insert(_el$92, () => emojiInTone(entry, props.emoji?.skinTone ?? 0));
|
|
1216
|
+
_$insert(_el$93, () => emojiName(entry, locale()));
|
|
1217
|
+
_$insert(_el$91, _$createComponent(Show, {
|
|
1218
|
+
get when() {
|
|
1219
|
+
return entry.shortcodes[0];
|
|
1220
|
+
},
|
|
1221
|
+
children: code => (() => {
|
|
1222
|
+
var _el$96 = _$getNextElement(_tmpl$23),
|
|
1223
|
+
_el$97 = _el$96.firstChild,
|
|
1224
|
+
_el$99 = _el$97.nextSibling,
|
|
1225
|
+
[_el$100, _co$25] = _$getNextMarker(_el$99.nextSibling),
|
|
1226
|
+
_el$98 = _el$100.nextSibling;
|
|
1227
|
+
_$insert(_el$96, code, _el$100, _co$25);
|
|
1228
|
+
return _el$96;
|
|
1229
|
+
})()
|
|
1230
|
+
}), _el$95, _co$24);
|
|
1231
|
+
_$effect(_p$ => {
|
|
1232
|
+
var _v$19 = `${commandListId}-${index()}`,
|
|
1233
|
+
_v$20 = index() === selectedCommandIndex(),
|
|
1234
|
+
_v$21 = emojiName(entry, locale()),
|
|
1235
|
+
_v$22 = index() === selectedCommandIndex() ? "true" : undefined;
|
|
1236
|
+
_v$19 !== _p$.e && _$setAttribute(_el$91, "id", _p$.e = _v$19);
|
|
1237
|
+
_v$20 !== _p$.t && _$setAttribute(_el$91, "aria-selected", _p$.t = _v$20);
|
|
1238
|
+
_v$21 !== _p$.a && _$setAttribute(_el$91, "aria-label", _p$.a = _v$21);
|
|
1239
|
+
_v$22 !== _p$.o && _$setAttribute(_el$91, "data-active", _p$.o = _v$22);
|
|
1240
|
+
return _p$;
|
|
1241
|
+
}, {
|
|
1242
|
+
e: undefined,
|
|
1243
|
+
t: undefined,
|
|
1244
|
+
a: undefined,
|
|
1245
|
+
o: undefined
|
|
1246
|
+
});
|
|
1247
|
+
_$runHydrationEvents();
|
|
1248
|
+
return _el$91;
|
|
1249
|
+
})()
|
|
1250
|
+
}));
|
|
1251
|
+
_$effect(() => _$setAttribute(_el$33, "aria-label", messages().emojiSuggestions));
|
|
1252
|
+
return _el$32;
|
|
1253
|
+
}
|
|
1254
|
+
}), _el$54, _co$1);
|
|
1255
|
+
_$insert(_el$30, _$createComponent(Show, {
|
|
425
1256
|
get when() {
|
|
426
1257
|
return commandsOpen();
|
|
427
1258
|
},
|
|
428
1259
|
get children() {
|
|
429
|
-
var _el$
|
|
430
|
-
_el$
|
|
431
|
-
_el$
|
|
432
|
-
[_el$
|
|
433
|
-
_el$
|
|
434
|
-
[_el$
|
|
435
|
-
_el$
|
|
436
|
-
[_el$
|
|
437
|
-
_el$
|
|
438
|
-
[_el$
|
|
439
|
-
var _ref$ = commandListRef;
|
|
440
|
-
typeof _ref$ === "function" ? _$use(_ref
|
|
441
|
-
_$setAttribute(_el$
|
|
442
|
-
_$insert(_el$
|
|
1260
|
+
var _el$34 = _$getNextElement(_tmpl$15),
|
|
1261
|
+
_el$35 = _el$34.firstChild,
|
|
1262
|
+
_el$45 = _el$35.firstChild,
|
|
1263
|
+
[_el$46, _co$7] = _$getNextMarker(_el$45.nextSibling),
|
|
1264
|
+
_el$47 = _el$46.nextSibling,
|
|
1265
|
+
[_el$48, _co$8] = _$getNextMarker(_el$47.nextSibling),
|
|
1266
|
+
_el$49 = _el$48.nextSibling,
|
|
1267
|
+
[_el$50, _co$9] = _$getNextMarker(_el$49.nextSibling),
|
|
1268
|
+
_el$51 = _el$50.nextSibling,
|
|
1269
|
+
[_el$52, _co$0] = _$getNextMarker(_el$51.nextSibling);
|
|
1270
|
+
var _ref$7 = commandListRef;
|
|
1271
|
+
typeof _ref$7 === "function" ? _$use(_ref$7, _el$35) : commandListRef = _el$35;
|
|
1272
|
+
_$setAttribute(_el$35, "id", commandListId);
|
|
1273
|
+
_$insert(_el$35, _$createComponent(For, {
|
|
443
1274
|
get each() {
|
|
444
1275
|
return commandMatches();
|
|
445
1276
|
},
|
|
446
1277
|
children: (command, index) => (() => {
|
|
447
|
-
var _el$
|
|
448
|
-
_el$
|
|
449
|
-
_el$
|
|
450
|
-
_el$
|
|
451
|
-
_el$
|
|
452
|
-
_el$
|
|
453
|
-
_$insert(_el$
|
|
454
|
-
_$insert(_el$
|
|
1278
|
+
var _el$101 = _$getNextElement(_tmpl$24),
|
|
1279
|
+
_el$102 = _el$101.firstChild,
|
|
1280
|
+
_el$103 = _el$102.nextSibling,
|
|
1281
|
+
_el$104 = _el$103.nextSibling;
|
|
1282
|
+
_el$101.$$click = () => void executeCommand(command);
|
|
1283
|
+
_el$101.$$pointerdown = event => event.preventDefault();
|
|
1284
|
+
_$insert(_el$103, () => command.label ?? `/${command.name}`);
|
|
1285
|
+
_$insert(_el$104, () => command.description);
|
|
455
1286
|
_$effect(_p$ => {
|
|
456
|
-
var _v$
|
|
457
|
-
_v$
|
|
458
|
-
_v$
|
|
459
|
-
_v$
|
|
460
|
-
_v$
|
|
461
|
-
_v$
|
|
462
|
-
_v$
|
|
463
|
-
_v$
|
|
464
|
-
_v$
|
|
465
|
-
_v$
|
|
1287
|
+
var _v$23 = `${commandListId}-${index()}`,
|
|
1288
|
+
_v$24 = index() === selectedCommandIndex(),
|
|
1289
|
+
_v$25 = command.disabled,
|
|
1290
|
+
_v$26 = index() === selectedCommandIndex() ? "true" : undefined,
|
|
1291
|
+
_v$27 = command.icon ?? "ti ti-slash";
|
|
1292
|
+
_v$23 !== _p$.e && _$setAttribute(_el$101, "id", _p$.e = _v$23);
|
|
1293
|
+
_v$24 !== _p$.t && _$setAttribute(_el$101, "aria-selected", _p$.t = _v$24);
|
|
1294
|
+
_v$25 !== _p$.a && _$setAttribute(_el$101, "aria-disabled", _p$.a = _v$25);
|
|
1295
|
+
_v$26 !== _p$.o && _$setAttribute(_el$101, "data-active", _p$.o = _v$26);
|
|
1296
|
+
_v$27 !== _p$.i && _$className(_el$102, _p$.i = _v$27);
|
|
466
1297
|
return _p$;
|
|
467
1298
|
}, {
|
|
468
1299
|
e: undefined,
|
|
@@ -472,604 +1303,519 @@ export function ChatComposer(props) {
|
|
|
472
1303
|
i: undefined
|
|
473
1304
|
});
|
|
474
1305
|
_$runHydrationEvents();
|
|
475
|
-
return _el$
|
|
1306
|
+
return _el$101;
|
|
476
1307
|
})()
|
|
477
|
-
}), _el$
|
|
478
|
-
_$insert(_el$
|
|
1308
|
+
}), _el$46, _co$7);
|
|
1309
|
+
_$insert(_el$35, _$createComponent(Show, {
|
|
479
1310
|
get when() {
|
|
480
1311
|
return searching();
|
|
481
1312
|
},
|
|
482
1313
|
get children() {
|
|
483
|
-
var _el$
|
|
484
|
-
_el$
|
|
485
|
-
_el$
|
|
486
|
-
_$insert(_el$
|
|
487
|
-
return _el$
|
|
1314
|
+
var _el$36 = _$getNextElement(_tmpl$12),
|
|
1315
|
+
_el$37 = _el$36.firstChild,
|
|
1316
|
+
_el$38 = _el$37.nextSibling;
|
|
1317
|
+
_$insert(_el$38, () => messages().loading);
|
|
1318
|
+
return _el$36;
|
|
488
1319
|
}
|
|
489
|
-
}), _el$
|
|
490
|
-
_$insert(_el$
|
|
1320
|
+
}), _el$48, _co$8);
|
|
1321
|
+
_$insert(_el$35, _$createComponent(Show, {
|
|
491
1322
|
get when() {
|
|
492
1323
|
return searchError();
|
|
493
1324
|
},
|
|
494
1325
|
get children() {
|
|
495
|
-
var _el$
|
|
496
|
-
_el$
|
|
497
|
-
_el$
|
|
498
|
-
_el$
|
|
499
|
-
[_el$
|
|
500
|
-
_$insert(_el$
|
|
501
|
-
return _el$
|
|
1326
|
+
var _el$39 = _$getNextElement(_tmpl$13),
|
|
1327
|
+
_el$40 = _el$39.firstChild,
|
|
1328
|
+
_el$41 = _el$40.nextSibling,
|
|
1329
|
+
_el$42 = _el$41.nextSibling,
|
|
1330
|
+
[_el$43, _co$6] = _$getNextMarker(_el$42.nextSibling);
|
|
1331
|
+
_$insert(_el$39, () => messages().error, _el$43, _co$6);
|
|
1332
|
+
return _el$39;
|
|
502
1333
|
}
|
|
503
|
-
}), _el$
|
|
504
|
-
_$insert(_el$
|
|
1334
|
+
}), _el$50, _co$9);
|
|
1335
|
+
_$insert(_el$35, _$createComponent(Show, {
|
|
505
1336
|
get when() {
|
|
506
1337
|
return _$memo(() => !!(!searching() && !searchError()))() && commandMatches().length === 0;
|
|
507
1338
|
},
|
|
508
1339
|
get children() {
|
|
509
|
-
var _el$
|
|
510
|
-
_$insert(_el$
|
|
511
|
-
return _el$
|
|
1340
|
+
var _el$44 = _$getNextElement(_tmpl$14);
|
|
1341
|
+
_$insert(_el$44, () => messages().noResults);
|
|
1342
|
+
return _el$44;
|
|
512
1343
|
}
|
|
513
|
-
}), _el$
|
|
514
|
-
_$effect(() => _$setAttribute(_el$
|
|
515
|
-
return _el$
|
|
1344
|
+
}), _el$52, _co$0);
|
|
1345
|
+
_$effect(() => _$setAttribute(_el$35, "aria-label", messages().commands));
|
|
1346
|
+
return _el$34;
|
|
516
1347
|
}
|
|
517
|
-
}), _el$
|
|
1348
|
+
}), _el$56, _co$10);
|
|
518
1349
|
_$effect(_p$ => {
|
|
519
|
-
var _v$ =
|
|
520
|
-
_v$
|
|
521
|
-
|
|
522
|
-
_v$
|
|
1350
|
+
var _v$12 = hasAccessory() ? undefined : "true",
|
|
1351
|
+
_v$13 = suggestionsOpen() ? "hidden" : undefined,
|
|
1352
|
+
_v$14 = suggestionsOpen();
|
|
1353
|
+
_v$12 !== _p$.e && _$setAttribute(_el$30, "data-overlay", _p$.e = _v$12);
|
|
1354
|
+
_v$13 !== _p$.t && _$setStyleProperty(_el$31, "visibility", _p$.t = _v$13);
|
|
1355
|
+
_v$14 !== _p$.a && _$setProperty(_el$31, "inert", _p$.a = _v$14);
|
|
523
1356
|
return _p$;
|
|
524
1357
|
}, {
|
|
525
1358
|
e: undefined,
|
|
526
|
-
t: undefined
|
|
1359
|
+
t: undefined,
|
|
1360
|
+
a: undefined
|
|
527
1361
|
});
|
|
528
|
-
return _el$
|
|
1362
|
+
return _el$30;
|
|
529
1363
|
}
|
|
530
|
-
}), _el$
|
|
531
|
-
var _ref$
|
|
532
|
-
typeof _ref$
|
|
533
|
-
_$insert(_el$
|
|
1364
|
+
}), _el$90, _co$23);
|
|
1365
|
+
var _ref$8 = composerRef;
|
|
1366
|
+
typeof _ref$8 === "function" ? _$use(_ref$8, _el$57) : composerRef = _el$57;
|
|
1367
|
+
_$insert(_el$57, _$createComponent(Show, {
|
|
1368
|
+
get when() {
|
|
1369
|
+
return showHint();
|
|
1370
|
+
},
|
|
1371
|
+
get children() {
|
|
1372
|
+
var _el$58 = _$getNextElement(_tmpl$17);
|
|
1373
|
+
_$insert(_el$58, _$createComponent(Show, {
|
|
1374
|
+
get when() {
|
|
1375
|
+
return dictationStatus();
|
|
1376
|
+
},
|
|
1377
|
+
get fallback() {
|
|
1378
|
+
return (() => {
|
|
1379
|
+
var _el$105 = _$getNextElement(_tmpl$25);
|
|
1380
|
+
_$insert(_el$105, hint);
|
|
1381
|
+
return _el$105;
|
|
1382
|
+
})();
|
|
1383
|
+
},
|
|
1384
|
+
children: status => [(() => {
|
|
1385
|
+
var _el$106 = _$getNextElement(_tmpl$26),
|
|
1386
|
+
_el$107 = _el$106.firstChild,
|
|
1387
|
+
_el$108 = _el$107.nextSibling;
|
|
1388
|
+
_$insert(_el$108, () => status().text);
|
|
1389
|
+
_$effect(_p$ => {
|
|
1390
|
+
var _v$28 = dictation() ?? undefined,
|
|
1391
|
+
_v$29 = status().icon;
|
|
1392
|
+
_v$28 !== _p$.e && _$setAttribute(_el$106, "data-state", _p$.e = _v$28);
|
|
1393
|
+
_v$29 !== _p$.t && _$className(_el$107, _p$.t = _v$29);
|
|
1394
|
+
return _p$;
|
|
1395
|
+
}, {
|
|
1396
|
+
e: undefined,
|
|
1397
|
+
t: undefined
|
|
1398
|
+
});
|
|
1399
|
+
return _el$106;
|
|
1400
|
+
})(), _$createComponent(Show, {
|
|
1401
|
+
get when() {
|
|
1402
|
+
return _$memo(() => dictation() === "refined")() ? props.microphone?.onRestoreOriginal : undefined;
|
|
1403
|
+
},
|
|
1404
|
+
children: restore => (() => {
|
|
1405
|
+
var _el$109 = _$getNextElement(_tmpl$27);
|
|
1406
|
+
_el$109.$$click = () => reportChatFailure(restore(), props.onError);
|
|
1407
|
+
_el$109.$$mousedown = keepFieldFocus;
|
|
1408
|
+
_$insert(_el$109, () => messages().restoreOriginal);
|
|
1409
|
+
_$effect(() => _$setProperty(_el$109, "disabled", microphoneDisabled()));
|
|
1410
|
+
_$runHydrationEvents();
|
|
1411
|
+
return _el$109;
|
|
1412
|
+
})()
|
|
1413
|
+
})]
|
|
1414
|
+
}));
|
|
1415
|
+
return _el$58;
|
|
1416
|
+
}
|
|
1417
|
+
}), _el$82, _co$19);
|
|
1418
|
+
_$insert(_el$57, _$createComponent(Show, {
|
|
534
1419
|
get when() {
|
|
535
1420
|
return attachments().length > 0;
|
|
536
1421
|
},
|
|
537
1422
|
get children() {
|
|
538
|
-
var _el$
|
|
539
|
-
_$insert(_el$
|
|
1423
|
+
var _el$59 = _$getNextElement(_tmpl$18);
|
|
1424
|
+
_$insert(_el$59, _$createComponent(For, {
|
|
540
1425
|
get each() {
|
|
541
1426
|
return attachments();
|
|
542
1427
|
},
|
|
543
1428
|
children: attachment => (() => {
|
|
544
|
-
var _el$
|
|
545
|
-
_el$
|
|
546
|
-
_el$
|
|
547
|
-
[_el$
|
|
548
|
-
_el$
|
|
549
|
-
[_el$
|
|
550
|
-
_el$
|
|
551
|
-
[_el$
|
|
552
|
-
_$insert(_el$
|
|
1429
|
+
var _el$110 = _$getNextElement(_tmpl$29),
|
|
1430
|
+
_el$111 = _el$110.firstChild,
|
|
1431
|
+
_el$112 = _el$111.firstChild,
|
|
1432
|
+
[_el$113, _co$26] = _$getNextMarker(_el$112.nextSibling),
|
|
1433
|
+
_el$114 = _el$113.nextSibling,
|
|
1434
|
+
[_el$115, _co$27] = _$getNextMarker(_el$114.nextSibling),
|
|
1435
|
+
_el$117 = _el$111.nextSibling,
|
|
1436
|
+
[_el$118, _co$28] = _$getNextMarker(_el$117.nextSibling);
|
|
1437
|
+
_$insert(_el$111, _$createComponent(Show, {
|
|
553
1438
|
get when() {
|
|
554
1439
|
return attachment.href;
|
|
555
1440
|
},
|
|
556
1441
|
get fallback() {
|
|
557
1442
|
return (() => {
|
|
558
|
-
var _el$
|
|
559
|
-
_el$
|
|
560
|
-
[_el$
|
|
561
|
-
_el$
|
|
562
|
-
[_el$
|
|
563
|
-
_$insert(_el$
|
|
1443
|
+
var _el$119 = _$getNextElement(_tmpl$31),
|
|
1444
|
+
_el$121 = _el$119.firstChild,
|
|
1445
|
+
[_el$122, _co$29] = _$getNextMarker(_el$121.nextSibling),
|
|
1446
|
+
_el$123 = _el$122.nextSibling,
|
|
1447
|
+
[_el$124, _co$30] = _$getNextMarker(_el$123.nextSibling);
|
|
1448
|
+
_$insert(_el$119, _$createComponent(Show, {
|
|
564
1449
|
get when() {
|
|
565
1450
|
return _$memo(() => attachment.kind === "image")() && attachment.previewUrl;
|
|
566
1451
|
},
|
|
567
1452
|
get fallback() {
|
|
568
1453
|
return (() => {
|
|
569
|
-
var _el$
|
|
570
|
-
_$effect(() => _$className(_el$
|
|
571
|
-
return _el$
|
|
1454
|
+
var _el$125 = _$getNextElement(_tmpl$3);
|
|
1455
|
+
_$effect(() => _$className(_el$125, attachmentIcon(attachment)));
|
|
1456
|
+
return _el$125;
|
|
572
1457
|
})();
|
|
573
1458
|
},
|
|
574
1459
|
get children() {
|
|
575
|
-
var _el$
|
|
1460
|
+
var _el$120 = _$getNextElement(_tmpl$30);
|
|
576
1461
|
_$effect(_p$ => {
|
|
577
|
-
var _v$
|
|
578
|
-
_v$
|
|
579
|
-
_v$
|
|
580
|
-
_v$
|
|
1462
|
+
var _v$32 = attachment.previewUrl,
|
|
1463
|
+
_v$33 = attachment.alt ?? "";
|
|
1464
|
+
_v$32 !== _p$.e && _$setAttribute(_el$120, "src", _p$.e = _v$32);
|
|
1465
|
+
_v$33 !== _p$.t && _$setAttribute(_el$120, "alt", _p$.t = _v$33);
|
|
581
1466
|
return _p$;
|
|
582
1467
|
}, {
|
|
583
1468
|
e: undefined,
|
|
584
1469
|
t: undefined
|
|
585
1470
|
});
|
|
586
|
-
return _el$
|
|
1471
|
+
return _el$120;
|
|
587
1472
|
}
|
|
588
|
-
}), _el$
|
|
589
|
-
_$insert(_el$
|
|
590
|
-
return _el$
|
|
1473
|
+
}), _el$122, _co$29);
|
|
1474
|
+
_$insert(_el$119, () => renderAttachmentCopy(attachment), _el$124, _co$30);
|
|
1475
|
+
return _el$119;
|
|
591
1476
|
})();
|
|
592
1477
|
},
|
|
593
1478
|
children: href => (() => {
|
|
594
|
-
var _el$
|
|
595
|
-
_el$
|
|
596
|
-
[_el$
|
|
597
|
-
_el$
|
|
598
|
-
[_el$
|
|
599
|
-
_$insert(_el$
|
|
1479
|
+
var _el$126 = _$getNextElement(_tmpl$32),
|
|
1480
|
+
_el$128 = _el$126.firstChild,
|
|
1481
|
+
[_el$129, _co$31] = _$getNextMarker(_el$128.nextSibling),
|
|
1482
|
+
_el$130 = _el$129.nextSibling,
|
|
1483
|
+
[_el$131, _co$32] = _$getNextMarker(_el$130.nextSibling);
|
|
1484
|
+
_$insert(_el$126, _$createComponent(Show, {
|
|
600
1485
|
get when() {
|
|
601
1486
|
return _$memo(() => attachment.kind === "image")() && attachment.previewUrl;
|
|
602
1487
|
},
|
|
603
1488
|
get fallback() {
|
|
604
1489
|
return (() => {
|
|
605
|
-
var _el$
|
|
606
|
-
_$effect(() => _$className(_el$
|
|
607
|
-
return _el$
|
|
1490
|
+
var _el$132 = _$getNextElement(_tmpl$3);
|
|
1491
|
+
_$effect(() => _$className(_el$132, attachmentIcon(attachment)));
|
|
1492
|
+
return _el$132;
|
|
608
1493
|
})();
|
|
609
1494
|
},
|
|
610
1495
|
get children() {
|
|
611
|
-
var _el$
|
|
1496
|
+
var _el$127 = _$getNextElement(_tmpl$30);
|
|
612
1497
|
_$effect(_p$ => {
|
|
613
|
-
var _v$
|
|
614
|
-
_v$
|
|
615
|
-
_v$
|
|
616
|
-
_v$
|
|
1498
|
+
var _v$34 = attachment.previewUrl,
|
|
1499
|
+
_v$35 = attachment.alt ?? "";
|
|
1500
|
+
_v$34 !== _p$.e && _$setAttribute(_el$127, "src", _p$.e = _v$34);
|
|
1501
|
+
_v$35 !== _p$.t && _$setAttribute(_el$127, "alt", _p$.t = _v$35);
|
|
617
1502
|
return _p$;
|
|
618
1503
|
}, {
|
|
619
1504
|
e: undefined,
|
|
620
1505
|
t: undefined
|
|
621
1506
|
});
|
|
622
|
-
return _el$
|
|
1507
|
+
return _el$127;
|
|
623
1508
|
}
|
|
624
|
-
}), _el$
|
|
625
|
-
_$insert(_el$
|
|
1509
|
+
}), _el$129, _co$31);
|
|
1510
|
+
_$insert(_el$126, () => renderAttachmentCopy(attachment), _el$131, _co$32);
|
|
626
1511
|
_$effect(_p$ => {
|
|
627
|
-
var _v$
|
|
628
|
-
_v$
|
|
1512
|
+
var _v$36 = href(),
|
|
1513
|
+
_v$37 = messages().openInNewTab({
|
|
629
1514
|
name: attachment.name
|
|
630
1515
|
});
|
|
631
|
-
_v$
|
|
632
|
-
_v$
|
|
1516
|
+
_v$36 !== _p$.e && _$setAttribute(_el$126, "href", _p$.e = _v$36);
|
|
1517
|
+
_v$37 !== _p$.t && _$setAttribute(_el$126, "aria-label", _p$.t = _v$37);
|
|
633
1518
|
return _p$;
|
|
634
1519
|
}, {
|
|
635
1520
|
e: undefined,
|
|
636
1521
|
t: undefined
|
|
637
1522
|
});
|
|
638
|
-
return _el$
|
|
1523
|
+
return _el$126;
|
|
639
1524
|
})()
|
|
640
|
-
}), _el$
|
|
641
|
-
_$insert(_el$
|
|
1525
|
+
}), _el$113, _co$26);
|
|
1526
|
+
_$insert(_el$111, _$createComponent(Show, {
|
|
642
1527
|
get when() {
|
|
643
1528
|
return attachment.action;
|
|
644
1529
|
},
|
|
645
1530
|
children: action => (() => {
|
|
646
|
-
var _el$
|
|
647
|
-
_el$
|
|
648
|
-
[_el$
|
|
649
|
-
_el$
|
|
650
|
-
[_el$
|
|
651
|
-
_el$
|
|
652
|
-
_$insert(_el$
|
|
1531
|
+
var _el$133 = _$getNextElement(_tmpl$33),
|
|
1532
|
+
_el$134 = _el$133.firstChild,
|
|
1533
|
+
[_el$135, _co$33] = _$getNextMarker(_el$134.nextSibling),
|
|
1534
|
+
_el$136 = _el$135.nextSibling,
|
|
1535
|
+
[_el$137, _co$34] = _$getNextMarker(_el$136.nextSibling);
|
|
1536
|
+
_el$133.$$click = () => reportChatFailure(() => executeChatAction(action()), props.onError);
|
|
1537
|
+
_$insert(_el$133, _$createComponent(Show, {
|
|
653
1538
|
get when() {
|
|
654
1539
|
return action().icon;
|
|
655
1540
|
},
|
|
656
1541
|
children: icon => (() => {
|
|
657
|
-
var _el$
|
|
658
|
-
_$effect(() => _$className(_el$
|
|
659
|
-
return _el$
|
|
1542
|
+
var _el$138 = _$getNextElement(_tmpl$3);
|
|
1543
|
+
_$effect(() => _$className(_el$138, icon()));
|
|
1544
|
+
return _el$138;
|
|
660
1545
|
})()
|
|
661
|
-
}), _el$
|
|
662
|
-
_$insert(_el$
|
|
663
|
-
_$effect(() => _$setProperty(_el$
|
|
1546
|
+
}), _el$135, _co$33);
|
|
1547
|
+
_$insert(_el$133, () => action().label, _el$137, _co$34);
|
|
1548
|
+
_$effect(() => _$setProperty(_el$133, "disabled", blocked() || action().disabled));
|
|
664
1549
|
_$runHydrationEvents();
|
|
665
|
-
return _el$
|
|
1550
|
+
return _el$133;
|
|
666
1551
|
})()
|
|
667
|
-
}), _el$
|
|
668
|
-
_$insert(_el$
|
|
1552
|
+
}), _el$115, _co$27);
|
|
1553
|
+
_$insert(_el$110, _$createComponent(Show, {
|
|
669
1554
|
get when() {
|
|
670
1555
|
return props.onAttachmentsChange;
|
|
671
1556
|
},
|
|
672
1557
|
get children() {
|
|
673
|
-
var _el$
|
|
674
|
-
_el$
|
|
1558
|
+
var _el$116 = _$getNextElement(_tmpl$28);
|
|
1559
|
+
_el$116.$$click = () => setAttachments(attachments().filter(candidate => candidate.id !== attachment.id));
|
|
675
1560
|
_$effect(_p$ => {
|
|
676
|
-
var _v$
|
|
1561
|
+
var _v$30 = messages().removeNamed({
|
|
677
1562
|
name: attachment.name
|
|
678
1563
|
}),
|
|
679
|
-
_v$
|
|
680
|
-
_v$
|
|
681
|
-
_v$
|
|
1564
|
+
_v$31 = blocked();
|
|
1565
|
+
_v$30 !== _p$.e && _$setAttribute(_el$116, "aria-label", _p$.e = _v$30);
|
|
1566
|
+
_v$31 !== _p$.t && _$setProperty(_el$116, "disabled", _p$.t = _v$31);
|
|
682
1567
|
return _p$;
|
|
683
1568
|
}, {
|
|
684
1569
|
e: undefined,
|
|
685
1570
|
t: undefined
|
|
686
1571
|
});
|
|
687
1572
|
_$runHydrationEvents();
|
|
688
|
-
return _el$
|
|
1573
|
+
return _el$116;
|
|
689
1574
|
}
|
|
690
|
-
}), _el$
|
|
691
|
-
_$effect(() => _el$
|
|
692
|
-
return _el$
|
|
1575
|
+
}), _el$118, _co$28);
|
|
1576
|
+
_$effect(() => _el$111.classList.toggle("k2b-chat-composer__attachment-content--action", !!Boolean(attachment.action)));
|
|
1577
|
+
return _el$110;
|
|
693
1578
|
})()
|
|
694
1579
|
}));
|
|
695
|
-
_$effect(() => _$setAttribute(_el$
|
|
696
|
-
return _el$
|
|
1580
|
+
_$effect(() => _$setAttribute(_el$59, "aria-label", messages().attachments));
|
|
1581
|
+
return _el$59;
|
|
697
1582
|
}
|
|
698
|
-
}), _el$
|
|
699
|
-
_el$
|
|
700
|
-
if (!event.dataTransfer?.types.includes("Files")) return;
|
|
701
|
-
event.preventDefault();
|
|
702
|
-
setDragActive(false);
|
|
703
|
-
if (canSelectFiles() && event.dataTransfer.files.length) void runFiles(event.dataTransfer.files);
|
|
704
|
-
});
|
|
705
|
-
_el$27.addEventListener("dragleave", event => {
|
|
706
|
-
if (!event.currentTarget.contains(event.relatedTarget)) setDragActive(false);
|
|
707
|
-
});
|
|
708
|
-
_el$27.addEventListener("dragover", event => {
|
|
709
|
-
if (!canSelectFiles() || !event.dataTransfer?.types.includes("Files")) return;
|
|
710
|
-
event.preventDefault();
|
|
711
|
-
setDragActive(true);
|
|
712
|
-
});
|
|
713
|
-
_el$27.addEventListener("dragenter", event => {
|
|
714
|
-
if (!canSelectFiles() || !event.dataTransfer?.types.includes("Files")) return;
|
|
715
|
-
event.preventDefault();
|
|
716
|
-
setDragActive(true);
|
|
717
|
-
});
|
|
718
|
-
_$insert(_el$27, _$createComponent(Show, {
|
|
1583
|
+
}), _el$84, _co$20);
|
|
1584
|
+
_$insert(_el$57, _$createComponent(Show, {
|
|
719
1585
|
get when() {
|
|
720
|
-
return
|
|
721
|
-
},
|
|
722
|
-
get children() {
|
|
723
|
-
var _el$28 = _$getNextElement(_tmpl$8);
|
|
724
|
-
_$insert(_el$28, () => messages().dropFilesToAttach);
|
|
725
|
-
return _el$28;
|
|
726
|
-
}
|
|
727
|
-
}), _el$35, _co$8);
|
|
728
|
-
_$insert(_el$27, _$createComponent(Show, {
|
|
729
|
-
get when() {
|
|
730
|
-
return mentions().length > 0;
|
|
731
|
-
},
|
|
732
|
-
get children() {
|
|
733
|
-
var _el$29 = _$getNextElement(_tmpl$9),
|
|
734
|
-
_el$31 = _el$29.firstChild,
|
|
735
|
-
[_el$32, _co$7] = _$getNextMarker(_el$31.nextSibling),
|
|
736
|
-
_el$30 = _el$32.nextSibling;
|
|
737
|
-
var _ref$3 = highlightRef;
|
|
738
|
-
typeof _ref$3 === "function" ? _$use(_ref$3, _el$29) : highlightRef = _el$29;
|
|
739
|
-
_$insert(_el$29, _$createComponent(For, {
|
|
740
|
-
get each() {
|
|
741
|
-
return chatMentionSegments(props.value, mentions());
|
|
742
|
-
},
|
|
743
|
-
children: part => (() => {
|
|
744
|
-
var _el$82 = _$getNextElement(_tmpl$18);
|
|
745
|
-
_$insert(_el$82, () => part.text);
|
|
746
|
-
_$effect(() => _el$82.classList.toggle("k2b-chat-composer__mention", !!Boolean(part.mention)));
|
|
747
|
-
return _el$82;
|
|
748
|
-
})()
|
|
749
|
-
}), _el$32, _co$7);
|
|
750
|
-
return _el$29;
|
|
751
|
-
}
|
|
752
|
-
}), _el$37, _co$9);
|
|
753
|
-
_el$33.$$keydown = onKeyDown;
|
|
754
|
-
_el$33.$$beforeinput = event => {
|
|
755
|
-
if (event.inputType === "historyUndo" || event.inputType === "historyRedo") {
|
|
756
|
-
event.preventDefault();
|
|
757
|
-
restoreHistory(event.inputType === "historyUndo" ? -1 : 1);
|
|
758
|
-
}
|
|
759
|
-
};
|
|
760
|
-
_el$33.addEventListener("scroll", () => {
|
|
761
|
-
if (highlightRef && textareaRef) highlightRef.scrollTop = textareaRef.scrollTop;
|
|
762
|
-
});
|
|
763
|
-
_el$33.addEventListener("compositionend", () => {
|
|
764
|
-
setComposing(false);
|
|
765
|
-
syncCaret();
|
|
766
|
-
});
|
|
767
|
-
_el$33.addEventListener("compositionstart", () => setComposing(true));
|
|
768
|
-
_el$33.$$keyup = syncCaret;
|
|
769
|
-
_el$33.$$click = () => {
|
|
770
|
-
setDismissed(false);
|
|
771
|
-
syncCaret();
|
|
772
|
-
};
|
|
773
|
-
_el$33.addEventListener("blur", () => setDismissed(true));
|
|
774
|
-
_el$33.addEventListener("select", syncCaret);
|
|
775
|
-
_el$33.addEventListener("paste", event => {
|
|
776
|
-
const clipboardData = event.clipboardData;
|
|
777
|
-
if (canSelectFiles() && clipboardData?.files.length) {
|
|
778
|
-
event.preventDefault();
|
|
779
|
-
void runFiles(clipboardData.files);
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
props.onPaste?.(event);
|
|
783
|
-
});
|
|
784
|
-
_el$33.$$input = event => {
|
|
785
|
-
edit(event.currentTarget.value);
|
|
786
|
-
syncCaret();
|
|
787
|
-
autoResize();
|
|
788
|
-
};
|
|
789
|
-
var _ref$4 = textareaRef;
|
|
790
|
-
typeof _ref$4 === "function" ? _$use(_ref$4, _el$33) : textareaRef = _el$33;
|
|
791
|
-
_$insert(_el$25, _$createComponent(Show, {
|
|
792
|
-
get when() {
|
|
793
|
-
return props.error;
|
|
794
|
-
},
|
|
795
|
-
get children() {
|
|
796
|
-
var _el$38 = _$getNextElement(_tmpl$0),
|
|
797
|
-
_el$39 = _el$38.firstChild,
|
|
798
|
-
_el$40 = _el$39.nextSibling,
|
|
799
|
-
[_el$41, _co$0] = _$getNextMarker(_el$40.nextSibling);
|
|
800
|
-
_$insert(_el$38, () => props.error, _el$41, _co$0);
|
|
801
|
-
return _el$38;
|
|
802
|
-
}
|
|
803
|
-
}), _el$46, _co$10);
|
|
804
|
-
_$insert(_el$42, _$createComponent(Show, {
|
|
805
|
-
get when() {
|
|
806
|
-
return props.footerContent;
|
|
1586
|
+
return conversation();
|
|
807
1587
|
},
|
|
808
1588
|
get fallback() {
|
|
809
|
-
return [(
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
1589
|
+
return [_$memo(field), _$createComponent(Show, {
|
|
1590
|
+
get when() {
|
|
1591
|
+
return props.error;
|
|
1592
|
+
},
|
|
1593
|
+
get children() {
|
|
1594
|
+
var _el$139 = _$getNextElement(_tmpl$19),
|
|
1595
|
+
_el$140 = _el$139.firstChild,
|
|
1596
|
+
_el$141 = _el$140.nextSibling,
|
|
1597
|
+
[_el$142, _co$35] = _$getNextMarker(_el$141.nextSibling);
|
|
1598
|
+
_$insert(_el$139, () => props.error, _el$142, _co$35);
|
|
1599
|
+
return _el$139;
|
|
1600
|
+
}
|
|
1601
|
+
}), _$memo(formatRow), (() => {
|
|
1602
|
+
var _el$143 = _$getNextElement(_tmpl$34);
|
|
1603
|
+
_$insert(_el$143, _$createComponent(Show, {
|
|
823
1604
|
get when() {
|
|
824
|
-
return
|
|
1605
|
+
return props.footerContent;
|
|
825
1606
|
},
|
|
826
|
-
get
|
|
827
|
-
return
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
1607
|
+
get fallback() {
|
|
1608
|
+
return [(() => {
|
|
1609
|
+
var _el$144 = _$getNextElement(_tmpl$35),
|
|
1610
|
+
_el$145 = _el$144.firstChild,
|
|
1611
|
+
[_el$146, _co$36] = _$getNextMarker(_el$145.nextSibling),
|
|
1612
|
+
_el$147 = _el$146.nextSibling,
|
|
1613
|
+
[_el$148, _co$37] = _$getNextMarker(_el$147.nextSibling),
|
|
1614
|
+
_el$149 = _el$148.nextSibling,
|
|
1615
|
+
[_el$150, _co$38] = _$getNextMarker(_el$149.nextSibling),
|
|
1616
|
+
_el$151 = _el$150.nextSibling,
|
|
1617
|
+
[_el$152, _co$39] = _$getNextMarker(_el$151.nextSibling),
|
|
1618
|
+
_el$153 = _el$152.nextSibling,
|
|
1619
|
+
[_el$154, _co$40] = _$getNextMarker(_el$153.nextSibling),
|
|
1620
|
+
_el$155 = _el$154.nextSibling,
|
|
1621
|
+
[_el$156, _co$41] = _$getNextMarker(_el$155.nextSibling),
|
|
1622
|
+
_el$157 = _el$156.nextSibling,
|
|
1623
|
+
[_el$158, _co$42] = _$getNextMarker(_el$157.nextSibling);
|
|
1624
|
+
_$insert(_el$144, () => props.footerTools, _el$146, _co$36);
|
|
1625
|
+
_$insert(_el$144, _$createComponent(Show, {
|
|
1626
|
+
get when() {
|
|
1627
|
+
return hasAddMenu();
|
|
1628
|
+
},
|
|
1629
|
+
get children() {
|
|
1630
|
+
return addMenu("ti ti-plus");
|
|
1631
|
+
}
|
|
1632
|
+
}), _el$148, _co$37);
|
|
1633
|
+
_$insert(_el$144, fileInput, _el$150, _co$38);
|
|
1634
|
+
_$insert(_el$144, formatToggle, _el$152, _co$39);
|
|
1635
|
+
_$insert(_el$144, emojiButton, _el$154, _co$40);
|
|
1636
|
+
_$insert(_el$144, _$createComponent(Show, {
|
|
1637
|
+
get when() {
|
|
1638
|
+
return (props.models?.length ?? 0) > 0;
|
|
1639
|
+
},
|
|
1640
|
+
get children() {
|
|
1641
|
+
return _$createComponent(SelectChip, {
|
|
1642
|
+
get ["aria-label"]() {
|
|
1643
|
+
return messages().chooseModel;
|
|
1644
|
+
},
|
|
1645
|
+
position: "top-right",
|
|
1646
|
+
"class": "k2b-chat-composer__model",
|
|
1647
|
+
menuWidth: "15rem",
|
|
1648
|
+
get placeholder() {
|
|
1649
|
+
return messages().model;
|
|
1650
|
+
},
|
|
1651
|
+
value: () => props.selectedModelId ?? "",
|
|
1652
|
+
get options() {
|
|
1653
|
+
return (props.models ?? []).map(model => ({
|
|
1654
|
+
value: model.id,
|
|
1655
|
+
label: model.label,
|
|
1656
|
+
description: model.description,
|
|
1657
|
+
icon: model.icon,
|
|
1658
|
+
image: model.image
|
|
1659
|
+
}));
|
|
1660
|
+
},
|
|
1661
|
+
get disabled() {
|
|
1662
|
+
return blocked() || running() || !props.onModelChange;
|
|
1663
|
+
},
|
|
1664
|
+
onValueChange: modelId => {
|
|
1665
|
+
props.onModelChange?.(modelId);
|
|
1666
|
+
queueMicrotask(focus);
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
}), _el$156, _co$41);
|
|
1671
|
+
_$insert(_el$144, () => props.modelDetails, _el$158, _co$42);
|
|
1672
|
+
return _el$144;
|
|
1673
|
+
})(), (() => {
|
|
1674
|
+
var _el$159 = _$getNextElement(_tmpl$36),
|
|
1675
|
+
_el$160 = _el$159.firstChild,
|
|
1676
|
+
[_el$161, _co$43] = _$getNextMarker(_el$160.nextSibling),
|
|
1677
|
+
_el$162 = _el$161.nextSibling,
|
|
1678
|
+
[_el$163, _co$44] = _$getNextMarker(_el$162.nextSibling),
|
|
1679
|
+
_el$164 = _el$163.nextSibling,
|
|
1680
|
+
[_el$165, _co$45] = _$getNextMarker(_el$164.nextSibling),
|
|
1681
|
+
_el$166 = _el$165.nextSibling,
|
|
1682
|
+
[_el$167, _co$46] = _$getNextMarker(_el$166.nextSibling),
|
|
1683
|
+
_el$168 = _el$167.nextSibling,
|
|
1684
|
+
[_el$169, _co$47] = _$getNextMarker(_el$168.nextSibling);
|
|
1685
|
+
_$insert(_el$159, _$createComponent(For, {
|
|
1686
|
+
get each() {
|
|
1687
|
+
return props.contextActions;
|
|
1688
|
+
},
|
|
1689
|
+
children: action => _$createComponent(Tooltip.Trigger, {
|
|
1690
|
+
type: "button",
|
|
841
1691
|
"class": "k2b-chat-composer__icon-action",
|
|
842
|
-
get
|
|
843
|
-
return
|
|
1692
|
+
get ["data-tone"]() {
|
|
1693
|
+
return action.variant === "danger" ? "danger" : undefined;
|
|
1694
|
+
},
|
|
1695
|
+
get disabled() {
|
|
1696
|
+
return action.disabled;
|
|
844
1697
|
},
|
|
845
|
-
get
|
|
846
|
-
return
|
|
1698
|
+
get ["aria-pressed"]() {
|
|
1699
|
+
return action.pressed;
|
|
847
1700
|
},
|
|
1701
|
+
get ["aria-label"]() {
|
|
1702
|
+
return action.label;
|
|
1703
|
+
},
|
|
1704
|
+
get content() {
|
|
1705
|
+
return action.label;
|
|
1706
|
+
},
|
|
1707
|
+
onClick: () => reportChatFailure(() => executeChatAction(action), props.onError),
|
|
848
1708
|
get children() {
|
|
849
|
-
|
|
1709
|
+
var _el$170 = _$getNextElement(_tmpl$3);
|
|
1710
|
+
_$effect(() => _$className(_el$170, action.icon ?? "ti ti-dots"));
|
|
1711
|
+
return _el$170;
|
|
850
1712
|
}
|
|
851
|
-
})
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
_v$29 !== _p$.t && _$setProperty(_el$85, "multiple", _p$.t = _v$29);
|
|
872
|
-
return _p$;
|
|
873
|
-
}, {
|
|
874
|
-
e: undefined,
|
|
875
|
-
t: undefined
|
|
876
|
-
});
|
|
877
|
-
return _el$85;
|
|
878
|
-
}
|
|
879
|
-
}), _el$91, _co$23);
|
|
880
|
-
_$insert(_el$83, _$createComponent(Show, {
|
|
881
|
-
get when() {
|
|
882
|
-
return (props.models?.length ?? 0) > 0;
|
|
883
|
-
},
|
|
884
|
-
get children() {
|
|
885
|
-
return _$createComponent(SelectChip, {
|
|
886
|
-
get ["aria-label"]() {
|
|
887
|
-
return messages().chooseModel;
|
|
888
|
-
},
|
|
889
|
-
position: "top-right",
|
|
890
|
-
"class": "k2b-chat-composer__model",
|
|
891
|
-
menuWidth: "15rem",
|
|
892
|
-
get placeholder() {
|
|
893
|
-
return messages().model;
|
|
894
|
-
},
|
|
895
|
-
value: () => props.selectedModelId ?? "",
|
|
896
|
-
get options() {
|
|
897
|
-
return (props.models ?? []).map(model => ({
|
|
898
|
-
value: model.id,
|
|
899
|
-
label: model.label,
|
|
900
|
-
description: model.description,
|
|
901
|
-
icon: model.icon,
|
|
902
|
-
image: model.image
|
|
903
|
-
}));
|
|
904
|
-
},
|
|
905
|
-
get disabled() {
|
|
906
|
-
return blocked() || running() || !props.onModelChange;
|
|
907
|
-
},
|
|
908
|
-
onValueChange: modelId => {
|
|
909
|
-
props.onModelChange?.(modelId);
|
|
910
|
-
queueMicrotask(focus);
|
|
911
|
-
}
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
|
-
}), _el$93, _co$24);
|
|
915
|
-
_$insert(_el$83, () => props.modelDetails, _el$95, _co$25);
|
|
916
|
-
return _el$83;
|
|
917
|
-
})(), (() => {
|
|
918
|
-
var _el$96 = _$getNextElement(_tmpl$22),
|
|
919
|
-
_el$98 = _el$96.firstChild,
|
|
920
|
-
[_el$99, _co$26] = _$getNextMarker(_el$98.nextSibling),
|
|
921
|
-
_el$100 = _el$99.nextSibling,
|
|
922
|
-
[_el$101, _co$27] = _$getNextMarker(_el$100.nextSibling),
|
|
923
|
-
_el$102 = _el$101.nextSibling,
|
|
924
|
-
[_el$103, _co$28] = _$getNextMarker(_el$102.nextSibling),
|
|
925
|
-
_el$104 = _el$103.nextSibling,
|
|
926
|
-
[_el$105, _co$29] = _$getNextMarker(_el$104.nextSibling);
|
|
927
|
-
_$insert(_el$96, _$createComponent(For, {
|
|
928
|
-
get each() {
|
|
929
|
-
return props.contextActions;
|
|
930
|
-
},
|
|
931
|
-
children: action => _$createComponent(Tooltip.Trigger, {
|
|
932
|
-
type: "button",
|
|
933
|
-
"class": "k2b-chat-composer__icon-action",
|
|
934
|
-
get ["data-tone"]() {
|
|
935
|
-
return action.variant === "danger" ? "danger" : undefined;
|
|
936
|
-
},
|
|
937
|
-
get disabled() {
|
|
938
|
-
return action.disabled;
|
|
939
|
-
},
|
|
940
|
-
get ["aria-pressed"]() {
|
|
941
|
-
return action.pressed;
|
|
942
|
-
},
|
|
943
|
-
get ["aria-label"]() {
|
|
944
|
-
return action.label;
|
|
945
|
-
},
|
|
946
|
-
get content() {
|
|
947
|
-
return action.label;
|
|
948
|
-
},
|
|
949
|
-
onClick: () => reportChatFailure(() => executeChatAction(action), props.onError),
|
|
950
|
-
get children() {
|
|
951
|
-
var _el$106 = _$getNextElement(_tmpl$15);
|
|
952
|
-
_$effect(() => _$className(_el$106, action.icon ?? "ti ti-dots"));
|
|
953
|
-
return _el$106;
|
|
954
|
-
}
|
|
955
|
-
})
|
|
956
|
-
}), _el$99, _co$26);
|
|
957
|
-
_$insert(_el$96, _$createComponent(Show, {
|
|
958
|
-
get when() {
|
|
959
|
-
return _$memo(() => !!hasContextUsage())() ? props.contextUsage ?? {} : undefined;
|
|
960
|
-
},
|
|
961
|
-
children: usage => _$createComponent(ContextUsage, _$mergeProps(usage, {
|
|
962
|
-
get action() {
|
|
963
|
-
return props.contextPopupAction;
|
|
964
|
-
},
|
|
965
|
-
get onActionError() {
|
|
966
|
-
return props.onError;
|
|
967
|
-
}
|
|
968
|
-
}))
|
|
969
|
-
}), _el$101, _co$27);
|
|
970
|
-
_$insert(_el$96, () => props.submitTools, _el$103, _co$28);
|
|
971
|
-
_$insert(_el$96, _$createComponent(Show, {
|
|
972
|
-
get when() {
|
|
973
|
-
return _$memo(() => !!(running() && !hasDraft()))() && props.onStop;
|
|
974
|
-
},
|
|
975
|
-
get fallback() {
|
|
976
|
-
return _$createComponent(Tooltip.Trigger, {
|
|
977
|
-
type: "button",
|
|
978
|
-
"class": "k2b-chat-composer__send",
|
|
979
|
-
get disabled() {
|
|
980
|
-
return !canSubmit();
|
|
981
|
-
},
|
|
982
|
-
get ["aria-label"]() {
|
|
983
|
-
return _$memo(() => !!submitting())() ? _$memo(() => !!running())() ? _$memo(() => runningSubmitIntent() === "queue")() ? messages().queueing : messages().steering : messages().sending : _$memo(() => !!running())() ? _$memo(() => runningSubmitIntent() === "queue")() ? messages().queueMessage : messages().steerResponse : messages().sendMessage;
|
|
984
|
-
},
|
|
985
|
-
get content() {
|
|
986
|
-
return _$memo(() => !!running())() ? _$memo(() => runningSubmitIntent() === "queue")() ? messages().queueMessage : messages().steerResponse : messages().sendMessage;
|
|
987
|
-
},
|
|
988
|
-
onClick: () => void submit(),
|
|
989
|
-
get children() {
|
|
990
|
-
var _el$107 = _$getNextElement(_tmpl$15);
|
|
991
|
-
_$effect(() => _$className(_el$107, submitting() ? "ti ti-loader-2 k2b-spin" : "ti ti-arrow-up"));
|
|
992
|
-
return _el$107;
|
|
993
|
-
}
|
|
994
|
-
});
|
|
1713
|
+
})
|
|
1714
|
+
}), _el$161, _co$43);
|
|
1715
|
+
_$insert(_el$159, _$createComponent(Show, {
|
|
1716
|
+
get when() {
|
|
1717
|
+
return _$memo(() => !!hasContextUsage())() ? props.contextUsage ?? {} : undefined;
|
|
1718
|
+
},
|
|
1719
|
+
children: usage => _$createComponent(ContextUsage, _$mergeProps(usage, {
|
|
1720
|
+
get action() {
|
|
1721
|
+
return props.contextPopupAction;
|
|
1722
|
+
},
|
|
1723
|
+
get onActionError() {
|
|
1724
|
+
return props.onError;
|
|
1725
|
+
}
|
|
1726
|
+
}))
|
|
1727
|
+
}), _el$163, _co$44);
|
|
1728
|
+
_$insert(_el$159, () => props.submitTools, _el$165, _co$45);
|
|
1729
|
+
_$insert(_el$159, microphoneControl, _el$167, _co$46);
|
|
1730
|
+
_$insert(_el$159, sendControl, _el$169, _co$47);
|
|
1731
|
+
return _el$159;
|
|
1732
|
+
})()];
|
|
995
1733
|
},
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1734
|
+
children: content => content()
|
|
1735
|
+
}));
|
|
1736
|
+
return _el$143;
|
|
1737
|
+
})()];
|
|
1738
|
+
},
|
|
1739
|
+
get children() {
|
|
1740
|
+
return [_$createComponent(Show, {
|
|
1741
|
+
get when() {
|
|
1742
|
+
return props.error;
|
|
1743
|
+
},
|
|
1744
|
+
get children() {
|
|
1745
|
+
var _el$60 = _$getNextElement(_tmpl$19),
|
|
1746
|
+
_el$61 = _el$60.firstChild,
|
|
1747
|
+
_el$62 = _el$61.nextSibling,
|
|
1748
|
+
[_el$63, _co$11] = _$getNextMarker(_el$62.nextSibling);
|
|
1749
|
+
_$insert(_el$60, () => props.error, _el$63, _co$11);
|
|
1750
|
+
return _el$60;
|
|
1751
|
+
}
|
|
1752
|
+
}), _$memo(() => formatRow()), (() => {
|
|
1753
|
+
var _el$64 = _$getNextElement(_tmpl$20),
|
|
1754
|
+
_el$75 = _el$64.firstChild,
|
|
1755
|
+
[_el$76, _co$16] = _$getNextMarker(_el$75.nextSibling),
|
|
1756
|
+
_el$77 = _el$76.nextSibling,
|
|
1757
|
+
[_el$78, _co$17] = _$getNextMarker(_el$77.nextSibling),
|
|
1758
|
+
_el$65 = _el$78.nextSibling,
|
|
1759
|
+
_el$73 = _el$65.firstChild,
|
|
1760
|
+
[_el$74, _co$15] = _$getNextMarker(_el$73.nextSibling),
|
|
1761
|
+
_el$66 = _el$74.nextSibling,
|
|
1762
|
+
_el$67 = _el$66.firstChild,
|
|
1763
|
+
[_el$68, _co$12] = _$getNextMarker(_el$67.nextSibling),
|
|
1764
|
+
_el$69 = _el$68.nextSibling,
|
|
1765
|
+
[_el$70, _co$13] = _$getNextMarker(_el$69.nextSibling),
|
|
1766
|
+
_el$71 = _el$70.nextSibling,
|
|
1767
|
+
[_el$72, _co$14] = _$getNextMarker(_el$71.nextSibling),
|
|
1768
|
+
_el$79 = _el$65.nextSibling,
|
|
1769
|
+
[_el$80, _co$18] = _$getNextMarker(_el$79.nextSibling);
|
|
1770
|
+
_$insert(_el$64, attachControl, _el$76, _co$16);
|
|
1771
|
+
_$insert(_el$64, fileInput, _el$78, _co$17);
|
|
1772
|
+
_$insert(_el$65, field, _el$74, _co$15);
|
|
1773
|
+
_$insert(_el$66, formatToggle, _el$68, _co$12);
|
|
1774
|
+
_$insert(_el$66, emojiButton, _el$70, _co$13);
|
|
1775
|
+
_$insert(_el$66, microphoneControl, _el$72, _co$14);
|
|
1776
|
+
_$insert(_el$64, sendControl, _el$80, _co$18);
|
|
1777
|
+
return _el$64;
|
|
1019
1778
|
})()];
|
|
1779
|
+
}
|
|
1780
|
+
}), _el$86, _co$21);
|
|
1781
|
+
_$insert(_el$57, _$createComponent(Show, {
|
|
1782
|
+
get when() {
|
|
1783
|
+
return props.fileSelection;
|
|
1020
1784
|
},
|
|
1021
|
-
children:
|
|
1022
|
-
|
|
1785
|
+
children: selection => _$createComponent(FileDropTarget, {
|
|
1786
|
+
get label() {
|
|
1787
|
+
return messages().dropFilesToAttach;
|
|
1788
|
+
},
|
|
1789
|
+
get accept() {
|
|
1790
|
+
return selection().accept;
|
|
1791
|
+
},
|
|
1792
|
+
get multiple() {
|
|
1793
|
+
return selection().multiple;
|
|
1794
|
+
},
|
|
1795
|
+
get disabled() {
|
|
1796
|
+
return !canSelectFiles();
|
|
1797
|
+
},
|
|
1798
|
+
onDrop: files => void runFiles(files)
|
|
1799
|
+
})
|
|
1800
|
+
}), _el$88, _co$22);
|
|
1023
1801
|
_$effect(_p$ => {
|
|
1024
|
-
var _v$
|
|
1025
|
-
_v$
|
|
1026
|
-
_v$
|
|
1027
|
-
_v$
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
_v$1 = props.inputLabel ?? messages().message,
|
|
1033
|
-
_v$10 = commandsOpen() ? "combobox" : undefined,
|
|
1034
|
-
_v$11 = commandsOpen() ? "list" : undefined,
|
|
1035
|
-
_v$12 = commandsOpen() ? commandListId : undefined,
|
|
1036
|
-
_v$13 = commandsOpen() ? "true" : undefined,
|
|
1037
|
-
_v$14 = selectedCommand() ? `${commandListId}-${selectedCommandIndex()}` : undefined;
|
|
1038
|
-
_v$3 !== _p$.e && _$className(_el$25, _p$.e = _v$3);
|
|
1039
|
-
_v$4 !== _p$.t && _$setAttribute(_el$25, "data-running", _p$.t = _v$4);
|
|
1040
|
-
_v$5 !== _p$.a && _$setAttribute(_el$25, "data-drag-active", _p$.a = _v$5);
|
|
1041
|
-
_v$6 !== _p$.o && _$setAttribute(_el$25, "aria-label", _p$.o = _v$6);
|
|
1042
|
-
_v$7 !== _p$.i && _$setAttribute(_el$27, "aria-label", _p$.i = _v$7);
|
|
1043
|
-
_v$8 !== _p$.n && _el$33.classList.toggle("k2b-chat-composer__textarea--highlighted", _p$.n = _v$8);
|
|
1044
|
-
_v$9 !== _p$.s && _$setProperty(_el$33, "disabled", _p$.s = _v$9);
|
|
1045
|
-
_v$0 !== _p$.h && _$setAttribute(_el$33, "placeholder", _p$.h = _v$0);
|
|
1046
|
-
_v$1 !== _p$.r && _$setAttribute(_el$33, "aria-label", _p$.r = _v$1);
|
|
1047
|
-
_v$10 !== _p$.d && _$setAttribute(_el$33, "role", _p$.d = _v$10);
|
|
1048
|
-
_v$11 !== _p$.l && _$setAttribute(_el$33, "aria-autocomplete", _p$.l = _v$11);
|
|
1049
|
-
_v$12 !== _p$.u && _$setAttribute(_el$33, "aria-controls", _p$.u = _v$12);
|
|
1050
|
-
_v$13 !== _p$.c && _$setAttribute(_el$33, "aria-expanded", _p$.c = _v$13);
|
|
1051
|
-
_v$14 !== _p$.w && _$setAttribute(_el$33, "aria-activedescendant", _p$.w = _v$14);
|
|
1802
|
+
var _v$15 = `k2b-chat-composer ${props.class ?? ""}`,
|
|
1803
|
+
_v$16 = running() ? "true" : undefined,
|
|
1804
|
+
_v$17 = conversation() ? "conversation" : undefined,
|
|
1805
|
+
_v$18 = props.label ?? messages().messageComposer;
|
|
1806
|
+
_v$15 !== _p$.e && _$className(_el$57, _p$.e = _v$15);
|
|
1807
|
+
_v$16 !== _p$.t && _$setAttribute(_el$57, "data-running", _p$.t = _v$16);
|
|
1808
|
+
_v$17 !== _p$.a && _$setAttribute(_el$57, "data-variant", _p$.a = _v$17);
|
|
1809
|
+
_v$18 !== _p$.o && _$setAttribute(_el$57, "aria-label", _p$.o = _v$18);
|
|
1052
1810
|
return _p$;
|
|
1053
1811
|
}, {
|
|
1054
1812
|
e: undefined,
|
|
1055
1813
|
t: undefined,
|
|
1056
1814
|
a: undefined,
|
|
1057
|
-
o: undefined
|
|
1058
|
-
i: undefined,
|
|
1059
|
-
n: undefined,
|
|
1060
|
-
s: undefined,
|
|
1061
|
-
h: undefined,
|
|
1062
|
-
r: undefined,
|
|
1063
|
-
d: undefined,
|
|
1064
|
-
l: undefined,
|
|
1065
|
-
u: undefined,
|
|
1066
|
-
c: undefined,
|
|
1067
|
-
w: undefined
|
|
1815
|
+
o: undefined
|
|
1068
1816
|
});
|
|
1069
|
-
|
|
1070
|
-
_$runHydrationEvents();
|
|
1071
|
-
return _el$3;
|
|
1817
|
+
return _el$29;
|
|
1072
1818
|
})();
|
|
1073
1819
|
}
|
|
1074
|
-
_$delegateEvents(["input", "click", "keyup", "beforeinput", "keydown", "pointerdown"]);
|
|
1820
|
+
_$delegateEvents(["input", "click", "keyup", "beforeinput", "keydown", "pointerdown", "mousedown"]);
|
|
1075
1821
|
//# sourceMappingURL=ChatComposer.js.map
|