@georapbox/files-dropzone-element 2.1.1 → 3.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 (49) hide show
  1. package/.editorconfig +15 -0
  2. package/.nvmrc +1 -0
  3. package/.prettierignore +6 -0
  4. package/.prettierrc +11 -0
  5. package/.vscode/extensions.json +8 -0
  6. package/.vscode/settings.json +8 -0
  7. package/.zed/settings.json +9 -0
  8. package/CHANGELOG.md +144 -0
  9. package/README.md +119 -103
  10. package/custom-elements-manifest.config.mjs +48 -0
  11. package/dist/custom-elements.json +509 -0
  12. package/dist/files-dropzone-defined.d.ts +1 -1
  13. package/dist/files-dropzone-defined.d.ts.map +1 -1
  14. package/dist/files-dropzone-defined.js +5 -5
  15. package/dist/files-dropzone-defined.js.map +4 -4
  16. package/dist/files-dropzone.d.ts +55 -68
  17. package/dist/files-dropzone.d.ts.map +1 -1
  18. package/dist/files-dropzone.js +5 -5
  19. package/dist/files-dropzone.js.map +4 -4
  20. package/dist/files-selector.d.ts +9 -0
  21. package/dist/files-selector.d.ts.map +1 -0
  22. package/dist/{utils/is-valid-file.d.ts → is-valid-file.d.ts} +1 -1
  23. package/dist/is-valid-file.d.ts.map +1 -0
  24. package/docs/css/main.css +190 -0
  25. package/docs/css/water.css +674 -0
  26. package/docs/favicon-32x32.png +0 -0
  27. package/docs/index.html +144 -0
  28. package/docs/js/main.js +154 -0
  29. package/docs/lib/files-dropzone.js +93 -0
  30. package/docs/lib/highlight/highlight-github.css +160 -0
  31. package/docs/lib/highlight/highlight.min.js +1160 -0
  32. package/eslint.config.mjs +42 -0
  33. package/package.json +52 -30
  34. package/scripts/build.mjs +32 -0
  35. package/scripts/copy-build-to-docs.mjs +17 -0
  36. package/scripts/dev.mjs +24 -0
  37. package/src/files-dropzone-defined.js +1 -1
  38. package/src/files-dropzone.js +70 -89
  39. package/test/files-dropzone-upgrade.test.js +39 -0
  40. package/test/files-dropzone.test.js +397 -0
  41. package/test/files-selector.test.js +96 -0
  42. package/test/is-valid-file.test.js +78 -0
  43. package/tsconfig.json +15 -0
  44. package/web-test-runner.config.js +13 -0
  45. package/dist/utils/files-selector.d.ts +0 -2
  46. package/dist/utils/files-selector.d.ts.map +0 -1
  47. package/dist/utils/is-valid-file.d.ts.map +0 -1
  48. /package/src/{utils/files-selector.js → files-selector.js} +0 -0
  49. /package/src/{utils/is-valid-file.js → is-valid-file.js} +0 -0
