@aleph-alpha/chat-kit 0.6.1 → 0.8.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 (42) hide show
  1. package/dist/{CkInput.vue_vue_type_script_setup_true_lang-BWh7IesK.js → CkInput.vue_vue_type_script_setup_true_lang-Bpa5PJj-.js} +245 -63
  2. package/dist/chat-kit.css +20 -0
  3. package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts +8 -0
  4. package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts.map +1 -0
  5. package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts +31 -0
  6. package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts.map +1 -0
  7. package/dist/components/base/CkCopyMessageActionButton/index.d.ts +2 -0
  8. package/dist/components/base/CkCopyMessageActionButton/index.d.ts.map +1 -0
  9. package/dist/components/base/CkMessageActionButton/CkMessageActionButton.stories.d.ts +7 -0
  10. package/dist/components/base/CkMessageActionButton/CkMessageActionButton.stories.d.ts.map +1 -0
  11. package/dist/components/base/CkMessageActionButton/CkMessageActionButton.vue.d.ts +20 -0
  12. package/dist/components/base/CkMessageActionButton/CkMessageActionButton.vue.d.ts.map +1 -0
  13. package/dist/components/base/CkMessageActionButton/index.d.ts +2 -0
  14. package/dist/components/base/CkMessageActionButton/index.d.ts.map +1 -0
  15. package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts +1 -1
  16. package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts.map +1 -1
  17. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts +8 -0
  18. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts.map +1 -0
  19. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts +25 -0
  20. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts.map +1 -0
  21. package/dist/components/base/CkPromptStopButton/index.d.ts +2 -0
  22. package/dist/components/base/CkPromptStopButton/index.d.ts.map +1 -0
  23. package/dist/components/base/icons/CkStopIcon.vue.d.ts +4 -0
  24. package/dist/components/base/icons/CkStopIcon.vue.d.ts.map +1 -0
  25. package/dist/components/base/icons/index.d.ts +1 -0
  26. package/dist/components/base/icons/index.d.ts.map +1 -1
  27. package/dist/components/base/index.d.ts +4 -0
  28. package/dist/components/base/index.d.ts.map +1 -1
  29. package/dist/components/composed/CkConversation/CkConversation.vue.d.ts.map +1 -1
  30. package/dist/components/composed/CkInput/CkInput.stories.d.ts +1 -1
  31. package/dist/components/composed/CkInput/CkInput.stories.d.ts.map +1 -1
  32. package/dist/components/composed/CkInput/CkInput.vue.d.ts +9 -3
  33. package/dist/components/composed/CkInput/CkInput.vue.d.ts.map +1 -1
  34. package/dist/components/index.d.ts +1 -1
  35. package/dist/components/index.d.ts.map +1 -1
  36. package/dist/components/index.js +10 -5
  37. package/dist/handlers/index.js +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +11 -6
  41. package/dist/{useChatKitLabels-xZXcnxZZ.js → useChatKitLabels-DOiK9ds0.js} +113 -52
  42. package/package.json +3 -3
