@atlaskit/code 14.4.6 → 14.4.8

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 (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/__perf__/source-code-examples/100-line-example.tsx +5 -5
  3. package/dist/cjs/bidi-warning/bidi-warning-decorator.js +6 -19
  4. package/dist/cjs/bidi-warning/index.js +0 -2
  5. package/dist/cjs/bidi-warning/ui/index.js +6 -17
  6. package/dist/cjs/bidi-warning/ui/styled.js +6 -11
  7. package/dist/cjs/code-block.js +25 -34
  8. package/dist/cjs/code.js +11 -33
  9. package/dist/cjs/constants.js +0 -2
  10. package/dist/cjs/entry-points/block.js +0 -2
  11. package/dist/cjs/entry-points/constants.js +0 -1
  12. package/dist/cjs/entry-points/inline.js +0 -4
  13. package/dist/cjs/extract-react-types/code-block.js +0 -1
  14. package/dist/cjs/extract-react-types/code.js +0 -1
  15. package/dist/cjs/index.js +0 -7
  16. package/dist/cjs/internal/hooks/use-highlight.js +10 -24
  17. package/dist/cjs/internal/theme/constants.js +2 -3
  18. package/dist/cjs/internal/theme/get-theme.js +0 -16
  19. package/dist/cjs/internal/theme/styles.js +4 -23
  20. package/dist/cjs/internal/utils/get-normalized-language.js +2 -8
  21. package/dist/cjs/react-syntax-highlighter-bidi-warning-renderer.js +17 -41
  22. package/dist/cjs/version.json +1 -1
  23. package/dist/es2019/bidi-warning/bidi-warning-decorator.js +5 -9
  24. package/dist/es2019/bidi-warning/ui/index.js +0 -1
  25. package/dist/es2019/bidi-warning/ui/styled.js +4 -5
  26. package/dist/es2019/code-block.js +5 -3
  27. package/dist/es2019/code.js +0 -7
  28. package/dist/es2019/internal/hooks/use-highlight.js +4 -8
  29. package/dist/es2019/internal/theme/constants.js +2 -1
  30. package/dist/es2019/internal/theme/get-theme.js +2 -3
  31. package/dist/es2019/internal/theme/styles.js +8 -9
  32. package/dist/es2019/internal/utils/get-normalized-language.js +2 -3
  33. package/dist/es2019/react-syntax-highlighter-bidi-warning-renderer.js +14 -21
  34. package/dist/es2019/version.json +1 -1
  35. package/dist/esm/bidi-warning/bidi-warning-decorator.js +6 -16
  36. package/dist/esm/bidi-warning/ui/index.js +6 -9
  37. package/dist/esm/bidi-warning/ui/styled.js +6 -7
  38. package/dist/esm/code-block.js +26 -26
  39. package/dist/esm/code.js +11 -21
  40. package/dist/esm/internal/hooks/use-highlight.js +10 -19
  41. package/dist/esm/internal/theme/constants.js +2 -1
  42. package/dist/esm/internal/theme/get-theme.js +0 -5
  43. package/dist/esm/internal/theme/styles.js +4 -10
  44. package/dist/esm/internal/utils/get-normalized-language.js +2 -3
  45. package/dist/esm/react-syntax-highlighter-bidi-warning-renderer.js +20 -33
  46. package/dist/esm/version.json +1 -1
  47. package/package.json +2 -2
@@ -1,46 +1,39 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
-
6
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
-
8
5
  import { useCallback, useMemo } from 'react';
9
6
  var DEFAULT_LINE_EL_ATTR_OBJ = {
10
7
  'data-ds--code--row': ''
11
8
  };
12
-
13
9
  var getLineStyleObject = function getLineStyleObject(lineNumber, testId) {
14
10
  return testId ? _objectSpread({
15
11
  'data-testid': "".concat(testId, "-line-").concat(lineNumber)
16
12
  }, DEFAULT_LINE_EL_ATTR_OBJ) : DEFAULT_LINE_EL_ATTR_OBJ;
17
13
  };
18
-
19
14
  export var useHighlightLines = function useHighlightLines(_ref) {
20
15
  var _ref$highlight = _ref.highlight,
21
- highlight = _ref$highlight === void 0 ? '' : _ref$highlight,
22
- testId = _ref.testId;
16
+ highlight = _ref$highlight === void 0 ? '' : _ref$highlight,
17
+ testId = _ref.testId;
23
18
  var highlightedLines = useMemo(function () {
24
19
  if (!highlight) {
25
20
  return [];
26
21
  }
27
-
28
22
  return highlight.split(',').map(function (num) {
29
23
  if (num.indexOf('-') > 0) {
30
24
  // We found a line group, e.g. 1-3
31
- var _num$split$map$sort = num.split('-').map(Number) // Sort by lowest value first, highest value last.
32
- .sort(function (a, b) {
33
- return a - b;
34
- }),
35
- _num$split$map$sort2 = _slicedToArray(_num$split$map$sort, 2),
36
- from = _num$split$map$sort2[0],
37
- to = _num$split$map$sort2[1];
38
-
25
+ var _num$split$map$sort = num.split('-').map(Number)
26
+ // Sort by lowest value first, highest value last.
27
+ .sort(function (a, b) {
28
+ return a - b;
29
+ }),
30
+ _num$split$map$sort2 = _slicedToArray(_num$split$map$sort, 2),
31
+ from = _num$split$map$sort2[0],
32
+ to = _num$split$map$sort2[1];
39
33
  return Array(to + 1).fill(undefined).map(function (_, index) {
40
34
  return index;
41
35
  }).slice(from, to + 1);
42
36
  }
43
-
44
37
  return Number(num);
45
38
  }).reduce(function (acc, val) {
46
39
  return acc.concat(val);
@@ -50,14 +43,12 @@ export var useHighlightLines = function useHighlightLines(_ref) {
50
43
  if (!highlight || highlightedLines.length === 0) {
51
44
  return getLineStyleObject(lineNumber, testId);
52
45
  }
53
-
54
46
  if (highlightedLines.includes(lineNumber)) {
55
47
  var highlightedDataAttrObj = {
56
48
  'data-ds--code--row--highlight': ''
57
49
  };
58
50
  return _objectSpread(_objectSpread({}, highlightedDataAttrObj), getLineStyleObject(lineNumber, testId));
59
51
  }
60
-
61
52
  return getLineStyleObject(lineNumber, testId);
62
53
  }, [highlight, testId]);
63
54
  return {
@@ -5,6 +5,7 @@ export var HIGHLIGHT_BORDER_WIDTH = '4px';
5
5
  export var SPACING = gridSize();
6
6
  export var LINE_NUMBER_GUTTER = SPACING * 2;
7
7
  export var VAR_CODE_LINE_NUMBER_BG_COLOR = '--ds--code--line-number-bg-color';
8
- export var VAR_CODE_BG_COLOR = '--ds--code--bg-color'; // selector for codeblock
8
+ export var VAR_CODE_BG_COLOR = '--ds--code--bg-color';
9
9
 
10
+ // selector for codeblock
10
11
  export var CODE_BLOCK_SELECTOR = "data-ds--code--code-block";
@@ -1,9 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  import memoizeOne from 'memoize-one';
8
5
  import * as colors from '@atlaskit/theme/colors';
9
6
  import { themed } from '@atlaskit/theme/components';
@@ -229,9 +226,7 @@ export var getColorPalette = memoizeOne(function (theme) {
229
226
  })(akTheme)
230
227
  };
231
228
  });
232
-
233
229
  var getTheme = function getTheme(theme) {
234
230
  return _objectSpread(_objectSpread({}, getBaseTheme(theme)), getColorPalette(theme));
235
231
  };
236
-
237
232
  export default getTheme;
@@ -1,9 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  import { borderRadius } from '@atlaskit/theme/constants';
8
5
  import { CODE_FONT_SIZE, CODE_LINE_HEIGHT, HIGHLIGHT_BORDER_WIDTH, LINE_NUMBER_GUTTER, SPACING, VAR_CODE_BG_COLOR, VAR_CODE_LINE_NUMBER_BG_COLOR } from './constants';
9
6
  import { getBaseTheme, getColorPalette } from './get-theme';
@@ -11,10 +8,8 @@ export var getLineNumWidth = function getLineNumWidth(numLines) {
11
8
  if (!numLines) {
12
9
  return '1ch';
13
10
  }
14
-
15
11
  return "".concat(numLines.toFixed(0).length, "ch");
16
12
  };
17
-
18
13
  var lineNumberStyle = function lineNumberStyle(theme) {
19
14
  return {
20
15
  // width of the line number gutter
@@ -34,9 +29,9 @@ var lineNumberStyle = function lineNumberStyle(theme) {
34
29
  // this is to fix SSR spacing issue
35
30
  display: 'block'
36
31
  };
37
- }; // order of these keys does matter as it will affect the css precedence
38
-
32
+ };
39
33
 
34
+ // order of these keys does matter as it will affect the css precedence
40
35
  var syntaxKeywordColors = function syntaxKeywordColors(theme) {
41
36
  return {
42
37
  '.token': {
@@ -184,11 +179,10 @@ var syntaxKeywordColors = function syntaxKeywordColors(theme) {
184
179
  }
185
180
  };
186
181
  };
182
+
187
183
  /**
188
184
  * Styles applied at the root element level, common across code/codeblock
189
185
  */
190
-
191
-
192
186
  export var getBaseCodeStyles = function getBaseCodeStyles(theme) {
193
187
  return {
194
188
  fontSize: CODE_FONT_SIZE,
@@ -200,13 +194,13 @@ export var getBaseCodeStyles = function getBaseCodeStyles(theme) {
200
194
  borderRadius: "".concat(borderRadius(), "px")
201
195
  };
202
196
  };
197
+
203
198
  /**
204
199
  * Takes an implemented CodeBlock theme, and returns styles required for
205
200
  * react-syntax-highlighter.
206
201
  *
207
202
  * @param theme
208
203
  */
209
-
210
204
  export var getCodeBlockStyles = function getCodeBlockStyles(theme) {
211
205
  return function (highlightedStartText, highlightedEndText, hasLineNumbers) {
212
206
  return _objectSpread(_objectSpread(_objectSpread({
@@ -4,10 +4,9 @@ export var normalizeLanguage = memoizeOne(function (language) {
4
4
  if (!language) {
5
5
  return '';
6
6
  }
7
-
8
7
  var match = SUPPORTED_LANGUAGES.find(function (val) {
9
8
  return val.name === language || val.alias.includes(language);
10
- }); // Fallback to plain monospaced text if language passed but not supported
11
-
9
+ });
10
+ // Fallback to plain monospaced text if language passed but not supported
12
11
  return match ? match.value : 'text';
13
12
  });
@@ -1,14 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
-
6
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
-
8
5
  // @ts-nocheck
9
6
  import React from 'react';
10
7
  import CodeBidiWarning from './bidi-warning';
11
- import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator'; // File mostly vendored from react-syntax-highlighter
8
+ import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
9
+
10
+ // File mostly vendored from react-syntax-highlighter
12
11
  //
13
12
  // - https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/efc3f7b7537d1729193b7a472067bcbe6cbecaf1/src/highlight.js#L272-L281
14
13
  // - https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/efc3f7b7537d1729193b7a472067bcbe6cbecaf1/src/create-element.js
@@ -18,8 +17,8 @@ import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator'; //
18
17
  export function createBidiWarningRenderer(codeBidiWarningConfig) {
19
18
  return function bidiWarningRenderer(_ref) {
20
19
  var rows = _ref.rows,
21
- stylesheet = _ref.stylesheet,
22
- useInlineStyles = _ref.useInlineStyles;
20
+ stylesheet = _ref.stylesheet,
21
+ useInlineStyles = _ref.useInlineStyles;
23
22
  return rows.map(function (node, i) {
24
23
  return createElement({
25
24
  node: node,
@@ -30,50 +29,41 @@ export function createBidiWarningRenderer(codeBidiWarningConfig) {
30
29
  });
31
30
  });
32
31
  };
33
- } // Get all possible permutations of all power sets
32
+ }
33
+
34
+ // Get all possible permutations of all power sets
34
35
  //
35
36
  // Super simple, non-algorithmic solution since the
36
37
  // number of class names will not be greater than 4
37
-
38
38
  function powerSetPermutations(arr) {
39
39
  var arrLength = arr.length;
40
-
41
40
  if (arrLength === 0 || arrLength === 1) {
42
41
  return arr;
43
42
  }
44
-
45
43
  if (arrLength === 2) {
46
44
  // prettier-ignore
47
45
  return [arr[0], arr[1], "".concat(arr[0], ".").concat(arr[1]), "".concat(arr[1], ".").concat(arr[0])];
48
46
  }
49
-
50
47
  if (arrLength === 3) {
51
48
  return [arr[0], arr[1], arr[2], "".concat(arr[0], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[2]), "".concat(arr[2], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0])];
52
49
  }
53
-
54
50
  if (arrLength >= 4) {
55
51
  // Currently does not support more than 4 extra
56
52
  // class names (after `.token` has been removed)
57
53
  return [arr[0], arr[1], arr[2], arr[3], "".concat(arr[0], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[3]), "".concat(arr[3], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[3]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[3]), "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[2]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2], ".").concat(arr[3]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[3], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1], ".").concat(arr[3]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[3], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[3], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[3], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[3], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[3], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[1], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[1], ".").concat(arr[0])];
58
54
  }
59
55
  }
60
-
61
56
  var classNameCombinations = {};
62
-
63
57
  function getClassNameCombinations(classNames) {
64
58
  if (classNames.length === 0 || classNames.length === 1) {
65
59
  return classNames;
66
60
  }
67
-
68
61
  var key = classNames.join('.');
69
-
70
62
  if (!classNameCombinations[key]) {
71
63
  classNameCombinations[key] = powerSetPermutations(classNames);
72
64
  }
73
-
74
65
  return classNameCombinations[key];
75
66
  }
76
-
77
67
  export function createStyleObject(classNames) {
78
68
  var elementStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
79
69
  var stylesheet = arguments.length > 2 ? arguments[2] : undefined;
@@ -103,27 +93,25 @@ export function createChildren(stylesheet, useInlineStyles, codeBidiWarningConfi
103
93
  });
104
94
  };
105
95
  }
106
-
107
96
  function createElement(_ref2) {
108
97
  var node = _ref2.node,
109
- stylesheet = _ref2.stylesheet,
110
- _ref2$style = _ref2.style,
111
- style = _ref2$style === void 0 ? {} : _ref2$style,
112
- useInlineStyles = _ref2.useInlineStyles,
113
- codeBidiWarningConfig = _ref2.codeBidiWarningConfig,
114
- key = _ref2.key;
98
+ stylesheet = _ref2.stylesheet,
99
+ _ref2$style = _ref2.style,
100
+ style = _ref2$style === void 0 ? {} : _ref2$style,
101
+ useInlineStyles = _ref2.useInlineStyles,
102
+ codeBidiWarningConfig = _ref2.codeBidiWarningConfig,
103
+ key = _ref2.key;
115
104
  var properties = node.properties,
116
- type = node.type,
117
- TagName = node.tagName,
118
- value = node.value;
119
-
105
+ type = node.type,
106
+ TagName = node.tagName,
107
+ value = node.value;
120
108
  if (type === 'text') {
121
109
  // occasionally react-syntax-highlighter passes a numeric value when the
122
110
  // type is text
123
111
  var textValue = value + '';
124
112
  var decorated = codeBidiWarningDecorator(textValue, function (_ref3) {
125
113
  var bidiCharacter = _ref3.bidiCharacter,
126
- index = _ref3.index;
114
+ index = _ref3.index;
127
115
  return /*#__PURE__*/React.createElement(CodeBidiWarning, {
128
116
  bidiCharacter: bidiCharacter,
129
117
  key: index,
@@ -135,7 +123,6 @@ function createElement(_ref2) {
135
123
  } else if (TagName) {
136
124
  var childrenCreator = createChildren(stylesheet, useInlineStyles, codeBidiWarningConfig);
137
125
  var props;
138
-
139
126
  if (!useInlineStyles) {
140
127
  props = _objectSpread(_objectSpread({}, properties), {}, {
141
128
  className: createClassNameString(properties.className)
@@ -148,8 +135,9 @@ function createElement(_ref2) {
148
135
  }
149
136
  });
150
137
  return classes;
151
- }, []); // For compatibility with older versions of react-syntax-highlighter
138
+ }, []);
152
139
 
140
+ // For compatibility with older versions of react-syntax-highlighter
153
141
  var startingClassName = properties.className && properties.className.includes('token') ? ['token'] : [];
154
142
  var className = properties.className && startingClassName.concat(properties.className.filter(function (className) {
155
143
  return !allStylesheetSelectors.includes(className);
@@ -159,7 +147,6 @@ function createElement(_ref2) {
159
147
  style: createStyleObject(properties.className, Object.assign({}, properties.style, style), stylesheet)
160
148
  });
161
149
  }
162
-
163
150
  var children = childrenCreator(node.children);
164
151
  return /*#__PURE__*/React.createElement(TagName, _extends({
165
152
  key: key
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "14.4.6",
3
+ "version": "14.4.8",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "14.4.6",
3
+ "version": "14.4.8",
4
4
  "description": "Code highlights short strings of code snippets inline with body text.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@atlaskit/codemod-utils": "^4.1.0",
31
31
  "@atlaskit/theme": "^12.2.0",
32
- "@atlaskit/tokens": "^0.13.0",
32
+ "@atlaskit/tokens": "^1.0.0",
33
33
  "@atlaskit/tooltip": "^17.6.0",
34
34
  "@babel/runtime": "^7.0.0",
35
35
  "@emotion/react": "^11.7.1",