@@ -0,0 +1,674 @@
1
+ /**
2
+ * water.css | https://github.com/kognise/water.css
3
+ * NOTE: This is a customized version of water.css.
4
+ */
5
+ :root {
6
+ /* Layout */
7
+ --body-max-width: 64rem; /* 1024px */
8
+
9
+ /* Colors */
10
+ --background-body: #ffffff;
11
+ --background: #efefef;
12
+ --background-alt: #f7f7f7;
13
+ --background-input: #ffffff;
14
+ --background-card: #ffffff;
15
+ --selection: #9e9e9e;
16
+ --text-main: #363636;
17
+ --text-bright: #000000;
18
+ --text-muted: #70777f;
19
+ --links: #0063af;
20
+ --focus: #0096bfab;
21
+ --border: #dbdbdb;
22
+ --code: #000000;
23
+ --button-base: #d0cfcf;
24
+ --button-hover: #9b9b9b;
25
+ --form-placeholder: #949494;
26
+ --form-text: #1d1d1d;
27
+ --variable: #39a33c;
28
+ --highlight: #fff000;
29
+
30
+ /* Shape */
31
+ --border-radius: 6px;
32
+
33
+ /* Misc */
34
+ --animation-duration: 0.1s;
35
+ --select-arrow: url("data:image/svg+xml;charset=utf-8,%3C?xml version='1.0' encoding='utf-8'?%3E %3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='62.5' width='116.9' fill='%23161f27'%3E %3Cpath d='M115.3,1.6 C113.7,0 111.1,0 109.5,1.6 L58.5,52.7 L7.4,1.6 C5.8,0 3.2,0 1.6,1.6 C0,3.2 0,5.8 1.6,7.4 L55.5,61.3 C56.3,62.1 57.3,62.5 58.4,62.5 C59.4,62.5 60.5,62.1 61.3,61.3 L115.2,7.4 C116.9,5.8 116.9,3.2 115.3,1.6Z'/%3E %3C/svg%3E");
36
+
37
+ accent-color: var(--links);
38
+ color-scheme: light;
39
+ }
40
+
41
+ @media (prefers-color-scheme: dark) {
42
+ :root {
43
+ /* Colors */
44
+ --background-body: #202b38;
45
+ --background: #161f27;
46
+ --background-alt: #1a242f;
47
+ --background-input: var(--background);
48
+ --background-card: #283647;
49
+ --selection: #1c76c5;
50
+ --text-main: #dbdbdb;
51
+ --text-bright: #ffffff;
52
+ --text-muted: #a9b1ba;
53
+ --links: #41adff;
54
+ --focus: #0096bfab;
55
+ --border: #526980;
56
+ --code: #ffbe85;
57
+ --button-base: #0c151c;
58
+ --button-hover: #040a0f;
59
+ --form-placeholder: #a9a9a9;
60
+ --form-text: #ffffff;
61
+ --variable: #d941e2;
62
+ --highlight: #efdb43;
63
+
64
+ /* Misc */
65
+ --select-arrow: url("data:image/svg+xml;charset=utf-8,%3C?xml version='1.0' encoding='utf-8'?%3E %3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='62.5' width='116.9' fill='%23ffffff'%3E %3Cpath d='M115.3,1.6 C113.7,0 111.1,0 109.5,1.6 L58.5,52.7 L7.4,1.6 C5.8,0 3.2,0 1.6,1.6 C0,3.2 0,5.8 1.6,7.4 L55.5,61.3 C56.3,62.1 57.3,62.5 58.4,62.5 C59.4,62.5 60.5,62.1 61.3,61.3 L115.2,7.4 C116.9,5.8 116.9,3.2 115.3,1.6Z'/%3E %3C/svg%3E");
66
+
67
+ color-scheme: dark;
68
+ }
69
+ }
70
+
71
+ body {
72
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
73
+ line-height: 1.5;
74
+ max-width: var(--body-max-width);
75
+ margin: 1.25rem auto; /* 20px */
76
+ padding: 0 0.75rem; /* 0 12px */
77
+ overflow-x: hidden;
78
+ color: var(--text-main);
79
+ background: var(--background-body);
80
+ text-rendering: optimizeLegibility;
81
+ }
82
+
83
+ p {
84
+ text-wrap: pretty;
85
+ }
86
+
87
+ h1 {
88
+ font-size: 2.2rem;
89
+ margin-top: 0;
90
+ }
91
+
92
+ h1,
93
+ h2,
94
+ h3,
95
+ h4,
96
+ h5,
97
+ h6 {
98
+ margin-bottom: 0.75rem; /* 12px */
99
+ margin-top: 1.5rem; /* 24px */
100
+ color: var(--text-bright);
101
+ }
102
+
103
+ strong {
104
+ color: var(--text-bright);
105
+ }
106
+
107
+ h1,
108
+ h2,
109
+ h3,
110
+ h4,
111
+ h5,
112
+ h6,
113
+ b,
114
+ strong,
115
+ th {
116
+ font-weight: 600;
117
+ }
118
+
119
+ q::before,
120
+ q::after {
121
+ content: none;
122
+ }
123
+
124
+ blockquote,
125
+ q {
126
+ border-inline-start: 0.25rem solid var(--focus); /* 4px */
127
+ margin: 1.5rem 0; /* 24px 0 */
128
+ padding: 0.5rem 1rem; /* 8px 16px */
129
+ font-style: italic;
130
+ }
131
+
132
+ blockquote > footer {
133
+ font-style: normal;
134
+ border: 0;
135
+ }
136
+
137
+ blockquote cite {
138
+ font-style: normal;
139
+ }
140
+
141
+ address {
142
+ font-style: normal;
143
+ }
144
+
145
+ a[href^='mailto\:']::before {
146
+ content: '📧 ';
147
+ }
148
+
149
+ a[href^='tel\:']::before {
150
+ content: '📞 ';
151
+ }
152
+
153
+ a[href^='sms\:']::before {
154
+ content: '💬 ';
155
+ }
156
+
157
+ mark {
158
+ background-color: #ff0;
159
+ background-color: var(--highlight);
160
+ border-radius: 0.125rem; /* 2px */
161
+ padding: 0 0.125rem;
162
+ color: #000000;
163
+ }
164
+
165
+ a > code,
166
+ a > strong {
167
+ color: inherit;
168
+ }
169
+
170
+ button,
171
+ select,
172
+ input[type='submit'],
173
+ input[type='reset'],
174
+ input[type='button'],
175
+ input[type='checkbox'],
176
+ input[type='range'],
177
+ input[type='radio'] {
178
+ cursor: pointer;
179
+ }
180
+
181
+ input,
182
+ select {
183
+ display: block;
184
+ }
185
+
186
+ [type='checkbox'],
187
+ [type='radio'] {
188
+ display: initial;
189
+ }
190
+
191
+ input,
192
+ button,
193
+ textarea,
194
+ select {
195
+ color: var(--form-text);
196
+ background-color: var(--background-input);
197
+ font-family: inherit;
198
+ font-size: inherit;
199
+ margin-inline-end: 0.375rem; /* 6px */
200
+ margin-bottom: 0.375rem; /* 6px */
201
+ padding: 0.625em 0.75em;
202
+ border: none;
203
+ border-radius: var(--border-radius);
204
+ outline: none;
205
+ }
206
+
207
+ button {
208
+ background-color: var(--button-base);
209
+ padding-inline: 1.875em;
210
+ }
211
+
212
+ input[type='submit'],
213
+ input[type='reset'],
214
+ input[type='button'] {
215
+ background-color: var(--button-base);
216
+ padding-inline: 1.875em;
217
+ }
218
+
219
+ button:hover:not(:disabled) {
220
+ background: var(--button-hover);
221
+ }
222
+
223
+ input[type='submit']:hover,
224
+ input[type='reset']:hover,
225
+ input[type='button']:hover {
226
+ background: var(--button-hover);
227
+ }
228
+
229
+ input[type='color'] {
230
+ min-height: 2rem;
231
+ padding: 0.5em;
232
+ cursor: pointer;
233
+ }
234
+
235
+ input[type='checkbox'],
236
+ input[type='radio'] {
237
+ width: 1em;
238
+ height: 1em;
239
+ }
240
+
241
+ input[type='radio'] {
242
+ border-radius: 100%;
243
+ }
244
+
245
+ input {
246
+ vertical-align: top;
247
+ }
248
+
249
+ input[type='text'],
250
+ input[type='url'],
251
+ input[type='email'],
252
+ input[type='number'],
253
+ input[type='password'],
254
+ input[type='search'],
255
+ input[type='date'],
256
+ input[type='datetime-local'],
257
+ input[type='time'],
258
+ input[type='week'],
259
+ input[type='tel'],
260
+ input[type='file'],
261
+ textarea,
262
+ select {
263
+ border: 1px solid var(--border);
264
+ }
265
+
266
+ label {
267
+ vertical-align: middle;
268
+ margin-bottom: 0.25rem; /* 4px */
269
+ display: inline-block;
270
+ }
271
+
272
+ input:not([type='checkbox']):not([type='radio']),
273
+ input[type='range'],
274
+ select,
275
+ button,
276
+ textarea {
277
+ appearance: none;
278
+ }
279
+
280
+ textarea {
281
+ display: block;
282
+ margin-inline-end: 0;
283
+ box-sizing: border-box;
284
+ resize: vertical;
285
+ }
286
+
287
+ textarea:not([cols]) {
288
+ width: 100%;
289
+ }
290
+
291
+ textarea:not([rows]) {
292
+ min-height: 2.5rem; /* 40px */
293
+ height: 8.75rem; /* 140px */
294
+ }
295
+
296
+ select {
297
+ padding-inline-end: 2.1875rem; /* 35px: room for arrow */
298
+ background-color: var(--background-input);
299
+ background-image: var(--select-arrow);
300
+ background-repeat: no-repeat;
301
+ background-size: 0.75rem;
302
+ background-position: right 0.75rem center;
303
+ }
304
+
305
+ :dir(rtl) select {
306
+ background-position: left 0.75rem center;
307
+ }
308
+
309
+ select::-ms-expand {
310
+ display: none;
311
+ }
312
+
313
+ select[multiple] {
314
+ padding-inline-end: 0.625rem; /* 10px */
315
+ background-image: none;
316
+ overflow-y: auto;
317
+ }
318
+
319
+ input:focus-visible,
320
+ select:focus-visible,
321
+ button:focus-visible,
322
+ textarea:focus-visible {
323
+ outline: 2px solid var(--focus);
324
+ }
325
+
326
+ input:disabled,
327
+ select:disabled,
328
+ button:disabled,
329
+ textarea:disabled {
330
+ cursor: not-allowed;
331
+ opacity: 0.5;
332
+ }
333
+
334
+ ::-moz-placeholder,
335
+ :-ms-input-placeholder,
336
+ ::-ms-input-placeholder,
337
+ ::placeholder {
338
+ color: var(--form-placeholder);
339
+ }
340
+
341
+ fieldset {
342
+ border: 1px solid var(--focus);
343
+ border-radius: var(--border-radius);
344
+ margin: 0;
345
+ margin-bottom: 0.75rem; /* 12px */
346
+ padding: 0.625rem; /* 10px */
347
+ }
348
+
349
+ legend {
350
+ font-size: 0.9rem;
351
+ font-weight: 600;
352
+ }
353
+
354
+ input[type='range'] {
355
+ margin: 0.625rem 0; /* 10px 0 */
356
+ padding: 0.625rem 0; /* 10px 0 */
357
+ background: transparent;
358
+ }
359
+
360
+ input[type='range']::-webkit-slider-runnable-track {
361
+ width: 100%;
362
+ height: 0.375rem;
363
+ border-radius: 9999px;
364
+ background: var(--border);
365
+ background: color-mix(in srgb, var(--border) 60%, transparent);
366
+ }
367
+
368
+ input[type='range']::-webkit-slider-thumb {
369
+ width: 1.125rem;
370
+ height: 1.125rem;
371
+ margin-top: -0.375rem;
372
+ appearance: none;
373
+ border: 2px solid var(--background-body);
374
+ border-radius: 50%;
375
+ background: var(--links);
376
+ box-shadow: 0 0 0 3px var(--border);
377
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--border) 60%, transparent);
378
+ }
379
+
380
+ input[type='range']::-moz-range-track {
381
+ width: 100%;
382
+ height: 0.375rem;
383
+ border-radius: 9999px;
384
+ background: var(--border);
385
+ background: color-mix(in srgb, var(--border) 60%, transparent);
386
+ }
387
+
388
+ input[type='range']::-moz-range-thumb {
389
+ width: 1.125rem;
390
+ height: 1.125rem;
391
+ border: 2px solid var(--background-body);
392
+ border-radius: 50%;
393
+ background: var(--links);
394
+ box-shadow: 0 0 0 3px rgb(155 234 38 / 18%);
395
+ box-shadow: 0 0 0 3px light-dark(rgb(74 112 18 / 28%), rgb(155 234 38 / 18%));
396
+ }
397
+
398
+ input[type="file"]::file-selector-button {
399
+ border: none;
400
+ border-radius: var(--border-radius);
401
+ background: var(--button-base);
402
+ color: var(--form-text);
403
+ padding: 0.625em 1.25em;
404
+ margin-inline-end: 0.75rem;
405
+ cursor: pointer;
406
+ }
407
+
408
+ input[type="file"]:disabled::file-selector-button {
409
+ cursor: not-allowed;
410
+ }
411
+
412
+ input[type="file"]:not(:disabled)::file-selector-button:hover {
413
+ background: var(--button-hover);
414
+ }
415
+
416
+ a,
417
+ a:hover {
418
+ color: var(--links);
419
+ text-decoration: underline;
420
+ }
421
+
422
+ code,
423
+ samp,
424
+ time {
425
+ background: var(--background);
426
+ color: var(--code);
427
+ padding: 0.15625rem 0.3125rem; /* 2.5px 5px */
428
+ border-radius: var(--border-radius);
429
+ font-size: 1em;
430
+ }
431
+
432
+ pre > code {
433
+ padding: 0.625rem; /* 10px */
434
+ display: block;
435
+ overflow-x: auto;
436
+ }
437
+
438
+ pre > code:empty {
439
+ display: none;
440
+ }
441
+
442
+ var {
443
+ color: var(--variable);
444
+ font-style: normal;
445
+ font-family: monospace;
446
+ }
447
+
448
+ kbd {
449
+ background: var(--background);
450
+ border: 1px solid var(--border);
451
+ border-radius: 0.125rem; /* 2px */
452
+ color: var(--text-main);
453
+ padding: 0.125rem 0.25rem;
454
+ }
455
+
456
+ img,
457
+ video {
458
+ max-width: 100%;
459
+ height: auto;
460
+ }
461
+
462
+ hr {
463
+ border: none;
464
+ border-top: 1px solid var(--border);
465
+ }
466
+
467
+ table {
468
+ border-collapse: collapse;
469
+ margin-bottom: 0.625rem; /* 10px */
470
+ width: 100%;
471
+ table-layout: fixed;
472
+ }
473
+
474
+ table caption {
475
+ text-align: start;
476
+ }
477
+
478
+ td,
479
+ th {
480
+ padding: 0.375rem; /* 6px */
481
+ text-align: start;
482
+ vertical-align: top;
483
+ word-wrap: break-word;
484
+ }
485
+
486
+ thead {
487
+ border-bottom: 1px solid var(--border);
488
+ }
489
+
490
+ tfoot {
491
+ border-top: 1px solid var(--border);
492
+ }
493
+
494
+ tbody tr:nth-child(even) {
495
+ background-color: var(--background);
496
+ }
497
+
498
+ tbody tr:nth-child(even) button {
499
+ background-color: var(--background-alt);
500
+ }
501
+
502
+ tbody tr:nth-child(even) button:hover {
503
+ background-color: var(--background-body);
504
+ }
505
+
506
+ details {
507
+ background-color: var(--background-alt);
508
+ padding: 0.625rem 0.625rem 0 0.625rem;
509
+ margin: 1rem 0;
510
+ border-radius: var(--border-radius);
511
+ overflow: hidden;
512
+ }
513
+
514
+ details[open] {
515
+ padding: 0.625rem;
516
+ }
517
+
518
+ details > :last-child {
519
+ margin-bottom: 0;
520
+ }
521
+
522
+ @media (prefers-reduced-motion: no-preference) {
523
+ details > summary {
524
+ transition: margin var(--animation-duration) ease-out;
525
+ }
526
+ }
527
+
528
+ details[open] > summary {
529
+ margin-bottom: 0.625rem;
530
+ }
531
+
532
+ summary {
533
+ display: list-item;
534
+ background-color: var(--background);
535
+ padding: 0.625rem;
536
+ margin: -0.625rem -0.625rem 0;
537
+ cursor: pointer;
538
+ outline: none;
539
+ }
540
+
541
+ details > :not(summary) {
542
+ margin-top: 0;
543
+ }
544
+
545
+ summary::marker {
546
+ color: var(--text-main);
547
+ }
548
+
549
+ summary:focus-visible {
550
+ box-shadow: inset 0 0 0 2px var(--focus);
551
+ }
552
+
553
+ dialog {
554
+ background-color: var(--background-alt);
555
+ color: var(--text-main);
556
+ border: none;
557
+ border-radius: var(--border-radius);
558
+ border-color: var(--border);
559
+ padding: 0.625rem 1.875rem; /* 10px 30px */
560
+ }
561
+
562
+ dialog > header:first-child {
563
+ background-color: var(--background);
564
+ border-radius: 0.375rem 0.375rem 0 0; /* 6px 6px 0 0 */
565
+ margin: -0.625rem -1.875rem 0.625rem;
566
+ padding: 0.625rem;
567
+ text-align: center;
568
+ }
569
+
570
+ dialog::backdrop {
571
+ background: #0000009c;
572
+ backdrop-filter: blur(0.25rem); /* 4px */
573
+ }
574
+
575
+ @media (prefers-reduced-motion: no-preference) {
576
+ dialog::backdrop {
577
+ opacity: 0;
578
+ }
579
+
580
+ dialog[open]::backdrop {
581
+ opacity: 1;
582
+ }
583
+
584
+ dialog,
585
+ dialog::backdrop {
586
+ transition: transform 0.3s, opacity 0.3s, display 0.3s allow-discrete, overlay 0.3s allow-discrete;
587
+ }
588
+
589
+ /* 1. IS-OPEN STATE */
590
+ dialog[open] {
591
+ transform: scale(1);
592
+ opacity: 1;
593
+ }
594
+
595
+ /* 2. EXIT STATE */
596
+ dialog {
597
+ transform: scale(0.95);
598
+ opacity: 0;
599
+ }
600
+
601
+ /* 0. BEFORE-OPEN STATE */
602
+ @starting-style {
603
+ dialog[open] {
604
+ transform: scale(0.95);
605
+ opacity: 0;
606
+ }
607
+
608
+ dialog[open]::backdrop {
609
+ opacity: 0;
610
+ }
611
+ }
612
+ }
613
+
614
+ footer {
615
+ border-top: 1px solid #dbdbdb;
616
+ border-top: 1px solid var(--border);
617
+ padding-top: 0.625rem; /* 10px */
618
+ color: #70777f;
619
+ color: var(--text-muted);
620
+ }
621
+
622
+ body > footer {
623
+ margin-top: 2.5rem; /* 40px */
624
+ }
625
+
626
+ @media print {
627
+ body,
628
+ pre,
629
+ code,
630
+ summary,
631
+ details,
632
+ button,
633
+ input,
634
+ textarea {
635
+ background-color: #ffffff;
636
+ }
637
+
638
+ button,
639
+ input,
640
+ textarea {
641
+ border: 1px solid #000000;
642
+ }
643
+
644
+ body,
645
+ h1,
646
+ h2,
647
+ h3,
648
+ h4,
649
+ h5,
650
+ h6,
651
+ pre,
652
+ code,
653
+ button,
654
+ input,
655
+ textarea,
656
+ footer,
657
+ summary,
658
+ strong {
659
+ color: #000000;
660
+ }
661
+
662
+ summary::marker {
663
+ color: #000000;
664
+ }
665
+
666
+ tbody tr:nth-child(even) {
667
+ background-color: #f2f2f2;
668
+ }
669
+
670
+ a {
671
+ color: #0000ff;
672
+ text-decoration: underline;
673
+ }
674
+ }
Binary file