@atlaskit/code 14.3.1 → 14.3.4

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 (30) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/__perf__/default.tsx +1 -1
  3. package/codemods/__tests__/14.0.0-lite-mode/14.0.0-lite-mode.ts +10 -10
  4. package/codemods/__tests__/14.0.0-lite-mode/remove-language.ts +6 -6
  5. package/codemods/__tests__/14.0.0-lite-mode/text-to-child.ts +10 -10
  6. package/dist/cjs/bidi-warning/bidi-warning-decorator.js +1 -1
  7. package/dist/cjs/bidi-warning/ui/index.js +3 -1
  8. package/dist/cjs/bidi-warning/ui/styled.js +4 -3
  9. package/dist/cjs/code.js +6 -4
  10. package/dist/cjs/index.js +6 -6
  11. package/dist/cjs/internal/hooks/use-highlight.js +2 -2
  12. package/dist/cjs/internal/theme/constants.js +1 -1
  13. package/dist/cjs/internal/theme/get-theme.js +99 -99
  14. package/dist/cjs/internal/theme/styles.js +4 -3
  15. package/dist/cjs/react-syntax-highlighter-bidi-warning-renderer.js +4 -4
  16. package/dist/cjs/version.json +1 -1
  17. package/dist/es2019/bidi-warning/ui/styled.js +4 -3
  18. package/dist/es2019/internal/theme/get-theme.js +96 -96
  19. package/dist/es2019/internal/theme/styles.js +1 -0
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/esm/bidi-warning/ui/index.js +2 -1
  22. package/dist/esm/bidi-warning/ui/styled.js +4 -3
  23. package/dist/esm/code.js +4 -2
  24. package/dist/esm/internal/hooks/use-highlight.js +2 -2
  25. package/dist/esm/internal/theme/get-theme.js +98 -98
  26. package/dist/esm/internal/theme/styles.js +3 -2
  27. package/dist/esm/react-syntax-highlighter-bidi-warning-renderer.js +2 -2
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/bidi-warning/ui/index.d.ts +1 -0
  30. package/package.json +9 -8
