@cp949/mui-react19 1.0.0

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 (41) hide show
  1. package/README.file-drop.md +843 -0
  2. package/README.md +211 -0
  3. package/dist/chunk-3KMZF7M6.cjs +2 -0
  4. package/dist/chunk-3KMZF7M6.cjs.map +1 -0
  5. package/dist/chunk-4C666HHU.js +2 -0
  6. package/dist/chunk-4C666HHU.js.map +1 -0
  7. package/dist/chunk-M4G6J7DP.cjs +2 -0
  8. package/dist/chunk-M4G6J7DP.cjs.map +1 -0
  9. package/dist/chunk-T37ZYZXP.js +2 -0
  10. package/dist/chunk-T37ZYZXP.js.map +1 -0
  11. package/dist/closables-BK0Db72u.d.cts +135 -0
  12. package/dist/closables-BK0Db72u.d.ts +135 -0
  13. package/dist/file-drop/index.cjs +2 -0
  14. package/dist/file-drop/index.cjs.map +1 -0
  15. package/dist/file-drop/index.d.cts +748 -0
  16. package/dist/file-drop/index.d.ts +748 -0
  17. package/dist/file-drop/index.js +2 -0
  18. package/dist/file-drop/index.js.map +1 -0
  19. package/dist/helper/index.cjs +2 -0
  20. package/dist/helper/index.cjs.map +1 -0
  21. package/dist/helper/index.d.cts +113 -0
  22. package/dist/helper/index.d.ts +113 -0
  23. package/dist/helper/index.js +2 -0
  24. package/dist/helper/index.js.map +1 -0
  25. package/dist/hooks/index.cjs +2 -0
  26. package/dist/hooks/index.cjs.map +1 -0
  27. package/dist/hooks/index.d.cts +1319 -0
  28. package/dist/hooks/index.d.ts +1319 -0
  29. package/dist/hooks/index.js +2 -0
  30. package/dist/hooks/index.js.map +1 -0
  31. package/dist/index.cjs +2 -0
  32. package/dist/index.cjs.map +1 -0
  33. package/dist/index.d.cts +910 -0
  34. package/dist/index.d.ts +910 -0
  35. package/dist/index.js +2 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/parallel-map-M764G6IE.js +2 -0
  38. package/dist/parallel-map-M764G6IE.js.map +1 -0
  39. package/dist/parallel-map-V2OVUIFQ.cjs +2 -0
  40. package/dist/parallel-map-V2OVUIFQ.cjs.map +1 -0
  41. package/package.json +117 -0
