@k2b/ui 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/browser/chat/ChatComposer.js +244 -193
  2. package/dist/browser/chat/ChatComposer.js.map +1 -1
  3. package/dist/browser/chat/chat-messages.js +6 -0
  4. package/dist/browser/chat/chat-messages.js.map +1 -1
  5. package/dist/browser/chat/types.js.map +1 -1
  6. package/dist/browser/content/Calendar.js +40 -5
  7. package/dist/browser/content/Calendar.js.map +1 -1
  8. package/dist/browser/content/calendar-event-detail.js +328 -0
  9. package/dist/browser/content/calendar-event-detail.js.map +1 -0
  10. package/dist/browser/content/calendar-messages.js +34 -2
  11. package/dist/browser/content/calendar-messages.js.map +1 -1
  12. package/dist/browser/content/calendar-shared.js +189 -82
  13. package/dist/browser/content/calendar-shared.js.map +1 -1
  14. package/dist/browser/content/calendar-time-view.js +101 -96
  15. package/dist/browser/content/calendar-time-view.js.map +1 -1
  16. package/dist/browser/content/index.js.map +1 -1
  17. package/dist/browser/inputs/dictation/Dictation.js +114 -108
  18. package/dist/browser/inputs/dictation/Dictation.js.map +1 -1
  19. package/dist/browser/inputs/dictation/dictation-messages.js +2 -0
  20. package/dist/browser/inputs/dictation/dictation-messages.js.map +1 -1
  21. package/dist/ssr/chat/ChatComposer.js +53 -30
  22. package/dist/ssr/chat/ChatComposer.js.map +1 -1
  23. package/dist/ssr/chat/chat-messages.js +6 -0
  24. package/dist/ssr/chat/chat-messages.js.map +1 -1
  25. package/dist/ssr/chat/types.js.map +1 -1
  26. package/dist/ssr/content/Calendar.js +36 -4
  27. package/dist/ssr/content/Calendar.js.map +1 -1
  28. package/dist/ssr/content/calendar-event-detail.js +212 -0
  29. package/dist/ssr/content/calendar-event-detail.js.map +1 -0
  30. package/dist/ssr/content/calendar-messages.js +34 -2
  31. package/dist/ssr/content/calendar-messages.js.map +1 -1
  32. package/dist/ssr/content/calendar-shared.js +117 -36
  33. package/dist/ssr/content/calendar-shared.js.map +1 -1
  34. package/dist/ssr/content/calendar-time-view.js +6 -4
  35. package/dist/ssr/content/calendar-time-view.js.map +1 -1
  36. package/dist/ssr/content/index.js.map +1 -1
  37. package/dist/ssr/inputs/dictation/Dictation.js +3 -1
  38. package/dist/ssr/inputs/dictation/Dictation.js.map +1 -1
  39. package/dist/ssr/inputs/dictation/dictation-messages.js +2 -0
  40. package/dist/ssr/inputs/dictation/dictation-messages.js.map +1 -1
  41. package/dist/styles.css +1 -1
  42. package/dist/types/chat/chat-messages.d.ts +3 -0
  43. package/dist/types/chat/types.d.ts +5 -0
  44. package/dist/types/content/Calendar.d.ts +29 -5
  45. package/dist/types/content/calendar-event-detail.d.ts +21 -0
  46. package/dist/types/content/calendar-messages.d.ts +16 -0
  47. package/dist/types/content/calendar-shared.d.ts +16 -1
  48. package/dist/types/content/calendar-time-view.d.ts +1 -1
  49. package/dist/types/content/index.d.ts +1 -1
  50. package/dist/types/inputs/dictation/dictation-messages.d.ts +1 -0
  51. package/package.json +1 -1
@@ -51,18 +51,19 @@ var _tmpl$ = ["<span><strong", ">", "</strong></span>"],
51
51
  _tmpl$42 = ["<div class=\"k2b-chat-composer__reply\">", "<button type=\"button\" class=\"k2b-chat-composer__icon-action k2b-chat-composer__reply-cancel\"", "><i class=\"ti ti-x\" aria-hidden=\"true\"></i></button></div>"],
