next-cloudinary 5.18.0 → 5.20.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 +25 -24
- package/dist/index.d.mts +242 -19
- package/dist/index.d.ts +242 -19
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _cloudinary_url_gen_config_interfaces_Config_ICloudinaryConfigurations from '@cloudinary/url-gen/config/interfaces/Config/ICloudinaryConfigurations';
|
|
1
2
|
import React, { MutableRefObject } from 'react';
|
|
2
3
|
import { ImageProps } from 'next/image';
|
|
3
4
|
import { ImageOptions, ConfigOptions, AnalyticsOptions, VideoOptions } from '@cloudinary-util/url-loader';
|
|
@@ -8,8 +9,238 @@ type CldImageProps = Omit<ImageProps, 'src'> & ImageOptions & {
|
|
|
8
9
|
src: string;
|
|
9
10
|
unoptimized?: boolean;
|
|
10
11
|
};
|
|
11
|
-
declare const CldImage: React.ForwardRefExoticComponent<Omit<ImageProps, "src"> &
|
|
12
|
-
|
|
12
|
+
declare const CldImage: React.ForwardRefExoticComponent<Omit<ImageProps, "src"> & {
|
|
13
|
+
src: string;
|
|
14
|
+
crop?: "fill" | "lfill" | "fill_pad" | "crop" | "thumb" | "scale" | "fit" | "limit" | "mfit" | "pad" | "lpad" | "mpad" | "imagga_scale" | "imagga_crop" | undefined;
|
|
15
|
+
sanitize?: boolean | undefined;
|
|
16
|
+
assetType?: string | undefined;
|
|
17
|
+
deliveryType?: string | undefined;
|
|
18
|
+
dpr?: string | number | undefined;
|
|
19
|
+
format?: string | undefined;
|
|
20
|
+
height?: string | number | undefined;
|
|
21
|
+
quality?: string | number | undefined;
|
|
22
|
+
strictTransformations?: boolean | undefined;
|
|
23
|
+
width?: string | number | undefined;
|
|
24
|
+
art?: any;
|
|
25
|
+
autoBrightness?: any;
|
|
26
|
+
autoColor?: any;
|
|
27
|
+
autoContrast?: any;
|
|
28
|
+
assistColorblind?: any;
|
|
29
|
+
background?: any;
|
|
30
|
+
blackwhite?: any;
|
|
31
|
+
blur?: any;
|
|
32
|
+
blurFaces?: any;
|
|
33
|
+
blurRegion?: any;
|
|
34
|
+
border?: any;
|
|
35
|
+
brightness?: any;
|
|
36
|
+
brightnessHSB?: any;
|
|
37
|
+
cartoonify?: any;
|
|
38
|
+
color?: any;
|
|
39
|
+
colorize?: any;
|
|
40
|
+
contrast?: any;
|
|
41
|
+
distort?: any;
|
|
42
|
+
fillLight?: any;
|
|
43
|
+
gamma?: any;
|
|
44
|
+
gradientFade?: any;
|
|
45
|
+
grayscale?: any;
|
|
46
|
+
improve?: any;
|
|
47
|
+
multiply?: any;
|
|
48
|
+
negate?: any;
|
|
49
|
+
oilPaint?: any;
|
|
50
|
+
opacity?: any;
|
|
51
|
+
outline?: any;
|
|
52
|
+
pixelate?: any;
|
|
53
|
+
pixelateFaces?: any;
|
|
54
|
+
pixelateRegion?: any;
|
|
55
|
+
radius?: any;
|
|
56
|
+
redeye?: any;
|
|
57
|
+
replaceColor?: any;
|
|
58
|
+
saturation?: any;
|
|
59
|
+
screen?: any;
|
|
60
|
+
sepia?: any;
|
|
61
|
+
shadow?: any;
|
|
62
|
+
sharpen?: any;
|
|
63
|
+
shear?: any;
|
|
64
|
+
simulateColorblind?: any;
|
|
65
|
+
tint?: any;
|
|
66
|
+
trim?: any;
|
|
67
|
+
unsharpMask?: any;
|
|
68
|
+
vectorize?: any;
|
|
69
|
+
vibrance?: any;
|
|
70
|
+
vignette?: any;
|
|
71
|
+
effects?: {
|
|
72
|
+
art?: any;
|
|
73
|
+
autoBrightness?: any;
|
|
74
|
+
autoColor?: any;
|
|
75
|
+
autoContrast?: any;
|
|
76
|
+
assistColorblind?: any;
|
|
77
|
+
background?: any;
|
|
78
|
+
blackwhite?: any;
|
|
79
|
+
blur?: any;
|
|
80
|
+
blurFaces?: any;
|
|
81
|
+
blurRegion?: any;
|
|
82
|
+
border?: any;
|
|
83
|
+
brightness?: any;
|
|
84
|
+
brightnessHSB?: any;
|
|
85
|
+
cartoonify?: any;
|
|
86
|
+
color?: any;
|
|
87
|
+
colorize?: any;
|
|
88
|
+
contrast?: any;
|
|
89
|
+
distort?: any;
|
|
90
|
+
fillLight?: any;
|
|
91
|
+
gamma?: any;
|
|
92
|
+
gradientFade?: any;
|
|
93
|
+
grayscale?: any;
|
|
94
|
+
improve?: any;
|
|
95
|
+
multiply?: any;
|
|
96
|
+
negate?: any;
|
|
97
|
+
oilPaint?: any;
|
|
98
|
+
opacity?: any;
|
|
99
|
+
outline?: any;
|
|
100
|
+
pixelate?: any;
|
|
101
|
+
pixelateFaces?: any;
|
|
102
|
+
pixelateRegion?: any;
|
|
103
|
+
radius?: any;
|
|
104
|
+
redeye?: any;
|
|
105
|
+
replaceColor?: any;
|
|
106
|
+
saturation?: any;
|
|
107
|
+
screen?: any;
|
|
108
|
+
sepia?: any;
|
|
109
|
+
shadow?: any;
|
|
110
|
+
sharpen?: any;
|
|
111
|
+
shear?: any;
|
|
112
|
+
simulateColorblind?: any;
|
|
113
|
+
tint?: any;
|
|
114
|
+
trim?: any;
|
|
115
|
+
unsharpMask?: any;
|
|
116
|
+
vectorize?: any;
|
|
117
|
+
vibrance?: any;
|
|
118
|
+
vignette?: any;
|
|
119
|
+
}[] | undefined;
|
|
120
|
+
flags?: "splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform" | ("splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform")[] | undefined;
|
|
121
|
+
gravity?: string | undefined;
|
|
122
|
+
text?: string | undefined;
|
|
123
|
+
version?: string | number | undefined;
|
|
124
|
+
underlay?: string | undefined;
|
|
125
|
+
underlays?: {
|
|
126
|
+
appliedEffects?: {}[] | undefined;
|
|
127
|
+
appliedFlags?: "splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform" | ("splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform")[] | undefined;
|
|
128
|
+
effects?: {}[] | undefined;
|
|
129
|
+
crop?: "fill" | "lfill" | "fill_pad" | "crop" | "thumb" | "scale" | "fit" | "limit" | "mfit" | "pad" | "lpad" | "mpad" | "imagga_scale" | "imagga_crop" | undefined;
|
|
130
|
+
flags?: "splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform" | ("splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform")[] | undefined;
|
|
131
|
+
height?: string | number | undefined;
|
|
132
|
+
position?: {
|
|
133
|
+
angle?: string | number | undefined;
|
|
134
|
+
gravity?: string | undefined;
|
|
135
|
+
x?: string | number | undefined;
|
|
136
|
+
y?: string | number | undefined;
|
|
137
|
+
} | undefined;
|
|
138
|
+
publicId?: string | undefined;
|
|
139
|
+
type?: string | undefined;
|
|
140
|
+
url?: string | undefined;
|
|
141
|
+
width?: string | number | undefined;
|
|
142
|
+
}[] | undefined;
|
|
143
|
+
seoSuffix?: string | undefined;
|
|
144
|
+
removeBackground?: boolean | undefined;
|
|
145
|
+
rawTransformations?: string | string[] | undefined;
|
|
146
|
+
overlay?: {
|
|
147
|
+
appliedEffects?: {}[] | undefined;
|
|
148
|
+
appliedFlags?: "splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform" | ("splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform")[] | undefined;
|
|
149
|
+
effects?: {}[] | undefined;
|
|
150
|
+
crop?: "fill" | "lfill" | "fill_pad" | "crop" | "thumb" | "scale" | "fit" | "limit" | "mfit" | "pad" | "lpad" | "mpad" | "imagga_scale" | "imagga_crop" | undefined;
|
|
151
|
+
flags?: "splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform" | ("splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform")[] | undefined;
|
|
152
|
+
height?: string | number | undefined;
|
|
153
|
+
position?: {
|
|
154
|
+
angle?: string | number | undefined;
|
|
155
|
+
gravity?: string | undefined;
|
|
156
|
+
x?: string | number | undefined;
|
|
157
|
+
y?: string | number | undefined;
|
|
158
|
+
} | undefined;
|
|
159
|
+
publicId?: string | undefined;
|
|
160
|
+
text?: string | {
|
|
161
|
+
text: string;
|
|
162
|
+
alignment?: string | undefined;
|
|
163
|
+
antialias?: string | undefined;
|
|
164
|
+
border?: string | undefined;
|
|
165
|
+
color?: string | undefined;
|
|
166
|
+
fontFamily?: string | undefined;
|
|
167
|
+
fontSize?: number | undefined;
|
|
168
|
+
fontStyle?: string | number | undefined;
|
|
169
|
+
fontWeight?: string | undefined;
|
|
170
|
+
hinting?: string | number | undefined;
|
|
171
|
+
letterSpacing?: string | number | undefined;
|
|
172
|
+
lineSpacing?: string | number | undefined;
|
|
173
|
+
stroke?: string | undefined;
|
|
174
|
+
} | undefined;
|
|
175
|
+
url?: string | undefined;
|
|
176
|
+
width?: string | number | undefined;
|
|
177
|
+
} | undefined;
|
|
178
|
+
overlays?: {
|
|
179
|
+
appliedEffects?: {}[] | undefined;
|
|
180
|
+
appliedFlags?: "splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform" | ("splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform")[] | undefined;
|
|
181
|
+
effects?: {}[] | undefined;
|
|
182
|
+
crop?: "fill" | "lfill" | "fill_pad" | "crop" | "thumb" | "scale" | "fit" | "limit" | "mfit" | "pad" | "lpad" | "mpad" | "imagga_scale" | "imagga_crop" | undefined;
|
|
183
|
+
flags?: "splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform" | ("splice" | "animated" | "any_format" | "apng" | "attachment" | "awebp" | "clip" | "clip_evenodd" | "cutter" | "force_icc" | "force_strip" | "getinfo" | "group4" | "hlsv3" | "ignore_aspect_ratio" | "ignore_mask_channels" | "immutable_cache" | "keep_attribution" | "keep_dar" | "keep_iptc" | "layer_apply" | "lossy" | "mono" | "no_overflow" | "no_stream" | "png8_fl_png24_fl_png32" | "preserve_transparency" | "progressive" | "rasterize" | "region_relative" | "relative" | "replace_image" | "sanitize" | "streaming_attachment" | "strip_profile" | "text_disallow_overflow" | "text_no_trim" | "tiff8_lzw" | "tiled" | "truncate_ts" | "waveform")[] | undefined;
|
|
184
|
+
height?: string | number | undefined;
|
|
185
|
+
position?: {
|
|
186
|
+
angle?: string | number | undefined;
|
|
187
|
+
gravity?: string | undefined;
|
|
188
|
+
x?: string | number | undefined;
|
|
189
|
+
y?: string | number | undefined;
|
|
190
|
+
} | undefined;
|
|
191
|
+
publicId?: string | undefined;
|
|
192
|
+
text?: string | {
|
|
193
|
+
text: string;
|
|
194
|
+
alignment?: string | undefined;
|
|
195
|
+
antialias?: string | undefined;
|
|
196
|
+
border?: string | undefined;
|
|
197
|
+
color?: string | undefined;
|
|
198
|
+
fontFamily?: string | undefined;
|
|
199
|
+
fontSize?: number | undefined;
|
|
200
|
+
fontStyle?: string | number | undefined;
|
|
201
|
+
fontWeight?: string | undefined;
|
|
202
|
+
hinting?: string | number | undefined;
|
|
203
|
+
letterSpacing?: string | number | undefined;
|
|
204
|
+
lineSpacing?: string | number | undefined;
|
|
205
|
+
stroke?: string | undefined;
|
|
206
|
+
} | undefined;
|
|
207
|
+
url?: string | undefined;
|
|
208
|
+
width?: string | number | undefined;
|
|
209
|
+
}[] | undefined;
|
|
210
|
+
namedTransformations?: string | string[] | undefined;
|
|
211
|
+
transformations?: string | string[] | undefined;
|
|
212
|
+
aspectRatio?: string | number | undefined;
|
|
213
|
+
widthResize?: string | number | undefined;
|
|
214
|
+
zoom?: string | undefined;
|
|
215
|
+
zoompan?: string | boolean | {
|
|
216
|
+
options: string;
|
|
217
|
+
loop: string | boolean;
|
|
218
|
+
} | undefined;
|
|
219
|
+
restore?: boolean | undefined;
|
|
220
|
+
replace?: string[] | boolean[] | {
|
|
221
|
+
to: string;
|
|
222
|
+
from: string;
|
|
223
|
+
preserveGeometry?: boolean | undefined;
|
|
224
|
+
} | undefined;
|
|
225
|
+
remove?: string | string[] | {
|
|
226
|
+
prompt?: string | string[] | undefined;
|
|
227
|
+
region?: number[] | number[][] | undefined;
|
|
228
|
+
multiple?: boolean | undefined;
|
|
229
|
+
removeShadow?: boolean | undefined;
|
|
230
|
+
} | undefined;
|
|
231
|
+
recolor?: string | string[] | {
|
|
232
|
+
prompt?: string | string[] | undefined;
|
|
233
|
+
to?: string | undefined;
|
|
234
|
+
multiple?: boolean | undefined;
|
|
235
|
+
} | undefined;
|
|
236
|
+
fillBackground?: boolean | {
|
|
237
|
+
crop?: "fill" | "lfill" | "fill_pad" | "crop" | "thumb" | "scale" | "fit" | "limit" | "mfit" | "pad" | "lpad" | "mpad" | "imagga_scale" | "imagga_crop" | undefined;
|
|
238
|
+
gravity?: string | undefined;
|
|
239
|
+
prompt?: string | undefined;
|
|
240
|
+
} | undefined;
|
|
241
|
+
defaultImage?: string | undefined;
|
|
242
|
+
} & {
|
|
243
|
+
config?: _cloudinary_url_gen_config_interfaces_Config_ICloudinaryConfigurations.default | undefined;
|
|
13
244
|
preserveTransformations?: boolean | undefined;
|
|
14
245
|
src: string;
|
|
15
246
|
unoptimized?: boolean | undefined;
|
|
@@ -285,12 +516,9 @@ interface CloudinaryVideoPlayerOptionPosterOptions {
|
|
|
285
516
|
/**
|
|
286
517
|
* getCldImageUrl
|
|
287
518
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
interface GetCldImageUrlAnalytics extends AnalyticsOptions {
|
|
293
|
-
}
|
|
519
|
+
type GetCldImageUrlOptions = ImageOptions;
|
|
520
|
+
type GetCldImageUrlConfig = ConfigOptions;
|
|
521
|
+
type GetCldImageUrlAnalytics = AnalyticsOptions;
|
|
294
522
|
interface GetCldImageUrl {
|
|
295
523
|
options: GetCldImageUrlOptions;
|
|
296
524
|
config?: GetCldImageUrlConfig;
|
|
@@ -301,12 +529,9 @@ declare function getCldImageUrl(options: GetCldImageUrlOptions, config?: GetCldI
|
|
|
301
529
|
/**
|
|
302
530
|
* getCldVideoUrl
|
|
303
531
|
*/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
interface GetCldVideoUrlAnalytics extends AnalyticsOptions {
|
|
309
|
-
}
|
|
532
|
+
type GetCldVideoUrlOptions = VideoOptions;
|
|
533
|
+
type GetCldVideoUrlConfig = ConfigOptions;
|
|
534
|
+
type GetCldVideoUrlAnalytics = AnalyticsOptions;
|
|
310
535
|
declare function getCldVideoUrl(options: GetCldVideoUrlOptions, config?: GetCldVideoUrlConfig, analytics?: GetCldVideoUrlAnalytics): string;
|
|
311
536
|
|
|
312
537
|
type CldVideoPlayerProps = Omit<CloudinaryVideoPlayerOptions, "cloud_name" | "autoplayMode" | "publicId" | "secure" | "showLogo" | "logoImageUrl" | "logoOnclickUrl"> & {
|
|
@@ -355,10 +580,8 @@ declare function cloudinaryLoader({ loaderOptions, imageProps, cldOptions, cldCo
|
|
|
355
580
|
/**
|
|
356
581
|
* getCldImageUrl
|
|
357
582
|
*/
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
interface GetCldOgImageUrlOptions extends GetCldImageUrlOptions {
|
|
361
|
-
}
|
|
583
|
+
type GetCldOgImageUrl = GetCldImageUrl;
|
|
584
|
+
type GetCldOgImageUrlOptions = GetCldImageUrlOptions;
|
|
362
585
|
declare function getCldOgImageUrl(options: GetCldOgImageUrlOptions): string;
|
|
363
586
|
|
|
364
|
-
export { CldImage, CldImageProps, CldOgImage, CldOgImageProps, CldUploadButton, CldUploadButtonProps, CldUploadWidget, CldUploadWidgetProps, CldUploadWidgetPropsChildren, CldUploadWidgetPropsOptions, CldUploadWidgetResults, CldVideoPlayer, CldVideoPlayerProps, CldVideoPlayerPropsColors, CldVideoPlayerPropsLogo, CloudinaryLoader, CloudinaryLoaderCldOptions, CloudinaryLoaderLoaderOptions, CloudinaryVideoPlayer, CloudinaryVideoPlayerOptions, CloudinaryVideoPlayerOptionsColors, CloudinaryVideoPlayerOptionsLogo, GetCldImageUrl, GetCldImageUrlAnalytics, GetCldImageUrlConfig, GetCldImageUrlOptions, GetCldOgImageUrl, GetCldOgImageUrlOptions, GetCldVideoUrlAnalytics, GetCldVideoUrlConfig, GetCldVideoUrlOptions, cloudinaryLoader, getCldImageUrl, getCldOgImageUrl, getCldVideoUrl };
|
|
587
|
+
export { CldImage, CldImageProps, CldOgImage, CldOgImageProps, CldUploadButton, CldUploadButtonProps, CldUploadWidget, CldUploadWidgetInfo, CldUploadWidgetProps, CldUploadWidgetPropsChildren, CldUploadWidgetPropsOptions, CldUploadWidgetResults, CldVideoPlayer, CldVideoPlayerProps, CldVideoPlayerPropsColors, CldVideoPlayerPropsLogo, CloudinaryLoader, CloudinaryLoaderCldOptions, CloudinaryLoaderLoaderOptions, CloudinaryVideoPlayer, CloudinaryVideoPlayerOptions, CloudinaryVideoPlayerOptionsColors, CloudinaryVideoPlayerOptionsLogo, GetCldImageUrl, GetCldImageUrlAnalytics, GetCldImageUrlConfig, GetCldImageUrlOptions, GetCldOgImageUrl, GetCldOgImageUrlOptions, GetCldVideoUrlAnalytics, GetCldVideoUrlConfig, GetCldVideoUrlOptions, cloudinaryLoader, getCldImageUrl, getCldOgImageUrl, getCldVideoUrl };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var We=Object.create;var K=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty;var ke=(e,t)=>{for(var d in t)K(e,d,{get:t[d],enumerable:!0})},ye=(e,t,d,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ge(t))!Se.call(e,o)&&o!==d&&K(e,o,{get:()=>t[o],enumerable:!(n=Ve(t,o))||n.enumerable});return e};var P=(e,t,d)=>(d=e!=null?We(De(e)):{},ye(t||!e||!e.__esModule?K(d,"default",{value:e,enumerable:!0}):d,e)),je=e=>ye(K({},"__esModule",{value:!0}),e);var Ke={};ke(Ke,{CldImage:()=>ae,CldOgImage:()=>se,CldUploadButton:()=>ce,CldUploadWidget:()=>B,CldVideoPlayer:()=>pe,cloudinaryLoader:()=>te,getCldImageUrl:()=>I,getCldOgImageUrl:()=>Ae,getCldVideoUrl:()=>oe});module.exports=je(Ke);var A=P(require("react")),Ue=P(require("next/image")),Oe=require("@cloudinary-util/util"),Ee=require("@cloudinary-util/url-loader");async function Q(e){let{src:t}=e;try{await new Promise((d,n)=>{fetch(t).then(o=>{if(!o.ok){n(o);return}d(o)})})}catch(d){return d.status===423?await Q(e):!1}return!0}function T(e){if(!e)throw new Error("A Cloudinary Cloud name is required, please make sure NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME is set and configured in your environment.")}var Ie=require("@cloudinary-util/url-loader");var he=P(require("next/package.json"));var Ce={name:"next-cloudinary",version:"5.18.0",license:"MIT",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",source:"src/index.ts",scripts:{build:"tsup",dev:"tsup --watch",prepublishOnly:"cp ../README.md . && cp ../LICENSE . && yarn build",postpublish:"rm ./README.md && rm ./LICENSE",test:"jest","test:app":'NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="test" yarn build && cd tests/nextjs-app && yarn build'},dependencies:{"@cloudinary-util/url-loader":"^3.22.0","@cloudinary-util/util":"^2.3.0"},devDependencies:{"@babel/core":"^7.23.2","@babel/preset-env":"^7.23.2","@types/jest":"^29.5.6","@types/react":"^18.2.33","@types/react-dom":"^18.2.14","babel-jest":"^29.7.0",dotenv:"^16.3.1",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0",mkdirp:"^3.0.1","ts-jest":"^29.1.1",tsup:"^7.2.0",typescript:"^5.2.2"},peerDependencies:{next:"^12 || ^13 || ^14",react:"^17 || ^18"}};var J="V",Z=Ce.version,ee=he.default.version;function I(e,t,d){var o,r;let n=(r=(o=t==null?void 0:t.cloud)==null?void 0:o.cloudName)!=null?r:process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME;return T(n),(0,Ie.constructCloudinaryUrl)({options:e,config:Object.assign({cloud:{cloudName:n}},t),analytics:Object.assign({sdkCode:J,sdkSemver:Z,techVersion:ee,feature:""},d)})}function te({loaderOptions:e,imageProps:t,cldOptions:d,cldConfig:n={}}){let o={...t,...d};o.width=typeof o.width=="string"?parseInt(o.width):o.width,o.height=typeof o.height=="string"?parseInt(o.height):o.height;let r;return typeof(e==null?void 0:e.width)=="number"&&typeof o.width=="number"&&e.width!==o.width?r=e.width:typeof(e==null?void 0:e.width)=="number"&&typeof(o==null?void 0:o.width)!="number"&&(r=e.width,o.width=r),o.width&&r&&r<o.width&&(o.widthResize=e.width),I(o,n)}var Fe=(0,A.forwardRef)(function(t,d){let n=!1,o=["deliveryType","preserveTransformations","strictTransformations","assetType"];Ee.transformationPlugins.forEach(({props:i=[]})=>{i.forEach(u=>{if(o.includes(u))throw new Error(`Option ${u} already exists!`);o.push(u)})});let r={alt:t.alt,src:t.src};Object.keys(t).filter(i=>!o.includes(i)).forEach(i=>r[i]=t[i]);let c=Object.keys(r).map(i=>`${i}:${r[i]}`).join(";"),[U,O]=(0,A.useState)(c),p={};if(o.forEach(i=>{t[i]&&(p[i]=t[i]||void 0)}),t.preserveTransformations)try{let i=(0,Oe.getTransformations)(t.src).map(u=>u.join(","));p.rawTransformations=[...i.flat(),...t.rawTransformations||[]]}catch(i){console.warn(`Failed to preserve transformations: ${i.message}`)}let a=process.env.__NEXT_IMAGE_OPTS||{};(t.unoptimized===!0||(a==null?void 0:a.unoptimized)===!0)&&(r.src=I({...p,width:r.width,height:r.height,src:r.src,format:"default",quality:"default"},t.config));async function E(i){let u=!0;if(n)return;if(n=!0,typeof t.onError=="function"){let x=t.onError(i);typeof x=="boolean"&&x===!1&&(u=!1)}else typeof t.onError=="boolean"&&t.onError===!1&&(u=!1);if(u===!1)return;let v=i.target;await Q({src:v.src})&&O(`${c};${Date.now()}`)}let w=(0,A.useCallback)(E,[Q,c]),_=Ue.default;return"default"in _&&(_=_.default),A.default.createElement(_,{key:U,...r,loader:i=>te({loaderOptions:i,imageProps:r,cldOptions:p,cldConfig:t.config}),onError:w,ref:d})}),ae=Fe;var N=P(require("react")),Pe=P(require("next/head"));var He="summary_large_image",Xe=({excludeTags:e=[],twitterTitle:t,keys:d={},...n})=>{let{alt:o}=n,r={...n,crop:n.crop||"fill",gravity:n.gravity||"center",height:n.height||1254,src:n.src,width:n.width||2400,widthResize:n.width||1200},c=typeof r.width=="string"?parseInt(r.width):r.width,U=typeof r.height=="string"?parseInt(r.height):r.height;typeof U=="number"&&typeof c=="number"&&(U=1200/c*U),c=1200;let O=I({...r,format:n.format||"jpg"}),p=I({...r,format:n.format||"webp"}),a={"og:image":"og-image","og:image:secure_url":"og-image-secureurl","og:image:width":"og-image-width","og:image:height":"og-image-height","og:image:alt":"og-image-alt","twitter:title":"twitter-title","twitter:card":"twitter-card","twitter:image":"twitter-image",...d};return N.default.createElement(Pe.default,null,N.default.createElement("meta",{key:a["og:image"],property:"og:image",content:O}),N.default.createElement("meta",{key:a["og:image:secure_url"],property:"og:image:secure_url",content:O}),N.default.createElement("meta",{key:a["og:image:width"],property:"og:image:width",content:`${c}`}),N.default.createElement("meta",{key:a["og:image:height"],property:"og:image:height",content:`${U}`}),o&&N.default.createElement("meta",{key:a["og:image:alt"],property:"og:image:alt",content:o}),!e.includes("twitter:title")&&N.default.createElement("meta",{key:a["twitter:title"],property:"twitter:title",content:t||" "}),N.default.createElement("meta",{key:a["twitter:card"],property:"twitter:card",content:He}),N.default.createElement("meta",{key:a["twitter:image"],property:"twitter:image",content:p}))},se=Xe;var Y=P(require("react"));var f=P(require("react")),_e=P(require("next/script"));function we(e){return window&&"requestIdleCallback"in window?requestIdleCallback(e):setTimeout(()=>e(),1)}var Be=["success","display-changed"],Ye={abort:"onAbort","batch-cancelled":"onBatchCancelled","display-changed":"onDisplayChanged",publicid:"onPublicId","queues-end":"onQueuesEnd","queues-start":"onQueuesStart",retry:"onRetry","show-completed":"onShowCompleted","source-changed":"onSourceChanged",success:"onSuccess",tags:"onTags","upload-added":"onUploadAdded"},$e=({children:e,onClose:t,onError:d,onOpen:n,onUpload:o,options:r,signatureEndpoint:c,uploadPreset:U,...O})=>{let p=(0,f.useRef)(),a=(0,f.useRef)(),E=!!c,[w,_]=(0,f.useState)(void 0),[i,u]=(0,f.useState)(void 0),[v,G]=(0,f.useState)(!0),x={cloudName:process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,uploadPreset:U||process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET,apiKey:process.env.NEXT_PUBLIC_CLOUDINARY_API_KEY,...r};T(process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME),E&&(x.uploadSignature=L,x.apiKey||console.warn("Missing dependency: Signed Upload requires an API key")),(0,f.useEffect)(()=>{if(typeof i=="undefined")return;let l=i.event==="success",g=i.event==="display-changed"&&i.info==="hidden";l&&typeof o=="function"&&o(i,a.current),g&&typeof t=="function"&&t(a.current)},[i]),(0,f.useEffect)(()=>{w&&typeof d=="function"&&d(w,a.current)},[w]);function j(){G(!1),p.current||(p.current=window.cloudinary),we(()=>{a.current||(a.current=V())})}(0,f.useEffect)(()=>()=>{var l;(l=a.current)==null||l.destroy(),a.current=void 0},[]);function L(l,g){if(typeof c=="undefined")throw Error("Failed to generate signature: signatureEndpoint undefined.");fetch(c,{method:"POST",body:JSON.stringify({paramsToSign:g})}).then(y=>y.json()).then(({signature:y})=>{l(y)})}function m(l,g=[]){if(a.current||(a.current=V()),typeof(a==null?void 0:a.current[l])=="function")return a.current[l](...g)}function D(l){m("close",[l])}function M(l){return m("destroy",[l])}function R(){m("hide")}function F(){return m("isDestroyed")}function S(){return m("isMinimized")}function $(){return m("isShowing")}function W(){m("minimize")}function z(l,g){m("open",[l,g]),typeof n=="function"&&n(a.current)}function ne(){m("show")}function H(){m("update")}let q={close:D,destroy:M,hide:R,isDestroyed:F,isMinimized:S,isShowing:$,minimize:W,open:z,show:ne,update:H};function V(){var l;return(l=p.current)==null?void 0:l.createUploadWidget(x,(g,y)=>{if(g&&g!==null&&_(g),typeof(y==null?void 0:y.event)=="string"){Be.includes(y==null?void 0:y.event)&&u(y);let b=Ye[y.event];if(typeof b=="string"&&typeof O[b]=="function"&&typeof O[b]){let ie=O[b];ie(y,{widget:a.current,...q})}}})}return f.default.createElement(f.default.Fragment,null,typeof e=="function"&&e({cloudinary:p.current,widget:a.current,results:i,error:w,isLoading:v,...q}),f.default.createElement(_e.default,{id:`cloudinary-uploadwidget-${Math.floor(Math.random()*100)}`,src:"https://upload-widget.cloudinary.com/global/all.js",onLoad:j,onError:l=>console.error(`Failed to load Cloudinary Upload Widget: ${l.message}`)}))},B=$e;var ze=({className:e,children:t,onClick:d,onError:n,onOpen:o,onUpload:r,onAbort:c,onBatchCancelled:U,onClose:O,onDisplayChanged:p,onPublicId:a,onQueuesEnd:E,onQueuesStart:w,onRetry:_,onShowCompleted:i,onSourceChanged:u,onSuccess:v,onTags:G,onUploadAdded:x,options:j,signatureEndpoint:L,uploadPreset:m,...D})=>Y.default.createElement(Y.default.Fragment,null,Y.default.createElement(B,{onError:n,onOpen:o,onUpload:r,onAbort:c,onBatchCancelled:U,onClose:O,onDisplayChanged:p,onPublicId:a,onQueuesEnd:E,onQueuesStart:w,onRetry:_,onShowCompleted:i,onSourceChanged:u,onSuccess:v,onTags:G,onUploadAdded:x,options:j,signatureEndpoint:L,uploadPreset:m},({open:M,isLoading:R})=>{function F(S){S.preventDefault(),M(),typeof d=="function"&&d(S)}return Y.default.createElement("button",{...D,className:e||"",onClick:F,disabled:R},t||"Upload")})),ce=ze;var C=P(require("react")),Ne=P(require("next/script")),be=P(require("next/head")),Te=require("@cloudinary-util/util");var xe=require("@cloudinary-util/url-loader");function oe(e,t,d){var o,r;let n=(r=(o=t==null?void 0:t.cloud)==null?void 0:o.cloudName)!=null?r:process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME;return T(n),(0,xe.constructCloudinaryUrl)({options:{assetType:"video",...e},config:Object.assign({cloud:{cloudName:n}},t),analytics:Object.assign({sdkCode:J,sdkSemver:Z,techVersion:ee,feature:""},d)})}var re=[],Le="1.10.4",qe=e=>{let{autoPlay:t,autoplay:d,className:n,colors:o,controls:r=!0,fontFace:c,height:U,id:O,language:p,languages:a,logo:E=!0,loop:w=!1,muted:_=!1,onDataLoad:i,onError:u,onMetadataLoad:v,onPause:G,onPlay:x,onEnded:j,poster:L,src:m,sourceTypes:D,transformation:M,quality:R="auto",width:F,...S}=e,$=Array.isArray(M)?M:[M],W=m||"";if(W.startsWith("http"))try{let s=(0,Te.parseUrl)(m);typeof(s==null?void 0:s.publicId)=="string"&&(W=s==null?void 0:s.publicId)}catch(s){}$.unshift({quality:R});let z=(0,C.useRef)(),ne=(0,C.useRef)(),H=e.videoRef||ne,q=(0,C.useRef)(),V=e.playerRef||q,l=O||`player-${W.replace("/","-")}`,g="cld-video-player cld-fluid";n&&(g=`${g} ${n}`),re.filter(s=>s===l).length>1?console.warn(`Multiple instances of the same video detected on the
|
|
1
|
+
"use strict";var Me=Object.create;var K=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty;var ke=(e,t)=>{for(var a in t)K(e,a,{get:t[a],enumerable:!0})},ye=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ge(t))!Se.call(e,o)&&o!==a&&K(e,o,{get:()=>t[o],enumerable:!(n=Ve(t,o))||n.enumerable});return e};var w=(e,t,a)=>(a=e!=null?Me(De(e)):{},ye(t||!e||!e.__esModule?K(a,"default",{value:e,enumerable:!0}):a,e)),je=e=>ye(K({},"__esModule",{value:!0}),e);var Ke={};ke(Ke,{CldImage:()=>de,CldOgImage:()=>se,CldUploadButton:()=>pe,CldUploadWidget:()=>B,CldVideoPlayer:()=>ce,cloudinaryLoader:()=>te,getCldImageUrl:()=>h,getCldOgImageUrl:()=>Ae,getCldVideoUrl:()=>oe});module.exports=je(Ke);var v=w(require("react")),Ue=w(require("next/image")),Oe=require("@cloudinary-util/util"),Ee=require("@cloudinary-util/url-loader");async function Q(e){let{src:t}=e;try{await new Promise((a,n)=>{fetch(t).then(o=>{if(!o.ok){n(o);return}a(o)})})}catch(a){return a.status===423?await Q(e):!1}return!0}function A(e){if(!e)throw new Error("A Cloudinary Cloud name is required, please make sure NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME is set and configured in your environment.")}var Ie=require("@cloudinary-util/url-loader");var he=w(require("next/package.json"));var Ce={name:"next-cloudinary",version:"5.20.0",license:"MIT",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",source:"src/index.ts",scripts:{build:"tsup",dev:"tsup --watch",prepublishOnly:"cp ../README.md . && cp ../LICENSE . && yarn build",postpublish:"rm ./README.md && rm ./LICENSE",test:"jest","test:app":'NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="test" yarn build && cd tests/nextjs-app && yarn build'},dependencies:{"@cloudinary-util/url-loader":"^4.1.1","@cloudinary-util/util":"^2.3.0"},devDependencies:{"@babel/core":"^7.23.2","@babel/preset-env":"^7.23.2","@types/jest":"^29.5.6","@types/react":"^18.2.33","@types/react-dom":"^18.2.14","babel-jest":"^29.7.0",dotenv:"^16.3.1",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0",mkdirp:"^3.0.1","ts-jest":"^29.1.1",tsup:"^7.2.0",typescript:"^5.2.2"},peerDependencies:{next:"^12 || ^13 || ^14",react:"^17 || ^18"}};var J="V",Z=Ce.version,ee=he.default.version;function h(e,t,a){var o,r;let n=(r=(o=t==null?void 0:t.cloud)==null?void 0:o.cloudName)!=null?r:process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME;return A(n),(0,Ie.constructCloudinaryUrl)({options:e,config:Object.assign({cloud:{cloudName:n}},t),analytics:Object.assign({sdkCode:J,sdkSemver:Z,techVersion:ee,feature:""},a)})}function te({loaderOptions:e,imageProps:t,cldOptions:a,cldConfig:n={}}){let o={...t,...a};o.width=typeof o.width=="string"?parseInt(o.width):o.width,o.height=typeof o.height=="string"?parseInt(o.height):o.height;let r;return typeof(e==null?void 0:e.width)=="number"&&typeof o.width=="number"&&e.width!==o.width?r=e.width:typeof(e==null?void 0:e.width)=="number"&&typeof(o==null?void 0:o.width)!="number"&&(r=e.width,o.width=r),o.width&&r&&r<o.width&&(o.widthResize=e.width),h(o,n)}var Fe=(0,v.forwardRef)(function(t,a){let n=!1,o=["deliveryType","preserveTransformations","strictTransformations","assetType"];Ee.transformationPlugins.forEach(({props:i})=>{Object.keys(i).forEach(P=>{if(o.includes(P))throw new Error(`Option ${P} already exists!`);o.push(P)})});let r={alt:t.alt,src:t.src};Object.keys(t).filter(i=>!o.includes(i)).forEach(i=>r[i]=t[i]);let p=Object.keys(r).map(i=>`${i}:${r[i]}`).join(";"),[I,U]=(0,v.useState)(p),c={};if(o.forEach(i=>{t[i]&&(c[i]=t[i]||void 0)}),t.preserveTransformations)try{let i=(0,Oe.getTransformations)(t.src).map(O=>O.join(","));c.rawTransformations=[...i.flat(),...t.rawTransformations||[]]}catch(i){console.warn(`Failed to preserve transformations: ${i.message}`)}let d=process.env.__NEXT_IMAGE_OPTS||{};(t.unoptimized===!0||(d==null?void 0:d.unoptimized)===!0)&&(r.src=h({...c,width:r.width,height:r.height,src:r.src,format:"default",quality:"default"},t.config));async function E(i){let O=!0;if(n)return;if(n=!0,typeof t.onError=="function"){let N=t.onError(i);typeof N=="boolean"&&N===!1&&(O=!1)}else typeof t.onError=="boolean"&&t.onError===!1&&(O=!1);if(O===!1)return;let P=i.target;await Q({src:P.src})&&U(`${p};${Date.now()}`)}let _=(0,v.useCallback)(E,[Q,p]),L=Ue.default;return"default"in L&&(L=L.default),v.default.createElement(L,{key:I,...r,loader:i=>te({loaderOptions:i,imageProps:r,cldOptions:c,cldConfig:t.config}),onError:_,ref:a})}),de=Fe;var x=w(require("react")),Pe=w(require("next/head"));var He="summary_large_image",Xe=({excludeTags:e=[],twitterTitle:t,keys:a={},...n})=>{let{alt:o}=n,r={...n,crop:n.crop||"fill",gravity:n.gravity||"center",height:n.height||1254,src:n.src,width:n.width||2400,widthResize:n.width||1200},p=typeof r.width=="string"?parseInt(r.width):r.width,I=typeof r.height=="string"?parseInt(r.height):r.height;typeof I=="number"&&typeof p=="number"&&(I=1200/p*I),p=1200;let U=h({...r,format:n.format||"jpg"}),c=h({...r,format:n.format||"webp"}),d={"og:image":"og-image","og:image:secure_url":"og-image-secureurl","og:image:width":"og-image-width","og:image:height":"og-image-height","og:image:alt":"og-image-alt","twitter:title":"twitter-title","twitter:card":"twitter-card","twitter:image":"twitter-image",...a};return x.default.createElement(Pe.default,null,x.default.createElement("meta",{key:d["og:image"],property:"og:image",content:U}),x.default.createElement("meta",{key:d["og:image:secure_url"],property:"og:image:secure_url",content:U}),x.default.createElement("meta",{key:d["og:image:width"],property:"og:image:width",content:`${p}`}),x.default.createElement("meta",{key:d["og:image:height"],property:"og:image:height",content:`${I}`}),o&&x.default.createElement("meta",{key:d["og:image:alt"],property:"og:image:alt",content:o}),!e.includes("twitter:title")&&x.default.createElement("meta",{key:d["twitter:title"],property:"twitter:title",content:t||" "}),x.default.createElement("meta",{key:d["twitter:card"],property:"twitter:card",content:He}),x.default.createElement("meta",{key:d["twitter:image"],property:"twitter:image",content:c}))},se=Xe;var Y=w(require("react"));var m=w(require("react")),_e=w(require("next/script"));function we(e){return window&&"requestIdleCallback"in window?requestIdleCallback(e):setTimeout(()=>e(),1)}var Be=["success","display-changed"],Ye={abort:"onAbort","batch-cancelled":"onBatchCancelled","display-changed":"onDisplayChanged",publicid:"onPublicId","queues-end":"onQueuesEnd","queues-start":"onQueuesStart",retry:"onRetry","show-completed":"onShowCompleted","source-changed":"onSourceChanged",success:"onSuccess",tags:"onTags","upload-added":"onUploadAdded"},$e=({children:e,onClose:t,onError:a,onOpen:n,onUpload:o,options:r,signatureEndpoint:p,uploadPreset:I,...U})=>{let c=(0,m.useRef)(),d=(0,m.useRef)(),E=!!p,[_,L]=(0,m.useState)(void 0),[i,O]=(0,m.useState)(void 0),[P,G]=(0,m.useState)(!0),N={cloudName:process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,uploadPreset:I||process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET,apiKey:process.env.NEXT_PUBLIC_CLOUDINARY_API_KEY,...r};A(process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME),E&&(N.uploadSignature=b,N.apiKey||console.warn("Missing dependency: Signed Upload requires an API key")),(0,m.useEffect)(()=>{if(typeof i=="undefined")return;let l=i.event==="success",g=i.event==="display-changed"&&i.info==="hidden";l&&typeof o=="function"&&o(i,d.current),g&&typeof t=="function"&&t(d.current)},[i]),(0,m.useEffect)(()=>{_&&typeof a=="function"&&a(_,d.current)},[_]);function j(){G(!1),c.current||(c.current=window.cloudinary),we(()=>{d.current||(d.current=V())})}(0,m.useEffect)(()=>()=>{var l;(l=d.current)==null||l.destroy(),d.current=void 0},[]);function b(l,g){if(typeof p=="undefined")throw Error("Failed to generate signature: signatureEndpoint undefined.");fetch(p,{method:"POST",body:JSON.stringify({paramsToSign:g})}).then(f=>f.json()).then(({signature:f})=>{l(f)})}function u(l,g=[]){if(d.current||(d.current=V()),typeof(d==null?void 0:d.current[l])=="function")return d.current[l](...g)}function D(l){u("close",[l])}function W(l){return u("destroy",[l])}function R(){u("hide")}function F(){return u("isDestroyed")}function S(){return u("isMinimized")}function $(){return u("isShowing")}function M(){u("minimize")}function z(l,g){u("open",[l,g]),typeof n=="function"&&n(d.current)}function ne(){u("show")}function H(){u("update")}let q={close:D,destroy:W,hide:R,isDestroyed:F,isMinimized:S,isShowing:$,minimize:M,open:z,show:ne,update:H};function V(){var l;return(l=c.current)==null?void 0:l.createUploadWidget(N,(g,f)=>{if(g&&g!==null&&L(g),typeof(f==null?void 0:f.event)=="string"){Be.includes(f==null?void 0:f.event)&&O(f);let T=Ye[f.event];if(typeof T=="string"&&typeof U[T]=="function"&&typeof U[T]){let ie=U[T];ie(f,{widget:d.current,...q})}}})}return m.default.createElement(m.default.Fragment,null,typeof e=="function"&&e({cloudinary:c.current,widget:d.current,results:i,error:_,isLoading:P,...q}),m.default.createElement(_e.default,{id:`cloudinary-uploadwidget-${Math.floor(Math.random()*100)}`,src:"https://upload-widget.cloudinary.com/global/all.js",onLoad:j,onError:l=>console.error(`Failed to load Cloudinary Upload Widget: ${l.message}`)}))},B=$e;var ze=({className:e,children:t,onClick:a,onError:n,onOpen:o,onUpload:r,onAbort:p,onBatchCancelled:I,onClose:U,onDisplayChanged:c,onPublicId:d,onQueuesEnd:E,onQueuesStart:_,onRetry:L,onShowCompleted:i,onSourceChanged:O,onSuccess:P,onTags:G,onUploadAdded:N,options:j,signatureEndpoint:b,uploadPreset:u,...D})=>Y.default.createElement(Y.default.Fragment,null,Y.default.createElement(B,{onError:n,onOpen:o,onUpload:r,onAbort:p,onBatchCancelled:I,onClose:U,onDisplayChanged:c,onPublicId:d,onQueuesEnd:E,onQueuesStart:_,onRetry:L,onShowCompleted:i,onSourceChanged:O,onSuccess:P,onTags:G,onUploadAdded:N,options:j,signatureEndpoint:b,uploadPreset:u},({open:W,isLoading:R})=>{function F(S){S.preventDefault(),W(),typeof a=="function"&&a(S)}return Y.default.createElement("button",{...D,className:e||"",onClick:F,disabled:R},t||"Upload")})),pe=ze;var y=w(require("react")),be=w(require("next/script")),xe=w(require("next/head")),Te=require("@cloudinary-util/util");var Le=require("@cloudinary-util/url-loader");function oe(e,t,a){var o,r;let n=(r=(o=t==null?void 0:t.cloud)==null?void 0:o.cloudName)!=null?r:process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME;return A(n),(0,Le.constructCloudinaryUrl)({options:{assetType:"video",...e},config:Object.assign({cloud:{cloudName:n}},t),analytics:Object.assign({sdkCode:J,sdkSemver:Z,techVersion:ee,feature:""},a)})}var re=[],Ne="1.10.4",qe=e=>{let{autoPlay:t,autoplay:a,className:n,colors:o,controls:r=!0,fontFace:p,height:I,id:U,language:c,languages:d,logo:E=!0,loop:_=!1,muted:L=!1,onDataLoad:i,onError:O,onMetadataLoad:P,onPause:G,onPlay:N,onEnded:j,poster:b,src:u,sourceTypes:D,transformation:W,quality:R="auto",width:F,...S}=e,$=Array.isArray(W)?W:[W],M=u||"";if(M.startsWith("http"))try{let s=(0,Te.parseUrl)(u);typeof(s==null?void 0:s.publicId)=="string"&&(M=s==null?void 0:s.publicId)}catch(s){}$.unshift({quality:R});let z=(0,y.useRef)(),ne=(0,y.useRef)(),H=e.videoRef||ne,q=(0,y.useRef)(),V=e.playerRef||q,l=U||`player-${M.replace("/","-")}`,g="cld-video-player cld-fluid";n&&(g=`${g} ${n}`),re.filter(s=>s===l).length>1?console.warn(`Multiple instances of the same video detected on the
|
|
2
2
|
page which may cause some features to not work.
|
|
3
|
-
Try adding a unique id to each player.`):re.push(l);let
|
|
3
|
+
Try adding a unique id to each player.`):re.push(l);let T={error:O,loadeddata:i,loadedmetadata:P,pause:G,play:N,ended:j};function ie(s){let C=T[s.type];typeof C=="function"&&C(We())}A(process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME);function ve(){if("cloudinary"in window){z.current=window.cloudinary;let s={};typeof E=="boolean"?s.showLogo=E:typeof E=="object"&&(s={...s,showLogo:!0,logoImageUrl:E.imageUrl,logoOnclickUrl:E.onClickUrl});let C=a||t,ue=!1,ge;t&&process.env.NODE_ENV==="development"&&console.warn('Prop autoPlay will be removed in future versions, please use autoplay (lowercase "p")'),(typeof C=="boolean"||C==="true"||C==="false")&&(ue=C),typeof C=="string"&&C!=="true"&&C!=="false"&&(ge=C);let k={autoplayMode:ge,autoplay:ue,cloud_name:process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,controls:r,fontFace:p||"",language:c,languages:d,loop:_,muted:L,publicId:M,transformation:$,...s,...S};Array.isArray(D)&&(k.sourceTypes=D),typeof o=="object"&&(k.colors=o),typeof b=="string"?k.posterOptions={publicId:b}:typeof b=="object"&&(typeof b.src!="string"?k.posterOptions={publicId:oe({...b,src:M,format:"auto:image"})}:k.posterOptions={publicId:h(b)}),V.current=z.current.videoPlayer(H.current,k),Object.keys(T).forEach(me=>{var fe;typeof T[me]=="function"&&((fe=V.current)==null||fe.on(me,ie))})}}(0,y.useEffect)(()=>()=>{var s;(s=V.current)==null||s.videojs.cloudinary.dispose(),re=re.filter(C=>C!==l)},[]);function We(){return{player:V.current,video:H.current}}return y.default.createElement(y.default.Fragment,null,y.default.createElement(xe.default,null,y.default.createElement("link",{href:`https://unpkg.com/cloudinary-video-player@${Ne}/dist/cld-video-player.min.css`,rel:"stylesheet"})),y.default.createElement("div",{style:{width:"100%",aspectRatio:`${e.width} / ${e.height}`}},y.default.createElement("video",{ref:H,id:l,className:g,width:F,height:I}),y.default.createElement(be.default,{id:`cloudinary-videoplayer-${l}-${Math.floor(Math.random()*100)}`,src:`https://unpkg.com/cloudinary-video-player@${Ne}/dist/cld-video-player.min.js`,onLoad:ve,onError:s=>console.error(`Failed to load Cloudinary Video Player: ${s.message}`)})))},ce=qe;function Ae(e){return h({...e,crop:e.crop||"fill",format:e.format||"jpg",gravity:e.gravity||"center",height:e.height||1254,width:e.width||2400,widthResize:e.width||1200})}0&&(module.exports={CldImage,CldOgImage,CldUploadButton,CldUploadWidget,CldVideoPlayer,cloudinaryLoader,getCldImageUrl,getCldOgImageUrl,getCldVideoUrl});
|
|
4
4
|
//# sourceMappingURL=index.js.map
|