laif-ds 0.2.71 → 0.2.73
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/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/components/AppForm.md +2 -0
- package/dist/agent-docs/components/AppTimePicker.md +3 -1
- package/dist/agent-docs/components/DatePicker.md +6 -0
- package/dist/agent-docs/components/FilePreview.md +142 -99
- package/dist/components/ui/app-kanban.js +149 -118
- package/dist/components/ui/app-time-picker.js +117 -99
- package/dist/components/ui/app-tooltip.js +49 -68
- package/dist/components/ui/chat-message.js +1 -1
- package/dist/components/ui/date-picker.js +219 -202
- package/dist/components/ui/dropdown-menu.js +50 -49
- package/dist/components/ui/file-preview/index.js +460 -0
- package/dist/components/ui/file-uploader.js +1 -1
- package/dist/components/ui/message-input.js +1 -1
- package/dist/index.d.ts +100 -10
- package/dist/index.js +1 -1
- package/dist/lib/file-preview.js +100 -21
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +2 -1
- package/dist/components/ui/file-preview.js +0 -263
package/dist/lib/file-preview.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
function
|
|
2
|
+
function n(t) {
|
|
3
3
|
if (!t) return "";
|
|
4
|
-
const
|
|
5
|
-
return
|
|
4
|
+
const s = t.split(/[?#]/)[0].split("/").pop() || "", e = s.lastIndexOf(".");
|
|
5
|
+
return e >= 0 ? s.substring(e + 1).toLowerCase() : "";
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const l = /* @__PURE__ */ new Set([
|
|
8
8
|
"jpg",
|
|
9
9
|
"jpeg",
|
|
10
10
|
"png",
|
|
@@ -13,29 +13,108 @@ const o = /* @__PURE__ */ new Set([
|
|
|
13
13
|
"bmp",
|
|
14
14
|
"svg",
|
|
15
15
|
"tiff"
|
|
16
|
-
]),
|
|
17
|
-
function
|
|
16
|
+
]), x = /* @__PURE__ */ new Set(["pdf"]), u = /* @__PURE__ */ new Set(["txt", "md", "csv", "log", "json"]), p = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac"]), m = /* @__PURE__ */ new Set(["mp4", "webm", "ogv", "mov"]);
|
|
17
|
+
function h(t) {
|
|
18
18
|
return !!t && /^(https?:)?\/\//i.test(t);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function C(t) {
|
|
21
21
|
return `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(t)}`;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function v({
|
|
24
24
|
mimeType: t,
|
|
25
|
-
filename:
|
|
26
|
-
url:
|
|
25
|
+
filename: o,
|
|
26
|
+
url: s
|
|
27
27
|
}) {
|
|
28
|
-
const
|
|
29
|
-
return t?.startsWith("image/") ||
|
|
28
|
+
const e = n(o || s);
|
|
29
|
+
return t?.startsWith("image/") || l.has(e) ? "image" : t === "application/pdf" || x.has(e) ? "pdf" : t?.startsWith("audio/") || p.has(e) ? "audio" : t?.startsWith("video/") || m.has(e) ? "video" : u.has(e) || t?.startsWith("text/") ? "text" : "office";
|
|
30
30
|
}
|
|
31
|
+
const a = (t) => "type" in t && typeof t.type == "string" && t instanceof File, d = (t) => t.name || "url" in t && t.url || "", g = (t) => {
|
|
32
|
+
if (a(t)) return t.type || "";
|
|
33
|
+
const o = t.type;
|
|
34
|
+
return typeof o == "string" ? o : "";
|
|
35
|
+
}, N = (t, o) => {
|
|
36
|
+
const s = {
|
|
37
|
+
pdf: { iconName: "FileText", colorClass: "text-red-600" },
|
|
38
|
+
doc: { iconName: "FileText", colorClass: "text-blue-600" },
|
|
39
|
+
docx: { iconName: "FileText", colorClass: "text-blue-600" },
|
|
40
|
+
ppt: { iconName: "FileText", colorClass: "text-orange-600" },
|
|
41
|
+
pptx: { iconName: "FileText", colorClass: "text-orange-600" },
|
|
42
|
+
txt: { iconName: "FileText", colorClass: "text-gray-600" },
|
|
43
|
+
md: { iconName: "FileText", colorClass: "text-gray-600" }
|
|
44
|
+
}, e = (r, i) => r.forEach((c) => s[c] = i);
|
|
45
|
+
return e(["xls", "xlsx", "csv"], {
|
|
46
|
+
iconName: "FileSpreadsheet",
|
|
47
|
+
colorClass: "text-green-600"
|
|
48
|
+
}), e(["zip", "rar", "7z", "tar", "gz", "tgz"], {
|
|
49
|
+
iconName: "FileArchive",
|
|
50
|
+
colorClass: "text-amber-600"
|
|
51
|
+
}), e(["mp3", "wav", "ogg", "flac", "m4a"], {
|
|
52
|
+
iconName: "FileAudio",
|
|
53
|
+
colorClass: "text-violet-600"
|
|
54
|
+
}), e(["mp4", "mov", "avi", "mkv", "webm"], {
|
|
55
|
+
iconName: "FileVideo",
|
|
56
|
+
colorClass: "text-rose-600"
|
|
57
|
+
}), e(
|
|
58
|
+
[
|
|
59
|
+
"js",
|
|
60
|
+
"ts",
|
|
61
|
+
"jsx",
|
|
62
|
+
"tsx",
|
|
63
|
+
"json",
|
|
64
|
+
"xml",
|
|
65
|
+
"yml",
|
|
66
|
+
"yaml",
|
|
67
|
+
"html",
|
|
68
|
+
"css",
|
|
69
|
+
"scss"
|
|
70
|
+
],
|
|
71
|
+
{
|
|
72
|
+
iconName: "FileCode",
|
|
73
|
+
colorClass: "text-indigo-600"
|
|
74
|
+
}
|
|
75
|
+
), t && s[t] ? s[t] : o?.startsWith("audio/") ? { iconName: "FileAudio", colorClass: "text-violet-600" } : o?.startsWith("video/") ? { iconName: "FileVideo", colorClass: "text-rose-600" } : o?.startsWith("text/") ? {
|
|
76
|
+
iconName: "FileText",
|
|
77
|
+
colorClass: "text-gray-600 dark:text-gray-400"
|
|
78
|
+
} : o?.startsWith("image/") ? {
|
|
79
|
+
iconName: "FileImage",
|
|
80
|
+
colorClass: "text-teal-600 dark:text-teal-500"
|
|
81
|
+
} : { iconName: "FileIcon", colorClass: "text-d-secondary-foreground" };
|
|
82
|
+
}, f = (t) => {
|
|
83
|
+
if (!Number.isFinite(t) || t < 0) return "";
|
|
84
|
+
if (t === 0) return "0B";
|
|
85
|
+
const o = ["B", "KB", "MB", "GB", "TB"], s = Math.min(
|
|
86
|
+
Math.floor(Math.log(t) / Math.log(1024)),
|
|
87
|
+
o.length - 1
|
|
88
|
+
), e = t / 1024 ** s, r = s > 0 && e < 100 ? 2 : 0;
|
|
89
|
+
return `${e.toFixed(r)}${o[s]}`;
|
|
90
|
+
}, F = (t) => {
|
|
91
|
+
const o = n(d(t));
|
|
92
|
+
if (o) return o.toUpperCase();
|
|
93
|
+
const s = g(t);
|
|
94
|
+
if (!s) return "";
|
|
95
|
+
if (s === "application/pdf") return "PDF";
|
|
96
|
+
const [e, r] = s.split("/");
|
|
97
|
+
return e === "image" ? r?.toUpperCase() || "IMAGE" : e === "audio" || e === "video" || e === "text" ? e.toUpperCase() : /(officedocument|msword|ms-excel|ms-powerpoint)/.test(s) ? "OFFICE" : "";
|
|
98
|
+
}, w = (t) => {
|
|
99
|
+
const o = a(t) ? f(t.size) : "", s = F(t);
|
|
100
|
+
return { sizeLabel: o, formatLabel: s };
|
|
101
|
+
}, b = (t, o) => t && o ? `${t} · ${o}` : t || o || null;
|
|
31
102
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
103
|
+
p as audioExts,
|
|
104
|
+
f as formatBytes,
|
|
105
|
+
b as formatMetadata,
|
|
106
|
+
n as getExt,
|
|
107
|
+
w as getFileMetadata,
|
|
108
|
+
N as getFormatIcon,
|
|
109
|
+
F as getFormatLabel,
|
|
110
|
+
g as getMimeFromFile,
|
|
111
|
+
d as getNameOrUrl,
|
|
112
|
+
C as getOfficeEmbedUrl,
|
|
113
|
+
v as guessKind,
|
|
114
|
+
l as imageExts,
|
|
115
|
+
a as isFile,
|
|
116
|
+
h as isHttpUrl,
|
|
117
|
+
x as pdfExts,
|
|
118
|
+
u as textExts,
|
|
119
|
+
m as videoExts
|
|
41
120
|
};
|