@@ -0,0 +1,748 @@
1
+ /**
2
+ * 기본 파일/디렉토리 아이템을 나타내는 인터페이스
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const item: FileItem = {
7
+ * type: 'file',
8
+ * name: 'example.txt',
9
+ * path: '/folder/example.txt',
10
+ * pathSegments: ['folder', 'example.txt'],
11
+ * size: 1024,
12
+ * lastModified: new Date(),
13
+ * relativePath: 'folder/example.txt'
14
+ * };
15
+ * ```
16
+ */
17
+ interface FileItem {
18
+ /** 아이템 타입 - 파일 또는 디렉토리 */
19
+ type: 'file' | 'directory';
20
+ /** 파일/디렉토리 이름 (확장자 포함) */
21
+ name: string;
22
+ /** 전체 경로 (루트부터 시작) */
23
+ path: string;
24
+ /** 경로를 세그먼트로 분할한 배열 */
25
+ pathSegments: string[];
26
+ /** 파일 크기 (바이트 단위, 디렉토리의 경우 optional) */
27
+ size?: number;
28
+ /** 마지막 수정 날짜 */
29
+ lastModified?: Date;
30
+ /** 드롭 루트로부터의 상대 경로 */
31
+ relativePath: string;
32
+ }
33
+ /**
34
+ * 처리 완료된 파일 정보
35
+ * FileItem을 확장하여 실제 File 객체와 MIME 타입 정보 포함
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const processedFile: ProcessedFile = {
40
+ * type: 'file',
41
+ * name: 'image.jpg',
42
+ * file: fileObject,
43
+ * mimeType: 'image/jpeg',
44
+ * extension: '.jpg',
45
+ * // ... 기타 FileItem 속성들
46
+ * };
47
+ * ```
48
+ */
49
+ interface ProcessedFile extends FileItem {
50
+ /** 항상 'file' 타입 */
51
+ type: 'file';
52
+ /** 브라우저의 File 객체 */
53
+ file: File;
54
+ /** MIME 타입 (예: 'image/jpeg', 'text/plain') */
55
+ mimeType: string;
56
+ /** 파일 확장자 (점 포함, 예: '.jpg', '.txt') */
57
+ extension: string;
58
+ }
59
+ /**
60
+ * 처리 완료된 디렉토리 정보
61
+ * FileItem을 확장하여 자식 요소들 포함 가능
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const processedDir: ProcessedDirectory = {
66
+ * type: 'directory',
67
+ * name: 'images',
68
+ * children: [file1, file2],
69
+ * // ... 기타 FileItem 속성들
70
+ * };
71
+ * ```
72
+ */
73
+ interface ProcessedDirectory extends FileItem {
74
+ /** 항상 'directory' 타입 */
75
+ type: 'directory';
76
+ /** 하위 파일/디렉토리 목록 (optional) */
77
+ children?: FileItem[];
78
+ }
79
+ /**
80
+ * 파일 트리 구조를 나타내는 노드
81
+ * 계층적 파일 시스템 구조를 트리 형태로 표현
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const treeNode: FileTreeNode = {
86
+ * name: 'project',
87
+ * type: 'directory',
88
+ * path: '/project',
89
+ * children: [
90
+ * {
91
+ * name: 'src',
92
+ * type: 'directory',
93
+ * path: '/project/src',
94
+ * children: [...]
95
+ * },
96
+ * {
97
+ * name: 'package.json',
98
+ * type: 'file',
99
+ * path: '/project/package.json',
100
+ * file: fileObject,
101
+ * metadata: { size: 1024, ... }
102
+ * }
103
+ * ]
104
+ * };
105
+ * ```
106
+ */
107
+ interface FileTreeNode {
108
+ /** 노드 이름 */
109
+ name: string;
110
+ /** 노드 타입 */
111
+ type: 'file' | 'directory';
112
+ /** 노드의 전체 경로 */
113
+ path: string;
114
+ /** 자식 노드들 (디렉토리인 경우) */
115
+ children?: FileTreeNode[];
116
+ /** 파일 객체 (파일 노드인 경우) */
117
+ file?: File;
118
+ /** 파일 메타데이터 (파일 노드인 경우) */
119
+ metadata?: FileMetadata;
120
+ }
121
+ /**
122
+ * 파일의 메타데이터 정보
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const metadata: FileMetadata = {
127
+ * size: 2048,
128
+ * lastModified: new Date('2023-12-01'),
129
+ * mimeType: 'application/json',
130
+ * extension: '.json'
131
+ * };
132
+ * ```
133
+ */
134
+ interface FileMetadata {
135
+ /** 파일 크기 (바이트 단위) */
136
+ size: number;
137
+ /** 마지막 수정 날짜 */
138
+ lastModified: Date;
139
+ /** MIME 타입 (optional) */
140
+ mimeType?: string;
141
+ /** 파일 확장자 (점 포함) */
142
+ extension: string;
143
+ }
144
+ /**
145
+ * 파일 처리 진행 상황 정보
146
+ * onProgress 콜백에서 제공되는 진행률 데이터
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * const progress: ProgressInfo = {
151
+ * totalItems: 100,
152
+ * processedItems: 45,
153
+ * currentItem: { name: 'loading.txt', ... },
154
+ * percentage: 45,
155
+ * estimatedTimeLeft: 2300
156
+ * };
157
+ * ```
158
+ */
159
+ interface ProgressInfo {
160
+ /** 전체 처리할 아이템 수 */
161
+ totalItems: number;
162
+ /** 현재까지 처리된 아이템 수 */
163
+ processedItems: number;
164
+ /** 현재 처리 중인 아이템 (optional) */
165
+ currentItem?: FileItem;
166
+ /** 진행률 퍼센트 (0-100) */
167
+ percentage: number;
168
+ /** 예상 남은 시간 (밀리초, optional) */
169
+ estimatedTimeLeft?: number;
170
+ }
171
+ /**
172
+ * 파일 드롭 처리 중 발생할 수 있는 에러 코드
173
+ *
174
+ * @example
175
+ * ```ts
176
+ * // 각 에러 코드의 의미:
177
+ * 'UNSUPPORTED_API' // 브라우저가 File API를 지원하지 않음
178
+ * 'FILE_TOO_LARGE' // 파일 크기가 허용된 최대 크기 초과
179
+ * 'ACCESS_DENIED' // 파일 접근 권한 거부됨
180
+ * 'INVALID_FILE_TYPE' // 허용되지 않은 파일 형식
181
+ * 'TOO_MANY_FILES' // 허용된 최대 파일 수 초과
182
+ * 'UNKNOWN' // 기타 알 수 없는 에러
183
+ * ```
184
+ */
185
+ type FileDropErrorCode = 'UNSUPPORTED_API' | 'FILE_TOO_LARGE' | 'ACCESS_DENIED' | 'INVALID_FILE_TYPE' | 'TOO_MANY_FILES' | 'UNKNOWN';
186
+ /**
187
+ * 파일 드롭 처리 중 발생하는 에러를 나타내는 클래스
188
+ * 표준 Error를 확장하여 에러 코드와 관련 아이템 정보 포함
189
+ *
190
+ * @example
191
+ * ```ts
192
+ * throw new FileDropError(
193
+ * 'FILE_TOO_LARGE',
194
+ * fileItem,
195
+ * 'File size exceeds 10MB limit'
196
+ * );
197
+ *
198
+ * // 에러 처리
199
+ * try {
200
+ * await processFileTreeDrop(event);
201
+ * } catch (error) {
202
+ * if (error instanceof FileDropError) {
203
+ * console.log(`Error code: ${error.code}`);
204
+ * console.log(`Failed item: ${error.item?.name}`);
205
+ * }
206
+ * }
207
+ * ```
208
+ */
209
+ declare class FileDropError extends Error {
210
+ /** 에러 코드 */
211
+ code: FileDropErrorCode;
212
+ /** 에러와 관련된 파일/디렉토리 아이템 (optional) */
213
+ item?: FileItem | undefined;
214
+ constructor(
215
+ /** 에러 코드 */
216
+ code: FileDropErrorCode,
217
+ /** 에러와 관련된 파일/디렉토리 아이템 (optional) */
218
+ item?: FileItem | undefined,
219
+ /** 에러 메시지 (optional, 기본값 자동 생성) */
220
+ message?: string);
221
+ }
222
+ /**
223
+ * 파일 필터링 옵션
224
+ * 처리할 파일들을 제한하고 필터링하는 설정
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * const filterOptions: FilterOptions = {
229
+ * maxSize: 10 * 1024 * 1024, // 10MB 제한
230
+ * maxFiles: 50, // 최대 50개 파일
231
+ * allowedExtensions: ['.jpg', '.png', '.gif'],
232
+ * accept: (item) => !item.name.startsWith('.'), // 숨김 파일 제외
233
+ * excludeDirectories: false // 디렉토리도 포함
234
+ * };
235
+ * ```
236
+ */
237
+ interface FilterOptions {
238
+ /** 커스텀 필터 함수 - true 반환시 파일 허용 */
239
+ accept?: (item: FileItem) => boolean;
240
+ /** 최대 파일 크기 (바이트 단위) */
241
+ maxSize?: number;
242
+ /** 최대 파일 개수 */
243
+ maxFiles?: number;
244
+ /** 허용할 파일 확장자 목록 (점 포함, 예: ['.jpg', '.png']) */
245
+ allowedExtensions?: string[];
246
+ /** true시 디렉토리 제외하고 파일만 처리 */
247
+ excludeDirectories?: boolean;
248
+ }
249
+ /**
250
+ * 파일 처리 옵션
251
+ * 성능과 처리 방식을 제어하는 설정
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * const processingOptions: ProcessingOptions = {
256
+ * parallel: true, // 병렬 처리 활성화
257
+ * concurrency: 4, // 동시 처리 수 4개
258
+ * preserveStructure: true // 디렉토리 구조 유지
259
+ * };
260
+ * ```
261
+ */
262
+ interface ProcessingOptions {
263
+ /** 병렬 처리 사용 여부 (기본: true) */
264
+ parallel?: boolean;
265
+ /** 동시 처리할 파일 수 (기본: 4) */
266
+ concurrency?: number;
267
+ /** 디렉토리 구조 정보 유지 여부 (기본: true) */
268
+ preserveStructure?: boolean;
269
+ }
270
+ /**
271
+ * 콜백 옵션
272
+ * 처리 과정에서 호출될 콜백 함수들
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * const callbacks: CallbackOptions = {
277
+ * onProgress: (progress) => {
278
+ * console.log(`진행률: ${progress.percentage}%`);
279
+ * },
280
+ * onError: (error, item) => {
281
+ * console.error(`${item?.name} 처리 실패: ${error.message}`);
282
+ * },
283
+ * onFile: (file) => {
284
+ * console.log(`파일 처리 완료: ${file.name}`);
285
+ * }
286
+ * };
287
+ * ```
288
+ */
289
+ interface CallbackOptions {
290
+ /** 진행상황 업데이트시 호출되는 콜백 */
291
+ onProgress?: (progress: ProgressInfo) => void;
292
+ /** 에러 발생시 호출되는 콜백 */
293
+ onError?: (error: FileDropError, item?: FileItem) => void;
294
+ /** 각 파일 처리 완료시 호출되는 콜백 */
295
+ onFile?: (file: ProcessedFile) => void;
296
+ }
297
+ /**
298
+ * processFileTreeDrop 함수의 전체 옵션
299
+ * 모든 설정을 한 곳에서 관리
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * const options: FileDropOptions = {
304
+ * filter: {
305
+ * maxSize: 10 * 1024 * 1024,
306
+ * allowedExtensions: ['.jpg', '.png']
307
+ * },
308
+ * processing: {
309
+ * parallel: true,
310
+ * concurrency: 4
311
+ * },
312
+ * callbacks: {
313
+ * onProgress: (prog) => console.log(`${prog.percentage}%`)
314
+ * },
315
+ * includeMetadata: true,
316
+ * signal: abortController.signal
317
+ * };
318
+ *
319
+ * const result = await processFileTreeDrop(event, options);
320
+ * ```
321
+ */
322
+ interface FileDropOptions {
323
+ /** 파일 필터링 옵션 */
324
+ filter?: FilterOptions;
325
+ /** 처리 방식 옵션 */
326
+ processing?: ProcessingOptions;
327
+ /** 콜백 함수들 */
328
+ callbacks?: CallbackOptions;
329
+ /** 상세한 메타데이터 포함 여부 (기본: true) */
330
+ includeMetadata?: boolean;
331
+ /** 처리 중단을 위한 AbortSignal */
332
+ signal?: AbortSignal;
333
+ /**
334
+ * 디버그 로그 출력 레벨
335
+ * - 'none': 로그 비활성화 (기본값)
336
+ * - 'info': 주요 단계와 요약 정보만 출력
337
+ * - 'verbose': 파일/디렉터리 단위의 상세 로그 포함
338
+ *
339
+ * 기존 boolean 옵션과의 호환을 위해 true는 'verbose', false는 'none'으로 간주합니다.
340
+ */
341
+ debug?: DebugLevel | boolean;
342
+ }
343
+ /** 디버그 로그 출력 레벨 */
344
+ type DebugLevel = 'none' | 'info' | 'verbose';
345
+ /**
346
+ * 파일 트리 처리 성공 결과
347
+ * processFileTreeDrop 함수가 정상 완료시 반환하는 데이터
348
+ *
349
+ * @example
350
+ * ```ts
351
+ * const result: ProcessResult = {
352
+ * files: [
353
+ * { name: 'image.jpg', type: 'file', file: fileObj, ... },
354
+ * { name: 'document.pdf', type: 'file', file: fileObj2, ... }
355
+ * ],
356
+ * directories: [
357
+ * { name: 'photos', type: 'directory', children: [...] }
358
+ * ],
359
+ * tree: {
360
+ * name: 'root',
361
+ * type: 'directory',
362
+ * children: [...] // 계층 구조
363
+ * },
364
+ * metadata: {
365
+ * totalFiles: 25,
366
+ * totalDirectories: 3,
367
+ * totalSize: 1024 * 1024 * 5, // 5MB
368
+ * processingTime: 1250 // 1.25초
369
+ * },
370
+ * errors: [] // 에러 발생시 정보 포함
371
+ * };
372
+ * ```
373
+ */
374
+ interface ProcessResult {
375
+ /** 처리된 모든 파일들 */
376
+ files: ProcessedFile[];
377
+ /** 처리된 모든 디렉토리들 */
378
+ directories: ProcessedDirectory[];
379
+ /** 계층 구조를 나타내는 트리 */
380
+ tree: FileTreeNode;
381
+ /** 처리 결과 통계 정보 */
382
+ metadata: {
383
+ /** 총 파일 수 */
384
+ totalFiles: number;
385
+ /** 총 디렉토리 수 */
386
+ totalDirectories: number;
387
+ /** 총 파일 크기 (바이트) */
388
+ totalSize: number;
389
+ /** 처리 소요 시간 (밀리초) */
390
+ processingTime: number;
391
+ };
392
+ /** 처리 중 발생한 에러들 (부분 실패시 포함) */
393
+ errors: FileDropError[];
394
+ }
395
+ /**
396
+ * 파일 트리 처리 실패 결과
397
+ * processFileTreeDropSafe 함수에서 전체 실패시 반환
398
+ *
399
+ * @example
400
+ * ```ts
401
+ * const errorResult: ErrorResult = {
402
+ * success: false,
403
+ * error: new FileDropError('ACCESS_DENIED', item, 'Permission denied'),
404
+ * partialResult: { files: [...], ... } // 부분적으로 처리된 결과 (optional)
405
+ * };
406
+ * ```
407
+ */
408
+ interface ErrorResult {
409
+ /** 항상 false (실패 표시) */
410
+ success: false;
411
+ /** 발생한 주요 에러 */
412
+ error: FileDropError;
413
+ /** 부분적으로 처리된 결과 (optional) */
414
+ partialResult?: ProcessResult;
415
+ }
416
+ /**
417
+ * 안전한 처리 결과 타입
418
+ * processFileTreeDropSafe 함수의 반환 타입
419
+ * 성공시 ProcessResult, 실패시 ErrorResult 반환
420
+ *
421
+ * @example
422
+ * ```ts
423
+ * const result: SafeProcessResult = await processFileTreeDropSafe(event);
424
+ *
425
+ * if ('error' in result) {
426
+ * // 실패한 경우
427
+ * console.error('처리 실패:', result.error.message);
428
+ * if (result.partialResult) {
429
+ * console.log('부분 결과:', result.partialResult.files.length);
430
+ * }
431
+ * } else {
432
+ * // 성공한 경우
433
+ * console.log('처리 성공:', result.files.length, '개 파일');
434
+ * }
435
+ * ```
436
+ */
437
+ type SafeProcessResult = ProcessResult | ErrorResult;
438
+ /**
439
+ * 지원되는 파일 드롭 소스 타입
440
+ * processFileTreeDrop 함수가 받을 수 있는 입력 타입들
441
+ *
442
+ * @example
443
+ * ```ts
444
+ * // React 드래그 이벤트
445
+ * const handleDrop = async (event: React.DragEvent<HTMLDivElement>) => {
446
+ * const result = await processFileTreeDrop(event);
447
+ * };
448
+ *
449
+ * // 파일 리스트
450
+ * const fileInput = document.querySelector('input[type="file"]');
451
+ * const result = await processFileTreeDrop(fileInput.files);
452
+ *
453
+ * // FileSystemHandle 배열
454
+ * const handles: FileSystemHandle[] = [...];
455
+ * const result = await processFileTreeDrop(handles);
456
+ *
457
+ * // File 객체 배열
458
+ * const files: File[] = [...];
459
+ * const result = await processFileTreeDrop(files);
460
+ * ```
461
+ */
462
+ type FileDropSource = React.DragEvent<HTMLElement> | FileList | FileSystemHandle[] | File[];
463
+ /**
464
+ * 레거시 API 호환성을 위한 파일 아이템 타입
465
+ * handleFileTreeDropEvent 함수에서 사용
466
+ *
467
+ * @deprecated 새로운 코드에서는 FileItem 사용 권장
468
+ *
469
+ * @example
470
+ * ```ts
471
+ * // 레거시 방식 (하위 호환성용)
472
+ * const legacyResult: LegacyFileItem[] = await handleFileTreeDropEvent(event);
473
+ *
474
+ * // 새로운 방식 (권장)
475
+ * const newResult: ProcessResult = await processFileTreeDrop(event);
476
+ * ```
477
+ */
478
+ interface LegacyFileItem {
479
+ /** 아이템 타입 - 'file' 또는 'dir' */
480
+ type: 'file' | 'dir';
481
+ /** 파일/디렉토리 경로 */
482
+ path: string;
483
+ /** File 객체 (파일인 경우만) */
484
+ file?: File;
485
+ }
486
+
487
+ /**
488
+ * 파일 드래그앤드롭 이벤트를 처리하여 파일 트리를 순회하는 메인 API 함수
489
+ *
490
+ * React 드래그 이벤트, FileList, FileSystemHandle 배열 등 다양한 소스를 지원하며,
491
+ * 깊은 디렉토리 구조도 완전히 순회합니다. 병렬 처리로 성능을 최적화하고,
492
+ * 부분 실패시에도 처리 가능한 파일들은 계속 처리합니다.
493
+ *
494
+ * @example
495
+ * ```tsx
496
+ * // 기본 사용법
497
+ * const handleDrop = async (event: React.DragEvent<HTMLDivElement>) => {
498
+ * event.preventDefault();
499
+ *
500
+ * try {
501
+ * const result = await processFileTreeDrop(event);
502
+ * console.log(`처리된 파일: ${result.files.length}개`);
503
+ * console.log(`처리 시간: ${result.metadata.processingTime}ms`);
504
+ * } catch (error) {
505
+ * console.error('파일 처리 중 오류:', error);
506
+ * }
507
+ * };
508
+ * ```
509
+ *
510
+ * @example
511
+ * ```tsx
512
+ * // 고급 옵션 사용
513
+ * const result = await processFileTreeDrop(event, {
514
+ * filter: {
515
+ * maxSize: 10 * 1024 * 1024, // 10MB 제한
516
+ * maxFiles: 50, // 최대 50개 파일
517
+ * allowedExtensions: ['.jpg', '.png', '.gif']
518
+ * },
519
+ * callbacks: {
520
+ * onProgress: (progress) => {
521
+ * console.log(`진행률: ${progress.percentage}%`);
522
+ * },
523
+ * onError: (error, item) => {
524
+ * console.error(`${item?.name} 처리 실패:`, error.message);
525
+ * }
526
+ * },
527
+ * signal: abortController.signal // 취소 가능
528
+ * });
529
+ * ```
530
+ *
531
+ * @param source - 파일 드롭 소스 (React DragEvent, FileList, FileSystemHandle[], File[])
532
+ * @param options - 처리 옵션 (필터링, 콜백, 중단 신호 등)
533
+ *
534
+ * @returns Promise<ProcessResult> - 처리된 파일들, 디렉토리 구조, 메타데이터, 에러 정보
535
+ *
536
+ * @throws {FileDropError} 전체 처리가 실패한 경우
537
+ * - 'UNSUPPORTED_API': 브라우저가 File API를 지원하지 않음
538
+ * - 'ACCESS_DENIED': 파일 접근 권한이 거부됨
539
+ * - 'UNKNOWN': 기타 알 수 없는 오류
540
+ *
541
+ * @see {@link processFileTreeDropSafe} 에러를 예외로 던지지 않는 안전한 버전
542
+ * @see {@link FileDropOptions} 사용 가능한 모든 옵션
543
+ * @see {@link ProcessResult} 반환 데이터 구조
544
+ *
545
+ * @since 1.0.0
546
+ */
547
+ declare function processFileTreeDrop(source: FileDropSource, options?: FileDropOptions): Promise<ProcessResult>;
548
+ /**
549
+ * 안전한 버전의 파일 트리 처리 함수
550
+ *
551
+ * processFileTreeDrop과 동일한 기능을 제공하지만, 에러를 예외로 던지지 않고
552
+ * 결과 객체에 포함시켜 반환합니다. 에러 처리가 복잡한 상황이나
553
+ * 부분 실패를 허용해야 하는 경우에 유용합니다.
554
+ *
555
+ * @example
556
+ * ```tsx
557
+ * // 에러를 안전하게 처리
558
+ * const result = await processFileTreeDropSafe(event, options);
559
+ *
560
+ * if ('error' in result) {
561
+ * // 실패한 경우
562
+ * console.error('처리 실패:', result.error.message);
563
+ * console.log('에러 코드:', result.error.code);
564
+ *
565
+ * // 부분적으로 처리된 결과가 있다면 활용
566
+ * if (result.partialResult) {
567
+ * console.log('부분 결과:', result.partialResult.files.length, '개 파일');
568
+ * }
569
+ * } else {
570
+ * // 성공한 경우
571
+ * console.log('처리 성공:', result.files.length, '개 파일');
572
+ * console.log('처리 시간:', result.metadata.processingTime, 'ms');
573
+ * }
574
+ * ```
575
+ *
576
+ * @example
577
+ * ```tsx
578
+ * // try-catch 없이 에러 처리
579
+ * const handleDrop = async (event: React.DragEvent<HTMLDivElement>) => {
580
+ * event.preventDefault();
581
+ *
582
+ * const result = await processFileTreeDropSafe(event, {
583
+ * filter: { maxSize: 5 * 1024 * 1024 }, // 5MB 제한
584
+ * callbacks: {
585
+ * onError: (error, item) => {
586
+ * // 개별 파일 에러는 여기서 처리
587
+ * console.warn(`${item?.name} 건너뜀:`, error.message);
588
+ * }
589
+ * }
590
+ * });
591
+ *
592
+ * // 타입 가드를 사용한 안전한 처리
593
+ * if ('error' in result) {
594
+ * setError(result.error.message);
595
+ * } else {
596
+ * setFiles(result.files);
597
+ * setProcessingTime(result.metadata.processingTime);
598
+ * }
599
+ * };
600
+ * ```
601
+ *
602
+ * @param source - 파일 드롭 소스 (React DragEvent, FileList, FileSystemHandle[], File[])
603
+ * @param options - 처리 옵션 (필터링, 콜백, 중단 신호 등)
604
+ *
605
+ * @returns Promise<SafeProcessResult> - 성공시 ProcessResult, 실패시 ErrorResult
606
+ * - 성공: ProcessResult와 동일한 구조
607
+ * - 실패: { success: false, error: FileDropError, partialResult?: ProcessResult }
608
+ *
609
+ * @see {@link processFileTreeDrop} 에러를 예외로 던지는 기본 버전
610
+ * @see {@link SafeProcessResult} 반환 타입 상세 정보
611
+ * @see {@link ErrorResult} 실패시 반환 구조
612
+ *
613
+ * @since 1.0.0
614
+ */
615
+ declare function processFileTreeDropSafe(source: FileDropSource, options?: FileDropOptions): Promise<SafeProcessResult>;
616
+
617
+ /**
618
+ * 파일 경로 유틸리티 (기존 PathUtils 개선)
619
+ */
620
+ declare class FilePathUtils {
621
+ static normalize(path: string): string;
622
+ static join(...segments: string[]): string;
623
+ static dirname(path: string): string;
624
+ static basename(path: string, ext?: string): string;
625
+ static extname(path: string): string;
626
+ static relative(from: string, to: string): string;
627
+ }
628
+ /**
629
+ * 파일 검증 함수들
630
+ */
631
+ declare function isValidFileType(file: File, allowedExtensions: string[]): boolean;
632
+ declare function isValidFileSize(file: File, maxSize: number): boolean;
633
+ declare function isValidFileName(name: string): boolean;
634
+ /**
635
+ * 트리 구조 조작 유틸리티
636
+ */
637
+ declare function flattenTree(tree: FileTreeNode): FileItem[];
638
+ declare function filterTree(tree: FileTreeNode, predicate: (node: FileTreeNode) => boolean): FileTreeNode | null;
639
+ declare function findInTree(tree: FileTreeNode, predicate: (node: FileTreeNode) => boolean): FileTreeNode | null;
640
+ /**
641
+ * 트리 빌더
642
+ */
643
+ declare function buildFileTree(items: FileItem[]): FileTreeNode;
644
+
645
+ /**
646
+ * 기본 필터 프리셋
647
+ */
648
+ declare const FilterPresets: {
649
+ /**
650
+ * 이미지만 허용
651
+ */
652
+ imagesOnly: () => FilterOptions;
653
+ /**
654
+ * 텍스트 파일만 허용
655
+ */
656
+ textOnly: () => FilterOptions;
657
+ /**
658
+ * 작은 파일만 허용 (1MB 이하)
659
+ */
660
+ smallFilesOnly: () => FilterOptions;
661
+ /**
662
+ * 개발 파일만 허용
663
+ */
664
+ developmentFiles: () => FilterOptions;
665
+ };
666
+
667
+ /**
668
+ * 레거시 파일 트리 드롭 이벤트 처리 함수
669
+ *
670
+ * @deprecated 새로운 코드에서는 `processFileTreeDrop` 또는 `processFileTreeDropSafe` 사용을 권장합니다.
671
+ *
672
+ * 이 함수는 하위 호환성을 위해 유지되지만 다음과 같은 제한사항이 있습니다:
673
+ * - 에러 처리가 제한적
674
+ * - 진행상황 추적 불가
675
+ * - 필터링 옵션 제한적
676
+ * - 반환 타입이 제한적
677
+ *
678
+ * @example
679
+ * ```tsx
680
+ * // ❌ 레거시 방식 (권장하지 않음)
681
+ * const legacyResult = await handleFileTreeDropEvent(event, (file) => file.size < 1000000);
682
+ *
683
+ * // ✅ 새로운 방식 (권장)
684
+ * const newResult = await processFileTreeDrop(event, {
685
+ * filter: { maxSize: 1000000 },
686
+ * callbacks: {
687
+ * onProgress: (prog) => console.log(`${prog.percentage}%`)
688
+ * }
689
+ * });
690
+ * ```
691
+ *
692
+ * @param event - React 드래그 이벤트
693
+ * @param callbackAccept - 파일 필터링 함수 (기본: 모든 파일 허용)
694
+ * @returns 레거시 형식의 파일/디렉토리 배열
695
+ *
696
+ * @see {@link processFileTreeDrop} - 권장되는 새로운 API
697
+ * @see {@link processFileTreeDropSafe} - 안전한 에러 처리가 포함된 버전
698
+ *
699
+ * @since 1.0.0
700
+ * @deprecated since 1.0.8 - Use processFileTreeDrop instead
701
+ */
702
+ declare function handleFileTreeDropEvent(event: React.DragEvent<HTMLElement>, callbackAccept?: (file: File) => boolean): Promise<Array<{
703
+ type: 'dir';
704
+ path: string;
705
+ } | {
706
+ type: 'file';
707
+ path: string;
708
+ file: File;
709
+ }>>;
710
+
711
+ /**
712
+ * Path utils
713
+ * not support relative path
714
+ */
715
+ declare class PathUtils {
716
+ static join(...args: (string[] | string | undefined | null)[]): string;
717
+ static split: (...args: (string[] | string | undefined | null)[]) => string[];
718
+ /**
719
+ * check startsWith for path segments
720
+ * pathStartsWith('a/b/c','a/b') = true
721
+ * pathStartsWith('/a/b/c','a/b') = true
722
+ * pathStartsWith('/a/b/c','/a/b') = true
723
+ * pathStartsWith('/a/b/c','/a/b/') = true
724
+ * pathStartsWith('/a//b//c//','//a//b//') = true
725
+ */
726
+ static pathStartsWith(p1: string, p2: string): boolean;
727
+ /**
728
+ * check startsWith for path segments
729
+ * segmentsStartsWith([1,2,3], [1,2]) = true
730
+ */
731
+ static segmentsStartsWith(p1: string[], p2: string[]): boolean;
732
+ }
733
+ declare class PathHolder {
734
+ readonly segments: string[];
735
+ readonly path: string;
736
+ constructor(path: string | string[]);
737
+ static EMPTY: PathHolder;
738
+ static from: (...args: (string[] | string | undefined | null)[]) => PathHolder;
739
+ join: (...args: (string[] | string | undefined | null)[]) => PathHolder;
740
+ changeLast: (fileName: string) => PathHolder;
741
+ parentOrNull: () => PathHolder | null;
742
+ lastSegmentOrNull: () => string | null;
743
+ lastSegment: () => string;
744
+ startsWith: (otherPath: string | string[] | PathHolder) => boolean;
745
+ toString(): string;
746
+ }
747
+
748
+ export { type CallbackOptions, type DebugLevel, FileDropError, type FileDropOptions, type FileDropSource, type FileItem, type FileMetadata, FilePathUtils, type FileTreeNode, type FilterOptions, FilterPresets, type LegacyFileItem, PathHolder, PathUtils, type ProcessResult, type ProcessedDirectory, type ProcessedFile, type ProcessingOptions, type ProgressInfo, type SafeProcessResult, buildFileTree, filterTree, findInTree, flattenTree, handleFileTreeDropEvent, isValidFileName, isValidFileSize, isValidFileType, processFileTreeDrop, processFileTreeDropSafe };