next-cloudinary 0.0.3 → 0.0.6

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.
@@ -34,7 +34,79 @@ function _objectWithoutPropertiesLoose(source, excluded) {
34
34
  return target;
35
35
  }
36
36
 
37
+ function _readOnlyError(name) {
38
+ throw new TypeError("\"" + name + "\" is read-only");
39
+ }
40
+
41
+ var cld$1 = new Cloudinary({
42
+ cloud: {
43
+ cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
44
+ },
45
+ url: {
46
+ // Used to avoid issues with SSR particularly for the blurred placeholder
47
+ analytics: false
48
+ }
49
+ });
50
+ /**
51
+ * createPlaceholderUrl
52
+ */
53
+
54
+ function createPlaceholderUrl(_ref) {
55
+ var src = _ref.src,
56
+ placeholder = _ref.placeholder;
57
+ var cldImage = cld$1.image(src).resize('c_limit,w_100').delivery('q_1').format('auto');
58
+
59
+ if (placeholder === 'grayscale') {
60
+ cldImage.effect('e_grayscale');
61
+ }
62
+
63
+ if (placeholder.includes('color:')) {
64
+ var color = placeholder.split(':').splice(1).join(':');
65
+ cldImage.effect('e_grayscale');
66
+ cldImage.effect("e_colorize:60,co_" + color);
67
+ }
68
+
69
+ return cldImage.toURL();
70
+ }
71
+
72
+ var cropsGravityAuto = ['crop', 'fill', 'lfill', 'fill_pad', 'thumb'];
73
+ function croppingPlugin(_temp) {
74
+ var _ref = _temp === void 0 ? {} : _temp,
75
+ cldImage = _ref.cldImage,
76
+ options = _ref.options,
77
+ cldOptions = _ref.cldOptions;
78
+
79
+ var width = options.width,
80
+ height = options.height;
81
+ var _cldOptions$crop = cldOptions.crop,
82
+ crop = _cldOptions$crop === void 0 ? 'limit' : _cldOptions$crop,
83
+ gravity = cldOptions.gravity;
84
+ var transformationString = "c_" + crop + ",w_" + width;
85
+
86
+ if (!gravity && cropsGravityAuto.includes(crop)) {
87
+ _readOnlyError("gravity");
88
+ }
89
+
90
+ if (!['limit'].includes(crop)) {
91
+ transformationString = transformationString + ",h_" + height;
92
+ }
93
+
94
+ if (gravity) {
95
+ if (gravity === 'auto' && !cropsGravityAuto.includes(crop)) {
96
+ console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');
97
+ } else {
98
+ transformationString = transformationString + ",g_" + gravity;
99
+ }
100
+ }
101
+
102
+ cldImage.resize(transformationString);
103
+ }
104
+
105
+ // aspectRatio
37
106
  var primary = {
107
+ aspectRatio: {
108
+ qualifier: 'ar'
109
+ },
38
110
  crop: {
39
111
  qualifier: 'c'
40
112
  },
@@ -84,70 +156,31 @@ var text = {
84
156
  }
85
157
  };
86
158
 
