@useupup/vanilla 3.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Devino
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @useupup/vanilla
2
+
3
+ Framework-free file uploader (built on lit-html) with cloud-drive sources (Google
4
+ Drive, OneDrive, Dropbox, Box), resumable uploads, theming, and ICU i18n. A native
5
+ port of the canonical [upup](https://github.com/DevinoSolutions/upup) React UI,
6
+ DOM-identical to it — no framework required. Mount it into any DOM element.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm i @useupup/vanilla
12
+ ```
13
+
14
+ ## Usage (Client Mode)
15
+
16
+ Client Mode uploads directly from the browser to your storage; your server only
17
+ issues short-lived upload credentials at `uploadEndpoint`.
18
+
19
+ ```ts
20
+ import { createUploader } from '@useupup/vanilla'
21
+ import '@useupup/vanilla/styles'
22
+
23
+ const uploader = createUploader('#uploader', {
24
+ provider: 'aws',
25
+ uploadEndpoint: '/api/upload-token',
26
+ onFileUploadComplete: (file, key) =>
27
+ console.log('Uploaded', file.name, 'to', key),
28
+ })
29
+ ```
30
+
31
+ `createUploader(target, options)` accepts a CSS selector string or an
32
+ `HTMLElement`. `uploadEndpoint` is your own route returning a presigned upload
33
+ URL — see the quickstart for a ready-made handler.
34
+
35
+ ## Custom element
36
+
37
+ A `<upup-uploader>` custom element is also published. Importing
38
+ `@useupup/vanilla/element` registers it, after which you can use it declaratively in
39
+ HTML:
40
+
41
+ ```ts
42
+ import '@useupup/vanilla/element'
43
+ ```
44
+
45
+ ## Server Mode
46
+
47
+ For credential isolation and server-proxied cloud drives, add
48
+ [`@useupup/server`](https://www.npmjs.com/package/@useupup/server) and set the mode:
49
+
50
+ ```ts
51
+ createUploader('#uploader', {
52
+ mode: 'server',
53
+ serverUrl: '/api/upup',
54
+ provider: 'aws',
55
+ })
56
+ ```
57
+
58
+ ## Also exported
59
+
60
+ `FileSource`, `StorageProvider`, and `UploadStatus`.
61
+
62
+ ## Links
63
+
64
+ - [Vanilla quickstart](https://useupup.com/docs/quickstarts/vanilla)
65
+ - [Documentation](https://useupup.com/docs/)
66
+ - [Source & monorepo](https://github.com/DevinoSolutions/upup)
67
+
68
+ ## License
69
+
70
+ MIT