@hienlh/ppm 0.11.9 → 0.11.10
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/CHANGELOG.md +5 -0
- package/dist/web/assets/{audio-preview-DklYMLn9.js → audio-preview-1DSokoKb.js} +1 -1
- package/dist/web/assets/{chat-tab-D8jTquKg.js → chat-tab-DJRa8l8m.js} +3 -3
- package/dist/web/assets/{code-editor-b_XM6ZCA.js → code-editor-CcHvVH2U.js} +2 -2
- package/dist/web/assets/{conflict-editor-B0doehdT.js → conflict-editor-C7ve0DV-.js} +1 -1
- package/dist/web/assets/{database-viewer-BOy1odBI.js → database-viewer-DIuNqm7A.js} +1 -1
- package/dist/web/assets/{diff-viewer-BIpHr-Qa.js → diff-viewer-DeitZvBi.js} +1 -1
- package/dist/web/assets/{extension-webview-BISaL10b.js → extension-webview-Ca4T_biw.js} +1 -1
- package/dist/web/assets/{image-preview-BK7gTzfW.js → image-preview-DvcaLB4N.js} +1 -1
- package/dist/web/assets/index-BJ5XngyN.js +23 -0
- package/dist/web/assets/index-FKwHNxD8.css +2 -0
- package/dist/web/assets/{markdown-renderer-B2-O-_b9.js → markdown-renderer-DP-MF3bM.js} +1 -1
- package/dist/web/assets/{pdf-preview-CAWtJtyh.js → pdf-preview-CSreqeop.js} +1 -1
- package/dist/web/assets/{port-forwarding-tab-CgO2JZy8.js → port-forwarding-tab-pISwYxUi.js} +1 -1
- package/dist/web/assets/{postgres-viewer-ByUqIYuz.js → postgres-viewer-ZIO1deEA.js} +1 -1
- package/dist/web/assets/{settings-tab-CB1Zns46.js → settings-tab-DjTka3Fq.js} +1 -1
- package/dist/web/assets/{sqlite-viewer-OUxK-Ssz.js → sqlite-viewer-Bxpo_5Ei.js} +1 -1
- package/dist/web/assets/{terminal-tab-D5zcIjmH.js → terminal-tab-Df8jrXRQ.js} +1 -1
- package/dist/web/assets/{video-preview-K0XoP6N-.js → video-preview-DmeBvw9D.js} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/src/web/components/explorer/file-tree.tsx +57 -24
- package/dist/web/assets/index-CaIM2BmJ.js +0 -23
- package/dist/web/assets/index-DYi59ytw.css +0 -2
|
@@ -7,6 +7,12 @@ import {
|
|
|
7
7
|
FileJson,
|
|
8
8
|
FileText,
|
|
9
9
|
FileType,
|
|
10
|
+
FileImage,
|
|
11
|
+
FileVideo,
|
|
12
|
+
FileAudio,
|
|
13
|
+
FileSpreadsheet,
|
|
14
|
+
FileArchive,
|
|
15
|
+
Database,
|
|
10
16
|
ChevronRight,
|
|
11
17
|
ChevronDown,
|
|
12
18
|
Download,
|
|
@@ -40,27 +46,56 @@ function isExternalFileDrag(e: React.DragEvent): boolean {
|
|
|
40
46
|
/** Synthetic root node for creating files/folders at project root */
|
|
41
47
|
const ROOT_NODE: FileNode = { name: "", path: "", type: "directory" };
|
|
42
48
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
rs: FileCode,
|
|
50
|
-
go: FileCode,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
type FileIconInfo = { icon: React.ComponentType<{ className?: string }>; color?: string };
|
|
50
|
+
|
|
51
|
+
const FILE_ICON_MAP: Record<string, FileIconInfo> = {
|
|
52
|
+
// Code
|
|
53
|
+
ts: { icon: FileCode, color: "text-blue-400" }, tsx: { icon: FileCode, color: "text-blue-400" },
|
|
54
|
+
js: { icon: FileCode, color: "text-yellow-400" }, jsx: { icon: FileCode, color: "text-yellow-400" },
|
|
55
|
+
py: { icon: FileCode, color: "text-green-400" }, rs: { icon: FileCode, color: "text-orange-400" },
|
|
56
|
+
go: { icon: FileCode, color: "text-cyan-400" }, c: { icon: FileCode, color: "text-blue-300" },
|
|
57
|
+
cpp: { icon: FileCode, color: "text-blue-300" }, java: { icon: FileCode, color: "text-red-400" },
|
|
58
|
+
rb: { icon: FileCode, color: "text-red-400" }, php: { icon: FileCode, color: "text-purple-400" },
|
|
59
|
+
swift: { icon: FileCode, color: "text-orange-400" }, kt: { icon: FileCode, color: "text-purple-400" },
|
|
60
|
+
dart: { icon: FileCode, color: "text-cyan-400" }, sh: { icon: FileCode, color: "text-green-300" },
|
|
61
|
+
html: { icon: FileCode, color: "text-orange-400" }, css: { icon: FileCode, color: "text-blue-400" },
|
|
62
|
+
scss: { icon: FileCode, color: "text-pink-400" },
|
|
63
|
+
// Data
|
|
64
|
+
json: { icon: FileJson, color: "text-yellow-400" },
|
|
65
|
+
yaml: { icon: FileType, color: "text-orange-300" }, yml: { icon: FileType, color: "text-orange-300" },
|
|
66
|
+
toml: { icon: FileType, color: "text-orange-300" }, ini: { icon: FileType, color: "text-orange-300" },
|
|
67
|
+
env: { icon: FileType, color: "text-yellow-300" },
|
|
68
|
+
csv: { icon: FileSpreadsheet, color: "text-green-400" },
|
|
69
|
+
xls: { icon: FileSpreadsheet, color: "text-green-400" }, xlsx: { icon: FileSpreadsheet, color: "text-green-400" },
|
|
70
|
+
// Text/Docs
|
|
71
|
+
md: { icon: FileText, color: "text-text-secondary" }, txt: { icon: FileText, color: "text-text-secondary" },
|
|
72
|
+
log: { icon: FileText, color: "text-text-subtle" }, pdf: { icon: FileText, color: "text-red-400" },
|
|
73
|
+
// Images
|
|
74
|
+
png: { icon: FileImage, color: "text-green-400" }, jpg: { icon: FileImage, color: "text-green-400" },
|
|
75
|
+
jpeg: { icon: FileImage, color: "text-green-400" }, gif: { icon: FileImage, color: "text-green-400" },
|
|
76
|
+
svg: { icon: FileImage, color: "text-yellow-400" }, webp: { icon: FileImage, color: "text-green-400" },
|
|
77
|
+
ico: { icon: FileImage, color: "text-green-400" }, bmp: { icon: FileImage, color: "text-green-400" },
|
|
78
|
+
// Video
|
|
79
|
+
mp4: { icon: FileVideo, color: "text-purple-400" }, webm: { icon: FileVideo, color: "text-purple-400" },
|
|
80
|
+
mov: { icon: FileVideo, color: "text-purple-400" }, avi: { icon: FileVideo, color: "text-purple-400" },
|
|
81
|
+
mkv: { icon: FileVideo, color: "text-purple-400" },
|
|
82
|
+
// Audio
|
|
83
|
+
mp3: { icon: FileAudio, color: "text-pink-400" }, wav: { icon: FileAudio, color: "text-pink-400" },
|
|
84
|
+
ogg: { icon: FileAudio, color: "text-pink-400" }, flac: { icon: FileAudio, color: "text-pink-400" },
|
|
85
|
+
// Database
|
|
86
|
+
db: { icon: Database, color: "text-amber-400" }, sqlite: { icon: Database, color: "text-amber-400" },
|
|
87
|
+
sqlite3: { icon: Database, color: "text-amber-400" }, sql: { icon: Database, color: "text-amber-400" },
|
|
88
|
+
// Archives
|
|
89
|
+
zip: { icon: FileArchive, color: "text-amber-300" }, tar: { icon: FileArchive, color: "text-amber-300" },
|
|
90
|
+
gz: { icon: FileArchive, color: "text-amber-300" }, rar: { icon: FileArchive, color: "text-amber-300" },
|
|
91
|
+
"7z": { icon: FileArchive, color: "text-amber-300" },
|
|
59
92
|
};
|
|
60
93
|
|
|
61
|
-
|
|
94
|
+
const DEFAULT_FILE_ICON: FileIconInfo = { icon: File };
|
|
95
|
+
|
|
96
|
+
function getFileIcon(name: string): FileIconInfo {
|
|
62
97
|
const ext = name.split(".").pop()?.toLowerCase() ?? "";
|
|
63
|
-
return FILE_ICON_MAP[ext] ??
|
|
98
|
+
return FILE_ICON_MAP[ext] ?? DEFAULT_FILE_ICON;
|
|
64
99
|
}
|
|
65
100
|
|
|
66
101
|
interface TreeNodeProps {
|
|
@@ -141,10 +176,8 @@ const TreeNode = memo(function TreeNode({ node, depth, projectName, onAction, on
|
|
|
141
176
|
}
|
|
142
177
|
}
|
|
143
178
|
|
|
144
|
-
const
|
|
145
|
-
? isExpanded
|
|
146
|
-
? FolderOpen
|
|
147
|
-
: Folder
|
|
179
|
+
const { icon: FileIcon, color: fileIconColor } = isDir
|
|
180
|
+
? { icon: isExpanded ? FolderOpen : Folder, color: "text-primary" }
|
|
148
181
|
: getFileIcon(node.name);
|
|
149
182
|
|
|
150
183
|
const sortedChildren = node.children
|
|
@@ -186,10 +219,10 @@ const TreeNode = memo(function TreeNode({ node, depth, projectName, onAction, on
|
|
|
186
219
|
) : (
|
|
187
220
|
<span className="w-3.5 shrink-0" />
|
|
188
221
|
)}
|
|
189
|
-
<
|
|
222
|
+
<FileIcon
|
|
190
223
|
className={cn(
|
|
191
224
|
"size-4 shrink-0",
|
|
192
|
-
|
|
225
|
+
fileIconColor ?? "text-text-secondary",
|
|
193
226
|
)}
|
|
194
227
|
/>
|
|
195
228
|
<span className="truncate">{node.name}</span>
|