@atlaskit/code 15.6.1 → 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,14 @@
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
+
3
12
  ## 15.6.1
4
13
 
5
14
  ### Patch Changes
@@ -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',
@@ -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',
@@ -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.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/"