@@ -1,6 +1,50 @@
1
- import { defineComponent, openBlock, createElementBlock, renderSlot, createCommentVNode, createElementVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, toRefs, computed, h, createBlock, unref, mergeProps, withCtx, useId, useTemplateRef, withModifiers, toDisplayString, createTextVNode, useSlots, createVNode, createSlots, normalizeProps, guardReactiveProps, normalizeClass } from "vue";
2
- import { a as useMarkdownParser, u as useChatKitLabels } from "./useChatKitLabels-xZXcnxZZ.js";
3
- import { UiIconButton, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback } from "@aleph-alpha/ui-library";
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, createBlock, unref, mergeProps, withCtx, createVNode, Transition, toDisplayString, toRefs, computed, h, useId, useTemplateRef, withModifiers, createTextVNode, useSlots, createSlots, normalizeProps, guardReactiveProps, normalizeClass } from "vue";
2
+ import { a as useMarkdownParser, u as useChatKitLabels } from "./useChatKitLabels-DOiK9ds0.js";
3
+ import { UiIconButton, UiIcon, UiButton, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback } from "@aleph-alpha/ui-library";
4
+ const _hoisted_1$7 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "16",
7
+ height: "16",
8
+ viewBox: "0 0 24 24",
9
+ fill: "none",
10
+ stroke: "currentColor",
11
+ "stroke-width": "2",
12
+ "stroke-linecap": "round",
13
+ "stroke-linejoin": "round"
14
+ };
15
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
16
+ ...{ name: "CkSendIcon" },
17
+ __name: "CkSendIcon",
18
+ setup(__props) {
19
+ return (_ctx, _cache) => {
20
+ return openBlock(), createElementBlock("svg", _hoisted_1$7, [..._cache[0] || (_cache[0] = [
21
+ createElementVNode("path", { d: "M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" }, null, -1),
22
+ createElementVNode("path", { d: "M6 12h16" }, null, -1)
23
+ ])]);
24
+ };
25
+ }
26
+ });
27
+ const _hoisted_1$6 = {
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ width: "16",
30
+ height: "16",
31
+ viewBox: "0 0 16 16",
32
+ fill: "none"
33
+ };
34
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
35
+ ...{ name: "CkStopIcon" },
36
+ __name: "CkStopIcon",
37
+ setup(__props) {
38
+ return (_ctx, _cache) => {
39
+ return openBlock(), createElementBlock("svg", _hoisted_1$6, [..._cache[0] || (_cache[0] = [
40
+ createElementVNode("path", {
41
+ d: "M13.3335 3.33301C13.3335 2.96482 13.035 2.66634 12.6668 2.66634H3.3335C2.96531 2.66634 2.66683 2.96482 2.66683 3.33301V12.6663C2.66683 13.0345 2.96531 13.333 3.3335 13.333H12.6668C13.035 13.333 13.3335 13.0345 13.3335 12.6663V3.33301ZM14.6668 12.6663C14.6668 13.7709 13.7714 14.6663 12.6668 14.6663H3.3335C2.22893 14.6663 1.3335 13.7709 1.3335 12.6663V3.33301C1.3335 2.22844 2.22893 1.33301 3.3335 1.33301H12.6668C13.7714 1.33301 14.6668 2.22844 14.6668 3.33301V12.6663Z",
42
+ fill: "#1D1D1B"
43
+ }, null, -1)
44
+ ])]);
45
+ };
46
+ }
47
+ });
4
48
  const _hoisted_1$5 = { class: "flex w-full items-start gap-2" };
5
49
  const _hoisted_2$3 = {
6
50
  key: 0,
@@ -15,7 +59,7 @@ const _hoisted_5$1 = {
15
59
  key: 1,
16
60
  class: "flex items-center"
17
61
  };
18
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
62
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
19
63
  ...{ name: "CkAgentMessage" },
20
64
  __name: "CkAgentMessage",
21
65
  setup(__props) {
@@ -48,7 +92,7 @@ const _hoisted_3$1 = {
48
92
  key: 1,
49
93
  class: "flex justify-start"
50
94
  };
51
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
95
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
52
96
  ...{ name: "CkConversationLayout" },
53
97
  __name: "CkConversationLayout",
54
98
  props: {
@@ -197,6 +241,121 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
197
241
  };
198
242
  }
199
243
  });
