@storybook/addon-docs 7.0.0-alpha.1 → 7.0.0-alpha.2

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.
@@ -1,74 +1,34 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.js");
4
-
5
- require("core-js/modules/es.symbol.description.js");
6
-
7
- require("core-js/modules/es.object.to-string.js");
8
-
9
- require("core-js/modules/es.symbol.iterator.js");
10
-
11
- require("core-js/modules/es.array.iterator.js");
12
-
13
- require("core-js/modules/es.string.iterator.js");
14
-
15
- require("core-js/modules/web.dom-collections.iterator.js");
16
-
17
- require("core-js/modules/es.array.from.js");
18
-
19
- require("core-js/modules/es.function.name.js");
20
-
21
3
  Object.defineProperty(exports, "__esModule", {
22
4
  value: true
23
5
  });
24
6
  exports.enhanceSource = void 0;
25
7
 
26
- require("core-js/modules/es.array.join.js");
27
-
28
- require("core-js/modules/es.array.concat.js");
29
-
30
- require("core-js/modules/es.array.slice.js");
31
-
32
- require("core-js/modules/es.regexp.exec.js");
33
-
34
- require("core-js/modules/es.string.replace.js");
35
-
36
- require("core-js/modules/es.string.split.js");
37
-
38
8
  var _store = require("@storybook/store");
39
9
 
40
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
41
-
42
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
43
-
44
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
45
-
46
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
47
-
48
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
49
-
50
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
51
-
52
10
  /**
53
11
  * given a location, extract the text from the full source
54
12
  */
55
13
  function extractSource(location, lines) {
56
- var start = location.startBody,
57
- end = location.endBody;
14
+ const {
15
+ startBody: start,
16
+ endBody: end
17
+ } = location;
58
18
 
59
19
  if (start.line === end.line && lines[start.line - 1] !== undefined) {
60
20
  return lines[start.line - 1].substring(start.col, end.col);
61
21
  } // NOTE: storysource locations are 1-based not 0-based!
62
22
 
63
23
 
64
- var startLine = lines[start.line - 1];
65
- var endLine = lines[end.line - 1];
24
+ const startLine = lines[start.line - 1];
25
+ const endLine = lines[end.line - 1];
66
26
 
67
27
  if (startLine === undefined || endLine === undefined) {
68
28
  return null;
69
29
  }
70
30
 
71
- return [startLine.substring(start.col)].concat(_toConsumableArray(lines.slice(start.line, end.line - 1)), [endLine.substring(0, end.col)]).join('\n');
31
+ return [startLine.substring(start.col), ...lines.slice(start.line, end.line - 1), endLine.substring(0, end.col)].join('\n');
72
32
  } // ============================================================
73
33
  // END @storybook/source-loader/extract-source
74
34
  // ============================================================
