@widgetic/file-browser 0.5.18 → 0.5.19
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/components/core/FileBrowser.svelte +149 -1331
- package/dist/components/core/FileUploader.svelte +4 -4
- package/dist/components/core/Header.svelte +3 -3
- package/dist/components/core/RecentFiles.svelte +7 -43
- package/dist/components/items/FileItem.svelte +10 -43
- package/dist/components/items/FileItem.svelte.d.ts +1 -0
- package/dist/components/items/FolderItem.svelte +4 -12
- package/dist/components/items/FolderItem.svelte.d.ts +1 -0
- package/dist/components/modals/MoveDialog.svelte +17 -17
- package/dist/components/modals/SearchModal.svelte +30 -41
- package/dist/components/modals/SelectedFilesModal.svelte +2 -2
- package/dist/components/previews/AudioPlayer.svelte +1 -1
- package/dist/components/previews/FilePreview.svelte +7 -7
- package/dist/components/previews/ImagePreview.svelte +13 -13
- package/dist/components/previews/VideoPlayer.svelte +1 -1
- package/dist/components/ui/DragSelect.svelte +73 -52
- package/dist/components/ui/DropdownMenu.svelte +1 -1
- package/dist/components/ui/VirtualList.svelte +20 -10
- package/dist/data/demoContent.json +1171 -0
- package/dist/stores/fileStore.js +1 -1
- package/dist/stores/persistentSelectStore.d.ts +1 -0
- package/dist/stores/persistentSelectStore.js +23 -0
- package/dist/stores/viewportStore.d.ts +5 -0
- package/dist/stores/viewportStore.js +19 -0
- package/dist/utils/fileOperations.js +17 -14
- package/dist/utils/resolveFileUrl.js +6 -2
- package/dist/utils/userUploadsStorage.d.ts +5 -0
- package/dist/utils/userUploadsStorage.js +15 -6
- package/dist/utils/widgeticUpload.d.ts +1 -0
- package/package.json +8 -8
|
@@ -413,7 +413,7 @@
|
|
|
413
413
|
|
|
414
414
|
if (uploadConfig?.accessToken && uploadConfig?.apiBasePath) {
|
|
415
415
|
if (showLogs) {
|
|
416
|
-
console.log('[FileUploader] Widgetic upload:', file.name, uploadConfig.contextType);
|
|
416
|
+
// console.log('[FileUploader] Widgetic upload:', file.name, uploadConfig.contextType);
|
|
417
417
|
}
|
|
418
418
|
response = await uploadToWidgeticApi(normalizedFile, uploadConfig, {
|
|
419
419
|
abortSignal: controller.signal,
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
});
|
|
429
429
|
} else {
|
|
430
430
|
if (showLogs) {
|
|
431
|
-
console.log(`[FileUploader] Mock upload ${file.name} to path: ${path}, folder: ${currentFolderId}`);
|
|
431
|
+
// console.log(`[FileUploader] Mock upload ${file.name} to path: ${path}, folder: ${currentFolderId}`);
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
const progressInterval = setInterval(() => {
|
|
@@ -1110,7 +1110,7 @@
|
|
|
1110
1110
|
|
|
1111
1111
|
/* Override button text to use subtext style */
|
|
1112
1112
|
:global(.file-uploader-button) {
|
|
1113
|
-
font-family: '
|
|
1113
|
+
font-family: 'Inter', sans-serif !important;
|
|
1114
1114
|
font-size: 16px !important;
|
|
1115
1115
|
line-height: 1.4 !important;
|
|
1116
1116
|
font-weight: 400 !important;
|
|
@@ -1119,7 +1119,7 @@
|
|
|
1119
1119
|
/* Override button text to ensure it's not bold */
|
|
1120
1120
|
:global(.file-uploader-button span) {
|
|
1121
1121
|
font-weight: 400 !important;
|
|
1122
|
-
font-family: '
|
|
1122
|
+
font-family: 'Inter', sans-serif !important;
|
|
1123
1123
|
}
|
|
1124
1124
|
|
|
1125
1125
|
/* Make sure drawer appears on top of other elements */
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
|
|
39
39
|
function handleNavigate(index: number): void {
|
|
40
40
|
if (index === currentPath.length - 1) {
|
|
41
|
-
console.log('Already at this path level, skipping navigation');
|
|
41
|
+
// console.log('Already at this path level, skipping navigation');
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (index === -1 && currentPath.length === 0) {
|
|
46
|
-
console.log('Already at root, skipping navigation');
|
|
46
|
+
// console.log('Already at root, skipping navigation');
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
console.log('Navigating to path index:', index);
|
|
50
|
+
// console.log('Navigating to path index:', index);
|
|
51
51
|
dispatch('navigate', index);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -250,54 +250,18 @@
|
|
|
250
250
|
const promises = recentFiles.map(async (file) => {
|
|
251
251
|
try {
|
|
252
252
|
const fileType = getFileType(file.url || file.name);
|
|
253
|
-
const isVideo = fileType === 'video';
|
|
254
|
-
const isSvg = fileType === 'svg';
|
|
255
253
|
const isFont = fileType === 'font';
|
|
256
254
|
|
|
257
|
-
//
|
|
255
|
+
// Load font for display if needed
|
|
258
256
|
if (isFont) {
|
|
259
|
-
|
|
260
|
-
cachedFonts.set(file.id,
|
|
261
|
-
|
|
262
|
-
if (isCached) {
|
|
263
|
-
// For cached fonts, ensure they're loaded for display
|
|
264
|
-
await loadFontForDisplay(file);
|
|
265
|
-
|
|
266
|
-
// Skip loading state for cached fonts
|
|
267
|
-
loadingStates.set(file.id, false);
|
|
268
|
-
errorStates.set(file.id, false);
|
|
269
|
-
file.isMissing = false;
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
257
|
+
await loadFontForDisplay(file);
|
|
258
|
+
cachedFonts.set(file.id, true);
|
|
272
259
|
}
|
|
273
260
|
|
|
274
|
-
//
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (isCached) {
|
|
280
|
-
// Skip loading state for cached SVGs
|
|
281
|
-
loadingStates.set(file.id, false);
|
|
282
|
-
errorStates.set(file.id, false);
|
|
283
|
-
file.isMissing = false;
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// For video and SVG files, only check the file existence
|
|
289
|
-
if (isVideo || isSvg) {
|
|
290
|
-
const fileExists = await checkFileExists(file.url);
|
|
291
|
-
file.isMissing = !fileExists;
|
|
292
|
-
errorStates.set(file.id, !fileExists);
|
|
293
|
-
loadingStates.set(file.id, false);
|
|
294
|
-
} else {
|
|
295
|
-
// For other files, keep existing logic
|
|
296
|
-
const exists = await checkFileExists(file.url);
|
|
297
|
-
file.isMissing = !exists;
|
|
298
|
-
errorStates.set(file.id, !exists);
|
|
299
|
-
loadingStates.set(file.id, false);
|
|
300
|
-
}
|
|
261
|
+
// Mount images/media directly without blocking HEAD request waterfalls
|
|
262
|
+
loadingStates.set(file.id, false);
|
|
263
|
+
errorStates.set(file.id, false);
|
|
264
|
+
file.isMissing = false;
|
|
301
265
|
} catch (error) {
|
|
302
266
|
if(showLogs) console.error('Error checking file:', file.name, error);
|
|
303
267
|
file.isMissing = true;
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
import { persistentSelectStore } from '../../stores/persistentSelectStore';
|
|
29
29
|
import type { FileFilterType } from '../../utils/fileTypes';
|
|
30
30
|
import { selectedFiles } from '../../stores/fileStore';
|
|
31
|
+
import { isMobileStore } from '../../stores/viewportStore';
|
|
31
32
|
import { buildTransformedUrl } from '../../utils/imageTransform';
|
|
32
33
|
import EaseOut from '@tabler/icons-svelte/icons/ease-out';
|
|
33
34
|
import { getAssetUrl } from '../../utils/fileUtils';
|
|
@@ -86,7 +87,8 @@
|
|
|
86
87
|
let fontLoadAttempts = 0;
|
|
87
88
|
const MAX_FONT_LOAD_ATTEMPTS = 3;
|
|
88
89
|
|
|
89
|
-
let isMobile
|
|
90
|
+
export let isMobile: boolean | undefined = undefined;
|
|
91
|
+
$: effectiveIsMobile = isMobile !== undefined ? isMobile : $isMobileStore;
|
|
90
92
|
|
|
91
93
|
// Add these state variables at the top with other state variables
|
|
92
94
|
let isNavigating = true;
|
|
@@ -108,7 +110,7 @@
|
|
|
108
110
|
|
|
109
111
|
// Tweened store for thumbhash fade-in
|
|
110
112
|
let thumbhashOpacity = tweened(0, {
|
|
111
|
-
duration:
|
|
113
|
+
duration: 200,
|
|
112
114
|
easing: cubicOut
|
|
113
115
|
});
|
|
114
116
|
|
|
@@ -190,10 +192,6 @@
|
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
194
|
|
|
193
|
-
function handleResize() {
|
|
194
|
-
isMobile = window.innerWidth <= 768;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
195
|
onMount(() => {
|
|
198
196
|
// console.log('FileItem mounted:', item, isMissing, imageMissing);
|
|
199
197
|
|
|
@@ -264,45 +262,17 @@
|
|
|
264
262
|
}
|
|
265
263
|
}
|
|
266
264
|
|
|
267
|
-
window.addEventListener('resize', handleResize);
|
|
268
|
-
|
|
269
265
|
return () => {
|
|
270
266
|
if (observer) {
|
|
271
267
|
observer.disconnect();
|
|
272
268
|
}
|
|
273
|
-
if (fontFace) {
|
|
274
|
-
try {
|
|
275
|
-
document.fonts.delete(fontFace);
|
|
276
|
-
} catch (error) {
|
|
277
|
-
console.error('Error cleaning up font:', { error, fontName });
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
window.removeEventListener('resize', handleResize);
|
|
281
269
|
};
|
|
282
270
|
});
|
|
283
271
|
|
|
284
272
|
async function checkFileExistence() {
|
|
285
|
-
|
|
286
|
-
// HEAD probes often fail on CDN CORS; the <img> onerror path is the source of truth.
|
|
287
|
-
isLoading = false;
|
|
288
|
-
shouldLoad = true;
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (!isFont) {
|
|
293
|
-
const imageExists = await checkFileExists(item.url, 'image');
|
|
294
|
-
if (imageExists && item.thumbnail) {
|
|
295
|
-
await checkFileExists(item.thumbnail, 'thumbnail');
|
|
296
|
-
}
|
|
297
|
-
item.isMissing = !imageExists;
|
|
298
|
-
if (imageExists) {
|
|
299
|
-
removeMissingFile(item.id);
|
|
300
|
-
} else {
|
|
301
|
-
addMissingFile(item.id);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
273
|
+
// Mount image/thumbnail directly; onerror path is source of truth for missing items
|
|
305
274
|
isLoading = false;
|
|
275
|
+
shouldLoad = true;
|
|
306
276
|
}
|
|
307
277
|
|
|
308
278
|
/**
|
|
@@ -341,16 +311,13 @@
|
|
|
341
311
|
}
|
|
342
312
|
|
|
343
313
|
if ((isVideo || isImage || isAudio) && item.thumbnail) {
|
|
344
|
-
isImageCached = checkImageCache(item.thumbnail);
|
|
345
314
|
return item.thumbnail;
|
|
346
315
|
}
|
|
347
316
|
|
|
348
317
|
if ((isImage || isSvg || isAudio) && item.url) {
|
|
349
|
-
isImageCached = checkImageCache(item.url);
|
|
350
318
|
return item.url;
|
|
351
319
|
}
|
|
352
320
|
|
|
353
|
-
isImageCached = true;
|
|
354
321
|
return getAssetUrl(fileIcon);
|
|
355
322
|
}
|
|
356
323
|
|
|
@@ -487,8 +454,8 @@
|
|
|
487
454
|
<div
|
|
488
455
|
class="file-item-ct relative {thumbnailOnly ? '' : 'w-full'} widgetic-colors widgetic-radius group rounded-[var(--radius-large)]"
|
|
489
456
|
class:cursor-pointer={!isMissing && allowSelecting}
|
|
490
|
-
class:hover:bg-[hsl(var(--grey1))]={!
|
|
491
|
-
class:hover:bg-[hsl(var(--light-green))]={!
|
|
457
|
+
class:hover:bg-[hsl(var(--grey1))]={!effectiveIsMobile && allowSelecting && !isMissing && !selected}
|
|
458
|
+
class:hover:bg-[hsl(var(--light-green))]={!effectiveIsMobile && allowSelecting && !isMissing && selected}
|
|
492
459
|
class:bg-[hsl(var(--light-green))]={selected}
|
|
493
460
|
class:h-[54px]={!thumbnailOnly && !gridLayout}
|
|
494
461
|
class:min-h-[96px]={gridLayout && !thumbnailOnly}
|
|
@@ -571,7 +538,7 @@
|
|
|
571
538
|
referrerpolicy="no-referrer"
|
|
572
539
|
style="opacity: {$opacity}; z-index: 10;"
|
|
573
540
|
onerror={(e: any) => {
|
|
574
|
-
console.log(`[FileItem ${item.name}] Thumbnail error:`, previewSrc);
|
|
541
|
+
// console.log(`[FileItem ${item.name}] Thumbnail error:`, previewSrc);
|
|
575
542
|
const imgEl = e.currentTarget as HTMLImageElement;
|
|
576
543
|
if (imgEl.srcset) {
|
|
577
544
|
imgEl.srcset = '';
|
|
@@ -645,7 +612,7 @@
|
|
|
645
612
|
<div class="absolute top-[17px] right-4 z-10">
|
|
646
613
|
<button
|
|
647
614
|
class="w-5 h-5 text-[hsl(var(--error))] opacity-0 group-hover:opacity-100 transition-opacity duration-200"
|
|
648
|
-
class:!opacity-100={
|
|
615
|
+
class:!opacity-100={effectiveIsMobile}
|
|
649
616
|
onclick={(e) => {
|
|
650
617
|
e.stopPropagation();
|
|
651
618
|
dispatch('delete', { item });
|
|
@@ -22,6 +22,7 @@ declare const FileItem: $$__sveltets_2_IsomorphicComponent<{
|
|
|
22
22
|
preventFontLoad?: boolean;
|
|
23
23
|
currentFilter?: FileFilterType;
|
|
24
24
|
/** Vertical grid cell (icon above centered label). */ gridLayout?: boolean;
|
|
25
|
+
isMobile?: boolean | undefined;
|
|
25
26
|
}, {
|
|
26
27
|
delete: CustomEvent<any>;
|
|
27
28
|
click: CustomEvent<any>;
|
|
@@ -4,24 +4,16 @@
|
|
|
4
4
|
import { getFolderIcon } from '../../utils/folderUtils';
|
|
5
5
|
import { type FileFilterType } from '../../utils/fileTypes';
|
|
6
6
|
import { DropdownMenu } from '../ui';
|
|
7
|
-
import {
|
|
7
|
+
import { isMobileStore } from '../../stores/viewportStore';
|
|
8
8
|
|
|
9
9
|
export let item: FolderItemWithCount;
|
|
10
10
|
export let currentFilter: FileFilterType = 'all';
|
|
11
11
|
export let gridLayout = false;
|
|
12
|
+
export let isMobile: boolean | undefined = undefined;
|
|
12
13
|
|
|
13
14
|
const dispatch = createEventDispatcher();
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function handleResize() {
|
|
18
|
-
isMobile = window.innerWidth <= 768;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
onMount(() => {
|
|
22
|
-
window.addEventListener('resize', handleResize);
|
|
23
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
24
|
-
});
|
|
16
|
+
$: effectiveIsMobile = isMobile !== undefined ? isMobile : $isMobileStore;
|
|
25
17
|
|
|
26
18
|
function handleIconClick(event: Event) {
|
|
27
19
|
event.stopPropagation();
|
|
@@ -68,7 +60,7 @@
|
|
|
68
60
|
</div>
|
|
69
61
|
|
|
70
62
|
<div
|
|
71
|
-
class="fb-folder-menu-ct opacity-0 group-hover:opacity-100 transition-opacity duration-200 w-5 h-5 {
|
|
63
|
+
class="fb-folder-menu-ct opacity-0 group-hover:opacity-100 transition-opacity duration-200 w-5 h-5 {effectiveIsMobile ? '!opacity-100' : ''} {gridLayout ? 'mt-0.5' : 'absolute right-4 top-1/2 -translate-y-1/2'}"
|
|
72
64
|
>
|
|
73
65
|
<DropdownMenu isFolder={true} on:action={handleDropdownAction} />
|
|
74
66
|
</div>
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
|
|
57
57
|
// Add a reactive statement to log when the dialog opens
|
|
58
58
|
$: if (isOpen) {
|
|
59
|
-
console.log('MoveDialog opened with:', {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
59
|
+
// console.log('MoveDialog opened with:', {
|
|
60
|
+
// sourceItems: sourceItems.map(item => ({
|
|
61
|
+
// id: item.id,
|
|
62
|
+
// name: item.name,
|
|
63
|
+
// type: item.type
|
|
64
|
+
// })),
|
|
65
|
+
// itemCount: sourceItems.length,
|
|
66
|
+
// hasFolders: sourceItems.some(item => item.type === 'folder')
|
|
67
|
+
// });
|
|
68
68
|
// Reset selection when dialog opens
|
|
69
69
|
selectedFolder = undefined;
|
|
70
70
|
}
|
|
@@ -127,11 +127,11 @@
|
|
|
127
127
|
* @param targetFolderId ID of the destination folder
|
|
128
128
|
*/
|
|
129
129
|
async function handleMove(targetFolderId: string) {
|
|
130
|
-
console.log('handleMove called with:', {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
130
|
+
// console.log('handleMove called with:', {
|
|
131
|
+
// targetFolderId,
|
|
132
|
+
// sourceItems,
|
|
133
|
+
// itemCount
|
|
134
|
+
// });
|
|
135
135
|
|
|
136
136
|
if (!targetFolderId) {
|
|
137
137
|
toast.error(
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
try {
|
|
165
|
-
const actualTargetId = targetFolderId === 'root' ? '' : targetFolderId;
|
|
165
|
+
const actualTargetId = (targetFolderId === 'root' || targetFolderId === $fileStore?.root?.id) ? '' : targetFolderId;
|
|
166
166
|
const movedItems: { id: string; name: string }[] = [];
|
|
167
167
|
|
|
168
168
|
// Helper function to find the complete path to a folder
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
|
|
190
190
|
// Get the complete path to the target folder
|
|
191
191
|
const targetPath = actualTargetId ? findFolderPath($fileStore.root, actualTargetId) : [];
|
|
192
|
-
console.log('Found target path:', targetPath);
|
|
192
|
+
// console.log('Found target path:', targetPath);
|
|
193
193
|
|
|
194
194
|
// Move all items at once
|
|
195
195
|
const results = await Promise.allSettled(
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
});
|
|
229
229
|
|
|
230
230
|
// Clear the item from selections
|
|
231
|
-
persistentSelectStore.
|
|
231
|
+
persistentSelectStore.removeSelection(sourceItem.id, currentFilter);
|
|
232
232
|
|
|
233
233
|
// Dispatch move event for each successful move
|
|
234
234
|
dispatch('move', {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
// Svelte imports
|
|
14
|
-
import { onMount } from 'svelte';
|
|
14
|
+
import { onMount, onDestroy } from 'svelte';
|
|
15
15
|
import { createEventDispatcher } from 'svelte';
|
|
16
16
|
const dispatch = createEventDispatcher();
|
|
17
17
|
|
|
@@ -74,18 +74,34 @@
|
|
|
74
74
|
activeIndex = index;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
let searchDebounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
78
|
+
|
|
79
|
+
onDestroy(() => {
|
|
80
|
+
if (searchDebounceTimer) {
|
|
81
|
+
clearTimeout(searchDebounceTimer);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
77
85
|
/**
|
|
78
86
|
* Reactive statement to update search results when search term changes
|
|
79
|
-
* Filters results based on current filter type and excludes root folder
|
|
87
|
+
* Filters results based on current filter type and excludes root folder.
|
|
88
|
+
* Debounced by 150ms to prevent expensive full-tree traversals on every keystroke.
|
|
80
89
|
*/
|
|
81
90
|
$: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
const term = $searchTermStore?.trim().toLowerCase();
|
|
92
|
+
const filter = currentFilter;
|
|
93
|
+
const root = $fileStore.root;
|
|
94
|
+
|
|
95
|
+
if (searchDebounceTimer) {
|
|
96
|
+
clearTimeout(searchDebounceTimer);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (term) {
|
|
100
|
+
searchDebounceTimer = setTimeout(() => {
|
|
101
|
+
searchResults = searchFileSystem(root, term)
|
|
102
|
+
.filter(item => item.name !== 'Root' && (item.type === 'folder' || matchesFilter(item)));
|
|
103
|
+
activeIndex = 0;
|
|
104
|
+
}, 150);
|
|
89
105
|
} else {
|
|
90
106
|
searchResults = [];
|
|
91
107
|
activeIndex = -1;
|
|
@@ -168,9 +184,9 @@
|
|
|
168
184
|
* Updates current path and closes search modal
|
|
169
185
|
*/
|
|
170
186
|
function handleResultClick(item: FileSystemItem) {
|
|
171
|
-
console.log('handleResultClick called with item:', item);
|
|
187
|
+
// console.log('handleResultClick called with item:', item);
|
|
172
188
|
const idPath = findItemPath($fileStore.root, item);
|
|
173
|
-
console.log('ID Path found:', idPath);
|
|
189
|
+
// console.log('ID Path found:', idPath);
|
|
174
190
|
|
|
175
191
|
if (idPath) {
|
|
176
192
|
// Remove root ID from the beginning of the path
|
|
@@ -184,7 +200,7 @@
|
|
|
184
200
|
}, 100);
|
|
185
201
|
}
|
|
186
202
|
|
|
187
|
-
console.log('Dispatching navigate event with ID path:', folderPath);
|
|
203
|
+
// console.log('Dispatching navigate event with ID path:', folderPath);
|
|
188
204
|
dispatch('navigate', { path: folderPath });
|
|
189
205
|
} else {
|
|
190
206
|
console.error('Path not found for item:', item);
|
|
@@ -228,7 +244,7 @@
|
|
|
228
244
|
const fileType = getFileType(item.url || item.name);
|
|
229
245
|
const matches = fileType === currentFilter;
|
|
230
246
|
if (fileType === 'font') {
|
|
231
|
-
console.log('Font file found in search:', item.name, 'URL:', item.url);
|
|
247
|
+
// console.log('Font file found in search:', item.name, 'URL:', item.url);
|
|
232
248
|
}
|
|
233
249
|
// console.log('Item matches filter:', matches);
|
|
234
250
|
return matches;
|
|
@@ -308,33 +324,6 @@
|
|
|
308
324
|
// console.log('Item path for', item.name, ':', path?.join('/') || '');
|
|
309
325
|
return path ? path.join('/') : item.id; // Fallback to ID if path not found
|
|
310
326
|
}
|
|
311
|
-
|
|
312
|
-
// Add logging to the search results
|
|
313
|
-
$: {
|
|
314
|
-
if ($searchTermStore) {
|
|
315
|
-
// Make this reactive statement depend on currentFilter as well
|
|
316
|
-
searchResults = searchFileSystem($fileStore.root, $searchTermStore.toLowerCase())
|
|
317
|
-
.filter(item => item.name !== 'Root' && (item.type === 'folder' || matchesFilter(item)));
|
|
318
|
-
console.log(`Search results filtered by '${currentFilter}' type:`, searchResults.length);
|
|
319
|
-
activeIndex = 0;
|
|
320
|
-
} else {
|
|
321
|
-
searchResults = [];
|
|
322
|
-
activeIndex = -1;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// Add a new reactive statement specifically for filter changes
|
|
327
|
-
$: if (currentFilter) {
|
|
328
|
-
// console.log('Filter changed to:', currentFilter);
|
|
329
|
-
// If we have an existing search term, re-filter the results
|
|
330
|
-
if ($searchTermStore) {
|
|
331
|
-
searchResults = searchFileSystem($fileStore.root, $searchTermStore.toLowerCase())
|
|
332
|
-
.filter(item => item.name !== 'Root' && (item.type === 'folder' || matchesFilter(item)));
|
|
333
|
-
console.log(`Re-filtered search results by '${currentFilter}' type:`, searchResults.length);
|
|
334
|
-
// Reset the active index when filter changes
|
|
335
|
-
activeIndex = 0;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
327
|
</script>
|
|
339
328
|
|
|
340
329
|
<!-- Search Modal Layout -->
|
|
@@ -390,7 +379,7 @@
|
|
|
390
379
|
bind:this={resultsContainer}
|
|
391
380
|
style="min-height: {scrolledAreaMaxHeight}px; padding: 0;"
|
|
392
381
|
>
|
|
393
|
-
{#each searchResults as result, index (
|
|
382
|
+
{#each searchResults as result, index (result.id || `${result.type}-${index}`)}
|
|
394
383
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
395
384
|
<div
|
|
396
385
|
class="search-result-item relative w-full mx-auto rounded-large widgetic-radius"
|
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
? idPath.slice(1, -1) // Remove root ID and file ID
|
|
125
125
|
: idPath.slice(0, -1); // Just remove file ID
|
|
126
126
|
|
|
127
|
-
console.log('Found ID path:', idPath);
|
|
128
|
-
console.log('Folder path to navigate to:', folderPath);
|
|
127
|
+
// console.log('Found ID path:', idPath);
|
|
128
|
+
// console.log('Folder path to navigate to:', folderPath);
|
|
129
129
|
|
|
130
130
|
// Close the modal first
|
|
131
131
|
dispatch('close');
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
$: currentIndex = currentFiles.findIndex((f: FileSystemItem) => f.id === file.id);
|
|
145
145
|
|
|
146
146
|
function findNextAvailableFile(startIndex: number, direction: 'next' | 'prev'): FileSystemItem | null {
|
|
147
|
-
console.log('Finding next available file from index:', startIndex, 'direction:', direction);
|
|
147
|
+
// console.log('Finding next available file from index:', startIndex, 'direction:', direction);
|
|
148
148
|
let index = startIndex;
|
|
149
149
|
const totalFiles = currentFiles.length;
|
|
150
150
|
|
|
@@ -177,18 +177,18 @@
|
|
|
177
177
|
|
|
178
178
|
if (event.key === 'ArrowLeft') {
|
|
179
179
|
event.preventDefault();
|
|
180
|
-
console.log('Left arrow pressed, current index:', currentIndex);
|
|
180
|
+
// console.log('Left arrow pressed, current index:', currentIndex);
|
|
181
181
|
const prevFile = findNextAvailableFile(currentIndex, 'prev');
|
|
182
182
|
if (prevFile) {
|
|
183
|
-
console.log('Navigating to previous file:', prevFile.name);
|
|
183
|
+
// console.log('Navigating to previous file:', prevFile.name);
|
|
184
184
|
dispatch('navigate', prevFile);
|
|
185
185
|
}
|
|
186
186
|
} else if (event.key === 'ArrowRight') {
|
|
187
187
|
event.preventDefault();
|
|
188
|
-
console.log('Right arrow pressed, current index:', currentIndex);
|
|
188
|
+
// console.log('Right arrow pressed, current index:', currentIndex);
|
|
189
189
|
const nextFile = findNextAvailableFile(currentIndex, 'next');
|
|
190
190
|
if (nextFile) {
|
|
191
|
-
console.log('Navigating to next file:', nextFile.name);
|
|
191
|
+
// console.log('Navigating to next file:', nextFile.name);
|
|
192
192
|
dispatch('navigate', nextFile);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
if (videoElement || audioElement) {
|
|
261
261
|
const mediaElement = videoElement || audioElement;
|
|
262
262
|
mediaElement.play().catch(error => {
|
|
263
|
-
console.log('Autoplay prevented:', error);
|
|
263
|
+
// console.log('Autoplay prevented:', error);
|
|
264
264
|
// Handle cases where autoplay is blocked by browser policy
|
|
265
265
|
});
|
|
266
266
|
}
|
|
@@ -436,7 +436,7 @@
|
|
|
436
436
|
url={fileUrl}
|
|
437
437
|
enableCacheClearing={true}
|
|
438
438
|
on:error={(e) => pdfLoadError = e.detail.message || 'Error loading PDF'}
|
|
439
|
-
on:cacheCleared={() => console.log('PDF cache cleared from FilePreview')}
|
|
439
|
+
on:cacheCleared={() => { /* console.log('PDF cache cleared from FilePreview'); */ }}
|
|
440
440
|
/>
|
|
441
441
|
{:else}
|
|
442
442
|
<p class="no-preview-container text-center py-8">Preview not available for this file type.</p>
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
// Subscribe to opacity changes for debugging
|
|
63
63
|
$: if (debugMode && $containerOpacity !== lastOpacityValue) {
|
|
64
|
-
console.log(`[DEBUG] Container opacity changed: ${lastOpacityValue.toFixed(2)} -> ${$containerOpacity.toFixed(2)}, Phase: ${transitionPhase}`);
|
|
64
|
+
// console.log(`[DEBUG] Container opacity changed: ${lastOpacityValue.toFixed(2)} -> ${$containerOpacity.toFixed(2)}, Phase: ${transitionPhase}`);
|
|
65
65
|
lastOpacityValue = $containerOpacity;
|
|
66
66
|
logElementStates();
|
|
67
67
|
}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
// Function to clean up any pending image requests
|
|
72
72
|
function cleanupPreviousImage() {
|
|
73
|
-
if (debugMode) console.log(`[DEBUG] Cleaning up previous image, current key: ${imageKey}, new key will be: ${imageKey + 1}`);
|
|
73
|
+
// if (debugMode) console.log(`[DEBUG] Cleaning up previous image, current key: ${imageKey}, new key will be: ${imageKey + 1}`);
|
|
74
74
|
|
|
75
75
|
// Increment the key to force component recreation
|
|
76
76
|
imageKey++;
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
if (container) {
|
|
176
176
|
// Log all image containers
|
|
177
177
|
const imageContainers = container.querySelectorAll('.image-container');
|
|
178
|
-
console.log(`[DEBUG] Found ${imageContainers.length} image containers`);
|
|
178
|
+
// console.log(`[DEBUG] Found ${imageContainers.length} image containers`);
|
|
179
179
|
|
|
180
180
|
imageContainers.forEach((container, index) => {
|
|
181
181
|
const containerKey = container.getAttribute('data-image-key');
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
const opacity = getComputedStyle(htmlContainer).opacity;
|
|
186
186
|
const visibility = getComputedStyle(htmlContainer).visibility;
|
|
187
187
|
|
|
188
|
-
console.log(`[DEBUG] Container ${index}: key=${containerKey}, src=${containerSrc}, display=${display}, opacity=${opacity}, visibility=${visibility}`);
|
|
188
|
+
// console.log(`[DEBUG] Container ${index}: key=${containerKey}, src=${containerSrc}, display=${display}, opacity=${opacity}, visibility=${visibility}`);
|
|
189
189
|
|
|
190
190
|
// Log thumbhash and main image states
|
|
191
191
|
const thumbhashImg = container.querySelector('img[data-thumbhash]') as HTMLImageElement;
|
|
@@ -199,10 +199,10 @@
|
|
|
199
199
|
`visible: ${!!(mainImg.offsetWidth || mainImg.offsetHeight)}, opacity: ${getComputedStyle(mainImg).opacity}, display: ${getComputedStyle(mainImg).display}` :
|
|
200
200
|
'not found';
|
|
201
201
|
|
|
202
|
-
console.log(`[DEBUG] Container ${index} images:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
`);
|
|
202
|
+
// console.log(`[DEBUG] Container ${index} images:
|
|
203
|
+
// - Thumbhash: ${thumbhashState}
|
|
204
|
+
// - Main Image: ${mainImgState}
|
|
205
|
+
// `);
|
|
206
206
|
});
|
|
207
207
|
|
|
208
208
|
elementStates.push({
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
if (img && img.complete && img.naturalWidth > 0) {
|
|
230
230
|
updateDimensions(img.naturalWidth, img.naturalHeight);
|
|
231
231
|
imgElement = img;
|
|
232
|
-
if (debugMode) console.log(`[DEBUG] Found main image element, dimensions: ${img.naturalWidth}x${img.naturalHeight}`);
|
|
232
|
+
// if (debugMode) console.log(`[DEBUG] Found main image element, dimensions: ${img.naturalWidth}x${img.naturalHeight}`);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
}
|
|
@@ -247,14 +247,14 @@
|
|
|
247
247
|
for (const mutation of mutations) {
|
|
248
248
|
if (mutation.type === 'childList') {
|
|
249
249
|
if (mutation.addedNodes.length > 0) {
|
|
250
|
-
console.log(`[DEBUG] DOM nodes added:`, Array.from(mutation.addedNodes).map(node => node.nodeName));
|
|
250
|
+
// console.log(`[DEBUG] DOM nodes added:`, Array.from(mutation.addedNodes).map(node => node.nodeName));
|
|
251
251
|
}
|
|
252
252
|
if (mutation.removedNodes.length > 0) {
|
|
253
|
-
console.log(`[DEBUG] DOM nodes removed:`, Array.from(mutation.removedNodes).map(node => node.nodeName));
|
|
253
|
+
// console.log(`[DEBUG] DOM nodes removed:`, Array.from(mutation.removedNodes).map(node => node.nodeName));
|
|
254
254
|
}
|
|
255
255
|
} else if (mutation.type === 'attributes') {
|
|
256
256
|
const target = mutation.target as HTMLElement;
|
|
257
|
-
console.log(`[DEBUG] Attribute changed: ${mutation.attributeName} on ${target.nodeName}${target.id ? '#'+target.id : ''}, new value: ${target.getAttribute(mutation.attributeName || '')}`);
|
|
257
|
+
// console.log(`[DEBUG] Attribute changed: ${mutation.attributeName} on ${target.nodeName}${target.id ? '#'+target.id : ''}, new value: ${target.getAttribute(mutation.attributeName || '')}`);
|
|
258
258
|
}
|
|
259
259
|
logElementStates();
|
|
260
260
|
}
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
attributeFilter: ['style', 'class', 'data-thumbhash', 'data-image-key']
|
|
268
268
|
});
|
|
269
269
|
|
|
270
|
-
console.log(`[DEBUG] DOM observer set up`);
|
|
270
|
+
// console.log(`[DEBUG] DOM observer set up`);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|