@voicenter-team/voicenter-ui-plus 3.4.4 → 3.4.6

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 (151) hide show
  1. package/README.md +502 -502
  2. package/library/assets/assets/sass/main.css +1 -1
  3. package/library/assets/components/VcAvatar/VcAvatar.css +1 -0
  4. package/library/assets/components/VcBadgeTag/VcBadgeTag.css +1 -0
  5. package/library/assets/components/VcChatComposer/VcChatComposer.css +1 -0
  6. package/library/assets/components/VcEmojiPicker/VcEmojiPicker.css +1 -0
  7. package/library/assets/components/VcFileUploader/VcFileItem.css +1 -0
  8. package/library/assets/components/VcFileUploader/VcFileUploaderArea.css +1 -1
  9. package/library/assets/components/VcFileUploader/VcFileUploaderSimple.css +1 -1
  10. package/library/assets/components/VcJsonSchema/Components/JsonSchemaEditor.css +1 -1
  11. package/library/assets/components/VcLoading/Loaders/Circles.css +1 -1
  12. package/library/assets/components/VcLoading/Loaders/DotSpinner.css +1 -1
  13. package/library/assets/components/VcLoading/Loaders/LdsSpinner.css +1 -1
  14. package/library/assets/components/VcLoading/Loaders/LoadIcon.css +1 -1
  15. package/library/assets/components/VcLoading/Loaders/Stretch.css +1 -1
  16. package/library/assets/components/VcLoading/VcLoading.css +1 -1
  17. package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
  18. package/library/assets/components/VcMessage/VcMessage.css +1 -0
  19. package/library/assets/components/VcMessage/content/VcMessageAudioBlock.css +1 -0
  20. package/library/assets/components/VcMessage/content/VcMessageFileBlock.css +1 -0
  21. package/library/assets/components/VcMessage/content/VcMessageImageBlock.css +1 -0
  22. package/library/assets/components/VcMessage/content/VcMessageTextBlock.css +1 -0
  23. package/library/assets/components/VcMessage/reactions/VcMessageEmojiPicker.css +1 -0
  24. package/library/assets/components/VcMessage/reactions/VcMessageReactionBar.css +1 -0
  25. package/library/assets/components/VcMessagesWrapper/VcMessagesWrapper.css +1 -0
  26. package/library/assets/components/VcSkeletonLoader/Loaders/Card.css +1 -1
  27. package/library/assets/components/VcSkeletonLoader/Loaders/Circle.css +1 -1
  28. package/library/assets/components/VcSkeletonLoader/Loaders/Row.css +1 -1
  29. package/library/assets/components/VcSkeletonLoader/Loaders/Square.css +1 -1
  30. package/library/assets/components/VcSkeletonLoader/Loaders/Text.css +1 -1
  31. package/library/components/VcAvatar/VcAvatar.vue.mjs +62 -0
  32. package/library/components/VcAvatar/VcAvatar.vue3.mjs +5 -0
  33. package/library/components/VcBadgeTag/VcBadgeTag.vue.mjs +31 -0
  34. package/library/components/VcBadgeTag/VcBadgeTag.vue3.mjs +5 -0
  35. package/library/components/VcChatComposer/VcChatComposer.vue.mjs +554 -0
  36. package/library/components/VcChatComposer/VcChatComposer.vue3.mjs +5 -0
  37. package/library/components/VcChatComposer/richText.mjs +320 -0
  38. package/library/components/VcEmojiPicker/VcEmojiPicker.vue.mjs +387 -0
  39. package/library/components/VcEmojiPicker/VcEmojiPicker.vue3.mjs +5 -0
  40. package/library/components/VcEmojiPicker/emojiData.mjs +26 -0
  41. package/library/components/VcFileUploader/VcFileItem.vue.mjs +146 -0
  42. package/library/components/VcFileUploader/VcFileItem.vue3.mjs +5 -0
  43. package/library/components/VcFileUploader/VcFileUploaderArea.vue.mjs +24 -147
  44. package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +1 -1
  45. package/library/components/VcJsonSchema/Components/JsonSchemaEditor.vue.mjs +1 -1
  46. package/library/components/VcLoading/Loaders/Circles.vue.mjs +1 -1
  47. package/library/components/VcLoading/Loaders/DotSpinner.vue.mjs +1 -1
  48. package/library/components/VcLoading/Loaders/DotSpinner.vue2.mjs +2 -2
  49. package/library/components/VcLoading/Loaders/LdsSpinner.vue.mjs +1 -1
  50. package/library/components/VcLoading/Loaders/LoadIcon.vue.mjs +1 -1
  51. package/library/components/VcLoading/Loaders/Stretch.vue.mjs +1 -1
  52. package/library/components/VcLoading/Loaders/Stretch.vue2.mjs +1 -1
  53. package/library/components/VcLoading/VcLoading.vue.mjs +1 -1
  54. package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
  55. package/library/components/VcMessage/VcMessage.vue.mjs +212 -0
  56. package/library/components/VcMessage/VcMessage.vue3.mjs +5 -0
  57. package/library/components/VcMessage/content/VcMessageAudioBlock.vue.mjs +53 -0
  58. package/library/components/VcMessage/content/VcMessageAudioBlock.vue3.mjs +5 -0
  59. package/library/components/VcMessage/content/VcMessageFileBlock.vue.mjs +80 -0
  60. package/library/components/VcMessage/content/VcMessageFileBlock.vue3.mjs +5 -0
  61. package/library/components/VcMessage/content/VcMessageImageBlock.vue.mjs +57 -0
  62. package/library/components/VcMessage/content/VcMessageImageBlock.vue3.mjs +5 -0
  63. package/library/components/VcMessage/content/VcMessageTextBlock.vue.mjs +19 -0
  64. package/library/components/VcMessage/content/VcMessageTextBlock.vue3.mjs +5 -0
  65. package/library/components/VcMessage/content/messageContentComponents.mjs +17 -0
  66. package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue.mjs +167 -0
  67. package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue3.mjs +5 -0
  68. package/library/components/VcMessage/reactions/VcMessageReactionBar.vue.mjs +82 -0
  69. package/library/components/VcMessage/reactions/VcMessageReactionBar.vue3.mjs +5 -0
  70. package/library/components/VcMessage/reactions/emojis.mjs +4 -0
  71. package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue.mjs +243 -0
  72. package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue3.mjs +5 -0
  73. package/library/components/VcSkeletonLoader/Loaders/Card.vue.mjs +1 -1
  74. package/library/components/VcSkeletonLoader/Loaders/Circle.vue.mjs +1 -1
  75. package/library/components/VcSkeletonLoader/Loaders/Row.vue.mjs +1 -1
  76. package/library/components/VcSkeletonLoader/Loaders/Square.vue.mjs +1 -1
  77. package/library/components/VcSkeletonLoader/Loaders/Text.vue.mjs +1 -1
  78. package/library/components/VcSoundplayer/useSoundPlayerProvideInject.mjs +1 -1
  79. package/library/composables/useAudioRecorder.mjs +120 -0
  80. package/library/enum/fileTypes.mjs +51 -0
  81. package/library/index.mjs +237 -216
  82. package/library/index.mjs.br +0 -0
  83. package/library/index.mjs.gz +0 -0
  84. package/library/localization/index.mjs.gz +0 -0
  85. package/library/localization/locales/en.json.mjs +24 -1
  86. package/library/plugin-components.gen.mjs +171 -150
  87. package/library/plugin.mjs +235 -214
  88. package/library/plugin.mjs.br +0 -0
  89. package/library/plugin.mjs.gz +0 -0
  90. package/library/style.css +42 -16
  91. package/library/style.css.br +0 -0
  92. package/library/style.css.gz +0 -0
  93. package/library/theme/index.mjs.gz +0 -0
  94. package/library/types/components/VcAvatar/VcAvatar.vue.d.ts +47 -0
  95. package/library/types/components/VcBadgeTag/VcBadgeTag.vue.d.ts +42 -0
  96. package/library/types/components/VcChatComposer/VcChatComposer.vue.d.ts +81 -0
  97. package/library/types/components/VcChatComposer/richText.d.ts +12 -0
  98. package/library/types/components/VcCollapse/VcCollapseItem.vue.d.ts +1 -1
  99. package/library/types/components/VcEmojiPicker/VcEmojiPicker.vue.d.ts +63 -0
  100. package/library/types/components/VcEmojiPicker/emojiData.d.ts +16 -0
  101. package/library/types/components/VcExcelUploader/VcExcelFileUploadBlock.vue.d.ts +1 -1
  102. package/library/types/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue.d.ts +2 -2
  103. package/library/types/components/VcFileUploader/VcFileItem.vue.d.ts +85 -0
  104. package/library/types/components/VcFileUploader/VcFileUploader.vue.d.ts +3 -3
  105. package/library/types/components/VcFileUploader/VcFileUploaderArea.vue.d.ts +17 -18
  106. package/library/types/components/VcFileUploader/VcFileUploaderSimple.vue.d.ts +3 -3
  107. package/library/types/components/VcForm/VcForm.vue.d.ts +1 -1
  108. package/library/types/components/VcMessage/VcMessage.vue.d.ts +66 -0
  109. package/library/types/components/VcMessage/content/VcMessageAudioBlock.vue.d.ts +24 -0
  110. package/library/types/components/VcMessage/content/VcMessageFileBlock.vue.d.ts +24 -0
  111. package/library/types/components/VcMessage/content/VcMessageImageBlock.vue.d.ts +28 -0
  112. package/library/types/components/VcMessage/content/VcMessageTextBlock.vue.d.ts +24 -0
  113. package/library/types/components/VcMessage/content/messageContentComponents.d.ts +3 -0
  114. package/library/types/components/VcMessage/reactions/VcMessageEmojiPicker.vue.d.ts +68 -0
  115. package/library/types/components/VcMessage/reactions/VcMessageReactionBar.vue.d.ts +28 -0
  116. package/library/types/components/VcMessage/reactions/emojis.d.ts +1 -0
  117. package/library/types/components/VcMessagesWrapper/VcMessagesWrapper.vue.d.ts +71 -0
  118. package/library/types/components/VcProgress/VcProgress.vue.d.ts +1 -1
  119. package/library/types/components/VcRadioGroup/VcRadioGroup.vue.d.ts +3 -3
  120. package/library/types/components/VcSelect/VcInfiniteScrollSelect.vue.d.ts +6 -6
  121. package/library/types/components/VcSelect/VcSelect.vue.d.ts +6 -6
  122. package/library/types/components/VcSelect/VcSelectGrouped.vue.d.ts +6 -6
  123. package/library/types/components/VcSelect/VcSelectOption.vue.d.ts +3 -3
  124. package/library/types/components/VcTree/VcTree.vue.d.ts +6 -6
  125. package/library/types/components/VcTree/VcTreeSelect.vue.d.ts +3 -3
  126. package/library/types/components/VcWizard/VcSummaryStep.vue.d.ts +1 -1
  127. package/library/types/components/VcWizard/VcWizardSummary.vue.d.ts +1 -1
  128. package/library/types/components/exports.d.ts +15 -1
  129. package/library/types/components.gen.d.ts +7 -0
  130. package/library/types/composables/useAudioRecorder.d.ts +18 -0
  131. package/library/types/entity/components/Button/VcEntityDeleteIconButton.vue.d.ts +3 -3
  132. package/library/types/enum/fileTypes.d.ts +3 -0
  133. package/library/types/localization/locales/en.json.d.ts +187 -164
  134. package/library/types/theme/themes.json.d.ts +227 -227
  135. package/library/types/types/VcAvatar.types.d.ts +35 -0
  136. package/library/types/types/VcBadgeTag.types.d.ts +19 -0
  137. package/library/types/types/VcChatComposer.types.d.ts +112 -0
  138. package/library/types/types/VcEmojiPicker.types.d.ts +20 -0
  139. package/library/types/types/VcFileUploader.types.d.ts +4 -0
  140. package/library/types/types/VcMessage.types.d.ts +131 -0
  141. package/library/types/types/VcMessagesWrapper.types.d.ts +61 -0
  142. package/library/types/types/index.d.ts +6 -0
  143. package/library/utils/jsonSchema/index.mjs.gz +0 -0
  144. package/package.json +215 -185
  145. package/src/theme/index.ts +101 -101
  146. package/src/theme/tailwindScheme.js +37 -37
  147. package/src/theme/theme.types.ts +31 -31
  148. package/src/theme/themeMerge.ts +40 -40
  149. package/src/theme/themes.json +227 -227
  150. package/tailwind.config.d.ts +5 -5
  151. package/tailwind.config.js +192 -192
