next-cloudinary 1.4.0 → 1.5.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.
@@ -90,89 +90,6 @@
90
90
  plugin: plugin$7
91
91
  };
92
92
 
93
- var params = ['art', {
94
- prop: 'autoBrightness',
95
- effect: 'auto_brightness'
96
- }, {
97
- prop: 'autoColor',
98
- effect: 'auto_color'
99
- }, {
100
- prop: 'autoContrast',
101
- effect: 'auto_contrast'
102
- }, {
103
- prop: 'assistColorblind',
104
- effect: 'assist_colorblind'
105
- }, 'blackwhite', 'blur', {
106
- prop: 'blurFaces',
107
- effect: 'blur_faces'
108
- }, {
109
- prop: 'blurRegion',
110
- effect: 'blur_region'
111
- }, 'brightness', {
112
- prop: 'brightnessHSB',
113
- effect: 'brightness_hsb'
114
- }, 'cartoonify', 'colorize', 'contrast', 'distort', {
115
- prop: 'fillLight',
116
- effect: 'fill_light'
117
- }, 'gamma', {
118
- prop: 'gradientFade',
119
- effect: 'gradient_fade'
120
- }, 'grayscale', 'improve', 'negate', {
121
- prop: 'oilPaint',
122
- effect: 'oil_paint'
123
- }, 'outline', 'pixelate', {
124
- prop: 'pixelateFaces',
125
- effect: 'pixelate_faces'
126
- }, {
127
- prop: 'pixelateRegion',
128
- effect: 'pixelate_region'
129
- }, 'redeye', {
130
- prop: 'replaceColor',
131
- effect: 'replace_color'
132
- }, 'saturation', 'sepia', 'shadow', 'sharpen', 'shear', {
133
- prop: 'simulateColorblind',
134
- effect: 'simulate_colorblind'
135
- }, 'tint', {
136
- prop: 'unsharpMask',
137
- effect: 'unsharp_mask'
138
- }, 'vectorize', 'vibrance', 'vignette'];
139
- var props$6 = params.map(function (param) {
140
- return param.prop || param;
141
- });
142
- function plugin$6(_temp) {
143
- var _ref = _temp === void 0 ? {} : _temp,
144
- cldImage = _ref.cldImage,
145
- options = _ref.options;
146
- params.forEach(function (key) {
147
- var prop = key.prop || key;
148
- var effect = key.effect || key;
149
- if (options[prop] === true) {
150
- cldImage.effect("e_" + effect);
151
- } else if (typeof options[prop] === 'string') {
152
- cldImage.effect("e_" + effect + ":" + options[prop]);
153
- }
154
- });
155
- }
156
-
157
- var effectsPlugin = {
158
- __proto__: null,
159
- props: props$6,
160
- plugin: plugin$6
161
- };
162
-
163
- /**
164
- * encodeBase64
165
- */
166
-
167
- function encodeBase64(value) {
168
- if (typeof btoa === 'function') {
169
- return btoa(value);
170
- }
171
- if (typeof Buffer !== 'undefined') {
172
- return Buffer.from(value).toString('base64');
173
- }
174
- }
175
-
176
93
  // aspectRatio
177
94
 
178
95
  var primary = {
@@ -240,6 +157,211 @@
240
157
  qualifier: false
241
158
  }
242
159
  };
