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.
@@ -38,7 +38,79 @@ function _objectWithoutPropertiesLoose(source, excluded) {
38
38
  return target;
39
39
  }
40
40
 
41
+ function _readOnlyError(name) {
42
+ throw new TypeError("\"" + name + "\" is read-only");
43
+ }
44
+
45
+ var cld$1 = new urlGen.Cloudinary({
46
+ cloud: {
47
+ cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
48
+ },
49
+ url: {
50
+ // Used to avoid issues with SSR particularly for the blurred placeholder
51
+ analytics: false
52
+ }
53
+ });
54
+ /**
55
+ * createPlaceholderUrl
56
+ */
57
+
58
+ function createPlaceholderUrl(_ref) {
59
+ var src = _ref.src,
60
+ placeholder = _ref.placeholder;
61
+ var cldImage = cld$1.image(src).resize('c_limit,w_100').delivery('q_1').format('auto');
62
+
63
+ if (placeholder === 'grayscale') {
64
+ cldImage.effect('e_grayscale');
65
+ }
66
+
67
+ if (placeholder.includes('color:')) {
68
+ var color = placeholder.split(':').splice(1).join(':');
69
+ cldImage.effect('e_grayscale');
70
+ cldImage.effect("e_colorize:60,co_" + color);
71
+ }
72
+
73
+ return cldImage.toURL();
74
+ }
75
+
76
+ var cropsGravityAuto = ['crop', 'fill', 'lfill', 'fill_pad', 'thumb'];
77
+ function croppingPlugin(_temp) {
78
+ var _ref = _temp === void 0 ? {} : _temp,
79
+ cldImage = _ref.cldImage,
80
+ options = _ref.options,
81
+ cldOptions = _ref.cldOptions;
82
+
83
+ var width = options.width,
84
+ height = options.height;
85
+ var _cldOptions$crop = cldOptions.crop,
86
+ crop = _cldOptions$crop === void 0 ? 'limit' : _cldOptions$crop,
87
+ gravity = cldOptions.gravity;
88
+ var transformationString = "c_" + crop + ",w_" + width;
89
+
90
+ if (!gravity && cropsGravityAuto.includes(crop)) {
91
+ _readOnlyError("gravity");
92
+ }
93
+
94
+ if (!['limit'].includes(crop)) {
95
+ transformationString = transformationString + ",h_" + height;
96
+ }
97
+
98
+ if (gravity) {
99
+ if (gravity === 'auto' && !cropsGravityAuto.includes(crop)) {
100
+ console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');
101
+ } else {
102
+ transformationString = transformationString + ",g_" + gravity;
103
+ }
104
+ }
105
+
106
+ cldImage.resize(transformationString);
107
+ }
108
+
109
+ // aspectRatio
41
110
  var primary = {
111
+ aspectRatio: {
112
+ qualifier: 'ar'
113
+ },
42
114
  crop: {
43
115
  qualifier: 'c'
44
116
  },
@@ -88,70 +160,31 @@ var text = {
88
160
  }
89
161
  };
90
162
 
