@uppy/unsplash
Advanced tools
Comparing version 2.0.3 to 2.1.0
"use strict"; | ||
var _class, _temp; | ||
const { | ||
UIPlugin | ||
} = require('@uppy/core'); | ||
const { | ||
h | ||
} = require('preact'); | ||
const { | ||
SearchProvider, | ||
Provider | ||
} = require('@uppy/companion-client'); | ||
const { | ||
SearchProviderViews | ||
} = require('@uppy/provider-views'); | ||
/** | ||
* Unsplash | ||
* | ||
*/ | ||
module.exports = (_temp = _class = class Unsplash extends UIPlugin { | ||
constructor(uppy, opts) { | ||
super(uppy, opts); | ||
this.id = this.opts.id || 'Unsplash'; | ||
this.title = this.opts.title || 'Unsplash'; | ||
Provider.initPlugin(this, opts, {}); | ||
this.icon = () => h("svg", { | ||
viewBox: "0 0 32 32", | ||
height: "32", | ||
width: "32", | ||
"aria-hidden": "true" | ||
}, h("path", { | ||
d: "M46.575 10.883v-9h12v9zm12 5h10v18h-32v-18h10v9h12z", | ||
fill: "#fff" | ||
}), h("rect", { | ||
className: "uppy-ProviderIconBg", | ||
width: "32", | ||
height: "32", | ||
rx: "16" | ||
}), h("path", { | ||
d: "M13 12.5V8h6v4.5zm6 2.5h5v9H8v-9h5v4.5h6z", | ||
fill: "#fff" | ||
})); | ||
if (!this.opts.companionUrl) { | ||
throw new Error('Companion hostname is required, please consult https://uppy.io/docs/companion'); | ||
} | ||
this.hostname = this.opts.companionUrl; | ||
this.provider = new SearchProvider(uppy, { | ||
companionUrl: this.opts.companionUrl, | ||
companionHeaders: this.opts.companionHeaders, | ||
companionCookiesRule: this.opts.companionCookiesRule, | ||
provider: 'unsplash', | ||
pluginId: this.id | ||
}); | ||
} | ||
install() { | ||
this.view = new SearchProviderViews(this, { | ||
provider: this.provider, | ||
viewType: 'unsplash' | ||
}); | ||
const { | ||
target | ||
} = this.opts; | ||
if (target) { | ||
this.mount(target, this); | ||
} | ||
} | ||
onFirstRender() {// do nothing | ||
} | ||
render(state) { | ||
return this.view.render(state); | ||
} | ||
uninstall() { | ||
this.unmount(); | ||
} | ||
}, _class.VERSION = "2.0.2", _temp); | ||
module.exports = require("./Unsplash.js"); |
{ | ||
"name": "@uppy/unsplash", | ||
"description": "Import files from Unsplash, the free stock photography resource, into Uppy", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"types": "types/index.d.ts", | ||
"type": "module", | ||
"keywords": [ | ||
@@ -23,9 +24,9 @@ "file uploader", | ||
"dependencies": { | ||
"@uppy/companion-client": "^2.0.3", | ||
"@uppy/provider-views": "^2.0.5", | ||
"@uppy/utils": "^4.0.3", | ||
"@uppy/companion-client": "^2.2.0", | ||
"@uppy/provider-views": "^2.1.1", | ||
"@uppy/utils": "^4.1.0", | ||
"preact": "^10.5.13" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^2.1.1" | ||
"@uppy/core": "^2.3.0" | ||
}, | ||
@@ -32,0 +33,0 @@ "publishConfig": { |
@@ -34,4 +34,2 @@ # @uppy/unsplash | ||
We recommend installing from npm and then using a module bundler such as [Webpack](https://webpack.js.org/), [Browserify](http://browserify.org/) or [Rollup.js](http://rollupjs.org/). | ||
Alternatively, you can also use this plugin in a pre-built bundle from Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. | ||
@@ -38,0 +36,0 @@ |
@@ -1,66 +0,1 @@ | ||
const { UIPlugin } = require('@uppy/core') | ||
const { h } = require('preact') | ||
const { SearchProvider, Provider } = require('@uppy/companion-client') | ||
const { SearchProviderViews } = require('@uppy/provider-views') | ||
/** | ||
* Unsplash | ||
* | ||
*/ | ||
module.exports = class Unsplash extends UIPlugin { | ||
static VERSION = require('../package.json').version | ||
constructor (uppy, opts) { | ||
super(uppy, opts) | ||
this.id = this.opts.id || 'Unsplash' | ||
this.title = this.opts.title || 'Unsplash' | ||
Provider.initPlugin(this, opts, {}) | ||
this.icon = () => ( | ||
<svg viewBox="0 0 32 32" height="32" width="32" aria-hidden="true"> | ||
<path d="M46.575 10.883v-9h12v9zm12 5h10v18h-32v-18h10v9h12z" fill="#fff" /> | ||
<rect className="uppy-ProviderIconBg" width="32" height="32" rx="16" /> | ||
<path d="M13 12.5V8h6v4.5zm6 2.5h5v9H8v-9h5v4.5h6z" fill="#fff" /> | ||
</svg> | ||
) | ||
if (!this.opts.companionUrl) { | ||
throw new Error('Companion hostname is required, please consult https://uppy.io/docs/companion') | ||
} | ||
this.hostname = this.opts.companionUrl | ||
this.provider = new SearchProvider(uppy, { | ||
companionUrl: this.opts.companionUrl, | ||
companionHeaders: this.opts.companionHeaders, | ||
companionCookiesRule: this.opts.companionCookiesRule, | ||
provider: 'unsplash', | ||
pluginId: this.id, | ||
}) | ||
} | ||
install () { | ||
this.view = new SearchProviderViews(this, { | ||
provider: this.provider, | ||
viewType: 'unsplash', | ||
}) | ||
const { target } = this.opts | ||
if (target) { | ||
this.mount(target, this) | ||
} | ||
} | ||
onFirstRender () { | ||
// do nothing | ||
} | ||
render (state) { | ||
return this.view.render(state) | ||
} | ||
uninstall () { | ||
this.unmount() | ||
} | ||
} | ||
export { default } from './Unsplash.jsx' |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12809
13
Yes
146
43
1
Updated@uppy/provider-views@^2.1.1
Updated@uppy/utils@^4.1.0