@micromag/element-heading 0.4.71 → 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.
Files changed (2) hide show
  1. package/es/index.js +206 -53
  2. package/package.json +9 -7
package/es/index.js CHANGED
@@ -1,5 +1,4 @@
1
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
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
- var _excluded = ["ref"];
12
- function Heading(_ref) {
13
- var _ref$size = _ref.size,
14
- size = _ref$size === void 0 ? 1 : _ref$size,
15
- _ref$body = _ref.body,
16
- body = _ref$body === void 0 ? null : _ref$body,
17
- _ref$textStyle = _ref.textStyle,
18
- textStyle = _ref$textStyle === void 0 ? null : _ref$textStyle,
19
- _ref$linksStyle = _ref.linksStyle,
20
- linksStyle = _ref$linksStyle === void 0 ? null : _ref$linksStyle,
21
- _ref$margin = _ref.margin,
22
- margin = _ref$margin === void 0 ? null : _ref$margin,
23
- _ref$withoutNonBreaki = _ref.withoutNonBreakingSpaces,
24
- withoutNonBreakingSpaces = _ref$withoutNonBreaki === void 0 ? false : _ref$withoutNonBreaki,
25
- _ref$className = _ref.className,
26
- className = _ref$className === void 0 ? null : _ref$className,
27
- _ref$headingRef = _ref.headingRef,
28
- headingRef = _ref$headingRef === void 0 ? null : _ref$headingRef;
29
- var HeadingComponent = "h".concat(size);
30
- var _ref2 = textStyle || {},
31
- _ref2$link = _ref2.link,
32
- linkStyle = _ref2$link === void 0 ? null : _ref2$link,
33
- _ref2$highlight = _ref2.highlight,
34
- highlightStyle = _ref2$highlight === void 0 ? null : _ref2$highlight;
35
- var finalStyle = null;
36
- var finalLinkStyle = linkStyle !== null ? getStyleFromLink(linkStyle) : null;
37
- var finalHighlightStyle = highlightStyle !== null ? getStyleFromHighlight(highlightStyle) : null;
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
- finalStyle = _objectSpread(_objectSpread({}, finalStyle), getStyleFromText(textStyle));
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
- finalStyle = _objectSpread(_objectSpread({}, finalStyle), getStyleFromMargin(margin));
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
- finalLinkStyle = _objectSpread(_objectSpread({}, finalLinkStyle), getStyleFromText(linksStyle));
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
- var needsId = finalLinkStyle !== null || highlightStyle !== null;
48
- var uniqueId = useId();
49
- var id = needsId ? "heading-component-".concat(uniqueId) : null;
50
- return /*#__PURE__*/jsxs(Fragment, {
51
- children: [finalLinkStyle !== null ? /*#__PURE__*/jsx(LinkStyle, {
52
- selector: "#".concat(cssEscape(id)),
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, finalHighlightStyle !== null ? /*#__PURE__*/jsx(HighlightStyle, {
55
- selector: "#".concat(cssEscape(id)),
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, /*#__PURE__*/jsx(HeadingComponent, {
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: classNames([styles.container, 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 = (function (_ref3) {
69
- var ref = _ref3.ref,
70
- props = _objectWithoutProperties(_ref3, _excluded);
71
- return /*#__PURE__*/jsx(Heading, _objectSpread({
72
- headingRef: ref
73
- }, props));
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.71",
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,16 +53,16 @@
51
53
  "build": "../../scripts/prepare-package.sh --types"
52
54
  },
53
55
  "devDependencies": {
54
- "react": "^18.3.0 || ^19.0.0",
55
- "react-dom": "^18.3.0 || ^19.0.0"
56
+ "react": "^19.0.0",
57
+ "react-dom": "^19.0.0"
56
58
  },
57
59
  "peerDependencies": {
58
- "react": "^18.3.0 || ^19.0.0",
59
- "react-dom": "^18.3.0 || ^19.0.0"
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.71",
65
+ "@micromag/core": "^0.4.74",
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": "9101554bc5761e32b4a002a10d26800608c69773",
74
+ "gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1",
73
75
  "types": "es/index.d.ts"
74
76
  }