@@ -78,49 +38,52 @@ function extractSource(location, lines) {
78
38
  * Replaces full story id name like: story-kind--story-name -> story-name
79
39
  * @param id
80
40
  */
81
- var storyIdToSanitizedStoryName = function storyIdToSanitizedStoryName(id) {
82
- return id.replace(/^.*?--/, '');
83
- };
84
-
85
- var extract = function extract(targetId, _ref) {
86
- var source = _ref.source,
87
- locationsMap = _ref.locationsMap;
41
+ const storyIdToSanitizedStoryName = id => id.replace(/^.*?--/, '');
88
42
 
43
+ const extract = (targetId, {
44
+ source,
45
+ locationsMap
46
+ }) => {
89
47
  if (!locationsMap) {
90
48
  return source;
91
49
  }
92
50
 
93
- var sanitizedStoryName = storyIdToSanitizedStoryName(targetId);
94
- var location = locationsMap[sanitizedStoryName];
51
+ const sanitizedStoryName = storyIdToSanitizedStoryName(targetId);
52
+ const location = locationsMap[sanitizedStoryName];
95
53
 
96
54
  if (!location) {
97
55
  return source;
98
56
  }
99
57
 
100
- var lines = source.split('\n');
58
+ const lines = source.split('\n');
101
59
  return extractSource(location, lines);
102
60
  };
103
61
 
104
- var enhanceSource = function enhanceSource(story) {
62
+ const enhanceSource = story => {
105
63
  var _docs$source;
106
64
 
107
- var id = story.id,
108
- parameters = story.parameters;
109
- var storySource = parameters.storySource,
110
- _parameters$docs = parameters.docs,
111
- docs = _parameters$docs === void 0 ? {} : _parameters$docs;
112
- var transformSource = docs.transformSource; // no input or user has manually overridden the output
65
+ const {
66
+ id,
67
+ parameters
68
+ } = story;
69
+ const {
70
+ storySource,
71
+ docs = {}
72
+ } = parameters;
73
+ const {
74
+ transformSource
75
+ } = docs; // no input or user has manually overridden the output
113
76
 
114
77
  if (!(storySource !== null && storySource !== void 0 && storySource.source) || (_docs$source = docs.source) !== null && _docs$source !== void 0 && _docs$source.code) {
115
78
  return null;
116
79
  }
117
80
 
118
- var input = extract(id, storySource);
119
- var code = transformSource ? transformSource(input, story) : input;
81
+ const input = extract(id, storySource);
82
+ const code = transformSource ? transformSource(input, story) : input;
120
83
  return {
121
84
  docs: (0, _store.combineParameters)(docs, {
122
85
  source: {
123
- code: code
86
+ code
124
87
  }
125
88
  })
126
89
  };
@@ -1,11 +1,5 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.to-string.js");
4
-
5
- require("core-js/modules/web.dom-collections.for-each.js");
6
-
7
- require("core-js/modules/es.object.keys.js");
8
-
9
3
  Object.defineProperty(exports, "__esModule", {
10
4
  value: true
11
5
  });
@@ -18,31 +12,31 @@ var _exportNames = {
18
12
  };
19
13
  Object.defineProperty(exports, "ColorItem", {
20
14
  enumerable: true,
21
- get: function get() {
15
+ get: function () {
22
16
  return _components.ColorItem;
23
17
  }
24
18
  });
25
19
  Object.defineProperty(exports, "ColorPalette", {
26
20
  enumerable: true,
27
- get: function get() {
21
+ get: function () {
28
22
  return _components.ColorPalette;
29
23
  }
30
24
  });
31
25
  Object.defineProperty(exports, "IconGallery", {
32
26
  enumerable: true,
33
- get: function get() {
27
+ get: function () {
34
28
  return _components.IconGallery;
35
29
  }
36
30
  });
37
31
  Object.defineProperty(exports, "IconItem", {
38
32
  enumerable: true,
39
- get: function get() {
33
+ get: function () {
40
34
  return _components.IconItem;
41
35
  }
42
36
  });
43
37
  Object.defineProperty(exports, "Typeset", {
44
38
  enumerable: true,
45
- get: function get() {
39
+ get: function () {
46
40
  return _components.Typeset;
47
41
  }
48
42
  });
@@ -57,7 +51,7 @@ Object.keys(_Anchor).forEach(function (key) {
57
51
  if (key in exports && exports[key] === _Anchor[key]) return;
58
52
  Object.defineProperty(exports, key, {
59
53
  enumerable: true,
60
- get: function get() {
54
+ get: function () {
61
55
  return _Anchor[key];
62
56
  }
63
57
  });
@@ -71,7 +65,7 @@ Object.keys(_ArgsTable).forEach(function (key) {
71
65
  if (key in exports && exports[key] === _ArgsTable[key]) return;
72
66
  Object.defineProperty(exports, key, {
73
67
  enumerable: true,
74
- get: function get() {
68
+ get: function () {
75
69
  return _ArgsTable[key];
76
70
  }
77
71
  });
@@ -85,7 +79,7 @@ Object.keys(_Canvas).forEach(function (key) {
85
79
  if (key in exports && exports[key] === _Canvas[key]) return;
86
80
  Object.defineProperty(exports, key, {
87
81
  enumerable: true,
88
- get: function get() {
82
+ get: function () {
89
83
  return _Canvas[key];
90
84
  }
91
85
  });
@@ -99,7 +93,7 @@ Object.keys(_Description).forEach(function (key) {
99
93
  if (key in exports && exports[key] === _Description[key]) return;
100
94
  Object.defineProperty(exports, key, {
101
95
  enumerable: true,
102
- get: function get() {
96
+ get: function () {
103
97
  return _Description[key];
104
98
  }
105
99
  });
@@ -113,7 +107,7 @@ Object.keys(_DocsContext).forEach(function (key) {
113
107
  if (key in exports && exports[key] === _DocsContext[key]) return;
114
108
  Object.defineProperty(exports, key, {
115
109
  enumerable: true,
116
- get: function get() {
110
+ get: function () {
117
111
  return _DocsContext[key];
118
112
  }
119
113
  });
@@ -127,7 +121,7 @@ Object.keys(_DocsPage).forEach(function (key) {
127
121
  if (key in exports && exports[key] === _DocsPage[key]) return;
128
122
  Object.defineProperty(exports, key, {
129
123
  enumerable: true,
130
- get: function get() {
124
+ get: function () {
131
125
  return _DocsPage[key];
132
126
  }
133
127
  });
@@ -141,7 +135,7 @@ Object.keys(_DocsContainer).forEach(function (key) {
141
135
  if (key in exports && exports[key] === _DocsContainer[key]) return;
142
136
  Object.defineProperty(exports, key, {
143
137
  enumerable: true,
144
- get: function get() {
138
+ get: function () {
145
139
  return _DocsContainer[key];
146
140
  }
147
141
  });
@@ -155,7 +149,7 @@ Object.keys(_DocsStory).forEach(function (key) {
155
149
  if (key in exports && exports[key] === _DocsStory[key]) return;
156
150
  Object.defineProperty(exports, key, {
157
151
  enumerable: true,
158
- get: function get() {
152
+ get: function () {
159
153
  return _DocsStory[key];
160
154
  }
161
155
  });
@@ -169,7 +163,7 @@ Object.keys(_Heading).forEach(function (key) {
169
163
  if (key in exports && exports[key] === _Heading[key]) return;
170
164
  Object.defineProperty(exports, key, {
171
165
  enumerable: true,
172
- get: function get() {
166
+ get: function () {
173
167
  return _Heading[key];
174
168
  }
175
169
  });
@@ -183,7 +177,7 @@ Object.keys(_Meta).forEach(function (key) {
183
177
  if (key in exports && exports[key] === _Meta[key]) return;
184
178
  Object.defineProperty(exports, key, {
185
179
  enumerable: true,
186
- get: function get() {
180
+ get: function () {
187
181
  return _Meta[key];
188
182
  }
189
183
  });
@@ -197,7 +191,7 @@ Object.keys(_Preview).forEach(function (key) {
197
191
  if (key in exports && exports[key] === _Preview[key]) return;
198
192
  Object.defineProperty(exports, key, {
199
193
  enumerable: true,
200
- get: function get() {
194
+ get: function () {
201
195
  return _Preview[key];
202
196
  }
203
197
  });
@@ -211,7 +205,7 @@ Object.keys(_Primary).forEach(function (key) {
211
205
  if (key in exports && exports[key] === _Primary[key]) return;
212
206
  Object.defineProperty(exports, key, {
213
207
  enumerable: true,
214
- get: function get() {
208
+ get: function () {
215
209
  return _Primary[key];
216
210
  }
217
211
  });
@@ -225,7 +219,7 @@ Object.keys(_Props).forEach(function (key) {
225
219
  if (key in exports && exports[key] === _Props[key]) return;
226
220
  Object.defineProperty(exports, key, {
227
221
  enumerable: true,
228
- get: function get() {
222
+ get: function () {
229
223
  return _Props[key];
230
224
  }
231
225
  });
@@ -239,7 +233,7 @@ Object.keys(_Source).forEach(function (key) {
239
233
  if (key in exports && exports[key] === _Source[key]) return;
240
234
  Object.defineProperty(exports, key, {
241
235
  enumerable: true,
242
- get: function get() {
236
+ get: function () {
243
237
  return _Source[key];
244
238
  }
245
239
  });
@@ -253,7 +247,7 @@ Object.keys(_SourceContainer).forEach(function (key) {
253
247
  if (key in exports && exports[key] === _SourceContainer[key]) return;
254
248
  Object.defineProperty(exports, key, {
255
249
  enumerable: true,
256
- get: function get() {
250
+ get: function () {
257
251
  return _SourceContainer[key];
258
252
  }
259
253
  });
@@ -267,7 +261,7 @@ Object.keys(_Stories).forEach(function (key) {
267
261
  if (key in exports && exports[key] === _Stories[key]) return;
268
262
  Object.defineProperty(exports, key, {
269
263
  enumerable: true,
270
- get: function get() {
264
+ get: function () {
271
265
  return _Stories[key];
272
266
  }
273
267
  });
@@ -281,7 +275,7 @@ Object.keys(_Story).forEach(function (key) {
281
275
  if (key in exports && exports[key] === _Story[key]) return;
282
276
  Object.defineProperty(exports, key, {
283
277
  enumerable: true,
284
- get: function get() {
278
+ get: function () {
285
279
  return _Story[key];
286
280
  }
287
281
  });
@@ -295,7 +289,7 @@ Object.keys(_Subheading).forEach(function (key) {
295
289
  if (key in exports && exports[key] === _Subheading[key]) return;
296
290
  Object.defineProperty(exports, key, {
297
291
  enumerable: true,
298
- get: function get() {
292
+ get: function () {
299
293
  return _Subheading[key];
300
294
  }
301
295
  });
@@ -309,7 +303,7 @@ Object.keys(_Subtitle).forEach(function (key) {
309
303
  if (key in exports && exports[key] === _Subtitle[key]) return;
310
304
  Object.defineProperty(exports, key, {
311
305
  enumerable: true,
312
- get: function get() {
306
+ get: function () {
313
307
  return _Subtitle[key];
314
308
  }
315
309
  });
@@ -323,7 +317,7 @@ Object.keys(_Title).forEach(function (key) {
323
317
  if (key in exports && exports[key] === _Title[key]) return;
324
318
  Object.defineProperty(exports, key, {
325
319
  enumerable: true,
326
- get: function get() {
320
+ get: function () {
327
321
  return _Title[key];
328
322
  }
329
323
  });
@@ -337,7 +331,7 @@ Object.keys(_Wrapper).forEach(function (key) {
337
331
  if (key in exports && exports[key] === _Wrapper[key]) return;
338
332
  Object.defineProperty(exports, key, {
339
333
  enumerable: true,
340
- get: function get() {
334
+ get: function () {
341
335
  return _Wrapper[key];
342
336
  }
343
337
  });
@@ -351,7 +345,7 @@ Object.keys(_types).forEach(function (key) {
351
345
  if (key in exports && exports[key] === _types[key]) return;
352
346
  Object.defineProperty(exports, key, {
353
347
  enumerable: true,
354
- get: function get() {
348
+ get: function () {
355
349
  return _types[key];
356
350
  }
357
351
  });
@@ -365,7 +359,7 @@ Object.keys(_mdx).forEach(function (key) {
365
359
  if (key in exports && exports[key] === _mdx[key]) return;
366
360
  Object.defineProperty(exports, key, {
367
361
  enumerable: true,
368
- get: function get() {
362
+ get: function () {
369
363
  return _mdx[key];
370
364
  }
371
365
  });
@@ -1,26 +1,10 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.keys.js");
4
-
5
- require("core-js/modules/es.symbol.js");
6
-
7
3
  Object.defineProperty(exports, "__esModule", {
8
4
  value: true
9
5
  });
10
6
  exports.assertIsFn = exports.HeadersMdx = exports.HeaderMdx = exports.CodeOrSourceMdx = exports.AnchorMdx = exports.AddContext = void 0;
11
7
 
12
- require("core-js/modules/es.object.assign.js");
13
-
14
- require("core-js/modules/es.regexp.exec.js");
15
-
16
- require("core-js/modules/es.string.match.js");
17
-
18
- require("core-js/modules/es.string.split.js");
19
-
20
- require("core-js/modules/es.string.starts-with.js");
21
-
22
- require("core-js/modules/es.object.to-string.js");
23
-
24
8
  var _react = _interopRequireDefault(require("react"));
25
9
 
26
10
  var _addons = require("@storybook/addons");
@@ -35,27 +19,25 @@ var _theming = require("@storybook/theming");
35
19
 
36
20
  var _DocsContext = require("./DocsContext");
37
21
 
38
- var _excluded = ["children"],
39
- _excluded2 = ["className", "children"],
40
- _excluded3 = ["href", "target", "children"],
41
- _excluded4 = ["as", "id", "children"],
42
- _excluded5 = ["as", "id", "children"];
22
+ const _excluded = ["children"],
23
+ _excluded2 = ["className", "children"],
24
+ _excluded3 = ["href", "target", "children"],
25
+ _excluded4 = ["as", "id", "children"],
26
+ _excluded5 = ["as", "id", "children"];
43
27
 
44
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
29
 
46
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
47
-
48
30
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
49
31
 
50
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
51
-
52
32
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
53
33
 
54
- var document = _global.default.document; // Hacky utility for asserting identifiers in MDX Story elements
34
+ const {
35
+ document
36
+ } = _global.default; // Hacky utility for asserting identifiers in MDX Story elements
55
37
 
56
- var assertIsFn = function assertIsFn(val) {
38
+ const assertIsFn = val => {
57
39
  if (typeof val !== 'function') {
58
- throw new Error("Expected story function, got: ".concat(val));
40
+ throw new Error(`Expected story function, got: ${val}`);
59
41
  }
60
42
 
61
43
  return val;
@@ -64,11 +46,13 @@ var assertIsFn = function assertIsFn(val) {
64
46
 
65
47
  exports.assertIsFn = assertIsFn;
66
48
 
67
- var AddContext = function AddContext(props) {
68
- var children = props.children,
69
- rest = _objectWithoutProperties(props, _excluded);
49
+ const AddContext = props => {
50
+ const {
51
+ children
52
+ } = props,
53
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
70
54
 
71
- var parentContext = _react.default.useContext(_DocsContext.DocsContext);
55
+ const parentContext = _react.default.useContext(_DocsContext.DocsContext);
72
56
 
73
57
  return /*#__PURE__*/_react.default.createElement(_DocsContext.DocsContext.Provider, {
74
58
  value: Object.assign({}, parentContext, rest)
@@ -77,10 +61,12 @@ var AddContext = function AddContext(props) {
77
61
 
78
62
  exports.AddContext = AddContext;
79
63
 
80
- var CodeOrSourceMdx = function CodeOrSourceMdx(_ref) {
81
- var className = _ref.className,
82
- children = _ref.children,
83
- rest = _objectWithoutProperties(_ref, _excluded2);
64
+ const CodeOrSourceMdx = _ref => {
65
+ let {
66
+ className,
67
+ children
68
+ } = _ref,
69
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded2);
84
70
 
85
71
  // markdown-to-jsx does not add className to inline code
86
72
  if (typeof className !== 'string' && (typeof children !== 'string' || !children.match(/[\n\r]/g))) {
@@ -88,7 +74,7 @@ var CodeOrSourceMdx = function CodeOrSourceMdx(_ref) {
88
74
  } // className: "lang-jsx"
89
75
 
90
76
 
91
- var language = className && className.split('-');
77
+ const language = className && className.split('-');
92
78
  return /*#__PURE__*/_react.default.createElement(_components.Source, _extends({
93
79
  language: language && language[1] || 'plaintext',
94
80
  format: false,
@@ -103,30 +89,31 @@ function navigate(url) {
103
89
  } // @ts-ignore
104
90
 
105
91
 
106
- var A = _components.components.a;
92
+ const A = _components.components.a;
107
93
 
108
- var AnchorInPage = function AnchorInPage(_ref2) {
109
- var hash = _ref2.hash,
110
- children = _ref2.children;
111
- return /*#__PURE__*/_react.default.createElement(A, {
112
- href: hash,
113
- target: "_self",
114
- onClick: function onClick(event) {
115
- var id = hash.substring(1);
116
- var element = document.getElementById(id);
94
+ const AnchorInPage = ({
95
+ hash,
96
+ children
97
+ }) => /*#__PURE__*/_react.default.createElement(A, {
98
+ href: hash,
99
+ target: "_self",
100
+ onClick: event => {
101
+ const id = hash.substring(1);
102
+ const element = document.getElementById(id);
117
103
 
118
- if (element) {
119
- navigate(hash);
120
- }
104
+ if (element) {
105
+ navigate(hash);
121
106
  }
122
- }, children);
123
- };
107
+ }
108
+ }, children);
124
109
 
125
- var AnchorMdx = function AnchorMdx(props) {
126
- var href = props.href,
127
- target = props.target,
128
- children = props.children,
129
- rest = _objectWithoutProperties(props, _excluded3);
110
+ const AnchorMdx = props => {
111
+ const {
112
+ href,
113
+ target,
114
+ children
115
+ } = props,
116
+ rest = _objectWithoutPropertiesLoose(props, _excluded3);
130
117
 
131
118
  if (href) {
132
119
  // Enable scrolling for in-page anchors.
@@ -140,7 +127,7 @@ var AnchorMdx = function AnchorMdx(props) {
140
127
  if (target !== '_blank' && !href.startsWith('https://')) {
141
128
  return /*#__PURE__*/_react.default.createElement(A, _extends({
142
129
  href: href,
143
- onClick: function onClick(event) {
130
+ onClick: event => {
144
131
  event.preventDefault(); // use the A element's href, which has been modified for
145
132
  // local paths without a `?path=` query param prefix
146
133
 
@@ -156,37 +143,38 @@ var AnchorMdx = function AnchorMdx(props) {
156
143
  };
157
144
 
158
145
  exports.AnchorMdx = AnchorMdx;
159
- var SUPPORTED_MDX_HEADERS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
160
- var OcticonHeaders = SUPPORTED_MDX_HEADERS.reduce(function (acc, headerType) {
161
- return Object.assign({}, acc, _defineProperty({}, headerType, (0, _theming.styled)(_components.components[headerType])({
146
+ const SUPPORTED_MDX_HEADERS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
147
+ const OcticonHeaders = SUPPORTED_MDX_HEADERS.reduce((acc, headerType) => Object.assign({}, acc, {
148
+ // @ts-ignore
149
+ [headerType]: (0, _theming.styled)(_components.components[headerType])({
162
150
  '& svg': {
163
151
  visibility: 'hidden'
164
152
  },
165
153
  '&:hover svg': {
166
154
  visibility: 'visible'
167
155
  }
168
- })));
169
- }, {});
170
-
171
- var OcticonAnchor = _theming.styled.a(function () {
172
- return {
173
- float: 'left',
174
- paddingRight: '4px',
175
- marginLeft: '-20px',
176
- // Allow the theme's text color to override the default link color.
177
- color: 'inherit'
178
- };
179
- });
180
-
181
- var HeaderWithOcticonAnchor = function HeaderWithOcticonAnchor(_ref3) {
182
- var as = _ref3.as,
183
- id = _ref3.id,
184
- children = _ref3.children,
185
- rest = _objectWithoutProperties(_ref3, _excluded4);
156
+ })
157
+ }), {});
158
+
159
+ const OcticonAnchor = _theming.styled.a(() => ({
160
+ float: 'left',
161
+ paddingRight: '4px',
162
+ marginLeft: '-20px',
163
+ // Allow the theme's text color to override the default link color.
164
+ color: 'inherit'
165
+ }));
166
+
167
+ const HeaderWithOcticonAnchor = _ref2 => {
168
+ let {
169
+ as,
170
+ id,
171
+ children
172
+ } = _ref2,
173
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded4);
186
174
 
187
175
  // @ts-ignore
188
- var OcticonHeader = OcticonHeaders[as];
189
- var hash = "#".concat(id);
176
+ const OcticonHeader = OcticonHeaders[as];
177
+ const hash = `#${id}`;
190
178
  return /*#__PURE__*/_react.default.createElement(OcticonHeader, _extends({
191
179
  id: id
192
180
  }, rest), /*#__PURE__*/_react.default.createElement(OcticonAnchor, {
@@ -194,8 +182,8 @@ var HeaderWithOcticonAnchor = function HeaderWithOcticonAnchor(_ref3) {
194
182
  href: hash,
195
183
  tabIndex: -1,
196
184
  target: "_self",
197
- onClick: function onClick(event) {
198
- var element = document.getElementById(id);
185
+ onClick: event => {
186
+ const element = document.getElementById(id);
199
187
 
200
188
  if (element) {
201
189
  navigate(hash);
@@ -214,11 +202,13 @@ var HeaderWithOcticonAnchor = function HeaderWithOcticonAnchor(_ref3) {
214
202
  }))), children);
215
203
  };
216
204
 
217
- var HeaderMdx = function HeaderMdx(props) {
218
- var as = props.as,
219
- id = props.id,
220
- children = props.children,
221
- rest = _objectWithoutProperties(props, _excluded5); // An id should have been added on every header by the "remark-slug" plugin.
205
+ const HeaderMdx = props => {
206
+ const {
207
+ as,
208
+ id,
209
+ children
210
+ } = props,
211
+ rest = _objectWithoutPropertiesLoose(props, _excluded5); // An id should have been added on every header by the "remark-slug" plugin.
222
212
 
223
213
 
224
214
  if (id) {
@@ -229,17 +219,16 @@ var HeaderMdx = function HeaderMdx(props) {
229
219
  } // @ts-ignore
230
220
 
231
221
 
232
- var Header = _components.components[as]; // Make sure it still work if "remark-slug" plugin is not present.
222
+ const Header = _components.components[as]; // Make sure it still work if "remark-slug" plugin is not present.
233
223
 
234
224
  return /*#__PURE__*/_react.default.createElement(Header, props);
235
225
  };
236
226
 
237
227
  exports.HeaderMdx = HeaderMdx;
238
- var HeadersMdx = SUPPORTED_MDX_HEADERS.reduce(function (acc, headerType) {
239
- return Object.assign({}, acc, _defineProperty({}, headerType, function (props) {
240
- return /*#__PURE__*/_react.default.createElement(HeaderMdx, _extends({
241
- as: headerType
242
- }, props));
243
- }));
244
- }, {});
228
+ const HeadersMdx = SUPPORTED_MDX_HEADERS.reduce((acc, headerType) => Object.assign({}, acc, {
229
+ // @ts-ignore
230
+ [headerType]: props => /*#__PURE__*/_react.default.createElement(HeaderMdx, _extends({
231
+ as: headerType
232
+ }, props))
233
+ }), {});
245
234
  exports.HeadersMdx = HeadersMdx;