@micromag/element-image 0.4.69 → 0.4.74
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/es/index.d.ts +20 -5
- package/es/index.js +315 -168
- package/package.json +9 -7
package/es/index.d.ts
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ForwardedRef } from 'react';
|
|
3
|
+
import { ImageMedia, ObjectFit, ContainerStyle } from '@micromag/core';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
interface ImageProps {
|
|
6
|
+
media?: ImageMedia | null;
|
|
7
|
+
alt?: string | null;
|
|
8
|
+
width?: number | string | null;
|
|
9
|
+
height?: number | string | null;
|
|
10
|
+
resolution?: number;
|
|
11
|
+
objectFit?: ObjectFit | null;
|
|
12
|
+
containerStyle?: ContainerStyle;
|
|
13
|
+
imageStyle?: ContainerStyle;
|
|
14
|
+
className?: string | null;
|
|
15
|
+
imageClassName?: string | null;
|
|
16
|
+
onLoaded?: ((...args: unknown[]) => void) | null;
|
|
17
|
+
loadingMode?: string;
|
|
18
|
+
shouldLoad?: boolean;
|
|
19
|
+
ref?: ForwardedRef<HTMLDivElement> | null;
|
|
20
|
+
}
|
|
21
|
+
declare function Image({ media, alt, width, height, resolution, objectFit, containerStyle, imageStyle, className, imageClassName, onLoaded, loadingMode, shouldLoad, ref, }: ImageProps): react_jsx_runtime.JSX.Element;
|
|
7
22
|
|
|
8
|
-
export {
|
|
23
|
+
export { Image as default };
|
package/es/index.js
CHANGED
|
@@ -1,195 +1,342 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
4
2
|
import { getSizeWithinBounds } from '@folklore/size';
|
|
5
3
|
import classNames from 'classnames';
|
|
6
|
-
import { useState
|
|
4
|
+
import { useState } from 'react';
|
|
7
5
|
import { useSetting } from '@micromag/core/contexts';
|
|
8
6
|
import { getOptimalImageUrl } from '@micromag/core/utils';
|
|
9
7
|
import { jsx } from 'react/jsx-runtime';
|
|
10
8
|
|
|
11
9
|
var styles = {"container":"micromag-element-image-container","img":"micromag-element-image-img"};
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
media
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
11
|
+
const emptyObject = {};
|
|
12
|
+
function Image(t0) {
|
|
13
|
+
const $ = c(61);
|
|
14
|
+
const {
|
|
15
|
+
media: t1,
|
|
16
|
+
alt: t2,
|
|
17
|
+
width: t3,
|
|
18
|
+
height: t4,
|
|
19
|
+
resolution: t5,
|
|
20
|
+
objectFit: t6,
|
|
21
|
+
containerStyle: t7,
|
|
22
|
+
imageStyle: t8,
|
|
23
|
+
className: t9,
|
|
24
|
+
imageClassName: t10,
|
|
25
|
+
onLoaded: t11,
|
|
26
|
+
loadingMode: t12,
|
|
27
|
+
shouldLoad: t13,
|
|
28
|
+
ref: t14
|
|
29
|
+
} = t0;
|
|
30
|
+
const media = t1 === undefined ? null : t1;
|
|
31
|
+
const alt = t2 === undefined ? null : t2;
|
|
32
|
+
const width = t3 === undefined ? null : t3;
|
|
33
|
+
const height = t4 === undefined ? null : t4;
|
|
34
|
+
const resolution = t5 === undefined ? 1 : t5;
|
|
35
|
+
const objectFit = t6 === undefined ? null : t6;
|
|
36
|
+
const containerStyle = t7 === undefined ? emptyObject : t7;
|
|
37
|
+
const imageStyle = t8 === undefined ? emptyObject : t8;
|
|
38
|
+
const className = t9 === undefined ? null : t9;
|
|
39
|
+
const imageClassName = t10 === undefined ? null : t10;
|
|
40
|
+
const onLoaded = t11 === undefined ? null : t11;
|
|
41
|
+
const loadingMode = t12 === undefined ? "lazy" : t12;
|
|
42
|
+
const shouldLoad = t13 === undefined ? true : t13;
|
|
43
|
+
const ref = t14 === undefined ? null : t14;
|
|
44
|
+
let t15;
|
|
45
|
+
if ($[0] !== media) {
|
|
46
|
+
t15 = media || {};
|
|
47
|
+
$[0] = media;
|
|
48
|
+
$[1] = t15;
|
|
49
|
+
} else {
|
|
50
|
+
t15 = $[1];
|
|
51
|
+
}
|
|
52
|
+
const {
|
|
53
|
+
metadata: t16
|
|
54
|
+
} = t15;
|
|
55
|
+
const metadata = t16 === undefined ? null : t16;
|
|
56
|
+
let t17;
|
|
57
|
+
if ($[2] !== metadata) {
|
|
58
|
+
t17 = metadata || {};
|
|
59
|
+
$[2] = metadata;
|
|
60
|
+
$[3] = t17;
|
|
61
|
+
} else {
|
|
62
|
+
t17 = $[3];
|
|
63
|
+
}
|
|
64
|
+
const {
|
|
65
|
+
width: t18,
|
|
66
|
+
height: t19,
|
|
67
|
+
description: t20
|
|
68
|
+
} = t17;
|
|
69
|
+
const mediaWidth = t18 === undefined ? 0 : t18;
|
|
70
|
+
const mediaHeight = t19 === undefined ? 0 : t19;
|
|
71
|
+
const description = t20 === undefined ? "image" : t20;
|
|
72
|
+
const mediaRatio = mediaWidth / mediaHeight;
|
|
73
|
+
let t21;
|
|
74
|
+
if ($[4] !== mediaHeight || $[5] !== mediaWidth) {
|
|
75
|
+
t21 = {
|
|
56
76
|
width: mediaWidth,
|
|
57
77
|
height: mediaHeight
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
realHeight = _useState2$$height === void 0 ? 0 : _useState2$$height,
|
|
65
|
-
setRealSize = _useState2[1];
|
|
66
|
-
var supportsWebp = useSetting('supportsWebp', false);
|
|
67
|
-
var imageResolution = useSetting('imageResolution', resolution);
|
|
68
|
-
var wasLoadedRef = useRef(shouldLoad);
|
|
69
|
-
if (shouldLoad && !wasLoadedRef.current) {
|
|
70
|
-
wasLoadedRef.current = shouldLoad;
|
|
78
|
+
};
|
|
79
|
+
$[4] = mediaHeight;
|
|
80
|
+
$[5] = mediaWidth;
|
|
81
|
+
$[6] = t21;
|
|
82
|
+
} else {
|
|
83
|
+
t21 = $[6];
|
|
71
84
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
_ref4$horizontalPosit = _ref4.horizontalPosition,
|
|
104
|
-
horizontalPosition = _ref4$horizontalPosit === void 0 ? 'center' : _ref4$horizontalPosit,
|
|
105
|
-
_ref4$verticalPositio = _ref4.verticalPosition,
|
|
106
|
-
verticalPosition = _ref4$verticalPositio === void 0 ? 'center' : _ref4$verticalPositio;
|
|
107
|
-
if (mediaHasSize) {
|
|
108
|
-
var _getSizeWithinBounds = getSizeWithinBounds(realWidth, realHeight, width, height, {
|
|
109
|
-
cover: fit === 'cover'
|
|
110
|
-
}),
|
|
111
|
-
resizedImageWidth = _getSizeWithinBounds.width,
|
|
112
|
-
resizedImageHeight = _getSizeWithinBounds.height;
|
|
113
|
-
imageWidth = resizedImageWidth;
|
|
114
|
-
imageHeight = resizedImageHeight;
|
|
115
|
-
if (horizontalPosition === 'center') {
|
|
116
|
-
imageLeft = -(resizedImageWidth - width) / 2;
|
|
117
|
-
} else if (horizontalPosition === 'right') {
|
|
118
|
-
imageLeft = -(resizedImageWidth - width);
|
|
85
|
+
const [realSize, setRealSize] = useState(t21);
|
|
86
|
+
const {
|
|
87
|
+
width: t22,
|
|
88
|
+
height: t23
|
|
89
|
+
} = realSize;
|
|
90
|
+
const realWidth = t22 === undefined ? 0 : t22;
|
|
91
|
+
const realHeight = t23 === undefined ? 0 : t23;
|
|
92
|
+
const supportsWebp = useSetting("supportsWebp", false);
|
|
93
|
+
const imageResolution = useSetting("imageResolution", resolution);
|
|
94
|
+
const [wasLoaded, setWasLoaded] = useState(shouldLoad);
|
|
95
|
+
if (shouldLoad && !wasLoaded) {
|
|
96
|
+
setWasLoaded(shouldLoad);
|
|
97
|
+
}
|
|
98
|
+
const finalShouldLoad = wasLoaded || shouldLoad;
|
|
99
|
+
let t24;
|
|
100
|
+
if ($[7] !== onLoaded || $[8] !== realHeight || $[9] !== realWidth) {
|
|
101
|
+
t24 = e => {
|
|
102
|
+
const {
|
|
103
|
+
target: t25
|
|
104
|
+
} = e;
|
|
105
|
+
const {
|
|
106
|
+
naturalWidth: t26,
|
|
107
|
+
naturalHeight: t27
|
|
108
|
+
} = t25;
|
|
109
|
+
const naturalWidth = t26 === undefined ? 0 : t26;
|
|
110
|
+
const naturalHeight = t27 === undefined ? 0 : t27;
|
|
111
|
+
if (naturalWidth !== realWidth || naturalHeight !== realHeight) {
|
|
112
|
+
setRealSize({
|
|
113
|
+
width: naturalWidth || 0,
|
|
114
|
+
height: naturalHeight || 0
|
|
115
|
+
});
|
|
119
116
|
}
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
} else if (verticalPosition === 'bottom') {
|
|
123
|
-
imageTop = -(resizedImageHeight - height);
|
|
117
|
+
if (onLoaded !== null) {
|
|
118
|
+
onLoaded(e);
|
|
124
119
|
}
|
|
125
|
-
} else {
|
|
126
|
-
imageObjectFit = fit;
|
|
127
|
-
imageObjectPosition = "".concat(horizontalPosition, " ").concat(verticalPosition);
|
|
128
|
-
}
|
|
129
|
-
finalContainerStyle = {
|
|
130
|
-
width: width,
|
|
131
|
-
height: height
|
|
132
|
-
};
|
|
133
|
-
finalImageStyle = {
|
|
134
|
-
position: 'absolute',
|
|
135
|
-
width: imageWidth,
|
|
136
|
-
height: imageHeight,
|
|
137
|
-
top: imageTop,
|
|
138
|
-
left: imageLeft,
|
|
139
|
-
objectFit: imageObjectFit,
|
|
140
|
-
objectPosition: imageObjectPosition
|
|
141
120
|
};
|
|
121
|
+
$[7] = onLoaded;
|
|
122
|
+
$[8] = realHeight;
|
|
123
|
+
$[9] = realWidth;
|
|
124
|
+
$[10] = t24;
|
|
142
125
|
} else {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
126
|
+
t24 = $[10];
|
|
127
|
+
}
|
|
128
|
+
const onImageLoaded = t24;
|
|
129
|
+
const withFit = objectFit !== null;
|
|
130
|
+
const mediaHasSize = realWidth > 0 && realHeight > 0;
|
|
131
|
+
let finalContainerStyle;
|
|
132
|
+
let finalImageStyle;
|
|
133
|
+
let t25;
|
|
134
|
+
if ($[11] !== containerStyle || $[12] !== finalContainerStyle || $[13] !== height || $[14] !== imageResolution || $[15] !== imageStyle || $[16] !== media || $[17] !== mediaHasSize || $[18] !== mediaHeight || $[19] !== mediaRatio || $[20] !== mediaWidth || $[21] !== objectFit || $[22] !== realHeight || $[23] !== realWidth || $[24] !== supportsWebp || $[25] !== width || $[26] !== withFit) {
|
|
135
|
+
if (withFit) {
|
|
136
|
+
let imageTop = 0;
|
|
137
|
+
let imageLeft = 0;
|
|
138
|
+
let imageWidth = width;
|
|
139
|
+
let imageHeight = height;
|
|
140
|
+
let imageObjectFit = null;
|
|
141
|
+
let imageObjectPosition = null;
|
|
142
|
+
const {
|
|
143
|
+
fit: t26,
|
|
144
|
+
horizontalPosition: t27,
|
|
145
|
+
verticalPosition: t28
|
|
146
|
+
} = objectFit || {};
|
|
147
|
+
const fit = t26 === undefined ? null : t26;
|
|
148
|
+
const horizontalPosition = t27 === undefined ? "center" : t27;
|
|
149
|
+
const verticalPosition = t28 === undefined ? "center" : t28;
|
|
150
|
+
if (mediaHasSize) {
|
|
151
|
+
const t29 = fit === "cover";
|
|
152
|
+
let t30;
|
|
153
|
+
if ($[30] !== height || $[31] !== realHeight || $[32] !== realWidth || $[33] !== t29 || $[34] !== width) {
|
|
154
|
+
t30 = getSizeWithinBounds(realWidth, realHeight, width, height, {
|
|
155
|
+
cover: t29
|
|
156
|
+
});
|
|
157
|
+
$[30] = height;
|
|
158
|
+
$[31] = realHeight;
|
|
159
|
+
$[32] = realWidth;
|
|
160
|
+
$[33] = t29;
|
|
161
|
+
$[34] = width;
|
|
162
|
+
$[35] = t30;
|
|
163
|
+
} else {
|
|
164
|
+
t30 = $[35];
|
|
165
|
+
}
|
|
166
|
+
const {
|
|
167
|
+
width: resizedImageWidth,
|
|
168
|
+
height: resizedImageHeight
|
|
169
|
+
} = t30;
|
|
170
|
+
imageWidth = resizedImageWidth;
|
|
171
|
+
imageHeight = resizedImageHeight;
|
|
172
|
+
if (horizontalPosition === "center") {
|
|
173
|
+
imageLeft = -(resizedImageWidth - width) / 2;
|
|
174
|
+
} else {
|
|
175
|
+
if (horizontalPosition === "right") {
|
|
176
|
+
imageLeft = -(resizedImageWidth - width);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (verticalPosition === "center") {
|
|
180
|
+
imageTop = -(resizedImageHeight - height) / 2;
|
|
181
|
+
} else {
|
|
182
|
+
if (verticalPosition === "bottom") {
|
|
183
|
+
imageTop = -(resizedImageHeight - height);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
imageObjectFit = fit;
|
|
188
|
+
imageObjectPosition = `${horizontalPosition} ${verticalPosition}`;
|
|
189
|
+
}
|
|
190
|
+
let t29;
|
|
191
|
+
if ($[36] !== height || $[37] !== width) {
|
|
192
|
+
t29 = {
|
|
193
|
+
width,
|
|
194
|
+
height
|
|
195
|
+
};
|
|
196
|
+
$[36] = height;
|
|
197
|
+
$[37] = width;
|
|
198
|
+
$[38] = t29;
|
|
199
|
+
} else {
|
|
200
|
+
t29 = $[38];
|
|
201
|
+
}
|
|
202
|
+
finalContainerStyle = t29;
|
|
203
|
+
finalImageStyle = {
|
|
204
|
+
position: "absolute",
|
|
205
|
+
width: imageWidth,
|
|
206
|
+
height: imageHeight,
|
|
207
|
+
top: imageTop,
|
|
208
|
+
left: imageLeft,
|
|
209
|
+
objectFit: imageObjectFit,
|
|
210
|
+
objectPosition: imageObjectPosition
|
|
211
|
+
};
|
|
212
|
+
} else {
|
|
213
|
+
const validWidth = width !== null && typeof width === "number";
|
|
214
|
+
const validHeight = height !== null && typeof height === "number";
|
|
215
|
+
const ratioWidth = mediaRatio && validHeight ? height * mediaRatio : null;
|
|
216
|
+
const ratioHeight = mediaRatio && validWidth ? width / mediaRatio : null;
|
|
217
|
+
let finalWidth = width !== null ? width : ratioWidth;
|
|
218
|
+
let finalHeight = height !== null ? height : ratioHeight;
|
|
219
|
+
if (finalWidth === null && finalHeight === null) {
|
|
220
|
+
finalWidth = realWidth > 0 ? mediaWidth : null;
|
|
221
|
+
finalHeight = realHeight > 0 ? mediaHeight : null;
|
|
222
|
+
}
|
|
223
|
+
let t26;
|
|
224
|
+
if ($[39] !== finalHeight || $[40] !== finalWidth) {
|
|
225
|
+
t26 = {
|
|
226
|
+
width: finalWidth,
|
|
227
|
+
height: finalHeight
|
|
228
|
+
};
|
|
229
|
+
$[39] = finalHeight;
|
|
230
|
+
$[40] = finalWidth;
|
|
231
|
+
$[41] = t26;
|
|
232
|
+
} else {
|
|
233
|
+
t26 = $[41];
|
|
234
|
+
}
|
|
235
|
+
finalContainerStyle = t26;
|
|
236
|
+
finalImageStyle = {
|
|
237
|
+
width: "100%",
|
|
238
|
+
height: validHeight ? "100%" : "auto"
|
|
239
|
+
};
|
|
152
240
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
241
|
+
let t26;
|
|
242
|
+
if ($[42] !== containerStyle || $[43] !== finalContainerStyle) {
|
|
243
|
+
t26 = {
|
|
244
|
+
...finalContainerStyle,
|
|
245
|
+
...containerStyle
|
|
246
|
+
};
|
|
247
|
+
$[42] = containerStyle;
|
|
248
|
+
$[43] = finalContainerStyle;
|
|
249
|
+
$[44] = t26;
|
|
250
|
+
} else {
|
|
251
|
+
t26 = $[44];
|
|
252
|
+
}
|
|
253
|
+
finalContainerStyle = t26;
|
|
157
254
|
finalImageStyle = {
|
|
158
|
-
|
|
159
|
-
|
|
255
|
+
...finalImageStyle,
|
|
256
|
+
...imageStyle
|
|
160
257
|
};
|
|
258
|
+
const {
|
|
259
|
+
width: t27,
|
|
260
|
+
height: t28
|
|
261
|
+
} = finalImageStyle;
|
|
262
|
+
const finalWidth_0 = t27 === undefined ? null : t27;
|
|
263
|
+
const finalHeight_0 = t28 === undefined ? null : t28;
|
|
264
|
+
t25 = getOptimalImageUrl(media, finalWidth_0, finalHeight_0 || finalWidth_0, {
|
|
265
|
+
resolution: imageResolution,
|
|
266
|
+
supportsWebp
|
|
267
|
+
});
|
|
268
|
+
$[11] = containerStyle;
|
|
269
|
+
$[12] = finalContainerStyle;
|
|
270
|
+
$[13] = height;
|
|
271
|
+
$[14] = imageResolution;
|
|
272
|
+
$[15] = imageStyle;
|
|
273
|
+
$[16] = media;
|
|
274
|
+
$[17] = mediaHasSize;
|
|
275
|
+
$[18] = mediaHeight;
|
|
276
|
+
$[19] = mediaRatio;
|
|
277
|
+
$[20] = mediaWidth;
|
|
278
|
+
$[21] = objectFit;
|
|
279
|
+
$[22] = realHeight;
|
|
280
|
+
$[23] = realWidth;
|
|
281
|
+
$[24] = supportsWebp;
|
|
282
|
+
$[25] = width;
|
|
283
|
+
$[26] = withFit;
|
|
284
|
+
$[27] = finalImageStyle;
|
|
285
|
+
$[28] = t25;
|
|
286
|
+
$[29] = finalContainerStyle;
|
|
287
|
+
} else {
|
|
288
|
+
finalImageStyle = $[27];
|
|
289
|
+
t25 = $[28];
|
|
290
|
+
finalContainerStyle = $[29];
|
|
291
|
+
}
|
|
292
|
+
const finalUrl = t25;
|
|
293
|
+
let t26;
|
|
294
|
+
if ($[45] !== className) {
|
|
295
|
+
t26 = classNames([styles.container, className]);
|
|
296
|
+
$[45] = className;
|
|
297
|
+
$[46] = t26;
|
|
298
|
+
} else {
|
|
299
|
+
t26 = $[46];
|
|
161
300
|
}
|
|
162
|
-
|
|
163
|
-
finalImageStyle
|
|
164
|
-
|
|
165
|
-
_finalImageStyle$widt = _finalImageStyle.width,
|
|
166
|
-
finalWidth = _finalImageStyle$widt === void 0 ? null : _finalImageStyle$widt,
|
|
167
|
-
_finalImageStyle$heig = _finalImageStyle.height,
|
|
168
|
-
finalHeight = _finalImageStyle$heig === void 0 ? null : _finalImageStyle$heig;
|
|
169
|
-
var finalUrl = getOptimalImageUrl(media, finalWidth, finalHeight || finalWidth, {
|
|
170
|
-
resolution: imageResolution,
|
|
171
|
-
supportsWebp: supportsWebp
|
|
172
|
-
});
|
|
173
|
-
return /*#__PURE__*/jsx("div", {
|
|
174
|
-
className: classNames([styles.container, className]),
|
|
175
|
-
style: finalContainerStyle,
|
|
176
|
-
ref: containerRef,
|
|
177
|
-
children: finalUrl !== null && finalShouldLoad ? /*#__PURE__*/jsx("img", {
|
|
301
|
+
let t27;
|
|
302
|
+
if ($[47] !== alt || $[48] !== description || $[49] !== finalImageStyle || $[50] !== finalShouldLoad || $[51] !== finalUrl || $[52] !== imageClassName || $[53] !== loadingMode || $[54] !== onImageLoaded) {
|
|
303
|
+
t27 = finalUrl !== null && finalShouldLoad ? /*#__PURE__*/jsx("img", {
|
|
178
304
|
src: finalUrl,
|
|
179
305
|
alt: alt || description,
|
|
180
306
|
className: classNames([styles.img, imageClassName]),
|
|
181
307
|
style: finalImageStyle,
|
|
182
308
|
onLoad: onImageLoaded,
|
|
183
309
|
loading: loadingMode
|
|
184
|
-
}) : null
|
|
185
|
-
|
|
310
|
+
}) : null;
|
|
311
|
+
$[47] = alt;
|
|
312
|
+
$[48] = description;
|
|
313
|
+
$[49] = finalImageStyle;
|
|
314
|
+
$[50] = finalShouldLoad;
|
|
315
|
+
$[51] = finalUrl;
|
|
316
|
+
$[52] = imageClassName;
|
|
317
|
+
$[53] = loadingMode;
|
|
318
|
+
$[54] = onImageLoaded;
|
|
319
|
+
$[55] = t27;
|
|
320
|
+
} else {
|
|
321
|
+
t27 = $[55];
|
|
322
|
+
}
|
|
323
|
+
let t28;
|
|
324
|
+
if ($[56] !== finalContainerStyle || $[57] !== ref || $[58] !== t26 || $[59] !== t27) {
|
|
325
|
+
t28 = /*#__PURE__*/jsx("div", {
|
|
326
|
+
className: t26,
|
|
327
|
+
style: finalContainerStyle,
|
|
328
|
+
ref: ref,
|
|
329
|
+
children: t27
|
|
330
|
+
});
|
|
331
|
+
$[56] = finalContainerStyle;
|
|
332
|
+
$[57] = ref;
|
|
333
|
+
$[58] = t26;
|
|
334
|
+
$[59] = t27;
|
|
335
|
+
$[60] = t28;
|
|
336
|
+
} else {
|
|
337
|
+
t28 = $[60];
|
|
338
|
+
}
|
|
339
|
+
return t28;
|
|
186
340
|
}
|
|
187
|
-
var Image_default = (function (_ref5) {
|
|
188
|
-
var ref = _ref5.ref,
|
|
189
|
-
props = _objectWithoutProperties(_ref5, _excluded);
|
|
190
|
-
return /*#__PURE__*/jsx(Image, _objectSpread({
|
|
191
|
-
containerRef: ref
|
|
192
|
-
}, props));
|
|
193
|
-
});
|
|
194
341
|
|
|
195
|
-
export {
|
|
342
|
+
export { Image as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-image",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.74",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"type": "module",
|
|
34
34
|
"module": "es/index.js",
|
|
35
|
+
"style": "./assets/css/styles.css",
|
|
35
36
|
"exports": {
|
|
36
37
|
".": {
|
|
37
38
|
"types": "./es/index.d.ts",
|
|
39
|
+
"style": "./assets/css/styles.css",
|
|
38
40
|
"import": "./es/index.js"
|
|
39
41
|
},
|
|
40
42
|
"./assets/css/styles": "./assets/css/styles.css",
|
|
@@ -51,17 +53,17 @@
|
|
|
51
53
|
"build": "../../scripts/prepare-package.sh --types"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
|
-
"react": "^
|
|
55
|
-
"react-dom": "^
|
|
56
|
+
"react": "^19.0.0",
|
|
57
|
+
"react-dom": "^19.0.0"
|
|
56
58
|
},
|
|
57
59
|
"peerDependencies": {
|
|
58
|
-
"react": "^
|
|
59
|
-
"react-dom": "^
|
|
60
|
+
"react": "^19.0.0",
|
|
61
|
+
"react-dom": "^19.0.0"
|
|
60
62
|
},
|
|
61
63
|
"dependencies": {
|
|
62
64
|
"@babel/runtime": "^7.28.6",
|
|
63
65
|
"@folklore/size": "^0.1.20",
|
|
64
|
-
"@micromag/core": "^0.4.
|
|
66
|
+
"@micromag/core": "^0.4.74",
|
|
65
67
|
"classnames": "^2.2.6",
|
|
66
68
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
67
69
|
"uuid": "^9.0.0"
|
|
@@ -70,6 +72,6 @@
|
|
|
70
72
|
"access": "public",
|
|
71
73
|
"registry": "https://registry.npmjs.org/"
|
|
72
74
|
},
|
|
73
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1",
|
|
74
76
|
"types": "es/index.d.ts"
|
|
75
77
|
}
|