@micromag/element-heading 0.4.71 → 0.4.77
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 +206 -53
- package/package.json +9 -7
package/es/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { useId } from 'react';
|
|
5
4
|
import { LinkStyle, HighlightStyle } from '@micromag/core/components';
|
|
@@ -8,69 +7,223 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
8
7
|
|
|
9
8
|
var styles = {"container":"micromag-element-heading-container"};
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
size
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
10
|
+
function Heading(t0) {
|
|
11
|
+
const $ = c(44);
|
|
12
|
+
const {
|
|
13
|
+
size: t1,
|
|
14
|
+
body: t2,
|
|
15
|
+
textStyle: t3,
|
|
16
|
+
linksStyle: t4,
|
|
17
|
+
margin: t5,
|
|
18
|
+
withoutNonBreakingSpaces: t6,
|
|
19
|
+
className: t7,
|
|
20
|
+
headingRef: t8
|
|
21
|
+
} = t0;
|
|
22
|
+
const size = t1 === undefined ? 1 : t1;
|
|
23
|
+
const body = t2 === undefined ? null : t2;
|
|
24
|
+
const textStyle = t3 === undefined ? null : t3;
|
|
25
|
+
const linksStyle = t4 === undefined ? null : t4;
|
|
26
|
+
const margin = t5 === undefined ? null : t5;
|
|
27
|
+
const withoutNonBreakingSpaces = t6 === undefined ? false : t6;
|
|
28
|
+
const className = t7 === undefined ? null : t7;
|
|
29
|
+
const headingRef = t8 === undefined ? null : t8;
|
|
30
|
+
const HeadingComponent = `h${size}`;
|
|
31
|
+
let t9;
|
|
32
|
+
if ($[0] !== textStyle) {
|
|
33
|
+
t9 = textStyle || {};
|
|
34
|
+
$[0] = textStyle;
|
|
35
|
+
$[1] = t9;
|
|
36
|
+
} else {
|
|
37
|
+
t9 = $[1];
|
|
38
|
+
}
|
|
39
|
+
const {
|
|
40
|
+
link: t10,
|
|
41
|
+
highlight: t11
|
|
42
|
+
} = t9;
|
|
43
|
+
const linkStyle = t10 === undefined ? null : t10;
|
|
44
|
+
const highlightStyle = t11 === undefined ? null : t11;
|
|
45
|
+
let finalStyle = null;
|
|
46
|
+
let t12;
|
|
47
|
+
if ($[2] !== linkStyle) {
|
|
48
|
+
t12 = linkStyle !== null ? getStyleFromLink(linkStyle) : null;
|
|
49
|
+
$[2] = linkStyle;
|
|
50
|
+
$[3] = t12;
|
|
51
|
+
} else {
|
|
52
|
+
t12 = $[3];
|
|
53
|
+
}
|
|
54
|
+
let finalLinkStyle = t12;
|
|
55
|
+
let t13;
|
|
56
|
+
if ($[4] !== highlightStyle) {
|
|
57
|
+
t13 = highlightStyle !== null ? getStyleFromHighlight(highlightStyle) : null;
|
|
58
|
+
$[4] = highlightStyle;
|
|
59
|
+
$[5] = t13;
|
|
60
|
+
} else {
|
|
61
|
+
t13 = $[5];
|
|
62
|
+
}
|
|
63
|
+
const finalHighlightStyle = t13;
|
|
38
64
|
if (textStyle !== null) {
|
|
39
|
-
|
|
65
|
+
let t14;
|
|
66
|
+
if ($[6] !== textStyle) {
|
|
67
|
+
t14 = getStyleFromText(textStyle);
|
|
68
|
+
$[6] = textStyle;
|
|
69
|
+
$[7] = t14;
|
|
70
|
+
} else {
|
|
71
|
+
t14 = $[7];
|
|
72
|
+
}
|
|
73
|
+
let t15;
|
|
74
|
+
if ($[8] !== t14) {
|
|
75
|
+
t15 = {
|
|
76
|
+
...null,
|
|
77
|
+
...t14
|
|
78
|
+
};
|
|
79
|
+
$[8] = t14;
|
|
80
|
+
$[9] = t15;
|
|
81
|
+
} else {
|
|
82
|
+
t15 = $[9];
|
|
83
|
+
}
|
|
84
|
+
finalStyle = t15;
|
|
40
85
|
}
|
|
41
86
|
if (margin !== null) {
|
|
42
|
-
|
|
87
|
+
const t14 = finalStyle;
|
|
88
|
+
let t15;
|
|
89
|
+
if ($[10] !== margin) {
|
|
90
|
+
t15 = getStyleFromMargin(margin);
|
|
91
|
+
$[10] = margin;
|
|
92
|
+
$[11] = t15;
|
|
93
|
+
} else {
|
|
94
|
+
t15 = $[11];
|
|
95
|
+
}
|
|
96
|
+
let t16;
|
|
97
|
+
if ($[12] !== finalStyle || $[13] !== t15) {
|
|
98
|
+
t16 = {
|
|
99
|
+
...t14,
|
|
100
|
+
...t15
|
|
101
|
+
};
|
|
102
|
+
$[12] = finalStyle;
|
|
103
|
+
$[13] = t15;
|
|
104
|
+
$[14] = t16;
|
|
105
|
+
} else {
|
|
106
|
+
t16 = $[14];
|
|
107
|
+
}
|
|
108
|
+
finalStyle = t16;
|
|
43
109
|
}
|
|
44
110
|
if (linksStyle !== null) {
|
|
45
|
-
|
|
111
|
+
const t14 = finalLinkStyle;
|
|
112
|
+
let t15;
|
|
113
|
+
if ($[15] !== linksStyle) {
|
|
114
|
+
t15 = getStyleFromText(linksStyle);
|
|
115
|
+
$[15] = linksStyle;
|
|
116
|
+
$[16] = t15;
|
|
117
|
+
} else {
|
|
118
|
+
t15 = $[16];
|
|
119
|
+
}
|
|
120
|
+
let t16;
|
|
121
|
+
if ($[17] !== finalLinkStyle || $[18] !== t15) {
|
|
122
|
+
t16 = {
|
|
123
|
+
...t14,
|
|
124
|
+
...t15
|
|
125
|
+
};
|
|
126
|
+
$[17] = finalLinkStyle;
|
|
127
|
+
$[18] = t15;
|
|
128
|
+
$[19] = t16;
|
|
129
|
+
} else {
|
|
130
|
+
t16 = $[19];
|
|
131
|
+
}
|
|
132
|
+
finalLinkStyle = t16;
|
|
46
133
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
134
|
+
const needsId = finalLinkStyle !== null || highlightStyle !== null;
|
|
135
|
+
const uniqueId = useId();
|
|
136
|
+
const id = needsId ? `heading-component-${uniqueId}` : null;
|
|
137
|
+
let t14;
|
|
138
|
+
if ($[20] !== finalLinkStyle || $[21] !== id) {
|
|
139
|
+
t14 = finalLinkStyle !== null ? /*#__PURE__*/jsx(LinkStyle, {
|
|
140
|
+
selector: `#${cssEscape(id)}`,
|
|
53
141
|
style: finalLinkStyle
|
|
54
|
-
}) : null
|
|
55
|
-
|
|
142
|
+
}) : null;
|
|
143
|
+
$[20] = finalLinkStyle;
|
|
144
|
+
$[21] = id;
|
|
145
|
+
$[22] = t14;
|
|
146
|
+
} else {
|
|
147
|
+
t14 = $[22];
|
|
148
|
+
}
|
|
149
|
+
let t15;
|
|
150
|
+
if ($[23] !== finalHighlightStyle || $[24] !== id) {
|
|
151
|
+
t15 = finalHighlightStyle !== null ? /*#__PURE__*/jsx(HighlightStyle, {
|
|
152
|
+
selector: `#${cssEscape(id)}`,
|
|
56
153
|
style: finalHighlightStyle
|
|
57
|
-
}) : null
|
|
154
|
+
}) : null;
|
|
155
|
+
$[23] = finalHighlightStyle;
|
|
156
|
+
$[24] = id;
|
|
157
|
+
$[25] = t15;
|
|
158
|
+
} else {
|
|
159
|
+
t15 = $[25];
|
|
160
|
+
}
|
|
161
|
+
let t16;
|
|
162
|
+
if ($[26] !== className) {
|
|
163
|
+
t16 = classNames([styles.container, className]);
|
|
164
|
+
$[26] = className;
|
|
165
|
+
$[27] = t16;
|
|
166
|
+
} else {
|
|
167
|
+
t16 = $[27];
|
|
168
|
+
}
|
|
169
|
+
let t17;
|
|
170
|
+
if ($[28] !== body || $[29] !== withoutNonBreakingSpaces) {
|
|
171
|
+
t17 = !withoutNonBreakingSpaces ? addNonBreakingSpaces(body) : body;
|
|
172
|
+
$[28] = body;
|
|
173
|
+
$[29] = withoutNonBreakingSpaces;
|
|
174
|
+
$[30] = t17;
|
|
175
|
+
} else {
|
|
176
|
+
t17 = $[30];
|
|
177
|
+
}
|
|
178
|
+
let t18;
|
|
179
|
+
if ($[31] !== t17) {
|
|
180
|
+
t18 = {
|
|
181
|
+
__html: t17
|
|
182
|
+
};
|
|
183
|
+
$[31] = t17;
|
|
184
|
+
$[32] = t18;
|
|
185
|
+
} else {
|
|
186
|
+
t18 = $[32];
|
|
187
|
+
}
|
|
188
|
+
let t19;
|
|
189
|
+
if ($[33] !== HeadingComponent || $[34] !== finalStyle || $[35] !== headingRef || $[36] !== id || $[37] !== t16 || $[38] !== t18) {
|
|
190
|
+
t19 = /*#__PURE__*/jsx(HeadingComponent, {
|
|
58
191
|
id: id,
|
|
59
|
-
className:
|
|
192
|
+
className: t16,
|
|
60
193
|
style: finalStyle,
|
|
61
|
-
dangerouslySetInnerHTML:
|
|
62
|
-
__html: !withoutNonBreakingSpaces ? addNonBreakingSpaces(body) : body
|
|
63
|
-
},
|
|
194
|
+
dangerouslySetInnerHTML: t18,
|
|
64
195
|
ref: headingRef
|
|
65
|
-
})
|
|
66
|
-
|
|
196
|
+
});
|
|
197
|
+
$[33] = HeadingComponent;
|
|
198
|
+
$[34] = finalStyle;
|
|
199
|
+
$[35] = headingRef;
|
|
200
|
+
$[36] = id;
|
|
201
|
+
$[37] = t16;
|
|
202
|
+
$[38] = t18;
|
|
203
|
+
$[39] = t19;
|
|
204
|
+
} else {
|
|
205
|
+
t19 = $[39];
|
|
206
|
+
}
|
|
207
|
+
let t20;
|
|
208
|
+
if ($[40] !== t14 || $[41] !== t15 || $[42] !== t19) {
|
|
209
|
+
t20 = /*#__PURE__*/jsxs(Fragment, {
|
|
210
|
+
children: [t14, t15, t19]
|
|
211
|
+
});
|
|
212
|
+
$[40] = t14;
|
|
213
|
+
$[41] = t15;
|
|
214
|
+
$[42] = t19;
|
|
215
|
+
$[43] = t20;
|
|
216
|
+
} else {
|
|
217
|
+
t20 = $[43];
|
|
218
|
+
}
|
|
219
|
+
return t20;
|
|
67
220
|
}
|
|
68
|
-
var Heading_default = (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
221
|
+
var Heading_default = ({
|
|
222
|
+
ref,
|
|
223
|
+
...props
|
|
224
|
+
}) => /*#__PURE__*/jsx(Heading, {
|
|
225
|
+
headingRef: ref,
|
|
226
|
+
...props
|
|
74
227
|
});
|
|
75
228
|
|
|
76
229
|
export { Heading_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-heading",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.77",
|
|
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,16 +53,16 @@
|
|
|
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
|
-
"@micromag/core": "^0.4.
|
|
65
|
+
"@micromag/core": "^0.4.77",
|
|
64
66
|
"classnames": "^2.2.6",
|
|
65
67
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
66
68
|
"uuid": "^9.0.0"
|
|
@@ -69,6 +71,6 @@
|
|
|
69
71
|
"access": "public",
|
|
70
72
|
"registry": "https://registry.npmjs.org/"
|
|
71
73
|
},
|
|
72
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "b55c2c748383d30c8ff0ca7594e499dbdc8d1c10",
|
|
73
75
|
"types": "es/index.d.ts"
|
|
74
76
|
}
|