Ver Fonte

Move `ProviderView` to `@uppy/provider-views`.

Steps taken:

```bash
cp -R package-template packages/@uppy/provider-views
vim packages/@uppy/provider-views/{README.md,package.json}
vim src/plugins/{Dropbox,GoogleDrive,Instagram}/index.js # Update require()s
vim src/index.js # Update require()
```
Renée Kooi há 6 anos atrás
pai
commit
ac07bcf0cb

+ 21 - 0
packages/@uppy/provider-views/LICENSE

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2018 Transloadit
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 45 - 0
packages/@uppy/provider-views/README.md

@@ -0,0 +1,45 @@
+# @uppy/provider-views
+
+<img src="https://uppy.io/images/logos/uppy-dog-head-arrow.svg" width="120" alt="Uppy logo: a superman puppy in a pink suit" align="right">
+
+<a href="https://www.npmjs.com/package/@uppy/provider-views"><img src="https://img.shields.io/npm/v/@uppy/provider-views.svg?style=flat-square"></a>
+<a href="https://travis-ci.org/transloadit/uppy"><img src="https://img.shields.io/travis/transloadit/uppy/master.svg?style=flat-square" alt="Build Status"></a>
+
+View library for Uppy remote provider plugins.
+
+Uppy is being developed by the folks at [Transloadit](https://transloadit.com), a versatile file encoding service.
+
+## Example
+
+```js
+const Plugin = require('@uppy/core/lib/plugin')
+const ProviderViews = require('@uppy/provider-views')
+
+class GoogleDrive extends Plugin {
+  constructor () { /* snip */ }
+  install () {
+    this.view = new ProviderViews(this)
+    // snip
+  }
+
+  render (state) {
+    return this.view.render(state)
+  }
+}
+```
+
+## Installation
+
+> Unless you are creating a custom provider plugin, you do not need to install this.
+
+```bash
+$ npm install @uppy/provider-views --save
+```
+
+## Documentation
+
+Documentation for this plugin can be found on the [Uppy website](https://uppy.io/docs/DOC_PAGE_HERE).
+
+## License
+
+[The MIT License](./LICENSE).

+ 28 - 0
packages/@uppy/provider-views/package.json

@@ -0,0 +1,28 @@
+{
+  "name": "@uppy/provider-views",
+  "description": "View library for Uppy remote provider plugins.",
+  "version": "0.25.5",
+  "license": "MIT",
+  "main": "lib/index.js",
+  "jsnext:main": "src/index.js",
+  "types": "types/index.d.ts",
+  "keywords": [
+    "file uploader",
+    "plugin name and other keywords",
+    "uppy",
+    "uppy-plugin"
+  ],
+  "homepage": "https://uppy.io",
+  "bugs": {
+    "url": "https://github.com/transloadit/uppy/issues"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/transloadit/uppy.git"
+  },
+  "dependencies": {
+    "@uppy/utils": "^0.25.5",
+    "classnames": "^2.2.6",
+    "preact": "^8.2.9"
+  }
+}

+ 0 - 0
src/views/ProviderView/AuthView.js → packages/@uppy/provider-views/src/AuthView.js


+ 0 - 0
src/views/ProviderView/Breadcrumbs.js → packages/@uppy/provider-views/src/Breadcrumbs.js


+ 0 - 0
src/views/ProviderView/Browser.js → packages/@uppy/provider-views/src/Browser.js


+ 0 - 0
src/views/ProviderView/Filter.js → packages/@uppy/provider-views/src/Filter.js


+ 0 - 0
src/views/ProviderView/FooterActions.js → packages/@uppy/provider-views/src/FooterActions.js


+ 0 - 0
src/views/ProviderView/Item.js → packages/@uppy/provider-views/src/Item.js


+ 0 - 0
src/views/ProviderView/ItemList.js → packages/@uppy/provider-views/src/ItemList.js


+ 0 - 0
src/views/ProviderView/Loader.js → packages/@uppy/provider-views/src/Loader.js


+ 0 - 0
src/views/ProviderView/index.js → packages/@uppy/provider-views/src/index.js


+ 0 - 0
packages/@uppy/provider-views/types/index.d.ts


+ 2 - 2
src/index.js

@@ -4,7 +4,7 @@ const Core = require('@uppy/core')
 const server = require('@uppy/server-utils')
 
 // Reusable views
-const views = require('./views')
+const ProviderView = require('@uppy/provider-views')
 
 // Parent
 const Plugin = require('@uppy/core/lib/Plugin')
@@ -38,7 +38,7 @@ const ReduxDevTools = require('./plugins/ReduxDevTools')
 
 module.exports = {
   Core,
-  views,
+  views: { ProviderView },
   server,
   Plugin,
   StatusBar,

+ 2 - 2
src/plugins/Dropbox/index.js

@@ -1,6 +1,6 @@
 const Plugin = require('@uppy/core/lib/Plugin')
 const { Provider } = require('@uppy/server-utils')
-const { ProviderView } = require('../../views')
+const ProviderViews = require('@uppy/provider-views')
 const icons = require('./icons')
 const { h } = require('preact')
 
@@ -39,7 +39,7 @@ module.exports = class Dropbox extends Plugin {
   }
 
   install () {
-    this.view = new ProviderView(this)
+    this.view = new ProviderViews(this)
     // Set default state for Dropbox
     this.setPluginState({
       authenticated: false,

+ 2 - 2
src/plugins/GoogleDrive/index.js

@@ -1,6 +1,6 @@
 const Plugin = require('@uppy/core/lib/Plugin')
 const { Provider } = require('@uppy/server-utils')
-const { ProviderView } = require('../../views')
+const ProviderViews = require('@uppy/provider-views')
 const { h } = require('preact')
 
 module.exports = class GoogleDrive extends Plugin {
@@ -34,7 +34,7 @@ module.exports = class GoogleDrive extends Plugin {
   }
 
   install () {
-    this.view = new ProviderView(this)
+    this.view = new ProviderViews(this)
     // Set default state for Google Drive
     this.setPluginState({
       authenticated: false,

+ 2 - 2
src/plugins/Instagram/index.js

@@ -1,6 +1,6 @@
 const Plugin = require('@uppy/core/lib/Plugin')
 const { Provider } = require('@uppy/server-utils')
-const { ProviderView } = require('../../views')
+const ProviderViews = require('@uppy/provider-views')
 const { h } = require('preact')
 
 module.exports = class Instagram extends Plugin {
@@ -37,7 +37,7 @@ module.exports = class Instagram extends Plugin {
   }
 
   install () {
-    this.view = new ProviderView(this, {
+    this.view = new ProviderViews(this, {
       viewType: 'grid',
       showTitles: false,
       showFilter: false,