@atlaskit/code 14.6.8 → 15.0.0

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 (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/bidi-warning/bidi-warning-decorator.js +1 -2
  3. package/dist/cjs/code-block.js +3 -6
  4. package/dist/cjs/code.js +2 -7
  5. package/dist/cjs/constants.js +2 -3
  6. package/dist/cjs/internal/hooks/use-highlight.js +2 -3
  7. package/dist/cjs/internal/theme/constants.js +8 -16
  8. package/dist/cjs/internal/theme/get-theme.js +54 -217
  9. package/dist/cjs/internal/theme/styles.js +26 -34
  10. package/dist/cjs/internal/utils/get-normalized-language.js +2 -3
  11. package/dist/cjs/syntax-highlighter/async.js +2 -3
  12. package/dist/cjs/syntax-highlighter/index.js +1 -2
  13. package/dist/cjs/syntax-highlighter/lib/highlight.js +1 -2
  14. package/dist/cjs/syntax-highlighter/lib/process/create-line.js +1 -2
  15. package/dist/cjs/syntax-highlighter/lib/process/index.js +2 -3
  16. package/dist/cjs/syntax-highlighter/types.js +2 -3
  17. package/dist/es2019/code-block.js +1 -3
  18. package/dist/es2019/code.js +2 -4
  19. package/dist/es2019/internal/theme/get-theme.js +54 -213
  20. package/dist/es2019/internal/theme/styles.js +6 -9
  21. package/dist/esm/code-block.js +2 -4
  22. package/dist/esm/code.js +2 -6
  23. package/dist/esm/internal/theme/get-theme.js +53 -212
  24. package/dist/esm/internal/theme/styles.js +5 -8
  25. package/dist/esm/syntax-highlighter/lib/process/index.js +2 -3
  26. package/dist/types/internal/theme/get-theme.d.ts +3 -4
  27. package/dist/types/internal/theme/styles.d.ts +3 -6
  28. package/dist/types-ts4.5/internal/theme/get-theme.d.ts +3 -4
  29. package/dist/types-ts4.5/internal/theme/styles.d.ts +3 -6
  30. package/package.json +3 -3
  31. package/report.api.md +1 -8
  32. package/tmp/api-report-tmp.d.ts +1 -4
@@ -75,7 +75,7 @@ var generator = function generator(options) {
75
75
  (0, _defineProperty2.default)(AsyncHighlighter, "highlightInstance", _highlight.default);
76
76
  return AsyncHighlighter;
77
77
  };
78
- var _default = generator({
78
+ var _default = exports.default = generator({
79
79
  loader: function loader() {
80
80
  return Promise.resolve().then(function () {
81
81
  return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_refractor-import" */
@@ -85,5 +85,4 @@ var _default = generator({
85
85
  return module.default || module;
86
86
  });
87
87
  }
88
- });
89
- exports.default = _default;
88
+ });
@@ -40,5 +40,4 @@ var _async = _interopRequireDefault(require("./async"));
40
40
  * @atlaskit/code uses this under-the-hood, but it is not intended for public consumption.
41
41
  * You should be using @atlaskit/code directly.
42
42
  */
43
- var _default = _async.default;
44
- exports.default = _default;
43
+ var _default = exports.default = _async.default;
@@ -87,5 +87,4 @@ var Highlight = /*#__PURE__*/(0, _react.memo)(function Highlight(_ref) {
87
87
  codeBidiWarningConfig: codeBidiWarningConfig
88
88
  });
89
89
  });
90
- var _default = Highlight;
91
- exports.default = _default;
90
+ var _default = exports.default = Highlight;
@@ -28,5 +28,4 @@ function createLineGenerator(lineProps, shouldCreateParentElementForLines, showL
28
28
  }
29
29
  };
30
30
  }
