filepond-plugin-image-validate-size
Advanced tools
Comparing version 1.2.0 to 1.2.1
/* | ||
* FilePondPluginImageValidateSize 1.2.0 | ||
* FilePondPluginImageValidateSize 1.2.1 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT | ||
@@ -230,3 +230,3 @@ * Please visit https://pqina.nl/filepond for details. | ||
if (isBrowser && document) { | ||
if (isBrowser) { | ||
document.dispatchEvent( | ||
@@ -233,0 +233,0 @@ new CustomEvent('FilePond:pluginloaded', { detail: plugin$1 }) |
/* | ||
* FilePondPluginImageValidateSize 1.2.0 | ||
* FilePondPluginImageValidateSize 1.2.1 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT | ||
@@ -8,2 +8,2 @@ * Please visit https://pqina.nl/filepond for details. | ||
/* eslint-disable */ | ||
const isImage=e=>/^image/.test(e.type),getImageSize=e=>new Promise((i,a)=>{const t=document.createElement("img");t.src=URL.createObjectURL(e),t.onerror=(e=>{clearInterval(E),a(e)});const E=setInterval(()=>{t.naturalWidth&&t.naturalHeight&&(clearInterval(E),URL.revokeObjectURL(t.src),i({width:t.naturalWidth,height:t.naturalHeight}))},1)});var plugin$1=({addFilter:e,utils:i})=>{const{Type:a,replaceInString:t,isFile:E}=i;return e("LOAD_FILE",(e,{query:i})=>new Promise((a,_)=>{if(!E(e)||!isImage(e)||!i("GET_ALLOW_IMAGE_VALIDATE_SIZE"))return void a(e);const I={minWidth:i("GET_IMAGE_VALIDATE_SIZE_MIN_WIDTH"),minHeight:i("GET_IMAGE_VALIDATE_SIZE_MIN_HEIGHT"),maxWidth:i("GET_IMAGE_VALIDATE_SIZE_MAX_WIDTH"),maxHeight:i("GET_IMAGE_VALIDATE_SIZE_MAX_HEIGHT"),minResolution:i("GET_IMAGE_VALIDATE_SIZE_MIN_RESOLUTION"),maxResolution:i("GET_IMAGE_VALIDATE_SIZE_MAX_RESOLUTION")},l=i("GET_IMAGE_VALIDATE_SIZE_MEASURE");((e,i,a)=>new Promise((t,E)=>{const _=({width:e,height:a})=>{const{minWidth:_,minHeight:I,maxWidth:l,maxHeight:o,minResolution:n,maxResolution:T}=i,A=e*a;e<_||a<I?E("TOO_SMALL"):e>l||a>o?E("TOO_BIG"):null!==n&&A<n?E("TOO_LOW_RES"):null!==T&&A>T&&E("TOO_HIGH_RES"),t()};getImageSize(e).then(_).catch(()=>{a?a(e,i).then(_).catch(()=>E()):E()})}))(e,I,l).then(()=>{a(e)}).catch(a=>{const E=a?{TOO_SMALL:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_SMALL"),details:i("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_SIZE")},TOO_BIG:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_BIG"),details:i("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_SIZE")},TOO_LOW_RES:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_LOW"),details:i("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_RESOLUTION")},TOO_HIGH_RES:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_HIGH"),details:i("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_RESOLUTION")}}[a]:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_FORMAT_ERROR"),details:e.type};_({status:{main:E.label,sub:a?t(E.details,I):E.details}})})})),{options:{allowImageValidateSize:[!0,a.BOOLEAN],imageValidateSizeLabelFormatError:["Image type not supported",a.STRING],imageValidateSizeMeasure:[null,a.FUNCTION],imageValidateSizeMinResolution:[null,a.INT],imageValidateSizeMaxResolution:[null,a.INT],imageValidateSizeLabelImageResolutionTooLow:["Resolution is too low",a.STRING],imageValidateSizeLabelImageResolutionTooHigh:["Resolution is too high",a.STRING],imageValidateSizeLabelExpectedMinResolution:["Minimum resolution is {minResolution}",a.STRING],imageValidateSizeLabelExpectedMaxResolution:["Maximum resolution is {maxResolution}",a.STRING],imageValidateSizeMinWidth:[1,a.INT],imageValidateSizeMinHeight:[1,a.INT],imageValidateSizeMaxWidth:[65535,a.INT],imageValidateSizeMaxHeight:[65535,a.INT],imageValidateSizeLabelImageSizeTooSmall:["Image is too small",a.STRING],imageValidateSizeLabelImageSizeTooBig:["Image is too big",a.STRING],imageValidateSizeLabelExpectedMinSize:["Minimum size is {minWidth} × {minHeight}",a.STRING],imageValidateSizeLabelExpectedMaxSize:["Maximum size is {maxWidth} × {maxHeight}",a.STRING]}}};const isBrowser="undefined"!=typeof window&&void 0!==window.document;isBrowser&&document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:plugin$1}));export default plugin$1; | ||
const isImage=e=>/^image/.test(e.type),getImageSize=e=>new Promise((i,a)=>{const t=document.createElement("img");t.src=URL.createObjectURL(e),t.onerror=(e=>{clearInterval(E),a(e)});const E=setInterval(()=>{t.naturalWidth&&t.naturalHeight&&(clearInterval(E),URL.revokeObjectURL(t.src),i({width:t.naturalWidth,height:t.naturalHeight}))},1)});var plugin$1=({addFilter:e,utils:i})=>{const{Type:a,replaceInString:t,isFile:E}=i;return e("LOAD_FILE",(e,{query:i})=>new Promise((a,_)=>{if(!E(e)||!isImage(e)||!i("GET_ALLOW_IMAGE_VALIDATE_SIZE"))return void a(e);const I={minWidth:i("GET_IMAGE_VALIDATE_SIZE_MIN_WIDTH"),minHeight:i("GET_IMAGE_VALIDATE_SIZE_MIN_HEIGHT"),maxWidth:i("GET_IMAGE_VALIDATE_SIZE_MAX_WIDTH"),maxHeight:i("GET_IMAGE_VALIDATE_SIZE_MAX_HEIGHT"),minResolution:i("GET_IMAGE_VALIDATE_SIZE_MIN_RESOLUTION"),maxResolution:i("GET_IMAGE_VALIDATE_SIZE_MAX_RESOLUTION")},l=i("GET_IMAGE_VALIDATE_SIZE_MEASURE");((e,i,a)=>new Promise((t,E)=>{const _=({width:e,height:a})=>{const{minWidth:_,minHeight:I,maxWidth:l,maxHeight:o,minResolution:n,maxResolution:T}=i,A=e*a;e<_||a<I?E("TOO_SMALL"):e>l||a>o?E("TOO_BIG"):null!==n&&A<n?E("TOO_LOW_RES"):null!==T&&A>T&&E("TOO_HIGH_RES"),t()};getImageSize(e).then(_).catch(()=>{a?a(e,i).then(_).catch(()=>E()):E()})}))(e,I,l).then(()=>{a(e)}).catch(a=>{const E=a?{TOO_SMALL:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_SMALL"),details:i("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_SIZE")},TOO_BIG:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_BIG"),details:i("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_SIZE")},TOO_LOW_RES:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_LOW"),details:i("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_RESOLUTION")},TOO_HIGH_RES:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_HIGH"),details:i("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_RESOLUTION")}}[a]:{label:i("GET_IMAGE_VALIDATE_SIZE_LABEL_FORMAT_ERROR"),details:e.type};_({status:{main:E.label,sub:a?t(E.details,I):E.details}})})})),{options:{allowImageValidateSize:[!0,a.BOOLEAN],imageValidateSizeLabelFormatError:["Image type not supported",a.STRING],imageValidateSizeMeasure:[null,a.FUNCTION],imageValidateSizeMinResolution:[null,a.INT],imageValidateSizeMaxResolution:[null,a.INT],imageValidateSizeLabelImageResolutionTooLow:["Resolution is too low",a.STRING],imageValidateSizeLabelImageResolutionTooHigh:["Resolution is too high",a.STRING],imageValidateSizeLabelExpectedMinResolution:["Minimum resolution is {minResolution}",a.STRING],imageValidateSizeLabelExpectedMaxResolution:["Maximum resolution is {maxResolution}",a.STRING],imageValidateSizeMinWidth:[1,a.INT],imageValidateSizeMinHeight:[1,a.INT],imageValidateSizeMaxWidth:[65535,a.INT],imageValidateSizeMaxHeight:[65535,a.INT],imageValidateSizeLabelImageSizeTooSmall:["Image is too small",a.STRING],imageValidateSizeLabelImageSizeTooBig:["Image is too big",a.STRING],imageValidateSizeLabelExpectedMinSize:["Minimum size is {minWidth} × {minHeight}",a.STRING],imageValidateSizeLabelExpectedMaxSize:["Maximum size is {maxWidth} × {maxHeight}",a.STRING]}}};const isBrowser="undefined"!=typeof window&&void 0!==window.document;isBrowser&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:plugin$1}));export default plugin$1; |
/* | ||
* FilePondPluginImageValidateSize 1.2.0 | ||
* FilePondPluginImageValidateSize 1.2.1 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT | ||
@@ -253,3 +253,3 @@ * Please visit https://pqina.nl/filepond for details. | ||
if (isBrowser && document) { | ||
if (isBrowser) { | ||
document.dispatchEvent( | ||
@@ -256,0 +256,0 @@ new CustomEvent('FilePond:pluginloaded', { detail: plugin$1 }) |
/* | ||
* FilePondPluginImageValidateSize 1.2.0 | ||
* FilePondPluginImageValidateSize 1.2.1 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT | ||
@@ -8,2 +8,2 @@ * Please visit https://pqina.nl/filepond for details. | ||
/* eslint-disable */ | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):e.FilePondPluginImageValidateSize=i()}(this,function(){"use strict";var e=function(e){var i=e.addFilter,t=e.utils,a=t.Type,n=t.replaceInString,I=t.isFile,l=function(i,m,t){return new Promise(function(T,A){var E,e=function(e){var i=e.width,t=e.height,a=m.minWidth,E=m.minHeight,_=m.maxWidth,n=m.maxHeight,I=m.minResolution,l=m.maxResolution,o=i*t;i<a||t<E?A("TOO_SMALL"):_<i||n<t?A("TOO_BIG"):null!==I&&o<I?A("TOO_LOW_RES"):null!==l&&l<o&&A("TOO_HIGH_RES"),T()};(E=i,new Promise(function(e,i){var t=document.createElement("img");t.src=URL.createObjectURL(E),t.onerror=function(e){clearInterval(a),i(e)};var a=setInterval(function(){t.naturalWidth&&t.naturalHeight&&(clearInterval(a),URL.revokeObjectURL(t.src),e({width:t.naturalWidth,height:t.naturalHeight}))},1)})).then(e).catch(function(){t?t(i,m).then(e).catch(function(){return A()}):A()})})};return i("LOAD_FILE",function(E,e){var _=e.query;return new Promise(function(e,t){if(I(E)&&/^image/.test(E.type)&&_("GET_ALLOW_IMAGE_VALIDATE_SIZE")){var a={minWidth:_("GET_IMAGE_VALIDATE_SIZE_MIN_WIDTH"),minHeight:_("GET_IMAGE_VALIDATE_SIZE_MIN_HEIGHT"),maxWidth:_("GET_IMAGE_VALIDATE_SIZE_MAX_WIDTH"),maxHeight:_("GET_IMAGE_VALIDATE_SIZE_MAX_HEIGHT"),minResolution:_("GET_IMAGE_VALIDATE_SIZE_MIN_RESOLUTION"),maxResolution:_("GET_IMAGE_VALIDATE_SIZE_MAX_RESOLUTION")},i=_("GET_IMAGE_VALIDATE_SIZE_MEASURE");l(E,a,i).then(function(){e(E)}).catch(function(e){var i=e?{TOO_SMALL:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_SMALL"),details:_("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_SIZE")},TOO_BIG:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_BIG"),details:_("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_SIZE")},TOO_LOW_RES:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_LOW"),details:_("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_RESOLUTION")},TOO_HIGH_RES:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_HIGH"),details:_("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_RESOLUTION")}}[e]:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_FORMAT_ERROR"),details:E.type};t({status:{main:i.label,sub:e?n(i.details,a):i.details}})})}else e(E)})}),{options:{allowImageValidateSize:[!0,a.BOOLEAN],imageValidateSizeLabelFormatError:["Image type not supported",a.STRING],imageValidateSizeMeasure:[null,a.FUNCTION],imageValidateSizeMinResolution:[null,a.INT],imageValidateSizeMaxResolution:[null,a.INT],imageValidateSizeLabelImageResolutionTooLow:["Resolution is too low",a.STRING],imageValidateSizeLabelImageResolutionTooHigh:["Resolution is too high",a.STRING],imageValidateSizeLabelExpectedMinResolution:["Minimum resolution is {minResolution}",a.STRING],imageValidateSizeLabelExpectedMaxResolution:["Maximum resolution is {maxResolution}",a.STRING],imageValidateSizeMinWidth:[1,a.INT],imageValidateSizeMinHeight:[1,a.INT],imageValidateSizeMaxWidth:[65535,a.INT],imageValidateSizeMaxHeight:[65535,a.INT],imageValidateSizeLabelImageSizeTooSmall:["Image is too small",a.STRING],imageValidateSizeLabelImageSizeTooBig:["Image is too big",a.STRING],imageValidateSizeLabelExpectedMinSize:["Minimum size is {minWidth} × {minHeight}",a.STRING],imageValidateSizeLabelExpectedMaxSize:["Maximum size is {maxWidth} × {maxHeight}",a.STRING]}}};return"undefined"!=typeof window&&void 0!==window.document&&document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e})),e}); | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):e.FilePondPluginImageValidateSize=i()}(this,function(){"use strict";var e=function(e){var i=e.addFilter,t=e.utils,a=t.Type,n=t.replaceInString,I=t.isFile,l=function(i,L,t){return new Promise(function(T,A){var E,e=function(e){var i=e.width,t=e.height,a=L.minWidth,E=L.minHeight,_=L.maxWidth,n=L.maxHeight,I=L.minResolution,l=L.maxResolution,o=i*t;i<a||t<E?A("TOO_SMALL"):_<i||n<t?A("TOO_BIG"):null!==I&&o<I?A("TOO_LOW_RES"):null!==l&&l<o&&A("TOO_HIGH_RES"),T()};(E=i,new Promise(function(e,i){var t=document.createElement("img");t.src=URL.createObjectURL(E),t.onerror=function(e){clearInterval(a),i(e)};var a=setInterval(function(){t.naturalWidth&&t.naturalHeight&&(clearInterval(a),URL.revokeObjectURL(t.src),e({width:t.naturalWidth,height:t.naturalHeight}))},1)})).then(e).catch(function(){t?t(i,L).then(e).catch(function(){return A()}):A()})})};return i("LOAD_FILE",function(E,e){var _=e.query;return new Promise(function(e,t){if(I(E)&&/^image/.test(E.type)&&_("GET_ALLOW_IMAGE_VALIDATE_SIZE")){var a={minWidth:_("GET_IMAGE_VALIDATE_SIZE_MIN_WIDTH"),minHeight:_("GET_IMAGE_VALIDATE_SIZE_MIN_HEIGHT"),maxWidth:_("GET_IMAGE_VALIDATE_SIZE_MAX_WIDTH"),maxHeight:_("GET_IMAGE_VALIDATE_SIZE_MAX_HEIGHT"),minResolution:_("GET_IMAGE_VALIDATE_SIZE_MIN_RESOLUTION"),maxResolution:_("GET_IMAGE_VALIDATE_SIZE_MAX_RESOLUTION")},i=_("GET_IMAGE_VALIDATE_SIZE_MEASURE");l(E,a,i).then(function(){e(E)}).catch(function(e){var i=e?{TOO_SMALL:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_SMALL"),details:_("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_SIZE")},TOO_BIG:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_BIG"),details:_("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_SIZE")},TOO_LOW_RES:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_LOW"),details:_("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_RESOLUTION")},TOO_HIGH_RES:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_HIGH"),details:_("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_RESOLUTION")}}[e]:{label:_("GET_IMAGE_VALIDATE_SIZE_LABEL_FORMAT_ERROR"),details:E.type};t({status:{main:i.label,sub:e?n(i.details,a):i.details}})})}else e(E)})}),{options:{allowImageValidateSize:[!0,a.BOOLEAN],imageValidateSizeLabelFormatError:["Image type not supported",a.STRING],imageValidateSizeMeasure:[null,a.FUNCTION],imageValidateSizeMinResolution:[null,a.INT],imageValidateSizeMaxResolution:[null,a.INT],imageValidateSizeLabelImageResolutionTooLow:["Resolution is too low",a.STRING],imageValidateSizeLabelImageResolutionTooHigh:["Resolution is too high",a.STRING],imageValidateSizeLabelExpectedMinResolution:["Minimum resolution is {minResolution}",a.STRING],imageValidateSizeLabelExpectedMaxResolution:["Maximum resolution is {maxResolution}",a.STRING],imageValidateSizeMinWidth:[1,a.INT],imageValidateSizeMinHeight:[1,a.INT],imageValidateSizeMaxWidth:[65535,a.INT],imageValidateSizeMaxHeight:[65535,a.INT],imageValidateSizeLabelImageSizeTooSmall:["Image is too small",a.STRING],imageValidateSizeLabelImageSizeTooBig:["Image is too big",a.STRING],imageValidateSizeLabelExpectedMinSize:["Minimum size is {minWidth} × {minHeight}",a.STRING],imageValidateSizeLabelExpectedMaxSize:["Maximum size is {maxWidth} × {maxHeight}",a.STRING]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e})),e}); |
{ | ||
"name": "filepond-plugin-image-validate-size", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Image Size Validation Plugin for FilePond", | ||
@@ -16,4 +16,4 @@ "homepage": "https://pqina.nl/filepond", | ||
"peerDependencies": { | ||
"filepond": ">=1.8.x <4.x" | ||
"filepond": ">=1.8.x <5.x" | ||
} | ||
} |
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
24804