@@ -11,26 +11,26 @@ export const getBaseTheme = theme => ({
11
11
  fontFamily: codeFontFamily(),
12
12
  fontFamilyItalic: `SFMono-MediumItalic, ${codeFontFamily()}`,
13
13
  backgroundColor: themed({
14
- light: colors.N20,
15
- dark: colors.DN50
14
+ light: `var(--ds-background-neutral, ${colors.N20})`,
15
+ dark: `var(--ds-background-neutral, ${colors.DN50})`
16
16
  })({
17
17
  theme
18
18
  }),
19
19
  textColor: themed({
20
- light: colors.N800,
21
- dark: colors.DN800
20
+ light: `var(--ds-text, ${colors.N800})`,
21
+ dark: `var(--ds-text, ${colors.DN800})`
22
22
  })({
23
23
  theme
24
24
  }),
25
25
  lineNumberColor: themed({
26
- light: colors.N400,
27
- dark: colors.DN400
26
+ light: `var(--ds-text-subtlest, ${colors.N400})`,
27
+ dark: `var(--ds-text-subtlest, ${colors.DN400})`
28
28
  })({
29
29
  theme
30
30
  }),
31
31
  lineNumberBgColor: themed({
32
- light: colors.N30,
33
- dark: colors.DN20
32
+ light: `var(--ds-background-neutral, ${colors.N30})`,
33
+ dark: `var(--ds-background-neutral, ${colors.DN20})`
34
34
  })({
35
35
  theme
36
36
  })
@@ -44,180 +44,180 @@ export const getColorPalette = memoizeOne(theme => {
44
44
  };
45
45
  return {
46
46
  highlightedLineBgColor: themed({
47
- light: colors.N30,
48
- dark: PLUS20
47
+ light: `var(--ds-background-neutral, ${colors.N30})`,
48
+ dark: `var(--ds-background-neutral, ${PLUS20})`
49
49
  })(akTheme),
50
50
  highlightedLineBorderColor: themed({
51
- light: colors.B200,
52
- dark: colors.B100
51
+ light: `var(--ds-border-focused, ${colors.B200})`,
52
+ dark: `var(--ds-border-focused, ${colors.B100})`
53
53
  })(akTheme),
54
54
  substringColor: themed({
55
- light: colors.N400,
56
- dark: colors.DN400
55
+ light: `var(--ds-text-subtlest, ${colors.N400})`,
56
+ dark: `var(--ds-text-subtlest, ${colors.DN400})`
57
57
  })(akTheme),
58
58
  keywordColor: themed({
59
- light: colors.B400,
60
- dark: colors.B75
59
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
60
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
61
61
  })(akTheme),
62
62
  attributeColor: themed({
63
- light: T800,
64
- dark: colors.T200
63
+ light: `var(--ds-text-accent-teal, ${T800})`,
64
+ dark: `var(--ds-text-accent-teal, ${colors.T200})`
65
65
  })(akTheme),
66
66
  selectorTagColor: themed({
67
- light: colors.B400,
68
- dark: colors.B75
67
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
68
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
69
69
  })(akTheme),
70
70
  docTagColor: themed({
71
- light: Y1100,
72
- dark: colors.Y300
71
+ light: `var(--ds-text-accent-yellow, ${Y1100})`,
72
+ dark: `var(--ds-text-accent-yellow, ${colors.Y300})`
73
73
  })(akTheme),
74
74
  nameColor: themed({
75
- light: colors.B400,
76
- dark: colors.B75
75
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
76
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
77
77
  })(akTheme),
78
78
  builtInColor: themed({
79
- light: colors.B400,
80
- dark: colors.B75
79
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
80
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
81
81
  })(akTheme),
82
82
  literalColor: themed({
83
- light: colors.B400,
84
- dark: colors.B75
83
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
84
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
85
85
  })(akTheme),
86
86
  bulletColor: themed({
87
- light: colors.B400,
88
- dark: colors.B75
87
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
88
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
89
89
  })(akTheme),
90
90
  codeColor: themed({
91
- light: colors.B400,
92
- dark: colors.B75
91
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
92
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
93
93
  })(akTheme),
94
94
  regexpColor: themed({
95
- light: T800,
96
- dark: colors.T200
95
+ light: `var(--ds-text-accent-teal, ${T800})`,
96
+ dark: `var(--ds-text-accent-teal, ${colors.T200})`
97
97
  })(akTheme),
98
98
  symbolColor: themed({
99
- light: T800,
100
- dark: colors.T200
99
+ light: `var(--ds-text-accent-teal, ${T800})`,
100
+ dark: `var(--ds-text-accent-teal, ${colors.T200})`
101
101
  })(akTheme),
102
102
  variableColor: themed({
103
- light: T800,
104
- dark: colors.T200
103
+ light: `var(--ds-text-accent-teal, ${T800})`,
104
+ dark: `var(--ds-text-accent-teal, ${colors.T200})`
105
105
  })(akTheme),
106
106
  templateVariableColor: themed({
107
- light: T800,
108
- dark: colors.T200
107
+ light: `var(--ds-text-accent-teal, ${T800})`,
108
+ dark: `var(--ds-text-accent-teal, ${colors.T200})`
109
109
  })(akTheme),
110
110
  linkColor: themed({
111
- light: colors.P300,
112
- dark: colors.P75
111
+ light: `var(--ds-text-accent-purple, ${colors.P300})`,
112
+ dark: `var(--ds-text-accent-purple, ${colors.P75})`
113
113
  })(akTheme),
114
114
  selectorAttributeColor: themed({
115
- light: T800,
116
- dark: colors.T200
115
+ light: `var(--ds-text-accent-teal, ${T800})`,
116
+ dark: `var(--ds-text-accent-teal, ${colors.T200})`
117
117
  })(akTheme),
118
118
  selectorPseudoColor: themed({
119
- light: T800,
120
- dark: colors.T200
119
+ light: `var(--ds-text-accent-teal, ${T800})`,
120
+ dark: `var(--ds-text-accent-teal, ${colors.T200})`
121
121
  })(akTheme),
122
122
  typeColor: themed({
123
- light: T800,
124
- dark: colors.T100
123
+ light: `var(--ds-text-accent-teal, ${T800})`,
124
+ dark: `var(--ds-text-accent-teal, ${colors.T100})`
125
125
  })(akTheme),
126
126
  stringColor: themed({
127
- light: colors.G500,
128
- dark: colors.G200
127
+ light: `var(--ds-text-accent-green, ${colors.G500})`,
128
+ dark: `var(--ds-text-accent-green, ${colors.G200})`
129
129
  })(akTheme),
130
130
  selectorIdColor: themed({
131
- light: T800,
132
- dark: colors.T100
131
+ light: `var(--ds-text-accent-teal, ${T800})`,
132
+ dark: `var(--ds-text-accent-teal, ${colors.T100})`
133
133
  })(akTheme),
134
134
  selectorClassColor: themed({
135
- light: T800,
136
- dark: colors.T100
135
+ light: `var(--ds-text-accent-teal, ${T800})`,
136
+ dark: `var(--ds-text-accent-teal, ${colors.T100})`
137
137
  })(akTheme),
138
138
  quoteColor: themed({
139
- light: T800,
140
- dark: colors.T100
139
+ light: `var(--ds-text-accent-teal, ${T800})`,
140
+ dark: `var(--ds-text-accent-teal, ${colors.T100})`
141
141
  })(akTheme),
142
142
  templateTagColor: themed({
143
- light: T800,
144
- dark: colors.T100
143
+ light: `var(--ds-text-accent-teal, ${T800})`,
144
+ dark: `var(--ds-text-accent-teal, ${colors.T100})`
145
145
  })(akTheme),
146
146
  titleColor: themed({
147
- light: colors.P300,
148
- dark: colors.P75
147
+ light: `var(--ds-text-accent-purple, ${colors.P300})`,
148
+ dark: `var(--ds-text-accent-purple, ${colors.P75})`
149
149
  })(akTheme),
150
150
  sectionColor: themed({
151
- light: colors.P300,
152
- dark: colors.P75
151
+ light: `var(--ds-text-accent-purple, ${colors.P300})`,
152
+ dark: `var(--ds-text-accent-purple, ${colors.P75})`
153
153
  })(akTheme),
154
154
  commentColor: themed({
155
- light: colors.N400,
156
- dark: colors.DN400
155
+ light: `var(--ds-text-subtlest, ${colors.N400})`,
156
+ dark: `var(--ds-text-subtlest, ${colors.DN400})`
157
157
  })(akTheme),
158
158
  metaKeywordColor: themed({
159
- light: colors.G500,
160
- dark: colors.G200
159
+ light: `var(--ds-text-accent-green, ${colors.G500})`,
160
+ dark: `var(--ds-text-accent-green, ${colors.G200})`
161
161
  })(akTheme),
162
162
  metaColor: themed({
163
- light: colors.N400,
164
- dark: colors.DN400
163
+ light: `var(--ds-text-subtlest, ${colors.N400})`,
164
+ dark: `var(--ds-text-subtlest, ${colors.DN400})`
165
165
  })(akTheme),
166
166
  functionColor: themed({
167
- light: colors.N800,
168
- dark: colors.DN800
167
+ light: `var(--ds-text, ${colors.N800})`,
168
+ dark: `var(--ds-text, ${colors.DN800})`
169
169
  })(akTheme),
170
170
  numberColor: themed({
171
- light: colors.B400,
172
- dark: colors.B75
171
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
172
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
173
173
  })(akTheme),
174
174
  prologColor: themed({
175
- light: colors.B400,
176
- dark: colors.B75
175
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
176
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
177
177
  })(akTheme),
178
178
  cdataColor: themed({
179
- light: colors.N400,
180
- dark: colors.B75
179
+ light: `var(--ds-text-subtlest, ${colors.N400})`,
180
+ dark: `var(--ds-text-subtlest, ${colors.B75})`
181
181
  })(akTheme),
182
182
  punctuationColor: themed({
183
- light: colors.N800,
184
- dark: colors.DN800
183
+ light: `var(--ds-text, ${colors.N800})`,
184
+ dark: `var(--ds-text, ${colors.DN800})`
185
185
  })(akTheme),
186
186
  propertyColor: themed({
187
- light: colors.P300,
188
- dark: colors.P75
187
+ light: `var(--ds-text-accent-purple, ${colors.P300})`,
188
+ dark: `var(--ds-text-accent-purple, ${colors.P75})`
189
189
  })(akTheme),
190
190
  constantColor: themed({
191
- light: T800,
192
- dark: colors.T100
191
+ light: `var(--ds-text-accent-teal, ${T800})`,
192
+ dark: `var(--ds-text-accent-teal, ${colors.T100})`
193
193
  })(akTheme),
194
194
  booleanColor: themed({
195
- light: colors.B500,
196
- dark: colors.B75
195
+ light: `var(--ds-text-accent-blue, ${colors.B400})`,
196
+ dark: `var(--ds-text-accent-blue, ${colors.B75})`
197
197
  })(akTheme),
198
198
  charColor: themed({
199
- light: colors.N800,
200
- dark: colors.DN800
199
+ light: `var(--ds-text, ${colors.N800})`,
200
+ dark: `var(--ds-text, ${colors.DN800})`
201
201
  })(akTheme),
202
202
  insertedColor: themed({
203
- light: colors.G500,
204
- dark: colors.B75
203
+ light: `var(--ds-text-accent-green, ${colors.G500})`,
204
+ dark: `var(--ds-text-accent-green, ${colors.B75})`
205
205
  })(akTheme),
206
206
  deletedColor: themed({
207
- light: colors.R500,
208
- dark: colors.B75
207
+ light: `var(--ds-text-accent-red, ${colors.R500})`,
208
+ dark: `var(--ds-text-accent-red, ${colors.B75})`
209
209
  })(akTheme),
210
210
  operatorColor: themed({
211
- light: colors.N800,
212
- dark: colors.B75
211
+ light: `var(--ds-text, ${colors.N800})`,
212
+ dark: `var(--ds-text, ${colors.B75})`
213
213
  })(akTheme),
214
214
  atruleColor: themed({
215
- light: colors.G500,
216
- dark: colors.G200
215
+ light: `var(--ds-text-accent-green, ${colors.G500})`,
216
+ dark: `var(--ds-text-accent-green, ${colors.G200})`
217
217
  })(akTheme),
218
218
  importantColor: themed({
219
- light: Y1100,
220
- dark: colors.Y300
219
+ light: `var(--ds-text-accent-yellow, ${Y1100})`,
220
+ dark: `var(--ds-text-accent-yellow, ${colors.Y300})`
221
221
  })(akTheme)
222
222
  };
223
223
  });
@@ -220,6 +220,7 @@ export const getCodeBlockStyles = theme => (highlightedStartText, highlightedEnd
220
220
  },
221
221
  '& [data-ds--code--row--highlight]': {
222
222
  background: `${theme.highlightedLineBgColor}`,
223
+ // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
223
224
  '&::before, &::after': {
224
225
  clipPath: 'inset(100%)',
225
226
  clip: 'rect(1px, 1px, 1px, 1px)',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "14.3.1",
3
+ "version": "14.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children"];
3
4
  import React from 'react';
4
5
  import Tooltip from '@atlaskit/tooltip';
5
6
  import { Decorator } from './styled';
@@ -33,7 +34,7 @@ export default function BidiWarning(_ref) {
33
34
  }
34
35
  var CustomizedTagWithRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
35
36
  var children = props.children,
36
- rest = _objectWithoutProperties(props, ["children"]);
37
+ rest = _objectWithoutProperties(props, _excluded);
37
38
 
38
39
  return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
39
40
  ref: ref
@@ -17,7 +17,7 @@ var decoration = css({
17
17
  padding: '0 4px',
18
18
  fontSize: '14px',
19
19
  lineHeight: '18px',
20
- background: Y75,
20
+ background: "var(--ds-background-warning, ".concat(Y75, ")"),
21
21
 
22
22
  /**
23
23
  * Ensures the decoration receives pointer events when it occurs with
@@ -29,11 +29,12 @@ var decoration = css({
29
29
  content: '"<"attr(data-bidi-character-code)">"',
30
30
  // This color is Y800 which is not yet rolled out
31
31
  // https://hello.atlassian.net/wiki/spaces/~tswan/pages/1366555782?focusedCommentId=1370387374#comment-1370387374
32
- color: '#7F5F01',
32
+ color: "var(--ds-text-warning, #7F5F01)",
33
33
  fontStyle: 'normal'
34
34
  },
35
35
  ':hover:before': {
36
- color: '#533F04'
36
+ color: "var(--ds-text-warning, #533F04)",
37
+ background: "var(--ds-background-warning-hovered, ".concat(Y75, ")")
37
38
  }
38
39
  });
39
40
  export function Decorator(_ref) {
package/dist/esm/code.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["testId"],
4
+ _excluded2 = ["children", "codeBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled"];
3
5
 
4
6
  /** @jsx jsx */
5
7
  import React, { forwardRef, memo, useMemo } from 'react';
@@ -10,7 +12,7 @@ import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
10
12
  import { getCodeStyles } from './internal/theme/styles';
11
13
  var Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code(_ref, ref) {
12
14
  var testId = _ref.testId,
13
- props = _objectWithoutProperties(_ref, ["testId"]);
15
+ props = _objectWithoutProperties(_ref, _excluded);
14
16
 
15
17
  var theme = useGlobalTheme();
16
18
  var styles = useMemo(function () {
@@ -23,7 +25,7 @@ var Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code(_ref, ref) {
23
25
  codeBidiWarningLabel = props.codeBidiWarningLabel,
24
26
  _props$codeBidiWarnin2 = props.codeBidiWarningTooltipEnabled,
25
27
  codeBidiWarningTooltipEnabled = _props$codeBidiWarnin2 === void 0 ? true : _props$codeBidiWarnin2,
26
- otherProps = _objectWithoutProperties(props, ["children", "codeBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled"]);
28
+ otherProps = _objectWithoutProperties(props, _excluded2);
27
29
 
28
30
  var decoratedChildren = codeBidiWarnings ? jsx(RenderCodeChildrenWithBidiWarnings, {
29
31
  codeBidiWarningLabel: codeBidiWarningLabel,
@@ -1,9 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
 
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+ 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
5
 
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
+ 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
7
 
8
8
  import { useCallback, useMemo } from 'react';
9
9
  var DEFAULT_LINE_EL_ATTR_OBJ = {