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
|
@@ -88,87 +88,6 @@ var croppingPlugin = {
|
|
|
88
88
|
plugin: plugin$7
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
const params = ['art', {
|
|
92
|
-
prop: 'autoBrightness',
|
|
93
|
-
effect: 'auto_brightness'
|
|
94
|
-
}, {
|
|
95
|
-
prop: 'autoColor',
|
|
96
|
-
effect: 'auto_color'
|
|
97
|
-
}, {
|
|
98
|
-
prop: 'autoContrast',
|
|
99
|
-
effect: 'auto_contrast'
|
|
100
|
-
}, {
|
|
101
|
-
prop: 'assistColorblind',
|
|
102
|
-
effect: 'assist_colorblind'
|
|
103
|
-
}, 'blackwhite', 'blur', {
|
|
104
|
-
prop: 'blurFaces',
|
|
105
|
-
effect: 'blur_faces'
|
|
106
|
-
}, {
|
|
107
|
-
prop: 'blurRegion',
|
|
108
|
-
effect: 'blur_region'
|
|
109
|
-
}, 'brightness', {
|
|
110
|
-
prop: 'brightnessHSB',
|
|
111
|
-
effect: 'brightness_hsb'
|
|
112
|
-
}, 'cartoonify', 'colorize', 'contrast', 'distort', {
|
|
113
|
-
prop: 'fillLight',
|
|
114
|
-
effect: 'fill_light'
|
|
115
|
-
}, 'gamma', {
|
|
116
|
-
prop: 'gradientFade',
|
|
117
|
-
effect: 'gradient_fade'
|
|
118
|
-
}, 'grayscale', 'improve', 'negate', {
|
|
119
|
-
prop: 'oilPaint',
|
|
120
|
-
effect: 'oil_paint'
|
|
121
|
-
}, 'outline', 'pixelate', {
|
|
122
|
-
prop: 'pixelateFaces',
|
|
123
|
-
effect: 'pixelate_faces'
|
|
124
|
-
}, {
|
|
125
|
-
prop: 'pixelateRegion',
|
|
126
|
-
effect: 'pixelate_region'
|
|
127
|
-
}, 'redeye', {
|
|
128
|
-
prop: 'replaceColor',
|
|
129
|
-
effect: 'replace_color'
|
|
130
|
-
}, 'saturation', 'sepia', 'shadow', 'sharpen', 'shear', {
|
|
131
|
-
prop: 'simulateColorblind',
|
|
132
|
-
effect: 'simulate_colorblind'
|
|
133
|
-
}, 'tint', {
|
|
134
|
-
prop: 'unsharpMask',
|
|
135
|
-
effect: 'unsharp_mask'
|
|
136
|
-
}, 'vectorize', 'vibrance', 'vignette'];
|
|
137
|
-
const props$6 = params.map(param => param.prop || param);
|
|
138
|
-
function plugin$6({
|
|
139
|
-
cldImage,
|
|
140
|
-
options
|
|
141
|
-
} = {}) {
|
|
142
|
-
params.forEach(key => {
|
|
143
|
-
const prop = key.prop || key;
|
|
144
|
-
const 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
91
|
// aspectRatio
|
|
173
92
|
|
|
174
93
|
const primary = {
|
|
@@ -236,6 +155,259 @@ const text = {
|
|
|
236
155
|
qualifier: false
|
|
237
156
|
}
|
|
238
157
|
};
|
|
158
|
+
const effects = {
|
|
159
|
+
art: {
|
|
160
|
+
prefix: 'e',
|
|
161
|
+
qualifier: 'art'
|
|
162
|
+
},
|
|
163
|
+
autoBrightness: {
|
|
164
|
+
prefix: 'e',
|
|
165
|
+
qualifier: 'auto_brightness'
|
|
166
|
+
},
|
|
167
|
+
autoColor: {
|
|
168
|
+
prefix: 'e',
|
|
169
|
+
qualifier: 'auto_color'
|
|
170
|
+
},
|
|
171
|
+
autoContrast: {
|
|
172
|
+
prefix: 'e',
|
|
173
|
+
qualifier: 'auto_contrast'
|
|
174
|
+
},
|
|
175
|
+
assistColorblind: {
|
|
176
|
+
prefix: 'e',
|
|
177
|
+
qualifier: 'assist_colorblind'
|
|
178
|
+
},
|
|
179
|
+
background: {
|
|
180
|
+
qualifier: 'b'
|
|
181
|
+
},
|
|
182
|
+
blackwhite: {
|
|
183
|
+
prefix: 'e',
|
|
184
|
+
qualifier: 'blackwhite'
|
|
185
|
+
},
|
|
186
|
+
blur: {
|
|
187
|
+
prefix: 'e',
|
|
188
|
+
qualifier: 'blur'
|
|
189
|
+
},
|
|
190
|
+
blurFaces: {
|
|
191
|
+
prefix: 'e',
|
|
192
|
+
qualifier: 'blur_faces'
|
|
193
|
+
},
|
|
194
|
+
blurRegion: {
|
|
195
|
+
prefix: 'e',
|
|
196
|
+
qualifier: 'blur_region'
|
|
197
|
+
},
|
|
198
|
+
border: {
|
|
199
|
+
qualifier: 'bo'
|
|
200
|
+
},
|
|
201
|
+
brightness: {
|
|
202
|
+
prefix: 'e',
|
|
203
|
+
qualifier: 'brightness'
|
|
204
|
+
},
|
|
205
|
+
brightnessHSB: {
|
|
206
|
+
prefix: 'e',
|
|
207
|
+
qualifier: 'brightness_hsb'
|
|
208
|
+
},
|
|
209
|
+
cartoonify: {
|
|
210
|
+
prefix: 'e',
|
|
211
|
+
qualifier: 'cartoonify'
|
|
212
|
+
},
|
|
213
|
+
color: {
|
|
214
|
+
qualifier: 'co'
|
|
215
|
+
},
|
|
216
|
+
colorize: {
|
|
217
|
+
prefix: 'e',
|
|
218
|
+
qualifier: 'colorize'
|
|
219
|
+
},
|
|
220
|
+
contrast: {
|
|
221
|
+
prefix: 'e',
|
|
222
|
+
qualifier: 'contrast'
|
|
223
|
+
},
|
|
224
|
+
distort: {
|
|
225
|
+
prefix: 'e',
|
|
226
|
+
qualifier: 'distort'
|
|
227
|
+
},
|
|
228
|
+
fillLight: {
|
|
229
|
+
prefix: 'e',
|
|
230
|
+
qualifier: 'fill_light'
|
|
231
|
+
},
|
|
232
|
+
gamma: {
|
|
233
|
+
prefix: 'e',
|
|
234
|
+
qualifier: 'gamma'
|
|
235
|
+
},
|
|
236
|
+
gradientFade: {
|
|
237
|
+
prefix: 'e',
|
|
238
|
+
qualifier: 'gradient_fade'
|
|
239
|
+
},
|
|
240
|
+
grayscale: {
|
|
241
|
+
prefix: 'e',
|
|
242
|
+
qualifier: 'grayscale'
|
|
243
|
+
},
|
|
244
|
+
improve: {
|
|
245
|
+
prefix: 'e',
|
|
246
|
+
qualifier: 'improve'
|
|
247
|
+
},
|
|
248
|
+
negate: {
|
|
249
|
+
prefix: 'e',
|
|
250
|
+
qualifier: 'negate'
|
|
251
|
+
},
|
|
252
|
+
oilPaint: {
|
|
253
|
+
prefix: 'e',
|
|
254
|
+
qualifier: 'oil_paint'
|
|
255
|
+
},
|
|
256
|
+
opacity: {
|
|
257
|
+
qualifier: 'o'
|
|
258
|
+
},
|
|
259
|
+
outline: {
|
|
260
|
+
prefix: 'e',
|
|
261
|
+
qualifier: 'outline'
|
|
262
|
+
},
|
|
263
|
+
pixelate: {
|
|
264
|
+
prefix: 'e',
|
|
265
|
+
qualifier: 'pixelate'
|
|
266
|
+
},
|
|
267
|
+
pixelateFaces: {
|
|
268
|
+
prefix: 'e',
|
|
269
|
+
qualifier: 'pixelate_faces'
|
|
270
|
+
},
|
|
271
|
+
pixelateRegion: {
|
|
272
|
+
prefix: 'e',
|
|
273
|
+
qualifier: 'pixelate_region'
|
|
274
|
+
},
|
|
275
|
+
redeye: {
|
|
276
|
+
prefix: 'e',
|
|
277
|
+
qualifier: 'redeye'
|
|
278
|
+
},
|
|
279
|
+
replaceColor: {
|
|
280
|
+
prefix: 'e',
|
|
281
|
+
qualifier: 'replace_color'
|
|
282
|
+
},
|
|
283
|
+
saturation: {
|
|
284
|
+
prefix: 'e',
|
|
285
|
+
qualifier: 'saturation'
|
|
286
|
+
},
|
|
287
|
+
sepia: {
|
|
288
|
+
prefix: 'e',
|
|
289
|
+
qualifier: 'sepia'
|
|
290
|
+
},
|
|
291
|
+
shadow: {
|
|
292
|
+
prefix: 'e',
|
|
293
|
+
qualifier: 'shadow'
|
|
294
|
+
},
|
|
295
|
+
sharpen: {
|
|
296
|
+
prefix: 'e',
|
|
297
|
+
qualifier: 'sharpen'
|
|
298
|
+
},
|
|
299
|
+
shear: {
|
|
300
|
+
prefix: 'e',
|
|
301
|
+
qualifier: 'shear'
|
|
302
|
+
},
|
|
303
|
+
simulateColorblind: {
|
|
304
|
+
prefix: 'e',
|
|
305
|
+
qualifier: 'simulate_colorblind'
|
|
306
|
+
},
|
|
307
|
+
tint: {
|
|
308
|
+
prefix: 'e',
|
|
309
|
+
qualifier: 'tint'
|
|
310
|
+
},
|
|
311
|
+
unsharpMask: {
|
|
312
|
+
prefix: 'e',
|
|
313
|
+
qualifier: 'unsharp_mask'
|
|
314
|
+
},
|
|
315
|
+
vectorize: {
|
|
316
|
+
prefix: 'e',
|
|
317
|
+
qualifier: 'vectorize'
|
|
318
|
+
},
|
|
319
|
+
vibrance: {
|
|
320
|
+
prefix: 'e',
|
|
321
|
+
qualifier: 'vibrance'
|
|
322
|
+
},
|
|
323
|
+
vignette: {
|
|
324
|
+
prefix: 'e',
|
|
325
|
+
qualifier: 'vignette'
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const props$6 = [...Object.keys(effects), 'effects'];
|
|
330
|
+
function plugin$6({
|
|
331
|
+
cldImage,
|
|
332
|
+
options
|
|
333
|
+
} = {}) {
|
|
334
|
+
// Handle any top-level effect props
|
|
335
|
+
|
|
336
|
+
constructTransformationString({
|
|
337
|
+
effects: effects,
|
|
338
|
+
options
|
|
339
|
+
}).filter(t => !!t).forEach(transformation => cldImage.effect(transformation));
|
|
340
|
+
|
|
341
|
+
// If we're passing in an effects prop explicitly, treat it as an array of
|
|
342
|
+
// effects that we need to process
|
|
343
|
+
|
|
344
|
+
if (Array.isArray(options.effects)) {
|
|
345
|
+
options.effects.forEach(effectsSet => {
|
|
346
|
+
const transformationString = constructTransformationString({
|
|
347
|
+
effects: effects,
|
|
348
|
+
options: effectsSet
|
|
349
|
+
}).filter(t => !!t).join(',');
|
|
350
|
+
cldImage.effect(transformationString);
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* constructEffect
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
function constructEffect({
|
|
359
|
+
effect,
|
|
360
|
+
value
|
|
361
|
+
}) {
|
|
362
|
+
const {
|
|
363
|
+
prefix,
|
|
364
|
+
qualifier
|
|
365
|
+
} = effect;
|
|
366
|
+
let transformation = '';
|
|
367
|
+
if (prefix) {
|
|
368
|
+
transformation = `${prefix}_`;
|
|
369
|
+
}
|
|
370
|
+
if (value === true) {
|
|
371
|
+
return `${transformation}${qualifier}`;
|
|
372
|
+
} else if (typeof value === 'string' || typeof value === 'number') {
|
|
373
|
+
if (prefix) {
|
|
374
|
+
return `${transformation}${qualifier}:${value}`;
|
|
375
|
+
} else {
|
|
376
|
+
return `${qualifier}_${value}`;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function constructTransformationString({
|
|
381
|
+
effects,
|
|
382
|
+
options
|
|
383
|
+
}) {
|
|
384
|
+
return Object.keys(effects).map(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
|
const _excluded$3 = ["publicId", "url", "position", "text", "effects"];
|
|
241
413
|
const props$5 = ['text', 'overlays'];
|
|
@@ -321,14 +493,36 @@ function plugin$5({
|
|
|
321
493
|
});
|
|
322
494
|
|
|
323
495
|
// Layer effects
|
|
496
|
+
// For layer effects we allow both the standard effects to be applied as well
|
|
497
|
+
// as the primary ones like width and height as those can be used to modify
|
|
498
|
+
// the layer after it's created
|
|
324
499
|
|
|
325
500
|
layerEffects.forEach(effect => {
|
|
326
501
|
Object.keys(effect).forEach(key => {
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
502
|
+
if (primary[key]) {
|
|
503
|
+
const {
|
|
504
|
+
qualifier
|
|
505
|
+
} = primary[key];
|
|
506
|
+
primary$1.push(`${qualifier}_${effect[key]}`);
|
|
507
|
+
} else if (effects[key]) {
|
|
508
|
+
const {
|
|
509
|
+
qualifier,
|
|
510
|
+
prefix
|
|
511
|
+
} = effects[key];
|
|
512
|
+
let transformation = '';
|
|
513
|
+
if (prefix) {
|
|
514
|
+
transformation = `${prefix}_`;
|
|
515
|
+
}
|
|
516
|
+
if (effect[key] === true) {
|
|
517
|
+
primary$1.push(`${transformation}${qualifier}`);
|
|
518
|
+
} else if (typeof effect[key] === 'string' || typeof effect[key] === 'number') {
|
|
519
|
+
if (prefix) {
|
|
520
|
+
primary$1.push(`${transformation}${qualifier}:${effect[key]}`);
|
|
521
|
+
} else {
|
|
522
|
+
primary$1.push(`${qualifier}_${effect[key]}`);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
332
526
|
});
|
|
333
527
|
});
|
|
334
528
|
|