52
52
  _tmpl$43 = ["<div class=\"k2b-message-row__quote\">", "</div>"],
53
53
  _tmpl$44 = ["<button type=\"button\" class=\"k2b-message-row__quote\">", "</button>"],
54
- _tmpl$45 = ["<button type=\"button\" class=\"k2b-chat-composer__attachment-remove\"", "", "><i class=\"ti ti-x\" aria-hidden=\"true\"></i></button>"],
55
- _tmpl$46 = ["<div class=\"k2b-chat-composer__attachment\" role=\"listitem\"><div class=\"", "\">", "", "</div>", "</div>"],
56
- _tmpl$47 = ["<img", ">"],
57
- _tmpl$48 = ["<div class=\"k2b-chat-composer__attachment-identity\">", "", "</div>"],
58
- _tmpl$49 = ["<a class=\"k2b-chat-composer__attachment-link\"", " target=\"_blank\" rel=\"noopener noreferrer\"", ">", "", "</a>"],
59
- _tmpl$50 = ["<button type=\"button\" class=\"k2b-chat-composer__attachment-action\"", ">", "", "</button>"],
60
- _tmpl$51 = ["<footer class=\"k2b-chat-composer__footer\">", "</footer>"],
61
- _tmpl$52 = ["<div class=\"k2b-chat-composer__tools\">", "", "", "", "", "", "", "</div>"],
62
- _tmpl$53 = ["<div class=\"k2b-chat-composer__submit\">", "", "", "", "", "", "</div>"],
63
- _tmpl$54 = ["<span>", "</span>"],
64
- _tmpl$55 = ["<div class=\"k2b-chat-composer__status-line\"", "><i aria-hidden=\"true\"", "></i><span>", "</span></div>"],
65
- _tmpl$56 = ["<span class=\"k2b-sr-only\">", "</span>"];
54
+ _tmpl$45 = ["<span class=\"k2b-chat-composer__attachment-action k2b-chat-composer__attachment-progress\">", "", "</span>"],
55
+ _tmpl$46 = ["<button type=\"button\" class=\"k2b-chat-composer__attachment-remove\"", "", "><i class=\"ti ti-x\" aria-hidden=\"true\"></i></button>"],
56
+ _tmpl$47 = ["<div class=\"k2b-chat-composer__attachment\" role=\"listitem\"><div class=\"", "\">", "", "", "</div>", "</div>"],
57
+ _tmpl$48 = ["<img", ">"],
58
+ _tmpl$49 = ["<div class=\"k2b-chat-composer__attachment-identity\">", "", "</div>"],
59
+ _tmpl$50 = ["<a class=\"k2b-chat-composer__attachment-link\"", " target=\"_blank\" rel=\"noopener noreferrer\"", ">", "", "</a>"],
60
+ _tmpl$51 = ["<button type=\"button\" class=\"k2b-chat-composer__attachment-action\"", "", ">", "", "</button>"],
61
+ _tmpl$52 = ["<footer class=\"k2b-chat-composer__footer\">", "</footer>"],
62
+ _tmpl$53 = ["<div class=\"k2b-chat-composer__tools\">", "", "", "", "", "", "", "</div>"],
63
+ _tmpl$54 = ["<div class=\"k2b-chat-composer__submit\">", "", "", "", "", "", "</div>"],
64
+ _tmpl$55 = ["<span>", "</span>"],
65
+ _tmpl$56 = ["<div class=\"k2b-chat-composer__status-line\"", "><i aria-hidden=\"true\"", "></i><span>", "</span></div>"],
66
+ _tmpl$57 = ["<span class=\"k2b-sr-only\">", "</span>"];
66
67
  import { batch, children, createEffect, createMemo, createSignal, createUniqueId, For, Index, on, onCleanup, onMount, Show, untrack } from "solid-js";
67
68
  import { Dropdown } from "../actions/Dropdown";
68
69
  import { dialogHistorySettled, holdDialogHistory } from "../feedback/dialog-core";
@@ -80,6 +81,7 @@ import { SelectChip } from "../inputs/SelectChip";
80
81
  import { useSelectMessages } from "../inputs/select-messages";
81
82
  import { useLocale } from "../intl/locale";
