next-cloudinary 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,14 +33,18 @@ function _objectWithoutPropertiesLoose(source, excluded) {
33
33
  }
34
34
 
35
35
  const cropsGravityAuto = ['crop', 'fill', 'lfill', 'fill_pad', 'thumb'];
36
- const props$6 = ['crop', 'gravity'];
37
- function plugin$6({
36
+ const cropsWithZoom = ['crop', 'thumb'];
37
+ const props$7 = ['crop', 'gravity', 'zoom'];
38
+ function plugin$7({
38
39
  cldImage,
39
40
  options
40
41
  } = {}) {
42
+ const overrides = {};
41
43
  const {
42
44
  width,
43
45
  height,
46
+ widthResize,
47
+ heightResize,
44
48
  crop = 'limit'
45
49
  } = options;
46
50
  let transformationString = `c_${crop},w_${width}`;
@@ -52,18 +56,36 @@ function plugin$6({
52
56
  }
53
57
  if (options.gravity) {
54
58
  if (options.gravity === 'auto' && !cropsGravityAuto.includes(crop)) {
55
- console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');
59
+ console.warn(`Auto gravity can only be used with crop modes: ${cropsGravityAuto.join(', ')}. Not applying gravity.`);
56
60
  } else {
57
61
  transformationString = `${transformationString},g_${options.gravity}`;
58
62
  }
59
63
  }
60
- cldImage.resize(transformationString);
64
+ if (options.zoom) {
65
+ if (options.zoom === 'auto' && !cropsWithZoom.includes(crop)) {
66
+ console.warn(`Zoom can only be used with crop modes: ${cropsWithZoom.join(', ')}. Not applying zoom.`);
67
+ } else {
68
+ transformationString = `${transformationString},z_${options.zoom}`;
69
+ }
70
+ }
71
+ cldImage.effect(transformationString);
72
+
73
+ // If we have a resize width that's smaller than the user-defined width, we want to give the
74
+ // ability to perform a final resize on the image without impacting any of the effects like text
75
+ // overlays that may depend on the size to work properly
76
+
77
+ if (typeof widthResize === 'number' && widthResize < width) {
78
+ overrides.width = widthResize;
79
+ }
80
+ return {
81
+ options: overrides
82
+ };
61
83
  }
62
84
 
63
85
  var croppingPlugin = {
64
86
  __proto__: null,
65
- props: props$6,
66
- plugin: plugin$6
87
+ props: props$7,
88
+ plugin: plugin$7
67
89
  };
68
90
 
69
91
  const params = ['art', {
@@ -112,8 +134,8 @@ const params = ['art', {
112
134
  prop: 'unsharpMask',
113
135
  effect: 'unsharp_mask'
114
136
  }, 'vectorize', 'vibrance', 'vignette'];
115
- const props$5 = params.map(param => param.prop || param);
116
- function plugin$5({
137
+ const props$6 = params.map(param => param.prop || param);
138
+ function plugin$6({
117
139
  cldImage,
118
140
  options
119
141
  } = {}) {
@@ -130,8 +152,8 @@ function plugin$5({
130
152
 
131
153
  var effectsPlugin = {
132
154
  __proto__: null,
133
- props: props$5,
134
- plugin: plugin$5
155
+ props: props$6,
156
+ plugin: plugin$6
135
157
  };
136
158
 
137
159
  /**
@@ -216,14 +238,14 @@ const text = {
216
238
  };
217
239
 
218
240
  const _excluded$3 = ["publicId", "url", "position", "text", "effects"];
219
- const props$4 = ['text', 'overlays'];
241
+ const props$5 = ['text', 'overlays'];
220
242
  const DEFAULT_TEXT_OPTIONS = {
221
243
  color: 'black',
222
244
  fontFamily: 'Arial',
223
245
  fontSize: 200,
224
246
  fontWeight: 'bold'
225
247
  };
226
- function plugin$4({
248
+ function plugin$5({
227
249
  cldImage,
228
250
  options
229
251
  } = {}) {
@@ -369,8 +391,30 @@ function plugin$4({
369
391
 
370
392
  var overlaysPlugin = {
371
393
  __proto__: null,
372
- props: props$4,
394
+ props: props$5,
373
395
  DEFAULT_TEXT_OPTIONS: DEFAULT_TEXT_OPTIONS,
396
+ plugin: plugin$5
397
+ };
398
+
399
+ const props$4 = ['transformations'];
400
+ function plugin$4({
401
+ cldImage,
402
+ options
403
+ } = {}) {
404
+ let {
405
+ transformations = []
406
+ } = options;
407
+ if (!Array.isArray(transformations)) {
408
+ transformations = [transformations];
409
+ }
410
+ transformations.forEach(transformation => {
411
+ cldImage.addTransformation(`t_${transformation}`);
412
+ });
413
+ }
414
+
415
+ var namedTransformationsPlugin = {
416
+ __proto__: null,
417
+ props: props$4,
374
418
  plugin: plugin$4
375
419
  };
376
420
 
@@ -577,7 +621,7 @@ var zoompanPlugin = {
577
621
 
578
622
  const transformationPlugins = [
579
623
  // Background Removal must always come first
580
- removeBackgroundPlugin, croppingPlugin, effectsPlugin, overlaysPlugin, underlaysPlugin, zoompanPlugin,
624
+ removeBackgroundPlugin, croppingPlugin, effectsPlugin, overlaysPlugin, namedTransformationsPlugin, underlaysPlugin, zoompanPlugin,
581
625
  // Raw transformations needs to be last simply to make sure
582
626
  // it's always expected to applied the same way
583
627
 
@@ -617,7 +661,19 @@ function constructCloudinaryUrl({
617
661
  if (pluginOptions != null && pluginOptions.format) {
618
662
  options.format = pluginOptions.format;
619
663
  }
664
+ if (pluginOptions != null && pluginOptions.width) {
665
+ options.resize = {
666
+ width: pluginOptions == null ? void 0 : pluginOptions.width
667
+ };
668
+ }
620
669
  });
670
+ if (options.resize) {
671
+ const {
672
+ width,
673
+ crop = 'scale'
674
+ } = options.resize;
675
+ cldImage.effect(`c_${crop},w_${width}`);
676
+ }
621
677
  return cldImage.setDeliveryType(options.deliveryType || 'upload').format(options.format || 'auto').delivery(`q_${options.quality || 'auto'}`).toURL();
622
678
  }
623
679
 
@@ -686,6 +742,8 @@ function cloudinaryLoader({
686
742
  cldConfig = {}
687
743
  }) {
688
744
  const options = _extends({}, imageProps, cldOptions);
745
+ options.width = parseInt(options.width);
746
+ options.height = parseInt(options.height);
689
747
 
690
748
  // The loader options are used to create dynamic sizing when working with responsive images
691
749
  // so these should override the default options collected from the props alone if
@@ -694,8 +752,8 @@ function cloudinaryLoader({
694
752
 
695
753
  if (loaderOptions != null && loaderOptions.width && loaderOptions.width !== options.width) {
696
754
  const multiplier = loaderOptions.width / options.width;
697
- options.width = loaderOptions.width;
698
- options.height = Math.round(options.height * multiplier);
755
+ options.widthResize = loaderOptions.width;
756
+ options.heightResize = Math.round(options.height * multiplier);
699
757
  }
700
758
  return constructCloudinaryUrl({
701
759
  options,
@@ -1 +1 @@
1
- {"version":3,"file":"next-cloudinary.modern.mjs","sources":["../src/plugins/cropping.js","../src/plugins/effects.js","../src/lib/util.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/raw-transformations.js","../src/plugins/remove-background.js","../src/plugins/underlays.js","../src/plugins/zoompan.js","../src/lib/cloudinary.js","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.js","../src/components/CldOgImage/CldOgImage.js","../src/components/CldUploadWidget/CldUploadWidget.js","../src/components/CldUploadButton/CldUploadButton.js"],"sourcesContent":["const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\n\nexport const props = ['crop', 'gravity'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { width, height, crop = 'limit' } = options;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !options.gravity && cropsGravityAuto.includes(crop) ) {\n options.gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( options.gravity ) {\n if ( options.gravity === 'auto' && !cropsGravityAuto.includes(crop) ) {\n console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');\n } else {\n transformationString = `${transformationString},g_${options.gravity}`;\n }\n }\n\n cldImage.resize(transformationString);\n}\n","const params = [\n 'art',\n {\n prop: 'autoBrightness',\n effect: 'auto_brightness',\n },\n {\n prop: 'autoColor',\n effect: 'auto_color',\n },\n {\n prop: 'autoContrast',\n effect: 'auto_contrast',\n },\n {\n prop: 'assistColorblind',\n effect: 'assist_colorblind',\n },\n 'blackwhite',\n 'blur',\n {\n prop: 'blurFaces',\n effect: 'blur_faces',\n },\n {\n prop: 'blurRegion',\n effect: 'blur_region',\n },\n 'brightness',\n {\n prop: 'brightnessHSB',\n effect: 'brightness_hsb',\n },\n 'cartoonify',\n 'colorize',\n 'contrast',\n 'distort',\n {\n prop: 'fillLight',\n effect: 'fill_light',\n },\n 'gamma',\n {\n prop: 'gradientFade',\n effect: 'gradient_fade',\n },\n 'grayscale',\n 'improve',\n 'negate',\n {\n prop: 'oilPaint',\n effect: 'oil_paint',\n },\n 'outline',\n 'pixelate',\n {\n prop: 'pixelateFaces',\n effect: 'pixelate_faces',\n },\n {\n prop: 'pixelateRegion',\n effect: 'pixelate_region',\n },\n 'redeye',\n {\n prop: 'replaceColor',\n effect: 'replace_color',\n },\n 'saturation',\n 'sepia',\n 'shadow',\n 'sharpen',\n 'shear',\n {\n prop: 'simulateColorblind',\n effect: 'simulate_colorblind',\n },\n 'tint',\n {\n prop: 'unsharpMask',\n effect: 'unsharp_mask',\n },\n 'vectorize',\n 'vibrance',\n 'vignette',\n];\n\nexport const props = params.map(param => param.prop || param);\n\nexport function plugin({ cldImage, options } = {}) {\n params.forEach(key => {\n const prop = key.prop || key;\n const effect = key.effect || key;\n\n if ( options[prop] === true ) {\n cldImage.effect(`e_${effect}`);\n } else if ( typeof options[prop] === 'string' ) {\n cldImage.effect(`e_${effect}:${options[prop]}`);\n }\n });\n}","/**\n * encodeBase64\n */\n\nexport function encodeBase64(value) {\n if ( typeof btoa === 'function' ) {\n return btoa(value);\n }\n\n if ( typeof Buffer !== 'undefined' ) {\n return Buffer.from(value).toString('base64');\n }\n}","// aspectRatio\n\nexport const primary = {\n aspectRatio: {\n qualifier: 'ar'\n },\n crop: {\n qualifier: 'c'\n },\n gravity: {\n qualifier: 'g'\n },\n height: {\n qualifier: 'h'\n },\n width: {\n qualifier: 'w'\n },\n};\n\nexport const position = {\n angle: {\n qualifier: 'a'\n },\n gravity: {\n qualifier: 'g'\n },\n x: {\n qualifier: 'x'\n },\n y: {\n qualifier: 'y'\n },\n}\n\nexport const text = {\n alignment: {\n qualifier: 'alignment'\n },\n border: {\n qualifier: 'bo',\n location: 'primary'\n },\n color: {\n qualifier: 'co',\n location: 'primary'\n },\n fontFamily: {\n qualifier: false\n },\n fontSize: {\n qualifier: false\n },\n fontWeight: {\n qualifier: false\n },\n letterSpacing: {\n qualifier: 'letter_spacing'\n },\n lineSpacing: {\n qualifier: 'line_spacing'\n },\n stroke: {\n qualifier: 'self'\n },\n textDecoration: {\n qualifier: false\n }\n}","import { encodeBase64 } from '../lib/util';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['text', 'overlays'];\n\nexport const DEFAULT_TEXT_OPTIONS = {\n color: 'black',\n fontFamily: 'Arial',\n fontSize: 200,\n fontWeight: 'bold',\n};\n\nexport function plugin({ cldImage, options } = {}) {\n const { text, overlays = [] } = options;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n if ( Array.isArray(overlays) ) {\n overlays.forEach(applyOverlay);\n }\n\n if ( typeof text === 'string' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n })\n } else if ( typeof text === 'object' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n ...text\n }\n })\n }\n\n\n\n /**\n * applyOverlay\n */\n\n function applyOverlay({ publicId, url, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasUrl = typeof url === 'string';\n const hasText = typeof text === 'object' || typeof text === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasUrl && !hasText ) {\n console.warn(`An ${type} is missing Public ID, URL, or Text`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation;\n\n if ( hasText ) {\n layerTransformation = `${typeQualifier}_text`;\n } else if ( hasPublicId ) {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n } else if ( hasUrl ) {\n layerTransformation = `${typeQualifier}_fetch:${encodeBase64(url)}`;\n }\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Text styling\n\n if ( hasText ) {\n if ( typeof text === 'string' ) {\n text = {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n }\n\n\n const textTransformations = [];\n\n Object.keys(text).forEach(key => {\n if ( !qualifiersText[key] ) return;\n\n const { qualifier, location } = qualifiersText[key];\n\n if ( location === 'primary' ) {\n primary.push(`${qualifier}_${text[key]}`);\n } else if ( qualifier === 'self' ) {\n textTransformations.push(key);\n } else if ( qualifier ) {\n textTransformations.push(`${qualifier}_${text[key]}`);\n } else {\n textTransformations.push(text[key]);\n }\n });\n\n layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text.text}`\n }\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['rawTransformations'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { rawTransformations = [] } = options;\n\n rawTransformations.forEach(transformation => {\n cldImage.addTransformation(transformation);\n });\n}","export const props = ['removeBackground'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { removeBackground = false } = options;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['underlay', 'underlays'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { underlay, underlays = [] } = options;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n if ( Array.isArray(underlays) ) {\n underlays.forEach(applyUnderlay);\n }\n\n if ( typeof underlay === 'string' ) {\n\n const underlayOptions = {\n publicId: underlay,\n crop: 'fill'\n }\n\n if ( options.width ) {\n underlayOptions.width = options.width;\n }\n\n if ( options.height ) {\n underlayOptions.height = options.height;\n }\n\n applyUnderlay(underlayOptions);\n }\n\n /**\n * applyUnderlay\n */\n\n function applyUnderlay({ publicId, type, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId ) {\n console.warn(`An ${type} is missing a Public ID`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['zoompan'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { zoompan = false } = options;\n const overrides = {};\n\n if ( zoompan === true ) {\n cldImage.effect('e_zoompan');\n } else if ( typeof zoompan === 'string' ) {\n if ( zoompan === 'loop' ) {\n cldImage.effect('e_zoompan');\n cldImage.effect('e_loop');\n } else {\n cldImage.effect(`e_zoompan:${zoompan}`);\n }\n } else if ( typeof zoompan === 'object' ) {\n let zoompanEffect = 'e_zoompan';\n\n if ( typeof zoompan.options === 'string' ) {\n zoompanEffect = `${zoompanEffect}${zoompan.options}`;\n }\n\n cldImage.effect(zoompanEffect);\n\n let loopEffect;\n\n if ( zoompan.loop === true ) {\n loopEffect = 'e_loop';\n } else if ( typeof zoompan.loop === 'string' ) {\n loopEffect = `e_loop${zoompan.loop}`;\n }\n\n if ( loopEffect ) {\n cldImage.effect(loopEffect);\n }\n }\n\n if ( zoompan !== false ) {\n overrides.format = 'gif';\n }\n\n return {\n options: overrides\n }\n}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport * as croppingPlugin from '../plugins/cropping';\nimport * as effectsPlugin from '../plugins/effects';\nimport * as overlaysPlugin from '../plugins/overlays';\nimport * as rawTransformationsPlugin from '../plugins/raw-transformations';\nimport * as removeBackgroundPlugin from '../plugins/remove-background';\nimport * as underlaysPlugin from '../plugins/underlays';\nimport * as zoompanPlugin from '../plugins/zoompan';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const transformationPlugins = [\n // Background Removal must always come first\n removeBackgroundPlugin,\n\n croppingPlugin,\n effectsPlugin,\n overlaysPlugin,\n underlaysPlugin,\n zoompanPlugin,\n\n // Raw transformations needs to be last simply to make sure\n // it's always expected to applied the same way\n\n rawTransformationsPlugin\n];\n\nlet cld;\n\n/**\n * constructCloudinaryUrl\n */\n\nexport function constructCloudinaryUrl({ options, config }) {\n if ( !cld ) {\n cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n url: {\n // Used to avoid issues with SSR particularly for the blurred placeholder\n analytics: false\n },\n ...config\n });\n }\n\n const publicId = getPublicId(options.src);\n\n const cldImage = cld.image(publicId);\n\n transformationPlugins.forEach(({ plugin }) => {\n const { options: pluginOptions } = plugin({\n cldImage,\n options\n }) || {};\n\n if ( pluginOptions?.format ) {\n options.format = pluginOptions.format;\n }\n });\n\n return cldImage\n .setDeliveryType(options.deliveryType || 'upload')\n .format(options.format || 'auto')\n .delivery(`q_${options.quality || 'auto'}`)\n .toURL();\n}\n\n/**\n * Retrieves the public id of a cloudiary image url. If no url is recognized it returns the parameter it self.\n * If it's recognized that is a url and it's not possible to get the public id, it warns the user.\n *\n * @param {string} src The cloudiary url or public id.\n *\n * @return {string} The images public id\n */\n\nexport function getPublicId(src) {\n if ( typeof src !== 'string' ) {\n throw new Error(`Invalid src of type ${typeof src}`);\n }\n\n if ( src.includes('res.cloudinary.com') ) {\n const regexWithTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(.*)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n const regexWithoutTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n\n const withTransformations = src.match(regexWithTransformations)\n const withoutTransformations = src.match(regexWithoutTransformations)\n\n if ( withTransformations ) {\n return withTransformations[withTransformations.length - 1]\n } else if ( withoutTransformations ) {\n return withoutTransformations[withoutTransformations.length - 1]\n } else {\n console.warn(`Not possible to retrieve the publicUrl from ${src}, make sure it's a valid cloudinary image url.`)\n }\n }\n\n return src;\n}\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder = true, config }) {\n const rawTransformations = [];\n\n if ( placeholder === 'grayscale' ) {\n rawTransformations.push('e_grayscale');\n }\n\n if ( typeof placeholder === 'string' && placeholder.includes('color:') ) {\n const color = placeholder.split(':').splice(1).join(':')\n rawTransformations.push('e_grayscale');\n rawTransformations.push(`e_colorize:60,co_${color}`);\n }\n\n return constructCloudinaryUrl({\n options: {\n src,\n width: 100,\n quality: 1,\n rawTransformations,\n },\n config\n });;\n}\n","import { constructCloudinaryUrl } from '../lib/cloudinary';\n\nexport function cloudinaryLoader({ loaderOptions, imageProps, cldOptions, cldConfig = {} }) {\n const options = {\n ...imageProps,\n ...cldOptions\n }\n\n // The loader options are used to create dynamic sizing when working with responsive images\n // so these should override the default options collected from the props alone if\n // the results are different. While we don't always use the height in the loader logic,\n // we always pass it here, as the usage is determined later based on cropping.js\n\n if ( loaderOptions?.width && loaderOptions.width !== options.width ) {\n const multiplier = loaderOptions.width / options.width;\n options.width = loaderOptions.width;\n options.height = Math.round(options.height * multiplier);\n }\n\n return constructCloudinaryUrl({\n options,\n config: cldConfig\n });\n}","import Image from 'next/image';\n\nimport { createPlaceholderUrl, getPublicId, transformationPlugins } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst CldImage = props => {\n\n const CLD_OPTIONS = [\n 'deliveryType'\n ];\n\n transformationPlugins.forEach(({ props = [] }) => {\n props.forEach(prop => {\n if ( CLD_OPTIONS.includes(prop) ) {\n throw new Error(`Option ${prop} already exists!`);\n }\n CLD_OPTIONS.push(prop);\n });\n })\n\n // Construct the base Image component props by filtering out Cloudinary-specific props\n\n const imageProps = {};\n\n Object.keys(props)\n .filter(key => !CLD_OPTIONS.includes(key))\n .forEach(key => imageProps[key] = props[key]);\n\n // Construct Cloudinary-specific props by looking for values for any of the supported prop keys\n\n const cldOptions = {};\n\n CLD_OPTIONS.forEach(key => {\n if ( props[key] ) {\n cldOptions[key] = props[key];\n }\n });\n\n // If we see a placeholder option, configure a Cloudinary-based URL.\n // The resulting image will always be blurred per Next.js, so we're\n // limited on options for placeholders.\n //\n // We need to do this logic here as we potentially need to mutate\n // an Image component prop as opposed to simply the URL\n //\n // https://nextjs.org/docs/api-reference/next/image#blurdataurl\n\n if ( imageProps.placeholder ) {\n const publicId = getPublicId(props.src);\n\n imageProps.blurDataURL = createPlaceholderUrl({\n src: publicId,\n placeholder: props.placeholder\n });\n\n if ( imageProps.placeholder !== 'blur' ) {\n imageProps.placeholder = 'blur';\n }\n }\n\n return (\n <Image\n {...imageProps}\n loader={(loaderOptions) => cloudinaryLoader({ loaderOptions, imageProps, cldOptions })}\n />\n );\n}\n\nexport default CldImage;","import Head from 'next/head';\n\nconst IMAGE_WIDTH = 2400;\nconst IMAGE_HEIGHT = 1200;\n\nimport { constructCloudinaryUrl } from '../../lib/cloudinary';\n\nconst TWITTER_CARD = 'summary_large_image';\n\nconst CldOgImage = ({ excludeTags = [], twitterTitle, ...props }) => {\n const options = {\n ...props,\n width: props.width || IMAGE_WIDTH,\n height: props.height || IMAGE_HEIGHT,\n crop: props.crop || 'fill',\n gravity: props.gravity || 'center'\n }\n\n const ogImageUrl = constructCloudinaryUrl({\n options\n });\n\n // We need to include the tags within the Next.js Head component rather than\n // direcly adding them inside of the Head otherwise we get unexpected results\n\n return (\n <Head>\n <meta property=\"og:image\" content={ogImageUrl} />\n <meta property=\"og:image:secure_url\" content={ogImageUrl} />\n <meta property=\"og:image:width\" content={options.width} />\n <meta property=\"og:image:height\" content={options.height} />\n\n {options.alt && (\n <meta property=\"og:image:alt\" content={options.alt} />\n )}\n\n {/* Required for summary_large_image, exclude vai excludeTags */}\n {/* https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary-card-with-large-image */}\n\n {!excludeTags.includes('twitter:title') && (\n <meta property=\"twitter:title\" content={twitterTitle || ' '} />\n )}\n\n <meta property=\"twitter:card\" content={TWITTER_CARD} />\n <meta property=\"twitter:image\" content={ogImageUrl} />\n </Head>\n );\n}\n\nexport default CldOgImage;","import { useRef } from 'react';\nimport Script from 'next/script';\n\nconst CldUploadWidget = ({\n children,\n onUpload,\n options,\n signatureEndpoint,\n uploadPreset,\n}) => {\n const cloudinary = useRef();\n const widget = useRef();\n\n const signed = !!signatureEndpoint;\n\n /**\n * generateSignature\n * @description Makes a request to an endpoint to sign Cloudinary parameters as part of widget creation\n */\n\n function generateSignature(callback, paramsToSign) {\n fetch(signatureEndpoint, {\n method: \"POST\",\n body: JSON.stringify({\n paramsToSign,\n }),\n })\n .then((r) => r.json())\n .then(({ signature }) => {\n callback(signature);\n });\n }\n\n /**\n * createWidget\n * @description Creates a new instance of the Cloudinary widget and stores in a ref\n */\n\n function createWidget() {\n // When creating a signed upload, you need to provide both your Cloudinary API Key\n // as well as a signature generator function that will sign any paramters\n // either on page load or during the upload process. Read more about signed uploads at:\n // https://cloudinary.com/documentation/upload_widget#signed_uploads\n\n const uploadOptions = {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,\n uploadPreset: uploadPreset || process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET,\n apiKey: process.env.NEXT_PUBLIC_CLOUDINARY_API_KEY,\n ...options,\n };\n\n if ( signed ) {\n uploadOptions.uploadSignature = generateSignature;\n\n // No need for apiSecret here because of api/sign-cloudinary-params\n\n if (!uploadOptions.apiKey) {\n return new Error(\"Signed Upload needs apiKey!\");\n }\n }\n\n return cloudinary.current?.createUploadWidget(\n uploadOptions,\n function (error, result) {\n // The callback is a bit more chatty than failed or success so\n // only trigger when one of those are the case. You can additionally\n // create a separate handler such as onEvent and trigger it on\n // ever occurance\n if (error || result.event === \"success\") {\n onUpload(error, result, widget?.current);\n }\n }\n );\n }\n\n /**\n * open\n * @description When triggered, uses the current widget instance to open the upload modal\n */\n\n function open() {\n if (!widget?.current) {\n widget.current = createWidget();\n }\n\n widget?.current && widget.current.open();\n }\n\n /**\n * handleOnLoad\n * @description Stores the Cloudinary window instance to a ref when the widget script loads\n */\n\n function handleOnLoad() {\n cloudinary.current = window.cloudinary;\n }\n\n return (\n <>\n {children({\n cloudinary: cloudinary.current,\n widget: widget.current,\n open,\n })}\n <Script\n id={`cloudinary-${Math.floor(Math.random() * 100)}`}\n src=\"https://widget.cloudinary.com/v2.0/global/all.js\"\n onLoad={handleOnLoad}\n onError={(e) => console.error(`Failed to load Cloudinary: ${e.message}`)}\n />\n </>\n );\n};\n\nexport default CldUploadWidget;\n","import CldUploadWidget from '../CldUploadWidget';\n\nconst CldUploadButton = ({\n children,\n onClick,\n onUpload,\n options,\n signatureEndpoint,\n uploadPreset,\n ...props\n}) => {\n return (\n <>\n <CldUploadWidget\n onUpload={onUpload}\n options={options}\n signatureEndpoint={signatureEndpoint}\n uploadPreset={uploadPreset}\n >\n {({ open }) => {\n function handleOnClick(e) {\n e.preventDefault();\n\n open();\n\n if ( typeof onClick === 'function' ) {\n onClick(e);\n }\n }\n return (\n <button {...props} onClick={handleOnClick} >\n {children || 'Upload'}\n </button>\n );\n }}\n </CldUploadWidget>\n </>\n );\n};\n\nexport default CldUploadButton;\n"],"names":["cropsGravityAuto","props","plugin","cldImage","options","width","height","crop","transformationString","gravity","includes","console","warn","resize","params","prop","effect","map","param","forEach","key","encodeBase64","value","btoa","Buffer","from","toString","primary","aspectRatio","qualifier","position","angle","x","y","text","alignment","border","location","color","fontFamily","fontSize","fontWeight","letterSpacing","lineSpacing","stroke","textDecoration","DEFAULT_TEXT_OPTIONS","overlays","type","typeQualifier","Array","isArray","applyOverlay","publicId","url","effects","layerEffects","_excluded","hasPublicId","hasUrl","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","qualifiersPrimary","push","textTransformations","qualifiersText","join","qualifiersPosition","length","addTransformation","rawTransformations","transformation","removeBackground","underlay","underlays","applyUnderlay","underlayOptions","zoompan","overrides","zoompanEffect","loopEffect","loop","format","transformationPlugins","removeBackgroundPlugin","croppingPlugin","effectsPlugin","overlaysPlugin","underlaysPlugin","zoompanPlugin","rawTransformationsPlugin","cld","constructCloudinaryUrl","config","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","analytics","getPublicId","src","image","pluginOptions","setDeliveryType","deliveryType","delivery","quality","toURL","Error","regexWithTransformations","regexWithoutTransformations","withTransformations","match","withoutTransformations","createPlaceholderUrl","placeholder","split","splice","cloudinaryLoader","loaderOptions","imageProps","cldOptions","cldConfig","multiplier","Math","round","CldImage","CLD_OPTIONS","filter","blurDataURL","_jsx","IMAGE_WIDTH","IMAGE_HEIGHT","TWITTER_CARD","CldOgImage","excludeTags","twitterTitle","ogImageUrl","_jsxs","alt","CldUploadWidget","children","onUpload","signatureEndpoint","uploadPreset","cloudinary","useRef","widget","signed","generateSignature","callback","paramsToSign","fetch","method","body","JSON","stringify","then","r","json","signature","createWidget","uploadOptions","NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET","apiKey","NEXT_PUBLIC_CLOUDINARY_API_KEY","uploadSignature","current","createUploadWidget","error","result","event","open","handleOnLoad","window","_Fragment","floor","random","e","message","CldUploadButton","onClick","handleOnClick","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAMA,gBAAgB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAE,CAAA;AAElE,MAAMC,OAAK,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEjC,SAASC,QAAM,CAAC;EAAEC,QAAQ;AAAEC,EAAAA,OAAAA;AAAQ,CAAC,GAAG,EAAE,EAAE;EACjD,MAAM;IAAEC,KAAK;IAAEC,MAAM;AAAEC,IAAAA,IAAI,GAAG,OAAA;AAAQ,GAAC,GAAGH,OAAO,CAAA;AAEjD,EAAA,IAAII,oBAAoB,GAAI,CAAA,EAAA,EAAID,IAAK,CAAA,GAAA,EAAKF,KAAM,CAAC,CAAA,CAAA;EAEjD,IAAK,CAACD,OAAO,CAACK,OAAO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1
+ {"version":3,"file":"next-cloudinary.modern.mjs","sources":["../src/plugins/cropping.js","../src/plugins/effects.js","../src/lib/util.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/named-transformations.js","../src/plugins/raw-transformations.js","../src/plugins/remove-background.js","../src/plugins/underlays.js","../src/plugins/zoompan.js","../src/lib/cloudinary.js","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.js","../src/components/CldOgImage/CldOgImage.js","../src/components/CldUploadWidget/CldUploadWidget.js","../src/components/CldUploadButton/CldUploadButton.js"],"sourcesContent":["const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\nconst cropsWithZoom = ['crop', 'thumb'];\n\nexport const props = [\n 'crop',\n 'gravity',\n 'zoom'\n];\n\nexport function plugin({ cldImage, options } = {}) {\n const overrides = {};\n\n const { width, height, widthResize, heightResize, crop = 'limit' } = options;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !options.gravity && cropsGravityAuto.includes(crop) ) {\n options.gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( options.gravity ) {\n if ( options.gravity === 'auto' && !cropsGravityAuto.includes(crop) ) {\n console.warn(`Auto gravity can only be used with crop modes: ${cropsGravityAuto.join(', ')}. Not applying gravity.`);\n } else {\n transformationString = `${transformationString},g_${options.gravity}`;\n }\n }\n\n if ( options.zoom ) {\n if ( options.zoom === 'auto' && !cropsWithZoom.includes(crop) ) {\n console.warn(`Zoom can only be used with crop modes: ${cropsWithZoom.join(', ')}. Not applying zoom.`);\n } else {\n transformationString = `${transformationString},z_${options.zoom}`;\n }\n }\n\n cldImage.effect(transformationString);\n\n // If we have a resize width that's smaller than the user-defined width, we want to give the\n // ability to perform a final resize on the image without impacting any of the effects like text\n // overlays that may depend on the size to work properly\n\n if ( typeof widthResize === 'number' && widthResize < width ) {\n overrides.width = widthResize;\n }\n\n return {\n options: overrides\n }\n}\n","const params = [\n 'art',\n {\n prop: 'autoBrightness',\n effect: 'auto_brightness',\n },\n {\n prop: 'autoColor',\n effect: 'auto_color',\n },\n {\n prop: 'autoContrast',\n effect: 'auto_contrast',\n },\n {\n prop: 'assistColorblind',\n effect: 'assist_colorblind',\n },\n 'blackwhite',\n 'blur',\n {\n prop: 'blurFaces',\n effect: 'blur_faces',\n },\n {\n prop: 'blurRegion',\n effect: 'blur_region',\n },\n 'brightness',\n {\n prop: 'brightnessHSB',\n effect: 'brightness_hsb',\n },\n 'cartoonify',\n 'colorize',\n 'contrast',\n 'distort',\n {\n prop: 'fillLight',\n effect: 'fill_light',\n },\n 'gamma',\n {\n prop: 'gradientFade',\n effect: 'gradient_fade',\n },\n 'grayscale',\n 'improve',\n 'negate',\n {\n prop: 'oilPaint',\n effect: 'oil_paint',\n },\n 'outline',\n 'pixelate',\n {\n prop: 'pixelateFaces',\n effect: 'pixelate_faces',\n },\n {\n prop: 'pixelateRegion',\n effect: 'pixelate_region',\n },\n 'redeye',\n {\n prop: 'replaceColor',\n effect: 'replace_color',\n },\n 'saturation',\n 'sepia',\n 'shadow',\n 'sharpen',\n 'shear',\n {\n prop: 'simulateColorblind',\n effect: 'simulate_colorblind',\n },\n 'tint',\n {\n prop: 'unsharpMask',\n effect: 'unsharp_mask',\n },\n 'vectorize',\n 'vibrance',\n 'vignette',\n];\n\nexport const props = params.map(param => param.prop || param);\n\nexport function plugin({ cldImage, options } = {}) {\n params.forEach(key => {\n const prop = key.prop || key;\n const effect = key.effect || key;\n\n if ( options[prop] === true ) {\n cldImage.effect(`e_${effect}`);\n } else if ( typeof options[prop] === 'string' ) {\n cldImage.effect(`e_${effect}:${options[prop]}`);\n }\n });\n}","/**\n * encodeBase64\n */\n\nexport function encodeBase64(value) {\n if ( typeof btoa === 'function' ) {\n return btoa(value);\n }\n\n if ( typeof Buffer !== 'undefined' ) {\n return Buffer.from(value).toString('base64');\n }\n}","// aspectRatio\n\nexport const primary = {\n aspectRatio: {\n qualifier: 'ar'\n },\n crop: {\n qualifier: 'c'\n },\n gravity: {\n qualifier: 'g'\n },\n height: {\n qualifier: 'h'\n },\n width: {\n qualifier: 'w'\n },\n};\n\nexport const position = {\n angle: {\n qualifier: 'a'\n },\n gravity: {\n qualifier: 'g'\n },\n x: {\n qualifier: 'x'\n },\n y: {\n qualifier: 'y'\n },\n}\n\nexport const text = {\n alignment: {\n qualifier: 'alignment'\n },\n border: {\n qualifier: 'bo',\n location: 'primary'\n },\n color: {\n qualifier: 'co',\n location: 'primary'\n },\n fontFamily: {\n qualifier: false\n },\n fontSize: {\n qualifier: false\n },\n fontWeight: {\n qualifier: false\n },\n letterSpacing: {\n qualifier: 'letter_spacing'\n },\n lineSpacing: {\n qualifier: 'line_spacing'\n },\n stroke: {\n qualifier: 'self'\n },\n textDecoration: {\n qualifier: false\n }\n}","import { encodeBase64 } from '../lib/util';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['text', 'overlays'];\n\nexport const DEFAULT_TEXT_OPTIONS = {\n color: 'black',\n fontFamily: 'Arial',\n fontSize: 200,\n fontWeight: 'bold',\n};\n\nexport function plugin({ cldImage, options } = {}) {\n const { text, overlays = [] } = options;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n if ( Array.isArray(overlays) ) {\n overlays.forEach(applyOverlay);\n }\n\n if ( typeof text === 'string' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n })\n } else if ( typeof text === 'object' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n ...text\n }\n })\n }\n\n\n\n /**\n * applyOverlay\n */\n\n function applyOverlay({ publicId, url, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasUrl = typeof url === 'string';\n const hasText = typeof text === 'object' || typeof text === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasUrl && !hasText ) {\n console.warn(`An ${type} is missing Public ID, URL, or Text`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation;\n\n if ( hasText ) {\n layerTransformation = `${typeQualifier}_text`;\n } else if ( hasPublicId ) {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n } else if ( hasUrl ) {\n layerTransformation = `${typeQualifier}_fetch:${encodeBase64(url)}`;\n }\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Text styling\n\n if ( hasText ) {\n if ( typeof text === 'string' ) {\n text = {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n }\n\n\n const textTransformations = [];\n\n Object.keys(text).forEach(key => {\n if ( !qualifiersText[key] ) return;\n\n const { qualifier, location } = qualifiersText[key];\n\n if ( location === 'primary' ) {\n primary.push(`${qualifier}_${text[key]}`);\n } else if ( qualifier === 'self' ) {\n textTransformations.push(key);\n } else if ( qualifier ) {\n textTransformations.push(`${qualifier}_${text[key]}`);\n } else {\n textTransformations.push(text[key]);\n }\n });\n\n layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text.text}`\n }\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['transformations'];\n\nexport function plugin({ cldImage, options } = {}) {\n let { transformations = [] } = options;\n\n if ( !Array.isArray(transformations) ) {\n transformations = [transformations];\n }\n\n transformations.forEach(transformation => {\n cldImage.addTransformation(`t_${transformation}`);\n });\n}","export const props = ['rawTransformations'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { rawTransformations = [] } = options;\n\n rawTransformations.forEach(transformation => {\n cldImage.addTransformation(transformation);\n });\n}","export const props = ['removeBackground'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { removeBackground = false } = options;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['underlay', 'underlays'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { underlay, underlays = [] } = options;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n if ( Array.isArray(underlays) ) {\n underlays.forEach(applyUnderlay);\n }\n\n if ( typeof underlay === 'string' ) {\n\n const underlayOptions = {\n publicId: underlay,\n crop: 'fill'\n }\n\n if ( options.width ) {\n underlayOptions.width = options.width;\n }\n\n if ( options.height ) {\n underlayOptions.height = options.height;\n }\n\n applyUnderlay(underlayOptions);\n }\n\n /**\n * applyUnderlay\n */\n\n function applyUnderlay({ publicId, type, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId ) {\n console.warn(`An ${type} is missing a Public ID`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['zoompan'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { zoompan = false } = options;\n const overrides = {};\n\n if ( zoompan === true ) {\n cldImage.effect('e_zoompan');\n } else if ( typeof zoompan === 'string' ) {\n if ( zoompan === 'loop' ) {\n cldImage.effect('e_zoompan');\n cldImage.effect('e_loop');\n } else {\n cldImage.effect(`e_zoompan:${zoompan}`);\n }\n } else if ( typeof zoompan === 'object' ) {\n let zoompanEffect = 'e_zoompan';\n\n if ( typeof zoompan.options === 'string' ) {\n zoompanEffect = `${zoompanEffect}${zoompan.options}`;\n }\n\n cldImage.effect(zoompanEffect);\n\n let loopEffect;\n\n if ( zoompan.loop === true ) {\n loopEffect = 'e_loop';\n } else if ( typeof zoompan.loop === 'string' ) {\n loopEffect = `e_loop${zoompan.loop}`;\n }\n\n if ( loopEffect ) {\n cldImage.effect(loopEffect);\n }\n }\n\n if ( zoompan !== false ) {\n overrides.format = 'gif';\n }\n\n return {\n options: overrides\n }\n}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport * as croppingPlugin from '../plugins/cropping';\nimport * as effectsPlugin from '../plugins/effects';\nimport * as overlaysPlugin from '../plugins/overlays';\nimport * as namedTransformationsPlugin from '../plugins/named-transformations';\nimport * as rawTransformationsPlugin from '../plugins/raw-transformations';\nimport * as removeBackgroundPlugin from '../plugins/remove-background';\nimport * as underlaysPlugin from '../plugins/underlays';\nimport * as zoompanPlugin from '../plugins/zoompan';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const transformationPlugins = [\n // Background Removal must always come first\n removeBackgroundPlugin,\n\n croppingPlugin,\n effectsPlugin,\n overlaysPlugin,\n namedTransformationsPlugin,\n underlaysPlugin,\n zoompanPlugin,\n\n // Raw transformations needs to be last simply to make sure\n // it's always expected to applied the same way\n\n rawTransformationsPlugin\n];\n\nlet cld;\n\n/**\n * constructCloudinaryUrl\n */\n\nexport function constructCloudinaryUrl({ options, config }) {\n if ( !cld ) {\n cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n url: {\n // Used to avoid issues with SSR particularly for the blurred placeholder\n analytics: false\n },\n ...config\n });\n }\n\n const publicId = getPublicId(options.src);\n\n const cldImage = cld.image(publicId);\n\n transformationPlugins.forEach(({ plugin }) => {\n const { options: pluginOptions } = plugin({\n cldImage,\n options\n }) || {};\n\n if ( pluginOptions?.format ) {\n options.format = pluginOptions.format;\n }\n\n if ( pluginOptions?.width ) {\n options.resize = {\n width: pluginOptions?.width\n };\n }\n });\n\n if ( options.resize ) {\n const { width, crop = 'scale' } = options.resize;\n cldImage.effect(`c_${crop},w_${width}`);\n }\n\n return cldImage\n .setDeliveryType(options.deliveryType || 'upload')\n .format(options.format || 'auto')\n .delivery(`q_${options.quality || 'auto'}`)\n .toURL();\n}\n\n/**\n * Retrieves the public id of a cloudiary image url. If no url is recognized it returns the parameter it self.\n * If it's recognized that is a url and it's not possible to get the public id, it warns the user.\n *\n * @param {string} src The cloudiary url or public id.\n *\n * @return {string} The images public id\n */\n\nexport function getPublicId(src) {\n if ( typeof src !== 'string' ) {\n throw new Error(`Invalid src of type ${typeof src}`);\n }\n\n if ( src.includes('res.cloudinary.com') ) {\n const regexWithTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(.*)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n const regexWithoutTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n\n const withTransformations = src.match(regexWithTransformations)\n const withoutTransformations = src.match(regexWithoutTransformations)\n\n if ( withTransformations ) {\n return withTransformations[withTransformations.length - 1]\n } else if ( withoutTransformations ) {\n return withoutTransformations[withoutTransformations.length - 1]\n } else {\n console.warn(`Not possible to retrieve the publicUrl from ${src}, make sure it's a valid cloudinary image url.`)\n }\n }\n\n return src;\n}\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder = true, config }) {\n const rawTransformations = [];\n\n if ( placeholder === 'grayscale' ) {\n rawTransformations.push('e_grayscale');\n }\n\n if ( typeof placeholder === 'string' && placeholder.includes('color:') ) {\n const color = placeholder.split(':').splice(1).join(':')\n rawTransformations.push('e_grayscale');\n rawTransformations.push(`e_colorize:60,co_${color}`);\n }\n\n return constructCloudinaryUrl({\n options: {\n src,\n width: 100,\n quality: 1,\n rawTransformations,\n },\n config\n });;\n}\n","import { constructCloudinaryUrl } from '../lib/cloudinary';\n\nexport function cloudinaryLoader({ loaderOptions, imageProps, cldOptions, cldConfig = {} }) {\n const options = {\n ...imageProps,\n ...cldOptions\n }\n\n options.width = parseInt(options.width);\n options.height = parseInt(options.height);\n\n // The loader options are used to create dynamic sizing when working with responsive images\n // so these should override the default options collected from the props alone if\n // the results are different. While we don't always use the height in the loader logic,\n // we always pass it here, as the usage is determined later based on cropping.js\n\n if ( loaderOptions?.width && loaderOptions.width !== options.width ) {\n const multiplier = loaderOptions.width / options.width;\n options.widthResize = loaderOptions.width;\n options.heightResize = Math.round(options.height * multiplier);\n }\n\n return constructCloudinaryUrl({\n options,\n config: cldConfig\n });\n}","import Image from 'next/image';\n\nimport { createPlaceholderUrl, getPublicId, transformationPlugins } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst CldImage = props => {\n\n const CLD_OPTIONS = [\n 'deliveryType'\n ];\n\n transformationPlugins.forEach(({ props = [] }) => {\n props.forEach(prop => {\n if ( CLD_OPTIONS.includes(prop) ) {\n throw new Error(`Option ${prop} already exists!`);\n }\n CLD_OPTIONS.push(prop);\n });\n })\n\n // Construct the base Image component props by filtering out Cloudinary-specific props\n\n const imageProps = {};\n\n Object.keys(props)\n .filter(key => !CLD_OPTIONS.includes(key))\n .forEach(key => imageProps[key] = props[key]);\n\n // Construct Cloudinary-specific props by looking for values for any of the supported prop keys\n\n const cldOptions = {};\n\n CLD_OPTIONS.forEach(key => {\n if ( props[key] ) {\n cldOptions[key] = props[key];\n }\n });\n\n // If we see a placeholder option, configure a Cloudinary-based URL.\n // The resulting image will always be blurred per Next.js, so we're\n // limited on options for placeholders.\n //\n // We need to do this logic here as we potentially need to mutate\n // an Image component prop as opposed to simply the URL\n //\n // https://nextjs.org/docs/api-reference/next/image#blurdataurl\n\n if ( imageProps.placeholder ) {\n const publicId = getPublicId(props.src);\n\n imageProps.blurDataURL = createPlaceholderUrl({\n src: publicId,\n placeholder: props.placeholder\n });\n\n if ( imageProps.placeholder !== 'blur' ) {\n imageProps.placeholder = 'blur';\n }\n }\n\n return (\n <Image\n {...imageProps}\n loader={(loaderOptions) => cloudinaryLoader({ loaderOptions, imageProps, cldOptions })}\n />\n );\n}\n\nexport default CldImage;","import Head from 'next/head';\n\nconst IMAGE_WIDTH = 2400;\nconst IMAGE_HEIGHT = 1200;\n\nimport { constructCloudinaryUrl } from '../../lib/cloudinary';\n\nconst TWITTER_CARD = 'summary_large_image';\n\nconst CldOgImage = ({ excludeTags = [], twitterTitle, ...props }) => {\n const options = {\n ...props,\n width: props.width || IMAGE_WIDTH,\n height: props.height || IMAGE_HEIGHT,\n crop: props.crop || 'fill',\n gravity: props.gravity || 'center'\n }\n\n const ogImageUrl = constructCloudinaryUrl({\n options\n });\n\n // We need to include the tags within the Next.js Head component rather than\n // direcly adding them inside of the Head otherwise we get unexpected results\n\n return (\n <Head>\n <meta property=\"og:image\" content={ogImageUrl} />\n <meta property=\"og:image:secure_url\" content={ogImageUrl} />\n <meta property=\"og:image:width\" content={options.width} />\n <meta property=\"og:image:height\" content={options.height} />\n\n {options.alt && (\n <meta property=\"og:image:alt\" content={options.alt} />\n )}\n\n {/* Required for summary_large_image, exclude vai excludeTags */}\n {/* https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary-card-with-large-image */}\n\n {!excludeTags.includes('twitter:title') && (\n <meta property=\"twitter:title\" content={twitterTitle || ' '} />\n )}\n\n <meta property=\"twitter:card\" content={TWITTER_CARD} />\n <meta property=\"twitter:image\" content={ogImageUrl} />\n </Head>\n );\n}\n\nexport default CldOgImage;","import { useRef } from 'react';\nimport Script from 'next/script';\n\nconst CldUploadWidget = ({\n children,\n onUpload,\n options,\n signatureEndpoint,\n uploadPreset,\n}) => {\n const cloudinary = useRef();\n const widget = useRef();\n\n const signed = !!signatureEndpoint;\n\n /**\n * generateSignature\n * @description Makes a request to an endpoint to sign Cloudinary parameters as part of widget creation\n */\n\n function generateSignature(callback, paramsToSign) {\n fetch(signatureEndpoint, {\n method: \"POST\",\n body: JSON.stringify({\n paramsToSign,\n }),\n })\n .then((r) => r.json())\n .then(({ signature }) => {\n callback(signature);\n });\n }\n\n /**\n * createWidget\n * @description Creates a new instance of the Cloudinary widget and stores in a ref\n */\n\n function createWidget() {\n // When creating a signed upload, you need to provide both your Cloudinary API Key\n // as well as a signature generator function that will sign any paramters\n // either on page load or during the upload process. Read more about signed uploads at:\n // https://cloudinary.com/documentation/upload_widget#signed_uploads\n\n const uploadOptions = {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,\n uploadPreset: uploadPreset || process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET,\n apiKey: process.env.NEXT_PUBLIC_CLOUDINARY_API_KEY,\n ...options,\n };\n\n if ( signed ) {\n uploadOptions.uploadSignature = generateSignature;\n\n // No need for apiSecret here because of api/sign-cloudinary-params\n\n if (!uploadOptions.apiKey) {\n return new Error(\"Signed Upload needs apiKey!\");\n }\n }\n\n return cloudinary.current?.createUploadWidget(\n uploadOptions,\n function (error, result) {\n // The callback is a bit more chatty than failed or success so\n // only trigger when one of those are the case. You can additionally\n // create a separate handler such as onEvent and trigger it on\n // ever occurance\n if (error || result.event === \"success\") {\n onUpload(error, result, widget?.current);\n }\n }\n );\n }\n\n /**\n * open\n * @description When triggered, uses the current widget instance to open the upload modal\n */\n\n function open() {\n if (!widget?.current) {\n widget.current = createWidget();\n }\n\n widget?.current && widget.current.open();\n }\n\n /**\n * handleOnLoad\n * @description Stores the Cloudinary window instance to a ref when the widget script loads\n */\n\n function handleOnLoad() {\n cloudinary.current = window.cloudinary;\n }\n\n return (\n <>\n {children({\n cloudinary: cloudinary.current,\n widget: widget.current,\n open,\n })}\n <Script\n id={`cloudinary-${Math.floor(Math.random() * 100)}`}\n src=\"https://widget.cloudinary.com/v2.0/global/all.js\"\n onLoad={handleOnLoad}\n onError={(e) => console.error(`Failed to load Cloudinary: ${e.message}`)}\n />\n </>\n );\n};\n\nexport default CldUploadWidget;\n","import CldUploadWidget from '../CldUploadWidget';\n\nconst CldUploadButton = ({\n children,\n onClick,\n onUpload,\n options,\n signatureEndpoint,\n uploadPreset,\n ...props\n}) => {\n return (\n <>\n <CldUploadWidget\n onUpload={onUpload}\n options={options}\n signatureEndpoint={signatureEndpoint}\n uploadPreset={uploadPreset}\n >\n {({ open }) => {\n function handleOnClick(e) {\n e.preventDefault();\n\n open();\n\n if ( typeof onClick === 'function' ) {\n onClick(e);\n }\n }\n return (\n <button {...props} onClick={handleOnClick} >\n {children || 'Upload'}\n </button>\n );\n }}\n </CldUploadWidget>\n </>\n );\n};\n\nexport default CldUploadButton;\n"],"names":["cropsGravityAuto","cropsWithZoom","props","plugin","cldImage","options","overrides","width","height","widthResize","heightResize","crop","transformationString","gravity","includes","console","warn","join","zoom","effect","params","prop","map","param","forEach","key","encodeBase64","value","btoa","Buffer","from","toString","primary","aspectRatio","qualifier","position","angle","x","y","text","alignment","border","location","color","fontFamily","fontSize","fontWeight","letterSpacing","lineSpacing","stroke","textDecoration","DEFAULT_TEXT_OPTIONS","overlays","type","typeQualifier","Array","isArray","applyOverlay","publicId","url","effects","layerEffects","_excluded","hasPublicId","hasUrl","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","qualifiersPrimary","push","textTransformations","qualifiersText","qualifiersPosition","length","addTransformation","transformations","transformation","rawTransformations","removeBackground","underlay","underlays","applyUnderlay","underlayOptions","zoompan","zoompanEffect","loopEffect","loop","format","transformationPlugins","removeBackgroundPlugin","croppingPlugin","effectsPlugin","overlaysPlugin","namedTransformationsPlugin","underlaysPlugin","zoompanPlugin","rawTransformationsPlugin","cld","constructCloudinaryUrl","config","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","analytics","getPublicId","src","image","pluginOptions","resize","setDeliveryType","deliveryType","delivery","quality","toURL","Error","regexWithTransformations","regexWithoutTransformations","withTransformations","match","withoutTransformations","createPlaceholderUrl","placeholder","split","splice","cloudinaryLoader","loaderOptions","imageProps","cldOptions","cldConfig","parseInt","multiplier","Math","round","CldImage","CLD_OPTIONS","filter","blurDataURL","_jsx","IMAGE_WIDTH","IMAGE_HEIGHT","TWITTER_CARD","CldOgImage","excludeTags","twitterTitle","ogImageUrl","_jsxs","alt","CldUploadWidget","children","onUpload","signatureEndpoint","uploadPreset","cloudinary","useRef","widget","signed","generateSignature","callback","paramsToSign","fetch","method","body","JSON","stringify","then","r","json","signature","createWidget","uploadOptions","NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET","apiKey","NEXT_PUBLIC_CLOUDINARY_API_KEY","uploadSignature","current","createUploadWidget","error","result","event","open","handleOnLoad","window","_Fragment","floor","random","e","message","CldUploadButton","onClick","handleOnClick","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAMA,gBAAgB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAE,CAAA;AACzE,MAAMC,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEhC,MAAMC,OAAK,GAAG,CACnB,MAAM,EACN,SAAS,EACT,MAAM,CACP,CAAA;AAEM,SAASC,QAAM,CAAC;EAAEC,QAAQ;AAAEC,EAAAA,OAAAA;AAAQ,CAAC,GAAG,EAAE,EAAE;EACjD,MAAMC,SAAS,GAAG,EAAE,CAAA;EAEpB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,WAAW;IAAEC,YAAY;AAAEC,IAAAA,IAAI,GAAG,OAAA;AAAQ,GAAC,GAAGN,OAAO,CAAA;AAE5E,EAAA,IAAIO,oBAAoB,GAAI,CAAA,EAAA,EAAID,IAAK,CAAA,GAAA,EAAKJ,KAAM,CAAC,CAAA,CAAA;EAEjD,IAAK,CAACF,OAAO,CAACQ,OAAO,IAAIb,gBAAgB,CAACc,QAAQ,CAACH,IAAI,CAAC,EAAG;IACzDN,OAAO,CAACQ,OAAO,GAAG,MAAM,CAAA;AAC1B,GAAA;EAEA,IAAK,CAAC,CAAC,OAAO,CAAC,CAACC,QAAQ,CAACH,IAAI,CAAC,EAAG;AAC/BC,IAAAA,oBAAoB,GAAI,CAAA,EAAEA,oBAAqB,CAAA,GAAA,EAAKJ,MAAO,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;QACb,SAASU,aAAa,CAACJ,CAAC,EAAE;UACxBA,CAAC,CAACK,cAAc,EAAE,CAAA;AAElBX,UAAAA,IAAI,EAAE,CAAA;AAEN,UAAA,IAAK,OAAOS,OAAO,KAAK,UAAU,EAAG;YACnCA,OAAO,CAACH,CAAC,CAAC,CAAA;AACZ,WAAA;AACF,SAAA;AACA,QAAA,oBACEhD,2BAAY9I,KAAK,EAAA;AAAE,UAAA,OAAO,EAAEkM,aAAc;AAAA,UAAA,QAAA,EACvCzC,QAAQ,IAAI,QAAA;SACN,CAAA,CAAA,CAAA;AAEb,OAAA;AAAC,KAAA,CAAA;GAEF,CAAA,CAAA;AAEP;;;;"}
@@ -33,13 +33,16 @@ function _objectWithoutPropertiesLoose(source, excluded) {
33
33
  }
34
34
 
35
35
  var cropsGravityAuto = ['crop', 'fill', 'lfill', 'fill_pad', 'thumb'];
36
- var props$6 = ['crop', 'gravity'];
37
- function plugin$6(_temp) {
36
+ var cropsWithZoom = ['crop', 'thumb'];
37
+ var props$7 = ['crop', 'gravity', 'zoom'];
38
+ function plugin$7(_temp) {
38
39
  var _ref = _temp === void 0 ? {} : _temp,
39
40
  cldImage = _ref.cldImage,
40
41
  options = _ref.options;
42
+ var overrides = {};
41
43
  var width = options.width,
42
44
  height = options.height,
45
+ widthResize = options.widthResize,
43
46
  _options$crop = options.crop,
44
47
  crop = _options$crop === void 0 ? 'limit' : _options$crop;
45
48
  var transformationString = "c_" + crop + ",w_" + width;
@@ -51,18 +54,36 @@ function plugin$6(_temp) {
51
54
  }
52
55
  if (options.gravity) {
53
56
  if (options.gravity === 'auto' && !cropsGravityAuto.includes(crop)) {
54
- console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');
57
+ console.warn("Auto gravity can only be used with crop modes: " + cropsGravityAuto.join(', ') + ". Not applying gravity.");
55
58
  } else {
56
59
  transformationString = transformationString + ",g_" + options.gravity;
57
60
  }
58
61
  }
59
- cldImage.resize(transformationString);
62
+ if (options.zoom) {
63
+ if (options.zoom === 'auto' && !cropsWithZoom.includes(crop)) {
64
+ console.warn("Zoom can only be used with crop modes: " + cropsWithZoom.join(', ') + ". Not applying zoom.");
65
+ } else {
66
+ transformationString = transformationString + ",z_" + options.zoom;
67
+ }
68
+ }
69
+ cldImage.effect(transformationString);
70
+
71
+ // If we have a resize width that's smaller than the user-defined width, we want to give the
72
+ // ability to perform a final resize on the image without impacting any of the effects like text
73
+ // overlays that may depend on the size to work properly
74
+
75
+ if (typeof widthResize === 'number' && widthResize < width) {
76
+ overrides.width = widthResize;
77
+ }
78
+ return {
79
+ options: overrides
80
+ };
60
81
  }
61
82
 
62
83
  var croppingPlugin = {
63
84
  __proto__: null,
64
- props: props$6,
65
- plugin: plugin$6
85
+ props: props$7,
86
+ plugin: plugin$7
66
87
  };
67
88
 
68
89
  var params = ['art', {
@@ -111,10 +132,10 @@ var params = ['art', {
111
132
  prop: 'unsharpMask',
112
133
  effect: 'unsharp_mask'
113
134
  }, 'vectorize', 'vibrance', 'vignette'];
114
- var props$5 = params.map(function (param) {
135
+ var props$6 = params.map(function (param) {
115
136
  return param.prop || param;
116
137
  });
117
- function plugin$5(_temp) {
138
+ function plugin$6(_temp) {
118
139
  var _ref = _temp === void 0 ? {} : _temp,
119
140
  cldImage = _ref.cldImage,
120
141
  options = _ref.options;
@@ -131,8 +152,8 @@ function plugin$5(_temp) {
131
152
 
132
153
  var effectsPlugin = {
133
154
  __proto__: null,
134
- props: props$5,
135
- plugin: plugin$5
155
+ props: props$6,
156
+ plugin: plugin$6
136
157
  };
137
158
 
138
159
  /**
@@ -217,14 +238,14 @@ var text = {
217
238
  };
218
239
 
219
240
  var _excluded$3 = ["publicId", "url", "position", "text", "effects"];
220
- var props$4 = ['text', 'overlays'];
241
+ var props$5 = ['text', 'overlays'];
221
242
  var DEFAULT_TEXT_OPTIONS = {
222
243
  color: 'black',
223
244
  fontFamily: 'Arial',
224
245
  fontSize: 200,
225
246
  fontWeight: 'bold'
226
247
  };
227
- function plugin$4(_temp) {
248
+ function plugin$5(_temp) {
228
249
  var _ref = _temp === void 0 ? {} : _temp,
229
250
  cldImage = _ref.cldImage,
230
251
  options = _ref.options;
@@ -361,8 +382,29 @@ function plugin$4(_temp) {
361
382
 
362
383
  var overlaysPlugin = {
363
384
  __proto__: null,
364
- props: props$4,
385
+ props: props$5,
365
386
  DEFAULT_TEXT_OPTIONS: DEFAULT_TEXT_OPTIONS,
387
+ plugin: plugin$5
388
+ };
389
+
390
+ var props$4 = ['transformations'];
391
+ function plugin$4(_temp) {
392
+ var _ref = _temp === void 0 ? {} : _temp,
393
+ cldImage = _ref.cldImage,
394
+ options = _ref.options;
395
+ var _options$transformati = options.transformations,
396
+ transformations = _options$transformati === void 0 ? [] : _options$transformati;
397
+ if (!Array.isArray(transformations)) {
398
+ transformations = [transformations];
399
+ }
400
+ transformations.forEach(function (transformation) {
401
+ cldImage.addTransformation("t_" + transformation);
402
+ });
403
+ }
404
+
405
+ var namedTransformationsPlugin = {
406
+ __proto__: null,
407
+ props: props$4,
366
408
  plugin: plugin$4
367
409
  };
368
410
 
@@ -558,7 +600,7 @@ var zoompanPlugin = {
558
600
 
559
601
  var transformationPlugins = [
560
602
  // Background Removal must always come first
561
- removeBackgroundPlugin, croppingPlugin, effectsPlugin, overlaysPlugin, underlaysPlugin, zoompanPlugin,
603
+ removeBackgroundPlugin, croppingPlugin, effectsPlugin, overlaysPlugin, namedTransformationsPlugin, underlaysPlugin, zoompanPlugin,
562
604
  // Raw transformations needs to be last simply to make sure
563
605
  // it's always expected to applied the same way
564
606
 
@@ -595,7 +637,19 @@ function constructCloudinaryUrl(_ref) {
595
637
  if (pluginOptions != null && pluginOptions.format) {
596
638
  options.format = pluginOptions.format;
597
639
  }
640
+ if (pluginOptions != null && pluginOptions.width) {
641
+ options.resize = {
642
+ width: pluginOptions == null ? void 0 : pluginOptions.width
643
+ };
644
+ }
598
645
  });
646
+ if (options.resize) {
647
+ var _options$resize = options.resize,
648
+ width = _options$resize.width,
649
+ _options$resize$crop = _options$resize.crop,
650
+ crop = _options$resize$crop === void 0 ? 'scale' : _options$resize$crop;
651
+ cldImage.effect("c_" + crop + ",w_" + width);
652
+ }
599
653
  return cldImage.setDeliveryType(options.deliveryType || 'upload').format(options.format || 'auto').delivery("q_" + (options.quality || 'auto')).toURL();
600
654
  }
601
655
 
@@ -664,6 +718,8 @@ function cloudinaryLoader(_ref) {
664
718
  _ref$cldConfig = _ref.cldConfig,
665
719
  cldConfig = _ref$cldConfig === void 0 ? {} : _ref$cldConfig;
666
720
  var options = _extends({}, imageProps, cldOptions);
721
+ options.width = parseInt(options.width);
722
+ options.height = parseInt(options.height);
667
723
 
668
724
  // The loader options are used to create dynamic sizing when working with responsive images
669
725
  // so these should override the default options collected from the props alone if
@@ -672,8 +728,8 @@ function cloudinaryLoader(_ref) {
672
728
 
673
729
  if (loaderOptions != null && loaderOptions.width && loaderOptions.width !== options.width) {
674
730
  var multiplier = loaderOptions.width / options.width;
675
- options.width = loaderOptions.width;
676
- options.height = Math.round(options.height * multiplier);
731
+ options.widthResize = loaderOptions.width;
732
+ options.heightResize = Math.round(options.height * multiplier);
677
733
  }
678
734
  return constructCloudinaryUrl({
679
735
  options: options,