@atlaskit/code 15.6.1 → 15.6.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/code
2
2
 
3
+ ## 15.6.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#152305](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152305)
8
+ [`0f13c972be628`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0f13c972be628) -
9
+ [ux] Fix background color override using CSS variable for inlinde code behind a feature flag. If
10
+ successful, these changes will be made available in a later release.
11
+
12
+ ## 15.6.2
13
+
14
+ ### Patch Changes
15
+
16
+ - [#146968](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/146968)
17
+ [`55f40e0488d9e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/55f40e0488d9e) -
18
+ [ux] Use typography tokens where possible for code block component behind a feature flag. If
19
+ successful, these changes will be made available in a later release.
20
+
3
21
  ## 15.6.1
4
22
 
5
23
  ### Patch Changes
package/dist/cjs/code.js CHANGED
@@ -19,6 +19,7 @@ var _react2 = require("@emotion/react");
19
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
20
  var _bidiWarning = _interopRequireDefault(require("./bidi-warning"));
21
21
  var _bidiWarningDecorator = _interopRequireDefault(require("./bidi-warning/bidi-warning-decorator"));
22
+ var _constants = require("./internal/theme/constants");
22
23
  var _styles = require("./internal/theme/styles");
23
24
  var _excluded = ["testId"],
24
25
  _excluded2 = ["children", "codeBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled"];
@@ -45,7 +46,8 @@ var Code = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
45
46
  var styles = (0, _platformFeatureFlags.fg)('platform_design_system_team_code_new_typography') ? (0, _react2.css)({
46
47
  display: 'inline',
47
48
  padding: '2px 0.5ch',
48
- backgroundColor: "var(--ds-background-neutral, #091E420F)",
49
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
50
+ backgroundColor: "var(".concat(_constants.VAR_CODE_BG_COLOR, ", ", "var(--ds-background-neutral, #091E420F)", ")"),
49
51
  borderRadius: "var(--ds-border-radius, 3px)",
50
52
  borderStyle: 'none',
51
53
  boxDecorationBreak: 'clone',
@@ -5,11 +5,13 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getColorPalette = exports.getBaseTheme = exports.defaultBaseTheme = exports.default = void 0;
8
+ exports.getColorPalette = exports.getBaseTheme = exports.default = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
12
13
  var _constants = require("@atlaskit/theme/constants");
14
+ var _tokens = require("@atlaskit/tokens");
13
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
17
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -20,15 +22,14 @@ var T800 = '#067384';
20
22
  var Y1100 = '#7A5D1A';
21
23
  var getBaseTheme = exports.getBaseTheme = function getBaseTheme() {
22
24
  return {
23
- fontFamily: (0, _constants.codeFontFamily)(),
24
- fontFamilyItalic: "SFMono-MediumItalic, ".concat((0, _constants.codeFontFamily)()),
25
+ fontFamily: (0, _platformFeatureFlags.fg)('platform_design_system_team_code_new_typography') ? "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)" : (0, _constants.codeFontFamily)(),
26
+ fontFamilyItalic: "SFMono-MediumItalic, ".concat((0, _platformFeatureFlags.fg)('platform_design_system_team_code_new_typography') ? (0, _tokens.getTokenValue)('font.family.code') : (0, _constants.codeFontFamily)()),
25
27
  backgroundColor: "var(--ds-background-neutral, ".concat(colors.N20, ")"),
26
28
  textColor: "var(--ds-text, ".concat(colors.N800, ")"),
27
29
  lineNumberColor: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
28
30
  lineNumberBgColor: "var(--ds-background-neutral, ".concat(colors.N30, ")")
29
31
  };
30
32
  };
31
- var defaultBaseTheme = exports.defaultBaseTheme = getBaseTheme();
32
33
  var getColorPalette = exports.getColorPalette = (0, _memoizeOne.default)(function () {
33
34
  return {
34
35
  highlightedLineBgColor: "var(--ds-background-neutral, ".concat(colors.N30, ")"),
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.getLineNumWidth = exports.getCodeStyles = exports.getCodeBlockTheme = exports.getCodeBlockStyles = exports.getBaseCodeStyles = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
10
  var _constants = require("./constants");
10
11
  var _getTheme = require("./get-theme");
11
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -199,7 +200,7 @@ var getBaseCodeStyles = exports.getBaseCodeStyles = function getBaseCodeStyles(t
199
200
  return {
200
201
  fontSize: _constants.CODE_FONT_SIZE,
201
202
  fontFamily: theme.fontFamily,
202
- fontWeight: 'normal',
203
+ fontWeight: (0, _platformFeatureFlags.fg)('platform_design_system_team_code_new_typography') ? "var(--ds-font-weight-regular, 400)" : 'normal',
203
204
  backgroundColor: "var(".concat(_constants.VAR_CODE_BG_COLOR, ",").concat(theme.backgroundColor, ")"),
204
205
  color: theme.textColor,
205
206
  borderStyle: 'none',
@@ -10,6 +10,7 @@ import { css, jsx } from '@emotion/react';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
11
  import CodeBidiWarning from './bidi-warning';
12
12
  import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
13
+ import { VAR_CODE_BG_COLOR } from './internal/theme/constants';
13
14
  import { getCodeStyles } from './internal/theme/styles';
14
15
  /**
15
16
  * __Code__
@@ -28,7 +29,8 @@ const Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code({
28
29
  const styles = fg('platform_design_system_team_code_new_typography') ? css({
29
30
  display: 'inline',
30
31
  padding: '2px 0.5ch',
31
- backgroundColor: "var(--ds-background-neutral, #091E420F)",
32
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
33
+ backgroundColor: `var(${VAR_CODE_BG_COLOR}, ${"var(--ds-background-neutral, #091E420F)"})`,
32
34
  borderRadius: "var(--ds-border-radius, 3px)",
33
35
  borderStyle: 'none',
34
36
  boxDecorationBreak: 'clone',
@@ -1,19 +1,20 @@
1
1
  import memoizeOne from 'memoize-one';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import * as colors from '@atlaskit/theme/colors';
3
4
  import { codeFontFamily } from '@atlaskit/theme/constants';
5
+ import { getTokenValue } from '@atlaskit/tokens';
4
6
  // Hardcoded values have been used due to the current color palette not having any
5
7
  // accessible color options for Teal and Yellow and +20A
6
8
  const T800 = '#067384';
7
9
  const Y1100 = '#7A5D1A';
8
10
  export const getBaseTheme = () => ({
9
- fontFamily: codeFontFamily(),
10
- fontFamilyItalic: `SFMono-MediumItalic, ${codeFontFamily()}`,
11
+ fontFamily: fg('platform_design_system_team_code_new_typography') ? "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)" : codeFontFamily(),
12
+ fontFamilyItalic: `SFMono-MediumItalic, ${fg('platform_design_system_team_code_new_typography') ? getTokenValue('font.family.code') : codeFontFamily()}`,
11
13
  backgroundColor: `var(--ds-background-neutral, ${colors.N20})`,
12
14
  textColor: `var(--ds-text, ${colors.N800})`,
13
15
  lineNumberColor: `var(--ds-text-subtlest, ${colors.N400})`,
14
16
  lineNumberBgColor: `var(--ds-background-neutral, ${colors.N30})`
15
17
  });
16
- export const defaultBaseTheme = getBaseTheme();
17
18
  export const getColorPalette = memoizeOne(() => {
18
19
  return {
19
20
  highlightedLineBgColor: `var(--ds-background-neutral, ${colors.N30})`,
@@ -1,5 +1,6 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
2
 
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  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';
4
5
  import { getBaseTheme, getColorPalette } from './get-theme';
5
6
  export const getLineNumWidth = numLines => {
@@ -186,7 +187,7 @@ const syntaxKeywordColors = theme => ({
186
187
  export const getBaseCodeStyles = theme => ({
187
188
  fontSize: CODE_FONT_SIZE,
188
189
  fontFamily: theme.fontFamily,
189
- fontWeight: 'normal',
190
+ fontWeight: fg('platform_design_system_team_code_new_typography') ? "var(--ds-font-weight-regular, 400)" : 'normal',
190
191
  backgroundColor: `var(${VAR_CODE_BG_COLOR},${theme.backgroundColor})`,
191
192
  color: theme.textColor,
192
193
  borderStyle: 'none',
package/dist/esm/code.js CHANGED
@@ -13,6 +13,7 @@ import { css, jsx } from '@emotion/react';
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
14
  import CodeBidiWarning from './bidi-warning';
15
15
  import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
16
+ import { VAR_CODE_BG_COLOR } from './internal/theme/constants';
16
17
  import { getCodeStyles } from './internal/theme/styles';
17
18
  /**
18
19
  * __Code__
@@ -30,7 +31,8 @@ var Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code(_ref, ref) {
30
31
  var styles = fg('platform_design_system_team_code_new_typography') ? css({
31
32
  display: 'inline',
32
33
  padding: '2px 0.5ch',
33
- backgroundColor: "var(--ds-background-neutral, #091E420F)",
34
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
35
+ backgroundColor: "var(".concat(VAR_CODE_BG_COLOR, ", ", "var(--ds-background-neutral, #091E420F)", ")"),
34
36
  borderRadius: "var(--ds-border-radius, 3px)",
35
37
  borderStyle: 'none',
36
38
  boxDecorationBreak: 'clone',
@@ -2,23 +2,24 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import memoizeOne from 'memoize-one';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import * as colors from '@atlaskit/theme/colors';
6
7
  import { codeFontFamily } from '@atlaskit/theme/constants';
8
+ import { getTokenValue } from '@atlaskit/tokens';
7
9
  // Hardcoded values have been used due to the current color palette not having any
8
10
  // accessible color options for Teal and Yellow and +20A
9
11
  var T800 = '#067384';
10
12
  var Y1100 = '#7A5D1A';
11
13
  export var getBaseTheme = function getBaseTheme() {
12
14
  return {
13
- fontFamily: codeFontFamily(),
14
- fontFamilyItalic: "SFMono-MediumItalic, ".concat(codeFontFamily()),
15
+ fontFamily: fg('platform_design_system_team_code_new_typography') ? "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)" : codeFontFamily(),
16
+ fontFamilyItalic: "SFMono-MediumItalic, ".concat(fg('platform_design_system_team_code_new_typography') ? getTokenValue('font.family.code') : codeFontFamily()),
15
17
  backgroundColor: "var(--ds-background-neutral, ".concat(colors.N20, ")"),
16
18
  textColor: "var(--ds-text, ".concat(colors.N800, ")"),
17
19
  lineNumberColor: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
18
20
  lineNumberBgColor: "var(--ds-background-neutral, ".concat(colors.N30, ")")
19
21
  };
20
22
  };
21
- export var defaultBaseTheme = getBaseTheme();
22
23
  export var getColorPalette = memoizeOne(function () {
23
24
  return {
24
25
  highlightedLineBgColor: "var(--ds-background-neutral, ".concat(colors.N30, ")"),
@@ -3,6 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
5
 
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  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';
7
8
  import { getBaseTheme, getColorPalette } from './get-theme';
8
9
  export var getLineNumWidth = function getLineNumWidth(numLines) {
@@ -194,7 +195,7 @@ export var getBaseCodeStyles = function getBaseCodeStyles(theme) {
194
195
  return {
195
196
  fontSize: CODE_FONT_SIZE,
196
197
  fontFamily: theme.fontFamily,
197
- fontWeight: 'normal',
198
+ fontWeight: fg('platform_design_system_team_code_new_typography') ? "var(--ds-font-weight-regular, 400)" : 'normal',
198
199
  backgroundColor: "var(".concat(VAR_CODE_BG_COLOR, ",").concat(theme.backgroundColor, ")"),
199
200
  color: theme.textColor,
200
201
  borderStyle: 'none',
@@ -1,6 +1,5 @@
1
1
  import type { CodeBlockTheme, CodeTheme } from './types';
2
2
  export declare const getBaseTheme: () => CodeTheme;
3
- export declare const defaultBaseTheme: CodeTheme;
4
3
  export declare const getColorPalette: import("memoize-one").MemoizedFn<() => CodeBlockTheme>;
5
4
  declare const getTheme: () => CodeBlockTheme;
6
5
  export default getTheme;
@@ -1,6 +1,5 @@
1
1
  import type { CodeBlockTheme, CodeTheme } from './types';
2
2
  export declare const getBaseTheme: () => CodeTheme;
3
- export declare const defaultBaseTheme: CodeTheme;
4
3
  export declare const getColorPalette: import("memoize-one").MemoizedFn<() => CodeBlockTheme>;
5
4
  declare const getTheme: () => CodeBlockTheme;
6
5
  export default getTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "15.6.1",
3
+ "version": "15.6.3",
4
4
  "description": "Code highlights short strings of code snippets inline with body text.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,9 +28,9 @@
28
28
  "dependencies": {
29
29
  "@atlaskit/codemod-utils": "^4.2.0",
30
30
  "@atlaskit/platform-feature-flags": "^0.3.0",
31
- "@atlaskit/theme": "^13.0.0",
31
+ "@atlaskit/theme": "^13.1.0",
32
32
  "@atlaskit/tokens": "^2.0.0",
33
- "@atlaskit/tooltip": "^18.7.0",
33
+ "@atlaskit/tooltip": "^18.8.0",
34
34
  "@atlaskit/visually-hidden": "^1.5.0",
35
35
  "@babel/runtime": "^7.0.0",
36
36
  "@emotion/react": "^11.7.1",
@@ -44,7 +44,7 @@
44
44
  "@af/accessibility-testing": "*",
45
45
  "@af/integration-testing": "*",
46
46
  "@af/visual-regression": "*",
47
- "@atlaskit/ds-lib": "^2.6.0",
47
+ "@atlaskit/ds-lib": "^3.1.0",
48
48
  "@atlaskit/ssr": "*",
49
49
  "@atlaskit/toggle": "^13.4.0",
50
50
  "@atlaskit/visual-regression": "*",