82
83
  import { useUiMessages } from "../intl/messages";
84
+ import { ProgressRing } from "../surfaces/ProgressRing";
83
85
  import { ChatContextUsage as ContextUsage } from "./ChatPrimitives";
84
86
  import { chatCommandKey, conversationEnterAction, executeChatAction, nextChatCommandIndex, reportChatFailure, runChatSubmission } from "./chat-behavior";
85
87
  import { useChatMessages } from "./chat-messages";
@@ -240,7 +242,10 @@ export function ChatComposer(props) {
240
242
  const [microphoneMenuOpen, setMicrophoneMenuOpen] = createSignal(false);
241
243
  const dictation = () => props.microphone?.dictation ?? null;
242
244
  const showHint = () => conversation() || dictation() !== null || hasContent(hint.toArray());
243
- const state = () => props.state ?? "idle";
245
+
246
+ // Handlers such as sending read these outside any owner. A host's conditional prop is a getter that creates a
247
+ // computation on each read, which would never be disposed there; memos read it inside the composer's owner.
248
+ const state = createMemo(() => props.state ?? "idle");
244
249
  const running = () => state() === "running";
245
250
  const stopping = () => state() === "stopping";
246
251
  const runningSubmitIntent = () => props.runningSubmitIntent ?? "steer";
@@ -927,7 +932,7 @@ export function ChatComposer(props) {
927
932
  selectedCommandKey();
928
933
  setAnnouncement(undefined);
929
934
  });
930
- const busy = () => Boolean(props.disabled || stopping() || state() === "submitting" || executing() || addingFiles());
935
+ const busy = createMemo(() => Boolean(props.disabled || stopping() || state() === "submitting" || executing() || addingFiles()));
931
936
  const blocked = () => busy() || submitting();
932
937
  /** The conversation field stays editable while a message is sent, so it keeps the focus and a phone its keyboard. */
933
938
  const editBlocked = () => conversation() ? busy() : blocked();
@@ -941,7 +946,7 @@ export function ChatComposer(props) {
941
946
  }));
942
947
  const hasDraft = () => Boolean(props.value.trim() || !running() && attachments().length > 0);
943
948
  /** The draft may go out now, apart from a submission that is already on its way. */
944
- const submittable = () => !busy() && !props.submitDisabled && hasDraft() && !(props.dictation && liveDictation.active()) && !(running() && runningSubmitIntent() === "steer" && mentions().length);
949
+ const submittable = createMemo(() => !busy() && !props.submitDisabled && hasDraft() && !(props.dictation && liveDictation.active()) && !(running() && runningSubmitIntent() === "steer" && mentions().length));
945
950
  const canSubmit = () => !submitting() && submittable();
946
951
  const canSelectFiles = () => Boolean(props.fileSelection && !props.fileSelection.disabled && !running() && !blocked());
947
952
  const hasAddMenu = () => Boolean(props.fileSelection || props.menuActions?.length);
@@ -2266,7 +2271,7 @@ export function ChatComposer(props) {
2266
2271
  }
2267
2272
  })));
2268
2273
  }
