next-cloudinary 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/next-cloudinary.js +279 -86
- package/dist/next-cloudinary.js.map +1 -1
- package/dist/next-cloudinary.modern.mjs +280 -86
- package/dist/next-cloudinary.modern.mjs.map +1 -1
- package/dist/next-cloudinary.module.js +279 -86
- package/dist/next-cloudinary.module.js.map +1 -1
- package/dist/next-cloudinary.umd.js +279 -86
- package/dist/next-cloudinary.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -86,89 +86,6 @@ var croppingPlugin = {
|
|
|
86
86
|
plugin: plugin$7
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
var params = ['art', {
|
|
90
|
-
prop: 'autoBrightness',
|
|
91
|
-
effect: 'auto_brightness'
|
|
92
|
-
}, {
|
|
93
|
-
prop: 'autoColor',
|
|
94
|
-
effect: 'auto_color'
|
|
95
|
-
}, {
|
|
96
|
-
prop: 'autoContrast',
|
|
97
|
-
effect: 'auto_contrast'
|
|
98
|
-
}, {
|
|
99
|
-
prop: 'assistColorblind',
|
|
100
|
-
effect: 'assist_colorblind'
|
|
101
|
-
}, 'blackwhite', 'blur', {
|
|
102
|
-
prop: 'blurFaces',
|
|
103
|
-
effect: 'blur_faces'
|
|
104
|
-
}, {
|
|
105
|
-
prop: 'blurRegion',
|
|
106
|
-
effect: 'blur_region'
|
|
107
|
-
}, 'brightness', {
|
|
108
|
-
prop: 'brightnessHSB',
|
|
109
|
-
effect: 'brightness_hsb'
|
|
110
|
-
}, 'cartoonify', 'colorize', 'contrast', 'distort', {
|
|
111
|
-
prop: 'fillLight',
|
|
112
|
-
effect: 'fill_light'
|
|
113
|
-
}, 'gamma', {
|
|
114
|
-
prop: 'gradientFade',
|
|
115
|
-
effect: 'gradient_fade'
|
|
116
|
-
}, 'grayscale', 'improve', 'negate', {
|
|
117
|
-
prop: 'oilPaint',
|
|
118
|
-
effect: 'oil_paint'
|
|
119
|
-
}, 'outline', 'pixelate', {
|
|
120
|
-
prop: 'pixelateFaces',
|
|
121
|
-
effect: 'pixelate_faces'
|
|
122
|
-
}, {
|
|
123
|
-
prop: 'pixelateRegion',
|
|
124
|
-
effect: 'pixelate_region'
|
|
125
|
-
}, 'redeye', {
|
|
126
|
-
prop: 'replaceColor',
|
|
127
|
-
effect: 'replace_color'
|
|
128
|
-
}, 'saturation', 'sepia', 'shadow', 'sharpen', 'shear', {
|
|
129
|
-
prop: 'simulateColorblind',
|
|
130
|
-
effect: 'simulate_colorblind'
|
|
131
|
-
}, 'tint', {
|
|
132
|
-
prop: 'unsharpMask',
|
|
133
|
-
effect: 'unsharp_mask'
|
|
134
|
-
}, 'vectorize', 'vibrance', 'vignette'];
|
|
135
|
-
var props$6 = params.map(function (param) {
|
|
136
|
-
return param.prop || param;
|
|
137
|
-
});
|
|
138
|
-
function plugin$6(_temp) {
|
|
139
|
-
var _ref = _temp === void 0 ? {} : _temp,
|
|
140
|
-
cldImage = _ref.cldImage,
|
|
141
|
-
options = _ref.options;
|
|
142
|
-
params.forEach(function (key) {
|
|
143
|
-
var prop = key.prop || key;
|
|
144
|
-
var effect = key.effect || key;
|
|
145
|
-
if (options[prop] === true) {
|
|
146
|
-
cldImage.effect("e_" + effect);
|
|
147
|
-
} else if (typeof options[prop] === 'string') {
|
|
148
|
-
cldImage.effect("e_" + effect + ":" + options[prop]);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
var effectsPlugin = {
|
|
154
|
-
__proto__: null,
|
|
155
|
-
props: props$6,
|
|
156
|
-
plugin: plugin$6
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* encodeBase64
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
function encodeBase64(value) {
|
|
164
|
-
if (typeof btoa === 'function') {
|
|
165
|
-
return btoa(value);
|
|
166
|
-
}
|
|
167
|
-
if (typeof Buffer !== 'undefined') {
|
|
168
|
-
return Buffer.from(value).toString('base64');
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
89
|
// aspectRatio
|
|
173
90
|
|
|
174
91
|
var primary = {
|
|
@@ -236,6 +153,261 @@ var text = {
|
|
|
236
153
|
qualifier: false
|
|
237
154
|
}
|
|
238
155
|
};
|
|
156
|
+
var effects = {
|
|
157
|
+
art: {
|
|
158
|
+
prefix: 'e',
|
|
159
|
+
qualifier: 'art'
|
|
160
|
+
},
|
|
161
|
+
autoBrightness: {
|
|
162
|
+
prefix: 'e',
|
|
163
|
+
qualifier: 'auto_brightness'
|
|
164
|
+
},
|
|
165
|
+
autoColor: {
|
|
166
|
+
prefix: 'e',
|
|
167
|
+
qualifier: 'auto_color'
|
|
168
|
+
},
|
|
169
|
+
autoContrast: {
|
|
170
|
+
prefix: 'e',
|
|
171
|
+
qualifier: 'auto_contrast'
|
|
172
|
+
},
|
|
173
|
+
assistColorblind: {
|
|
174
|
+
prefix: 'e',
|
|
175
|
+
qualifier: 'assist_colorblind'
|
|
176
|
+
},
|
|
177
|
+
background: {
|
|
178
|
+
qualifier: 'b'
|
|
179
|
+
},
|
|
180
|
+
blackwhite: {
|
|
181
|
+
prefix: 'e',
|
|
182
|
+
qualifier: 'blackwhite'
|
|
183
|
+
},
|
|
184
|
+
blur: {
|
|
185
|
+
prefix: 'e',
|
|
186
|
+
qualifier: 'blur'
|
|
187
|
+
},
|
|
188
|
+
blurFaces: {
|
|
189
|
+
prefix: 'e',
|
|
190
|
+
qualifier: 'blur_faces'
|
|
191
|
+
},
|
|
192
|
+
blurRegion: {
|
|
193
|
+
prefix: 'e',
|
|
194
|
+
qualifier: 'blur_region'
|
|
195
|
+
},
|
|
196
|
+
border: {
|
|
197
|
+
qualifier: 'bo'
|
|
198
|
+
},
|
|
199
|
+
brightness: {
|
|
200
|
+
prefix: 'e',
|
|
201
|
+
qualifier: 'brightness'
|
|
202
|
+
},
|
|
203
|
+
brightnessHSB: {
|
|
204
|
+
prefix: 'e',
|
|
205
|
+
qualifier: 'brightness_hsb'
|
|
206
|
+
},
|
|
207
|
+
cartoonify: {
|
|
208
|
+
prefix: 'e',
|
|
209
|
+
qualifier: 'cartoonify'
|
|
210
|
+
},
|
|
211
|
+
color: {
|
|
212
|
+
qualifier: 'co'
|
|
213
|
+
},
|
|
214
|
+
colorize: {
|
|
215
|
+
prefix: 'e',
|
|
216
|
+
qualifier: 'colorize'
|
|
217
|
+
},
|
|
218
|
+
contrast: {
|
|
219
|
+
prefix: 'e',
|
|
220
|
+
qualifier: 'contrast'
|
|
221
|
+
},
|
|
222
|
+
distort: {
|
|
223
|
+
prefix: 'e',
|
|
224
|
+
qualifier: 'distort'
|
|
225
|
+
},
|
|
226
|
+
fillLight: {
|
|
227
|
+
prefix: 'e',
|
|
228
|
+
qualifier: 'fill_light'
|
|
229
|
+
},
|
|
230
|
+
gamma: {
|
|
231
|
+
prefix: 'e',
|
|
232
|
+
qualifier: 'gamma'
|
|
233
|
+
},
|
|
234
|
+
gradientFade: {
|
|
235
|
+
prefix: 'e',
|
|
236
|
+
qualifier: 'gradient_fade'
|
|
237
|
+
},
|
|
238
|
+
grayscale: {
|
|
239
|
+
prefix: 'e',
|
|
240
|
+
qualifier: 'grayscale'
|
|
241
|
+
},
|
|
242
|
+
improve: {
|
|
243
|
+
prefix: 'e',
|
|
244
|
+
qualifier: 'improve'
|
|
245
|
+
},
|
|
246
|
+
negate: {
|
|
247
|
+
prefix: 'e',
|
|
248
|
+
qualifier: 'negate'
|
|
249
|
+
},
|
|
250
|
+
oilPaint: {
|
|
251
|
+
prefix: 'e',
|
|
252
|
+
qualifier: 'oil_paint'
|
|
253
|
+
},
|
|
254
|
+
opacity: {
|
|
255
|
+
qualifier: 'o'
|
|
256
|
+
},
|
|
257
|
+
outline: {
|
|
258
|
+
prefix: 'e',
|
|
259
|
+
qualifier: 'outline'
|
|
260
|
+
},
|
|
261
|
+
pixelate: {
|
|
262
|
+
prefix: 'e',
|
|
263
|
+
qualifier: 'pixelate'
|
|
264
|
+
},
|
|
265
|
+
pixelateFaces: {
|
|
266
|
+
prefix: 'e',
|
|
267
|
+
qualifier: 'pixelate_faces'
|
|
268
|
+
},
|
|
269
|
+
pixelateRegion: {
|
|
270
|
+
prefix: 'e',
|
|
271
|
+
qualifier: 'pixelate_region'
|
|
272
|
+
},
|
|
273
|
+
redeye: {
|
|
274
|
+
prefix: 'e',
|
|
275
|
+
qualifier: 'redeye'
|
|
276
|
+
},
|
|
277
|
+
replaceColor: {
|
|
278
|
+
prefix: 'e',
|
|
279
|
+
qualifier: 'replace_color'
|
|
280
|
+
},
|
|
281
|
+
saturation: {
|
|
282
|
+
prefix: 'e',
|
|
283
|
+
qualifier: 'saturation'
|
|
284
|
+
},
|
|
285
|
+
sepia: {
|
|
286
|
+
prefix: 'e',
|
|
287
|
+
qualifier: 'sepia'
|
|
288
|
+
},
|
|
289
|
+
shadow: {
|
|
290
|
+
prefix: 'e',
|
|
291
|
+
qualifier: 'shadow'
|
|
292
|
+
},
|
|
293
|
+
sharpen: {
|
|
294
|
+
prefix: 'e',
|
|
295
|
+
qualifier: 'sharpen'
|
|
296
|
+
},
|
|
297
|
+
shear: {
|
|
298
|
+
prefix: 'e',
|
|
299
|
+
qualifier: 'shear'
|
|
300
|
+
},
|
|
301
|
+
simulateColorblind: {
|
|
302
|
+
prefix: 'e',
|
|
303
|
+
qualifier: 'simulate_colorblind'
|
|
304
|
+
},
|
|
305
|
+
tint: {
|
|
306
|
+
prefix: 'e',
|
|
307
|
+
qualifier: 'tint'
|
|
308
|
+
},
|
|
309
|
+
unsharpMask: {
|
|
310
|
+
prefix: 'e',
|
|
311
|
+
qualifier: 'unsharp_mask'
|
|
312
|
+
},
|
|
313
|
+
vectorize: {
|
|
314
|
+
prefix: 'e',
|
|
315
|
+
qualifier: 'vectorize'
|
|
316
|
+
},
|
|
317
|
+
vibrance: {
|
|
318
|
+
prefix: 'e',
|
|
319
|
+
qualifier: 'vibrance'
|
|
320
|
+
},
|
|
321
|
+
vignette: {
|
|
322
|
+
prefix: 'e',
|
|
323
|
+
qualifier: 'vignette'
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
var props$6 = [].concat(Object.keys(effects), ['effects']);
|
|
328
|
+
function plugin$6(_temp) {
|
|
329
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
330
|
+
cldImage = _ref.cldImage,
|
|
331
|
+
options = _ref.options;
|
|
332
|
+
// Handle any top-level effect props
|
|
333
|
+
|
|
334
|
+
constructTransformationString({
|
|
335
|
+
effects: effects,
|
|
336
|
+
options: options
|
|
337
|
+
}).filter(function (t) {
|
|
338
|
+
return !!t;
|
|
339
|
+
}).forEach(function (transformation) {
|
|
340
|
+
return cldImage.effect(transformation);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// If we're passing in an effects prop explicitly, treat it as an array of
|
|
344
|
+
// effects that we need to process
|
|
345
|
+
|
|
346
|
+
if (Array.isArray(options.effects)) {
|
|
347
|
+
options.effects.forEach(function (effectsSet) {
|
|
348
|
+
var transformationString = constructTransformationString({
|
|
349
|
+
effects: effects,
|
|
350
|
+
options: effectsSet
|
|
351
|
+
}).filter(function (t) {
|
|
352
|
+
return !!t;
|
|
353
|
+
}).join(',');
|
|
354
|
+
cldImage.effect(transformationString);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* constructEffect
|
|
360
|
+
*/
|
|
361
|
+
|
|
362
|
+
function constructEffect(_ref2) {
|
|
363
|
+
var effect = _ref2.effect,
|
|
364
|
+
value = _ref2.value;
|
|
365
|
+
var prefix = effect.prefix,
|
|
366
|
+
qualifier = effect.qualifier;
|
|
367
|
+
var transformation = '';
|
|
368
|
+
if (prefix) {
|
|
369
|
+
transformation = prefix + "_";
|
|
370
|
+
}
|
|
371
|
+
if (value === true) {
|
|
372
|
+
return "" + transformation + qualifier;
|
|
373
|
+
} else if (typeof value === 'string' || typeof value === 'number') {
|
|
374
|
+
if (prefix) {
|
|
375
|
+
return "" + transformation + qualifier + ":" + value;
|
|
376
|
+
} else {
|
|
377
|
+
return qualifier + "_" + value;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function constructTransformationString(_ref3) {
|
|
382
|
+
var effects = _ref3.effects,
|
|
383
|
+
options = _ref3.options;
|
|
384
|
+
return Object.keys(effects).map(function (key) {
|
|
385
|
+
return constructEffect({
|
|
386
|
+
effect: effects[key],
|
|
387
|
+
value: options[key]
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
var effectsPlugin = {
|
|
394
|
+
__proto__: null,
|
|
395
|
+
props: props$6,
|
|
396
|
+
plugin: plugin$6
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* encodeBase64
|
|
401
|
+
*/
|
|
402
|
+
|
|
403
|
+
function encodeBase64(value) {
|
|
404
|
+
if (typeof btoa === 'function') {
|
|
405
|
+
return btoa(value);
|
|
406
|
+
}
|
|
407
|
+
if (typeof Buffer !== 'undefined') {
|
|
408
|
+
return Buffer.from(value).toString('base64');
|
|
409
|
+
}
|
|
410
|
+
}
|
|
239
411
|
|
|
240
412
|
var _excluded$3 = ["publicId", "url", "position", "text", "effects"];
|
|
241
413
|
var props$5 = ['text', 'overlays'];
|
|
@@ -317,12 +489,33 @@ function plugin$5(_temp) {
|
|
|
317
489
|
});
|
|
318
490
|
|
|
319
491
|
// Layer effects
|
|
492
|
+
// For layer effects we allow both the standard effects to be applied as well
|
|
493
|
+
// as the primary ones like width and height as those can be used to modify
|
|
494
|
+
// the layer after it's created
|
|
320
495
|
|
|
321
496
|
layerEffects.forEach(function (effect) {
|
|
322
497
|
Object.keys(effect).forEach(function (key) {
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
|
|
498
|
+
if (primary[key]) {
|
|
499
|
+
var qualifier = primary[key].qualifier;
|
|
500
|
+
primary$1.push(qualifier + "_" + effect[key]);
|
|
501
|
+
} else if (effects[key]) {
|
|
502
|
+
var _qualifiersEffects$ke = effects[key],
|
|
503
|
+
_qualifier = _qualifiersEffects$ke.qualifier,
|
|
504
|
+
prefix = _qualifiersEffects$ke.prefix;
|
|
505
|
+
var transformation = '';
|
|
506
|
+
if (prefix) {
|
|
507
|
+
transformation = prefix + "_";
|
|
508
|
+
}
|
|
509
|
+
if (effect[key] === true) {
|
|
510
|
+
primary$1.push("" + transformation + _qualifier);
|
|
511
|
+
} else if (typeof effect[key] === 'string' || typeof effect[key] === 'number') {
|
|
512
|
+
if (prefix) {
|
|
513
|
+
primary$1.push("" + transformation + _qualifier + ":" + effect[key]);
|
|
514
|
+
} else {
|
|
515
|
+
primary$1.push(_qualifier + "_" + effect[key]);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
326
519
|
});
|
|
327
520
|
});
|
|
328
521
|
|