244
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
245
+ ...{
246
+ name: "CkMessageActionButton"
247
+ },
248
+ __name: "CkMessageActionButton",
249
+ props: {
250
+ ariaLabel: {},
251
+ disabled: { type: Boolean, default: false }
252
+ },
253
+ setup(__props) {
254
+ return (_ctx, _cache) => {
255
+ return openBlock(), createBlock(unref(UiIconButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
256
+ disabled: __props.disabled,
257
+ variant: "ghost",
258
+ class: "message-action-button box-border w-8 h-8 transition-colors hover:bg-background-surface-muted hover:border-border-button-outlined focus-visible:bg-background-surface-muted focus-visible:border-border-button-outlined active:bg-background-surface-muted active:border-border-button-outlined"
259
+ }), {
260
+ default: withCtx(() => [
261
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
262
+ ]),
263
+ _: 3
264
+ }, 16, ["disabled"]);
265
+ };
266
+ }
267
+ });
268
+ const _export_sfc = (sfc, props) => {
269
+ const target = sfc.__vccOpts || sfc;
270
+ for (const [key, val] of props) {
271
+ target[key] = val;
272
+ }
273
+ return target;
274
+ };
275
+ const CkMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-ee7595cc"]]);
276
+ const _hoisted_1$3 = {
277
+ class: "sr-only",
278
+ "aria-live": "polite"
279
+ };
280
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
281
+ ...{
282
+ name: "CkCopyMessageActionButton"
283
+ },
284
+ __name: "CkCopyMessageActionButton",
285
+ props: {
286
+ text: {},
287
+ disabled: { type: Boolean, default: false },
288
+ durationMs: { default: 3e3 },
289
+ ariaLabelCopy: { default: "Copy message" },
290
+ ariaLabelCopied: { default: "Copied" },
291
+ writeToClipboard: { type: Function, default: void 0 }
292
+ },
293
+ emits: ["copy"],
294
+ setup(__props, { emit: __emit }) {
295
+ const props = __props;
296
+ const emit = __emit;
297
+ const copied = ref(false);
298
+ let resetTimer;
299
+ onUnmounted(() => {
300
+ if (resetTimer !== void 0) {
301
+ clearTimeout(resetTimer);
302
+ }
303
+ });
304
+ async function handleClick() {
305
+ if (props.disabled) {
306
+ return;
307
+ }
308
+ try {
309
+ const write = props.writeToClipboard ?? ((t) => globalThis.navigator.clipboard.writeText(t));
310
+ await write(props.text);
311
+ copied.value = true;
312
+ emit("copy", { success: true });
313
+ if (resetTimer !== void 0) {
314
+ clearTimeout(resetTimer);
315
+ }
316
+ resetTimer = setTimeout(() => {
317
+ copied.value = false;
318
+ resetTimer = void 0;
319
+ }, props.durationMs);
320
+ } catch {
321
+ emit("copy", { success: false });
322
+ }
323
+ }
324
+ return (_ctx, _cache) => {
325
+ return openBlock(), createElementBlock("div", null, [
326
+ createVNode(unref(CkMessageActionButton), mergeProps({ ariaLabel: copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy }, {
327
+ disabled: __props.disabled,
328
+ onClick: handleClick
329
+ }), {
330
+ default: withCtx(() => [
331
+ createVNode(Transition, {
332
+ name: "copy-message-icon-fade",
333
+ mode: "out-in"
334
+ }, {
335
+ default: withCtx(() => [
336
+ !copied.value ? (openBlock(), createBlock(unref(UiIcon), {
337
+ key: "copy",
338
+ name: "copy",
339
+ size: 16,
340
+ "aria-hidden": "true"
341
+ })) : (openBlock(), createBlock(unref(UiIcon), {
342
+ key: "check",
343
+ name: "check",
344
+ size: 16,
345
+ "aria-hidden": "true"
346
+ }))
347
+ ]),
348
+ _: 1
349
+ })
350
+ ]),
351
+ _: 1
352
+ }, 16, ["disabled"]),
353
+ createElementVNode("span", _hoisted_1$3, toDisplayString(copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy), 1)
354
+ ]);
355
+ };
356
+ }
357
+ });
358
+ const CkCopyMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-1fb0b8d1"]]);
200
359
  const defaultMarkdownClasses = {
201
360
  p: "my-1 leading-7",
202
361
  a: "underline underline-offset-4",
@@ -276,7 +435,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
276
435
  },
277
436
  setup(__props) {
278
437
  return (_ctx, _cache) => {
279
- return openBlock(), createBlock(unref(UiIconButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
438
+ return openBlock(), createBlock(unref(UiButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
439
+ size: "icon",
280
440
  type: __props.type,
281
441
  disabled: __props.disabled,
282
442
  loading: __props.loading,
@@ -290,14 +450,38 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
290
450
  };
291
451
  }
292
452
  });
293
- const _hoisted_1$3 = { class: "flex flex-col gap-2" };
453
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
454
+ ...{ name: "CkPromptStopButton" },
455
+ __name: "CkPromptStopButton",
456
+ props: {
457
+ ariaLabel: { default: "Stop generating" },
458
+ disabled: { type: Boolean, default: false }
459
+ },
460
+ emits: ["click"],
461
+ setup(__props) {
462
+ const props = __props;
463
+ return (_ctx, _cache) => {
464
+ return openBlock(), createBlock(unref(UiIconButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
465
+ disabled: props.disabled,
466
+ class: "!bg-brand-bg-brand hover:!bg-brand-bg-brand-hover !text-brand-content-default !rounded-md",
467
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
468
+ }), {
469
+ default: withCtx(() => [
470
+ renderSlot(_ctx.$slots, "default")
471
+ ]),
472
+ _: 3
473
+ }, 16, ["disabled"]);
474
+ };
475
+ }
476
+ });
477
+ const _hoisted_1$2 = { class: "flex flex-col gap-2" };
294
478
  const _hoisted_2$1 = ["for"];
