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