160
+ var effects = {
161
+ art: {
162
+ prefix: 'e',
163
+ qualifier: 'art'
164
+ },
165
+ autoBrightness: {
166
+ prefix: 'e',
167
+ qualifier: 'auto_brightness'
168
+ },
169
+ autoColor: {
170
+ prefix: 'e',
171
+ qualifier: 'auto_color'
172
+ },
173
+ autoContrast: {
174
+ prefix: 'e',
175
+ qualifier: 'auto_contrast'
176
+ },
177
+ assistColorblind: {
178
+ prefix: 'e',
179
+ qualifier: 'assist_colorblind'
180
+ },
181
+ blackwhite: {
182
+ prefix: 'e',
183
+ qualifier: 'blackwhite'
184
+ },
185
+ blur: {
186
+ prefix: 'e',
187
+ qualifier: 'blur'
188
+ },
189
+ blurFaces: {
190
+ prefix: 'e',
191
+ qualifier: 'blur_faces'
192
+ },
193
+ blurRegion: {
194
+ prefix: 'e',
195
+ qualifier: 'blur_region'
196
+ },
197
+ brightness: {
198
+ prefix: 'e',
199
+ qualifier: 'brightness'
200
+ },
201
+ brightnessHSB: {
202
+ prefix: 'e',
203
+ qualifier: 'brightness_hsb'
204
+ },
205
+ cartoonify: {
206
+ prefix: 'e',
207
+ qualifier: 'cartoonify'
208
+ },
209
+ colorize: {
210
+ prefix: 'e',
211
+ qualifier: 'colorize'
212
+ },
213
+ contrast: {
214
+ prefix: 'e',
215
+ qualifier: 'contrast'
216
+ },
217
+ distort: {
218
+ prefix: 'e',
219
+ qualifier: 'distort'
220
+ },
221
+ fillLight: {
222
+ prefix: 'e',
223
+ qualifier: 'fill_light'
224
+ },
225
+ gamma: {
226
+ prefix: 'e',
227
+ qualifier: 'gamma'
228
+ },
229
+ gradientFade: {
230
+ prefix: 'e',
231
+ qualifier: 'gradient_fade'
232
+ },
233
+ grayscale: {
234
+ prefix: 'e',
235
+ qualifier: 'grayscale'
236
+ },
237
+ improve: {
238
+ prefix: 'e',
239
+ qualifier: 'improve'
240
+ },
241
+ negate: {
242
+ prefix: 'e',
243
+ qualifier: 'negate'
244
+ },
245
+ oilPaint: {
246
+ prefix: 'e',
247
+ qualifier: 'oil_paint'
248
+ },
249
+ opacity: {
250
+ qualifier: 'o'
251
+ },
252
+ outline: {
253
+ prefix: 'e',
254
+ qualifier: 'outline'
255
+ },
256
+ pixelate: {
257
+ prefix: 'e',
258
+ qualifier: 'pixelate'
259
+ },
260
+ pixelateFaces: {
261
+ prefix: 'e',
262
+ qualifier: 'pixelate_faces'
263
+ },
264
+ pixelateRegion: {
265
+ prefix: 'e',
266
+ qualifier: 'pixelate_region'
267
+ },
268
+ redeye: {
269
+ prefix: 'e',
270
+ qualifier: 'redeye'
271
+ },
272
+ replaceColor: {
273
+ prefix: 'e',
274
+ qualifier: 'replace_color'
275
+ },
276
+ saturation: {
277
+ prefix: 'e',
278
+ qualifier: 'saturation'
279
+ },
280
+ sepia: {
281
+ prefix: 'e',
282
+ qualifier: 'sepia'
283
+ },
284
+ shadow: {
285
+ prefix: 'e',
286
+ qualifier: 'shadow'
287
+ },
288
+ sharpen: {
289
+ prefix: 'e',
290
+ qualifier: 'sharpen'
291
+ },
292
+ shear: {
293
+ prefix: 'e',
294
+ qualifier: 'shear'
295
+ },
296
+ simulateColorblind: {
297
+ prefix: 'e',
298
+ qualifier: 'simulate_colorblind'
299
+ },
300
+ tint: {
301
+ prefix: 'e',
302
+ qualifier: 'tint'
303
+ },
304
+ unsharpMask: {
305
+ prefix: 'e',
306
+ qualifier: 'unsharp_mask'
307
+ },
308
+ vectorize: {
309
+ prefix: 'e',
310
+ qualifier: 'vectorize'
311
+ },
312
+ vibrance: {
313
+ prefix: 'e',
314
+ qualifier: 'vibrance'
315
+ },
316
+ vignette: {
317
+ prefix: 'e',
318
+ qualifier: 'vignette'
319
+ }
320
+ };
321
+
322
+ var props$6 = Object.keys(effects);
323
+ function plugin$6(_temp) {
324
+ var _ref = _temp === void 0 ? {} : _temp,
325
+ cldImage = _ref.cldImage,
326
+ options = _ref.options;
327
+ Object.keys(effects).forEach(function (key) {
328
+ var _effects$key = effects[key],
329
+ prefix = _effects$key.prefix,
330
+ qualifier = _effects$key.qualifier;
331
+ var transformation = '';
332
+ if (prefix) {
333
+ transformation = prefix + "_";
334
+ }
335
+ if (options[key] === true) {
336
+ cldImage.effect("" + transformation + qualifier);
337
+ } else if (typeof options[key] === 'string') {
338
+ if (prefix) {
339
+ cldImage.effect("" + transformation + qualifier + ":" + options[key]);
340
+ } else {
341
+ cldImage.effect(qualifier + "_" + options[key]);
342
+ }
343
+ }
344
+ });
345
+ }
346
+
347
+ var effectsPlugin = {
348
+ __proto__: null,
349
+ props: props$6,
350
+ plugin: plugin$6
351
+ };
352
+
353
+ /**
354
+ * encodeBase64
355
+ */
356
+
357
+ function encodeBase64(value) {
358
+ if (typeof btoa === 'function') {
359
+ return btoa(value);
360
+ }
361
+ if (typeof Buffer !== 'undefined') {
362
+ return Buffer.from(value).toString('base64');
363
+ }
364
+ }
243
365
 
244
366
  var _excluded$3 = ["publicId", "url", "position", "text", "effects"];
245
367
  var props$5 = ['text', 'overlays'];
@@ -321,12 +443,33 @@
321
443
  });
322
444
 
323
445
  // Layer effects
446
+ // For layer effects we allow both the standard effects to be applied as well
447
+ // as the primary ones like width and height as those can be used to modify
448
+ // the layer after it's created
324
449
 
325
450
  layerEffects.forEach(function (effect) {
326
451
  Object.keys(effect).forEach(function (key) {
327
- if (!primary[key]) return;
328
- var qualifier = primary[key].qualifier;
329
- primary$1.push(qualifier + "_" + effect[key]);
452
+ if (primary[key]) {
453
+ var qualifier = primary[key].qualifier;
454
+ primary$1.push(qualifier + "_" + effect[key]);
455
+ } else if (effects[key]) {
456
+ var _qualifiersEffects$ke = effects[key],
457
+ _qualifier = _qualifiersEffects$ke.qualifier,
458
+ prefix = _qualifiersEffects$ke.prefix;
459
+ var transformation = '';
460
+ if (prefix) {
461
+ transformation = prefix + "_";
462
+ }
463
+ if (effect[key] === true) {
464
+ primary$1.push("" + transformation + _qualifier);
465
+ } else if (typeof effect[key] === 'string' || typeof effect[key] === 'number') {
466
+ if (prefix) {
467
+ primary$1.push("" + transformation + _qualifier + ":" + effect[key]);
468
+ } else {
469
+ primary$1.push(_qualifier + "_" + effect[key]);
470
+ }
471
+ }
472
+ }
330
473
  });
331
474
  });
332
475