handy-uploader 1.1.7 → 2.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.
package/README.md CHANGED
@@ -1,42 +1,401 @@
1
- <p align="center">
2
- <img src="https://img.techpowerup.org/200626/vue-file-uploader038.png" alt="handy uplader"/>
3
- </p>
1
+ # Handy Uploader Vue
4
2
 
5
- <div>
6
- <a title="MadeWithVueJs.com Shield" href="https://madewithvuejs.com/p/handy-uploader/shield-link"> <img src="https://madewithvuejs.com/storage/repo-shields/2558-shield.svg"/></a>
3
+ [![npm version](https://badge.fury.io/js/handy-uploader-vue.svg)](https://badge.fury.io/js/handy-uploader-vue)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Vue 3](https://img.shields.io/badge/Vue-3.x-4FC08D.svg)](https://vuejs.org/)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
7
7
 
8
- <img alt="npm" src="https://img.shields.io/npm/v/handy-uploader">
8
+ A comprehensive Vue 3 file uploader component library with advanced features including **automatic video thumbnail generation**, multiple upload styles, and extensive file type support.
9
9
 
10
+ ## ✨ Key Features
10
11
 
11
- <img alt="NPM" src="https://img.shields.io/npm/l/handy-uploader">
12
- </div>
12
+ ### 🎥 **Video Thumbnail Generation**
13
+ - **Automatic thumbnail extraction** from video files using Canvas API
14
+ - Support for **MP4, AVI, MOV, WMV, FLV, WebM** formats
15
+ - Real-time thumbnail display with play button overlay
16
+ - No external dependencies required
13
17
 
14
- # handy-uploader
18
+ ### 📁 **Comprehensive File Support**
19
+ - **Images**: JPG, JPEG, PNG, GIF, BMP, SVG, WebP, TIFF
20
+ - **Videos**: MP4, AVI, MOV, WMV, FLV, WebM
21
+ - **Documents**: PDF, DOC, DOCX, TXT, RTF, ODT
22
+ - **Spreadsheets**: XLS, XLSX, CSV, ODS
23
+ - **Presentations**: PPT, PPTX, ODP
24
+ - **Archives**: ZIP, RAR, 7Z, TAR, GZ
25
+ - **Audio**: MP3, WAV, FLAC, AAC, OGG
15
26
 
16
- > Complete and simple file uploader with image compressor in Vue.js
27
+ ### 🎨 **Multiple Upload Styles**
28
+ - **ThumbnailUploader**: Grid-based layout with file previews
29
+ - **TableUploader**: Table-based layout for detailed file information
30
+ - **SimpleUploader**: Minimalist drag-and-drop interface
17
31
 
18
- + Choice Theme : Thumbnail, Simple, Table
19
- + Add custom fields (Title, Description, Tags, ...)
20
- + Image compressor
21
- + Select level for Image compressor
22
- + Mange file extensions
23
- + Manage files count
24
- + Manage files size
25
- + Multi languages support
26
- + Add custom language
27
- + Right to left support
28
- + Multi file upload
29
- + Responsive
30
- + ...
32
+ ### 🌍 **Internationalization**
33
+ - **8 languages**: English, Chinese, Spanish, French, German, Japanese, Korean, Arabic
34
+ - RTL support for Arabic
35
+ - Easy language switching
31
36
 
32
- ## Examples
33
- - [Demo](https://friendly-varahamihira-45c09f.netlify.app)
37
+ ## 📦 Installation
34
38
 
35
- ## Documentation
36
- - [Documentation](https://friendly-varahamihira-45c09f.netlify.app/documentation)
39
+ ```bash
40
+ npm install handy-uploader-vue
41
+ ```
42
+
43
+ ```bash
44
+ yarn add handy-uploader-vue
45
+ ```
46
+
47
+ ```bash
48
+ pnpm add handy-uploader-vue
49
+ ```
50
+
51
+ ## 🚀 Quick Start
52
+
53
+ ### 1. Install Dependencies
54
+
55
+ Make sure you have the required peer dependencies:
37
56
 
38
- ## Install
39
57
  ```bash
40
- # install
41
- $ npm install handy-uploader
58
+ npm install vue@^3.0.0 vuetify@^3.0.0
59
+ ```
60
+
61
+ ### 2. Import and Use
62
+
63
+ ```vue
64
+ <template>
65
+ <div>
66
+ <!-- Thumbnail Uploader with Video Support -->
67
+ <ThumbnailUploader
68
+ :max-file-size="10485760"
69
+ :max-file-count="5"
70
+ :accepted-file-types="['image/*', 'video/*']"
71
+ :language="'en'"
72
+ @files-selected="handleFilesSelected"
73
+ />
74
+ </div>
75
+ </template>
76
+
77
+ <script setup lang="ts">
78
+ import { ThumbnailUploader } from 'handy-uploader-vue'
79
+ import type { FileData } from 'handy-uploader-vue'
80
+
81
+ const handleFilesSelected = (files: FileData[]) => {
82
+ console.log('Selected files:', files)
83
+ // Each file includes base64 data and video thumbnails are auto-generated
84
+ }
85
+ </script>
86
+ ```
87
+
88
+ ### 3. Setup Vuetify (Required)
89
+
90
+ ```typescript
91
+ // main.ts
92
+ import { createApp } from 'vue'
93
+ import { createVuetify } from 'vuetify'
94
+ import 'vuetify/styles'
95
+ import '@mdi/font/css/materialdesignicons.css'
96
+
97
+ const vuetify = createVuetify()
98
+ const app = createApp(App)
99
+
100
+ app.use(vuetify)
101
+ app.mount('#app')
102
+ ```
103
+
104
+ ## 📖 Component Usage
105
+
106
+ ### ThumbnailUploader (Recommended)
107
+
108
+ Perfect for media files with automatic video thumbnail generation:
109
+
110
+ ```vue
111
+ <template>
112
+ <ThumbnailUploader
113
+ :max-file-size="52428800"
114
+ :max-file-count="10"
115
+ :accepted-file-types="['image/*', 'video/*', 'application/pdf']"
116
+ :language="'en'"
117
+ :theme="'light'"
118
+ @files-selected="onFilesSelected"
119
+ @file-removed="onFileRemoved"
120
+ @error="onError"
121
+ />
122
+ </template>
123
+
124
+ <script setup>
125
+ import { ThumbnailUploader } from 'handy-uploader-vue'
126
+
127
+ const onFilesSelected = (files) => {
128
+ // Video files will have thumbnails automatically generated
129
+ files.forEach(file => {
130
+ if (file.type === 'video') {
131
+ console.log('Video thumbnail:', file.thumbnail) // Base64 thumbnail
132
+ }
133
+ })
134
+ }
135
+ </script>
136
+ ```
137
+
138
+ ### TableUploader
139
+
140
+ Great for document management with detailed file information:
141
+
142
+ ```vue
143
+ <template>
144
+ <TableUploader
145
+ :max-file-size="104857600"
146
+ :max-file-count="20"
147
+ :language="'en'"
148
+ @files-selected="handleFiles"
149
+ />
150
+ </template>
151
+ ```
152
+
153
+ ### SimpleUploader
154
+
155
+ Minimal drag-and-drop interface:
156
+
157
+ ```vue
158
+ <template>
159
+ <SimpleUploader
160
+ :max-file-size="5242880"
161
+ :accepted-file-types="['image/*']"
162
+ @files-selected="handleImages"
163
+ />
164
+ </template>
165
+ ```
166
+
167
+ ## ⚙️ API Reference
168
+
169
+ ### Props
170
+
171
+ | Prop | Type | Default | Description |
172
+ |------|------|---------|-------------|
173
+ | `maxFileSize` | `number` | `10485760` | Maximum file size in bytes (10MB) |
174
+ | `maxFileCount` | `number` | `5` | Maximum number of files |
175
+ | `acceptedFileTypes` | `string[]` | `['*']` | Accepted MIME types |
176
+ | `language` | `string` | `'en'` | Language code |
177
+ | `theme` | `string` | `'light'` | Theme variant |
178
+
179
+ ### Events
180
+
181
+ | Event | Payload | Description |
182
+ |-------|---------|-------------|
183
+ | `files-selected` | `FileData[]` | Emitted when files are selected |
184
+ | `file-removed` | `FileData` | Emitted when a file is removed |
185
+ | `error` | `Error` | Emitted on errors |
186
+
187
+ ### FileData Interface
188
+
189
+ ```typescript
190
+ interface FileData {
191
+ id: string
192
+ name: string
193
+ size: number
194
+ type: string
195
+ format: string
196
+ base64?: string
197
+ thumbnail?: string // Auto-generated for videos
198
+ lastModified: number
199
+ }
200
+ ```
201
+
202
+ ## 🎯 Advanced Features
203
+
204
+ ### Video Thumbnail Generation
205
+
206
+ The library automatically generates thumbnails for video files:
207
+
208
+ ```javascript
209
+ // Thumbnails are generated automatically
210
+ const videoFile = {
211
+ name: 'video.mp4',
212
+ type: 'video',
213
+ thumbnail: 'data:image/jpeg;base64,/9j/4AAQ...' // Auto-generated
214
+ }
215
+ ```
216
+
217
+ ### File Type Detection
218
+
219
+ Automatic file type detection and icon assignment:
220
+
221
+ ```javascript
222
+ // Automatic type detection
223
+ const file = {
224
+ name: 'document.pdf',
225
+ type: 'document', // Auto-detected
226
+ icon: 'mdi-file-pdf-box', // Auto-assigned
227
+ color: 'red' // Auto-assigned
228
+ }
229
+ ```
230
+
231
+ ### Image Compression
232
+
233
+ Built-in image compression for large files:
234
+
235
+ ```vue
236
+ <ThumbnailUploader
237
+ :compress-images="true"
238
+ :compression-quality="0.8"
239
+ :max-width="1920"
240
+ :max-height="1080"
241
+ />
242
+ ```
243
+
244
+ ## 🌍 Internationalization
245
+
246
+ Supported languages:
247
+
248
+ ```javascript
249
+ const languages = [
250
+ 'en', // English
251
+ 'zh', // Chinese
252
+ 'es', // Spanish
253
+ 'fr', // French
254
+ 'de', // German
255
+ 'ja', // Japanese
256
+ 'ko', // Korean
257
+ 'ar' // Arabic (RTL)
258
+ ]
259
+ ```
260
+
261
+ ## 🛠️ Technical Requirements
262
+
263
+ ### Peer Dependencies
264
+ - **Vue**: ^3.0.0
265
+ - **Vuetify**: ^3.0.0
266
+
267
+ ### Browser Support
268
+ - Chrome 88+
269
+ - Firefox 85+
270
+ - Safari 14+
271
+ - Edge 88+
272
+
273
+ ### Bundle Size
274
+ - **Gzipped**: ~45KB
275
+ - **Minified**: ~120KB
276
+
277
+ ## 🎨 Customization
278
+
279
+ ### Theming
280
+
281
+ Works with Vuetify's theming system:
282
+
283
+ ```javascript
284
+ // vuetify.config.js
285
+ export default createVuetify({
286
+ theme: {
287
+ themes: {
288
+ light: {
289
+ primary: '#1976D2',
290
+ secondary: '#424242',
291
+ // Custom theme colors
292
+ }
293
+ }
294
+ }
295
+ })
296
+ ```
297
+
298
+ ### Custom Styling
299
+
300
+ ```vue
301
+ <style scoped>
302
+ .handy-uploader {
303
+ --uploader-border-radius: 12px;
304
+ --uploader-primary-color: #1976D2;
305
+ --uploader-background: #f5f5f5;
306
+ }
307
+ </style>
308
+ ```
309
+
310
+ ## 📝 Examples
311
+
312
+ ### Complete Example with All Features
313
+
314
+ ```vue
315
+ <template>
316
+ <div class="uploader-container">
317
+ <h2>File Upload with Video Thumbnails</h2>
318
+
319
+ <ThumbnailUploader
320
+ :max-file-size="52428800"
321
+ :max-file-count="10"
322
+ :accepted-file-types="['image/*', 'video/*', 'application/pdf']"
323
+ :language="currentLanguage"
324
+ :theme="isDark ? 'dark' : 'light'"
325
+ :compress-images="true"
326
+ :compression-quality="0.8"
327
+ @files-selected="handleFilesSelected"
328
+ @file-removed="handleFileRemoved"
329
+ @error="handleError"
330
+ />
331
+
332
+ <!-- Display selected files -->
333
+ <div v-if="selectedFiles.length" class="mt-4">
334
+ <h3>Selected Files:</h3>
335
+ <div v-for="file in selectedFiles" :key="file.id" class="file-item">
336
+ <img v-if="file.thumbnail" :src="file.thumbnail" alt="Thumbnail" width="100" />
337
+ <span>{{ file.name }} ({{ formatFileSize(file.size) }})</span>
338
+ </div>
339
+ </div>
340
+ </div>
341
+ </template>
342
+
343
+ <script setup lang="ts">
344
+ import { ref } from 'vue'
345
+ import { ThumbnailUploader, type FileData } from 'handy-uploader-vue'
346
+
347
+ const selectedFiles = ref<FileData[]>([])
348
+ const currentLanguage = ref('en')
349
+ const isDark = ref(false)
350
+
351
+ const handleFilesSelected = (files: FileData[]) => {
352
+ selectedFiles.value = files
353
+ console.log('Files with thumbnails:', files)
354
+ }
355
+
356
+ const handleFileRemoved = (file: FileData) => {
357
+ console.log('File removed:', file.name)
358
+ }
359
+
360
+ const handleError = (error: Error) => {
361
+ console.error('Upload error:', error)
362
+ }
363
+
364
+ const formatFileSize = (bytes: number) => {
365
+ return bytes > 1024 * 1024
366
+ ? `${(bytes / 1024 / 1024).toFixed(2)} MB`
367
+ : `${(bytes / 1024).toFixed(2)} KB`
368
+ }
369
+ </script>
370
+ ```
371
+
372
+ ## 🤝 Contributing
373
+
374
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
375
+
376
+ 1. Fork the repository
377
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
378
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
379
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
380
+ 5. Open a Pull Request
381
+
382
+ ## 📄 License
383
+
384
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
385
+
386
+ ## 🔗 Links
387
+
388
+ - [GitHub Repository](https://github.com/yourusername/handy-uploader-vue)
389
+ - [npm Package](https://www.npmjs.com/package/handy-uploader-vue)
390
+ - [Documentation](https://github.com/yourusername/handy-uploader-vue#readme)
391
+ - [Issues](https://github.com/yourusername/handy-uploader-vue/issues)
392
+
393
+ ## 📊 Stats
394
+
395
+ ![npm downloads](https://img.shields.io/npm/dm/handy-uploader-vue.svg)
396
+ ![GitHub stars](https://img.shields.io/github/stars/yourusername/handy-uploader-vue.svg)
397
+ ![GitHub issues](https://img.shields.io/github/issues/yourusername/handy-uploader-vue.svg)
398
+
399
+ ---
42
400
 
401
+ **Made with ❤️ for the Vue.js community**
Binary file