@atlaskit/code 17.2.7 → 17.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/code
2
2
 
3
+ ## 17.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`480d781cdc018`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/480d781cdc018) -
8
+ Align the code component to ADS design tokens where possible behind a feature flag. If successful,
9
+ this will be part of a later release.
10
+
11
+ ## 17.2.8
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 17.2.7
4
18
 
5
19
  ### Patch Changes
@@ -548,7 +562,6 @@
548
562
  CodeBlock has had some significant under-the-hood changes in this version. While technically it is
549
563
  a minor update as all API changes are additive and backwards-compatible, this is a heads up that
550
564
  there are some small visual changes that may require visual regression snapshots to be updated.
551
-
552
565
  - Adds a new `shouldWrapLongLines` prop that allows you to wrap long lines of code over multiple
553
566
  lines, instead of always forcing the container to scroll horizontally.
554
567
 
@@ -822,7 +835,6 @@
822
835
 
823
836
  Component theming is no longer supported in `<Code />` or `<CodeBlock />`; this change does not
824
837
  effect global theming. As an escape hatch, two CSS variables are exposed:
825
-
826
838
  - `--ds--code--line-number-bg-color`: which controls the background color of the line numbers if
827
839
  set
828
840
  - `--ds--code--bg-color`: which controls the background color of the block body if set
@@ -919,7 +931,6 @@
919
931
  is an escape hatch which will likley be removed in a future major version.
920
932
 
921
933
  This change also includes:
922
-
923
934
  - A bugfix for lineHeight that meant linenumbers and code body were not vertically aligned
924
935
  correctly.
925
936
  - A bugfix for the SSR'd components not rendering consistently before hydration
@@ -1089,7 +1100,6 @@
1089
1100
 
1090
1101
  Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