91
- var _excluded$1 = ["publicId", "type", "position", "text", "effects"];
92
- var cld$1 = new urlGen.Cloudinary({
93
- cloud: {
94
- cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
95
- }
96
- });
97
- function cloudinaryLoader(options, cldOptions) {
98
- var src = options.src,
99
- width = options.width,
100
- _options$format = options.format,
101
- format = _options$format === void 0 ? 'auto' : _options$format,
102
- _options$quality = options.quality,
103
- quality = _options$quality === void 0 ? 'auto' : _options$quality;
104
- var _cldOptions$overlays = cldOptions.overlays,
105
- overlays = _cldOptions$overlays === void 0 ? [] : _cldOptions$overlays,
106
- _cldOptions$removeBac = cldOptions.removeBackground,
107
- removeBackground = _cldOptions$removeBac === void 0 ? false : _cldOptions$removeBac,
108
- _cldOptions$underlays = cldOptions.underlays,
109
- underlays = _cldOptions$underlays === void 0 ? [] : _cldOptions$underlays;
110
- var cldImage = cld$1.image(src);
111
-
112
- if (removeBackground) {
113
- cldImage.effect('e_background_removal');
114
- } // Adding overlays and underlays allows you to compose your image
115
- // by using layering with overlays appearing on top of and udnerlays
116
- // appearing below your base image layer
117
- //
118
- // Learn more: https://cloudinary.com/documentation/layers
119
-
163
+ var _excluded$1 = ["publicId", "position", "text", "effects"];
164
+ function overlaysPlugin(_temp) {
165
+ var _ref = _temp === void 0 ? {} : _temp,
166
+ cldImage = _ref.cldImage,
167
+ cldOptions = _ref.cldOptions;
120
168
 
121
- var layers = [].concat(overlays.map(function (overlay) {
122
- return _extends({}, overlay, {
123
- type: 'overlay'
124
- });
125
- }), underlays.map(function (underlay) {
126
- return _extends({}, underlay, {
127
- type: 'underlay'
128
- });
129
- }));
130
- layers.forEach(function (_ref) {
131
- var publicId = _ref.publicId,
132
- type = _ref.type,
133
- position$1 = _ref.position,
134
- text$1 = _ref.text,
135
- _ref$effects = _ref.effects,
136
- layerEffects = _ref$effects === void 0 ? [] : _ref$effects,
137
- options = _objectWithoutPropertiesLoose(_ref, _excluded$1);
169
+ var _cldOptions$overlays = cldOptions.overlays,
170
+ overlays = _cldOptions$overlays === void 0 ? [] : _cldOptions$overlays;
171
+ var type = 'overlay';
172
+ var typeQualifier = 'l';
173
+ overlays.forEach(function (_ref2) {
174
+ var publicId = _ref2.publicId,
175
+ position$1 = _ref2.position,
176
+ text$1 = _ref2.text,
177
+ _ref2$effects = _ref2.effects,
178
+ layerEffects = _ref2$effects === void 0 ? [] : _ref2$effects,
179
+ options = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
138
180
 
139
181
  var hasPublicId = typeof publicId === 'string';
140
182
  var hasText = typeof text$1 === 'object';
141
183
  var hasPosition = typeof position$1 === 'object';
142
184
 
143
185
  if (!hasPublicId && !hasText) {
144
- console.warn(type + " is missing Public ID or Text");
186
+ console.warn("An " + type + " is missing Public ID or Text");
145
187
  return;
146
- } // Determine the qualifier for the type of layer
147
-
148
-
149
- var typeQualifier;
150
-
151
- if (type === 'overlay') {
152
- typeQualifier = 'l';
153
- } else if (type === 'underlay') {
154
- typeQualifier = 'u';
155
188
  } // Start to construct the transformation string using text or the public ID
156
189
  // if it's image-based
157
190
 
@@ -221,59 +254,167 @@ function cloudinaryLoader(options, cldOptions) {
221
254
 
222
255
  cldImage.addTransformation(layerTransformation);
223
256
  });
224
- return cldImage.resize("c_limit,w_" + width).format(format).delivery("q_" + quality).toURL();
225
257
  }
226
258
 
227
- var _excluded = ["overlays", "removeBackground", "underlays"];
259
+ function removeBackgroundPlugin(_temp) {
260
+ var _ref = _temp === void 0 ? {} : _temp,
261
+ cldImage = _ref.cldImage,
262
+ cldOptions = _ref.cldOptions;
263
+
264
+ var _cldOptions$removeBac = cldOptions.removeBackground,
265
+ removeBackground = _cldOptions$removeBac === void 0 ? false : _cldOptions$removeBac;
266
+
267
+ if (removeBackground) {
268
+ cldImage.effect('e_background_removal');
269
+ }
270
+ }
271
+
272
+ function tintPlugin(_temp) {
273
+ var _ref = _temp === void 0 ? {} : _temp,
274
+ cldImage = _ref.cldImage,
275
+ cldOptions = _ref.cldOptions;
276
+
277
+ var tint = cldOptions.tint;
278
+
279
+ if (tint) {
280
+ cldImage.effect("e_tint:" + tint);
281
+ }
282
+ }
283
+
284
+ var _excluded = ["publicId", "type", "position", "text", "effects"];
285
+ function underlaysPlugin(_temp) {
286
+ var _ref = _temp === void 0 ? {} : _temp,
287
+ cldImage = _ref.cldImage,
288
+ cldOptions = _ref.cldOptions;
289
+
290
+ var _cldOptions$underlays = cldOptions.underlays,
291
+ underlays = _cldOptions$underlays === void 0 ? [] : _cldOptions$underlays;
292
+ var typeQualifier = 'u';
293
+ underlays.forEach(function (_ref2) {
294
+ var publicId = _ref2.publicId,
295
+ type = _ref2.type,
296
+ position$1 = _ref2.position,
297
+ _ref2$effects = _ref2.effects,
298
+ layerEffects = _ref2$effects === void 0 ? [] : _ref2$effects,
299
+ options = _objectWithoutPropertiesLoose(_ref2, _excluded);
300
+
301
+ var hasPublicId = typeof publicId === 'string';
302
+ var hasPosition = typeof position$1 === 'object';
303
+
304
+ if (!hasPublicId) {
305
+ console.warn("An " + type + " is missing a Public ID");
306
+ return;
307
+ } // Start to construct the transformation string using text or the public ID
308
+ // if it's image-based
309
+
310
+
311
+ var layerTransformation = typeQualifier + "_" + publicId.replace(/\//g, ':'); // Begin organizing transformations based on what it is and the location
312
+ // it needs to be placed in the URL
313
+
314
+ var primary$1 = [];
315
+ var applied = []; // Gemeral options
316
+
317
+ Object.keys(options).forEach(function (key) {
318
+ if (!primary[key]) return;
319
+ var qualifier = primary[key].qualifier;
320
+ primary$1.push(qualifier + "_" + options[key]);
321
+ }); // Layer effects
322
+
323
+ layerEffects.forEach(function (effect) {
324
+ Object.keys(effect).forEach(function (key) {
325
+ if (!primary[key]) return;
326
+ var qualifier = primary[key].qualifier;
327
+ primary$1.push(qualifier + "_" + effect[key]);
328
+ });
329
+ }); // Positioning
330
+
331
+ if (hasPosition) {
332
+ Object.keys(position$1).forEach(function (key) {
333
+ if (!position[key]) return;
334
+ var qualifier = position[key].qualifier;
335
+ applied.push(qualifier + "_" + position$1[key]);
336
+ });
337
+ } // Add all primary transformations
338
+
339
+
340
+ layerTransformation = layerTransformation + "," + primary$1.join(','); // Add all applied transformations
341
+
342
+ layerTransformation = layerTransformation + "/fl_layer_apply";
343
+
344
+ if (applied.length > 0) {
345
+ layerTransformation = layerTransformation + "," + applied.join(',');
346
+ } // Finally add it to the image
347
+
348
+
349
+ cldImage.addTransformation(layerTransformation);
350
+ });
351
+ }
352
+
228
353
  var cld = new urlGen.Cloudinary({
229
354
  cloud: {
230
355
  cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
231
- },
232
- url: {
233
- // Used to avoid issues with SSR particularly for the blurred placeholder
234
- analytics: false
235
356
  }
236
357
  });
358
+ var transformationPlugins = [removeBackgroundPlugin, // Background Removal must always come first
359
+ croppingPlugin, tintPlugin, overlaysPlugin, underlaysPlugin];
360
+ function cloudinaryLoader(options, cldOptions) {
361
+ var src = options.src,
362
+ _options$format = options.format,
363
+ format = _options$format === void 0 ? 'auto' : _options$format,
364
+ _options$quality = options.quality,
365
+ quality = _options$quality === void 0 ? 'auto' : _options$quality;
366
+ var cldImage = cld.image(src);
367
+ transformationPlugins.forEach(function (plugin) {
368
+ plugin({
369
+ cldImage: cldImage,
370
+ options: options,
371
+ cldOptions: cldOptions
372
+ });
373
+ });
374
+ return cldImage.format(format).delivery("q_" + quality).toURL();
375
+ }
237
376
 
238
- var CldImage = function CldImage(_ref) {
239
- var overlays = _ref.overlays,
240
- removeBackground = _ref.removeBackground,
241
- underlays = _ref.underlays,
242
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
243
-
244
- var cldOptions = {
245
- overlays: overlays,
246
- removeBackground: removeBackground,
247
- underlays: underlays
248
- };
249
- var imageProps = {}; // If we see a placeholder option, configure a Cloudinary-based URL.
377
+ var options = ['crop', 'gravity', 'overlays', 'removeBackground', 'tint', 'underlays'];
378
+
379
+ var CldImage = function CldImage(props) {
380
+ // Construct the base Image component props by filtering out Cloudinary-specific props
381
+ var imageProps = {};
382
+ Object.keys(props).filter(function (key) {
383
+ return !options.includes(key);
384
+ }).forEach(function (key) {
385
+ return imageProps[key] = props[key];
386
+ }); // Construct Cloudinary-specific props by looking for values for any of the supported prop keys
387
+
388
+ var cldOptions = {};
389
+ options.forEach(function (key) {
390
+ if (props[key]) {
391
+ cldOptions[key] = props[key];
392
+ }
393
+ }); // If we see a placeholder option, configure a Cloudinary-based URL.
250
394
  // The resulting image will always be blurred per Next.js, so we're
251
395
  // limited on options for placeholders.
396
+ //
397
+ // We need to do this logic here as we potentially need to mutate
398
+ // an Image component prop as opposed to simply the URL
399
+ //
252
400
  // https://nextjs.org/docs/api-reference/next/image#blurdataurl
253
401
 
254
- if (props.placeholder) {
255
- var cldBlurredImage = cld.image(props.src).resize('c_limit,w_100').delivery('q_1').format('auto');
256
-
257
- if (props.placeholder === 'grayscale') {
258
- cldBlurredImage.effect('e_grayscale');
259
- }
260
-
261
- if (props.placeholder.includes('color:')) {
262
- var color = props.placeholder.split(':').splice(1).join(':');
263
- cldBlurredImage.effect('e_grayscale');
264
- cldBlurredImage.effect("e_colorize:60,co_" + color);
265
- }
266
-
267
- imageProps.blurDataURL = cldBlurredImage.toURL();
402
+ if (imageProps.placeholder) {
403
+ imageProps.blurDataURL = createPlaceholderUrl({
404
+ src: props.src,
405
+ placeholder: props.placeholder
406
+ });
268
407
 
269
- if (props.placeholder !== 'blur') {
270
- props.placeholder = 'blur';
408
+ if (imageProps.placeholder !== 'blur') {
409
+ imageProps.placeholder = 'blur';
271
410
  }
272
411
  }
273
412
 
274
- return /*#__PURE__*/jsxRuntime.jsx(Image__default["default"], _extends({}, imageProps, props, {
413
+ return /*#__PURE__*/jsxRuntime.jsx(Image__default["default"], _extends({}, imageProps, {
275
414
  loader: function loader(options) {
276
- return cloudinaryLoader(options, cldOptions);
415
+ return cloudinaryLoader(_extends({}, imageProps, {
416
+ options: options
417
+ }), cldOptions);
277
418
  }
278
419
  }));
279
420
  };
@@ -1 +1 @@
1
- {"version":3,"file":"next-cloudinary.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","Image"],"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,GAA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AFN,EAAA;IAGE,MAAM,EAAE,gBAAC/C,OAAD,EAAA;AAAA,MAAA,OAAaD,gBAAgB,CAACC,OAAD,EAAUC,UAAV,CAA7B,CAAA;AAAA,KAAA;GAJZ,CAAA,CAAA,CAAA;AAOD;;;;;;;;"}
1
+ {"version":3,"file":"next-cloudinary.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","Image"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,KAAG,GAAG,IAAIC,iBAAJ,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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