vlite3 1.1.4 → 1.1.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 (85) hide show
  1. package/README.md +5 -0
  2. package/components/CategoryManager/CategoryManager.vue.js +1 -1
  3. package/components/Chart/BarChart.vue.d.ts +48 -0
  4. package/components/Chart/CircleChart.vue.d.ts +47 -0
  5. package/components/Chart/LineChart.vue.d.ts +55 -0
  6. package/components/Chart/PieChart.vue.d.ts +49 -0
  7. package/components/Chart/index.d.ts +5 -0
  8. package/components/Chart/types.d.ts +135 -0
  9. package/components/Chart/utils.d.ts +40 -0
  10. package/components/ColorPicker/ColorIro.vue3.js +2 -2
  11. package/components/ColorPicker/ColorPicker.vue.js +2 -2
  12. package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
  13. package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
  14. package/components/Comment/CommentEditor.vue.d.ts +41 -0
  15. package/components/Comment/CommentEditor.vue.js +221 -0
  16. package/components/Comment/CommentEditor.vue2.js +4 -0
  17. package/components/Comment/CommentItem.vue.d.ts +70 -0
  18. package/components/Comment/CommentItem.vue.js +7 -0
  19. package/components/Comment/CommentItem.vue2.js +322 -0
  20. package/components/Comment/CommentThread.vue.d.ts +64 -0
  21. package/components/Comment/CommentThread.vue.js +185 -0
  22. package/components/Comment/CommentThread.vue2.js +4 -0
  23. package/components/Comment/index.d.ts +4 -0
  24. package/components/Comment/types.d.ts +34 -0
  25. package/components/DataTable/DataTable.vue.d.ts +2 -4
  26. package/components/DataTable/DataTable.vue.js +175 -226
  27. package/components/DataTable/DataTableHeader.vue.d.ts +2 -0
  28. package/components/DataTable/DataTableHeader.vue.js +24 -23
  29. package/components/DataTable/DataTableRow.vue.d.ts +2 -0
  30. package/components/DataTable/DataTableRow.vue.js +32 -31
  31. package/components/DataTable/types.d.ts +2 -9
  32. package/components/Dropdown/Dropdown.vue.d.ts +2 -0
  33. package/components/Dropdown/Dropdown.vue.js +60 -58
  34. package/components/Dropdown/DropdownTrigger.vue.d.ts +2 -0
  35. package/components/Dropdown/DropdownTrigger.vue.js +7 -6
  36. package/components/Empty/Empty.vue.js +7 -5
  37. package/components/Empty/index.d.ts +1 -1
  38. package/components/Empty/variants/Variant12.vue.d.ts +22 -0
  39. package/components/Empty/variants/Variant12.vue.js +35 -0
  40. package/components/Empty/variants/Variant12.vue2.js +4 -0
  41. package/components/Footer/Footer.vue.d.ts +3 -0
  42. package/components/Footer/Variant1.vue.d.ts +20 -0
  43. package/components/Footer/Variant2.vue.d.ts +20 -0
  44. package/components/Footer/Variant3.vue.d.ts +12 -0
  45. package/components/Footer/index.d.ts +2 -0
  46. package/components/Footer/types.d.ts +73 -0
  47. package/components/Form/CustomFields.vue.d.ts +2 -0
  48. package/components/Form/CustomFields.vue.js +2 -2
  49. package/components/Form/CustomFields.vue2.js +134 -131
  50. package/components/Form/FormField.vue.js +1 -1
  51. package/components/MultiSelect/MultiSelect.vue.d.ts +2 -0
  52. package/components/MultiSelect/MultiSelect.vue.js +95 -94
  53. package/components/NavbarCommandPalette.vue.js +1 -1
  54. package/components/NumberInput.vue.js +1 -1
  55. package/components/NumberInput.vue2.js +39 -38
  56. package/components/RichTextEditor/RichTextLinkPopover.vue.d.ts +26 -0
  57. package/components/RichTextEditor/RichTextReader.vue.d.ts +7 -0
  58. package/components/RichTextEditor/RichTextToolbar.vue.d.ts +24 -0
  59. package/components/RichTextEditor/composables/useRichTextImageUpload.d.ts +14 -0
  60. package/components/RichTextEditor/composables/useRichTextLinks.d.ts +32 -0
  61. package/components/RichTextEditor/index.d.ts +2 -0
  62. package/components/Screen/Screen.vue.js +45 -46
  63. package/components/Screen/ScreenFilter.vue.js +1 -1
  64. package/components/Screen/components/ScreenEmptyState.vue.js +1 -1
  65. package/components/SidebarMenu/SidebarMenu.vue.d.ts +1 -1
  66. package/components/SidebarMenu/SidebarMenu.vue.js +192 -91
  67. package/components/SidebarMenu/SidebarMenu.vue3.js +5 -0
  68. package/components/SidebarMenu/SidebarMenuItem.vue.js +170 -157
  69. package/components/SidebarMenu/types.d.ts +12 -3
  70. package/components/{DataTable/DataTableToolbar.vue.d.ts → Splitter/Splitter.vue.d.ts} +18 -15
  71. package/components/Splitter/Splitter.vue.js +64 -0
  72. package/components/Splitter/Splitter.vue2.js +4 -0
  73. package/components/Splitter/index.d.ts +1 -0
  74. package/components/StatusChip/status-map.js +34 -2
  75. package/components/index.d.ts +4 -0
  76. package/core/config.d.ts +18 -0
  77. package/index.d.ts +2 -0
  78. package/index.js +316 -307
  79. package/package.json +1 -1
  80. package/style.css +42 -6
  81. package/types/config.type.d.ts +2 -0
  82. package/components/DataTable/DataTableToolbar.vue.js +0 -60
  83. package/components/DataTable/DataTableToolbar.vue2.js +0 -4
  84. package/components/SidebarMenu/SidebarMenu.vue2.js +0 -4
  85. /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