295
479
  const _hoisted_3 = ["id", "value", "placeholder", "disabled"];
296
480
  const _hoisted_4 = { class: "flex items-center justify-between" };
297
481
  const _hoisted_5 = { key: 0 };
298
482
  const _hoisted_6 = { key: 1 };
299
483
  const _hoisted_7 = { class: "ml-auto" };
300
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
484
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
301
485
  ...{ name: "CkPromptInput" },
302
486
  __name: "CkPromptInput",
303
487
  props: {
@@ -349,7 +533,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
349
533
  );
350
534
  __expose({ focus, submit });
351
535
  return (_ctx, _cache) => {
352
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
536
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
353
537
  createElementVNode("form", {
354
538
  class: "border-core-border-default bg-core-bg-primary [&:has(textarea:focus)]:ring-core-border-focus flex flex-col gap-3 rounded-xl border px-4 pt-3 pb-3 shadow-sm [&:has(textarea:focus)]:ring-2",
355
539
  onSubmit: withModifiers(submit, ["prevent"])
@@ -389,11 +573,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
389
573
  };
390
574
  }
391
575
  });
392
- const _hoisted_1$2 = {
576
+ const _hoisted_1$1 = {
393
577
  key: 0,
394
578
  class: "text-core-content-tertiary text-center text-xs leading-3.5"
395
579
  };
396
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
580
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
397
581
  ...{ name: "CkPromptInputDisclaimer" },
398
582
  __name: "CkPromptInputDisclaimer",
399
583
  props: {
@@ -401,7 +585,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
401
585
  },
402
586
  setup(__props) {
403
587
  return (_ctx, _cache) => {
404
- return _ctx.$slots.default || __props.text ? (openBlock(), createElementBlock("p", _hoisted_1$2, [
588
+ return _ctx.$slots.default || __props.text ? (openBlock(), createElementBlock("p", _hoisted_1$1, [
405
589
  renderSlot(_ctx.$slots, "default", {}, () => [
406
590
  createTextVNode(toDisplayString(__props.text), 1)
407
591
  ])
@@ -409,9 +593,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
409
593
  };
410
594
  }
411
595
  });
412
- const _hoisted_1$1 = { class: "bg-background-surface-primary inline-flex max-w-[600px] flex-col items-end justify-start gap-4 rounded-xl p-6" };
596
+ const _hoisted_1 = { class: "bg-background-surface-primary inline-flex max-w-[600px] flex-col items-end justify-start gap-4 rounded-xl p-6" };
413
597
  const _hoisted_2 = { class: "text-content-on-surface-primary justify-start self-stretch text-base leading-6 font-normal" };
414
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
598
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
415
599
  ...{ name: "CkUserMessage" },
416
600
  __name: "CkUserMessage",
417
601
  props: {
@@ -419,7 +603,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
419
603
  },
420
604
  setup(__props) {
421
605
  return (_ctx, _cache) => {
422
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
606
+ return openBlock(), createElementBlock("div", _hoisted_1, [
423
607
  createElementVNode("div", _hoisted_2, [
424
608
  renderSlot(_ctx.$slots, "default", {}, () => [
425
609
  createTextVNode(toDisplayString(__props.message), 1)
@@ -429,7 +613,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
429
613
  };
430
614
  }
431
615
  });
432
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
616
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
433
617
  ...{ name: "CkConversation" },
434
618
  __name: "CkConversation",
435
619
  props: {
@@ -448,13 +632,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
448
632
  );
449
633
  const isLoading = (message) => message.status === "started" || message.status === "sending";
450
634
  return (_ctx, _cache) => {
451
- return openBlock(), createBlock(_sfc_main$8, { messages: __props.messages }, {
635
+ return openBlock(), createBlock(_sfc_main$a, { messages: __props.messages }, {
452
636
  "user-message": withCtx(({ message }) => [
453
637
  createElementVNode("div", {
454
638
  class: normalizeClass({ "ml-8": hasIcon.value })
455
639
  }, [
456
640
  renderSlot(_ctx.$slots, "user-message", { message }, () => [
457
- createVNode(_sfc_main$3, {
641
+ createVNode(_sfc_main$2, {
458
642
  message: message.content
459
643
  }, {
460
644
  default: withCtx(() => [
@@ -469,7 +653,15 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
469
653
  ]),
470
654
  "agent-message": withCtx(({ message }) => [
471
655
  renderSlot(_ctx.$slots, "agent-message", { message }, () => [
472
- createVNode(_sfc_main$9, null, createSlots({
656
+ createVNode(_sfc_main$b, null, createSlots({
657
+ footer: withCtx(() => [
658
+ renderSlot(_ctx.$slots, "agent-message-footer", { message }, () => [
659
+ message.content && !isLoading(message) ? (openBlock(), createBlock(CkCopyMessageActionButton, {
660
+ key: 0,
661
+ text: message.content
662
+ }, null, 8, ["text"])) : createCommentVNode("", true)
663
+ ])
664
+ ]),
473
665
  default: withCtx(() => [
474
666
  renderSlot(_ctx.$slots, "agent-message-content", { message }, () => [
475
667
  createVNode(_sfc_main$7, {
@@ -541,13 +733,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
541
733
  renderSlot(_ctx.$slots, "agent-message-header", { message })
542
734
  ]),
543
735
  key: "1"
544
- } : void 0,
545
- _ctx.$slots["agent-message-footer"] ? {
546
- name: "footer",
547
- fn: withCtx(() => [
548
- renderSlot(_ctx.$slots, "agent-message-footer", { message })
549
- ]),
550
- key: "2"
551
736
  } : void 0
552
737
  ]), 1024)
553
738
  ])
@@ -557,29 +742,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
557
742
  };
558
743
  }
559
744
  });
560
- const _hoisted_1 = {
561
- xmlns: "http://www.w3.org/2000/svg",
562
- width: "16",
563
- height: "16",
564
- viewBox: "0 0 24 24",
565
- fill: "none",
566
- stroke: "currentColor",
567
- "stroke-width": "2",
568
- "stroke-linecap": "round",
569
- "stroke-linejoin": "round"
570
- };
571
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
572
- ...{ name: "CkSendIcon" },
573
- __name: "CkSendIcon",
574
- setup(__props) {
575
- return (_ctx, _cache) => {
576
- return openBlock(), createElementBlock("svg", _hoisted_1, [..._cache[0] || (_cache[0] = [
577
- createElementVNode("path", { d: "M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" }, null, -1),
578
- createElementVNode("path", { d: "M6 12h16" }, null, -1)
579
- ])]);
580
- };
581
- }
582
- });
583
745
  const _sfc_main = /* @__PURE__ */ defineComponent({
584
746
  ...{ name: "CkInput" },
585
747
  __name: "CkInput",
@@ -590,9 +752,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
590
752
  loading: { type: Boolean, default: false },
591
753
  maxHeight: { default: 200 },
592
754
  ariaLabel: { default: "Chat message input" },
755
+ stopAriaLabel: { default: "Stop generating" },
593
756
  disclaimer: { default: void 0 }
594
757
  },
595
- emits: ["update:modelValue", "submit"],
758
+ emits: ["update:modelValue", "submit", "stop"],
596
759
  setup(__props, { expose: __expose, emit: __emit }) {
597
760
  const props = __props;
598
761
  const emit = __emit;
@@ -604,6 +767,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
604
767
  function onSubmit(value) {
605
768
  emit("submit", value);
606
769
  }
770
+ function onStop() {
771
+ emit("stop");
772
+ }
607
773
  function focus() {
608
774
  promptInputRef.value?.focus();
609
775
  }
@@ -612,7 +778,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
612
778
  }
613
779
  __expose({ focus, submit });
614
780
  return (_ctx, _cache) => {
615
- return openBlock(), createBlock(_sfc_main$5, {
781
+ return openBlock(), createBlock(_sfc_main$4, {
616
782
  ref_key: "promptInputRef",
617
783
  ref: promptInputRef,
618
784
  "model-value": __props.modelValue,
@@ -625,23 +791,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
625
791
  }, createSlots({
626
792
  "toolbar-right": withCtx((scope) => [
627
793
  renderSlot(_ctx.$slots, "toolbar-right", normalizeProps(guardReactiveProps(scope)), () => [
628
- createVNode(_sfc_main$6, mergeProps({ ariaLabel: "Send message" }, {
794
+ __props.loading ? (openBlock(), createBlock(_sfc_main$5, {
795
+ key: 0,
796
+ "aria-label": __props.stopAriaLabel,
797
+ disabled: __props.disabled,
798
+ onClick: onStop
799
+ }, {
800
+ default: withCtx(() => [
801
+ renderSlot(_ctx.$slots, "stop-icon", {}, () => [
802
+ createVNode(_sfc_main$c)
803
+ ])
804
+ ]),
805
+ _: 3
806
+ }, 8, ["aria-label", "disabled"])) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, { ariaLabel: "Send message" }, {
629
807
  type: "submit",
630
- disabled: scope.disabled,
631
- loading: __props.loading
808
+ disabled: scope.disabled
632
809
  }), {
633
810
  default: withCtx(() => [
634
811
  renderSlot(_ctx.$slots, "send-icon", {}, () => [
635
- createVNode(_sfc_main$1)
812
+ createVNode(_sfc_main$d)
636
813
  ])
637
814
  ]),
638
815
  _: 3
639
- }, 16, ["disabled", "loading"])
816
+ }, 16, ["disabled"]))
640
817
  ])
641
818
  ]),
642
819
  footer: withCtx(() => [
643
820
  renderSlot(_ctx.$slots, "footer", {}, () => [
644
- __props.disclaimer ? (openBlock(), createBlock(_sfc_main$4, {
821
+ __props.disclaimer ? (openBlock(), createBlock(_sfc_main$3, {
645
822
  key: 0,
646
823
  text: __props.disclaimer
647
824
  }, null, 8, ["text"])) : createCommentVNode("", true)
@@ -661,13 +838,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
661
838
  }
662
839
  });
663
840
  export {
664
- _sfc_main$9 as _,
665
- _sfc_main$2 as a,
666
- _sfc_main$8 as b,
841
+ CkCopyMessageActionButton as C,
842
+ _sfc_main$b as _,
843
+ _sfc_main$1 as a,
844
+ _sfc_main$a as b,
667
845
  _sfc_main as c,
668
846
  _sfc_main$7 as d,
669
- _sfc_main$6 as e,
670
- _sfc_main$5 as f,
847
+ CkMessageActionButton as e,
848
+ _sfc_main$6 as f,
671
849
  _sfc_main$4 as g,
672
- _sfc_main$3 as h
850
+ _sfc_main$3 as h,
851
+ _sfc_main$5 as i,
852
+ _sfc_main$d as j,
853
+ _sfc_main$c as k,
854
+ _sfc_main$2 as l
673
855
  };
@@ -0,0 +1,20 @@
1
+
2
+ /* Ghost buttons inject a dark v-hover overlay; suppress it so token bg/border show through. */
3
+ .message-action-button[data-v-ee7595cc] .v-hover-overlay {
4
+ opacity: 0 !important;
5
+ }
6
+
7
+ .copy-message-icon-fade-enter-active[data-v-1fb0b8d1],
8
+ .copy-message-icon-fade-leave-active[data-v-1fb0b8d1] {
9
+ transition: opacity 0.15s ease-out;
10
+ }
11
+ .copy-message-icon-fade-enter-from[data-v-1fb0b8d1],
12
+ .copy-message-icon-fade-leave-to[data-v-1fb0b8d1] {
13
+ opacity: 0;
14
+ }
15
+ @media (prefers-reduced-motion: reduce) {
16
+ .copy-message-icon-fade-enter-active[data-v-1fb0b8d1],
17
+ .copy-message-icon-fade-leave-active[data-v-1fb0b8d1] {
18
+ transition-duration: 0.01ms;
19
+ }
20
+ }
@@ -0,0 +1,8 @@
1
+ import CkCopyMessageActionButton from './CkCopyMessageActionButton.vue';
2
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
3
+ declare const meta: Meta<typeof CkCopyMessageActionButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Disabled: Story;
8
+ //# sourceMappingURL=CkCopyMessageActionButton.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkCopyMessageActionButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,yBAAyB,CAShD,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC"}
@@ -0,0 +1,31 @@
1
+ type __VLS_Props = {
2
+ /** Plain text to copy to the clipboard */
3
+ text: string;
4
+ disabled?: boolean;
5
+ /** How long to show the checkmark before reverting (ms) */
6
+ durationMs?: number;
7
+ ariaLabelCopy?: string;
8
+ ariaLabelCopied?: string;
9
+ /**
10
+ * Optional writer (e.g. tests). When omitted, uses `navigator.clipboard.writeText`.
11
+ */
12
+ writeToClipboard?: (text: string) => Promise<void>;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ copy: (payload: {
16
+ success: boolean;
17
+ }) => any;
18
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
19
+ onCopy?: ((payload: {
20
+ success: boolean;
21
+ }) => any) | undefined;
22
+ }>, {
23
+ disabled: boolean;
24
+ durationMs: number;
25
+ ariaLabelCopy: string;
26
+ ariaLabelCopied: string;
27
+ writeToClipboard: (text: string) => Promise<void>;
28
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ //# sourceMappingURL=CkCopyMessageActionButton.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkCopyMessageActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue"],"names":[],"mappings":"AAoHE,KAAK,WAAW,GAAG;IACf,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD,CAAC;AA4KN,QAAA,MAAM,YAAY;;iBA/Ja,OAAO;;;;iBAAP,OAAO;;;cAtBrB,OAAO;gBAEL,MAAM;mBACH,MAAM;qBACJ,MAAM;sBAIL,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;6EAiLtD,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,2 @@
1
+ export { default as CkCopyMessageActionButton } from './CkCopyMessageActionButton.vue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import CkMessageActionButton from './CkMessageActionButton.vue';
2
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
3
+ declare const meta: Meta<typeof CkMessageActionButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ //# sourceMappingURL=CkMessageActionButton.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkMessageActionButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/CkMessageActionButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,qBAAqB,CAS5C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC"}
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ ariaLabel: string;
3
+ disabled?: boolean;
4
+ };
5
+ declare var __VLS_8: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_8) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
+ disabled: boolean;
11
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
20
+ //# sourceMappingURL=CkMessageActionButton.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkMessageActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/CkMessageActionButton.vue"],"names":[],"mappings":"AA4CE,KAAK,WAAW,GAAG;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAkEN,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU;cA1EC,OAAO;6EA6EtB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as CkMessageActionButton } from './CkMessageActionButton.vue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -9,8 +9,8 @@ type __VLS_Slots = {} & {
9
9
  default?: (props: typeof __VLS_8) => any;
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
- type: "button" | "submit";
13
12
  disabled: boolean;
13
+ type: "button" | "submit";
14
14
  loading: boolean;
15
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1 +1 @@
1
- {"version":3,"file":"CkPromptActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/CkPromptActionButton.vue"],"names":[],"mappings":"AAsCE,KAAK,WAAW,GAAG;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B,CAAC;AA8DN,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU;UAtEH,QAAQ,GAAG,QAAQ;cAFf,OAAO;aACR,OAAO;6EA0ErB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"CkPromptActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/CkPromptActionButton.vue"],"names":[],"mappings":"AAuCE,KAAK,WAAW,GAAG;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B,CAAC;AAgEN,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU;cA1EC,OAAO;UAEX,QAAQ,GAAG,QAAQ;aADhB,OAAO;6EA4ErB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import CkPromptStopButton from './CkPromptStopButton.vue';
2
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
3
+ declare const meta: Meta<typeof CkPromptStopButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Disabled: Story;
8
+ //# sourceMappingURL=CkPromptStopButton.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkPromptStopButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptStopButton/CkPromptStopButton.stories.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,kBAAkB,CASzC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAStB,CAAC"}
@@ -0,0 +1,25 @@
1
+ type __VLS_Props = {
2
+ ariaLabel?: string;
3
+ disabled?: boolean;
4
+ };
5
+ declare var __VLS_10: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_10) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
10
+ click: (event: MouseEvent) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onClick?: ((event: MouseEvent) => any) | undefined;
13
+ }>, {
14
+ ariaLabel: string;
15
+ disabled: boolean;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
25
+ //# sourceMappingURL=CkPromptStopButton.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkPromptStopButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptStopButton/CkPromptStopButton.vue"],"names":[],"mappings":"AAsCE,KAAK,WAAW,GAAG;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA0EN,QAAA,IAAI,QAAQ,IAAW,CAAE;AACzB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKhD,QAAA,MAAM,UAAU;;;;;eAnFE,MAAM;cACP,OAAO;6EAsFtB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}