@uppy/thumbnail-generator
Advanced tools
Comparing version 2.0.0-alpha.0 to 2.0.0
@@ -9,4 +9,2 @@ "use strict"; | ||
const Translator = require('@uppy/utils/lib/Translator'); | ||
const dataURItoBlob = require('@uppy/utils/lib/dataURItoBlob'); | ||
@@ -81,3 +79,3 @@ | ||
return new Promise((resolve, reject) => { | ||
return new Promise(resolve => { | ||
if (this.queueProcessing) { | ||
@@ -145,3 +143,3 @@ this.uppy.once('thumbnail:all-generated', () => { | ||
}); | ||
const orientationPromise = exifr.rotation(file.data).catch(_err => 1); | ||
const orientationPromise = exifr.rotation(file.data).catch(() => 1); | ||
return Promise.all([onload, orientationPromise]).then(([image, orientation]) => { | ||
@@ -243,4 +241,4 @@ const dimensions = this.getProportionalDimensions(image, targetWidth, targetHeight, orientation.deg); | ||
let sW = targetWidth * Math.pow(2, steps - 1); | ||
let sH = targetHeight * Math.pow(2, steps - 1); | ||
let sW = targetWidth * 2 ** (steps - 1); | ||
let sH = targetHeight * 2 ** (steps - 1); | ||
const x = 2; | ||
@@ -353,3 +351,3 @@ | ||
return this.requestThumbnail(current).catch(err => {}) // eslint-disable-line handle-callback-err | ||
return this.requestThumbnail(current).catch(() => {}) // eslint-disable-line node/handle-callback-err | ||
.then(() => this.processQueue()); | ||
@@ -411,2 +409,2 @@ } | ||
}, _class.VERSION = "2.0.0-alpha.0", _temp); | ||
}, _class.VERSION = "2.0.0", _temp); |
{ | ||
"name": "@uppy/thumbnail-generator", | ||
"description": "Uppy plugin that generates small previews of images to show on your upload UI.", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
@@ -25,3 +25,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/utils": "^4.0.0-alpha.0", | ||
"@uppy/utils": "^4.0.0", | ||
"exifr": "^6.0.0" | ||
@@ -35,3 +35,3 @@ }, | ||
}, | ||
"gitHead": "113b627dd0ef5aa5d198dc309dda05da2117dfe5" | ||
"gitHead": "ab771cbe1cd87affd87c97bc983b19058e2e72bd" | ||
} |
const { UIPlugin } = require('@uppy/core') | ||
const Translator = require('@uppy/utils/lib/Translator') | ||
const dataURItoBlob = require('@uppy/utils/lib/dataURItoBlob') | ||
@@ -69,3 +68,3 @@ const isObjectURL = require('@uppy/utils/lib/isObjectURL') | ||
const orientationPromise = exifr.rotation(file.data).catch(_err => 1) | ||
const orientationPromise = exifr.rotation(file.data).catch(() => 1) | ||
@@ -164,4 +163,4 @@ return Promise.all([onload, orientationPromise]) | ||
} | ||
let sW = targetWidth * Math.pow(2, steps - 1) | ||
let sH = targetHeight * Math.pow(2, steps - 1) | ||
let sW = targetWidth * 2 ** (steps - 1) | ||
let sH = targetHeight * 2 ** (steps - 1) | ||
const x = 2 | ||
@@ -265,3 +264,3 @@ | ||
return this.requestThumbnail(current) | ||
.catch(err => {}) // eslint-disable-line handle-callback-err | ||
.catch(() => {}) // eslint-disable-line node/handle-callback-err | ||
.then(() => this.processQueue()) | ||
@@ -353,3 +352,3 @@ } | ||
return new Promise((resolve, reject) => { | ||
return new Promise((resolve) => { | ||
if (this.queueProcessing) { | ||
@@ -356,0 +355,0 @@ this.uppy.once('thumbnail:all-generated', () => { |
@@ -1,2 +0,2 @@ | ||
import type { PluginOptions, UIPlugin } from '@uppy/core' | ||
import type { PluginOptions, UIPlugin, UppyFile } from '@uppy/core' | ||
@@ -14,4 +14,14 @@ import ThumbnailGeneratorLocale from './generatedLocale' | ||
declare class ThumbnailGenerator extends UIPlugin<ThumbnailGeneratorOptions> {} | ||
declare class ThumbnailGenerator extends UIPlugin<ThumbnailGeneratorOptions> { } | ||
export default ThumbnailGenerator | ||
// Events | ||
export type ThumbnailGeneratedCallback<TMeta> = (file: UppyFile<TMeta>, preview: string) => void; | ||
declare module '@uppy/core' { | ||
export interface UppyEventMap<TMeta> { | ||
'thumbnail:generated' : ThumbnailGeneratedCallback<TMeta> | ||
} | ||
} |
@@ -18,2 +18,9 @@ import Uppy from '@uppy/core' | ||
}) | ||
uppy.on('thumbnail:generated', (file, preview) => { | ||
const img = document.createElement('img') | ||
img.src = preview | ||
img.width = 100 | ||
document.body.appendChild(img) | ||
}) | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
70399
1191
0
1
Updated@uppy/utils@^4.0.0