@uppy/unsplash
Advanced tools
Comparing version 0.1.13 to 0.2.0-alpha.0
124
lib/index.js
@@ -0,20 +1,20 @@ | ||
"use strict"; | ||
var _class, _temp; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
const { | ||
UIPlugin | ||
} = require('@uppy/core'); | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | ||
const { | ||
h | ||
} = require('preact'); | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
const { | ||
SearchProvider | ||
} = require('@uppy/companion-client'); | ||
var _require = require('@uppy/core'), | ||
Plugin = _require.Plugin; | ||
var _require2 = require('preact'), | ||
h = _require2.h; | ||
var _require3 = require('@uppy/companion-client'), | ||
SearchProvider = _require3.SearchProvider; | ||
var _require4 = require('@uppy/provider-views'), | ||
SearchProviderViews = _require4.SearchProviderViews; | ||
const { | ||
SearchProviderViews | ||
} = require('@uppy/provider-views'); | ||
/** | ||
@@ -26,58 +26,53 @@ * Unsplash | ||
module.exports = (_temp = _class = /*#__PURE__*/function (_Plugin) { | ||
_inheritsLoose(Unsplash, _Plugin); | ||
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'; | ||
this.type = 'acquirer'; | ||
function Unsplash(uppy, opts) { | ||
var _this; | ||
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" | ||
})); | ||
_this = _Plugin.call(this, uppy, opts) || this; | ||
_this.id = _this.opts.id || 'Unsplash'; | ||
_this.title = _this.opts.title || 'Unsplash'; | ||
_this.type = 'acquirer'; | ||
_this.icon = function () { | ||
return 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" | ||
})); | ||
const defaultOptions = {}; | ||
this.opts = { ...defaultOptions, | ||
...opts | ||
}; | ||
this.hostname = this.opts.companionUrl; | ||
var defaultOptions = {}; | ||
_this.opts = _extends({}, defaultOptions, opts); | ||
_this.hostname = _this.opts.companionUrl; | ||
if (!_this.hostname) { | ||
if (!this.hostname) { | ||
throw new Error('Companion hostname is required, please consult https://uppy.io/docs/companion'); | ||
} | ||
_this.provider = new SearchProvider(uppy, { | ||
companionUrl: _this.opts.companionUrl, | ||
companionHeaders: _this.opts.companionHeaders, | ||
companionCookiesRule: _this.opts.companionCookiesRule, | ||
this.provider = new SearchProvider(uppy, { | ||
companionUrl: this.opts.companionUrl, | ||
companionHeaders: this.opts.companionHeaders, | ||
companionCookiesRule: this.opts.companionCookiesRule, | ||
provider: 'unsplash', | ||
pluginId: _this.id | ||
pluginId: this.id | ||
}); | ||
return _this; | ||
} | ||
var _proto = Unsplash.prototype; | ||
_proto.install = function install() { | ||
install() { | ||
this.view = new SearchProviderViews(this, { | ||
provider: this.provider | ||
}); | ||
var target = this.opts.target; | ||
const { | ||
target | ||
} = this.opts; | ||
@@ -87,16 +82,15 @@ if (target) { | ||
} | ||
}; | ||
} | ||
_proto.onFirstRender = function onFirstRender() {// do nothing | ||
}; | ||
onFirstRender() {// do nothing | ||
} | ||
_proto.render = function render(state) { | ||
render(state) { | ||
return this.view.render(state); | ||
}; | ||
} | ||
_proto.uninstall = function uninstall() { | ||
uninstall() { | ||
this.unmount(); | ||
}; | ||
} | ||
return Unsplash; | ||
}(Plugin), _class.VERSION = "0.1.13", _temp); | ||
}, _class.VERSION = "0.2.0-alpha.0", _temp); |
{ | ||
"name": "@uppy/unsplash", | ||
"description": "Import files from Unsplash, the free stock photography resource, into Uppy", | ||
"version": "0.1.13", | ||
"version": "0.2.0-alpha.0", | ||
"license": "MIT", | ||
@@ -23,6 +23,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/companion-client": "^1.10.2", | ||
"@uppy/provider-views": "^1.12.3", | ||
"@uppy/utils": "^3.6.2", | ||
"preact": "8.2.9" | ||
"@uppy/companion-client": "^2.0.0-alpha.0", | ||
"@uppy/provider-views": "^2.0.0-alpha.0", | ||
"@uppy/utils": "^4.0.0-alpha.0", | ||
"preact": "^10.5.13" | ||
}, | ||
@@ -35,3 +35,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "4b782ffbbb443672843d7b4096956bed3b11d612" | ||
"gitHead": "113b627dd0ef5aa5d198dc309dda05da2117dfe5" | ||
} |
@@ -17,6 +17,6 @@ # @uppy/unsplash | ||
```js | ||
const Uppy = require('@uppy/core') | ||
const Unsplash = require('@uppy/unsplash') | ||
import Uppy from '@uppy/core' | ||
import Unsplash from '@uppy/unsplash' | ||
const uppy = Uppy() | ||
const uppy = new Uppy() | ||
uppy.use(Unsplash, { | ||
@@ -23,0 +23,0 @@ // Options |
@@ -1,2 +0,2 @@ | ||
const { Plugin } = require('@uppy/core') | ||
const { UIPlugin } = require('@uppy/core') | ||
const { h } = require('preact') | ||
@@ -10,3 +10,3 @@ const { SearchProvider } = require('@uppy/companion-client') | ||
*/ | ||
module.exports = class Unsplash extends Plugin { | ||
module.exports = class Unsplash extends UIPlugin { | ||
static VERSION = require('../package.json').version | ||
@@ -49,3 +49,3 @@ | ||
const target = this.opts.target | ||
const { target } = this.opts | ||
if (target) { | ||
@@ -52,0 +52,0 @@ this.mount(target, this) |
@@ -1,16 +0,12 @@ | ||
import Uppy = require('@uppy/core') | ||
import CompanionClient = require('@uppy/companion-client') | ||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core' | ||
import type { RequestClientOptions } from '@uppy/companion-client' | ||
declare module Unsplash { | ||
interface UnsplashOptions | ||
extends Uppy.PluginOptions, | ||
CompanionClient.RequestClientOptions { | ||
interface UnsplashOptions extends PluginOptions, RequestClientOptions { | ||
replaceTargetContent?: boolean | ||
target?: Uppy.PluginTarget | ||
target?: PluginTarget | ||
title?: string | ||
} | ||
} | ||
declare class Unsplash extends Uppy.Plugin<Unsplash.UnsplashOptions> {} | ||
declare class Unsplash extends UIPlugin<UnsplashOptions> {} | ||
export = Unsplash | ||
export default Unsplash |
@@ -1,2 +0,13 @@ | ||
import Unsplash = require('../') | ||
// TODO implement | ||
import Uppy from '@uppy/core' | ||
import Unsplash from '..' | ||
{ | ||
const uppy = new Uppy() | ||
uppy.use(Unsplash, { | ||
companionUrl: '', | ||
companionCookiesRule: 'same-origin', | ||
replaceTargetContent: false, | ||
target: 'body', | ||
title: 'title', | ||
}) | ||
} |
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
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
152
12156
+ Added@uppy/companion-client@2.2.2(transitive)
+ Added@uppy/core@2.3.4(transitive)
+ Added@uppy/provider-views@2.1.3(transitive)
+ Added@uppy/store-default@2.1.1(transitive)
+ Added@uppy/utils@4.1.3(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addedpreact@10.24.3(transitive)
- Removed@uppy/companion-client@1.10.2(transitive)
- Removed@uppy/provider-views@1.12.3(transitive)
- Removedqs-stringify@1.2.1(transitive)
- Removedquerystringify@2.2.0(transitive)
- Removedrequires-port@1.0.0(transitive)
- Removedurl-parse@1.5.10(transitive)
Updated@uppy/utils@^4.0.0-alpha.0
Updatedpreact@^10.5.13