31
- var _default = createLineGenerator;
32
- exports.default = _default;
31
+ var _default = exports.default = createLineGenerator;
@@ -39,7 +39,7 @@ function processLines(_ref) {
39
39
  var testNode = tree[index];
40
40
  if (testNode.type === 'text') {
41
41
  index++;
42
- return "continue";
42
+ return 1; // continue
43
43
  }
44
44
  var node = testNode;
45
45
  var firstChildNode = node.children[0];
@@ -100,8 +100,7 @@ function processLines(_ref) {
100
100
  index++;
101
101
  };
102
102
  while (index < tree.length) {
103
- var _ret = _loop();
104
- if (_ret === "continue") continue;
103
+ if (_loop()) continue;
105
104
  }
106
105
  if (lastLineBreakIndex !== tree.length - 1) {
107
106
  var children = tree.slice(lastLineBreakIndex + 1, tree.length);
@@ -15,7 +15,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
15
15
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
16
  // This wrapper supports the async loading of refractor and language grammars. The internal Highlight is a memo() functional component as expected
17
17
  // eslint-disable-next-line @repo/internal/react/no-class-components
18
- var SyntaxHighlighter = /*#__PURE__*/function (_React$PureComponent) {
18
+ var SyntaxHighlighter = exports.SyntaxHighlighter = /*#__PURE__*/function (_React$PureComponent) {
19
19
  (0, _inherits2.default)(SyntaxHighlighter, _React$PureComponent);
20
20
  var _super = _createSuper(SyntaxHighlighter);
21
21
  function SyntaxHighlighter() {
@@ -32,5 +32,4 @@ var SyntaxHighlighter = /*#__PURE__*/function (_React$PureComponent) {
32
32
  * Props to be passed to the `span` wrapping each code line. Can be an
33
33
  * object or a function that receives current line number as argument and
34
34
  * returns a props object.
35
- */
36
- exports.SyntaxHighlighter = SyntaxHighlighter;
35
+ */
@@ -1,7 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { memo, useCallback, useMemo } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
- import { useGlobalTheme } from '@atlaskit/theme/components';
5
4
  import { useHighlightLines } from './internal/hooks/use-highlight';
6
5
  import { getCodeBlockStyles, getCodeBlockTheme } from './internal/theme/styles';
7
6
  import { normalizeLanguage } from './internal/utils/get-normalized-language';
@@ -30,8 +29,7 @@ const CodeBlock = /*#__PURE__*/memo(function CodeBlock({
30
29
  shouldWrapLongLines = false
31
30
  }) {
32
31
  const numLines = (text || '').split('\n').length;
33
- const globalTheme = useGlobalTheme();
34
- const theme = useMemo(() => getCodeBlockTheme(globalTheme, numLines), [globalTheme, numLines]);
32
+ const theme = useMemo(() => getCodeBlockTheme(numLines), [numLines]);
35
33
  const getStyles = useMemo(() => getCodeBlockStyles(theme), [theme]);
36
34
  const styles = useMemo(() => css(getStyles(highlightedStartText, highlightedEndText, showLineNumbers, shouldWrapLongLines)), [highlightedStartText, highlightedEndText, showLineNumbers, shouldWrapLongLines, getStyles]);
37
35
  const {
@@ -1,8 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
- import React, { forwardRef, memo, useMemo } from 'react';
3
+ import React, { forwardRef, memo } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
- import { useGlobalTheme } from '@atlaskit/theme/components';
6
5
  import CodeBidiWarning from './bidi-warning';
7
6
  import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
8
7
  import { getCodeStyles } from './internal/theme/styles';
@@ -19,8 +18,7 @@ const Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code({
19
18
  testId,
20
19
  ...props
21
20
  }, ref) {
22
- const theme = useGlobalTheme();
23
- const styles = useMemo(() => css(getCodeStyles(theme)), [theme]);
21
+ const styles = css(getCodeStyles());
24
22
  const {
25
23
  children,
26
24
  codeBidiWarnings = true,
@@ -1,228 +1,69 @@
1
1
  import memoizeOne from 'memoize-one';
2
2
  import * as colors from '@atlaskit/theme/colors';
3
- import { themed } from '@atlaskit/theme/components';
4
3
  import { codeFontFamily } from '@atlaskit/theme/constants';
5
4
  // Hardcoded values have been used due to the current color palette not having any
6
5
  // accessible color options for Teal and Yellow and +20A
7
6
  const T800 = '#067384';
8
7
  const Y1100 = '#7A5D1A';
9
- const PLUS20 = '#3A434E';
10
- export const getBaseTheme = theme => ({
8
+ export const getBaseTheme = () => ({
11
9
  fontFamily: codeFontFamily(),
12
10
  fontFamilyItalic: `SFMono-MediumItalic, ${codeFontFamily()}`,
13
- backgroundColor: themed({
14
- light: `var(--ds-background-neutral, ${colors.N20})`,
15
- dark: `var(--ds-background-neutral, ${colors.DN50})`
16
- })({
17
- theme
18
- }),
19
- textColor: themed({
20
- light: `var(--ds-text, ${colors.N800})`,
21
- dark: `var(--ds-text, ${colors.DN800})`
22
- })({
23
- theme
24
- }),
25
- lineNumberColor: themed({
26
- light: `var(--ds-text-subtlest, ${colors.N400})`,
27
- dark: `var(--ds-text-subtlest, ${colors.DN400})`
28
- })({
29
- theme
30
- }),
31
- lineNumberBgColor: themed({
32
- light: `var(--ds-background-neutral, ${colors.N30})`,
33
- dark: `var(--ds-background-neutral, ${colors.DN20})`
34
- })({
35
- theme
36
- })
11
+ backgroundColor: `var(--ds-background-neutral, ${colors.N20})`,
12
+ textColor: `var(--ds-text, ${colors.N800})`,
13
+ lineNumberColor: `var(--ds-text-subtlest, ${colors.N400})`,
14
+ lineNumberBgColor: `var(--ds-background-neutral, ${colors.N30})`
37
15
  });
38
- export const defaultBaseTheme = getBaseTheme({
39
- mode: 'light'
40
- });
41
- export const getColorPalette = memoizeOne(theme => {
42
- const akTheme = {
43
- theme
44
- };
16
+ export const defaultBaseTheme = getBaseTheme();
17
+ export const getColorPalette = memoizeOne(() => {
45
18
  return {
46
- highlightedLineBgColor: themed({
47
- light: `var(--ds-background-neutral, ${colors.N30})`,
48
- dark: `var(--ds-background-neutral, ${PLUS20})`
49
- })(akTheme),
50
- highlightedLineBorderColor: themed({
51
- light: `var(--ds-border-focused, ${colors.B200})`,
52
- dark: `var(--ds-border-focused, ${colors.B100})`
53
- })(akTheme),
54
- substringColor: themed({
55
- light: `var(--ds-text-subtlest, ${colors.N400})`,
56
- dark: `var(--ds-text-subtlest, ${colors.DN400})`
57
- })(akTheme),
58
- keywordColor: themed({
59
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
60
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
61
- })(akTheme),
62
- attributeColor: themed({
63
- light: `var(--ds-text-accent-teal, ${T800})`,
64
- dark: `var(--ds-text-accent-teal, ${colors.T200})`
65
- })(akTheme),
66
- selectorTagColor: themed({
67
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
68
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
69
- })(akTheme),
70
- docTagColor: themed({
71
- light: `var(--ds-text-accent-yellow, ${Y1100})`,
72
- dark: `var(--ds-text-accent-yellow, ${colors.Y300})`
73
- })(akTheme),
74
- nameColor: themed({
75
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
76
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
77
- })(akTheme),
78
- builtInColor: themed({
79
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
80
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
81
- })(akTheme),
82
- literalColor: themed({
83
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
84
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
85
- })(akTheme),
86
- bulletColor: themed({
87
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
88
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
89
- })(akTheme),
90
- codeColor: themed({
91
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
92
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
93
- })(akTheme),
94
- regexpColor: themed({
95
- light: `var(--ds-text-accent-teal, ${T800})`,
96
- dark: `var(--ds-text-accent-teal, ${colors.T200})`
97
- })(akTheme),
98
- symbolColor: themed({
99
- light: `var(--ds-text-accent-teal, ${T800})`,
100
- dark: `var(--ds-text-accent-teal, ${colors.T200})`
101
- })(akTheme),
102
- variableColor: themed({
103
- light: `var(--ds-text-accent-teal, ${T800})`,
104
- dark: `var(--ds-text-accent-teal, ${colors.T200})`
105
- })(akTheme),
106
- templateVariableColor: themed({
107
- light: `var(--ds-text-accent-teal, ${T800})`,
108
- dark: `var(--ds-text-accent-teal, ${colors.T200})`
109
- })(akTheme),
110
- linkColor: themed({
111
- light: `var(--ds-text-accent-purple, ${colors.P300})`,
112
- dark: `var(--ds-text-accent-purple, ${colors.P75})`
113
- })(akTheme),
114
- selectorAttributeColor: themed({
115
- light: `var(--ds-text-accent-teal, ${T800})`,
116
- dark: `var(--ds-text-accent-teal, ${colors.T200})`
117
- })(akTheme),
118
- selectorPseudoColor: themed({
119
- light: `var(--ds-text-accent-teal, ${T800})`,
120
- dark: `var(--ds-text-accent-teal, ${colors.T200})`
121
- })(akTheme),
122
- typeColor: themed({
123
- light: `var(--ds-text-accent-teal, ${T800})`,
124
- dark: `var(--ds-text-accent-teal, ${colors.T100})`
125
- })(akTheme),
126
- stringColor: themed({
127
- light: `var(--ds-text-accent-green, ${colors.G500})`,
128
- dark: `var(--ds-text-accent-green, ${colors.G200})`
129
- })(akTheme),
130
- selectorIdColor: themed({
131
- light: `var(--ds-text-accent-teal, ${T800})`,
132
- dark: `var(--ds-text-accent-teal, ${colors.T100})`
133
- })(akTheme),
134
- selectorClassColor: themed({
135
- light: `var(--ds-text-accent-teal, ${T800})`,
136
- dark: `var(--ds-text-accent-teal, ${colors.T100})`
137
- })(akTheme),
138
- quoteColor: themed({
139
- light: `var(--ds-text-accent-teal, ${T800})`,
140
- dark: `var(--ds-text-accent-teal, ${colors.T100})`
141
- })(akTheme),
142
- templateTagColor: themed({
143
- light: `var(--ds-text-accent-teal, ${T800})`,
144
- dark: `var(--ds-text-accent-teal, ${colors.T100})`
145
- })(akTheme),
146
- titleColor: themed({
147
- light: `var(--ds-text-accent-purple, ${colors.P300})`,
148
- dark: `var(--ds-text-accent-purple, ${colors.P75})`
149
- })(akTheme),
150
- sectionColor: themed({
151
- light: `var(--ds-text-accent-purple, ${colors.P300})`,
152
- dark: `var(--ds-text-accent-purple, ${colors.P75})`
153
- })(akTheme),
154
- commentColor: themed({
155
- light: `var(--ds-text-subtlest, ${colors.N400})`,
156
- dark: `var(--ds-text-subtlest, ${colors.DN400})`
157
- })(akTheme),
158
- metaKeywordColor: themed({
159
- light: `var(--ds-text-accent-green, ${colors.G500})`,
160
- dark: `var(--ds-text-accent-green, ${colors.G200})`
161
- })(akTheme),
162
- metaColor: themed({
163
- light: `var(--ds-text-subtlest, ${colors.N400})`,
164
- dark: `var(--ds-text-subtlest, ${colors.DN400})`
165
- })(akTheme),
166
- functionColor: themed({
167
- light: `var(--ds-text, ${colors.N800})`,
168
- dark: `var(--ds-text, ${colors.DN800})`
169
- })(akTheme),
170
- numberColor: themed({
171
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
172
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
173
- })(akTheme),
174
- prologColor: themed({
175
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
176
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
177
- })(akTheme),
178
- cdataColor: themed({
179
- light: `var(--ds-text-subtlest, ${colors.N400})`,
180
- dark: `var(--ds-text-subtlest, ${colors.B75})`
181
- })(akTheme),
182
- punctuationColor: themed({
183
- light: `var(--ds-text, ${colors.N800})`,
184
- dark: `var(--ds-text, ${colors.DN800})`
185
- })(akTheme),
186
- propertyColor: themed({
187
- light: `var(--ds-text-accent-purple, ${colors.P300})`,
188
- dark: `var(--ds-text-accent-purple, ${colors.P75})`
189
- })(akTheme),
190
- constantColor: themed({
191
- light: `var(--ds-text-accent-teal, ${T800})`,
192
- dark: `var(--ds-text-accent-teal, ${colors.T100})`
193
- })(akTheme),
194
- booleanColor: themed({
195
- light: `var(--ds-text-accent-blue, ${colors.B400})`,
196
- dark: `var(--ds-text-accent-blue, ${colors.B75})`
197
- })(akTheme),
198
- charColor: themed({
199
- light: `var(--ds-text, ${colors.N800})`,
200
- dark: `var(--ds-text, ${colors.DN800})`
201
- })(akTheme),
202
- insertedColor: themed({
203
- light: `var(--ds-text-accent-green, ${colors.G500})`,
204
- dark: `var(--ds-text-accent-green, ${colors.B75})`
205
- })(akTheme),
206
- deletedColor: themed({
207
- light: `var(--ds-text-accent-red, ${colors.R500})`,
208
- dark: `var(--ds-text-accent-red, ${colors.B75})`
209
- })(akTheme),
210
- operatorColor: themed({
211
- light: `var(--ds-text, ${colors.N800})`,
212
- dark: `var(--ds-text, ${colors.B75})`
213
- })(akTheme),
214
- atruleColor: themed({
215
- light: `var(--ds-text-accent-green, ${colors.G500})`,
216
- dark: `var(--ds-text-accent-green, ${colors.G200})`
217
- })(akTheme),
218
- importantColor: themed({
219
- light: `var(--ds-text-accent-yellow, ${Y1100})`,
220
- dark: `var(--ds-text-accent-yellow, ${colors.Y300})`
221
- })(akTheme)
19
+ highlightedLineBgColor: `var(--ds-background-neutral, ${colors.N30})`,
20
+ highlightedLineBorderColor: `var(--ds-border-focused, ${colors.B200})`,
21
+ substringColor: `var(--ds-text-subtlest, ${colors.N400})`,
22
+ keywordColor: `var(--ds-text-accent-blue, ${colors.B400})`,
23
+ attributeColor: `var(--ds-text-accent-teal, ${T800})`,
24
+ selectorTagColor: `var(--ds-text-accent-blue, ${colors.B400})`,
25
+ docTagColor: `var(--ds-text-accent-yellow, ${Y1100})`,
26
+ nameColor: `var(--ds-text-accent-blue, ${colors.B400})`,
27
+ builtInColor: `var(--ds-text-accent-blue, ${colors.B400})`,
28
+ literalColor: `var(--ds-text-accent-blue, ${colors.B400})`,
29
+ bulletColor: `var(--ds-text-accent-blue, ${colors.B400})`,
30
+ codeColor: `var(--ds-text-accent-blue, ${colors.B400})`,
31
+ regexpColor: `var(--ds-text-accent-teal, ${T800})`,
32
+ symbolColor: `var(--ds-text-accent-teal, ${T800})`,
33
+ variableColor: `var(--ds-text-accent-teal, ${T800})`,
34
+ templateVariableColor: `var(--ds-text-accent-teal, ${T800})`,
35
+ linkColor: `var(--ds-text-accent-purple, ${colors.P300})`,
36
+ selectorAttributeColor: `var(--ds-text-accent-teal, ${T800})`,
37
+ selectorPseudoColor: `var(--ds-text-accent-teal, ${T800})`,
38
+ typeColor: `var(--ds-text-accent-teal, ${T800})`,
39
+ stringColor: `var(--ds-text-accent-green, ${colors.G500})`,
40
+ selectorIdColor: `var(--ds-text-accent-teal, ${T800})`,
41
+ selectorClassColor: `var(--ds-text-accent-teal, ${T800})`,
42
+ quoteColor: `var(--ds-text-accent-teal, ${T800})`,
43
+ templateTagColor: `var(--ds-text-accent-teal, ${T800})`,
44
+ titleColor: `var(--ds-text-accent-purple, ${colors.P300})`,
45
+ sectionColor: `var(--ds-text-accent-purple, ${colors.P300})`,
46
+ commentColor: `var(--ds-text-subtlest, ${colors.N400})`,
47
+ metaKeywordColor: `var(--ds-text-accent-green, ${colors.G500})`,
48
+ metaColor: `var(--ds-text-subtlest, ${colors.N400})`,
49
+ functionColor: `var(--ds-text, ${colors.N800})`,
50
+ numberColor: `var(--ds-text-accent-blue, ${colors.B400})`,
51
+ prologColor: `var(--ds-text-accent-blue, ${colors.B400})`,
52
+ cdataColor: `var(--ds-text-subtlest, ${colors.N400})`,
53
+ punctuationColor: `var(--ds-text, ${colors.N800})`,
54
+ propertyColor: `var(--ds-text-accent-purple, ${colors.P300})`,
55
+ constantColor: `var(--ds-text-accent-teal, ${T800})`,
56
+ booleanColor: `var(--ds-text-accent-blue, ${colors.B400})`,
57
+ charColor: `var(--ds-text, ${colors.N800})`,
58
+ insertedColor: `var(--ds-text-accent-green, ${colors.G500})`,
59
+ deletedColor: `var(--ds-text-accent-red, ${colors.R500})`,
60
+ operatorColor: `var(--ds-text, ${colors.N800})`,
61
+ atruleColor: `var(--ds-text-accent-green, ${colors.G500})`,
62
+ importantColor: `var(--ds-text-accent-yellow, ${Y1100})`
222
63
  };
223
64
  });
224
- const getTheme = theme => ({
225
- ...getBaseTheme(theme),
226
- ...getColorPalette(theme)
65
+ const getTheme = () => ({
66
+ ...getBaseTheme(),
67
+ ...getColorPalette()
227
68
  });
228
69
  export default getTheme;
@@ -1,4 +1,3 @@
1
- import { borderRadius } from '@atlaskit/theme/constants';
2
1
  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';
3
2
  import { getBaseTheme, getColorPalette } from './get-theme';
4
3
  export const getLineNumWidth = numLines => {
@@ -189,7 +188,7 @@ export const getBaseCodeStyles = theme => ({
189
188
  backgroundColor: `var(${VAR_CODE_BG_COLOR},${theme.backgroundColor})`,
190
189
  color: theme.textColor,
191
190
  borderStyle: 'none',
192
- borderRadius: `${borderRadius()}px`
191
+ borderRadius: "var(--ds-border-radius, 3px)"
193
192
  });
194
193
 
195
194
  /**
@@ -284,10 +283,8 @@ export const getCodeBlockStyles = theme => (highlightedStartText, highlightedEnd
284
283
  content: '" "'
285
284
  }
286
285
  });
287
- export const getCodeStyles = globalTheme => {
288
- // Required to have proper compatibility with styled components interpolations
289
- const akTheme = 'theme' in globalTheme ? globalTheme.theme : globalTheme;
290
- const theme = getBaseTheme(akTheme);
286
+ export const getCodeStyles = () => {
287
+ const theme = getBaseTheme();
291
288
  const baseStyles = getBaseCodeStyles(theme);
292
289
  return {
293
290
  ...baseStyles,
@@ -300,10 +297,10 @@ export const getCodeStyles = globalTheme => {
300
297
  whiteSpace: 'pre-wrap'
301
298
  };
302
299
  };
303
- export const getCodeBlockTheme = (globalTheme, maxLines) => {
300
+ export const getCodeBlockTheme = maxLines => {
304
301
  return {
305
- ...getBaseTheme(globalTheme),
306
- ...getColorPalette(globalTheme),
302
+ ...getBaseTheme(),
303
+ ...getColorPalette(),
307
304
  lineNumberWidth: maxLines ? getLineNumWidth(maxLines) : undefined
308
305
  };
309
306
  };
@@ -1,7 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { memo, useCallback, useMemo } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
- import { useGlobalTheme } from '@atlaskit/theme/components';
5
4
  import { useHighlightLines } from './internal/hooks/use-highlight';
6
5
  import { getCodeBlockStyles, getCodeBlockTheme } from './internal/theme/styles';
7
6
  import { normalizeLanguage } from './internal/utils/get-normalized-language';
@@ -37,10 +36,9 @@ var CodeBlock = /*#__PURE__*/memo(function CodeBlock(_ref) {
37
36
  _ref$shouldWrapLongLi = _ref.shouldWrapLongLines,
38
37
  shouldWrapLongLines = _ref$shouldWrapLongLi === void 0 ? false : _ref$shouldWrapLongLi;
39
38
  var numLines = (text || '').split('\n').length;
40
- var globalTheme = useGlobalTheme();
41
39
  var theme = useMemo(function () {
42
- return getCodeBlockTheme(globalTheme, numLines);
43
- }, [globalTheme, numLines]);
40
+ return getCodeBlockTheme(numLines);
41
+ }, [numLines]);
44
42
  var getStyles = useMemo(function () {
45
43
  return getCodeBlockStyles(theme);
46
44
  }, [theme]);
package/dist/esm/code.js CHANGED
@@ -3,9 +3,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["testId"],
4
4
  _excluded2 = ["children", "codeBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled"];
5
5
  /** @jsx jsx */
6
- import React, { forwardRef, memo, useMemo } from 'react';
6
+ import React, { forwardRef, memo } from 'react';
7
7
  import { css, jsx } from '@emotion/react';
8
- import { useGlobalTheme } from '@atlaskit/theme/components';
9
8
  import CodeBidiWarning from './bidi-warning';
10
9
  import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
11
10
  import { getCodeStyles } from './internal/theme/styles';
@@ -21,10 +20,7 @@ import { getCodeStyles } from './internal/theme/styles';
21
20
  var Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code(_ref, ref) {
22
21
  var testId = _ref.testId,
23
22
  props = _objectWithoutProperties(_ref, _excluded);
24
- var theme = useGlobalTheme();
25
- var styles = useMemo(function () {
26
- return css(getCodeStyles(theme));
27
- }, [theme]);
23
+ var styles = css(getCodeStyles());
28
24
  var children = props.children,
29
25
  _props$codeBidiWarnin = props.codeBidiWarnings,
30
26
  codeBidiWarnings = _props$codeBidiWarnin === void 0 ? true : _props$codeBidiWarnin,