87
- var _excluded$1 = ["publicId", "type", "position", "text", "effects"];
88
- var cld$1 = new Cloudinary({
89
- cloud: {
90
- cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
91
- }
92
- });
93
- function cloudinaryLoader(options, cldOptions) {
94
- var src = options.src,
95
- width = options.width,
96
- _options$format = options.format,
97
- format = _options$format === void 0 ? 'auto' : _options$format,
98
- _options$quality = options.quality,
99
- quality = _options$quality === void 0 ? 'auto' : _options$quality;
100
- var _cldOptions$overlays = cldOptions.overlays,
101
- overlays = _cldOptions$overlays === void 0 ? [] : _cldOptions$overlays,
102
- _cldOptions$removeBac = cldOptions.removeBackground,
103
- removeBackground = _cldOptions$removeBac === void 0 ? false : _cldOptions$removeBac,
104
- _cldOptions$underlays = cldOptions.underlays,
105
- underlays = _cldOptions$underlays === void 0 ? [] : _cldOptions$underlays;
106
- var cldImage = cld$1.image(src);
107
-
108
- if (removeBackground) {
109
- cldImage.effect('e_background_removal');
110
- } // Adding overlays and underlays allows you to compose your image
111
- // by using layering with overlays appearing on top of and udnerlays
112
- // appearing below your base image layer
113
- //
114
- // Learn more: https://cloudinary.com/documentation/layers
115
-
159
+ var _excluded$1 = ["publicId", "position", "text", "effects"];
160
+ function overlaysPlugin(_temp) {
161
+ var _ref = _temp === void 0 ? {} : _temp,
162
+ cldImage = _ref.cldImage,
163
+ cldOptions = _ref.cldOptions;
116
164
 
117
- var layers = [].concat(overlays.map(function (overlay) {
118
- return _extends({}, overlay, {
119
- type: 'overlay'
120
- });
121
- }), underlays.map(function (underlay) {
122
- return _extends({}, underlay, {
123
- type: 'underlay'
124
- });
125
- }));
126
- layers.forEach(function (_ref) {
127
- var publicId = _ref.publicId,
128
- type = _ref.type,
129
- position$1 = _ref.position,
130
- text$1 = _ref.text,
131
- _ref$effects = _ref.effects,
132
- layerEffects = _ref$effects === void 0 ? [] : _ref$effects,
133
- options = _objectWithoutPropertiesLoose(_ref, _excluded$1);
165
+ var _cldOptions$overlays = cldOptions.overlays,
166
+ overlays = _cldOptions$overlays === void 0 ? [] : _cldOptions$overlays;
167
+ var type = 'overlay';
168
+ var typeQualifier = 'l';
169
+ overlays.forEach(function (_ref2) {
170
+ var publicId = _ref2.publicId,
171
+ position$1 = _ref2.position,
172
+ text$1 = _ref2.text,
173
+ _ref2$effects = _ref2.effects,
174
+ layerEffects = _ref2$effects === void 0 ? [] : _ref2$effects,
175
+ options = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
134
176
 
135
177
  var hasPublicId = typeof publicId === 'string';
136
178
  var hasText = typeof text$1 === 'object';
137
179
  var hasPosition = typeof position$1 === 'object';
138
180
 
139
181
  if (!hasPublicId && !hasText) {
140
- console.warn(type + " is missing Public ID or Text");
182
+ console.warn("An " + type + " is missing Public ID or Text");
141
183
  return;
142
- } // Determine the qualifier for the type of layer
143
-
144
-
145
- var typeQualifier;
146
-
147
- if (type === 'overlay') {
148
- typeQualifier = 'l';
149
- } else if (type === 'underlay') {
150
- typeQualifier = 'u';
151
184
  } // Start to construct the transformation string using text or the public ID
152
185
  // if it's image-based
153
186
 
@@ -217,59 +250,167 @@ function cloudinaryLoader(options, cldOptions) {
217
250
 
218
251
  cldImage.addTransformation(layerTransformation);
219
252
  });
220
- return cldImage.resize("c_limit,w_" + width).format(format).delivery("q_" + quality).toURL();
221
253
  }
222
254
 
223
- var _excluded = ["overlays", "removeBackground", "underlays"];
255
+ function removeBackgroundPlugin(_temp) {
256
+ var _ref = _temp === void 0 ? {} : _temp,
257
+ cldImage = _ref.cldImage,
258
+ cldOptions = _ref.cldOptions;
259
+
260
+ var _cldOptions$removeBac = cldOptions.removeBackground,
261
+ removeBackground = _cldOptions$removeBac === void 0 ? false : _cldOptions$removeBac;
262
+
263
+ if (removeBackground) {
264
+ cldImage.effect('e_background_removal');
265
+ }
266
+ }
267
+
268
+ function tintPlugin(_temp) {
269
+ var _ref = _temp === void 0 ? {} : _temp,
270
+ cldImage = _ref.cldImage,
271
+ cldOptions = _ref.cldOptions;
272
+
273
+ var tint = cldOptions.tint;
274
+
275
+ if (tint) {
276
+ cldImage.effect("e_tint:" + tint);
277
+ }
278
+ }
279
+
280
+ var _excluded = ["publicId", "type", "position", "text", "effects"];
281
+ function underlaysPlugin(_temp) {
282
+ var _ref = _temp === void 0 ? {} : _temp,
283
+ cldImage = _ref.cldImage,
284
+ cldOptions = _ref.cldOptions;
285
+
286
+ var _cldOptions$underlays = cldOptions.underlays,
287
+ underlays = _cldOptions$underlays === void 0 ? [] : _cldOptions$underlays;
288
+ var typeQualifier = 'u';
289
+ underlays.forEach(function (_ref2) {
290
+ var publicId = _ref2.publicId,
291
+ type = _ref2.type,
292
+ position$1 = _ref2.position,
293
+ _ref2$effects = _ref2.effects,
294
+ layerEffects = _ref2$effects === void 0 ? [] : _ref2$effects,
295
+ options = _objectWithoutPropertiesLoose(_ref2, _excluded);
296
+
297
+ var hasPublicId = typeof publicId === 'string';
298
+ var hasPosition = typeof position$1 === 'object';
299
+
300
+ if (!hasPublicId) {
301
+ console.warn("An " + type + " is missing a Public ID");
302
+ return;
303
+ } // Start to construct the transformation string using text or the public ID
304
+ // if it's image-based
305
+
306
+
307
+ var layerTransformation = typeQualifier + "_" + publicId.replace(/\//g, ':'); // Begin organizing transformations based on what it is and the location
308
+ // it needs to be placed in the URL
309
+
310
+ var primary$1 = [];
311
+ var applied = []; // Gemeral options
312
+
313
+ Object.keys(options).forEach(function (key) {
314
+ if (!primary[key]) return;
315
+ var qualifier = primary[key].qualifier;
316
+ primary$1.push(qualifier + "_" + options[key]);
317
+ }); // Layer effects
318
+
319
+ layerEffects.forEach(function (effect) {
320
+ Object.keys(effect).forEach(function (key) {
321
+ if (!primary[key]) return;
322
+ var qualifier = primary[key].qualifier;
323
+ primary$1.push(qualifier + "_" + effect[key]);
324
+ });
325
+ }); // Positioning
326
+
327
+ if (hasPosition) {
328
+ Object.keys(position$1).forEach(function (key) {
329
+ if (!position[key]) return;
330
+ var qualifier = position[key].qualifier;
331
+ applied.push(qualifier + "_" + position$1[key]);
332
+ });
333
+ } // Add all primary transformations
334
+
335
+
336
+ layerTransformation = layerTransformation + "," + primary$1.join(','); // Add all applied transformations
337
+
338
+ layerTransformation = layerTransformation + "/fl_layer_apply";
339
+
340
+ if (applied.length > 0) {
341
+ layerTransformation = layerTransformation + "," + applied.join(',');
342
+ } // Finally add it to the image
343
+
344
+
345
+ cldImage.addTransformation(layerTransformation);
346
+ });
347
+ }
348
+
224
349
  var cld = new Cloudinary({
225
350
  cloud: {
226
351
  cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
227
- },
228
- url: {
229
- // Used to avoid issues with SSR particularly for the blurred placeholder
230
- analytics: false
231
352
  }
232
353
  });
354
+ var transformationPlugins = [removeBackgroundPlugin, // Background Removal must always come first
355
+ croppingPlugin, tintPlugin, overlaysPlugin, underlaysPlugin];
356
+ function cloudinaryLoader(options, cldOptions) {
357
+ var src = options.src,
358
+ _options$format = options.format,
359
+ format = _options$format === void 0 ? 'auto' : _options$format,
360
+ _options$quality = options.quality,
361
+ quality = _options$quality === void 0 ? 'auto' : _options$quality;
362
+ var cldImage = cld.image(src);
363
+ transformationPlugins.forEach(function (plugin) {
364
+ plugin({
365
+ cldImage: cldImage,
366
+ options: options,
367
+ cldOptions: cldOptions
368
+ });
369
+ });
370
+ return cldImage.format(format).delivery("q_" + quality).toURL();
371
+ }
233
372
 
234
- var CldImage = function CldImage(_ref) {
235
- var overlays = _ref.overlays,
236
- removeBackground = _ref.removeBackground,
237
- underlays = _ref.underlays,
238
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
239
-
240
- var cldOptions = {
241
- overlays: overlays,
242
- removeBackground: removeBackground,
243
- underlays: underlays
244
- };
245
- var imageProps = {}; // If we see a placeholder option, configure a Cloudinary-based URL.
373
+ var options = ['crop', 'gravity', 'overlays', 'removeBackground', 'tint', 'underlays'];
374
+
375
+ var CldImage = function CldImage(props) {
376
+ // Construct the base Image component props by filtering out Cloudinary-specific props
377
+ var imageProps = {};
378
+ Object.keys(props).filter(function (key) {
379
+ return !options.includes(key);
380
+ }).forEach(function (key) {
381
+ return imageProps[key] = props[key];
382
+ }); // Construct Cloudinary-specific props by looking for values for any of the supported prop keys
383
+
384
+ var cldOptions = {};
385
+ options.forEach(function (key) {
386
+ if (props[key]) {
387
+ cldOptions[key] = props[key];
388
+ }
389
+ }); // If we see a placeholder option, configure a Cloudinary-based URL.
246
390
  // The resulting image will always be blurred per Next.js, so we're
247
391
  // limited on options for placeholders.
392
+ //
393
+ // We need to do this logic here as we potentially need to mutate
394
+ // an Image component prop as opposed to simply the URL
395
+ //
248
396
  // https://nextjs.org/docs/api-reference/next/image#blurdataurl
249
397
 
250
- if (props.placeholder) {
251
- var cldBlurredImage = cld.image(props.src).resize('c_limit,w_100').delivery('q_1').format('auto');
252
-
253
- if (props.placeholder === 'grayscale') {
254
- cldBlurredImage.effect('e_grayscale');
255
- }
256
-
257
- if (props.placeholder.includes('color:')) {
258
- var color = props.placeholder.split(':').splice(1).join(':');
259
- cldBlurredImage.effect('e_grayscale');
260
- cldBlurredImage.effect("e_colorize:60,co_" + color);
261
- }
262
-
263
- imageProps.blurDataURL = cldBlurredImage.toURL();
398
+ if (imageProps.placeholder) {
399
+ imageProps.blurDataURL = createPlaceholderUrl({
400
+ src: props.src,
401
+ placeholder: props.placeholder
402
+ });
264
403
 
265
- if (props.placeholder !== 'blur') {
266
- props.placeholder = 'blur';
404
+ if (imageProps.placeholder !== 'blur') {
405
+ imageProps.placeholder = 'blur';
267
406
  }
268
407
  }
269
408
 
270
- return /*#__PURE__*/jsx(Image, _extends({}, imageProps, props, {
409
+ return /*#__PURE__*/jsx(Image, _extends({}, imageProps, {
271
410
  loader: function loader(options) {
272
- return cloudinaryLoader(options, cldOptions);
411
+ return cloudinaryLoader(_extends({}, imageProps, {
412
+ options: options
413
+ }), cldOptions);
273
414
  }
274
415
  }));
275
416
  };
@@ -1 +1 @@
1
- {"version":3,"file":"next-cloudinary.module.js","sources":["../src/constants/qualifiers.js","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.js"],"sourcesContent":["export const primary = {\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 color: {\n qualifier: 'co',\n location: 'primary'\n },\n textDecoration: {\n qualifier: false\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}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n }\n});\n\nexport function cloudinaryLoader(options, cldOptions) {\n const {\n src,\n width,\n format = 'auto',\n quality = 'auto',\n } = options;\n\n const {\n overlays = [],\n effects = [],\n removeBackground = false,\n underlays = []\n } = cldOptions;\n\n const cldImage = cld.image(src);\n\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n\n // Adding overlays and underlays allows you to compose your image\n // by using layering with overlays appearing on top of and udnerlays\n // appearing below your base image layer\n //\n // Learn more: https://cloudinary.com/documentation/layers\n\n const layers = [\n ...overlays.map(overlay => ({ ...overlay, type: 'overlay' })),\n ...underlays.map(underlay => ({ ...underlay, type: 'underlay' })),\n ];\n\n layers.forEach(({ publicId, type, position, text, effects: layerEffects = [], ...options }) => {\n const hasPublicId = typeof publicId === 'string';\n const hasText = typeof text === 'object';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasText ) {\n console.warn(`${type} is missing Public ID or Text`);\n return;\n }\n\n // Determine the qualifier for the type of layer\n\n let typeQualifier;\n\n if ( type === 'overlay' ) {\n typeQualifier = 'l';\n } else if ( type === 'underlay' ) {\n typeQualifier = 'u';\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 {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\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 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 {\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`;\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\n return cldImage.resize(`c_limit,w_${width}`).format(format).delivery(`q_${quality}`).toURL();\n}","import Image from 'next/image';\nimport { Cloudinary } from '@cloudinary/url-gen';\n\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst 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});\n\nconst CldImage = ({ overlays, removeBackground, underlays, ...props }) => {\n const cldOptions = {\n overlays,\n removeBackground,\n underlays,\n };\n\n const imageProps = {};\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 // https://nextjs.org/docs/api-reference/next/image#blurdataurl\n\n if ( props.placeholder ) {\n const cldBlurredImage = cld.image(props.src)\n .resize('c_limit,w_100')\n .delivery('q_1')\n .format('auto');\n\n if ( props.placeholder === 'grayscale' ) {\n cldBlurredImage.effect('e_grayscale');\n }\n\n if ( props.placeholder.includes('color:') ) {\n const color = props.placeholder.split(':').splice(1).join(':')\n cldBlurredImage.effect('e_grayscale');\n cldBlurredImage.effect(`e_colorize:60,co_${color}`);\n }\n\n imageProps.blurDataURL = cldBlurredImage.toURL();\n\n if ( props.placeholder !== 'blur' ) {\n props.placeholder = 'blur';\n }\n }\n\n return (\n <Image\n {...imageProps}\n {...props}\n loader={(options) => cloudinaryLoader(options, cldOptions)}\n />\n );\n}\n\nexport default CldImage;"],"names":["primary","crop","qualifier","gravity","height","width","position","angle","x","y","text","color","location","textDecoration","fontFamily","fontSize","fontWeight","letterSpacing","cld","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","cloudinaryLoader","options","cldOptions","src","format","quality","overlays","removeBackground","underlays","cldImage","image","effect","layers","map","overlay","type","underlay","forEach","publicId","effects","layerEffects","_excluded","hasPublicId","hasText","hasPosition","console","warn","typeQualifier","layerTransformation","replace","applied","Object","keys","key","qualifiersPrimary","push","textTransformations","qualifiersText","join","qualifiersPosition","length","addTransformation","resize","delivery","toURL","url","analytics","CldImage","props","imageProps","placeholder","cldBlurredImage","includes","split","splice","blurDataURL","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,OAAO,GAAG;AACrBC,EAAAA,IAAI,EAAE;AACJC,IAAAA,SAAS,EAAE,GAAA;GAFQ;AAIrBC,EAAAA,OAAO,EAAE;AACPD,IAAAA,SAAS,EAAE,GAAA;GALQ;AAOrBE,EAAAA,MAAM,EAAE;AACNF,IAAAA,SAAS,EAAE,GAAA;GARQ;AAUrBG,EAAAA,KAAK,EAAE;AACLH,IAAAA,SAAS,EAAE,GAAA;AADN,GAAA;AAVc,EAAhB;AAeA,IAAMI,QAAQ,GAAG;AACtBC,EAAAA,KAAK,EAAE;AACLL,IAAAA,SAAS,EAAE,GAAA;GAFS;AAItBC,EAAAA,OAAO,EAAE;AACPD,IAAAA,SAAS,EAAE,GAAA;GALS;AAOtBM,EAAAA,CAAC,EAAE;AACDN,IAAAA,SAAS,EAAE,GAAA;GARS;AAUtBO,EAAAA,CAAC,EAAE;AACDP,IAAAA,SAAS,EAAE,GAAA;AADV,GAAA;AAVmB,EAAjB;AAeA,IAAMQ,IAAI,GAAG;AAClBC,EAAAA,KAAK,EAAE;AACLT,IAAAA,SAAS,EAAE,I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A,OAAaD,gBAAgB,CAACC,OAAD,EAAUC,UAAV,CAA7B,CAAA;AAAA,KAAA;GAJZ,CAAA,CAAA,CAAA;AAOD;;;;"}
1
+ {"version":3,"file":"next-cloudinary.module.js","sources":["../src/lib/cloudinary.js","../src/plugins/cropping.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/remove-background.js","../src/plugins/tint.js","../src/plugins/underlays.js","../src/loaders/cloudinary-loader.js","../src/constants/options.js","../src/components/CldImage/CldImage.js"],"sourcesContent":["import { Cloudinary } from '@cloudinary/url-gen';\n\nconst 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});\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder }) {\n const cldImage = cld.image(src)\n .resize('c_limit,w_100')\n .delivery('q_1')\n .format('auto');\n\n if ( placeholder === 'grayscale' ) {\n cldImage.effect('e_grayscale');\n }\n\n if ( placeholder.includes('color:') ) {\n const color = placeholder.split(':').splice(1).join(':')\n cldImage.effect('e_grayscale');\n cldImage.effect(`e_colorize:60,co_${color}`);\n }\n\n return cldImage.toURL();\n}","const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\n\nexport function croppingPlugin({ cldImage, options, cldOptions } = {}) {\n const { width, height } = options;\n const { crop = 'limit', gravity } = cldOptions;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !gravity && cropsGravityAuto.includes(crop) ) {\n gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( gravity ) {\n if ( 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_${gravity}`;\n }\n }\n\n cldImage.resize(transformationString);\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 color: {\n qualifier: 'co',\n location: 'primary'\n },\n textDecoration: {\n qualifier: false\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}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport function overlaysPlugin({ cldImage, options, cldOptions } = {}) {\n const { overlays = [] } = cldOptions;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n overlays.forEach(({ publicId, position, text, effects: layerEffects = [], ...options }) => {\n const hasPublicId = typeof publicId === 'string';\n const hasText = typeof text === 'object';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasText ) {\n console.warn(`An ${type} is missing Public ID 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 {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\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 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 {\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`;\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 function removeBackgroundPlugin({ cldImage, options, cldOptions } = {}) {\n const { removeBackground = false } = cldOptions;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","export function tintPlugin({ cldImage, options, cldOptions } = {}) {\n const { tint } = cldOptions;\n\n if ( tint ) {\n cldImage.effect(`e_tint:${tint}`);\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport function underlaysPlugin({ cldImage, options, cldOptions } = {}) {\n const { underlays = [] } = cldOptions;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n underlays.forEach(({ 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`;\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}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport { croppingPlugin } from '../plugins/cropping';\nimport { overlaysPlugin } from '../plugins/overlays';\nimport { removeBackgroundPlugin } from '../plugins/remove-background';\nimport { tintPlugin } from '../plugins/tint';\nimport { underlaysPlugin } from '../plugins/underlays';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n});\n\nconst transformationPlugins = [\n removeBackgroundPlugin, // Background Removal must always come first\n croppingPlugin,\n tintPlugin,\n overlaysPlugin,\n underlaysPlugin\n];\n\nexport function cloudinaryLoader(options, cldOptions) {\n const {\n src,\n width,\n format = 'auto',\n quality = 'auto',\n } = options;\n\n const cldImage = cld.image(src);\n\n transformationPlugins.forEach(plugin => {\n plugin({\n cldImage,\n options,\n cldOptions\n });\n });\n\n return cldImage.format(format).delivery(`q_${quality}`).toURL();\n}","export const options = [\n 'crop',\n 'gravity',\n 'overlays',\n 'removeBackground',\n 'tint',\n 'underlays',\n];","import Image from 'next/image';\n\nimport { createPlaceholderUrl } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nimport { options as CLD_OPTIONS } from '../../constants/options';\n\nconst CldImage = props => {\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 imageProps.blurDataURL = createPlaceholderUrl({\n src: props.src,\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={(options) => cloudinaryLoader({ ...imageProps, options }, cldOptions)}\n />\n );\n}\n\nexport default CldImage;"],"names":["cld","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","url","analytics","createPlaceholderUrl","src","placeholder","cldImage","image","resize","delivery","format","effect","includes","color","split","splice","join","toURL","cropsGravityAuto","croppingPlugin","options","cldOptions","width","height","crop","gravity","transformationString","console","warn","primary","aspectRatio","qualifier","position","angle","x","y","text","location","textDecoration","fontFamily","fontSize","fontWeight","letterSpacing","overlaysPlugin","overlays","type","typeQualifier","forEach","publicId","effects","layerEffects","_excluded","hasPublicId","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","key","qualifiersPrimary","push","textTransformations","qualifiersText","qualifiersPosition","length","addTransformation","removeBackgroundPlugin","removeBackground","tintPlugin","tint","underlaysPlugin","underlays","transformationPlugins","cloudinaryLoader","quality","plugin","CldImage","props","imageProps","filter","CLD_OPTIONS","blurDataURL","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,KAAG,GAAG,IAAIC,UAAJ,CAAe;AACzBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEC,OAAO,CAACC,GAAR,CAAYC,iCAAAA;GAFA;AAIzBC,EAAAA,GAAG,EAAE;AACH;AACAC,IAAAA,SAAS,EAAE,KAAA;AAFR,GAAA;AAJoB,CAAf,CAAZ,CAAA;AAUA;AACA;AACA;;AAEO,SAASC,oBAAT,CAAoD,IAAA,EAAA;EAAA,IAApBC,GAAoB,QAApBA,GAAoB;MAAfC,WAAe,QAAfA,WAAe,CAAA;AACzD,EAAA,IAAMC,QAAQ,GAAGZ,KAAG,CAACa,KAAJ,CAAUH,GAAV,CACII,CAAAA,MADJ,CACW,eADX,CAAA,CAEIC,QAFJ,CAEa,KAFb,EAGIC,MAHJ,CAGW,MAHX,CAAjB,CAAA;;EAKA,IAAKL,WAAW,KAAK,WAArB,EAAmC;IACjCC,QAAQ,CAACK,MAAT,CAAgB,aAAhB,CAAA,CAAA;AACD,GAAA;;AAED,EAAA,IAAKN,WAAW,CAACO,QAAZ,CAAqB,QAArB,CAAL,EAAsC;AACpC,IAAA,IAAMC,KAAK,GAAGR,WAAW,CAACS,KAAZ,CAAkB,GAAlB,CAAuBC,CAAAA,MAAvB,CAA8B,CAA9B,CAAA,CAAiCC,IAAjC,CAAsC,GAAtC,CAAd,CAAA;IACAV,QAAQ,CAACK,MAAT,CAAgB,aAAhB,CAAA,CAAA;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