@micromag/element-author 0.4.70 → 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.js +264 -91
- package/package.json +12 -10
package/es/index.js
CHANGED
|
@@ -1,114 +1,287 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { getOptimalImageUrl, pascalCase, isTextFilled } from '@micromag/core/utils';
|
|
5
4
|
import Link from '@micromag/element-link';
|
|
6
5
|
import Text from '@micromag/element-text';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
8
6
|
import { useSetting } from '@micromag/core/contexts';
|
|
9
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
8
|
|
|
11
9
|
var styles$1 = {"container":"micromag-element-author-avatar-container","shape":"micromag-element-author-avatar-shape","shapeCircle":"micromag-element-author-avatar-shapeCircle"};
|
|
12
10
|
|
|
13
|
-
function Avatar(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
width
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
11
|
+
function Avatar(t0) {
|
|
12
|
+
const $ = c(18);
|
|
13
|
+
const {
|
|
14
|
+
image: t1,
|
|
15
|
+
width: t2,
|
|
16
|
+
height: t3,
|
|
17
|
+
resolution: t4,
|
|
18
|
+
shape: t5,
|
|
19
|
+
isTag: t6,
|
|
20
|
+
className: t7,
|
|
21
|
+
shouldLoad: t8
|
|
22
|
+
} = t0;
|
|
23
|
+
const image = t1 === undefined ? null : t1;
|
|
24
|
+
const width = t2 === undefined ? 100 : t2;
|
|
25
|
+
const height = t3 === undefined ? 100 : t3;
|
|
26
|
+
const resolution = t4 === undefined ? 1 : t4;
|
|
27
|
+
const shape = t5 === undefined ? "circle" : t5;
|
|
28
|
+
const isTag = t6 === undefined ? false : t6;
|
|
29
|
+
const className = t7 === undefined ? null : t7;
|
|
30
|
+
const shouldLoad = t8 === undefined ? true : t8;
|
|
31
|
+
const supportsWebp = useSetting("supportsWebp", false);
|
|
32
|
+
const imageResolution = useSetting("imageResolution", resolution);
|
|
33
|
+
let t9;
|
|
34
|
+
if ($[0] !== height || $[1] !== image || $[2] !== imageResolution || $[3] !== supportsWebp || $[4] !== width) {
|
|
35
|
+
t9 = getOptimalImageUrl(image, width, height, {
|
|
36
|
+
resolution: imageResolution,
|
|
37
|
+
supportsWebp
|
|
38
|
+
});
|
|
39
|
+
$[0] = height;
|
|
40
|
+
$[1] = image;
|
|
41
|
+
$[2] = imageResolution;
|
|
42
|
+
$[3] = supportsWebp;
|
|
43
|
+
$[4] = width;
|
|
44
|
+
$[5] = t9;
|
|
45
|
+
} else {
|
|
46
|
+
t9 = $[5];
|
|
47
|
+
}
|
|
48
|
+
const imageAtSize = t9;
|
|
49
|
+
let t10;
|
|
50
|
+
if ($[6] !== shape) {
|
|
51
|
+
t10 = shape !== null ? pascalCase(shape) : null;
|
|
52
|
+
$[6] = shape;
|
|
53
|
+
$[7] = t10;
|
|
54
|
+
} else {
|
|
55
|
+
t10 = $[7];
|
|
56
|
+
}
|
|
57
|
+
const finalShape = t10;
|
|
58
|
+
const t11 = styles$1[`shape${finalShape}`];
|
|
59
|
+
const t12 = finalShape !== null;
|
|
60
|
+
let t13;
|
|
61
|
+
if ($[8] !== className || $[9] !== isTag || $[10] !== t11 || $[11] !== t12) {
|
|
62
|
+
t13 = classNames([styles$1.container, className, {
|
|
63
|
+
[t11]: t12,
|
|
64
|
+
[styles$1.isTag]: isTag
|
|
65
|
+
}]);
|
|
66
|
+
$[8] = className;
|
|
67
|
+
$[9] = isTag;
|
|
68
|
+
$[10] = t11;
|
|
69
|
+
$[11] = t12;
|
|
70
|
+
$[12] = t13;
|
|
71
|
+
} else {
|
|
72
|
+
t13 = $[12];
|
|
73
|
+
}
|
|
74
|
+
const t14 = shouldLoad ? `url("${imageAtSize}")` : null;
|
|
75
|
+
let t15;
|
|
76
|
+
if ($[13] !== t14) {
|
|
77
|
+
t15 = /*#__PURE__*/jsx("span", {
|
|
40
78
|
className: styles$1.shape,
|
|
41
79
|
style: {
|
|
42
|
-
backgroundImage:
|
|
80
|
+
backgroundImage: t14
|
|
43
81
|
}
|
|
44
|
-
})
|
|
45
|
-
|
|
82
|
+
});
|
|
83
|
+
$[13] = t14;
|
|
84
|
+
$[14] = t15;
|
|
85
|
+
} else {
|
|
86
|
+
t15 = $[14];
|
|
87
|
+
}
|
|
88
|
+
let t16;
|
|
89
|
+
if ($[15] !== t13 || $[16] !== t15) {
|
|
90
|
+
t16 = /*#__PURE__*/jsx("span", {
|
|
91
|
+
className: t13,
|
|
92
|
+
children: t15
|
|
93
|
+
});
|
|
94
|
+
$[15] = t13;
|
|
95
|
+
$[16] = t15;
|
|
96
|
+
$[17] = t16;
|
|
97
|
+
} else {
|
|
98
|
+
t16 = $[17];
|
|
99
|
+
}
|
|
100
|
+
return t16;
|
|
46
101
|
}
|
|
47
102
|
|
|
48
103
|
var styles = {"container":"micromag-element-author-container","image":"micromag-element-author-image","link":"micromag-element-author-link","right":"micromag-element-author-right","name":"micromag-element-author-name","collaborator":"micromag-element-author-collaborator","collaboratorText":"micromag-element-author-collaboratorText"};
|
|
49
104
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
function Author(t0) {
|
|
106
|
+
const $ = c(39);
|
|
107
|
+
let otherProps;
|
|
108
|
+
let t1;
|
|
109
|
+
let t2;
|
|
110
|
+
let t3;
|
|
111
|
+
let t4;
|
|
112
|
+
let t5;
|
|
113
|
+
let t6;
|
|
114
|
+
let t7;
|
|
115
|
+
let t8;
|
|
116
|
+
if ($[0] !== t0) {
|
|
117
|
+
({
|
|
118
|
+
author: t1,
|
|
119
|
+
withImage: t2,
|
|
120
|
+
withoutLink: t3,
|
|
121
|
+
linkUnderlineColor: t4,
|
|
122
|
+
className: t5,
|
|
123
|
+
backgroundClassName: t6,
|
|
124
|
+
collaboratorClassName: t7,
|
|
125
|
+
shouldLoad: t8,
|
|
126
|
+
...otherProps
|
|
127
|
+
} = t0);
|
|
128
|
+
$[0] = t0;
|
|
129
|
+
$[1] = otherProps;
|
|
130
|
+
$[2] = t1;
|
|
131
|
+
$[3] = t2;
|
|
132
|
+
$[4] = t3;
|
|
133
|
+
$[5] = t4;
|
|
134
|
+
$[6] = t5;
|
|
135
|
+
$[7] = t6;
|
|
136
|
+
$[8] = t7;
|
|
137
|
+
$[9] = t8;
|
|
138
|
+
} else {
|
|
139
|
+
otherProps = $[1];
|
|
140
|
+
t1 = $[2];
|
|
141
|
+
t2 = $[3];
|
|
142
|
+
t3 = $[4];
|
|
143
|
+
t4 = $[5];
|
|
144
|
+
t5 = $[6];
|
|
145
|
+
t6 = $[7];
|
|
146
|
+
t7 = $[8];
|
|
147
|
+
t8 = $[9];
|
|
148
|
+
}
|
|
149
|
+
const author = t1 === undefined ? null : t1;
|
|
150
|
+
const withImage = t2 === undefined ? true : t2;
|
|
151
|
+
const withoutLink = t3 === undefined ? false : t3;
|
|
152
|
+
const linkUnderlineColor = t4 === undefined ? null : t4;
|
|
153
|
+
const className = t5 === undefined ? null : t5;
|
|
154
|
+
const backgroundClassName = t6 === undefined ? null : t6;
|
|
155
|
+
const collaboratorClassName = t7 === undefined ? null : t7;
|
|
156
|
+
const shouldLoad = t8 === undefined ? true : t8;
|
|
157
|
+
let t9;
|
|
158
|
+
if ($[10] !== author) {
|
|
159
|
+
t9 = author || {};
|
|
160
|
+
$[10] = author;
|
|
161
|
+
$[11] = t9;
|
|
162
|
+
} else {
|
|
163
|
+
t9 = $[11];
|
|
164
|
+
}
|
|
165
|
+
const {
|
|
166
|
+
name: t10,
|
|
167
|
+
image: t11,
|
|
168
|
+
url: t12,
|
|
169
|
+
collaborator: t13
|
|
170
|
+
} = t9;
|
|
171
|
+
const name = t10 === undefined ? null : t10;
|
|
172
|
+
const image = t11 === undefined ? null : t11;
|
|
173
|
+
const url = t12 === undefined ? null : t12;
|
|
174
|
+
const collaborator = t13 === undefined ? null : t13;
|
|
175
|
+
const withAvatar = withImage && image !== null;
|
|
176
|
+
let t14;
|
|
177
|
+
if ($[12] !== backgroundClassName || $[13] !== name) {
|
|
178
|
+
t14 = isTextFilled(name) ? /*#__PURE__*/jsx(Text, {
|
|
179
|
+
className: classNames([styles.name, backgroundClassName]),
|
|
180
|
+
...name
|
|
181
|
+
}) : null;
|
|
182
|
+
$[12] = backgroundClassName;
|
|
183
|
+
$[13] = name;
|
|
184
|
+
$[14] = t14;
|
|
185
|
+
} else {
|
|
186
|
+
t14 = $[14];
|
|
187
|
+
}
|
|
188
|
+
const authorText = t14;
|
|
189
|
+
let t15;
|
|
190
|
+
if ($[15] !== collaborator) {
|
|
191
|
+
t15 = isTextFilled(collaborator) ? /*#__PURE__*/jsx(Text, {
|
|
192
|
+
className: styles.collaboratorText,
|
|
193
|
+
...collaborator,
|
|
194
|
+
inline: true
|
|
195
|
+
}) : null;
|
|
196
|
+
$[15] = collaborator;
|
|
197
|
+
$[16] = t15;
|
|
198
|
+
} else {
|
|
199
|
+
t15 = $[16];
|
|
200
|
+
}
|
|
201
|
+
const collaboratorText = t15;
|
|
202
|
+
let t16;
|
|
203
|
+
if ($[17] !== className) {
|
|
204
|
+
t16 = classNames([styles.container, className]);
|
|
205
|
+
$[17] = className;
|
|
206
|
+
$[18] = t16;
|
|
207
|
+
} else {
|
|
208
|
+
t16 = $[18];
|
|
209
|
+
}
|
|
210
|
+
let t17;
|
|
211
|
+
if ($[19] !== image || $[20] !== shouldLoad || $[21] !== withAvatar) {
|
|
212
|
+
t17 = withAvatar ? /*#__PURE__*/jsx(Avatar, {
|
|
91
213
|
className: styles.image,
|
|
92
214
|
image: image,
|
|
93
215
|
shouldLoad: shouldLoad
|
|
94
|
-
}) : null
|
|
216
|
+
}) : null;
|
|
217
|
+
$[19] = image;
|
|
218
|
+
$[20] = shouldLoad;
|
|
219
|
+
$[21] = withAvatar;
|
|
220
|
+
$[22] = t17;
|
|
221
|
+
} else {
|
|
222
|
+
t17 = $[22];
|
|
223
|
+
}
|
|
224
|
+
let t18;
|
|
225
|
+
if ($[23] !== authorText || $[24] !== linkUnderlineColor || $[25] !== url || $[26] !== withoutLink) {
|
|
226
|
+
t18 = url !== null && !withoutLink ? /*#__PURE__*/jsx(Link, {
|
|
227
|
+
className: styles.link,
|
|
228
|
+
url: url,
|
|
229
|
+
external: true,
|
|
230
|
+
style: {
|
|
231
|
+
backgroundImage: linkUnderlineColor !== null ? `linear-gradient(0deg, ${linkUnderlineColor} 0, ${linkUnderlineColor})` : null
|
|
232
|
+
},
|
|
233
|
+
children: authorText
|
|
234
|
+
}) : /*#__PURE__*/jsx("div", {
|
|
235
|
+
children: authorText
|
|
236
|
+
});
|
|
237
|
+
$[23] = authorText;
|
|
238
|
+
$[24] = linkUnderlineColor;
|
|
239
|
+
$[25] = url;
|
|
240
|
+
$[26] = withoutLink;
|
|
241
|
+
$[27] = t18;
|
|
242
|
+
} else {
|
|
243
|
+
t18 = $[27];
|
|
244
|
+
}
|
|
245
|
+
let t19;
|
|
246
|
+
if ($[28] !== collaboratorClassName || $[29] !== collaboratorText) {
|
|
247
|
+
t19 = collaboratorText !== null ? /*#__PURE__*/jsx("div", {
|
|
248
|
+
className: classNames([styles.collaborator, collaboratorClassName]),
|
|
249
|
+
children: collaboratorText !== null ? collaboratorText : null
|
|
250
|
+
}) : null;
|
|
251
|
+
$[28] = collaboratorClassName;
|
|
252
|
+
$[29] = collaboratorText;
|
|
253
|
+
$[30] = t19;
|
|
254
|
+
} else {
|
|
255
|
+
t19 = $[30];
|
|
256
|
+
}
|
|
257
|
+
let t20;
|
|
258
|
+
if ($[31] !== t18 || $[32] !== t19) {
|
|
259
|
+
t20 = /*#__PURE__*/jsxs("div", {
|
|
95
260
|
className: styles.right,
|
|
96
|
-
children: [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
})
|
|
111
|
-
|
|
261
|
+
children: [t18, t19]
|
|
262
|
+
});
|
|
263
|
+
$[31] = t18;
|
|
264
|
+
$[32] = t19;
|
|
265
|
+
$[33] = t20;
|
|
266
|
+
} else {
|
|
267
|
+
t20 = $[33];
|
|
268
|
+
}
|
|
269
|
+
let t21;
|
|
270
|
+
if ($[34] !== otherProps || $[35] !== t16 || $[36] !== t17 || $[37] !== t20) {
|
|
271
|
+
t21 = /*#__PURE__*/jsxs("div", {
|
|
272
|
+
className: t16,
|
|
273
|
+
...otherProps,
|
|
274
|
+
children: [t17, t20]
|
|
275
|
+
});
|
|
276
|
+
$[34] = otherProps;
|
|
277
|
+
$[35] = t16;
|
|
278
|
+
$[36] = t17;
|
|
279
|
+
$[37] = t20;
|
|
280
|
+
$[38] = t21;
|
|
281
|
+
} else {
|
|
282
|
+
t21 = $[38];
|
|
283
|
+
}
|
|
284
|
+
return t21;
|
|
112
285
|
}
|
|
113
286
|
|
|
114
287
|
export { Author as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-author",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.74",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
"type": "module",
|
|
34
34
|
"module": "es/index.js",
|
|
35
35
|
"types": "es/index.d.ts",
|
|
36
|
+
"style": "./assets/css/styles.css",
|
|
36
37
|
"exports": {
|
|
37
38
|
".": {
|
|
38
39
|
"import": "./es/index.js",
|
|
40
|
+
"style": "./assets/css/styles.css",
|
|
39
41
|
"types": "./es/index.d.ts"
|
|
40
42
|
},
|
|
41
43
|
"./assets/css/styles": "./assets/css/styles.css",
|
|
@@ -52,19 +54,19 @@
|
|
|
52
54
|
"build": "../../scripts/prepare-package.sh --types"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
|
-
"react": "^
|
|
56
|
-
"react-dom": "^
|
|
57
|
+
"react": "^19.0.0",
|
|
58
|
+
"react-dom": "^19.0.0"
|
|
57
59
|
},
|
|
58
60
|
"peerDependencies": {
|
|
59
|
-
"react": "^
|
|
60
|
-
"react-dom": "^
|
|
61
|
+
"react": "^19.0.0",
|
|
62
|
+
"react-dom": "^19.0.0"
|
|
61
63
|
},
|
|
62
64
|
"dependencies": {
|
|
63
65
|
"@babel/runtime": "^7.28.6",
|
|
64
|
-
"@micromag/core": "^0.4.
|
|
65
|
-
"@micromag/element-button": "^0.4.
|
|
66
|
-
"@micromag/element-link": "^0.4.
|
|
67
|
-
"@micromag/element-text": "^0.4.
|
|
66
|
+
"@micromag/core": "^0.4.74",
|
|
67
|
+
"@micromag/element-button": "^0.4.74",
|
|
68
|
+
"@micromag/element-link": "^0.4.74",
|
|
69
|
+
"@micromag/element-text": "^0.4.74",
|
|
68
70
|
"classnames": "^2.2.6",
|
|
69
71
|
"lodash": "^4.17.23",
|
|
70
72
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
@@ -74,5 +76,5 @@
|
|
|
74
76
|
"access": "public",
|
|
75
77
|
"registry": "https://registry.npmjs.org/"
|
|
76
78
|
},
|
|
77
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1"
|
|
78
80
|
}
|