@aleph-alpha/chat-kit 1.14.0 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CkInput.vue_vue_type_script_setup_true_lang-BVZ7FG88.js → CkInput.vue_vue_type_script_setup_true_lang-DedLzDoO.js} +157 -82
- package/dist/components/base/CkAgentMessage/CkAgentMessage.vue.d.ts.map +1 -1
- package/dist/components/base/CkHistoryItem/CkHistoryItem.stories.d.ts.map +1 -1
- package/dist/components/base/CkHistoryItem/CkHistoryItem.vue.d.ts.map +1 -1
- package/dist/components/base/CkHistoryWrapper/CkHistoryWrapper.stories.d.ts.map +1 -1
- package/dist/components/composed/CkHistory/CkHistory.stories.d.ts +15 -0
- package/dist/components/composed/CkHistory/CkHistory.stories.d.ts.map +1 -1
- package/dist/components/composed/CkHistory/CkHistory.vue.d.ts +6 -0
- package/dist/components/composed/CkHistory/CkHistory.vue.d.ts.map +1 -1
- package/dist/components/composed/CkHistory/types.d.ts +33 -0
- package/dist/components/composed/CkHistory/types.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/handlers/index.js +1 -1
- package/dist/handlers/useChatKitLabels.d.ts +5 -0
- package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
- package/dist/helpers/formatRelativeTime.d.ts +10 -0
- package/dist/helpers/formatRelativeTime.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/{useChatKitLabels-BxNkTzr2.js → useChatKitLabels-BC6ItJc6.js} +2 -1
- package/package.json +1 -1
- package/src/components/base/CkAgentMessage/CkAgentMessage.spec.ts +6 -12
- package/src/components/base/CkAgentMessage/CkAgentMessage.vue +24 -15
- package/src/components/base/CkHistoryItem/CkHistoryItem.spec.ts +0 -2
- package/src/components/base/CkHistoryItem/CkHistoryItem.stories.ts +0 -6
- package/src/components/base/CkHistoryItem/CkHistoryItem.vue +2 -3
- package/src/components/base/CkHistoryWrapper/CkHistoryWrapper.stories.ts +23 -23
- package/src/components/composed/CkConversation/CkConversation.spec.ts +8 -35
- package/src/components/composed/CkHistory/CkHistory.spec.ts +107 -0
- package/src/components/composed/CkHistory/CkHistory.stories.ts +91 -3
- package/src/components/composed/CkHistory/CkHistory.vue +94 -44
- package/src/components/composed/CkHistory/types.ts +33 -0
- package/src/handlers/useChatKitLabels.spec.ts +1 -0
- package/src/handlers/useChatKitLabels.ts +6 -0
- package/src/helpers/formatRelativeTime.ts +49 -0
- package/src/helpers/index.ts +1 -0
- package/src/index.ts +3 -0
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, createBlock, unref, mergeProps, withCtx, createVNode, Transition, toDisplayString, computed, normalizeClass, toRefs, h, useId, createTextVNode, useAttrs, useSlots, withModifiers, resolveDynamicComponent, useTemplateRef, onBeforeUnmount, createSlots, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
-
import { u as useChatKitLabels, d as defaultChatKitLabels, a as useMarkdownParser } from "./useChatKitLabels-
|
|
2
|
+
import { u as useChatKitLabels, d as defaultChatKitLabels, a as useMarkdownParser } from "./useChatKitLabels-BC6ItJc6.js";
|
|
3
3
|
import { UiButton, UiTooltip, UiIcon, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem, UiPopover, UiPopoverTrigger, UiFileType, UiPopoverContent, Primitive, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
|
|
4
|
+
const MINUTE = 60;
|
|
5
|
+
const HOUR = 60 * MINUTE;
|
|
6
|
+
const DAY = 24 * HOUR;
|
|
7
|
+
const WEEK = 7 * DAY;
|
|
8
|
+
const MONTH = 30 * DAY;
|
|
9
|
+
const YEAR = 365 * DAY;
|
|
10
|
+
function formatRelativeTime(unixSeconds, nowSeconds = Math.floor(Date.now() / 1e3)) {
|
|
11
|
+
const delta = Math.max(0, nowSeconds - unixSeconds);
|
|
12
|
+
if (delta < MINUTE) return "Just now";
|
|
13
|
+
if (delta < HOUR) {
|
|
14
|
+
const mins = Math.floor(delta / MINUTE);
|
|
15
|
+
return mins === 1 ? "1 minute ago" : `${mins} minutes ago`;
|
|
16
|
+
}
|
|
17
|
+
if (delta < DAY) {
|
|
18
|
+
const hrs = Math.floor(delta / HOUR);
|
|
19
|
+
return hrs === 1 ? "1 hour ago" : `${hrs} hours ago`;
|
|
20
|
+
}
|
|
21
|
+
if (delta < 2 * DAY) return "Yesterday";
|
|
22
|
+
if (delta < WEEK) {
|
|
23
|
+
const days = Math.floor(delta / DAY);
|
|
24
|
+
return `${days} days ago`;
|
|
25
|
+
}
|
|
26
|
+
if (delta < 2 * WEEK) return "1 week ago";
|
|
27
|
+
if (delta < MONTH) {
|
|
28
|
+
const weeks = Math.floor(delta / WEEK);
|
|
29
|
+
return `${weeks} weeks ago`;
|
|
30
|
+
}
|
|
31
|
+
if (delta < 2 * MONTH) return "1 month ago";
|
|
32
|
+
if (delta < YEAR) {
|
|
33
|
+
const months = Math.floor(delta / MONTH);
|
|
34
|
+
return `${months} months ago`;
|
|
35
|
+
}
|
|
36
|
+
const years = Math.floor(delta / YEAR);
|
|
37
|
+
return years === 1 ? "1 year ago" : `${years} years ago`;
|
|
38
|
+
}
|
|
4
39
|
const _hoisted_1$b = {
|
|
5
40
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6
41
|
width: "16",
|
|
@@ -45,19 +80,25 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
45
80
|
};
|
|
46
81
|
}
|
|
47
82
|
});
|
|
48
|
-
const _hoisted_1$9 = { class: "flex w-full
|
|
83
|
+
const _hoisted_1$9 = { class: "border-border-surface-default flex w-full flex-col gap-6 border-b pb-6" };
|
|
49
84
|
const _hoisted_2$6 = {
|
|
50
85
|
key: 0,
|
|
86
|
+
class: "flex items-center gap-3"
|
|
87
|
+
};
|
|
88
|
+
const _hoisted_3$5 = {
|
|
89
|
+
key: 0,
|
|
90
|
+
"data-testid": "ck-agent-message-icon",
|
|
51
91
|
class: "flex flex-shrink-0 items-center justify-center"
|
|
52
92
|
};
|
|
53
|
-
const _hoisted_3$5 = { class: "text-core-content-primary flex min-w-0 flex-1 flex-col gap-2" };
|
|
54
93
|
const _hoisted_4$4 = {
|
|
55
|
-
key:
|
|
56
|
-
|
|
94
|
+
key: 1,
|
|
95
|
+
"data-testid": "ck-agent-message-header",
|
|
96
|
+
class: "body-14-regular text-content-on-surface-muted min-w-0 flex-1 [word-break:break-word]"
|
|
57
97
|
};
|
|
58
|
-
const _hoisted_5$3 = {
|
|
98
|
+
const _hoisted_5$3 = { class: "text-content-on-surface-primary text-base leading-7" };
|
|
99
|
+
const _hoisted_6$2 = {
|
|
59
100
|
key: 1,
|
|
60
|
-
class: "flex items-center"
|
|
101
|
+
class: "flex items-center gap-4"
|
|
61
102
|
};
|
|
62
103
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
63
104
|
...{ name: "CkAgentMessage" },
|
|
@@ -65,20 +106,20 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
65
106
|
setup(__props) {
|
|
66
107
|
return (_ctx, _cache) => {
|
|
67
108
|
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
68
|
-
_ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
109
|
+
_ctx.$slots.icon || _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
|
|
110
|
+
_ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_3$5, [
|
|
111
|
+
renderSlot(_ctx.$slots, "icon")
|
|
112
|
+
])) : createCommentVNode("", true),
|
|
72
113
|
_ctx.$slots.header ? (openBlock(), createElementBlock("span", _hoisted_4$4, [
|
|
73
114
|
renderSlot(_ctx.$slots, "header")
|
|
74
|
-
])) : createCommentVNode("", true),
|
|
75
|
-
createElementVNode("div", null, [
|
|
76
|
-
renderSlot(_ctx.$slots, "default")
|
|
77
|
-
]),
|
|
78
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_5$3, [
|
|
79
|
-
renderSlot(_ctx.$slots, "footer")
|
|
80
115
|
])) : createCommentVNode("", true)
|
|
81
|
-
])
|
|
116
|
+
])) : createCommentVNode("", true),
|
|
117
|
+
createElementVNode("div", _hoisted_5$3, [
|
|
118
|
+
renderSlot(_ctx.$slots, "default")
|
|
119
|
+
]),
|
|
120
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
|
|
121
|
+
renderSlot(_ctx.$slots, "footer")
|
|
122
|
+
])) : createCommentVNode("", true)
|
|
82
123
|
]);
|
|
83
124
|
};
|
|
84
125
|
}
|
|
@@ -1096,10 +1137,10 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
1096
1137
|
props.showActionOnHover ? "[&_button]:opacity-0 [&_button]:transition-opacity group-hover/ck-history-item:[&_button]:opacity-100 group-focus-within/ck-history-item:[&_button]:opacity-100" : ""
|
|
1097
1138
|
]);
|
|
1098
1139
|
const actionButtonClass = computed(() => [
|
|
1099
|
-
"relative z-10 inline-flex size-8 shrink-0 items-center justify-center rounded-sm border
|
|
1140
|
+
"relative z-10 inline-flex size-8 shrink-0 items-center justify-center rounded-sm border-0 text-content-on-surface-primary outline-hidden transition-colors",
|
|
1100
1141
|
"[&_svg]:size-4 [&_svg]:shrink-0",
|
|
1101
1142
|
"focus-visible:ring-0 focus-visible:outline-none",
|
|
1102
|
-
pointerOnAction.value && "bg-background-surface-muted-subtle
|
|
1143
|
+
pointerOnAction.value && "bg-background-surface-muted-subtle"
|
|
1103
1144
|
]);
|
|
1104
1145
|
const actionPopoverPanelClass = computed(() => [
|
|
1105
1146
|
"w-auto min-w-48 max-w-sm p-0 bg-background-surface-secondary",
|
|
@@ -1665,13 +1706,27 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1665
1706
|
hrefResolver: {},
|
|
1666
1707
|
activeId: { default: void 0 },
|
|
1667
1708
|
showAction: { type: Boolean, default: true },
|
|
1668
|
-
showActionOnHover: { type: Boolean, default: true }
|
|
1709
|
+
showActionOnHover: { type: Boolean, default: true },
|
|
1710
|
+
timeFormatter: { type: Function, default: formatRelativeTime },
|
|
1711
|
+
collapsedLimit: { default: 5 },
|
|
1712
|
+
maxHeight: { default: void 0 }
|
|
1669
1713
|
},
|
|
1670
1714
|
emits: ["select", "edit", "delete"],
|
|
1671
1715
|
setup(__props, { emit: __emit }) {
|
|
1672
1716
|
const props = __props;
|
|
1673
1717
|
const emit = __emit;
|
|
1674
1718
|
const labels = useChatKitLabels();
|
|
1719
|
+
const isExpanded = ref(false);
|
|
1720
|
+
const canCollapse = computed(
|
|
1721
|
+
() => props.collapsedLimit > 0 && props.conversations.length > props.collapsedLimit
|
|
1722
|
+
);
|
|
1723
|
+
const visibleConversations = computed(() => {
|
|
1724
|
+
if (!canCollapse.value || isExpanded.value) return props.conversations;
|
|
1725
|
+
return props.conversations.slice(0, props.collapsedLimit);
|
|
1726
|
+
});
|
|
1727
|
+
function toggleExpanded() {
|
|
1728
|
+
isExpanded.value = !isExpanded.value;
|
|
1729
|
+
}
|
|
1675
1730
|
function hrefFor(c) {
|
|
1676
1731
|
return props.hrefResolver(c.id);
|
|
1677
1732
|
}
|
|
@@ -1679,6 +1734,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1679
1734
|
const title = c.title?.trim();
|
|
1680
1735
|
return title ? title : labels.value.historyItemUntitled;
|
|
1681
1736
|
}
|
|
1737
|
+
function timeFor(c) {
|
|
1738
|
+
return props.timeFormatter?.(c.updatedAt);
|
|
1739
|
+
}
|
|
1682
1740
|
function handleRowClick(c, event) {
|
|
1683
1741
|
if (event.defaultPrevented) return;
|
|
1684
1742
|
if (event.button !== 0) return;
|
|
@@ -1687,68 +1745,84 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1687
1745
|
emit("select", c, event);
|
|
1688
1746
|
}
|
|
1689
1747
|
return (_ctx, _cache) => {
|
|
1690
|
-
return openBlock(),
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
}, () => [
|
|
1703
|
-
createVNode(_sfc_main$9, {
|
|
1704
|
-
as: "a",
|
|
1748
|
+
return openBlock(), createElementBlock("div", null, [
|
|
1749
|
+
createVNode(_sfc_main$8, {
|
|
1750
|
+
class: normalizeClass(isExpanded.value && props.maxHeight ? "overflow-y-auto" : void 0),
|
|
1751
|
+
style: normalizeStyle(
|
|
1752
|
+
isExpanded.value && props.maxHeight ? { maxHeight: props.maxHeight } : void 0
|
|
1753
|
+
)
|
|
1754
|
+
}, {
|
|
1755
|
+
default: withCtx(() => [
|
|
1756
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleConversations.value, (conversation) => {
|
|
1757
|
+
return renderSlot(_ctx.$slots, "item", {
|
|
1758
|
+
key: conversation.id,
|
|
1759
|
+
conversation,
|
|
1705
1760
|
href: hrefFor(conversation),
|
|
1706
|
-
|
|
1761
|
+
isActive: conversation.id === props.activeId,
|
|
1707
1762
|
title: titleFor(conversation),
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
"
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1763
|
+
time: timeFor(conversation),
|
|
1764
|
+
select: (event) => handleRowClick(conversation, event),
|
|
1765
|
+
edit: () => emit("edit", conversation),
|
|
1766
|
+
delete: () => emit("delete", conversation)
|
|
1767
|
+
}, () => [
|
|
1768
|
+
createVNode(_sfc_main$9, {
|
|
1769
|
+
as: "a",
|
|
1770
|
+
href: hrefFor(conversation),
|
|
1771
|
+
"is-active": conversation.id === props.activeId,
|
|
1772
|
+
title: titleFor(conversation),
|
|
1773
|
+
"meta-start": timeFor(conversation),
|
|
1774
|
+
"show-action": props.showAction,
|
|
1775
|
+
"show-action-on-hover": props.showActionOnHover,
|
|
1776
|
+
"action-popover": props.showAction,
|
|
1777
|
+
"action-aria-label": unref(labels).historyItemActionAriaLabel,
|
|
1778
|
+
onClick: ($event) => handleRowClick(conversation, $event)
|
|
1779
|
+
}, {
|
|
1780
|
+
"action-popover": withCtx(() => [
|
|
1781
|
+
createVNode(unref(UiSidebarPopoverMenu), { "show-footer-separator": false }, {
|
|
1782
|
+
default: withCtx(() => [
|
|
1783
|
+
createVNode(unref(UiSidebarPopoverMenuItem), {
|
|
1784
|
+
label: unref(labels).historyItemEditAction,
|
|
1785
|
+
onClick: ($event) => emit("edit", conversation)
|
|
1786
|
+
}, {
|
|
1787
|
+
icon: withCtx(() => [
|
|
1788
|
+
createVNode(unref(UiIcon), {
|
|
1789
|
+
name: "pencil",
|
|
1790
|
+
size: "s"
|
|
1791
|
+
})
|
|
1792
|
+
]),
|
|
1793
|
+
_: 1
|
|
1794
|
+
}, 8, ["label", "onClick"]),
|
|
1795
|
+
createVNode(unref(UiSidebarPopoverMenuItem), {
|
|
1796
|
+
label: unref(labels).historyItemDeleteAction,
|
|
1797
|
+
onClick: ($event) => emit("delete", conversation)
|
|
1798
|
+
}, {
|
|
1799
|
+
icon: withCtx(() => [
|
|
1800
|
+
createVNode(unref(UiIcon), {
|
|
1801
|
+
name: "trash",
|
|
1802
|
+
size: "s"
|
|
1803
|
+
})
|
|
1804
|
+
]),
|
|
1805
|
+
_: 1
|
|
1806
|
+
}, 8, ["label", "onClick"])
|
|
1807
|
+
]),
|
|
1808
|
+
_: 2
|
|
1809
|
+
}, 1024)
|
|
1810
|
+
]),
|
|
1811
|
+
_: 2
|
|
1812
|
+
}, 1032, ["href", "is-active", "title", "meta-start", "show-action", "show-action-on-hover", "action-popover", "action-aria-label", "onClick"])
|
|
1813
|
+
]);
|
|
1814
|
+
}), 128))
|
|
1815
|
+
]),
|
|
1816
|
+
_: 3
|
|
1817
|
+
}, 8, ["class", "style"]),
|
|
1818
|
+
canCollapse.value && !isExpanded.value ? (openBlock(), createElementBlock("button", {
|
|
1819
|
+
key: 0,
|
|
1820
|
+
type: "button",
|
|
1821
|
+
"data-testid": "ck-history-show-all",
|
|
1822
|
+
class: "mt-1 w-full rounded-lg px-2 py-2 text-center body-14-medium text-content-on-surface-muted transition-colors hover:bg-background-surface-muted-subtle",
|
|
1823
|
+
onClick: toggleExpanded
|
|
1824
|
+
}, toDisplayString(unref(labels).historyShowAll), 1)) : createCommentVNode("", true)
|
|
1825
|
+
]);
|
|
1752
1826
|
};
|
|
1753
1827
|
}
|
|
1754
1828
|
});
|
|
@@ -1867,5 +1941,6 @@ export {
|
|
|
1867
1941
|
_sfc_main$6 as o,
|
|
1868
1942
|
_sfc_main$k as p,
|
|
1869
1943
|
_sfc_main$j as q,
|
|
1870
|
-
CkUserMessage as r
|
|
1944
|
+
CkUserMessage as r,
|
|
1945
|
+
formatRelativeTime as s
|
|
1871
1946
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkAgentMessage.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkAgentMessage/CkAgentMessage.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CkAgentMessage.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkAgentMessage/CkAgentMessage.vue"],"names":[],"mappings":"AA6GA,QAAA,IAAI,OAAO,IAAU,EAAE,OAAO,IAAU,EAAE,OAAO,IAAU,EAAE,OAAO,IAAW,CAAE;AACjF,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GACzC;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC3C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK9C,QAAA,MAAM,UAAU,+QACd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkHistoryItem.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/CkHistoryItem.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,
|
|
1
|
+
{"version":3,"file":"CkHistoryItem.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/CkHistoryItem.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAqCpC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AA8F5C;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAGrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,KAMpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAM9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,KAMpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAmC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkHistoryItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/CkHistoryItem.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CkHistoryItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/CkHistoryItem.vue"],"names":[],"mappings":"AAySA,OAAO,KAAK,EAAsB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAydzE,QAAA,IAAI,OAAO,IAAU,EAAE,QAAQ,IAAY,CAAE;AAC7C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GACzC;IAAE,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKzD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;6EAId,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkHistoryWrapper.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryWrapper/CkHistoryWrapper.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AAGtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAkBvC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"CkHistoryWrapper.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryWrapper/CkHistoryWrapper.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AAGtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAkBvC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAkC/C;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KA8CrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KA+BxB,CAAC"}
|
|
@@ -30,4 +30,19 @@ export declare const RouterLinkIntegration: Story;
|
|
|
30
30
|
* look while delegating navigation to the router.
|
|
31
31
|
*/
|
|
32
32
|
export declare const WithCustomItem: Story;
|
|
33
|
+
/**
|
|
34
|
+
* Hides the relative time label by setting `time-formatter` to `undefined`.
|
|
35
|
+
* Rows display only the title (the pre-v1.14 default).
|
|
36
|
+
*/
|
|
37
|
+
export declare const WithoutTime: Story;
|
|
38
|
+
/**
|
|
39
|
+
* With 10 conversations and a `collapsedLimit` of 5, only the first 5 rows
|
|
40
|
+
* are shown initially. A "Show all" button at the bottom reveals the rest
|
|
41
|
+
* and makes the list scrollable (capped at `maxHeight`).
|
|
42
|
+
*/
|
|
43
|
+
export declare const CollapsedWithShowAll: Story;
|
|
44
|
+
/**
|
|
45
|
+
* All conversations visible without collapse — set `collapsedLimit` to `0`.
|
|
46
|
+
*/
|
|
47
|
+
export declare const NoCollapse: Story;
|
|
33
48
|
//# sourceMappingURL=CkHistory.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkHistory.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkHistory/CkHistory.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,SAAS,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"CkHistory.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkHistory/CkHistory.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAuExC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAsBhC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AA4LxC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,KAS5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAUnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,KA0E5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KASzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,KASlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAQxB,CAAC"}
|
|
@@ -11,6 +11,8 @@ type __VLS_Slots = {
|
|
|
11
11
|
* - `href` — URL produced by `hrefResolver(conversation.id)`
|
|
12
12
|
* - `isActive` — whether this row matches `activeId`
|
|
13
13
|
* - `title` — resolved title (falls back to `historyItemUntitled` label)
|
|
14
|
+
* - `time` — formatted relative time string from `timeFormatter`, or
|
|
15
|
+
* `undefined` when no formatter is set
|
|
14
16
|
* - `select(event)` — RouterLink-style click guard: `preventDefault()`
|
|
15
17
|
* and emit `select` for plain left-clicks; ignores middle/modifier
|
|
16
18
|
* clicks so native browser affordances still work.
|
|
@@ -21,6 +23,7 @@ type __VLS_Slots = {
|
|
|
21
23
|
href: string;
|
|
22
24
|
isActive: boolean;
|
|
23
25
|
title: string;
|
|
26
|
+
time: string | undefined;
|
|
24
27
|
select: (event: MouseEvent) => void;
|
|
25
28
|
edit: () => void;
|
|
26
29
|
delete: () => void;
|
|
@@ -37,7 +40,10 @@ declare const __VLS_base: import("vue").DefineComponent<CkHistoryProps, {}, {},
|
|
|
37
40
|
}>, {
|
|
38
41
|
showAction: boolean;
|
|
39
42
|
showActionOnHover: boolean;
|
|
43
|
+
maxHeight: string;
|
|
40
44
|
activeId: string;
|
|
45
|
+
timeFormatter: (updatedAtSeconds: number) => string;
|
|
46
|
+
collapsedLimit: number;
|
|
41
47
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
42
48
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
43
49
|
declare const _default: typeof __VLS_export;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkHistory.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkHistory/CkHistory.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CkHistory.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkHistory/CkHistory.vue"],"names":[],"mappings":"AA6LA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,SAAS,CAAC;AAiB9D,KAAK,WAAW,GAAG;IACjB;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,EAAE,CAAC,KAAK,EAAE;QACZ,YAAY,EAAE,YAAY,CAAC;QAC3B,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,OAAO,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;QACzB,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;QACpC,IAAI,EAAE,MAAM,IAAI,CAAC;QACjB,MAAM,EAAE,MAAM,IAAI,CAAC;KACpB,KAAK,IAAI,CAAC;CACZ,CAAC;AAmSF,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;6EAId,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"}
|
|
@@ -49,6 +49,39 @@ export interface CkHistoryProps {
|
|
|
49
49
|
* @default true
|
|
50
50
|
*/
|
|
51
51
|
showActionOnHover?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Formats a conversation's `updatedAt` timestamp (Unix seconds) into a
|
|
54
|
+
* human-readable relative time string displayed under the title.
|
|
55
|
+
*
|
|
56
|
+
* Defaults to the built-in `formatRelativeTime` which produces English
|
|
57
|
+
* labels like "Just now", "Yesterday", "3 days ago". Pass your own
|
|
58
|
+
* function for locale-aware formatting (e.g. via `Intl.RelativeTimeFormat`
|
|
59
|
+
* or your i18n library).
|
|
60
|
+
*
|
|
61
|
+
* To hide the time label entirely, pass `() => ''`.
|
|
62
|
+
*
|
|
63
|
+
* @default formatRelativeTime
|
|
64
|
+
*/
|
|
65
|
+
timeFormatter?: (updatedAtSeconds: number) => string;
|
|
66
|
+
/**
|
|
67
|
+
* Maximum number of conversations shown in collapsed mode. When the
|
|
68
|
+
* array has more items than this limit a "Show all" button is rendered
|
|
69
|
+
* below the visible rows. Clicking it expands the list and makes it
|
|
70
|
+
* scrollable (capped at `maxHeight`).
|
|
71
|
+
*
|
|
72
|
+
* Set to `0` or `undefined` to disable collapsing — all conversations
|
|
73
|
+
* are shown and the list is always scrollable.
|
|
74
|
+
*
|
|
75
|
+
* @default 5
|
|
76
|
+
*/
|
|
77
|
+
collapsedLimit?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Maximum height (CSS value) of the list when expanded. Allows the list
|
|
80
|
+
* to scroll when conversations exceed the available space.
|
|
81
|
+
*
|
|
82
|
+
* @default undefined — no max-height constraint
|
|
83
|
+
*/
|
|
84
|
+
maxHeight?: string;
|
|
52
85
|
}
|
|
53
86
|
/**
|
|
54
87
|
* Emitted events for `CkHistory`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkHistory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B;;;;;;;;;;;;OAYG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkHistory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B;;;;;;;;;;;;OAYG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,MAAM,CAAC;IACrD;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACxD,0EAA0E;IAC1E,IAAI,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACnC,4EAA4E;IAC5E,MAAM,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;CACtC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r } from "../CkInput.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r } from "../CkInput.vue_vue_type_script_setup_true_lang-DedLzDoO.js";
|
|
2
2
|
export {
|
|
3
3
|
_ as CkAgentMessage,
|
|
4
4
|
a as CkConversation,
|
package/dist/handlers/index.js
CHANGED
|
@@ -75,6 +75,11 @@ export type ChatKitLabels = {
|
|
|
75
75
|
historyItemEditAction: string;
|
|
76
76
|
/** Label for the "Delete" action in the `CkHistory` row popover menu. */
|
|
77
77
|
historyItemDeleteAction: string;
|
|
78
|
+
/**
|
|
79
|
+
* Label for the "Show all" button that appears when `collapsedLimit` is
|
|
80
|
+
* set and more conversations exist than the limit.
|
|
81
|
+
*/
|
|
82
|
+
historyShowAll?: string;
|
|
78
83
|
};
|
|
79
84
|
/** English defaults used when no labels are provided by the consumer. */
|
|
80
85
|
export declare const defaultChatKitLabels: ChatKitLabels;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatKitLabels.d.ts","sourceRoot":"","sources":["../../src/handlers/useChatKitLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,sFAAsF;IACtF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4FAA4F;IAC5F,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,+DAA+D;IAC/D,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,gEAAgE;IAChE,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,kFAAkF;IAClF,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,qEAAqE;IACrE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qEAAqE;IACrE,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,iEAAiE;IACjE,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,iDAAiD;IACjD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,iDAAiD;IACjD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,0EAA0E;IAC1E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yEAAyE;IACzE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,6EAA6E;IAC7E,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,0BAA0B,EAAE,MAAM,CAAC;IACnC,uEAAuE;IACvE,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yEAAyE;IACzE,uBAAuB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useChatKitLabels.d.ts","sourceRoot":"","sources":["../../src/handlers/useChatKitLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,sFAAsF;IACtF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4FAA4F;IAC5F,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,+DAA+D;IAC/D,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,gEAAgE;IAChE,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,kFAAkF;IAClF,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,qEAAqE;IACrE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qEAAqE;IACrE,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,iEAAiE;IACjE,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,iDAAiD;IACjD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,iDAAiD;IACjD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,0EAA0E;IAC1E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yEAAyE;IACzE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,6EAA6E;IAC7E,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,0BAA0B,EAAE,MAAM,CAAC;IACnC,uEAAuE;IACvE,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yEAAyE;IACzE,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,aA2BlC,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,WAAW,CAAC,aAAa,CAAC,CAC1C,CAAC;AAE5B,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5C,yFAAyF;AACzF,KAAK,cAAc,GACf,GAAG,CAAC,aAAa,CAAC,GAClB,WAAW,CAAC,aAAa,CAAC,GAC1B,CAAC,MAAM,aAAa,CAAC,CAAC;AAE1B;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAKjE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAAC,aAAa,CAAC,CAK7D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a Unix-seconds timestamp to a human-readable relative time string.
|
|
3
|
+
*
|
|
4
|
+
* Uses simple threshold-based bucketing (not `Intl.RelativeTimeFormat`) so the
|
|
5
|
+
* output is deterministic and easy to snapshot-test. Consumers who need
|
|
6
|
+
* locale-aware formatting can supply their own formatter via the
|
|
7
|
+
* `timeFormatter` prop on `CkHistory`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatRelativeTime(unixSeconds: number, nowSeconds?: number): string;
|
|
10
|
+
//# sourceMappingURL=formatRelativeTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatRelativeTime.d.ts","sourceRoot":"","sources":["../../src/helpers/formatRelativeTime.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,UAAU,GAAE,MAAsC,GACjD,MAAM,CA8BR"}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export { SdkError, createDocumentUploadProvider, defaultDocumentUploadConfig, de
|
|
|
7
7
|
export type { DocumentUploadConfig, DocumentUploadProvider, FileEntry, FileStatus, } from './composables/fileUpload';
|
|
8
8
|
export { CkAgentMessage, CkConversation, CkConversationLayout, CkCopyMessageActionButton, CkFeedbackButton, CkFeedbackDialog, CkFileItemsList, CkHistory, CkHistoryItem, CkHistoryWrapper, CkInput, CkMarkdownRenderer, CkMessageActionButton, CkPromptActionButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './components';
|
|
9
9
|
export type { CkConversationLayoutProps, CkConversationProps, CkFeedbackButtonProps, CkFeedbackDialogEmits, CkFeedbackDialogProps, CkFeedbackDialogSubmitPayload, CkFeedbackReason, CkFeedbackSentiment, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryEmits, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkUserMessageProps, } from './components';
|
|
10
|
+
export { formatRelativeTime } from './helpers';
|
|
10
11
|
export type { BaseMessage, Conversation, ConversationTree, MessageContent, MessageContentStatus, MessageMetadata, MessageReasoningContent, MessageRole, MessageStatus, MessageTextContent, MessageToolContent, TreeMessage, } from './types';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AASpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,OAAO,EACP,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,2BAA2B,EAC3B,gBAAgB,EAChB,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AASpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,OAAO,EACP,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,2BAA2B,EAC3B,gBAAgB,EAChB,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { u } from "./useMessageHandler-CMdy-lm0.js";
|
|
2
|
-
import { C, d, p, u as u2, a } from "./useChatKitLabels-
|
|
2
|
+
import { C, d, p, u as u2, a } from "./useChatKitLabels-BC6ItJc6.js";
|
|
3
3
|
import { S, c, d as d2, a as a2, u as u3, b, e, f } from "./index-Ct5hD214.js";
|
|
4
|
-
import { _, a as a3, b as b2, C as C2, c as c2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2, q, r } from "./CkInput.vue_vue_type_script_setup_true_lang-
|
|
4
|
+
import { _, a as a3, b as b2, C as C2, c as c2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2, q, r, s } from "./CkInput.vue_vue_type_script_setup_true_lang-DedLzDoO.js";
|
|
5
5
|
export {
|
|
6
6
|
C as CHAT_KIT_LABELS,
|
|
7
7
|
_ as CkAgentMessage,
|
|
@@ -29,6 +29,7 @@ export {
|
|
|
29
29
|
d as defaultChatKitLabels,
|
|
30
30
|
d2 as defaultDocumentUploadConfig,
|
|
31
31
|
a2 as defaultEndpoints,
|
|
32
|
+
s as formatRelativeTime,
|
|
32
33
|
p as provideChatKitLabels,
|
|
33
34
|
u3 as useChat,
|
|
34
35
|
u2 as useChatKitLabels,
|
|
@@ -12722,7 +12722,8 @@ const defaultChatKitLabels = {
|
|
|
12722
12722
|
historyItemUntitled: "Untitled conversation",
|
|
12723
12723
|
historyItemActionAriaLabel: "Conversation options",
|
|
12724
12724
|
historyItemEditAction: "Edit",
|
|
12725
|
-
historyItemDeleteAction: "Delete"
|
|
12725
|
+
historyItemDeleteAction: "Delete",
|
|
12726
|
+
historyShowAll: "Show all"
|
|
12726
12727
|
};
|
|
12727
12728
|
const CHAT_KIT_LABELS = /* @__PURE__ */ Symbol("chat-kit-labels");
|
|
12728
12729
|
function provideChatKitLabels(labels) {
|
package/package.json
CHANGED
|
@@ -12,12 +12,12 @@ describe('CkAgentMessage', () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it('hides the header section when no header slot is provided', () => {
|
|
15
|
-
|
|
15
|
+
render(CkAgentMessage, {
|
|
16
16
|
slots: { default: 'Some content' },
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
expect(
|
|
20
|
-
|
|
20
|
+
screen.queryByTestId('ck-agent-message-header'),
|
|
21
21
|
).not.toBeInTheDocument();
|
|
22
22
|
});
|
|
23
23
|
});
|
|
@@ -42,26 +42,20 @@ describe('CkAgentMessage', () => {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
it('renders the icon container only when the icon slot is provided', () => {
|
|
45
|
-
|
|
45
|
+
render(CkAgentMessage, {
|
|
46
46
|
slots: { icon: '<img src="" alt="bot-icon" />' },
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
expect(
|
|
50
|
-
container.querySelector(
|
|
51
|
-
'.flex.flex-shrink-0.items-center.justify-center',
|
|
52
|
-
),
|
|
53
|
-
).toBeInTheDocument();
|
|
49
|
+
expect(screen.getByTestId('ck-agent-message-icon')).toBeInTheDocument();
|
|
54
50
|
});
|
|
55
51
|
|
|
56
52
|
it('does not render the icon container when no icon slot is provided', () => {
|
|
57
|
-
|
|
53
|
+
render(CkAgentMessage, {
|
|
58
54
|
slots: { default: 'Some content' },
|
|
59
55
|
});
|
|
60
56
|
|
|
61
57
|
expect(
|
|
62
|
-
|
|
63
|
-
'.flex.flex-shrink-0.items-center.justify-center',
|
|
64
|
-
),
|
|
58
|
+
screen.queryByTestId('ck-agent-message-icon'),
|
|
65
59
|
).not.toBeInTheDocument();
|
|
66
60
|
});
|
|
67
61
|
});
|