@@ -0,0 +1,82 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, withCtx, createElementVNode, normalizeClass, toDisplayString, createVNode } from "vue";
2
+ import { ElTooltip } from "element-plus";
3
+ import '../../../assets/components/VcMessage/reactions/VcMessageEmojiPicker.css';import '../../../assets/components/VcIcon/VcIcon.css';import '../../../assets/node_modules/element-plus/theme-chalk/src/tooltip.css';import '../../../assets/node_modules/element-plus/theme-chalk/src/popper.css';import '../../../assets/node_modules/element-plus/theme-chalk/src/base.css';
4
+ import '../../../assets/components/VcMessage/reactions/VcMessageReactionBar.css';/* empty css */
5
+ /* empty css */
6
+ /* empty css */
7
+ import { Plus } from "@lucide/vue";
8
+ import _sfc_main$2 from "../../VcIcon/VcIcon.vue.mjs";
9
+ /* empty css */
10
+ import { tVU } from "../../../localization/index.mjs";
11
+ import _sfc_main$1 from "./VcMessageEmojiPicker.vue.mjs";
12
+ /* empty css */
13
+ const _hoisted_1 = { class: "vc-message-reaction-bar" };
14
+ const _hoisted_2 = ["aria-pressed", "onClick"];
15
+ const _hoisted_3 = { class: "vc-message-reaction-bar__emoji" };
16
+ const _hoisted_4 = { class: "vc-message-reaction-bar__count" };
17
+ const _hoisted_5 = ["aria-label", "title", "aria-expanded"];
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
19
+ __name: "VcMessageReactionBar",
20
+ props: {
21
+ reactions: {},
22
+ emojis: {}
23
+ },
24
+ emits: ["toggle"],
25
+ setup(__props, { emit: __emit }) {
26
+ const emit = __emit;
27
+ const addReactionLabel = computed(() => tVU.t("voicenterUi.message.addReaction"));
28
+ function getUsersText(reaction) {
29
+ const users = reaction.users ?? [];
30
+ const rest = reaction.count - users.length;
31
+ const names = users.join(", ");
32
+ return rest > 0 ? `${names} ${tVU.t("voicenterUi.message.reactionUsersMore", { count: rest })}` : names;
33
+ }
34
+ return (_ctx, _cache) => {
35
+ return openBlock(), createElementBlock("div", _hoisted_1, [
36
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.reactions, (reaction) => {
37
+ var _a;
38
+ return openBlock(), createBlock(unref(ElTooltip), {
39
+ key: reaction.emoji,
40
+ content: getUsersText(reaction),
41
+ disabled: !((_a = reaction.users) == null ? void 0 : _a.length),
42
+ placement: "top"
43
+ }, {
44
+ default: withCtx(() => [
45
+ createElementVNode("button", {
46
+ class: normalizeClass([{ "is--own": reaction.isOwn }, "vc-message-reaction-bar__chip"]),
47
+ "aria-pressed": !!reaction.isOwn,
48
+ type: "button",
49
+ onClick: ($event) => emit("toggle", reaction.emoji)
50
+ }, [
51
+ createElementVNode("span", _hoisted_3, toDisplayString(reaction.emoji), 1),
52
+ createElementVNode("span", _hoisted_4, toDisplayString(reaction.count), 1)
53
+ ], 10, _hoisted_2)
54
+ ]),
55
+ _: 2
56
+ }, 1032, ["content", "disabled"]);
57
+ }), 128)),
58
+ createVNode(_sfc_main$1, {
59
+ emojis: __props.emojis,
60
+ onSelect: _cache[0] || (_cache[0] = (emoji) => emit("toggle", emoji))
61
+ }, {
62
+ trigger: withCtx(({ isOpen }) => [
63
+ createElementVNode("button", {
64
+ "aria-label": addReactionLabel.value,
65
+ title: addReactionLabel.value,
66
+ "aria-expanded": isOpen,
67
+ "aria-haspopup": "true",
68
+ type: "button",
69
+ class: "vc-message-reaction-bar__chip vc-message-reaction-bar__add"
70
+ }, [
71
+ createVNode(_sfc_main$2, { icon: unref(Plus) }, null, 8, ["icon"])
72
+ ], 8, _hoisted_5)
73
+ ]),
74
+ _: 1
75
+ }, 8, ["emojis"])
76
+ ]);
77
+ };
78
+ }
79
+ });
80
+ export {
81
+ _sfc_main as default
82
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcMessageReactionBar.vue.mjs";
2
+ import '../../../assets/components/VcMessage/reactions/VcMessageReactionBar.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,4 @@
1
+ const DEFAULT_REACTION_EMOJIS = ["👍", "❤️", "😂", "😮", "😢", "🙏", "🎉", "🔥"];
2
+ export {
3
+ DEFAULT_REACTION_EMOJIS
4
+ };
@@ -0,0 +1,243 @@
1
+ import '../../assets/components/VcMessagesWrapper/VcMessagesWrapper.css';
2
+ import { defineComponent, ref, computed, watch, nextTick, onMounted, onBeforeUnmount, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, Fragment, renderList, toDisplayString, normalizeClass, createVNode } from "vue";
3
+ import dayjs from "dayjs";
4
+ import _sfc_main$1 from "../VcMessage/VcMessage.vue.mjs";
5
+ import '../../assets/components/VcMessage/VcMessage.css';/* empty css */
6
+ import { tVU } from "../../localization/index.mjs";
7
+ const _hoisted_1 = {
8
+ key: 0,
9
+ class: "vc-messages-wrapper__date"
10
+ };
11
+ const _hoisted_2 = { class: "vc-messages-wrapper__date-label" };
12
+ const _hoisted_3 = ["data-message-id"];
13
+ const _hoisted_4 = {
14
+ key: 0,
15
+ class: "vc-messages-wrapper__header"
16
+ };
17
+ const _hoisted_5 = { class: "vc-messages-wrapper__sender" };
18
+ const _hoisted_6 = { class: "vc-messages-wrapper__time" };
19
+ const _sfc_main = /* @__PURE__ */ defineComponent({
20
+ __name: "VcMessagesWrapper",
21
+ props: {
22
+ messages: {},
23
+ options: { type: Function, default: void 0 },
24
+ additionalOptions: { type: Function, default: void 0 },
25
+ reactionEmojis: { default: void 0 },
26
+ scrollThreshold: { default: 50 },
27
+ dateFormat: { default: "dddd, MMM D" },
28
+ timeFormat: { default: "HH:mm" }
29
+ },
30
+ emits: ["reached-top", "reached-bottom", "option-click", "reply-click", "content-click", "reaction-toggle"],
31
+ setup(__props, { expose: __expose, emit: __emit }) {
32
+ const props = __props;
33
+ const emit = __emit;
34
+ const containerRef = ref();
35
+ const listRef = ref();
36
+ const renderItems = computed(() => {
37
+ const items = [];
38
+ let previous;
39
+ for (const message of props.messages) {
40
+ const createdAt = dayjs(message.createdAt);
41
+ const previousCreatedAt = previous ? dayjs(previous.createdAt) : void 0;
42
+ const isNewDay = !previousCreatedAt || !createdAt.isSame(previousCreatedAt, "day");
43
+ if (isNewDay) {
44
+ items.push({
45
+ kind: "date",
46
+ key: `date-${createdAt.format("YYYY-MM-DD")}`,
47
+ date: createdAt.toDate(),
48
+ label: formatDateLabel(createdAt)
49
+ });
50
+ }
51
+ const isGroupStart = isNewDay || (previous == null ? void 0 : previous.sender.id) !== message.sender.id;
52
+ const isNewMinute = !previousCreatedAt || !createdAt.isSame(previousCreatedAt, "minute");
53
+ items.push({
54
+ kind: "message",
55
+ key: message.id,
56
+ message,
57
+ isGroupStart,
58
+ showTime: isGroupStart || isNewMinute,
59
+ time: createdAt.format(props.timeFormat)
60
+ });
61
+ previous = message;
62
+ }
63
+ return items;
64
+ });
65
+ function formatDateLabel(date) {
66
+ const today = dayjs();
67
+ if (date.isSame(today, "day")) {
68
+ return tVU.t("voicenterUi.messagesWrapper.today");
69
+ }
70
+ if (date.isSame(today.subtract(1, "day"), "day")) {
71
+ return tVU.t("voicenterUi.messagesWrapper.yesterday");
72
+ }
73
+ return date.format(props.dateFormat);
74
+ }
75
+ let isAtTop = false;
76
+ let isAtBottom = false;
77
+ function getEdges() {
78
+ const el = containerRef.value;
79
+ if (!el) {
80
+ return {
81
+ top: false,
82
+ bottom: false
83
+ };
84
+ }
85
+ return {
86
+ top: el.scrollTop <= props.scrollThreshold,
87
+ bottom: el.scrollHeight - el.scrollTop - el.clientHeight <= props.scrollThreshold
88
+ };
89
+ }
90
+ function syncEdges() {
91
+ const edges = getEdges();
92
+ isAtTop = edges.top;
93
+ isAtBottom = edges.bottom;
94
+ }
95
+ function onScroll() {
96
+ const edges = getEdges();
97
+ if (edges.top && !isAtTop) {
98
+ emit("reached-top");
99
+ }
100
+ if (edges.bottom && !isAtBottom) {
101
+ emit("reached-bottom");
102
+ }
103
+ isAtTop = edges.top;
104
+ isAtBottom = edges.bottom;
105
+ }
106
+ function scrollToBottom(behavior = "auto") {
107
+ const el = containerRef.value;
108
+ if (!el) {
109
+ return;
110
+ }
111
+ el.scrollTo({
112
+ top: el.scrollHeight,
113
+ behavior
114
+ });
115
+ syncEdges();
116
+ }
117
+ function scrollToMessage(id, behavior = "smooth") {
118
+ var _a;
119
+ const target = (_a = containerRef.value) == null ? void 0 : _a.querySelector(`[data-message-id="${CSS.escape(String(id))}"]`);
120
+ if (!target) {
121
+ return false;
122
+ }
123
+ target.scrollIntoView({
124
+ block: "center",
125
+ behavior
126
+ });
127
+ return true;
128
+ }
129
+ function onReplyClick(message) {
130
+ var _a;
131
+ if (((_a = message.replyTo) == null ? void 0 : _a.id) !== void 0) {
132
+ scrollToMessage(message.replyTo.id);
133
+ }
134
+ emit("reply-click", message);
135
+ }
136
+ watch(
137
+ () => {
138
+ var _a, _b;
139
+ return [props.messages.length, (_a = props.messages[0]) == null ? void 0 : _a.id, (_b = props.messages[props.messages.length - 1]) == null ? void 0 : _b.id];
140
+ },
141
+ async (_, [, previousFirstId]) => {
142
+ const el = containerRef.value;
143
+ if (!el) {
144
+ return;
145
+ }
146
+ const wasAtBottom = getEdges().bottom;
147
+ const previousScrollHeight = el.scrollHeight;
148
+ const previousScrollTop = el.scrollTop;
149
+ const previousFirstIndex = props.messages.findIndex((message) => message.id === previousFirstId);
150
+ await nextTick();
151
+ if (previousFirstIndex > 0) {
152
+ el.scrollTop = previousScrollTop + (el.scrollHeight - previousScrollHeight);
153
+ syncEdges();
154
+ } else if (wasAtBottom) {
155
+ scrollToBottom();
156
+ }
157
+ }
158
+ );
159
+ let resizeObserver;
160
+ onMounted(() => {
161
+ scrollToBottom();
162
+ resizeObserver = new ResizeObserver(() => {
163
+ if (isAtBottom) {
164
+ scrollToBottom();
165
+ }
166
+ });
167
+ if (listRef.value) {
168
+ resizeObserver.observe(listRef.value);
169
+ }
170
+ });
171
+ onBeforeUnmount(() => {
172
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
173
+ });
174
+ __expose({
175
+ scrollToBottom,
176
+ scrollToMessage
177
+ });
178
+ return (_ctx, _cache) => {
179
+ return openBlock(), createElementBlock("div", {
180
+ ref_key: "containerRef",
181
+ ref: containerRef,
182
+ class: "vc-messages-wrapper",
183
+ onScroll
184
+ }, [
185
+ createElementVNode("div", {
186
+ ref_key: "listRef",
187
+ ref: listRef,
188
+ class: "vc-messages-wrapper__list"
189
+ }, [
190
+ !__props.messages.length ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : createCommentVNode("", true),
191
+ (openBlock(true), createElementBlock(Fragment, null, renderList(renderItems.value, (item) => {
192
+ var _a, _b;
193
+ return openBlock(), createElementBlock(Fragment, {
194
+ key: item.key
195
+ }, [
196
+ item.kind === "date" ? (openBlock(), createElementBlock("div", _hoisted_1, [
197
+ renderSlot(_ctx.$slots, "date-divider", {
198
+ date: item.date,
199
+ label: item.label
200
+ }, () => [
201
+ createElementVNode("span", _hoisted_2, toDisplayString(item.label), 1)
202
+ ])
203
+ ])) : (openBlock(), createElementBlock("div", {
204
+ key: 1,
205
+ "data-message-id": item.message.id,
206
+ class: normalizeClass([{
207
+ "is--own": item.message.isOwn,
208
+ "is--group-start": item.isGroupStart
209
+ }, "vc-messages-wrapper__row"])
210
+ }, [
211
+ item.showTime ? (openBlock(), createElementBlock("div", _hoisted_4, [
212
+ item.isGroupStart ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
213
+ createElementVNode("span", _hoisted_5, toDisplayString(item.message.sender.name), 1),
214
+ _cache[0] || (_cache[0] = createElementVNode("span", { class: "vc-messages-wrapper__dot" }, "·", -1))
215
+ ], 64)) : createCommentVNode("", true),
216
+ createElementVNode("span", _hoisted_6, toDisplayString(item.time), 1)
217
+ ])) : createCommentVNode("", true),
218
+ createVNode(_sfc_main$1, {
219
+ content: item.message.content,
220
+ align: item.message.isOwn ? "end" : "start",
221
+ reply: item.message.replyTo,
222
+ reactions: item.message.reactions,
223
+ "reaction-emojis": __props.reactionEmojis,
224
+ edited: item.message.isEdited,
225
+ deleted: item.message.isDeleted,
226
+ options: ((_a = __props.options) == null ? void 0 : _a.call(__props, item.message)) ?? [],
227
+ "additional-options": ((_b = __props.additionalOptions) == null ? void 0 : _b.call(__props, item.message)) ?? [],
228
+ onOptionClick: (event, option) => emit("option-click", event, item.message, option),
229
+ onReplyClick: ($event) => onReplyClick(item.message),
230
+ onContentClick: ($event) => emit("content-click", item.message),
231
+ onReactionToggle: ($event) => emit("reaction-toggle", $event, item.message)
232
+ }, null, 8, ["content", "align", "reply", "reactions", "reaction-emojis", "edited", "deleted", "options", "additional-options", "onOptionClick", "onReplyClick", "onContentClick", "onReactionToggle"])
233
+ ], 10, _hoisted_3))
234
+ ], 64);
235
+ }), 128))
236
+ ], 512)
237
+ ], 544);
238
+ };
239
+ }
240
+ });
241
+ export {
242
+ _sfc_main as default
243
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./VcMessagesWrapper.vue.mjs";
2
+ import '../../assets/components/VcMessagesWrapper/VcMessagesWrapper.css';/* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./Card.vue2.mjs";
2
2
  import '../../../assets/components/VcSkeletonLoader/Loaders/Card.css';/* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const Card = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-93d2f041"]]);
4
+ const Card = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d2573680"]]);
5
5
  export {
6
6
  Card as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./Circle.vue2.mjs";
2
2
  import '../../../assets/components/VcSkeletonLoader/Loaders/Circle.css';/* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const Circle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cd879b6a"]]);
4
+ const Circle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-294d40dc"]]);
5
5
  export {
6
6
  Circle as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./Row.vue2.mjs";
2
2
  import '../../../assets/components/VcSkeletonLoader/Loaders/Row.css';/* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const Row = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cfdd382d"]]);
4
+ const Row = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0d5ada11"]]);
5
5
  export {
6
6
  Row as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./Square.vue2.mjs";
2
2
  import '../../../assets/components/VcSkeletonLoader/Loaders/Square.css';/* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const Square = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fbf8d22a"]]);
4
+ const Square = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d474acd9"]]);
5
5
  export {
6
6
  Square as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./Text.vue2.mjs";
2
2
  import '../../../assets/components/VcSkeletonLoader/Loaders/Text.css';/* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const Text = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7cb2b774"]]);
4
+ const Text = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1f605cc5"]]);
5
5
  export {
6
6
  Text as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { inject, provide } from "vue";
1
+ import { provide, inject } from "vue";
2
2
  import { VcSoundPlayerProvideKey } from "../../tokens/tokens.mjs";
3
3
  function useSoundPlayerProvide(param) {
4
4
  provide(VcSoundPlayerProvideKey, param);
@@ -0,0 +1,120 @@
1
+ import { ref, shallowRef, computed, onBeforeUnmount } from "vue";
2
+ const PREFERRED_MIME_TYPES = ["audio/webm;codecs=opus", "audio/webm", "audio/mp4"];
3
+ function getSupportedMimeType() {
4
+ return PREFERRED_MIME_TYPES.find((type) => MediaRecorder.isTypeSupported(type));
5
+ }
6
+ function useAudioRecorder() {
7
+ const state = ref("idle");
8
+ const blob = shallowRef();
9
+ const url = ref();
10
+ const duration = ref(0);
11
+ const error = shallowRef();
12
+ let recorder;
13
+ let stream;
14
+ let chunks = [];
15
+ let timer;
16
+ let startedAt = 0;
17
+ let isCancelled = false;
18
+ const isSupported = computed(() => {
19
+ var _a;
20
+ return typeof window !== "undefined" && typeof MediaRecorder !== "undefined" && !!((_a = navigator.mediaDevices) == null ? void 0 : _a.getUserMedia);
21
+ });
22
+ function releaseMicrophone() {
23
+ stream == null ? void 0 : stream.getTracks().forEach((track) => track.stop());
24
+ stream = void 0;
25
+ if (timer) {
26
+ clearInterval(timer);
27
+ timer = void 0;
28
+ }
29
+ }
30
+ function revokeUrl() {
31
+ if (url.value) {
32
+ URL.revokeObjectURL(url.value);
33
+ url.value = void 0;
34
+ }
35
+ }
36
+ async function start() {
37
+ if (state.value === "recording" || !isSupported.value) {
38
+ return;
39
+ }
40
+ reset();
41
+ try {
42
+ stream = await navigator.mediaDevices.getUserMedia({ audio: true });
43
+ } catch (cause) {
44
+ error.value = cause instanceof Error ? cause : new Error(String(cause));
45
+ return;
46
+ }
47
+ chunks = [];
48
+ isCancelled = false;
49
+ recorder = new MediaRecorder(stream, { mimeType: getSupportedMimeType() });
50
+ recorder.addEventListener("dataavailable", (event) => {
51
+ if (event.data.size) {
52
+ chunks.push(event.data);
53
+ }
54
+ });
55
+ recorder.addEventListener("stop", () => {
56
+ releaseMicrophone();
57
+ if (isCancelled || !chunks.length) {
58
+ state.value = "idle";
59
+ return;
60
+ }
61
+ blob.value = new Blob(chunks, { type: (recorder == null ? void 0 : recorder.mimeType) || chunks[0].type });
62
+ url.value = URL.createObjectURL(blob.value);
63
+ state.value = "recorded";
64
+ });
65
+ recorder.start();
66
+ startedAt = Date.now();
67
+ duration.value = 0;
68
+ timer = setInterval(() => {
69
+ duration.value = Math.floor((Date.now() - startedAt) / 1e3);
70
+ }, 250);
71
+ state.value = "recording";
72
+ }
73
+ function stop() {
74
+ if ((recorder == null ? void 0 : recorder.state) === "recording") {
75
+ recorder.stop();
76
+ }
77
+ }
78
+ function cancel() {
79
+ isCancelled = true;
80
+ if ((recorder == null ? void 0 : recorder.state) === "recording") {
81
+ recorder.stop();
82
+ } else {
83
+ releaseMicrophone();
84
+ state.value = "idle";
85
+ }
86
+ }
87
+ function reset() {
88
+ if ((recorder == null ? void 0 : recorder.state) === "recording") {
89
+ cancel();
90
+ }
91
+ revokeUrl();
92
+ blob.value = void 0;
93
+ error.value = void 0;
94
+ duration.value = 0;
95
+ state.value = "idle";
96
+ }
97
+ onBeforeUnmount(() => {
98
+ isCancelled = true;
99
+ if ((recorder == null ? void 0 : recorder.state) === "recording") {
100
+ recorder.stop();
101
+ }
102
+ releaseMicrophone();
103
+ revokeUrl();
104
+ });
105
+ return {
106
+ state,
107
+ blob,
108
+ url,
109
+ duration,
110
+ error,
111
+ isSupported,
112
+ start,
113
+ stop,
114
+ cancel,
115
+ reset
116
+ };
117
+ }
118
+ export {
119
+ useAudioRecorder as default
120
+ };
@@ -0,0 +1,51 @@
1
+ import { FileArchive, FileSpreadsheet, FileText } from "@lucide/vue";
2
+ const DEFAULT_FILE_TYPE = {
3
+ icon: FileText,
4
+ color: "var(--secondary-actions)"
5
+ };
6
+ const DEFAULT_FILE_TYPE_MAP = {
7
+ pdf: {
8
+ icon: FileText,
9
+ color: "#D34C4C"
10
+ },
11
+ doc: {
12
+ icon: FileText,
13
+ color: "var(--secondary-text)"
14
+ },
15
+ docx: {
16
+ icon: FileText,
17
+ color: "var(--secondary-text)"
18
+ },
19
+ txt: {
20
+ icon: FileText,
21
+ color: "var(--secondary-text)"
22
+ },
23
+ xls: {
24
+ icon: FileSpreadsheet,
25
+ color: "var(--success-actions)"
26
+ },
27
+ xlsx: {
28
+ icon: FileSpreadsheet,
29
+ color: "var(--success-actions)"
30
+ },
31
+ csv: {
32
+ icon: FileSpreadsheet,
33
+ color: "var(--success-actions)"
34
+ },
35
+ zip: {
36
+ icon: FileArchive,
37
+ color: "var(--warning-actions)"
38
+ },
39
+ rar: {
40
+ icon: FileArchive,
41
+ color: "var(--warning-actions)"
42
+ },
43
+ "7z": {
44
+ icon: FileArchive,
45
+ color: "var(--warning-actions)"
46
+ }
47
+ };
48
+ export {
49
+ DEFAULT_FILE_TYPE,
50
+ DEFAULT_FILE_TYPE_MAP
51
+ };