@atlaskit/code 15.6.0 → 15.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/code
2
2
 
3
+ ## 15.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#146968](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/146968)
8
+ [`55f40e0488d9e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/55f40e0488d9e) -
9
+ [ux] Use typography tokens where possible for code block component behind a feature flag. If
10
+ successful, these changes will be made available in a later release.
11
+
12
+ ## 15.6.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 15.6.0
4
19
 
5
20
  ### Minor Changes
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.bidiCharacterRegex = void 0;
8
8
  exports.default = codeBidiWarningDecorator;
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
11
- 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); }
12
- 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; }
10
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
13
  var bidiCharacterRegex = exports.bidiCharacterRegex = /[\u202A-\u202E\u2066-\u2069]/g;
14
14
 
15
15
  /**
package/dist/cjs/code.js CHANGED
@@ -28,7 +28,7 @@ var _excluded = ["testId"],
28
28
  */
29
29
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
30
30
  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); }
31
- 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 && Object.prototype.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; }
31
+ 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; }
32
32
  /**
33
33
  * __Code__
34
34
  *
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "getCodeStyles", {
18
18
  });
19
19
  var _code = _interopRequireWildcard(require("../code"));
20
20
  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); }
21
- 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 && Object.prototype.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; }
21
+ 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; }
package/dist/cjs/index.js CHANGED
@@ -33,4 +33,4 @@ var _code = _interopRequireWildcard(require("./code"));
33
33
  var _codeBlock = _interopRequireDefault(require("./code-block"));
34
34
  var _constants = require("./constants");
35
35
  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); }
36
- 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 && Object.prototype.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; }
36
+ 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; }
@@ -5,13 +5,15 @@ 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
- 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 && Object.prototype.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; }
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; }
16
18
  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) { (0, _defineProperty2.default)(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; }
17
19
  // Hardcoded values have been used due to the current color palette not having any
@@ -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',
@@ -16,8 +16,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
16
16
  var _react = _interopRequireDefault(require("react"));
17
17
  var _highlight = _interopRequireDefault(require("./lib/highlight"));
18
18
  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); }
19
- 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 && Object.prototype.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; }
20
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
19
+ 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; }
20
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
21
21
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
22
  // Uses the loader method of async bundling
23
23
  // Instantiates highligher as a singleton, loading refractor only once per page (refractor/prism are singleton modules)
@@ -11,7 +11,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
11
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
13
  var _react = _interopRequireDefault(require("react"));
14
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
14
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
15
15
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
16
16
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
17
17
  // This wrapper supports the async loading of refractor and language grammars. The internal Highlight is a memo() functional component as expected
@@ -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',
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
- 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); }
4
- 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; }
2
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
5
  export var bidiCharacterRegex = /[\u202A-\u202E\u2066-\u2069]/g;
6
6
 
7
7
  /**
@@ -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',
@@ -5,7 +5,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  import React from 'react';
11
11
  import highlight from './lib/highlight';
@@ -3,7 +3,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
6
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
7
7
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
8
  import React from 'react';
9
9
 
@@ -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.0",
3
+ "version": "15.6.2",
4
4
  "description": "Code highlights short strings of code snippets inline with body text.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -16,7 +16,6 @@
16
16
  "atlaskit:src": "src/index.tsx",
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
- "releaseModel": "continuous",
20
19
  "website": {
21
20
  "name": "Code",
22
21
  "category": "Components"
@@ -30,7 +29,7 @@
30
29
  "@atlaskit/codemod-utils": "^4.2.0",
31
30
  "@atlaskit/platform-feature-flags": "^0.3.0",
32
31
  "@atlaskit/theme": "^13.0.0",
33
- "@atlaskit/tokens": "^1.59.0",
32
+ "@atlaskit/tokens": "^2.0.0",
34
33
  "@atlaskit/tooltip": "^18.7.0",
35
34
  "@atlaskit/visually-hidden": "^1.5.0",
36
35
  "@babel/runtime": "^7.0.0",
@@ -45,9 +44,9 @@
45
44
  "@af/accessibility-testing": "*",
46
45
  "@af/integration-testing": "*",
47
46
  "@af/visual-regression": "*",
48
- "@atlaskit/ds-lib": "^2.5.0",
47
+ "@atlaskit/ds-lib": "^2.6.0",
49
48
  "@atlaskit/ssr": "*",
50
- "@atlaskit/toggle": "^13.3.0",
49
+ "@atlaskit/toggle": "^13.4.0",
51
50
  "@atlaskit/visual-regression": "*",
52
51
  "@testing-library/react": "^12.1.5",
53
52
  "@types/jscodeshift": "^0.11.0",