next-cloudinary 0.0.1 → 0.0.4
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.
- package/dist/next-cloudinary.js +345 -21
- package/dist/next-cloudinary.js.map +1 -1
- package/dist/next-cloudinary.modern.mjs +358 -18
- package/dist/next-cloudinary.modern.mjs.map +1 -1
- package/dist/next-cloudinary.module.js +342 -22
- package/dist/next-cloudinary.module.js.map +1 -1
- package/dist/next-cloudinary.umd.js +348 -24
- package/dist/next-cloudinary.umd.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@cloudinary/url-gen', '
|
|
4
|
-
(global = global || self, factory(global.nextCloudinary = {}, global.
|
|
5
|
-
})(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('next/image'), require('@cloudinary/url-gen'), require('react/jsx-runtime')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'next/image', '@cloudinary/url-gen', 'react/jsx-runtime'], factory) :
|
|
4
|
+
(global = global || self, factory(global.nextCloudinary = {}, global.Image, global.urlGen, global.jsxRuntime));
|
|
5
|
+
})(this, (function (exports, Image, urlGen, jsxRuntime) {
|
|
6
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
7
|
|
|
8
8
|
var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
|
|
@@ -39,53 +39,377 @@
|
|
|
39
39
|
return target;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
function _readOnlyError(name) {
|
|
43
|
+
throw new TypeError("\"" + name + "\" is read-only");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var cld$1 = new urlGen.Cloudinary({
|
|
44
47
|
cloud: {
|
|
45
48
|
cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
|
|
49
|
+
},
|
|
50
|
+
url: {
|
|
51
|
+
// Used to avoid issues with SSR particularly for the blurred placeholder
|
|
52
|
+
analytics: false
|
|
46
53
|
}
|
|
47
54
|
});
|
|
55
|
+
/**
|
|
56
|
+
* createPlaceholderUrl
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
function createPlaceholderUrl(_ref) {
|
|
60
|
+
var src = _ref.src,
|
|
61
|
+
placeholder = _ref.placeholder;
|
|
62
|
+
var cldImage = cld$1.image(src).resize('c_limit,w_100').delivery('q_1').format('auto');
|
|
63
|
+
|
|
64
|
+
if (placeholder === 'grayscale') {
|
|
65
|
+
cldImage.effect('e_grayscale');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (placeholder.includes('color:')) {
|
|
69
|
+
var color = placeholder.split(':').splice(1).join(':');
|
|
70
|
+
cldImage.effect('e_grayscale');
|
|
71
|
+
cldImage.effect("e_colorize:60,co_" + color);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return cldImage.toURL();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var cropsGravityAuto = ['crop', 'fill', 'lfill', 'fill_pad', 'thumb'];
|
|
78
|
+
function croppingPlugin(_temp) {
|
|
79
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
80
|
+
cldImage = _ref.cldImage,
|
|
81
|
+
options = _ref.options,
|
|
82
|
+
cldOptions = _ref.cldOptions;
|
|
83
|
+
|
|
84
|
+
var width = options.width,
|
|
85
|
+
height = options.height;
|
|
86
|
+
var _cldOptions$crop = cldOptions.crop,
|
|
87
|
+
crop = _cldOptions$crop === void 0 ? 'limit' : _cldOptions$crop,
|
|
88
|
+
gravity = cldOptions.gravity;
|
|
89
|
+
var transformationString = "c_" + crop + ",w_" + width;
|
|
90
|
+
|
|
91
|
+
if (!gravity && cropsGravityAuto.includes(crop)) {
|
|
92
|
+
_readOnlyError("gravity");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (!['limit'].includes(crop)) {
|
|
96
|
+
transformationString = transformationString + ",h_" + height;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (gravity) {
|
|
100
|
+
if (gravity === 'auto' && !cropsGravityAuto.includes(crop)) {
|
|
101
|
+
console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');
|
|
102
|
+
} else {
|
|
103
|
+
transformationString = transformationString + ",g_" + gravity;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
cldImage.resize(transformationString);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// aspectRatio
|
|
111
|
+
var primary = {
|
|
112
|
+
aspectRatio: {
|
|
113
|
+
qualifier: 'ar'
|
|
114
|
+
},
|
|
115
|
+
crop: {
|
|
116
|
+
qualifier: 'c'
|
|
117
|
+
},
|
|
118
|
+
gravity: {
|
|
119
|
+
qualifier: 'g'
|
|
120
|
+
},
|
|
121
|
+
height: {
|
|
122
|
+
qualifier: 'h'
|
|
123
|
+
},
|
|
124
|
+
width: {
|
|
125
|
+
qualifier: 'w'
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var position = {
|
|
129
|
+
angle: {
|
|
130
|
+
qualifier: 'a'
|
|
131
|
+
},
|
|
132
|
+
gravity: {
|
|
133
|
+
qualifier: 'g'
|
|
134
|
+
},
|
|
135
|
+
x: {
|
|
136
|
+
qualifier: 'x'
|
|
137
|
+
},
|
|
138
|
+
y: {
|
|
139
|
+
qualifier: 'y'
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var text = {
|
|
143
|
+
color: {
|
|
144
|
+
qualifier: 'co',
|
|
145
|
+
location: 'primary'
|
|
146
|
+
},
|
|
147
|
+
textDecoration: {
|
|
148
|
+
qualifier: false
|
|
149
|
+
},
|
|
150
|
+
fontFamily: {
|
|
151
|
+
qualifier: false
|
|
152
|
+
},
|
|
153
|
+
fontSize: {
|
|
154
|
+
qualifier: false
|
|
155
|
+
},
|
|
156
|
+
fontWeight: {
|
|
157
|
+
qualifier: false
|
|
158
|
+
},
|
|
159
|
+
letterSpacing: {
|
|
160
|
+
qualifier: 'letter_spacing'
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var _excluded$2 = ["publicId", "position", "text", "effects"];
|
|
165
|
+
function overlaysPlugin(_temp) {
|
|
166
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
167
|
+
cldImage = _ref.cldImage,
|
|
168
|
+
cldOptions = _ref.cldOptions;
|
|
169
|
+
|
|
170
|
+
var _cldOptions$overlays = cldOptions.overlays,
|
|
171
|
+
overlays = _cldOptions$overlays === void 0 ? [] : _cldOptions$overlays;
|
|
172
|
+
var type = 'overlay';
|
|
173
|
+
var typeQualifier = 'l';
|
|
174
|
+
overlays.forEach(function (_ref2) {
|
|
175
|
+
var publicId = _ref2.publicId,
|
|
176
|
+
position$1 = _ref2.position,
|
|
177
|
+
text$1 = _ref2.text,
|
|
178
|
+
_ref2$effects = _ref2.effects,
|
|
179
|
+
layerEffects = _ref2$effects === void 0 ? [] : _ref2$effects,
|
|
180
|
+
options = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
|
|
181
|
+
|
|
182
|
+
var hasPublicId = typeof publicId === 'string';
|
|
183
|
+
var hasText = typeof text$1 === 'object';
|
|
184
|
+
var hasPosition = typeof position$1 === 'object';
|
|
185
|
+
|
|
186
|
+
if (!hasPublicId && !hasText) {
|
|
187
|
+
console.warn("An " + type + " is missing Public ID or Text");
|
|
188
|
+
return;
|
|
189
|
+
} // Start to construct the transformation string using text or the public ID
|
|
190
|
+
// if it's image-based
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
var layerTransformation;
|
|
194
|
+
|
|
195
|
+
if (hasText) {
|
|
196
|
+
layerTransformation = typeQualifier + "_text";
|
|
197
|
+
} else {
|
|
198
|
+
layerTransformation = typeQualifier + "_" + publicId.replace(/\//g, ':');
|
|
199
|
+
} // Begin organizing transformations based on what it is and the location
|
|
200
|
+
// it needs to be placed in the URL
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
var primary$1 = [];
|
|
204
|
+
var applied = []; // Gemeral options
|
|
205
|
+
|
|
206
|
+
Object.keys(options).forEach(function (key) {
|
|
207
|
+
if (!primary[key]) return;
|
|
208
|
+
var qualifier = primary[key].qualifier;
|
|
209
|
+
primary$1.push(qualifier + "_" + options[key]);
|
|
210
|
+
}); // Layer effects
|
|
211
|
+
|
|
212
|
+
layerEffects.forEach(function (effect) {
|
|
213
|
+
Object.keys(effect).forEach(function (key) {
|
|
214
|
+
if (!primary[key]) return;
|
|
215
|
+
var qualifier = primary[key].qualifier;
|
|
216
|
+
primary$1.push(qualifier + "_" + effect[key]);
|
|
217
|
+
});
|
|
218
|
+
}); // Text styling
|
|
219
|
+
|
|
220
|
+
if (hasText) {
|
|
221
|
+
var textTransformations = [];
|
|
222
|
+
Object.keys(text$1).forEach(function (key) {
|
|
223
|
+
if (!text[key]) return;
|
|
224
|
+
var _qualifiersText$key = text[key],
|
|
225
|
+
qualifier = _qualifiersText$key.qualifier,
|
|
226
|
+
location = _qualifiersText$key.location;
|
|
227
|
+
|
|
228
|
+
if (location === 'primary') {
|
|
229
|
+
primary$1.push(qualifier + "_" + text$1[key]);
|
|
230
|
+
} else {
|
|
231
|
+
textTransformations.push(text$1[key]);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
layerTransformation = layerTransformation + ":" + textTransformations.join('_') + ":" + text$1.text;
|
|
235
|
+
} // Positioning
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
if (hasPosition) {
|
|
239
|
+
Object.keys(position$1).forEach(function (key) {
|
|
240
|
+
if (!position[key]) return;
|
|
241
|
+
var qualifier = position[key].qualifier;
|
|
242
|
+
applied.push(qualifier + "_" + position$1[key]);
|
|
243
|
+
});
|
|
244
|
+
} // Add all primary transformations
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
layerTransformation = layerTransformation + "," + primary$1.join(','); // Add all applied transformations
|
|
248
|
+
|
|
249
|
+
layerTransformation = layerTransformation + "/fl_layer_apply";
|
|
250
|
+
|
|
251
|
+
if (applied.length > 0) {
|
|
252
|
+
layerTransformation = layerTransformation + "," + applied.join(',');
|
|
253
|
+
} // Finally add it to the image
|
|
48
254
|
|
|
255
|
+
|
|
256
|
+
cldImage.addTransformation(layerTransformation);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function removeBackgroundPlugin(_temp) {
|
|
261
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
262
|
+
cldImage = _ref.cldImage,
|
|
263
|
+
cldOptions = _ref.cldOptions;
|
|
264
|
+
|
|
265
|
+
var _cldOptions$removeBac = cldOptions.removeBackground,
|
|
266
|
+
removeBackground = _cldOptions$removeBac === void 0 ? false : _cldOptions$removeBac;
|
|
267
|
+
|
|
268
|
+
if (removeBackground) {
|
|
269
|
+
cldImage.effect('e_background_removal');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
var _excluded$1 = ["publicId", "type", "position", "text", "effects"];
|
|
274
|
+
function underlaysPlugin(_temp) {
|
|
275
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
276
|
+
cldImage = _ref.cldImage,
|
|
277
|
+
cldOptions = _ref.cldOptions;
|
|
278
|
+
|
|
279
|
+
var _cldOptions$underlays = cldOptions.underlays,
|
|
280
|
+
underlays = _cldOptions$underlays === void 0 ? [] : _cldOptions$underlays;
|
|
281
|
+
var typeQualifier = 'u';
|
|
282
|
+
underlays.forEach(function (_ref2) {
|
|
283
|
+
var publicId = _ref2.publicId,
|
|
284
|
+
type = _ref2.type,
|
|
285
|
+
position$1 = _ref2.position,
|
|
286
|
+
_ref2$effects = _ref2.effects,
|
|
287
|
+
layerEffects = _ref2$effects === void 0 ? [] : _ref2$effects,
|
|
288
|
+
options = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
|
|
289
|
+
|
|
290
|
+
var hasPublicId = typeof publicId === 'string';
|
|
291
|
+
var hasPosition = typeof position$1 === 'object';
|
|
292
|
+
|
|
293
|
+
if (!hasPublicId) {
|
|
294
|
+
console.warn("An " + type + " is missing a Public ID");
|
|
295
|
+
return;
|
|
296
|
+
} // Start to construct the transformation string using text or the public ID
|
|
297
|
+
// if it's image-based
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
var layerTransformation = typeQualifier + "_" + publicId.replace(/\//g, ':'); // Begin organizing transformations based on what it is and the location
|
|
301
|
+
// it needs to be placed in the URL
|
|
302
|
+
|
|
303
|
+
var primary$1 = [];
|
|
304
|
+
var applied = []; // Gemeral options
|
|
305
|
+
|
|
306
|
+
Object.keys(options).forEach(function (key) {
|
|
307
|
+
if (!primary[key]) return;
|
|
308
|
+
var qualifier = primary[key].qualifier;
|
|
309
|
+
primary$1.push(qualifier + "_" + options[key]);
|
|
310
|
+
}); // Layer effects
|
|
311
|
+
|
|
312
|
+
layerEffects.forEach(function (effect) {
|
|
313
|
+
Object.keys(effect).forEach(function (key) {
|
|
314
|
+
if (!primary[key]) return;
|
|
315
|
+
var qualifier = primary[key].qualifier;
|
|
316
|
+
primary$1.push(qualifier + "_" + effect[key]);
|
|
317
|
+
});
|
|
318
|
+
}); // Positioning
|
|
319
|
+
|
|
320
|
+
if (hasPosition) {
|
|
321
|
+
Object.keys(position$1).forEach(function (key) {
|
|
322
|
+
if (!position[key]) return;
|
|
323
|
+
var qualifier = position[key].qualifier;
|
|
324
|
+
applied.push(qualifier + "_" + position$1[key]);
|
|
325
|
+
});
|
|
326
|
+
} // Add all primary transformations
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
layerTransformation = layerTransformation + "," + primary$1.join(','); // Add all applied transformations
|
|
330
|
+
|
|
331
|
+
layerTransformation = layerTransformation + "/fl_layer_apply";
|
|
332
|
+
|
|
333
|
+
if (applied.length > 0) {
|
|
334
|
+
layerTransformation = layerTransformation + "," + applied.join(',');
|
|
335
|
+
} // Finally add it to the image
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
cldImage.addTransformation(layerTransformation);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
var cld = new urlGen.Cloudinary({
|
|
343
|
+
cloud: {
|
|
344
|
+
cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
var transformationPlugins = [// Background Removal must always come first
|
|
348
|
+
removeBackgroundPlugin, croppingPlugin, overlaysPlugin, underlaysPlugin];
|
|
49
349
|
function cloudinaryLoader(options, cldOptions) {
|
|
50
350
|
var src = options.src,
|
|
51
|
-
width = options.width,
|
|
52
351
|
_options$format = options.format,
|
|
53
352
|
format = _options$format === void 0 ? 'auto' : _options$format,
|
|
54
353
|
_options$quality = options.quality,
|
|
55
354
|
quality = _options$quality === void 0 ? 'auto' : _options$quality;
|
|
56
|
-
var _cldOptions$effects = cldOptions.effects,
|
|
57
|
-
effects = _cldOptions$effects === void 0 ? [] : _cldOptions$effects,
|
|
58
|
-
_cldOptions$removeBac = cldOptions.removeBackground,
|
|
59
|
-
removeBackground = _cldOptions$removeBac === void 0 ? false : _cldOptions$removeBac;
|
|
60
355
|
var cldImage = cld.image(src);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return cldImage.effect(effect);
|
|
356
|
+
transformationPlugins.forEach(function (plugin) {
|
|
357
|
+
plugin({
|
|
358
|
+
cldImage: cldImage,
|
|
359
|
+
options: options,
|
|
360
|
+
cldOptions: cldOptions
|
|
361
|
+
});
|
|
68
362
|
});
|
|
69
|
-
return cldImage.
|
|
363
|
+
return cldImage.format(format).delivery("q_" + quality).toURL();
|
|
70
364
|
}
|
|
71
365
|
|
|
366
|
+
var _excluded = ["crop", "gravity", "overlays", "removeBackground", "underlays"];
|
|
367
|
+
|
|
72
368
|
var CldImage = function CldImage(_ref) {
|
|
73
|
-
var
|
|
369
|
+
var crop = _ref.crop,
|
|
370
|
+
gravity = _ref.gravity,
|
|
371
|
+
overlays = _ref.overlays,
|
|
74
372
|
removeBackground = _ref.removeBackground,
|
|
373
|
+
underlays = _ref.underlays,
|
|
75
374
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
76
375
|
|
|
77
376
|
var cldOptions = {
|
|
78
|
-
|
|
79
|
-
|
|
377
|
+
crop: crop,
|
|
378
|
+
gravity: gravity,
|
|
379
|
+
overlays: overlays,
|
|
380
|
+
removeBackground: removeBackground,
|
|
381
|
+
underlays: underlays
|
|
80
382
|
};
|
|
81
|
-
|
|
383
|
+
var imageProps = {}; // If we see a placeholder option, configure a Cloudinary-based URL.
|
|
384
|
+
// The resulting image will always be blurred per Next.js, so we're
|
|
385
|
+
// limited on options for placeholders.
|
|
386
|
+
// https://nextjs.org/docs/api-reference/next/image#blurdataurl
|
|
387
|
+
|
|
388
|
+
if (props.placeholder) {
|
|
389
|
+
imageProps.blurDataURL = createPlaceholderUrl({
|
|
390
|
+
src: props.src,
|
|
391
|
+
placeholder: props.placeholder
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
if (props.placeholder !== 'blur') {
|
|
395
|
+
props.placeholder = 'blur';
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return /*#__PURE__*/jsxRuntime.jsx(Image__default["default"], _extends({}, imageProps, props, {
|
|
82
400
|
loader: function loader(options) {
|
|
83
|
-
return cloudinaryLoader(
|
|
401
|
+
return cloudinaryLoader(_extends({}, props, {
|
|
402
|
+
options: options
|
|
403
|
+
}), cldOptions);
|
|
84
404
|
}
|
|
85
405
|
}));
|
|
86
406
|
};
|
|
87
407
|
|
|
88
408
|
exports.CldImage = CldImage;
|
|
409
|
+
exports.cloudinaryLoader = cloudinaryLoader;
|
|
410
|
+
exports.position = position;
|
|
411
|
+
exports.primary = primary;
|
|
412
|
+
exports.text = text;
|
|
89
413
|
|
|
90
414
|
}));
|
|
91
415
|
//# sourceMappingURL=next-cloudinary.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-cloudinary.umd.js","sources":["../src/components/CldImage/CldImage.js"],"sourcesContent":["import { Cloudinary } from '@cloudinary/url-gen';\nimport Image from 'next/image';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n }\n});\n\nfunction cloudinaryLoader(options, cldOptions) {\n const {\n src,\n width,\n format = 'auto',\n quality = 'auto'\n } = options;\n\n const {\n effects = [],\n removeBackground = false\n } = cldOptions;\n\n const cldImage = cld.image(src);\n\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n\n effects.forEach(effect => cldImage.effect(effect));\n\n return cldImage.resize(`c_limit,w_${width}`).format(format).delivery(`q_${quality}`).toURL();\n}\n\nconst CldImage = ({ effects, removeBackground, ...props }) => {\n const cldOptions = {\n effects,\n removeBackground\n };\n return <Image {...props} loader={(options) => cloudinaryLoader(options, cldOptions)} />\n}\n\nexport default CldImage;"],"names":["cld","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","cloudinaryLoader","options","cldOptions","src","width","format","quality","effects","removeBackground","cldImage","image","effect","forEach","resize","delivery","toURL","CldImage","props","_jsx","Image"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA,IAAMA,GAAG,GAAG,IAAIC,iBAAJ,CAAe;EACzBC,EAAAA,KAAK,EAAE;EACLC,IAAAA,SAAS,EAAEC,OAAO,CAACC,GAAR,CAAYC,iCAAAA;EADlB,GAAA;EADkB,CAAf,CAAZ,CAAA;;EAMA,SAASC,gBAAT,CAA0BC,OAA1B,EAAmCC,UAAnC,EAA+C;EAC7C,EAAA,IACEC,GADF,GAKIF,OALJ,CACEE,GADF;EAAA,MAEEC,KAFF,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,CAACC,yBAAD,EAAA,QAAA,CAAA,EAAA,EAAWF,KAAX,EAAA;MAAkB,MAAM,EAAE,gBAAChB,OAAD,EAAA;EAAA,MAAA,OAAaD,gBAAgB,CAACC,OAAD,EAAUC,UAAV,CAA7B,CAAA;EAAA,KAAA;KAAjC,CAAA,CAAA,CAAA;EACD;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"next-cloudinary.umd.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/underlays.js","../src/loaders/cloudinary-loader.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}","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 { 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 // Background Removal must always come first\n removeBackgroundPlugin,\n\n croppingPlugin,\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}","import Image from 'next/image';\n\nimport { createPlaceholderUrl } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst CldImage = ({ crop, gravity, overlays, removeBackground, underlays, ...props }) => {\n const cldOptions = {\n crop,\n gravity,\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 imageProps.blurDataURL = createPlaceholderUrl({\n src: props.src,\n placeholder: props.placeholder\n });\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({ ...props, 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","underlaysPlugin","underlays","transformationPlugins","cloudinaryLoader","quality","plugin","CldImage","props","imageProps","blurDataURL","_jsx","Image"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA,IAAMA,KAAG,GAAG,IAAIC,iBA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KAAA;EACF,GAAA;;EAED,EAAA,oBACE2E,cAAC,CAAAC,yBAAD,EACMH,QAAAA,CAAAA,EAAAA,EAAAA,UADN,EAEMD,KAFN,EAAA;MAGE,MAAM,EAAE,gBAACzD,OAAD,EAAA;QAAA,OAAaqD,gBAAgB,cAAMI,KAAN,EAAA;EAAazD,QAAAA,OAAO,EAAPA,OAAAA;EAAb,OAAA,CAAA,EAAwBC,UAAxB,CAA7B,CAAA;EAAA,KAAA;KAJZ,CAAA,CAAA,CAAA;EAOD;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-cloudinary",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"main": "dist/next-cloudinary.umd.js",
|
|
5
5
|
"module": "dist/next-cloudinary.module.js",
|
|
6
6
|
"umd:main": "dist/next-cloudinary.umd.js",
|
|
7
7
|
"source": "src/index.js",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "microbundle --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react"
|
|
9
|
+
"build": "microbundle --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react",
|
|
10
|
+
"dev": "microbundle watch --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"@cloudinary/url-gen": "^1.8.5"
|