@joewinke/jatui 0.1.22 → 0.1.24
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/CLAUDE.md +244 -0
- package/package.json +23 -10
- package/src/lib/actions/collapse.ts +0 -134
- package/src/lib/actions/railNav.ts +0 -473
- package/src/lib/components/AnnotationLayer.svelte +0 -108
- package/src/lib/components/AnnotationPanel.svelte +0 -319
- package/src/lib/components/AudioWaveform.svelte +0 -698
- package/src/lib/components/AvailabilityModal.svelte +0 -177
- package/src/lib/components/AvatarUpload.svelte +0 -234
- package/src/lib/components/Badge.svelte +0 -38
- package/src/lib/components/BookingForm.svelte +0 -278
- package/src/lib/components/BurndownChart.svelte +0 -778
- package/src/lib/components/Button.svelte +0 -81
- package/src/lib/components/CalendarPicker.svelte +0 -284
- package/src/lib/components/Card.svelte +0 -67
- package/src/lib/components/CharacterCounter.svelte +0 -82
- package/src/lib/components/ChipInput.svelte +0 -609
- package/src/lib/components/Collapse.svelte +0 -82
- package/src/lib/components/ColorSelector.svelte +0 -167
- package/src/lib/components/CommentThread.svelte +0 -773
- package/src/lib/components/ConfirmDialog.svelte +0 -348
- package/src/lib/components/ConfirmModal.svelte +0 -142
- package/src/lib/components/ContextMenu.svelte +0 -188
- package/src/lib/components/CountdownTimer.svelte +0 -94
- package/src/lib/components/DateRangePicker.svelte +0 -194
- package/src/lib/components/Drawer.svelte +0 -143
- package/src/lib/components/EmojiPicker.svelte +0 -159
- package/src/lib/components/EntityPreviewCard.svelte +0 -104
- package/src/lib/components/FileDropzone.svelte +0 -493
- package/src/lib/components/FilePicker.svelte +0 -488
- package/src/lib/components/FileThumbnail.svelte +0 -80
- package/src/lib/components/FilterDropdown.svelte +0 -203
- package/src/lib/components/FloatingActionBar.svelte +0 -354
- package/src/lib/components/GPSTracker.svelte +0 -202
- package/src/lib/components/HunkDiffView.svelte +0 -348
- package/src/lib/components/ImageLightbox.svelte +0 -274
- package/src/lib/components/ImageUpload.svelte +0 -147
- package/src/lib/components/InlineEdit.svelte +0 -291
- package/src/lib/components/InputDialog.svelte +0 -327
- package/src/lib/components/KeyboardShortcutsOverlay.svelte +0 -296
- package/src/lib/components/LazyImage.svelte +0 -123
- package/src/lib/components/LinkShortener.svelte +0 -274
- package/src/lib/components/LoadingSpinner.svelte +0 -106
- package/src/lib/components/LocationMap.svelte +0 -186
- package/src/lib/components/MapView.svelte +0 -341
- package/src/lib/components/MarkupEditor.svelte +0 -485
- package/src/lib/components/MarkupOverlay.svelte +0 -55
- package/src/lib/components/MediaWorkbench.svelte +0 -871
- package/src/lib/components/MilestoneCard.svelte +0 -98
- package/src/lib/components/MilestoneTimeline.svelte +0 -91
- package/src/lib/components/Modal.svelte +0 -244
- package/src/lib/components/PDFViewer.svelte +0 -105
- package/src/lib/components/PdfThumbnail.svelte +0 -63
- package/src/lib/components/PhoneInput.svelte +0 -212
- package/src/lib/components/ResizableDivider.svelte +0 -307
- package/src/lib/components/ResizablePanel.svelte +0 -305
- package/src/lib/components/SearchDropdown.svelte +0 -421
- package/src/lib/components/SelectInput.svelte +0 -237
- package/src/lib/components/SidebarUserFooter.svelte +0 -34
- package/src/lib/components/SignaturePad.svelte +0 -175
- package/src/lib/components/SmartImageEditor.svelte +0 -720
- package/src/lib/components/SortDropdown.svelte +0 -156
- package/src/lib/components/Sparkline.svelte +0 -116
- package/src/lib/components/SpeechForm.svelte +0 -114
- package/src/lib/components/StatusBadge.svelte +0 -157
- package/src/lib/components/TaskTypeIcon.svelte +0 -54
- package/src/lib/components/TextArea.svelte +0 -162
- package/src/lib/components/TextInput.svelte +0 -131
- package/src/lib/components/ThemeSelector.svelte +0 -206
- package/src/lib/components/TimeSlotPicker.svelte +0 -162
- package/src/lib/components/UserAvatar.svelte +0 -72
- package/src/lib/components/VariablePicker.svelte +0 -170
- package/src/lib/components/VoicePlayer.svelte +0 -422
- package/src/lib/components/linked-columns/LinkedColumns.svelte +0 -526
- package/src/lib/components/markup.ts +0 -287
- package/src/lib/components/messaging/Avatar.svelte +0 -81
- package/src/lib/components/messaging/ChannelInfoModal.svelte +0 -163
- package/src/lib/components/messaging/ChannelList.svelte +0 -107
- package/src/lib/components/messaging/ChannelMemberAvatarStack.svelte +0 -69
- package/src/lib/components/messaging/ChannelMembersModal.svelte +0 -182
- package/src/lib/components/messaging/CreateChannelModal.svelte +0 -190
- package/src/lib/components/messaging/DirectMessageList.svelte +0 -145
- package/src/lib/components/messaging/EmojiSelector.svelte +0 -261
- package/src/lib/components/messaging/MentionAutocomplete.svelte +0 -193
- package/src/lib/components/messaging/MessageAttachment.svelte +0 -273
- package/src/lib/components/messaging/MessageAttachmentUpload.svelte +0 -243
- package/src/lib/components/messaging/MessageInput.svelte +0 -452
- package/src/lib/components/messaging/MessageItem.svelte +0 -341
- package/src/lib/components/messaging/MessageThread.svelte +0 -306
- package/src/lib/components/messaging/NotificationSettingsModal.svelte +0 -234
- package/src/lib/components/messaging/QuotedMessageDisplay.svelte +0 -123
- package/src/lib/components/messaging/StartDMModal.svelte +0 -100
- package/src/lib/components/messaging/ThreadPanel.svelte +0 -153
- package/src/lib/components/pipeline/DESIGN.md +0 -361
- package/src/lib/components/pipeline/Pipeline.svelte +0 -391
- package/src/lib/components/pipeline/PipelineCard.svelte +0 -94
- package/src/lib/components/pipeline/PipelineColumn.svelte +0 -163
- package/src/lib/components/replay/ChapterTimeline.svelte +0 -326
- package/src/lib/components/session-nav/transcriptModel.ts +0 -352
- package/src/lib/data/emojis.ts +0 -1208
- package/src/lib/index.ts +0 -405
- package/src/lib/stores/confirmDialog.svelte.ts +0 -48
- package/src/lib/stores/inputDialog.svelte.ts +0 -51
- package/src/lib/styles/rail.css +0 -63
- package/src/lib/types/annotation.ts +0 -38
- package/src/lib/types/booking.ts +0 -143
- package/src/lib/types/comments.ts +0 -97
- package/src/lib/types/entityPreview.ts +0 -45
- package/src/lib/types/filePicker.ts +0 -16
- package/src/lib/types/googleMaps.d.ts +0 -51
- package/src/lib/types/maps.ts +0 -43
- package/src/lib/types/messaging.ts +0 -459
- package/src/lib/types/milestone.ts +0 -22
- package/src/lib/types/pipeline.ts +0 -150
- package/src/lib/types/smartImageEditor.ts +0 -39
- package/src/lib/types/templateVars.ts +0 -36
- package/src/lib/utils/currency.ts +0 -20
- package/src/lib/utils/daisyuiColors.ts +0 -243
- package/src/lib/utils/dateFormatters.ts +0 -196
- package/src/lib/utils/googleMapsLoader.ts +0 -84
- package/src/lib/utils/mentionParser.ts +0 -188
- package/src/lib/utils/phone.ts +0 -80
- package/src/lib/utils/phoneFormat.ts +0 -74
- package/src/lib/utils/taskUtils.ts +0 -75
|
@@ -1,493 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
export interface FileDropzoneFile {
|
|
3
|
-
/** The raw File object for pending (pre-upload) files */
|
|
4
|
-
file?: File
|
|
5
|
-
/** Name to display */
|
|
6
|
-
name: string
|
|
7
|
-
/** MIME type */
|
|
8
|
-
mimeType: string
|
|
9
|
-
/** File size in bytes */
|
|
10
|
-
size?: number
|
|
11
|
-
/** URL for already-uploaded files (for FileThumbnail) */
|
|
12
|
-
url?: string
|
|
13
|
-
/** Arbitrary metadata for the consumer */
|
|
14
|
-
meta?: Record<string, unknown>
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<script lang="ts">
|
|
19
|
-
import FileThumbnail from "./FileThumbnail.svelte"
|
|
20
|
-
|
|
21
|
-
// Lightweight extension→MIME map (avoids mime-types dependency)
|
|
22
|
-
const EXT_TO_MIME: Record<string, string> = {
|
|
23
|
-
png: "image/png",
|
|
24
|
-
jpg: "image/jpeg",
|
|
25
|
-
jpeg: "image/jpeg",
|
|
26
|
-
gif: "image/gif",
|
|
27
|
-
webp: "image/webp",
|
|
28
|
-
svg: "image/svg+xml",
|
|
29
|
-
avif: "image/avif",
|
|
30
|
-
bmp: "image/bmp",
|
|
31
|
-
ico: "image/x-icon",
|
|
32
|
-
tiff: "image/tiff",
|
|
33
|
-
tif: "image/tiff",
|
|
34
|
-
pdf: "application/pdf",
|
|
35
|
-
zip: "application/zip",
|
|
36
|
-
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
37
|
-
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
38
|
-
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
39
|
-
doc: "application/msword",
|
|
40
|
-
xls: "application/vnd.ms-excel",
|
|
41
|
-
ppt: "application/vnd.ms-powerpoint",
|
|
42
|
-
txt: "text/plain",
|
|
43
|
-
csv: "text/csv",
|
|
44
|
-
mp4: "video/mp4",
|
|
45
|
-
mp3: "audio/mpeg",
|
|
46
|
-
wav: "audio/wav",
|
|
47
|
-
dwg: "image/vnd.dwg",
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const ZIP_TYPES = new Set([
|
|
51
|
-
"application/zip",
|
|
52
|
-
"application/x-zip-compressed",
|
|
53
|
-
"application/x-zip",
|
|
54
|
-
])
|
|
55
|
-
|
|
56
|
-
function extToMime(filename: string): string | false {
|
|
57
|
-
const ext = filename.split(".").pop()?.toLowerCase() ?? ""
|
|
58
|
-
return EXT_TO_MIME[ext] ?? false
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function mimeToExt(mime: string): string | false {
|
|
62
|
-
for (const [ext, m] of Object.entries(EXT_TO_MIME)) {
|
|
63
|
-
if (m === mime) return ext
|
|
64
|
-
}
|
|
65
|
-
return false
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface Props {
|
|
69
|
-
/** MIME types to accept, e.g. ["image/png","application/pdf"] */
|
|
70
|
-
accept?: string[]
|
|
71
|
-
/** Max file size in bytes (default 50 MB) */
|
|
72
|
-
maxSize?: number
|
|
73
|
-
/** Max number of files (default 10) */
|
|
74
|
-
maxFiles?: number
|
|
75
|
-
disabled?: boolean
|
|
76
|
-
/** Allow selecting multiple files */
|
|
77
|
-
multiple?: boolean
|
|
78
|
-
/** Already-uploaded files to show in the grid below the dropzone */
|
|
79
|
-
uploadedFiles?: FileDropzoneFile[]
|
|
80
|
-
/** Whether an upload is in flight */
|
|
81
|
-
isUploading?: boolean
|
|
82
|
-
/** Whether a ZIP extraction is in flight */
|
|
83
|
-
isExtracting?: boolean
|
|
84
|
-
/** Label shown in the dropzone (default: "Drop files or folders here") */
|
|
85
|
-
dropLabel?: string
|
|
86
|
-
/** Subtext shown below the label */
|
|
87
|
-
dropSubtext?: string
|
|
88
|
-
/** Called when the user selects or drops files (after validation) */
|
|
89
|
-
onFilesSelected?: (files: File[], errors: string[]) => void
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
let {
|
|
93
|
-
accept = [
|
|
94
|
-
"image/png",
|
|
95
|
-
"image/jpeg",
|
|
96
|
-
"application/pdf",
|
|
97
|
-
"application/zip",
|
|
98
|
-
"application/x-zip-compressed",
|
|
99
|
-
],
|
|
100
|
-
maxSize = 50 * 1024 * 1024,
|
|
101
|
-
maxFiles = 10,
|
|
102
|
-
disabled = false,
|
|
103
|
-
multiple = true,
|
|
104
|
-
uploadedFiles = [],
|
|
105
|
-
isUploading = false,
|
|
106
|
-
isExtracting = false,
|
|
107
|
-
dropLabel = "Upload files",
|
|
108
|
-
dropSubtext,
|
|
109
|
-
onFilesSelected,
|
|
110
|
-
}: Props = $props()
|
|
111
|
-
|
|
112
|
-
let isDragOver = $state(false)
|
|
113
|
-
let fileInput = $state<HTMLInputElement>(undefined!)
|
|
114
|
-
let dropzoneRef = $state<HTMLElement>(undefined!)
|
|
115
|
-
let selectedFiles = $state<File[]>([])
|
|
116
|
-
|
|
117
|
-
// Human-readable accepted extensions for display
|
|
118
|
-
const acceptedExtensions = $derived(
|
|
119
|
-
accept
|
|
120
|
-
.map((type) => {
|
|
121
|
-
if (ZIP_TYPES.has(type)) return ".zip"
|
|
122
|
-
const ext = mimeToExt(type)
|
|
123
|
-
return ext ? `.${ext}` : type
|
|
124
|
-
})
|
|
125
|
-
.filter((v, i, a) => a.indexOf(v) === i) // dedupe
|
|
126
|
-
.join(", ")
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
function validateFile(file: File): string | null {
|
|
130
|
-
if (file.type && !accept.includes(file.type)) {
|
|
131
|
-
// Try to infer from extension for files where browser didn't set MIME
|
|
132
|
-
const inferred = extToMime(file.name)
|
|
133
|
-
if (!inferred || !accept.includes(inferred)) {
|
|
134
|
-
return `File type not supported. Accepted: ${acceptedExtensions}`
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (file.size > maxSize) {
|
|
138
|
-
const sizeMB = Math.round(maxSize / (1024 * 1024))
|
|
139
|
-
return `File too large (max ${sizeMB} MB)`
|
|
140
|
-
}
|
|
141
|
-
return null
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function processFiles(files: FileList | File[]): { validFiles: File[]; errors: string[] } {
|
|
145
|
-
const fileArray = Array.from(files)
|
|
146
|
-
const validFiles: File[] = []
|
|
147
|
-
const errors: string[] = []
|
|
148
|
-
|
|
149
|
-
if (fileArray.length > maxFiles) {
|
|
150
|
-
errors.push(`Too many files. Maximum ${maxFiles} files allowed.`)
|
|
151
|
-
return { validFiles: [], errors }
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
for (const file of fileArray) {
|
|
155
|
-
const error = validateFile(file)
|
|
156
|
-
if (error) {
|
|
157
|
-
errors.push(`${file.name}: ${error}`)
|
|
158
|
-
} else {
|
|
159
|
-
validFiles.push(file)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return { validFiles, errors }
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Recursively read all files from a directory entry
|
|
166
|
-
async function readDirectoryEntries(entry: FileSystemDirectoryEntry): Promise<File[]> {
|
|
167
|
-
const files: File[] = []
|
|
168
|
-
const reader = entry.createReader()
|
|
169
|
-
|
|
170
|
-
const readBatch = (): Promise<FileSystemEntry[]> =>
|
|
171
|
-
new Promise((resolve, reject) => reader.readEntries(resolve, reject))
|
|
172
|
-
|
|
173
|
-
let batch: FileSystemEntry[]
|
|
174
|
-
do {
|
|
175
|
-
batch = await readBatch()
|
|
176
|
-
for (const child of batch) {
|
|
177
|
-
if (child.isFile) {
|
|
178
|
-
const file = await new Promise<File>((resolve, reject) =>
|
|
179
|
-
(child as FileSystemFileEntry).file(resolve, reject),
|
|
180
|
-
)
|
|
181
|
-
files.push(file)
|
|
182
|
-
} else if (child.isDirectory) {
|
|
183
|
-
const subFiles = await readDirectoryEntries(child as FileSystemDirectoryEntry)
|
|
184
|
-
files.push(...subFiles)
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
} while (batch.length > 0)
|
|
188
|
-
|
|
189
|
-
return files
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Collect files from DataTransfer items (handles folders)
|
|
193
|
-
async function collectDroppedFiles(dataTransfer: DataTransfer): Promise<File[]> {
|
|
194
|
-
const items = dataTransfer.items
|
|
195
|
-
if (!items || items.length === 0) {
|
|
196
|
-
return Array.from(dataTransfer.files)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const allFiles: File[] = []
|
|
200
|
-
const entries: FileSystemEntry[] = []
|
|
201
|
-
|
|
202
|
-
// Grab entries synchronously — they become invalid after await
|
|
203
|
-
for (let i = 0; i < items.length; i++) {
|
|
204
|
-
const entry = items[i].webkitGetAsEntry?.()
|
|
205
|
-
if (entry) entries.push(entry)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
for (const entry of entries) {
|
|
209
|
-
if (entry.isFile) {
|
|
210
|
-
const file = await new Promise<File>((resolve, reject) =>
|
|
211
|
-
(entry as FileSystemFileEntry).file(resolve, reject),
|
|
212
|
-
)
|
|
213
|
-
allFiles.push(file)
|
|
214
|
-
} else if (entry.isDirectory) {
|
|
215
|
-
const dirFiles = await readDirectoryEntries(entry as FileSystemDirectoryEntry)
|
|
216
|
-
allFiles.push(...dirFiles)
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return allFiles
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function handleFileSelect(event: Event) {
|
|
224
|
-
const target = event.target as HTMLInputElement
|
|
225
|
-
if (target.files && target.files.length > 0) {
|
|
226
|
-
const { validFiles, errors } = processFiles(target.files)
|
|
227
|
-
selectedFiles = validFiles
|
|
228
|
-
onFilesSelected?.(validFiles, errors)
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function handleDragEnter(event: DragEvent) {
|
|
233
|
-
event.preventDefault()
|
|
234
|
-
isDragOver = true
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function handleDragLeave(event: DragEvent) {
|
|
238
|
-
event.preventDefault()
|
|
239
|
-
if (!dropzoneRef.contains(event.relatedTarget as Node)) {
|
|
240
|
-
isDragOver = false
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function handleDragOver(event: DragEvent) {
|
|
245
|
-
event.preventDefault()
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
async function handleDrop(event: DragEvent) {
|
|
249
|
-
event.preventDefault()
|
|
250
|
-
isDragOver = false
|
|
251
|
-
|
|
252
|
-
if (disabled || !event.dataTransfer) return
|
|
253
|
-
|
|
254
|
-
const allFiles = await collectDroppedFiles(event.dataTransfer)
|
|
255
|
-
// Filter hidden / macOS artifact files
|
|
256
|
-
const filtered = allFiles.filter(
|
|
257
|
-
(f) => !f.name.startsWith(".") && !f.name.startsWith("__MACOSX"),
|
|
258
|
-
)
|
|
259
|
-
|
|
260
|
-
if (filtered.length > 0) {
|
|
261
|
-
const { validFiles, errors } = processFiles(filtered)
|
|
262
|
-
selectedFiles = validFiles
|
|
263
|
-
onFilesSelected?.(validFiles, errors)
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function openFileDialog() {
|
|
268
|
-
if (!disabled) fileInput.click()
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function formatFileSize(bytes: number): string {
|
|
272
|
-
if (bytes === 0) return "0 B"
|
|
273
|
-
const k = 1024
|
|
274
|
-
const sizes = ["B", "KB", "MB", "GB"]
|
|
275
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
276
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i]
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function fileIcon(file: File) {
|
|
280
|
-
if (file.type.startsWith("image/")) return "image"
|
|
281
|
-
if (file.type === "application/pdf") return "pdf"
|
|
282
|
-
if (ZIP_TYPES.has(file.type)) return "zip"
|
|
283
|
-
return "generic"
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Clear selected files when upload completes
|
|
287
|
-
$effect(() => {
|
|
288
|
-
if (!isUploading && uploadedFiles.length > 0) {
|
|
289
|
-
selectedFiles = []
|
|
290
|
-
}
|
|
291
|
-
})
|
|
292
|
-
</script>
|
|
293
|
-
|
|
294
|
-
<div class="w-full">
|
|
295
|
-
<!-- Hidden file input -->
|
|
296
|
-
<input
|
|
297
|
-
bind:this={fileInput}
|
|
298
|
-
type="file"
|
|
299
|
-
accept={accept.join(",")}
|
|
300
|
-
{multiple}
|
|
301
|
-
{disabled}
|
|
302
|
-
onchange={handleFileSelect}
|
|
303
|
-
class="hidden"
|
|
304
|
-
aria-hidden="true"
|
|
305
|
-
/>
|
|
306
|
-
|
|
307
|
-
<!-- Dropzone -->
|
|
308
|
-
<div
|
|
309
|
-
bind:this={dropzoneRef}
|
|
310
|
-
class="relative border-2 border-dashed rounded-lg p-6 transition-all duration-200 cursor-pointer
|
|
311
|
-
{isDragOver
|
|
312
|
-
? 'border-primary bg-primary/5 scale-[1.02]'
|
|
313
|
-
: disabled
|
|
314
|
-
? 'border-base-300 bg-base-200 cursor-not-allowed'
|
|
315
|
-
: 'border-base-300 hover:border-primary hover:bg-primary/5'}"
|
|
316
|
-
onclick={openFileDialog}
|
|
317
|
-
ondragenter={handleDragEnter}
|
|
318
|
-
ondragleave={handleDragLeave}
|
|
319
|
-
ondragover={handleDragOver}
|
|
320
|
-
ondrop={handleDrop}
|
|
321
|
-
role="button"
|
|
322
|
-
tabindex="0"
|
|
323
|
-
aria-label={dropLabel}
|
|
324
|
-
onkeydown={(e) => {
|
|
325
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
326
|
-
e.preventDefault()
|
|
327
|
-
openFileDialog()
|
|
328
|
-
}
|
|
329
|
-
}}
|
|
330
|
-
>
|
|
331
|
-
<div class="text-center">
|
|
332
|
-
<!-- Upload icon -->
|
|
333
|
-
<svg
|
|
334
|
-
class="mx-auto h-12 w-12 {disabled ? 'text-base-content/40' : 'text-base-content/50'}"
|
|
335
|
-
stroke="currentColor"
|
|
336
|
-
fill="none"
|
|
337
|
-
viewBox="0 0 48 48"
|
|
338
|
-
aria-hidden="true"
|
|
339
|
-
>
|
|
340
|
-
<path
|
|
341
|
-
d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02"
|
|
342
|
-
stroke-width="2"
|
|
343
|
-
stroke-linecap="round"
|
|
344
|
-
stroke-linejoin="round"
|
|
345
|
-
/>
|
|
346
|
-
</svg>
|
|
347
|
-
|
|
348
|
-
<div class="mt-4">
|
|
349
|
-
<p class="text-lg font-medium {disabled ? 'text-base-content/40' : 'text-base-content'}">
|
|
350
|
-
{isDragOver ? "Drop files or folders here" : dropLabel}
|
|
351
|
-
</p>
|
|
352
|
-
<p class="mt-2 text-sm {disabled ? 'text-base-content/40' : 'text-base-content/50'}">
|
|
353
|
-
{#if !disabled}
|
|
354
|
-
{#if dropSubtext}
|
|
355
|
-
{dropSubtext}
|
|
356
|
-
{:else}
|
|
357
|
-
Drag and drop files, folders, or ZIP archives, or
|
|
358
|
-
<span class="font-medium text-primary underline">click to browse</span>
|
|
359
|
-
{/if}
|
|
360
|
-
{:else}
|
|
361
|
-
File upload is disabled
|
|
362
|
-
{/if}
|
|
363
|
-
</p>
|
|
364
|
-
</div>
|
|
365
|
-
|
|
366
|
-
{#if !disabled}
|
|
367
|
-
<div class="mt-4 text-xs text-base-content/50 space-y-1">
|
|
368
|
-
<p>Accepted: {acceptedExtensions}</p>
|
|
369
|
-
<p>Max size: {formatFileSize(maxSize)} · Max files: {maxFiles}</p>
|
|
370
|
-
<p>You can drop a folder or ZIP archive</p>
|
|
371
|
-
</div>
|
|
372
|
-
{/if}
|
|
373
|
-
</div>
|
|
374
|
-
|
|
375
|
-
<!-- Drag overlay -->
|
|
376
|
-
{#if isDragOver}
|
|
377
|
-
<div
|
|
378
|
-
class="absolute inset-0 bg-primary/10 rounded-lg border-2 border-primary border-dashed flex items-center justify-center"
|
|
379
|
-
>
|
|
380
|
-
<div class="text-center">
|
|
381
|
-
<svg
|
|
382
|
-
class="mx-auto h-16 w-16 text-primary"
|
|
383
|
-
fill="none"
|
|
384
|
-
stroke="currentColor"
|
|
385
|
-
viewBox="0 0 24 24"
|
|
386
|
-
aria-hidden="true"
|
|
387
|
-
>
|
|
388
|
-
<path
|
|
389
|
-
stroke-linecap="round"
|
|
390
|
-
stroke-linejoin="round"
|
|
391
|
-
stroke-width="2"
|
|
392
|
-
d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"
|
|
393
|
-
/>
|
|
394
|
-
</svg>
|
|
395
|
-
<p class="mt-2 text-lg font-medium text-primary">Drop files or folders here</p>
|
|
396
|
-
</div>
|
|
397
|
-
</div>
|
|
398
|
-
{/if}
|
|
399
|
-
</div>
|
|
400
|
-
|
|
401
|
-
<!-- Selected Files (before upload) -->
|
|
402
|
-
{#if selectedFiles.length > 0 && !isUploading && uploadedFiles.length === 0}
|
|
403
|
-
<div class="mt-4 space-y-2">
|
|
404
|
-
<h4 class="text-sm font-medium text-base-content/70">
|
|
405
|
-
Selected ({selectedFiles.length})
|
|
406
|
-
</h4>
|
|
407
|
-
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3">
|
|
408
|
-
{#each selectedFiles as file}
|
|
409
|
-
<div class="flex flex-col items-center p-3 bg-base-200 rounded-lg border border-base-300">
|
|
410
|
-
<div class="w-12 h-12 bg-base-100 rounded border border-base-300 flex items-center justify-center mb-2">
|
|
411
|
-
{#if fileIcon(file) === "image"}
|
|
412
|
-
<svg class="h-6 w-6 text-info" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
413
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
|
414
|
-
</svg>
|
|
415
|
-
{:else if fileIcon(file) === "pdf"}
|
|
416
|
-
<svg class="h-6 w-6 text-error" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
417
|
-
<path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20M10.92,12.31C10.68,11.54 10.15,9.08 11.55,9.04C12.95,9 12.03,12.16 12.03,12.16C12.42,13.65 14.05,14.72 14.05,14.72C14.55,14.57 17.4,14.24 17,15.72C16.57,17.2 13.5,15.81 13.5,15.81C11.55,15.95 10.09,16.47 10.09,16.47C8.96,18.58 7.64,19.5 7.1,18.61C6.43,17.5 9.23,16.07 9.23,16.07C10.68,13.67 10.92,12.31 10.92,12.31Z" />
|
|
418
|
-
</svg>
|
|
419
|
-
{:else if fileIcon(file) === "zip"}
|
|
420
|
-
<svg class="h-6 w-6 text-warning" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
421
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4" />
|
|
422
|
-
</svg>
|
|
423
|
-
{:else}
|
|
424
|
-
<svg class="h-6 w-6 text-base-content/40" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
|
425
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
|
426
|
-
</svg>
|
|
427
|
-
{/if}
|
|
428
|
-
</div>
|
|
429
|
-
<span class="text-xs text-base-content/60 text-center font-medium truncate w-full" title={file.name}>
|
|
430
|
-
{file.name}
|
|
431
|
-
</span>
|
|
432
|
-
<span class="text-xs text-base-content/50 mt-1">{formatFileSize(file.size)}</span>
|
|
433
|
-
</div>
|
|
434
|
-
{/each}
|
|
435
|
-
</div>
|
|
436
|
-
</div>
|
|
437
|
-
{/if}
|
|
438
|
-
|
|
439
|
-
<!-- Upload / extraction progress -->
|
|
440
|
-
{#if isExtracting}
|
|
441
|
-
<div class="mt-4">
|
|
442
|
-
<div class="flex items-center justify-center p-6 bg-warning/10 rounded-lg border border-warning/30">
|
|
443
|
-
<div class="text-center">
|
|
444
|
-
<span class="loading loading-spinner loading-lg text-warning"></span>
|
|
445
|
-
<p class="mt-3 text-sm font-medium text-warning-content">Extracting ZIP file…</p>
|
|
446
|
-
<p class="text-xs text-warning-content/70">Unpacking and uploading files from archive</p>
|
|
447
|
-
</div>
|
|
448
|
-
</div>
|
|
449
|
-
</div>
|
|
450
|
-
{:else if isUploading}
|
|
451
|
-
<div class="mt-4">
|
|
452
|
-
<div class="flex items-center justify-center p-6 bg-info/10 rounded-lg border border-info/30">
|
|
453
|
-
<div class="text-center">
|
|
454
|
-
<span class="loading loading-spinner loading-lg text-primary"></span>
|
|
455
|
-
<p class="mt-3 text-sm font-medium text-info-content">Uploading files…</p>
|
|
456
|
-
<p class="text-xs text-info-content/70">Please wait while files are uploaded</p>
|
|
457
|
-
</div>
|
|
458
|
-
</div>
|
|
459
|
-
</div>
|
|
460
|
-
{/if}
|
|
461
|
-
|
|
462
|
-
<!-- Uploaded Files (after successful upload) -->
|
|
463
|
-
{#if uploadedFiles.length > 0}
|
|
464
|
-
<div class="mt-4 space-y-2">
|
|
465
|
-
<h4 class="text-sm font-medium text-base-content/70">
|
|
466
|
-
Uploaded ({uploadedFiles.length})
|
|
467
|
-
</h4>
|
|
468
|
-
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3">
|
|
469
|
-
{#each uploadedFiles as file}
|
|
470
|
-
<div class="flex flex-col items-center p-3 bg-success/10 rounded-lg border border-success/30">
|
|
471
|
-
<FileThumbnail
|
|
472
|
-
name={file.name}
|
|
473
|
-
mimeType={file.mimeType}
|
|
474
|
-
url={file.url}
|
|
475
|
-
size="md"
|
|
476
|
-
/>
|
|
477
|
-
<span class="text-xs text-base-content/60 text-center font-medium truncate w-full mt-2" title={file.name}>
|
|
478
|
-
{file.name}
|
|
479
|
-
</span>
|
|
480
|
-
<span class="text-xs text-success font-medium mt-1">✓ Uploaded</span>
|
|
481
|
-
</div>
|
|
482
|
-
{/each}
|
|
483
|
-
</div>
|
|
484
|
-
</div>
|
|
485
|
-
{/if}
|
|
486
|
-
</div>
|
|
487
|
-
|
|
488
|
-
<style>
|
|
489
|
-
div[role="button"]:focus {
|
|
490
|
-
outline: 2px solid var(--color-primary);
|
|
491
|
-
outline-offset: 2px;
|
|
492
|
-
}
|
|
493
|
-
</style>
|