@uzum-tech/ui 2.4.1 → 2.4.2
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/index.js +82 -43
- package/dist/index.mjs +83 -44
- package/dist/index.prod.js +3 -3
- package/dist/index.prod.mjs +3 -3
- package/es/_utils/index.d.ts +1 -1
- package/es/_utils/index.mjs +1 -1
- package/es/_utils/markdown/constants.d.ts +1 -0
- package/es/_utils/markdown/constants.mjs +1 -0
- package/es/_utils/markdown/index.d.ts +1 -1
- package/es/_utils/markdown/index.mjs +1 -1
- package/es/_utils/markdown/render-markdown.d.ts +3 -0
- package/es/_utils/markdown/render-markdown.mjs +18 -3
- package/es/_utils/vue/index.d.ts +1 -0
- package/es/_utils/vue/index.mjs +1 -0
- package/es/_utils/vue/resolve-reactive.d.ts +3 -0
- package/es/_utils/vue/resolve-reactive.mjs +9 -0
- package/es/chat/src/ChatListItems.mjs +16 -11
- package/es/chat/src/ChatMainArea.mjs +2 -1
- package/es/chat/src/ChatMessages.d.ts +1 -1
- package/es/chat/src/ChatMessages.mjs +6 -5
- package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.mjs +2 -1
- package/es/chat/src/ChatParts/ChatHeader/ChatHeader.mjs +3 -6
- package/es/chat/src/interface.d.ts +17 -34
- package/es/chat/tests/utils/constants.d.ts +12 -0
- package/es/chat/tests/utils/constants.mjs +12 -0
- package/es/chat/tests/utils/create-chat-item-mock.d.ts +2 -0
- package/es/chat/tests/utils/create-chat-item-mock.mjs +9 -0
- package/es/chat/tests/utils/create-chat-message-mock.d.ts +2 -0
- package/es/chat/tests/utils/create-chat-message-mock.mjs +13 -0
- package/es/components.d.ts +4 -4
- package/es/editor/src/Editor.mjs +14 -2
- package/es/message-bubble/src/MessageBubble.d.ts +10 -10
- package/es/message-bubble/src/MessageBubble.mjs +13 -17
- package/es/message-bubble/src/interface.d.ts +5 -5
- package/es/message-bubble/src/interface.mjs +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/_utils/index.d.ts +1 -1
- package/lib/_utils/index.js +3 -1
- package/lib/_utils/markdown/constants.d.ts +1 -0
- package/lib/_utils/markdown/constants.js +2 -1
- package/lib/_utils/markdown/index.d.ts +1 -1
- package/lib/_utils/markdown/index.js +4 -1
- package/lib/_utils/markdown/render-markdown.d.ts +3 -0
- package/lib/_utils/markdown/render-markdown.js +20 -2
- package/lib/_utils/vue/index.d.ts +1 -0
- package/lib/_utils/vue/index.js +4 -1
- package/lib/_utils/vue/resolve-reactive.d.ts +3 -0
- package/lib/_utils/vue/resolve-reactive.js +17 -0
- package/lib/chat/src/ChatListItems.js +20 -17
- package/lib/chat/src/ChatMainArea.js +2 -2
- package/lib/chat/src/ChatMessages.d.ts +1 -1
- package/lib/chat/src/ChatMessages.js +6 -5
- package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.js +4 -1
- package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.js +2 -2
- package/lib/chat/src/interface.d.ts +17 -34
- package/lib/chat/tests/utils/constants.d.ts +12 -0
- package/lib/chat/tests/utils/constants.js +15 -0
- package/lib/chat/tests/utils/create-chat-item-mock.d.ts +2 -0
- package/lib/chat/tests/utils/create-chat-item-mock.js +10 -0
- package/lib/chat/tests/utils/create-chat-message-mock.d.ts +2 -0
- package/lib/chat/tests/utils/create-chat-message-mock.js +14 -0
- package/lib/components.d.ts +4 -4
- package/lib/editor/src/Editor.d.ts +2 -2
- package/lib/editor/src/Editor.js +13 -1
- package/lib/message-bubble/src/MessageBubble.d.ts +10 -10
- package/lib/message-bubble/src/MessageBubble.js +15 -19
- package/lib/message-bubble/src/interface.d.ts +5 -5
- package/lib/message-bubble/src/interface.js +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +7 -7
package/dist/index.js
CHANGED
|
@@ -11106,6 +11106,15 @@
|
|
|
11106
11106
|
}
|
|
11107
11107
|
}
|
|
11108
11108
|
|
|
11109
|
+
function resolveReactiveContent(content) {
|
|
11110
|
+
const value = vue.isRef(content) ? content.value : typeof content === "function" ? content() : content;
|
|
11111
|
+
return value instanceof Date ? value.toString() : value;
|
|
11112
|
+
}
|
|
11113
|
+
function resolveReactiveText(content) {
|
|
11114
|
+
const value = resolveReactiveContent(content);
|
|
11115
|
+
return typeof value === "string" ? value : "";
|
|
11116
|
+
}
|
|
11117
|
+
|
|
11109
11118
|
function ensureValidVNode(vnodes) {
|
|
11110
11119
|
return vnodes.some(child => {
|
|
11111
11120
|
if (!vue.isVNode(child)) {
|
|
@@ -51616,6 +51625,7 @@
|
|
|
51616
51625
|
};
|
|
51617
51626
|
}
|
|
51618
51627
|
|
|
51628
|
+
const MARKDOWN_OPTIONS_KEYS_SEPARATOR = "|";
|
|
51619
51629
|
const HTML_COMMENT_REGEX = /<!--[\s\S]*?-->/g;
|
|
51620
51630
|
const HTML_CDATA_REGEX = /<!\[CDATA\[[\s\S]*?\]\]>/g;
|
|
51621
51631
|
const HTML_RAW_BLOCK_REGEX = /<(script|style|iframe|object|embed|template|svg|math|noscript)\b[^>]*>[\s\S]*?<\/\1\s*>/gi;
|
|
@@ -51803,12 +51813,21 @@
|
|
|
51803
51813
|
breaks: options?.breaks ?? true
|
|
51804
51814
|
};
|
|
51805
51815
|
}
|
|
51816
|
+
function getMarkdownOptionsKey(options) {
|
|
51817
|
+
const tags = {
|
|
51818
|
+
features: [...new Set(options.features)].sort().join(","),
|
|
51819
|
+
maxHeadingLevel: String(options.maxHeadingLevel),
|
|
51820
|
+
breaks: options.breaks ? "1" : "0"
|
|
51821
|
+
};
|
|
51822
|
+
return [tags.features, tags.maxHeadingLevel, tags.breaks].join(MARKDOWN_OPTIONS_KEYS_SEPARATOR);
|
|
51823
|
+
}
|
|
51806
51824
|
function getMarkdownRenderer(options) {
|
|
51807
51825
|
const normalizedOptions = normalizeOptions(options);
|
|
51808
|
-
const
|
|
51826
|
+
const key = getMarkdownOptionsKey(normalizedOptions);
|
|
51827
|
+
const instance = rendererCache.get(key);
|
|
51809
51828
|
if (!instance) {
|
|
51810
51829
|
const renderer = createMarkdownRenderer(normalizedOptions);
|
|
51811
|
-
rendererCache.set(
|
|
51830
|
+
rendererCache.set(key, renderer);
|
|
51812
51831
|
return renderer;
|
|
51813
51832
|
}
|
|
51814
51833
|
return instance;
|
|
@@ -58715,11 +58734,11 @@
|
|
|
58715
58734
|
default: false
|
|
58716
58735
|
},
|
|
58717
58736
|
title: {
|
|
58718
|
-
type: [String, Function],
|
|
58737
|
+
type: [String, Object, Function],
|
|
58719
58738
|
default: void 0
|
|
58720
58739
|
},
|
|
58721
58740
|
content: {
|
|
58722
|
-
type: [String, Function],
|
|
58741
|
+
type: [String, Object, Function],
|
|
58723
58742
|
default: void 0
|
|
58724
58743
|
},
|
|
58725
58744
|
markdown: {
|
|
@@ -58735,7 +58754,7 @@
|
|
|
58735
58754
|
default: void 0
|
|
58736
58755
|
},
|
|
58737
58756
|
timestamp: {
|
|
58738
|
-
type: [String, Number, Date, Function],
|
|
58757
|
+
type: [String, Number, Date, Object, Function],
|
|
58739
58758
|
default: void 0
|
|
58740
58759
|
},
|
|
58741
58760
|
status: {
|
|
@@ -60678,8 +60697,14 @@
|
|
|
60678
60697
|
status: props.status,
|
|
60679
60698
|
attachments: normalizedAttachmentsRef.value
|
|
60680
60699
|
}));
|
|
60700
|
+
const resolvedContentRef = vue.computed(
|
|
60701
|
+
() => resolveReactiveContent(props.content)
|
|
60702
|
+
);
|
|
60703
|
+
const resolvedTitleRef = vue.computed(
|
|
60704
|
+
() => resolveReactiveContent(props.title)
|
|
60705
|
+
);
|
|
60681
60706
|
const markdownContent = vue.computed(() => {
|
|
60682
|
-
const content =
|
|
60707
|
+
const content = resolvedContentRef.value;
|
|
60683
60708
|
return props.markdown && typeof content === "string" ? content : null;
|
|
60684
60709
|
});
|
|
60685
60710
|
const markdownActive = vue.computed(
|
|
@@ -60768,20 +60793,11 @@
|
|
|
60768
60793
|
}
|
|
60769
60794
|
result.push({
|
|
60770
60795
|
key: action.key,
|
|
60771
|
-
label:
|
|
60796
|
+
label: () => resolveReactiveContent(action.label)
|
|
60772
60797
|
});
|
|
60773
60798
|
}
|
|
60774
60799
|
return result;
|
|
60775
60800
|
});
|
|
60776
|
-
const resolveRenderContent = (content) => {
|
|
60777
|
-
if (typeof content === "function") {
|
|
60778
|
-
return content();
|
|
60779
|
-
}
|
|
60780
|
-
if (content instanceof Date) {
|
|
60781
|
-
return content.toString();
|
|
60782
|
-
}
|
|
60783
|
-
return content;
|
|
60784
|
-
};
|
|
60785
60801
|
const getThumbnailUrl = (attachment) => {
|
|
60786
60802
|
const url = [attachment.preview, attachment.thumbnail].find(
|
|
60787
60803
|
(value) => typeof value === "string"
|
|
@@ -60886,10 +60902,10 @@
|
|
|
60886
60902
|
const hasBubbleActionsConfig = Boolean(
|
|
60887
60903
|
props.actions && props.actions.length > 0
|
|
60888
60904
|
);
|
|
60889
|
-
const hasTitle = Boolean(
|
|
60905
|
+
const hasTitle = Boolean(resolvedTitleRef.value || slots.title);
|
|
60890
60906
|
const afterContentSlot = slots.afterContent || slots["after-content"];
|
|
60891
60907
|
const hasAfterContent = Boolean(afterContentSlot);
|
|
60892
|
-
const hasVisibleTextContent = markdownActive.value ? markdownHtmlRef.value !== null : Boolean(
|
|
60908
|
+
const hasVisibleTextContent = markdownActive.value ? markdownHtmlRef.value !== null : Boolean(resolvedContentRef.value);
|
|
60893
60909
|
const hasContentInsideBubble = Boolean(
|
|
60894
60910
|
hasVisibleTextContent || slots.default || hasAfterContent || hasTitle || normalizedAttachmentsRef.value.length > 1
|
|
60895
60911
|
);
|
|
@@ -60907,7 +60923,9 @@
|
|
|
60907
60923
|
class: `${mergedClsPrefixRef.value}-message-bubble__title`,
|
|
60908
60924
|
variant: "body-l-semi-bold"
|
|
60909
60925
|
},
|
|
60910
|
-
|
|
60926
|
+
{
|
|
60927
|
+
default: () => slots.title ? slots.title(messagePayloadRef.value) : resolvedTitleRef.value
|
|
60928
|
+
}
|
|
60911
60929
|
),
|
|
60912
60930
|
normalizedAttachmentsRef.value.length > 0 && renderAttachment(true),
|
|
60913
60931
|
(hasVisibleTextContent || slots.default) && (slots.default ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` }, slots.default(messagePayloadRef.value)) : markdownHtmlRef.value !== null ? /* @__PURE__ */ vue.h(
|
|
@@ -60921,7 +60939,7 @@
|
|
|
60921
60939
|
],
|
|
60922
60940
|
innerHTML: markdownHtmlRef.value
|
|
60923
60941
|
}
|
|
60924
|
-
) : /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` },
|
|
60942
|
+
) : /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` }, resolvedContentRef.value)),
|
|
60925
60943
|
hasAfterContent && /* @__PURE__ */ vue.h(
|
|
60926
60944
|
"div",
|
|
60927
60945
|
{
|
|
@@ -61026,7 +61044,7 @@
|
|
|
61026
61044
|
{
|
|
61027
61045
|
class: `${mergedClsPrefixRef.value}-message-bubble__time`
|
|
61028
61046
|
},
|
|
61029
|
-
|
|
61047
|
+
resolveReactiveContent(props.timestamp)
|
|
61030
61048
|
), props.isOwn && props.status && /* @__PURE__ */ vue.h(
|
|
61031
61049
|
"div",
|
|
61032
61050
|
{
|
|
@@ -61074,7 +61092,7 @@
|
|
|
61074
61092
|
],
|
|
61075
61093
|
innerHTML: markdownHtmlRef.value
|
|
61076
61094
|
}
|
|
61077
|
-
) :
|
|
61095
|
+
) : resolvedContentRef.value && /* @__PURE__ */ vue.h("span", null, resolvedContentRef.value)
|
|
61078
61096
|
);
|
|
61079
61097
|
};
|
|
61080
61098
|
return {
|
|
@@ -62591,7 +62609,9 @@
|
|
|
62591
62609
|
_UListItem,
|
|
62592
62610
|
{
|
|
62593
62611
|
header: { text: this.mergedTitle },
|
|
62594
|
-
description: {
|
|
62612
|
+
description: {
|
|
62613
|
+
text: resolveReactiveText(this.message?.content)
|
|
62614
|
+
}
|
|
62595
62615
|
},
|
|
62596
62616
|
{
|
|
62597
62617
|
suffix: () => /* @__PURE__ */ vue.h(
|
|
@@ -93167,6 +93187,8 @@ img.ProseMirror-separator {
|
|
|
93167
93187
|
vue.toRef(props, "value"),
|
|
93168
93188
|
uncontrolledValueRef
|
|
93169
93189
|
);
|
|
93190
|
+
const parserRef = vue.shallowRef();
|
|
93191
|
+
const parserKeyRef = vue.shallowRef();
|
|
93170
93192
|
const serializer = createMarkdownSerializer(props.markdownOptions);
|
|
93171
93193
|
const sourceMarkdownRef = vue.ref(mergedValueRef.value ?? "");
|
|
93172
93194
|
const loadedDocumentRef = vue.ref(null);
|
|
@@ -93217,13 +93239,22 @@ img.ProseMirror-separator {
|
|
|
93217
93239
|
if (props["onUpdate:value"])
|
|
93218
93240
|
call(props["onUpdate:value"], value);
|
|
93219
93241
|
}
|
|
93242
|
+
function getParser(instance) {
|
|
93243
|
+
const normalizedOptions = normalizeOptions(props.markdownOptions);
|
|
93244
|
+
const key = getMarkdownOptionsKey(normalizedOptions);
|
|
93245
|
+
if (!parserRef.value || parserKeyRef.value !== key) {
|
|
93246
|
+
parserKeyRef.value = key;
|
|
93247
|
+
parserRef.value = createMarkdownParser(
|
|
93248
|
+
instance.schema,
|
|
93249
|
+
props.markdownOptions
|
|
93250
|
+
);
|
|
93251
|
+
}
|
|
93252
|
+
return parserRef.value;
|
|
93253
|
+
}
|
|
93220
93254
|
function setMarkdown(markdown, instance = editorRef.value, addToHistory = true) {
|
|
93221
93255
|
if (!instance)
|
|
93222
93256
|
return;
|
|
93223
|
-
const document =
|
|
93224
|
-
instance.schema,
|
|
93225
|
-
props.markdownOptions
|
|
93226
|
-
).parse(markdown);
|
|
93257
|
+
const document = getParser(instance).parse(markdown);
|
|
93227
93258
|
sourceMarkdownRef.value = markdown;
|
|
93228
93259
|
loadedDocumentRef.value = document;
|
|
93229
93260
|
instance.chain().setMeta("addToHistory", addToHistory).setContent(document.toJSON(), { emitUpdate: false }).run();
|
|
@@ -93891,7 +93922,7 @@ img.ProseMirror-separator {
|
|
|
93891
93922
|
render() {
|
|
93892
93923
|
const { mergedClsPrefix, mergedTheme, selectedChat } = this;
|
|
93893
93924
|
const keyId = this.toKeyString(selectedChat?.id);
|
|
93894
|
-
const keyTitle =
|
|
93925
|
+
const keyTitle = resolveReactiveText(selectedChat?.title);
|
|
93895
93926
|
const renderDefaultActions = () => [
|
|
93896
93927
|
/* @__PURE__ */ vue.h(_UTooltip, null, {
|
|
93897
93928
|
trigger: () => /* @__PURE__ */ vue.h(
|
|
@@ -93977,7 +94008,7 @@ img.ProseMirror-separator {
|
|
|
93977
94008
|
themeOverrides: mergedTheme.peerOverrides.Typography
|
|
93978
94009
|
},
|
|
93979
94010
|
{
|
|
93980
|
-
default: () => selectedChat?.title
|
|
94011
|
+
default: () => resolveReactiveContent(selectedChat?.title)
|
|
93981
94012
|
}
|
|
93982
94013
|
), this.typing && /* @__PURE__ */ vue.h(
|
|
93983
94014
|
_UText,
|
|
@@ -94200,7 +94231,7 @@ img.ProseMirror-separator {
|
|
|
94200
94231
|
}));
|
|
94201
94232
|
};
|
|
94202
94233
|
const renderDateSeparator = (date) => {
|
|
94203
|
-
return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` }, /* @__PURE__ */ vue.h("span", null, date));
|
|
94234
|
+
return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` }, /* @__PURE__ */ vue.h("span", null, resolveReactiveContent(date)));
|
|
94204
94235
|
};
|
|
94205
94236
|
const renderUnreadNotification = () => {
|
|
94206
94237
|
const count = props.unreadNotificationCount ?? unreadMessagesCount.value;
|
|
@@ -94382,14 +94413,14 @@ img.ProseMirror-separator {
|
|
|
94382
94413
|
let currentDate = "";
|
|
94383
94414
|
let unreadNotificationInserted = false;
|
|
94384
94415
|
this.messages?.forEach((message, index) => {
|
|
94385
|
-
const
|
|
94386
|
-
if (
|
|
94416
|
+
const messageDateText = resolveReactiveText(message.date);
|
|
94417
|
+
if (messageDateText !== currentDate) {
|
|
94387
94418
|
messagesWithDates.push({
|
|
94388
94419
|
type: "date-separator",
|
|
94389
|
-
date:
|
|
94420
|
+
date: message.date,
|
|
94390
94421
|
id: `date-${String(index)}`
|
|
94391
94422
|
});
|
|
94392
|
-
currentDate =
|
|
94423
|
+
currentDate = messageDateText;
|
|
94393
94424
|
}
|
|
94394
94425
|
if (!unreadNotificationInserted && !message.isOwn && message.status === MessageStatus.UNREAD && this.showUnreadNotification) {
|
|
94395
94426
|
messagesWithDates.push({
|
|
@@ -95089,7 +95120,7 @@ img.ProseMirror-separator {
|
|
|
95089
95120
|
if (editMessageIdRef) {
|
|
95090
95121
|
editMessageIdRef.value = message.id;
|
|
95091
95122
|
}
|
|
95092
|
-
inputValue.value =
|
|
95123
|
+
inputValue.value = resolveReactiveText(message.content);
|
|
95093
95124
|
attachmentFileList.value = [];
|
|
95094
95125
|
uploadedAttachmentsMap.value.clear();
|
|
95095
95126
|
};
|
|
@@ -95555,10 +95586,9 @@ img.ProseMirror-separator {
|
|
|
95555
95586
|
const renderChatItem = (item) => {
|
|
95556
95587
|
const isSelected = props.selectedChatId === item.id;
|
|
95557
95588
|
const isTyping = props.typingChatIds?.includes(item.id) ?? false;
|
|
95558
|
-
const
|
|
95559
|
-
const
|
|
95560
|
-
const
|
|
95561
|
-
const keySubtitle = toKeyString(subtitle);
|
|
95589
|
+
const keyId = toKeyString(item.id);
|
|
95590
|
+
const keyTitle = resolveReactiveText(item.title);
|
|
95591
|
+
const keySubtitle = resolveReactiveText(item.subtitle);
|
|
95562
95592
|
return /* @__PURE__ */ vue.h(
|
|
95563
95593
|
_UListItem,
|
|
95564
95594
|
{
|
|
@@ -95594,7 +95624,10 @@ img.ProseMirror-separator {
|
|
|
95594
95624
|
variant: "body-l-medium"
|
|
95595
95625
|
},
|
|
95596
95626
|
{
|
|
95597
|
-
default: () =>
|
|
95627
|
+
default: () => {
|
|
95628
|
+
const title = resolveReactiveContent(item.title);
|
|
95629
|
+
return typeof title === "string" ? sanitizeMarkdown(title) : title;
|
|
95630
|
+
}
|
|
95598
95631
|
}
|
|
95599
95632
|
),
|
|
95600
95633
|
description: () => /* @__PURE__ */ vue.h(
|
|
@@ -95607,7 +95640,13 @@ img.ProseMirror-separator {
|
|
|
95607
95640
|
variant: "body-m-medium"
|
|
95608
95641
|
},
|
|
95609
95642
|
{
|
|
95610
|
-
default: () =>
|
|
95643
|
+
default: () => {
|
|
95644
|
+
if (isTyping) {
|
|
95645
|
+
return mergedTypingTextRef.value;
|
|
95646
|
+
}
|
|
95647
|
+
const subTitle = resolveReactiveContent(item.subtitle);
|
|
95648
|
+
return typeof subTitle === "string" ? sanitizeMarkdown(subTitle) : subTitle;
|
|
95649
|
+
}
|
|
95611
95650
|
}
|
|
95612
95651
|
),
|
|
95613
95652
|
suffix: () => {
|
|
@@ -95624,7 +95663,7 @@ img.ProseMirror-separator {
|
|
|
95624
95663
|
{
|
|
95625
95664
|
class: `${mergedClsPrefixRef.value}-chat-sidebar__item-time`
|
|
95626
95665
|
},
|
|
95627
|
-
item.datetime
|
|
95666
|
+
resolveReactiveContent(item.datetime)
|
|
95628
95667
|
), /* @__PURE__ */ vue.h(
|
|
95629
95668
|
"div",
|
|
95630
95669
|
{
|
|
@@ -154738,7 +154777,7 @@ ${icon.label}`.toLowerCase()
|
|
|
154738
154777
|
});
|
|
154739
154778
|
}
|
|
154740
154779
|
|
|
154741
|
-
var version = "2.4.
|
|
154780
|
+
var version = "2.4.2";
|
|
154742
154781
|
|
|
154743
154782
|
function create({
|
|
154744
154783
|
componentPrefix = "U",
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, ref, h as h$1, inject, computed, shallowRef, readonly, watch, onMounted, onBeforeUnmount, onBeforeMount, reactive, onActivated, onDeactivated, createTextVNode, Fragment as Fragment$1, Comment, provide, withDirectives, Teleport, toRef, nextTick, renderSlot, mergeProps, vShow, isVNode, watchEffect, Transition, TransitionGroup, useId, shallowReadonly, toValue, getCurrentScope, onScopeDispose, unref, toRaw, cloneVNode, Text as Text$2, onUnmounted, onBeforeUpdate, onUpdated, normalizeStyle, isReactive, toRefs, warn as warn$4, markRaw, customRef, isProxy, renderList, createApp } from 'vue';
|
|
1
|
+
import { defineComponent, getCurrentInstance, ref, h as h$1, inject, computed, shallowRef, readonly, watch, onMounted, onBeforeUnmount, onBeforeMount, reactive, onActivated, onDeactivated, createTextVNode, Fragment as Fragment$1, Comment, provide, withDirectives, Teleport, toRef, nextTick, renderSlot, mergeProps, vShow, isRef, isVNode, watchEffect, Transition, TransitionGroup, useId, shallowReadonly, toValue, getCurrentScope, onScopeDispose, unref, toRaw, cloneVNode, Text as Text$2, onUnmounted, onBeforeUpdate, onUpdated, normalizeStyle, isReactive, toRefs, warn as warn$4, markRaw, customRef, isProxy, renderList, createApp } from 'vue';
|
|
2
2
|
|
|
3
3
|
function UzumUiResolver() {
|
|
4
4
|
return {
|
|
@@ -11102,6 +11102,15 @@ function render$2(r, ...args) {
|
|
|
11102
11102
|
}
|
|
11103
11103
|
}
|
|
11104
11104
|
|
|
11105
|
+
function resolveReactiveContent(content) {
|
|
11106
|
+
const value = isRef(content) ? content.value : typeof content === "function" ? content() : content;
|
|
11107
|
+
return value instanceof Date ? value.toString() : value;
|
|
11108
|
+
}
|
|
11109
|
+
function resolveReactiveText(content) {
|
|
11110
|
+
const value = resolveReactiveContent(content);
|
|
11111
|
+
return typeof value === "string" ? value : "";
|
|
11112
|
+
}
|
|
11113
|
+
|
|
11105
11114
|
function ensureValidVNode(vnodes) {
|
|
11106
11115
|
return vnodes.some(child => {
|
|
11107
11116
|
if (!isVNode(child)) {
|
|
@@ -51612,6 +51621,7 @@ function createClampHeadingRule(maxLevel) {
|
|
|
51612
51621
|
};
|
|
51613
51622
|
}
|
|
51614
51623
|
|
|
51624
|
+
const MARKDOWN_OPTIONS_KEYS_SEPARATOR = "|";
|
|
51615
51625
|
const HTML_COMMENT_REGEX = /<!--[\s\S]*?-->/g;
|
|
51616
51626
|
const HTML_CDATA_REGEX = /<!\[CDATA\[[\s\S]*?\]\]>/g;
|
|
51617
51627
|
const HTML_RAW_BLOCK_REGEX = /<(script|style|iframe|object|embed|template|svg|math|noscript)\b[^>]*>[\s\S]*?<\/\1\s*>/gi;
|
|
@@ -51799,12 +51809,21 @@ function normalizeOptions(options) {
|
|
|
51799
51809
|
breaks: options?.breaks ?? true
|
|
51800
51810
|
};
|
|
51801
51811
|
}
|
|
51812
|
+
function getMarkdownOptionsKey(options) {
|
|
51813
|
+
const tags = {
|
|
51814
|
+
features: [...new Set(options.features)].sort().join(","),
|
|
51815
|
+
maxHeadingLevel: String(options.maxHeadingLevel),
|
|
51816
|
+
breaks: options.breaks ? "1" : "0"
|
|
51817
|
+
};
|
|
51818
|
+
return [tags.features, tags.maxHeadingLevel, tags.breaks].join(MARKDOWN_OPTIONS_KEYS_SEPARATOR);
|
|
51819
|
+
}
|
|
51802
51820
|
function getMarkdownRenderer(options) {
|
|
51803
51821
|
const normalizedOptions = normalizeOptions(options);
|
|
51804
|
-
const
|
|
51822
|
+
const key = getMarkdownOptionsKey(normalizedOptions);
|
|
51823
|
+
const instance = rendererCache.get(key);
|
|
51805
51824
|
if (!instance) {
|
|
51806
51825
|
const renderer = createMarkdownRenderer(normalizedOptions);
|
|
51807
|
-
rendererCache.set(
|
|
51826
|
+
rendererCache.set(key, renderer);
|
|
51808
51827
|
return renderer;
|
|
51809
51828
|
}
|
|
51810
51829
|
return instance;
|
|
@@ -58711,11 +58730,11 @@ const messageBubbleProps = {
|
|
|
58711
58730
|
default: false
|
|
58712
58731
|
},
|
|
58713
58732
|
title: {
|
|
58714
|
-
type: [String, Function],
|
|
58733
|
+
type: [String, Object, Function],
|
|
58715
58734
|
default: void 0
|
|
58716
58735
|
},
|
|
58717
58736
|
content: {
|
|
58718
|
-
type: [String, Function],
|
|
58737
|
+
type: [String, Object, Function],
|
|
58719
58738
|
default: void 0
|
|
58720
58739
|
},
|
|
58721
58740
|
markdown: {
|
|
@@ -58731,7 +58750,7 @@ const messageBubbleProps = {
|
|
|
58731
58750
|
default: void 0
|
|
58732
58751
|
},
|
|
58733
58752
|
timestamp: {
|
|
58734
|
-
type: [String, Number, Date, Function],
|
|
58753
|
+
type: [String, Number, Date, Object, Function],
|
|
58735
58754
|
default: void 0
|
|
58736
58755
|
},
|
|
58737
58756
|
status: {
|
|
@@ -60674,8 +60693,14 @@ var _UMessageBubble = defineComponent({
|
|
|
60674
60693
|
status: props.status,
|
|
60675
60694
|
attachments: normalizedAttachmentsRef.value
|
|
60676
60695
|
}));
|
|
60696
|
+
const resolvedContentRef = computed(
|
|
60697
|
+
() => resolveReactiveContent(props.content)
|
|
60698
|
+
);
|
|
60699
|
+
const resolvedTitleRef = computed(
|
|
60700
|
+
() => resolveReactiveContent(props.title)
|
|
60701
|
+
);
|
|
60677
60702
|
const markdownContent = computed(() => {
|
|
60678
|
-
const content =
|
|
60703
|
+
const content = resolvedContentRef.value;
|
|
60679
60704
|
return props.markdown && typeof content === "string" ? content : null;
|
|
60680
60705
|
});
|
|
60681
60706
|
const markdownActive = computed(
|
|
@@ -60764,20 +60789,11 @@ var _UMessageBubble = defineComponent({
|
|
|
60764
60789
|
}
|
|
60765
60790
|
result.push({
|
|
60766
60791
|
key: action.key,
|
|
60767
|
-
label:
|
|
60792
|
+
label: () => resolveReactiveContent(action.label)
|
|
60768
60793
|
});
|
|
60769
60794
|
}
|
|
60770
60795
|
return result;
|
|
60771
60796
|
});
|
|
60772
|
-
const resolveRenderContent = (content) => {
|
|
60773
|
-
if (typeof content === "function") {
|
|
60774
|
-
return content();
|
|
60775
|
-
}
|
|
60776
|
-
if (content instanceof Date) {
|
|
60777
|
-
return content.toString();
|
|
60778
|
-
}
|
|
60779
|
-
return content;
|
|
60780
|
-
};
|
|
60781
60797
|
const getThumbnailUrl = (attachment) => {
|
|
60782
60798
|
const url = [attachment.preview, attachment.thumbnail].find(
|
|
60783
60799
|
(value) => typeof value === "string"
|
|
@@ -60882,10 +60898,10 @@ var _UMessageBubble = defineComponent({
|
|
|
60882
60898
|
const hasBubbleActionsConfig = Boolean(
|
|
60883
60899
|
props.actions && props.actions.length > 0
|
|
60884
60900
|
);
|
|
60885
|
-
const hasTitle = Boolean(
|
|
60901
|
+
const hasTitle = Boolean(resolvedTitleRef.value || slots.title);
|
|
60886
60902
|
const afterContentSlot = slots.afterContent || slots["after-content"];
|
|
60887
60903
|
const hasAfterContent = Boolean(afterContentSlot);
|
|
60888
|
-
const hasVisibleTextContent = markdownActive.value ? markdownHtmlRef.value !== null : Boolean(
|
|
60904
|
+
const hasVisibleTextContent = markdownActive.value ? markdownHtmlRef.value !== null : Boolean(resolvedContentRef.value);
|
|
60889
60905
|
const hasContentInsideBubble = Boolean(
|
|
60890
60906
|
hasVisibleTextContent || slots.default || hasAfterContent || hasTitle || normalizedAttachmentsRef.value.length > 1
|
|
60891
60907
|
);
|
|
@@ -60903,7 +60919,9 @@ var _UMessageBubble = defineComponent({
|
|
|
60903
60919
|
class: `${mergedClsPrefixRef.value}-message-bubble__title`,
|
|
60904
60920
|
variant: "body-l-semi-bold"
|
|
60905
60921
|
},
|
|
60906
|
-
|
|
60922
|
+
{
|
|
60923
|
+
default: () => slots.title ? slots.title(messagePayloadRef.value) : resolvedTitleRef.value
|
|
60924
|
+
}
|
|
60907
60925
|
),
|
|
60908
60926
|
normalizedAttachmentsRef.value.length > 0 && renderAttachment(true),
|
|
60909
60927
|
(hasVisibleTextContent || slots.default) && (slots.default ? /* @__PURE__ */ h$1("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` }, slots.default(messagePayloadRef.value)) : markdownHtmlRef.value !== null ? /* @__PURE__ */ h$1(
|
|
@@ -60917,7 +60935,7 @@ var _UMessageBubble = defineComponent({
|
|
|
60917
60935
|
],
|
|
60918
60936
|
innerHTML: markdownHtmlRef.value
|
|
60919
60937
|
}
|
|
60920
|
-
) : /* @__PURE__ */ h$1("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` },
|
|
60938
|
+
) : /* @__PURE__ */ h$1("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` }, resolvedContentRef.value)),
|
|
60921
60939
|
hasAfterContent && /* @__PURE__ */ h$1(
|
|
60922
60940
|
"div",
|
|
60923
60941
|
{
|
|
@@ -61022,7 +61040,7 @@ var _UMessageBubble = defineComponent({
|
|
|
61022
61040
|
{
|
|
61023
61041
|
class: `${mergedClsPrefixRef.value}-message-bubble__time`
|
|
61024
61042
|
},
|
|
61025
|
-
|
|
61043
|
+
resolveReactiveContent(props.timestamp)
|
|
61026
61044
|
), props.isOwn && props.status && /* @__PURE__ */ h$1(
|
|
61027
61045
|
"div",
|
|
61028
61046
|
{
|
|
@@ -61070,7 +61088,7 @@ var _UMessageBubble = defineComponent({
|
|
|
61070
61088
|
],
|
|
61071
61089
|
innerHTML: markdownHtmlRef.value
|
|
61072
61090
|
}
|
|
61073
|
-
) :
|
|
61091
|
+
) : resolvedContentRef.value && /* @__PURE__ */ h$1("span", null, resolvedContentRef.value)
|
|
61074
61092
|
);
|
|
61075
61093
|
};
|
|
61076
61094
|
return {
|
|
@@ -62587,7 +62605,9 @@ var ChatEditingBlock = defineComponent({
|
|
|
62587
62605
|
_UListItem,
|
|
62588
62606
|
{
|
|
62589
62607
|
header: { text: this.mergedTitle },
|
|
62590
|
-
description: {
|
|
62608
|
+
description: {
|
|
62609
|
+
text: resolveReactiveText(this.message?.content)
|
|
62610
|
+
}
|
|
62591
62611
|
},
|
|
62592
62612
|
{
|
|
62593
62613
|
suffix: () => /* @__PURE__ */ h$1(
|
|
@@ -93163,6 +93183,8 @@ var _UEditor = defineComponent({
|
|
|
93163
93183
|
toRef(props, "value"),
|
|
93164
93184
|
uncontrolledValueRef
|
|
93165
93185
|
);
|
|
93186
|
+
const parserRef = shallowRef();
|
|
93187
|
+
const parserKeyRef = shallowRef();
|
|
93166
93188
|
const serializer = createMarkdownSerializer(props.markdownOptions);
|
|
93167
93189
|
const sourceMarkdownRef = ref(mergedValueRef.value ?? "");
|
|
93168
93190
|
const loadedDocumentRef = ref(null);
|
|
@@ -93213,13 +93235,22 @@ var _UEditor = defineComponent({
|
|
|
93213
93235
|
if (props["onUpdate:value"])
|
|
93214
93236
|
call(props["onUpdate:value"], value);
|
|
93215
93237
|
}
|
|
93238
|
+
function getParser(instance) {
|
|
93239
|
+
const normalizedOptions = normalizeOptions(props.markdownOptions);
|
|
93240
|
+
const key = getMarkdownOptionsKey(normalizedOptions);
|
|
93241
|
+
if (!parserRef.value || parserKeyRef.value !== key) {
|
|
93242
|
+
parserKeyRef.value = key;
|
|
93243
|
+
parserRef.value = createMarkdownParser(
|
|
93244
|
+
instance.schema,
|
|
93245
|
+
props.markdownOptions
|
|
93246
|
+
);
|
|
93247
|
+
}
|
|
93248
|
+
return parserRef.value;
|
|
93249
|
+
}
|
|
93216
93250
|
function setMarkdown(markdown, instance = editorRef.value, addToHistory = true) {
|
|
93217
93251
|
if (!instance)
|
|
93218
93252
|
return;
|
|
93219
|
-
const document =
|
|
93220
|
-
instance.schema,
|
|
93221
|
-
props.markdownOptions
|
|
93222
|
-
).parse(markdown);
|
|
93253
|
+
const document = getParser(instance).parse(markdown);
|
|
93223
93254
|
sourceMarkdownRef.value = markdown;
|
|
93224
93255
|
loadedDocumentRef.value = document;
|
|
93225
93256
|
instance.chain().setMeta("addToHistory", addToHistory).setContent(document.toJSON(), { emitUpdate: false }).run();
|
|
@@ -93887,7 +93918,7 @@ var ChatHeader = defineComponent({
|
|
|
93887
93918
|
render() {
|
|
93888
93919
|
const { mergedClsPrefix, mergedTheme, selectedChat } = this;
|
|
93889
93920
|
const keyId = this.toKeyString(selectedChat?.id);
|
|
93890
|
-
const keyTitle =
|
|
93921
|
+
const keyTitle = resolveReactiveText(selectedChat?.title);
|
|
93891
93922
|
const renderDefaultActions = () => [
|
|
93892
93923
|
/* @__PURE__ */ h$1(_UTooltip, null, {
|
|
93893
93924
|
trigger: () => /* @__PURE__ */ h$1(
|
|
@@ -93973,7 +94004,7 @@ var ChatHeader = defineComponent({
|
|
|
93973
94004
|
themeOverrides: mergedTheme.peerOverrides.Typography
|
|
93974
94005
|
},
|
|
93975
94006
|
{
|
|
93976
|
-
default: () => selectedChat?.title
|
|
94007
|
+
default: () => resolveReactiveContent(selectedChat?.title)
|
|
93977
94008
|
}
|
|
93978
94009
|
), this.typing && /* @__PURE__ */ h$1(
|
|
93979
94010
|
_UText,
|
|
@@ -94196,7 +94227,7 @@ var _UChatMessages = defineComponent({
|
|
|
94196
94227
|
}));
|
|
94197
94228
|
};
|
|
94198
94229
|
const renderDateSeparator = (date) => {
|
|
94199
|
-
return /* @__PURE__ */ h$1("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` }, /* @__PURE__ */ h$1("span", null, date));
|
|
94230
|
+
return /* @__PURE__ */ h$1("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` }, /* @__PURE__ */ h$1("span", null, resolveReactiveContent(date)));
|
|
94200
94231
|
};
|
|
94201
94232
|
const renderUnreadNotification = () => {
|
|
94202
94233
|
const count = props.unreadNotificationCount ?? unreadMessagesCount.value;
|
|
@@ -94378,14 +94409,14 @@ var _UChatMessages = defineComponent({
|
|
|
94378
94409
|
let currentDate = "";
|
|
94379
94410
|
let unreadNotificationInserted = false;
|
|
94380
94411
|
this.messages?.forEach((message, index) => {
|
|
94381
|
-
const
|
|
94382
|
-
if (
|
|
94412
|
+
const messageDateText = resolveReactiveText(message.date);
|
|
94413
|
+
if (messageDateText !== currentDate) {
|
|
94383
94414
|
messagesWithDates.push({
|
|
94384
94415
|
type: "date-separator",
|
|
94385
|
-
date:
|
|
94416
|
+
date: message.date,
|
|
94386
94417
|
id: `date-${String(index)}`
|
|
94387
94418
|
});
|
|
94388
|
-
currentDate =
|
|
94419
|
+
currentDate = messageDateText;
|
|
94389
94420
|
}
|
|
94390
94421
|
if (!unreadNotificationInserted && !message.isOwn && message.status === MessageStatus.UNREAD && this.showUnreadNotification) {
|
|
94391
94422
|
messagesWithDates.push({
|
|
@@ -95085,7 +95116,7 @@ var _UChatMainArea = defineComponent({
|
|
|
95085
95116
|
if (editMessageIdRef) {
|
|
95086
95117
|
editMessageIdRef.value = message.id;
|
|
95087
95118
|
}
|
|
95088
|
-
inputValue.value =
|
|
95119
|
+
inputValue.value = resolveReactiveText(message.content);
|
|
95089
95120
|
attachmentFileList.value = [];
|
|
95090
95121
|
uploadedAttachmentsMap.value.clear();
|
|
95091
95122
|
};
|
|
@@ -95551,10 +95582,9 @@ var _UChatListItems = defineComponent({
|
|
|
95551
95582
|
const renderChatItem = (item) => {
|
|
95552
95583
|
const isSelected = props.selectedChatId === item.id;
|
|
95553
95584
|
const isTyping = props.typingChatIds?.includes(item.id) ?? false;
|
|
95554
|
-
const
|
|
95555
|
-
const
|
|
95556
|
-
const
|
|
95557
|
-
const keySubtitle = toKeyString(subtitle);
|
|
95585
|
+
const keyId = toKeyString(item.id);
|
|
95586
|
+
const keyTitle = resolveReactiveText(item.title);
|
|
95587
|
+
const keySubtitle = resolveReactiveText(item.subtitle);
|
|
95558
95588
|
return /* @__PURE__ */ h$1(
|
|
95559
95589
|
_UListItem,
|
|
95560
95590
|
{
|
|
@@ -95590,7 +95620,10 @@ var _UChatListItems = defineComponent({
|
|
|
95590
95620
|
variant: "body-l-medium"
|
|
95591
95621
|
},
|
|
95592
95622
|
{
|
|
95593
|
-
default: () =>
|
|
95623
|
+
default: () => {
|
|
95624
|
+
const title = resolveReactiveContent(item.title);
|
|
95625
|
+
return typeof title === "string" ? sanitizeMarkdown(title) : title;
|
|
95626
|
+
}
|
|
95594
95627
|
}
|
|
95595
95628
|
),
|
|
95596
95629
|
description: () => /* @__PURE__ */ h$1(
|
|
@@ -95603,7 +95636,13 @@ var _UChatListItems = defineComponent({
|
|
|
95603
95636
|
variant: "body-m-medium"
|
|
95604
95637
|
},
|
|
95605
95638
|
{
|
|
95606
|
-
default: () =>
|
|
95639
|
+
default: () => {
|
|
95640
|
+
if (isTyping) {
|
|
95641
|
+
return mergedTypingTextRef.value;
|
|
95642
|
+
}
|
|
95643
|
+
const subTitle = resolveReactiveContent(item.subtitle);
|
|
95644
|
+
return typeof subTitle === "string" ? sanitizeMarkdown(subTitle) : subTitle;
|
|
95645
|
+
}
|
|
95607
95646
|
}
|
|
95608
95647
|
),
|
|
95609
95648
|
suffix: () => {
|
|
@@ -95620,7 +95659,7 @@ var _UChatListItems = defineComponent({
|
|
|
95620
95659
|
{
|
|
95621
95660
|
class: `${mergedClsPrefixRef.value}-chat-sidebar__item-time`
|
|
95622
95661
|
},
|
|
95623
|
-
item.datetime
|
|
95662
|
+
resolveReactiveContent(item.datetime)
|
|
95624
95663
|
), /* @__PURE__ */ h$1(
|
|
95625
95664
|
"div",
|
|
95626
95665
|
{
|
|
@@ -154734,7 +154773,7 @@ function useThemeVars() {
|
|
|
154734
154773
|
});
|
|
154735
154774
|
}
|
|
154736
154775
|
|
|
154737
|
-
var version = "2.4.
|
|
154776
|
+
var version = "2.4.2";
|
|
154738
154777
|
|
|
154739
154778
|
function create({
|
|
154740
154779
|
componentPrefix = "U",
|