1091
1102
  [6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
1092
-
1093
1103
  - @atlaskit/docs@8.3.2
1094
1104
  - @atlaskit/visual-regression@0.1.9
1095
1105
  - @atlaskit/theme@9.5.1
@@ -1102,7 +1112,6 @@
1102
1112
 
1103
1113
  ThemedCode and ThemeCodeBlock props are now correctly typed- Updated dependencies
1104
1114
  [d2b8166208](https://bitbucket.org/atlassian/atlassian-frontend/commits/d2b8166208):
1105
-
1106
1115
  - @atlaskit/docs@8.3.0
1107
1116
 
1108
1117
  ## 11.1.1
@@ -1114,7 +1123,6 @@
1114
1123
  Removes babel/runtime from dependencies. Users should see a smaller bundlesize as a result-
1115
1124
  Updated dependencies
1116
1125
  [82747f2922](https://bitbucket.org/atlassian/atlassian-frontend/commits/82747f2922):
1117
-
1118
1126
  - @atlaskit/theme@9.5.0
1119
1127
 
1120
1128
  ## 11.1.0
@@ -1127,7 +1135,6 @@
1127
1135
  emphasize which lines of code you would like people to look at!
1128
1136
 
1129
1137
  The `highlight` prop can be used as follows:
1130
-
1131
1138
  - To highlight one line: `highlight="3"`
1132
1139
  - To highlight sequential lines: `highlight="1-5"`
1133
1140
  - To highlight sequential and multiple single lines: `highlight="1-5,7,10,15-20"`
@@ -1208,7 +1215,6 @@
1208
1215
  - [patch][65ada7f318](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/65ada7f318):
1209
1216
 
1210
1217
  **FABDODGEM-12 Editor Cashmere Release**
1211
-
1212
1218
  - [Internal post](http://go.atlassian.com/cashmere-release)
1213
1219
 
1214
1220
  **Affected editor components:**
@@ -1216,19 +1222,16 @@
1216
1222
  tables, media, mobile, text color, emoji, copy/paste, analytics
1217
1223
 
1218
1224
  **Performance**
1219
-
1220
1225
  - Async import for code blocks and task items on renderer
1221
1226
  - https://product-fabric.atlassian.net/browse/ED-7155
1222
1227
 
1223
1228
  **Table**
1224
-
1225
1229
  - Add support to sort tables that contains smart links
1226
1230
  - https://product-fabric.atlassian.net/browse/ED-7449
1227
1231
  - Scale table when changing to full width mode
1228
1232
  - https://product-fabric.atlassian.net/browse/ED-7724
1229
1233
 
1230
1234
  **Text color**
1231
-
1232
1235
  - Update text color toolbar with right color when text is inside a list, panel, etc.
1233
1236
  - https://product-fabric.atlassian.net/browse/FM-1752
1234
1237
 
@@ -1334,7 +1337,6 @@ https://product-fabric.atlassian.net/browse/FM-2393
1334
1337
  - [patch][18dfac7332](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/18dfac7332):
1335
1338
 
1336
1339
  In this PR, we are:
1337
-
1338
1340
  - Re-introducing dist build folders
1339
1341
  - Adding back cjs
1340
1342
  - Replacing es5 by cjs and es2015 by esm
@@ -1371,21 +1373,18 @@ https://product-fabric.atlassian.net/browse/FM-2393
1371
1373
  ## 11.0.1
1372
1374
 
1373
1375
  - [patch][b0ef06c685](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b0ef06c685):
1374
-
1375
1376
  - This is just a safety release in case anything strange happened in in the previous one. See Pull
1376
1377
  Request #5942 for details
1377
1378
 
1378
1379
  ## 11.0.0
1379
1380
 
1380
1381
  - [major][97bfe81ec8](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/97bfe81ec8):
1381
-
1382
1382
  - @atlaskit/code has been converted to Typescript. Typescript consumers will now get static type
1383
1383
  safety. Flow types are no longer provided. No API or behavioural changes.
1384
1384
 
1385
1385
  ## 10.0.0
1386
1386
 
1387
1387
  - [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
1388
-
1389
1388
  - Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
1390
1389
  this package, please ensure you use at least this version of react and react-dom.
1391
1390
 
@@ -1399,7 +1398,6 @@ https://product-fabric.atlassian.net/browse/FM-2393
1399
1398
  ## 9.0.0
1400
1399
 
1401
1400
  - [major][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
1402
-
1403
1401
  - Drop ES5 from all the flow modules
1404
1402
 
1405
1403
  ### Dropping CJS support in all @atlaskit packages
@@ -1444,7 +1442,6 @@ https://product-fabric.atlassian.net/browse/FM-2393
1444
1442
  ## 8.2.3
1445
1443
 
1446
1444
  - [patch][d49e9bbb13](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/d49e9bbb13):
1447
-
1448
1445
  - Expose the props on website
1449
1446
 
1450
1447
  ## 8.2.2
@@ -1462,19 +1459,16 @@ https://product-fabric.atlassian.net/browse/FM-2393
1462
1459
  ## 8.2.0
1463
1460
 
1464
1461
  - [minor][10fe416](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/10fe416):
1465
-
1466
1462
  - Props Language should be required and surfacing more props for code
1467
1463
 
1468
1464
  ## 8.1.1
1469
1465
 
1470
1466
  - [patch][84e8015](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/84e8015):
1471
-
1472
1467
  - Bump react-syntax-highlighter to 10.0.1
1473
1468
 
1474
1469
  ## 8.1.0
1475
1470
 
1476
1471
  - [minor][26027dd](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/26027dd):
1477
-
1478
1472
  - Upgrade react syntax highlighter to version that ships its own async loaded languages and
1479
1473
  supports SSR
1480
1474
 
@@ -3,6 +3,7 @@
3
3
  ._7xinn7od code[class*=language-]{all:unset}
4
4
  ._i7ngn7od .token:not([class=token],[data-ds--code--row--highlight],[data-ds--code--row]){all:unset}
5
5
  ._t7aun7od pre[class*=language-]{all:unset}
6
+ ._11c81u0j{font:var(--ds-font-code,normal 400 .875em/1 ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
6
7
  ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
7
8
  ._1dqoglyw{border-style:none}
8
9
  ._196q1xv3 [data-ds--code--row--highlight]:last-child{border-block-end:var(--ds-border-width,1px) dashed transparent}
@@ -14,6 +14,7 @@ var _runtime = require("@compiled/react/runtime");
14
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
15
  var _bindEventListener = require("bind-event-listener");
16
16
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _useHighlight = require("./internal/hooks/use-highlight");
18
19
  var _styles = require("./internal/theme/styles");
19
20
  var _getNormalizedLanguage = require("./internal/utils/get-normalized-language");
@@ -22,7 +23,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
22
23
  /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-selectors */
23
24
  /* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
24
25
  var getCodeBlockStyles = {
25
- root: "_2rko12b0 _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _r28du2gc _tajqu2gc _1ohiu2gc _m802u2gc _i6ntu2gc _1w2xu2gc _1hmyegat _vblregat _vbulegat _196q1xv3 _1vbw1xv3 _1v9c1xv3 _1srn17d7 _18r6myb0 _vyvc1n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _ra6gww7y _13cdh2mm _1pp0126e _zvy9f705 _qcxof705 _qzn01a66 _j0l11wug _1weckb7n _1na21hna _vsnzgrf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _40uk1l04 _i81p1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _pyovu2gc _ccm6u2gc _1ascu2gc _1yuau2gc _xr0w1a66 _4io21a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
26
+ codeFontFlagOn: "_11c81u0j",
27
+ codeFontFlagOff: "_1wyb1crf _k48pi7a9 _ect41odn",
28
+ root: "_2rko12b0 _1dqoglyw _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _1ozdn7od _7xinn7od _t7aun7od _r28du2gc _tajqu2gc _1ohiu2gc _m802u2gc _i6ntu2gc _1w2xu2gc _1hmyegat _vblregat _vbulegat _196q1xv3 _1vbw1xv3 _1v9c1xv3 _1srn17d7 _18r6myb0 _vyvc1n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _ra6gww7y _13cdh2mm _1pp0126e _zvy9f705 _qcxof705 _qzn01a66 _j0l11wug _1weckb7n _1na21hna _vsnzgrf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _40uk1l04 _i81p1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _pyovu2gc _ccm6u2gc _1ascu2gc _1yuau2gc _xr0w1a66 _4io21a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
26
29
  showLineNumbers: "_17071olh _1i3h1txw _16noidpf _h4fuidpf _pp6yidpf _1g4tidpf _11wmidpf _1bx8idpf",
27
30
  dontShowLineNumbers: "_1i3h1ule _16nou2gc _h4fuu2gc _pp6yu2gc _1g4tu2gc _11wmu2gc _1bx8u2gc",
28
31
  shouldWrapLongLines: "_13dgkb7n",
@@ -109,6 +112,9 @@ var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
109
112
 
110
113
  // https://product-fabric.atlassian.net/browse/DST-2472
111
114
  var languageToUse = text ? language : 'text';
115
+
116
+ // https://product-fabric.atlassian.net/browse/DSP-22927
117
+ var useCodeFont = (0, _platformFeatureFlags.fg)('platform_dst_code-token');
112
118
  return /*#__PURE__*/React.createElement(_syntaxHighlighter.default, {
113
119
  "data-code-lang": language,
114
120
  "data-ds--code--code-block": "",
@@ -136,7 +142,7 @@ var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
136
142
  "aria-label": showContentFocus ? label : undefined,
137
143
  role: showContentFocus ? 'region' : undefined,
138
144
  scrollRef: scrollableRef,
139
- className: (0, _runtime.ax)([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
145
+ className: (0, _runtime.ax)([useCodeFont ? getCodeBlockStyles.codeFontFlagOn : getCodeBlockStyles.codeFontFlagOff, getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
140
146
  });
141
147
  });
142
148
  var _default = exports.default = CodeBlock;
@@ -3,6 +3,7 @@
3
3
  ._7xinn7od code[class*=language-]{all:unset}
4
4
  ._i7ngn7od .token:not([class=token],[data-ds--code--row--highlight],[data-ds--code--row]){all:unset}
5
5
  ._t7aun7od pre[class*=language-]{all:unset}
6
+ ._11c81u0j{font:var(--ds-font-code,normal 400 .875em/1 ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
6
7
  ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
7
8
  ._1dqoglyw{border-style:none}
8
9
  ._196q1xv3 [data-ds--code--row--highlight]:last-child{border-block-end:var(--ds-border-width,1px) dashed transparent}
@@ -7,12 +7,15 @@ import { ax, ix } from "@compiled/react/runtime";
7
7
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
8
  import { bind } from 'bind-event-listener';
9
9
  import rafSchedule from 'raf-schd';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { useHighlightLines } from './internal/hooks/use-highlight';
11
12
  import { getLineNumWidth } from './internal/theme/styles';
12
13
  import { normalizeLanguage } from './internal/utils/get-normalized-language';
13
14
  import SyntaxHighlighter from './syntax-highlighter';
14
15
  const getCodeBlockStyles = {
15
- root: "_2rko12b0 _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _r28du2gc _tajqu2gc _1ohiu2gc _m802u2gc _i6ntu2gc _1w2xu2gc _1hmyegat _vblregat _vbulegat _196q1xv3 _1vbw1xv3 _1v9c1xv3 _1srn17d7 _18r6myb0 _vyvc1n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _ra6gww7y _13cdh2mm _1pp0126e _zvy9f705 _qcxof705 _qzn01a66 _j0l11wug _1weckb7n _1na21hna _vsnzgrf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _40uk1l04 _i81p1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _pyovu2gc _ccm6u2gc _1ascu2gc _1yuau2gc _xr0w1a66 _4io21a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
16
+ codeFontFlagOn: "_11c81u0j",
17
+ codeFontFlagOff: "_1wyb1crf _k48pi7a9 _ect41odn",
18
+ root: "_2rko12b0 _1dqoglyw _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _1ozdn7od _7xinn7od _t7aun7od _r28du2gc _tajqu2gc _1ohiu2gc _m802u2gc _i6ntu2gc _1w2xu2gc _1hmyegat _vblregat _vbulegat _196q1xv3 _1vbw1xv3 _1v9c1xv3 _1srn17d7 _18r6myb0 _vyvc1n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _ra6gww7y _13cdh2mm _1pp0126e _zvy9f705 _qcxof705 _qzn01a66 _j0l11wug _1weckb7n _1na21hna _vsnzgrf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _40uk1l04 _i81p1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _pyovu2gc _ccm6u2gc _1ascu2gc _1yuau2gc _xr0w1a66 _4io21a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
16
19
  showLineNumbers: "_17071olh _1i3h1txw _16noidpf _h4fuidpf _pp6yidpf _1g4tidpf _11wmidpf _1bx8idpf",
17
20
  dontShowLineNumbers: "_1i3h1ule _16nou2gc _h4fuu2gc _pp6yu2gc _1g4tu2gc _11wmu2gc _1bx8u2gc",
18
21
  shouldWrapLongLines: "_13dgkb7n",
@@ -84,6 +87,9 @@ const CodeBlock = /*#__PURE__*/memo(function CodeBlock({
84
87
 
85
88
  // https://product-fabric.atlassian.net/browse/DST-2472
86
89
  const languageToUse = text ? language : 'text';
90
+
91
+ // https://product-fabric.atlassian.net/browse/DSP-22927
92
+ const useCodeFont = fg('platform_dst_code-token');
87
93
  return /*#__PURE__*/React.createElement(SyntaxHighlighter, {
88
94
  "data-code-lang": language,
89
95
  "data-ds--code--code-block": "",
@@ -111,7 +117,7 @@ const CodeBlock = /*#__PURE__*/memo(function CodeBlock({
111
117
  "aria-label": showContentFocus ? label : undefined,
112
118
  role: showContentFocus ? 'region' : undefined,
113
119
  scrollRef: scrollableRef,
114
- className: ax([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
120
+ className: ax([useCodeFont ? getCodeBlockStyles.codeFontFlagOn : getCodeBlockStyles.codeFontFlagOff, getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
115
121
  });
116
122
  });
117
123
  export default CodeBlock;
@@ -3,6 +3,7 @@
3
3
  ._7xinn7od code[class*=language-]{all:unset}
4
4
  ._i7ngn7od .token:not([class=token],[data-ds--code--row--highlight],[data-ds--code--row]){all:unset}
5
5
  ._t7aun7od pre[class*=language-]{all:unset}
6
+ ._11c81u0j{font:var(--ds-font-code,normal 400 .875em/1 ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
6
7
  ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
7
8
  ._1dqoglyw{border-style:none}
8
9
  ._196q1xv3 [data-ds--code--row--highlight]:last-child{border-block-end:var(--ds-border-width,1px) dashed transparent}
@@ -9,12 +9,15 @@ import { ax, ix } from "@compiled/react/runtime";
9
9
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
10
10
  import { bind } from 'bind-event-listener';
11
11
  import rafSchedule from 'raf-schd';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { useHighlightLines } from './internal/hooks/use-highlight';
13
14
  import { getLineNumWidth } from './internal/theme/styles';
14
15
  import { normalizeLanguage } from './internal/utils/get-normalized-language';
15
16
  import SyntaxHighlighter from './syntax-highlighter';
16
17
  var getCodeBlockStyles = {
17
- root: "_2rko12b0 _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _r28du2gc _tajqu2gc _1ohiu2gc _m802u2gc _i6ntu2gc _1w2xu2gc _1hmyegat _vblregat _vbulegat _196q1xv3 _1vbw1xv3 _1v9c1xv3 _1srn17d7 _18r6myb0 _vyvc1n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _ra6gww7y _13cdh2mm _1pp0126e _zvy9f705 _qcxof705 _qzn01a66 _j0l11wug _1weckb7n _1na21hna _vsnzgrf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _40uk1l04 _i81p1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _pyovu2gc _ccm6u2gc _1ascu2gc _1yuau2gc _xr0w1a66 _4io21a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
18
+ codeFontFlagOn: "_11c81u0j",
19
+ codeFontFlagOff: "_1wyb1crf _k48pi7a9 _ect41odn",
20
+ root: "_2rko12b0 _1dqoglyw _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _1ozdn7od _7xinn7od _t7aun7od _r28du2gc _tajqu2gc _1ohiu2gc _m802u2gc _i6ntu2gc _1w2xu2gc _1hmyegat _vblregat _vbulegat _196q1xv3 _1vbw1xv3 _1v9c1xv3 _1srn17d7 _18r6myb0 _vyvc1n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _ra6gww7y _13cdh2mm _1pp0126e _zvy9f705 _qcxof705 _qzn01a66 _j0l11wug _1weckb7n _1na21hna _vsnzgrf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _40uk1l04 _i81p1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _pyovu2gc _ccm6u2gc _1ascu2gc _1yuau2gc _xr0w1a66 _4io21a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
18
21
  showLineNumbers: "_17071olh _1i3h1txw _16noidpf _h4fuidpf _pp6yidpf _1g4tidpf _11wmidpf _1bx8idpf",
19
22
  dontShowLineNumbers: "_1i3h1ule _16nou2gc _h4fuu2gc _pp6yu2gc _1g4tu2gc _11wmu2gc _1bx8u2gc",
20
23
  shouldWrapLongLines: "_13dgkb7n",
@@ -101,6 +104,9 @@ var CodeBlock = /*#__PURE__*/memo(function CodeBlock(_ref) {
101
104
 
102
105
  // https://product-fabric.atlassian.net/browse/DST-2472
103
106
  var languageToUse = text ? language : 'text';
107
+
108
+ // https://product-fabric.atlassian.net/browse/DSP-22927
109
+ var useCodeFont = fg('platform_dst_code-token');
104
110
  return /*#__PURE__*/React.createElement(SyntaxHighlighter, {
105
111
  "data-code-lang": language,
106
112
  "data-ds--code--code-block": "",
@@ -128,7 +134,7 @@ var CodeBlock = /*#__PURE__*/memo(function CodeBlock(_ref) {
128
134
  "aria-label": showContentFocus ? label : undefined,
129
135
  role: showContentFocus ? 'region' : undefined,
130
136
  scrollRef: scrollableRef,
131
- className: ax([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
137
+ className: ax([useCodeFont ? getCodeBlockStyles.codeFontFlagOn : getCodeBlockStyles.codeFontFlagOff, getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
132
138
  });
133
139
  });
134
140
  export default CodeBlock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "17.2.7",
3
+ "version": "17.3.0",
4
4
  "description": "Code highlights short strings of code snippets inline with body text.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,11 +29,11 @@
29
29
  "dependencies": {
30
30
  "@atlaskit/codemod-utils": "^4.2.0",
31
31
  "@atlaskit/platform-feature-flags": "^1.1.0",
32
- "@atlaskit/tokens": "^6.4.0",
33
- "@atlaskit/tooltip": "^20.5.0",
32
+ "@atlaskit/tokens": "^7.0.0",
33
+ "@atlaskit/tooltip": "^20.6.0",
34
34
  "@atlaskit/visually-hidden": "^3.0.0",
35
35
  "@babel/runtime": "^7.0.0",
36
- "@compiled/react": "^0.18.3",
36
+ "@compiled/react": "^0.18.6",
37
37
  "bind-event-listener": "^3.0.0",
38
38
  "memoize-one": "^6.0.0",
39
39
  "raf-schd": "^4.0.3",
@@ -47,12 +47,12 @@
47
47
  "@af/integration-testing": "workspace:^",
48
48
  "@af/visual-regression": "workspace:^",
49
49
  "@atlaskit/button": "^23.5.0",
50
- "@atlaskit/docs": "^11.1.0",
50
+ "@atlaskit/docs": "^11.2.0",
51
51
  "@atlaskit/ds-lib": "^5.1.0",
52
52
  "@atlaskit/form": "^14.2.0",
53
53
  "@atlaskit/link": "^3.2.0",
54
- "@atlaskit/primitives": "^14.15.0",
55
- "@atlaskit/section-message": "^8.7.0",
54
+ "@atlaskit/primitives": "^16.0.0",
55
+ "@atlaskit/section-message": "^8.8.0",
56
56
  "@atlaskit/ssr": "workspace:^",
57
57
  "@atlaskit/theme": "^21.0.0",
58
58
  "@atlaskit/toggle": "^15.1.0",
@@ -105,5 +105,10 @@
105
105
  ]
106
106
  }
107
107
  },
108
- "homepage": "https://atlassian.design/components/code/"
108
+ "homepage": "https://atlassian.design/components/code/",
109
+ "platform-feature-flags": {
110
+ "platform_dst_code-token": {
111
+ "type": "boolean"
112
+ }
113
+ }
109
114
  }