@@ -0,0 +1,221 @@
1
+ import { defineComponent as K, computed as h, ref as T, onMounted as M, nextTick as H, openBlock as d, createElementBlock as m, normalizeClass as L, createBlock as F, createCommentVNode as p, createElementVNode as r, createVNode as c, toDisplayString as y, Fragment as P, renderList as j, unref as f, withCtx as A, withDirectives as q, vModelText as G, createTextVNode as J } from "vue";
2
+ import { $t as k } from "../../utils/i18n.js";
3
+ import C from "../Button.vue.js";
4
+ import w from "../Icon.vue.js";
5
+ import O from "../Avatar.vue.js";
6
+ import Q from "../FilePicker/FilePicker.vue.js";
7
+ import { useFileUpload as W } from "../Form/composables/useFileUpload.js";
8
+ const X = { class: "flex-1 min-w-0 flex flex-col gap-2" }, Y = {
9
+ key: 0,
10
+ class: "flex items-center justify-between px-3 py-1.5 bg-muted/40 rounded-lg text-xs text-muted-foreground border border-border animate-in fade-in slide-in-from-bottom-2"
11
+ }, Z = { class: "flex items-center gap-2" }, ee = { class: "flex items-center gap-2 shrink-0" }, te = { class: "text-[10px] hidden sm:inline-block opacity-60 mr-1" }, le = { class: "relative flex flex-col bg-background border border-border rounded-xl shadow-sm focus-within:border-primary transition-colors overflow-hidden" }, ae = {
12
+ key: 0,
13
+ class: "flex flex-wrap gap-2 p-3 bg-muted/10 border-b border-border"
14
+ }, ie = ["title"], ne = ["onClick", "disabled"], re = { class: "flex items-end gap-0 p-1" }, oe = {
15
+ key: 0,
16
+ class: "shrink-0 mb-0.5 ml-1"
17
+ }, se = ["placeholder", "disabled"], de = { class: "shrink-0 mb-0.5 mr-1 flex gap-1 items-center" }, pe = /* @__PURE__ */ K({
18
+ __name: "CommentEditor",
19
+ props: {
20
+ initialText: { default: "" },
21
+ variant: { default: "root" },
22
+ placeholder: {},
23
+ editingText: {},
24
+ cancelEditText: {},
25
+ cancelText: {},
26
+ currentUser: { default: null },
27
+ allowFileUpload: { type: Boolean, default: !0 },
28
+ folderId: {},
29
+ maxFileSize: {},
30
+ autofocus: { type: Boolean }
31
+ },
32
+ emits: ["submit", "cancel"],
33
+ setup(t, { emit: S }) {
34
+ const i = t, b = S, $ = h(() => {
35
+ if (i.placeholder) return i.placeholder;
36
+ const e = k("vlite.comment.placeholder");
37
+ return e !== "vlite.comment.placeholder" ? e : "Leave a comment...";
38
+ }), N = h(() => {
39
+ if (i.editingText) return i.editingText;
40
+ const e = k("vlite.comment.editing");
41
+ return e !== "vlite.comment.editing" ? e : "Editing Comment";
42
+ }), V = h(() => {
43
+ if (i.cancelEditText) return i.cancelEditText;
44
+ const e = k("vlite.comment.cancelEdit");
45
+ return e !== "vlite.comment.cancelEdit" ? e : "Press Esc to cancel";
46
+ }), _ = h(() => {
47
+ if (i.cancelText) return i.cancelText;
48
+ const e = k("vlite.comment.cancel");
49
+ return e !== "vlite.comment.cancel" ? e : "Cancel";
50
+ }), v = T(i.initialText), o = T(null), l = T([]), { handleUploadFiles: B, loading: s } = W(), U = () => {
51
+ if (!o.value) return;
52
+ o.value.style.height = "auto";
53
+ const e = o.value.scrollHeight;
54
+ o.value.style.height = `${Math.min(e, 120)}px`;
55
+ };
56
+ M(() => {
57
+ i.autofocus && o.value && o.value.focus(), H(() => {
58
+ U();
59
+ });
60
+ });
61
+ const R = (e) => {
62
+ e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), s.value || z()) : e.key === "Escape" && i.variant !== "root" && (e.preventDefault(), b("cancel"));
63
+ }, E = h(() => {
64
+ const e = !!v.value.trim(), n = Array.isArray(l.value) && l.value.length > 0;
65
+ return (e || n) && !s.value;
66
+ }), D = (e) => {
67
+ s.value || Array.isArray(l.value) && l.value.splice(e, 1);
68
+ }, z = async () => {
69
+ if (!E.value) return;
70
+ const e = v.value.trim(), n = Array.isArray(l.value) && l.value.length > 0;
71
+ let a = [];
72
+ if (n) {
73
+ const x = l.value.map((g) => g.file).filter(Boolean);
74
+ if (x.length > 0) {
75
+ const g = await B(x, i.folderId);
76
+ a = l.value.map((u, I) => ({
77
+ fileUrl: g[I] || "",
78
+ fileName: u.fileName,
79
+ fileType: u.fileType,
80
+ fileSize: u.fileSize
81
+ })).filter((u) => u.fileUrl !== null && u.fileUrl !== "");
82
+ }
83
+ }
84
+ b("submit", e, a.length > 0 ? a : void 0), l.value = [], i.variant !== "edit" && (v.value = "", o.value && (o.value.style.height = "auto", o.value.focus()));
85
+ };
86
+ return (e, n) => (d(), m("div", {
87
+ class: L(["vl-comment-editor flex gap-3 w-full", [
88
+ t.variant === "root" ? "bg-muted/10 p-3 sm:p-4 rounded-xl border border-border/60 items-start" : "",
89
+ t.variant === "reply" ? "items-start pl-2" : "",
90
+ t.variant === "edit" ? "items-center mt-1" : ""
91
+ ]])
92
+ }, [
93
+ t.variant !== "edit" && t.currentUser ? (d(), F(O, {
94
+ key: 0,
95
+ src: t.currentUser.avatar,
96
+ fallback: t.currentUser.name?.charAt(0) || "U",
97
+ size: t.variant === "root" ? "md" : "sm",
98
+ class: "shrink-0 mt-0.5"
99
+ }, null, 8, ["src", "fallback", "size"])) : p("", !0),
100
+ r("div", X, [
101
+ t.variant === "edit" ? (d(), m("div", Y, [
102
+ r("div", Z, [
103
+ c(w, {
104
+ icon: "lucide:pencil",
105
+ class: "w-3.5 h-3.5 text-primary shrink-0"
106
+ }),
107
+ r("span", null, y(N.value), 1)
108
+ ]),
109
+ r("div", ee, [
110
+ r("span", te, y(V.value), 1),
111
+ r("button", {
112
+ onClick: n[0] || (n[0] = (a) => b("cancel")),
113
+ class: "hover:text-foreground p-0.5 rounded-full hover:bg-background transition-colors",
114
+ "aria-label": "Cancel editing"
115
+ }, [
116
+ c(w, {
117
+ icon: "lucide:x",
118
+ class: "w-3.5 h-3.5"
119
+ })
120
+ ])
121
+ ])
122
+ ])) : p("", !0),
123
+ r("div", le, [
124
+ Array.isArray(l.value) && l.value.length > 0 ? (d(), m("div", ae, [
125
+ (d(!0), m(P, null, j(l.value, (a, x) => (d(), m("div", {
126
+ key: x,
127
+ class: "relative flex items-center gap-2 bg-background border border-border rounded-md p-1.5 pr-8 max-w-[200px] shadow-sm"
128
+ }, [
129
+ c(w, {
130
+ icon: "lucide:file-text",
131
+ class: "w-4 h-4 text-primary shrink-0"
132
+ }),
133
+ r("span", {
134
+ class: "text-xs truncate font-medium",
135
+ title: a.fileName
136
+ }, y(a.fileName), 9, ie),
137
+ r("button", {
138
+ onClick: (g) => D(x),
139
+ disabled: f(s),
140
+ class: "absolute right-1 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-destructive rounded-full hover:bg-muted/50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
141
+ }, [
142
+ c(w, {
143
+ icon: "lucide:x",
144
+ class: "w-3 h-3"
145
+ })
146
+ ], 8, ne)
147
+ ]))), 128))
148
+ ])) : p("", !0),
149
+ r("div", re, [
150
+ t.allowFileUpload ? (d(), m("div", oe, [
151
+ c(Q, {
152
+ modelValue: l.value,
153
+ "onUpdate:modelValue": n[1] || (n[1] = (a) => l.value = a),
154
+ "multi-select": !0,
155
+ "max-size": t.maxFileSize,
156
+ "return-format": "file"
157
+ }, {
158
+ trigger: A(({ trigger: a }) => [
159
+ c(C, {
160
+ variant: "ghost",
161
+ size: "sm",
162
+ icon: "lucide:paperclip",
163
+ rounded: "full",
164
+ class: "px-0 text-muted-foreground hover:text-foreground transition-colors",
165
+ onClick: a,
166
+ disabled: f(s),
167
+ "aria-label": "Attach files"
168
+ }, null, 8, ["onClick", "disabled"])
169
+ ]),
170
+ _: 1
171
+ }, 8, ["modelValue", "max-size"])
172
+ ])) : p("", !0),
173
+ q(r("textarea", {
174
+ ref_key: "textareaRef",
175
+ ref: o,
176
+ "onUpdate:modelValue": n[2] || (n[2] = (a) => v.value = a),
177
+ placeholder: $.value,
178
+ disabled: f(s),
179
+ class: "flex-1 max-h-[120px] min-h-[20px] w-full resize-none bg-transparent px-2 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground scrollbar-thin disabled:opacity-50",
180
+ rows: "1",
181
+ "aria-label": "Comment input",
182
+ onInput: U,
183
+ onKeydown: R
184
+ }, null, 40, se), [
185
+ [G, v.value]
186
+ ]),
187
+ r("div", de, [
188
+ t.variant !== "root" ? (d(), F(C, {
189
+ key: 0,
190
+ variant: "ghost",
191
+ size: "sm",
192
+ class: "h-8 text-muted-foreground hover:text-foreground",
193
+ onClick: n[3] || (n[3] = (a) => b("cancel")),
194
+ disabled: f(s)
195
+ }, {
196
+ default: A(() => [
197
+ J(y(_.value), 1)
198
+ ]),
199
+ _: 1
200
+ }, 8, ["disabled"])) : p("", !0),
201
+ c(C, {
202
+ variant: "primary",
203
+ size: "sm",
204
+ icon: f(s) ? "lucide:loader-2" : t.variant === "edit" ? "lucide:check" : "lucide:send",
205
+ loading: f(s),
206
+ rounded: "full",
207
+ class: "h-8 w-8 px-0 transition-transform active:scale-95",
208
+ disabled: !E.value,
209
+ onClick: z,
210
+ "aria-label": t.variant === "edit" ? "Save changes" : "Send comment"
211
+ }, null, 8, ["icon", "loading", "disabled", "aria-label"])
212
+ ])
213
+ ])
214
+ ])
215
+ ])
216
+ ], 2));
217
+ }
218
+ });
219
+ export {
220
+ pe as default
221
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./CommentEditor.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,70 @@
1
+ import { CommentNode, CommentActionPayload, CommentAuthor } from './types';
2
+ export interface CommentItemProps {
3
+ comment: CommentNode;
4
+ /** The ID of the currently logged-in user. Used to decide edit/delete visibility. */
5
+ currentUser?: CommentAuthor | null;
6
+ /** Allow threaded visual line between nested replies */
7
+ threaded?: boolean;
8
+ /** Globally allow delete. Only shows for author unless allowDeleteAll=true */
9
+ allowDelete?: boolean;
10
+ /** Globally allow edit. Only shows for author unless allowEditAll=true */
11
+ allowEdit?: boolean;
12
+ /** Globally allow reply (visible to all users) */
13
+ allowReply?: boolean;
14
+ /** Admin override: show delete button on ALL comments regardless of author */
15
+ allowDeleteAll?: boolean;
16
+ /** Admin override: show edit button on ALL comments regardless of author */
17
+ allowEditAll?: boolean;
18
+ /** Requires two clicks to delete (confirmation safety) */
19
+ confirmDelete?: boolean;
20
+ /** Controlled by parent CommentThread to reveal the reply slot */
21
+ activeReplyId?: string | number | null;
22
+ /** Controlled by parent CommentThread to reveal the edit slot */
23
+ activeEditId?: string | number | null;
24
+ /** Folder ID for uploads */
25
+ folderId?: string;
26
+ /** Max file size */
27
+ maxFileSize?: number;
28
+ /** Allow file uploads */
29
+ allowFileUpload?: boolean;
30
+ replyPlaceholder?: string;
31
+ editPlaceholder?: string;
32
+ replyText?: string;
33
+ editedText?: string;
34
+ editingText?: string;
35
+ cancelText?: string;
36
+ cancelEditText?: string;
37
+ loadMoreRepliesText?: string;
38
+ }
39
+ declare const _default: import('vue').DefineComponent<CommentItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
40
+ delete: (id: string | number) => any;
41
+ edit: (payload: CommentActionPayload) => any;
42
+ reply: (payload: CommentActionPayload) => any;
43
+ "submit-reply": (text: string, attachments: any[], parentId: string | number) => any;
44
+ "submit-edit": (text: string, attachments: any[], comment: CommentNode) => any;
45
+ "cancel-reply": () => any;
46
+ "cancel-edit": () => any;
47
+ "load-more-replies": (commentId: string | number) => any;
48
+ }, string, import('vue').PublicProps, Readonly<CommentItemProps> & Readonly<{
49
+ onDelete?: (id: string | number) => any;
50
+ onEdit?: (payload: CommentActionPayload) => any;
51
+ onReply?: (payload: CommentActionPayload) => any;
52
+ "onSubmit-reply"?: (text: string, attachments: any[], parentId: string | number) => any;
53
+ "onSubmit-edit"?: (text: string, attachments: any[], comment: CommentNode) => any;
54
+ "onCancel-reply"?: () => any;
55
+ "onCancel-edit"?: () => any;
56
+ "onLoad-more-replies"?: (commentId: string | number) => any;
57
+ }>, {
58
+ confirmDelete: boolean;
59
+ allowDeleteAll: boolean;
60
+ allowEditAll: boolean;
61
+ allowFileUpload: boolean;
62
+ currentUser: CommentAuthor | null;
63
+ threaded: boolean;
64
+ allowDelete: boolean;
65
+ allowEdit: boolean;
66
+ allowReply: boolean;
67
+ activeReplyId: string | number | null;
68
+ activeEditId: string | number | null;
69
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
70
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import o from "./CommentItem.vue2.js";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-446c60ad"]]);
5
+ export {
6
+ e as default
7
+ };
@@ -0,0 +1,322 @@
1
+ import { defineComponent as F, computed as u, ref as P, resolveComponent as V, openBlock as i, createElementBlock as r, createElementVNode as a, createVNode as v, createCommentVNode as d, toDisplayString as f, createBlock as y, withCtx as g, createTextVNode as b, normalizeClass as L, withModifiers as N, withDirectives as j, vShow as G, unref as H, TransitionGroup as q, Fragment as J, renderList as K } from "vue";
2
+ import { $t as k } from "../../utils/i18n.js";
3
+ import O from "../Avatar.vue.js";
4
+ import T from "../Button.vue.js";
5
+ import Q from "../Badge.vue.js";
6
+ import W from "../AttachmentsList/AttachmentsList.vue.js";
7
+ import E from "./CommentEditor.vue.js";
8
+ const X = { class: "vl-comment flex w-full relative" }, Y = { class: "flex flex-col items-center mr-4 shrink-0" }, Z = {
9
+ key: 0,
10
+ class: "w-px h-full bg-border/60 my-1 rounded-full"
11
+ }, _ = { class: "flex flex-col flex-1 min-w-0 mb-4" }, ee = { class: "vl-comment-header flex items-center gap-2 mb-1" }, te = { class: "text-sm font-semibold text-foreground tracking-tight" }, le = {
12
+ key: 1,
13
+ class: "text-xs text-muted-foreground ml-1"
14
+ }, ie = {
15
+ key: 2,
16
+ class: "text-xs text-muted-foreground/60 italic"
17
+ }, oe = { class: "vl-comment-actions flex items-center gap-0.5 ml-auto pl-4" }, ne = {
18
+ key: 2,
19
+ class: "relative flex items-center"
20
+ }, re = {
21
+ key: 0,
22
+ class: "mt-2 pb-2 mr-4"
23
+ }, ae = {
24
+ key: 1,
25
+ class: "mt-3.5"
26
+ }, de = {
27
+ key: 2,
28
+ class: "mt-4 pb-2"
29
+ }, me = {
30
+ key: 3,
31
+ class: "mt-5 flex flex-col w-full relative"
32
+ }, ce = {
33
+ key: 0,
34
+ class: "mt-3 mb-2 w-full flex items-center"
35
+ }, se = ["disabled"], ue = { key: 0 }, fe = {
36
+ key: 1,
37
+ class: "flex items-center gap-2"
38
+ }, ke = /* @__PURE__ */ F({
39
+ __name: "CommentItem",
40
+ props: {
41
+ comment: {},
42
+ currentUser: { default: null },
43
+ threaded: { type: Boolean, default: !0 },
44
+ allowDelete: { type: Boolean, default: !0 },
45
+ allowEdit: { type: Boolean, default: !0 },
46
+ allowReply: { type: Boolean, default: !0 },
47
+ allowDeleteAll: { type: Boolean, default: !1 },
48
+ allowEditAll: { type: Boolean, default: !1 },
49
+ confirmDelete: { type: Boolean, default: !0 },
50
+ activeReplyId: { default: null },
51
+ activeEditId: { default: null },
52
+ folderId: {},
53
+ maxFileSize: {},
54
+ allowFileUpload: { type: Boolean, default: !0 },
55
+ replyPlaceholder: {},
56
+ editPlaceholder: {},
57
+ replyText: {},
58
+ editedText: {},
59
+ editingText: {},
60
+ cancelText: {},
61
+ cancelEditText: {},
62
+ loadMoreRepliesText: {}
63
+ },
64
+ emits: ["reply", "edit", "delete", "submit-reply", "submit-edit", "cancel-reply", "cancel-edit", "load-more-replies"],
65
+ setup(e, { emit: p }) {
66
+ const l = e, o = p, C = u(() => l.currentUser === null || l.currentUser === void 0 || l.currentUser.id === void 0 ? !0 : String(l.currentUser.id) === String(l.comment.author.id)), z = u(() => l.allowEdit && (C.value || l.allowEditAll)), D = u(() => l.allowDelete && (C.value || l.allowDeleteAll)), I = u(() => l.allowReply), R = u(() => {
67
+ if (!l.comment.timestamp) return "";
68
+ const m = new Date(l.comment.timestamp);
69
+ return new Intl.DateTimeFormat(void 0, {
70
+ month: "short",
71
+ day: "numeric",
72
+ hour: "numeric",
73
+ minute: "numeric"
74
+ }).format(m);
75
+ }), $ = u(() => {
76
+ if (l.editedText) return l.editedText;
77
+ const m = k("vlite.comment.edited");
78
+ return m !== "vlite.comment.edited" ? m : "edited";
79
+ }), B = u(() => {
80
+ if (l.replyText) return l.replyText;
81
+ const m = k("vlite.comment.replyAction");
82
+ return m !== "vlite.comment.replyAction" ? m : "Reply";
83
+ }), M = u(() => {
84
+ if (l.loadMoreRepliesText) return l.loadMoreRepliesText;
85
+ if (l.comment.replyCount && l.comment.replyCount > 0)
86
+ return `View ${l.comment.replyCount} more replies`;
87
+ const m = k("vlite.comment.loadMoreReplies");
88
+ return m !== "vlite.comment.loadMoreReplies" ? m : "View more replies";
89
+ }), s = P(!1);
90
+ let x = null;
91
+ const S = () => {
92
+ if (!l.confirmDelete) {
93
+ o("delete", l.comment.id);
94
+ return;
95
+ }
96
+ s.value ? (s.value = !1, x && clearTimeout(x), o("delete", l.comment.id)) : (s.value = !0, x = setTimeout(() => {
97
+ s.value = !1;
98
+ }, 4e3));
99
+ }, U = () => {
100
+ s.value = !1, x && (clearTimeout(x), x = null);
101
+ };
102
+ return (m, t) => {
103
+ const A = V("CommentItem", !0);
104
+ return i(), r("div", X, [
105
+ a("div", Y, [
106
+ v(O, {
107
+ src: e.comment.author.avatar,
108
+ alt: e.comment.author.name,
109
+ fallback: e.comment.author.name?.charAt(0),
110
+ size: "md",
111
+ class: "border-2 border-background/50 shadow-sm"
112
+ }, null, 8, ["src", "alt", "fallback"]),
113
+ e.threaded && e.comment.replies?.length ? (i(), r("div", Z)) : d("", !0)
114
+ ]),
115
+ a("div", _, [
116
+ a("div", ee, [
117
+ a("span", te, f(e.comment.author.name), 1),
118
+ e.comment.author.role ? (i(), y(Q, {
119
+ key: 0,
120
+ variant: "secondary",
121
+ size: "sm"
122
+ }, {
123
+ default: g(() => [
124
+ b(f(e.comment.author.role), 1)
125
+ ]),
126
+ _: 1
127
+ })) : d("", !0),
128
+ R.value ? (i(), r("span", le, f(R.value), 1)) : d("", !0),
129
+ e.comment.isEdited ? (i(), r("span", ie, " (" + f($.value) + ") ", 1)) : d("", !0),
130
+ a("div", oe, [
131
+ I.value ? (i(), y(T, {
132
+ key: 0,
133
+ variant: "ghost",
134
+ size: "xs",
135
+ icon: "lucide:reply",
136
+ class: "text-muted-foreground hover:text-foreground h-7 px-2",
137
+ onClick: t[0] || (t[0] = (c) => o("reply", { commentId: e.comment.id, comment: e.comment }))
138
+ }, {
139
+ default: g(() => [
140
+ b(f(B.value), 1)
141
+ ]),
142
+ _: 1
143
+ })) : d("", !0),
144
+ z.value ? (i(), y(T, {
145
+ key: 1,
146
+ variant: "ghost",
147
+ size: "xs",
148
+ icon: "lucide:pencil",
149
+ class: "text-muted-foreground hover:text-foreground h-7 w-7 px-0",
150
+ onClick: t[1] || (t[1] = (c) => o("edit", { commentId: e.comment.id, comment: e.comment }))
151
+ })) : d("", !0),
152
+ D.value ? (i(), r("div", ne, [
153
+ v(T, {
154
+ variant: "ghost",
155
+ size: "xs",
156
+ icon: s.value ? "lucide:check" : "lucide:trash-2",
157
+ class: L([
158
+ "h-7 w-7 px-0 transition-colors",
159
+ s.value ? "text-destructive bg-destructive/10 hover:bg-destructive/20 hover:text-destructive" : "text-muted-foreground hover:text-foreground hover:bg-muted"
160
+ ]),
161
+ onClick: S
162
+ }, null, 8, ["icon", "class"]),
163
+ s.value ? (i(), r("button", {
164
+ key: 0,
165
+ class: "absolute -top-1.5 -right-1.5 w-3.5 h-3.5 rounded-full bg-muted border border-border flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors",
166
+ onClick: N(U, ["stop"])
167
+ }, [...t[15] || (t[15] = [
168
+ a("svg", {
169
+ xmlns: "http://www.w3.org/2000/svg",
170
+ viewBox: "0 0 24 24",
171
+ fill: "none",
172
+ stroke: "currentColor",
173
+ "stroke-width": "3",
174
+ "stroke-linecap": "round",
175
+ "stroke-linejoin": "round",
176
+ class: "w-2 h-2"
177
+ }, [
178
+ a("line", {
179
+ x1: "18",
180
+ y1: "6",
181
+ x2: "6",
182
+ y2: "18"
183
+ }),
184
+ a("line", {
185
+ x1: "6",
186
+ y1: "6",
187
+ x2: "18",
188
+ y2: "18"
189
+ })
190
+ ], -1)
191
+ ])])) : d("", !0)
192
+ ])) : d("", !0)
193
+ ])
194
+ ]),
195
+ j(a("div", { class: "text-sm text-foreground/90 whitespace-pre-wrap leading-relaxed py-0.5 wrap-break-word max-w-[95%]" }, f(e.comment.text), 513), [
196
+ [G, e.activeEditId !== e.comment.id]
197
+ ]),
198
+ e.activeEditId === e.comment.id ? (i(), r("div", re, [
199
+ v(E, {
200
+ variant: "edit",
201
+ "initial-text": e.comment.text,
202
+ "current-user": e.currentUser,
203
+ "folder-id": e.folderId,
204
+ "max-file-size": e.maxFileSize,
205
+ "allow-file-upload": e.allowFileUpload,
206
+ placeholder: e.editPlaceholder,
207
+ "editing-text": e.editingText,
208
+ "cancel-edit-text": e.cancelEditText,
209
+ "cancel-text": e.cancelText,
210
+ autofocus: "",
211
+ onSubmit: t[2] || (t[2] = (c, n) => o("submit-edit", c, n, e.comment)),
212
+ onCancel: t[3] || (t[3] = (c) => o("cancel-edit"))
213
+ }, null, 8, ["initial-text", "current-user", "folder-id", "max-file-size", "allow-file-upload", "placeholder", "editing-text", "cancel-edit-text", "cancel-text"])
214
+ ])) : d("", !0),
215
+ e.comment.attachments?.length ? (i(), r("div", ae, [
216
+ v(H(W), {
217
+ attachments: e.comment.attachments,
218
+ variant: "inline",
219
+ size: "sm",
220
+ clickToPreview: !0
221
+ }, null, 8, ["attachments"])
222
+ ])) : d("", !0),
223
+ e.activeReplyId === e.comment.id ? (i(), r("div", de, [
224
+ v(E, {
225
+ variant: "reply",
226
+ "show-cancel": "",
227
+ "current-user": e.currentUser,
228
+ "folder-id": e.folderId,
229
+ "max-file-size": e.maxFileSize,
230
+ "allow-file-upload": e.allowFileUpload,
231
+ placeholder: e.replyPlaceholder || "Replying to discussion...",
232
+ "cancel-text": e.cancelText,
233
+ autofocus: "",
234
+ onSubmit: t[4] || (t[4] = (c, n) => o("submit-reply", c, n, e.comment.id)),
235
+ onCancel: t[5] || (t[5] = (c) => o("cancel-reply"))
236
+ }, null, 8, ["current-user", "folder-id", "max-file-size", "allow-file-upload", "placeholder", "cancel-text"])
237
+ ])) : d("", !0),
238
+ e.comment.replies?.length || e.comment.hasMoreReplies ? (i(), r("div", me, [
239
+ v(q, {
240
+ "enter-active-class": "transition-all duration-300 ease-out",
241
+ "enter-from-class": "opacity-0 translate-y-2 translate-x-2",
242
+ "enter-to-class": "opacity-100 translate-y-0 translate-x-0",
243
+ "leave-active-class": "transition-none"
244
+ }, {
245
+ default: g(() => [
246
+ (i(!0), r(J, null, K(e.comment.replies || [], (c) => (i(), y(A, {
247
+ key: c.id,
248
+ comment: c,
249
+ "current-user": e.currentUser,
250
+ threaded: e.threaded,
251
+ "allow-delete": e.allowDelete,
252
+ "allow-edit": e.allowEdit,
253
+ "allow-reply": e.allowReply,
254
+ "allow-delete-all": e.allowDeleteAll,
255
+ "allow-edit-all": e.allowEditAll,
256
+ "confirm-delete": e.confirmDelete,
257
+ "active-reply-id": e.activeReplyId,
258
+ "active-edit-id": e.activeEditId,
259
+ "folder-id": e.folderId,
260
+ "max-file-size": e.maxFileSize,
261
+ "allow-file-upload": e.allowFileUpload,
262
+ "reply-placeholder": e.replyPlaceholder,
263
+ "edit-placeholder": e.editPlaceholder,
264
+ "reply-text": e.replyText,
265
+ "edited-text": e.editedText,
266
+ "editing-text": e.editingText,
267
+ "cancel-text": e.cancelText,
268
+ "cancel-edit-text": e.cancelEditText,
269
+ onReply: t[6] || (t[6] = (n) => o("reply", n)),
270
+ onEdit: t[7] || (t[7] = (n) => o("edit", n)),
271
+ onDelete: t[8] || (t[8] = (n) => o("delete", n)),
272
+ onSubmitReply: t[9] || (t[9] = (n, w, h) => o("submit-reply", n, w, h)),
273
+ onSubmitEdit: t[10] || (t[10] = (n, w, h) => o("submit-edit", n, w, h)),
274
+ onCancelReply: t[11] || (t[11] = (n) => o("cancel-reply")),
275
+ onCancelEdit: t[12] || (t[12] = (n) => o("cancel-edit")),
276
+ onLoadMoreReplies: t[13] || (t[13] = (n) => o("load-more-replies", n))
277
+ }, null, 8, ["comment", "current-user", "threaded", "allow-delete", "allow-edit", "allow-reply", "allow-delete-all", "allow-edit-all", "confirm-delete", "active-reply-id", "active-edit-id", "folder-id", "max-file-size", "allow-file-upload", "reply-placeholder", "edit-placeholder", "reply-text", "edited-text", "editing-text", "cancel-text", "cancel-edit-text"]))), 128))
278
+ ]),
279
+ _: 1
280
+ }),
281
+ e.comment.hasMoreReplies ? (i(), r("div", ce, [
282
+ a("button", {
283
+ class: "flex items-center gap-3 text-sm text-muted-foreground hover:text-foreground font-medium transition-colors p-1 rounded-md hover:bg-muted/30 group",
284
+ onClick: t[14] || (t[14] = (c) => o("load-more-replies", e.comment.id)),
285
+ disabled: e.comment.loadingMoreReplies,
286
+ "aria-label": "Load more replies"
287
+ }, [
288
+ t[17] || (t[17] = a("div", { class: "w-8 h-px bg-border group-hover:bg-muted-foreground/40 transition-colors" }, null, -1)),
289
+ e.comment.loadingMoreReplies ? (i(), r("span", fe, [...t[16] || (t[16] = [
290
+ a("svg", {
291
+ class: "animate-spin h-3.5 w-3.5",
292
+ xmlns: "http://www.w3.org/2000/svg",
293
+ fill: "none",
294
+ viewBox: "0 0 24 24"
295
+ }, [
296
+ a("circle", {
297
+ class: "opacity-25",
298
+ cx: "12",
299
+ cy: "12",
300
+ r: "10",
301
+ stroke: "currentColor",
302
+ "stroke-width": "4"
303
+ }),
304
+ a("path", {
305
+ class: "opacity-75",
306
+ fill: "currentColor",
307
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
308
+ })
309
+ ], -1),
310
+ b(" Loading... ", -1)
311
+ ])])) : (i(), r("span", ue, f(M.value), 1))
312
+ ], 8, se)
313
+ ])) : d("", !0)
314
+ ])) : d("", !0)
315
+ ])
316
+ ]);
317
+ };
318
+ }
319
+ });
320
+ export {
321
+ ke as default
322
+ };