2269
- })), `k2b-chat-composer ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-running", running() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-variant", conversation() ? "conversation" : _$escape(undefined, true), false), _$ssrAttribute("aria-label", _$escape(props.label ?? chatMessages().messageComposer, true), false), _$escape(_$createComponent(Show, {
2274
+ })), `k2b-chat-composer ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-running", running() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-variant", conversation() ? "conversation" : _$escape(undefined, true), false) + _$ssrAttribute("data-invalid", props.error ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-disabled", props.disabled ? "true" : _$escape(undefined, true), false), _$ssrAttribute("aria-label", _$escape(props.label ?? chatMessages().messageComposer, true), false), _$escape(_$createComponent(Show, {
2270
2275
  get when() {
2271
2276
  return showHint();
2272
2277
  },
@@ -2308,12 +2313,12 @@ export function ChatComposer(props) {
2308
2313
  get each() {
2309
2314
  return attachments();
2310
2315
  },
2311
- children: attachment => _$ssr(_tmpl$46, `k2b-chat-composer__attachment-content ${Boolean(attachment.action) ? "k2b-chat-composer__attachment-content--action" : ""}`, _$escape(_$createComponent(Show, {
2316
+ children: attachment => _$ssr(_tmpl$47, `k2b-chat-composer__attachment-content ${Boolean(attachment.action) || attachment.progress !== undefined ? "k2b-chat-composer__attachment-content--action" : ""}`, _$escape(_$createComponent(Show, {
2312
2317
  get when() {
2313
2318
  return attachment.href;
2314
2319
  },
2315
2320
  get fallback() {
2316
- return _$ssr(_tmpl$48, _$escape(_$createComponent(Show, {
2321
+ return _$ssr(_tmpl$49, _$escape(_$createComponent(Show, {
2317
2322
  get when() {
2318
2323
  return _$memo(() => attachment.kind === "image")() && attachment.previewUrl;
2319
2324
  },
@@ -2321,11 +2326,11 @@ export function ChatComposer(props) {
2321
2326
  return _$ssr(_tmpl$3, _$ssrAttribute("class", _$escape(attachmentIcon(attachment), true), false));
2322
2327
  },
2323
2328
  get children() {
2324
- return _$ssr(_tmpl$47, _$ssrAttribute("src", _$escape(attachment.previewUrl, true), false) + _$ssrAttribute("alt", _$escape(attachment.alt ?? "", true), false));
2329
+ return _$ssr(_tmpl$48, _$ssrAttribute("src", _$escape(attachment.previewUrl, true), false) + _$ssrAttribute("alt", _$escape(attachment.alt ?? "", true), false));
2325
2330
  }
2326
2331
  })), _$escape(renderAttachmentCopy(attachment)));
2327
2332
  },
2328
- children: href => _$ssr(_tmpl$49, _$ssrAttribute("href", _$escape(href(), true), false), _$ssrAttribute("aria-label", _$escape(chatMessages().openInNewTab({
2333
+ children: href => _$ssr(_tmpl$50, _$ssrAttribute("href", _$escape(href(), true), false), _$ssrAttribute("aria-label", _$escape(chatMessages().openInNewTab({
2329
2334
  name: attachment.name
2330
2335
  }), true), false), _$escape(_$createComponent(Show, {
2331
2336
  get when() {
@@ -2335,14 +2340,32 @@ export function ChatComposer(props) {
2335
2340
  return _$ssr(_tmpl$3, _$ssrAttribute("class", _$escape(attachmentIcon(attachment), true), false));
2336
2341
  },
2337
2342
  get children() {
2338
- return _$ssr(_tmpl$47, _$ssrAttribute("src", _$escape(attachment.previewUrl, true), false) + _$ssrAttribute("alt", _$escape(attachment.alt ?? "", true), false));
2343
+ return _$ssr(_tmpl$48, _$ssrAttribute("src", _$escape(attachment.previewUrl, true), false) + _$ssrAttribute("alt", _$escape(attachment.alt ?? "", true), false));
2339
2344
  }
2340
2345
  })), _$escape(renderAttachmentCopy(attachment)))
2341
2346
  })), _$escape(_$createComponent(Show, {
2342
2347
  get when() {
2343
- return attachment.action;
2348
+ return attachment.progress !== undefined;
2349
+ },
2350
+ get children() {
2351
+ return _$ssr(_tmpl$45, _$escape(_$createComponent(ProgressRing, {
2352
+ get value() {
2353
+ return attachment.progress ?? 0;
2354
+ },
2355
+ get label() {
2356
+ return chatMessages().uploading({
2357
+ name: attachment.name
2358
+ });
2359
+ }
2360
+ })), _$escape(new Intl.NumberFormat(locale(), {
2361
+ style: "percent"
2362
+ }).format(Math.round(attachment.progress ?? 0) / 100)));
2363
+ }
2364
+ })), _$escape(_$createComponent(Show, {
2365
+ get when() {
2366
+ return _$memo(() => attachment.progress === undefined)() && attachment.action;
2344
2367
  },
2345
- children: action => _$ssr(_tmpl$50, _$ssrAttribute("disabled", blocked() || action().disabled, true), _$escape(_$createComponent(Show, {
2368
+ children: action => _$ssr(_tmpl$51, _$ssrAttribute("data-tone", action().variant === "danger" ? "danger" : _$escape(undefined, true), false) + _$ssrAttribute("data-waiting", action().disabled ? "" : _$escape(undefined, true), false), _$ssrAttribute("disabled", blocked() || action().disabled, true), _$escape(_$createComponent(Show, {
2346
2369
  get when() {
2347
2370
  return action().icon;
2348
2371
  },
@@ -2353,7 +2376,7 @@ export function ChatComposer(props) {
2353
2376
  return props.onAttachmentsChange;
2354
2377
  },
2355
2378
  get children() {
2356
- return _$ssr(_tmpl$45, _$ssrAttribute("aria-label", _$escape(selectMessages().removeNamed({
2379
+ return _$ssr(_tmpl$46, _$ssrAttribute("aria-label", _$escape(selectMessages().removeNamed({
2357
2380
  name: attachment.name
2358
2381
  }), true), false), _$ssrAttribute("disabled", blocked(), true));
2359
2382
  }
@@ -2372,12 +2395,12 @@ export function ChatComposer(props) {
2372
2395
  get children() {
2373
2396
  return _$ssr(_tmpl$28, _$escape(props.error));
2374
2397
  }
2375
- }), formatRow(), _$ssr(_tmpl$51, _$escape(_$createComponent(Show, {
2398
+ }), formatRow(), _$ssr(_tmpl$52, _$escape(_$createComponent(Show, {
2376
2399
  get when() {
2377
2400
  return dictating() || footer();
2378
2401
  },
2379
2402
  get fallback() {
2380
- return [_$ssr(_tmpl$52, _$escape(props.footerTools), _$escape(_$createComponent(Show, {
2403
+ return [_$ssr(_tmpl$53, _$escape(props.footerTools), _$escape(_$createComponent(Show, {
2381
2404
  get when() {
2382
2405
  return addOpensCommands();
2383
2406
  },
@@ -2440,7 +2463,7 @@ export function ChatComposer(props) {
2440
2463
  }
2441
2464
  });
2442
2465
  }
2443
- })), _$escape(props.modelDetails)), _$ssr(_tmpl$53, _$escape(_$createComponent(For, {
2466
+ })), _$escape(props.modelDetails)), _$ssr(_tmpl$54, _$escape(_$createComponent(For, {
2444
2467
  get each() {
2445
2468
  return props.contextActions;
2446
2469
  },
@@ -2566,18 +2589,18 @@ export function ChatComposer(props) {
2566
2589
  return suggestionAnnouncement();
2567
2590
  },
2568
2591
  keyed: true,
2569
- children: announced => _$ssr(_tmpl$54, _$escape(announced.text))
2592
+ children: announced => _$ssr(_tmpl$55, _$escape(announced.text))
2570
2593
  })), _$escape(_$createComponent(Show, {
2571
2594
  get when() {
2572
2595
  return _$memo(() => !!!suggestionsOpen())() && commandStatus();
2573
2596
  },
2574
- children: status => _$ssr(_tmpl$55, _$ssrAttribute("data-tone", _$escape(status().tone, true), false), _$ssrAttribute("class", status().tone === "busy" ? "ti ti-loader-2 k2b-spin" : status().tone === "done" ? "ti ti-check" : "ti ti-alert-circle", false), _$escape(status().text))
2597
+ children: status => _$ssr(_tmpl$56, _$ssrAttribute("data-tone", _$escape(status().tone, true), false), _$ssrAttribute("class", status().tone === "busy" ? "ti ti-loader-2 k2b-spin" : status().tone === "done" ? "ti ti-check" : "ti ti-alert-circle", false), _$escape(status().text))
2575
2598
  })), _$escape(_$createComponent(Show, {
2576
2599
  get when() {
2577
2600
  return _$memo(() => !!suggestionsOpen())() && announcement();
2578
2601
  },
2579
2602
  keyed: true,
2580
- children: announced => _$ssr(_tmpl$56, _$escape(announced.text))
2603
+ children: announced => _$ssr(_tmpl$57, _$escape(announced.text))
2581
2604
  })));
2582
2605
  }
2583
2606
  //# sourceMappingURL=ChatComposer.js.map