@atlaskit/code 15.6.9 → 15.6.10
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 +9 -0
- package/dist/cjs/internal/theme/styles.js +2 -2
- package/dist/es2019/internal/theme/styles.js +1 -1
- package/dist/esm/internal/theme/styles.js +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/internal/theme/styles.d.ts +1 -13
- package/dist/types-ts4.5/constants.d.ts +1 -1
- package/dist/types-ts4.5/internal/theme/styles.d.ts +1 -13
- package/package.json +11 -3
- package/__perf__/code-block-100-lines.tsx +0 -7
- package/__perf__/code-block-1000-lines.tsx +0 -7
- package/__perf__/code-block-4458-lines.tsx +0 -7
- package/__perf__/code-block-500-lines.tsx +0 -7
- package/__perf__/code-block-no-syntax-highlighting.tsx +0 -7
- package/__perf__/code-block-syntax-highlighting.tsx +0 -31
- package/__perf__/inline-code.tsx +0 -5
- package/__perf__/source-code-examples/100-line-example.tsx +0 -113
- package/__perf__/source-code-examples/1000-line-example.tsx +0 -1000
- package/__perf__/source-code-examples/4458-line-example.tsx +0 -4461
- package/__perf__/source-code-examples/500-line-example.tsx +0 -501
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/code
|
|
2
2
|
|
|
3
|
+
## 15.6.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#105601](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105601)
|
|
8
|
+
[`948a599bf836d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/948a599bf836d) -
|
|
9
|
+
Update dependencies and remove unused internal exports.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 15.6.9
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getLineNumWidth = exports.getCodeStyles = exports.getCodeBlockTheme = exports.getCodeBlockStyles =
|
|
7
|
+
exports.getLineNumWidth = exports.getCodeStyles = exports.getCodeBlockTheme = exports.getCodeBlockStyles = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _constants = require("./constants");
|
|
10
10
|
var _getTheme = require("./get-theme");
|
|
@@ -195,7 +195,7 @@ var syntaxKeywordColors = function syntaxKeywordColors(theme) {
|
|
|
195
195
|
/**
|
|
196
196
|
* Styles applied at the root element level, common across code/codeblock
|
|
197
197
|
*/
|
|
198
|
-
var getBaseCodeStyles =
|
|
198
|
+
var getBaseCodeStyles = function getBaseCodeStyles(theme) {
|
|
199
199
|
return {
|
|
200
200
|
fontSize: _constants.CODE_FONT_SIZE,
|
|
201
201
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
@@ -183,7 +183,7 @@ const syntaxKeywordColors = theme => ({
|
|
|
183
183
|
/**
|
|
184
184
|
* Styles applied at the root element level, common across code/codeblock
|
|
185
185
|
*/
|
|
186
|
-
|
|
186
|
+
const getBaseCodeStyles = theme => ({
|
|
187
187
|
fontSize: CODE_FONT_SIZE,
|
|
188
188
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
189
189
|
fontFamily: theme.fontFamily,
|
|
@@ -190,7 +190,7 @@ var syntaxKeywordColors = function syntaxKeywordColors(theme) {
|
|
|
190
190
|
/**
|
|
191
191
|
* Styles applied at the root element level, common across code/codeblock
|
|
192
192
|
*/
|
|
193
|
-
|
|
193
|
+
var getBaseCodeStyles = function getBaseCodeStyles(theme) {
|
|
194
194
|
return {
|
|
195
195
|
fontSize: CODE_FONT_SIZE,
|
|
196
196
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
@@ -326,5 +326,5 @@ export declare const SUPPORTED_LANGUAGES: readonly [{
|
|
|
326
326
|
export { CODE_BLOCK_SELECTOR } from './internal/theme/constants';
|
|
327
327
|
export type Language = (typeof SUPPORTED_LANGUAGES)[number];
|
|
328
328
|
export type LanguageAlias = (typeof SUPPORTED_LANGUAGES)[number]['alias'][number];
|
|
329
|
-
|
|
329
|
+
type LanguageName = (typeof SUPPORTED_LANGUAGES)[number]['name'];
|
|
330
330
|
export type SupportedLanguages = LanguageName | LanguageAlias;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { CSSObject } from '@emotion/react';
|
|
2
|
-
import type { CodeBlockTheme
|
|
2
|
+
import type { CodeBlockTheme } from './types';
|
|
3
3
|
export declare const getLineNumWidth: (numLines: number) => string;
|
|
4
|
-
/**
|
|
5
|
-
* Styles applied at the root element level, common across code/codeblock
|
|
6
|
-
*/
|
|
7
|
-
export declare const getBaseCodeStyles: (theme: CodeTheme) => {
|
|
8
|
-
fontSize: number;
|
|
9
|
-
fontFamily: string | undefined;
|
|
10
|
-
fontWeight: "var(--ds-font-weight-regular)";
|
|
11
|
-
backgroundColor: string;
|
|
12
|
-
color: string | undefined;
|
|
13
|
-
borderStyle: string;
|
|
14
|
-
borderRadius: "var(--ds-border-radius)";
|
|
15
|
-
};
|
|
16
4
|
/**
|
|
17
5
|
* Takes an implemented CodeBlock theme, and returns styles required for
|
|
18
6
|
* react-syntax-highlighter.
|
|
@@ -652,5 +652,5 @@ export declare const SUPPORTED_LANGUAGES: readonly [
|
|
|
652
652
|
export { CODE_BLOCK_SELECTOR } from './internal/theme/constants';
|
|
653
653
|
export type Language = (typeof SUPPORTED_LANGUAGES)[number];
|
|
654
654
|
export type LanguageAlias = (typeof SUPPORTED_LANGUAGES)[number]['alias'][number];
|
|
655
|
-
|
|
655
|
+
type LanguageName = (typeof SUPPORTED_LANGUAGES)[number]['name'];
|
|
656
656
|
export type SupportedLanguages = LanguageName | LanguageAlias;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { CSSObject } from '@emotion/react';
|
|
2
|
-
import type { CodeBlockTheme
|
|
2
|
+
import type { CodeBlockTheme } from './types';
|
|
3
3
|
export declare const getLineNumWidth: (numLines: number) => string;
|
|
4
|
-
/**
|
|
5
|
-
* Styles applied at the root element level, common across code/codeblock
|
|
6
|
-
*/
|
|
7
|
-
export declare const getBaseCodeStyles: (theme: CodeTheme) => {
|
|
8
|
-
fontSize: number;
|
|
9
|
-
fontFamily: string | undefined;
|
|
10
|
-
fontWeight: "var(--ds-font-weight-regular)";
|
|
11
|
-
backgroundColor: string;
|
|
12
|
-
color: string | undefined;
|
|
13
|
-
borderStyle: string;
|
|
14
|
-
borderRadius: "var(--ds-border-radius)";
|
|
15
|
-
};
|
|
16
4
|
/**
|
|
17
5
|
* Takes an implemented CodeBlock theme, and returns styles required for
|
|
18
6
|
* react-syntax-highlighter.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/code",
|
|
3
|
-
"version": "15.6.
|
|
3
|
+
"version": "15.6.10",
|
|
4
4
|
"description": "Code highlights short strings of code snippets inline with body text.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
32
32
|
"@atlaskit/theme": "^14.0.0",
|
|
33
|
-
"@atlaskit/tokens": "^3.
|
|
33
|
+
"@atlaskit/tokens": "^3.2.0",
|
|
34
34
|
"@atlaskit/tooltip": "^19.0.0",
|
|
35
35
|
"@atlaskit/visually-hidden": "^1.5.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
@@ -45,17 +45,25 @@
|
|
|
45
45
|
"@af/accessibility-testing": "*",
|
|
46
46
|
"@af/integration-testing": "*",
|
|
47
47
|
"@af/visual-regression": "*",
|
|
48
|
+
"@atlaskit/button": "^20.3.10",
|
|
49
|
+
"@atlaskit/docs": "*",
|
|
48
50
|
"@atlaskit/ds-lib": "^3.3.0",
|
|
51
|
+
"@atlaskit/form": "^11.0.2",
|
|
52
|
+
"@atlaskit/link": "*",
|
|
53
|
+
"@atlaskit/primitives": "^13.3.8",
|
|
54
|
+
"@atlaskit/section-message": "*",
|
|
49
55
|
"@atlaskit/ssr": "*",
|
|
50
56
|
"@atlaskit/toggle": "^14.0.0",
|
|
51
|
-
"@
|
|
57
|
+
"@compiled/react": "^0.18.1",
|
|
52
58
|
"@testing-library/react": "^12.1.5",
|
|
53
59
|
"@types/jscodeshift": "^0.11.0",
|
|
54
60
|
"@types/refractor": "^3.0.2",
|
|
55
61
|
"color-contrast-checker": "^1.5.0",
|
|
62
|
+
"css-loader": "^2.0.0",
|
|
56
63
|
"jscodeshift": "^0.13.0",
|
|
57
64
|
"prismjs": "^1.25.0",
|
|
58
65
|
"react-dom": "^16.8.0",
|
|
66
|
+
"style-loader": "^0.16.1",
|
|
59
67
|
"typescript": "~5.4.2"
|
|
60
68
|
},
|
|
61
69
|
"keywords": [
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { CodeBlock } from '../src';
|
|
4
|
-
|
|
5
|
-
export const text = `/**
|
|
6
|
-
* @jsxRuntime classic
|
|
7
|
-
* @jsx jsx
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import ReactDOM from 'react-dom';
|
|
11
|
-
import styled from '@emotion/styled';
|
|
12
|
-
import { jsx } from '@emotion/react';
|
|
13
|
-
import { N800 } from '@atlaskit/theme/colors';
|
|
14
|
-
|
|
15
|
-
// TODO refactor
|
|
16
|
-
const Content = styled.div\`
|
|
17
|
-
color: \${N800};
|
|
18
|
-
margin-top: 8px !important;
|
|
19
|
-
\`
|
|
20
|
-
|
|
21
|
-
class HelloMessage extends React.Component {
|
|
22
|
-
render() {
|
|
23
|
-
return (
|
|
24
|
-
<Content css={{ background: "green" }}>Hello {this.props.name}</Content>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
ReactDOM.render(<HelloMessage name="Taylor" />, document.body);`;
|
|
30
|
-
|
|
31
|
-
export default () => <CodeBlock text={text} language="jsx" />;
|
package/__perf__/inline-code.tsx
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// eslint-disable-file
|
|
2
|
-
export const hundredLineExample = `/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
3
|
-
/**
|
|
4
|
-
* @jsxRuntime classic
|
|
5
|
-
* @jsx jsx
|
|
6
|
-
*/
|
|
7
|
-
import React, { CSSProperties, forwardRef } from 'react';
|
|
8
|
-
|
|
9
|
-
import { css, jsx } from '@emotion/react';
|
|
10
|
-
|
|
11
|
-
import { BackgroundColor, Box, Inline, xcss } from '@atlaskit/primitives';
|
|
12
|
-
import { N0, N500, N700, R400, Y300 } from '@atlaskit/theme/colors';
|
|
13
|
-
import { token } from '@atlaskit/tokens';
|
|
14
|
-
|
|
15
|
-
const CSS_VAR_TEXT_COLOR = '--banner-text-color';
|
|
16
|
-
|
|
17
|
-
const textStyles = css({
|
|
18
|
-
color: \`var(\${CSS_VAR_TEXT_COLOR})\`,
|
|
19
|
-
font: token('font.body'),
|
|
20
|
-
fontWeight: token('font.weight.medium', '500'),
|
|
21
|
-
overflow: 'hidden',
|
|
22
|
-
textOverflow: 'ellipsis',
|
|
23
|
-
whiteSpace: 'nowrap',
|
|
24
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
25
|
-
'a, a:visited, a:hover, a:focus, a:active': {
|
|
26
|
-
color: 'currentColor',
|
|
27
|
-
textDecoration: 'underline',
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const backgroundColors: Record<Appearance, BackgroundColor> = {
|
|
32
|
-
warning: 'color.background.warning.bold',
|
|
33
|
-
error: 'color.background.danger.bold',
|
|
34
|
-
announcement: 'color.background.neutral.bold',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const tokenBackgroundColors: Record<Appearance, string> = {
|
|
38
|
-
warning: token('color.background.warning.bold', Y300),
|
|
39
|
-
error: token('color.background.danger.bold', R400),
|
|
40
|
-
announcement: token('color.background.neutral.bold', N500),
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const tokenTextColors: Record<Appearance, string> = {
|
|
44
|
-
warning: token('color.text.warning.inverse', N700),
|
|
45
|
-
error: token('color.text.inverse', N0),
|
|
46
|
-
announcement: token('color.text.inverse', N0),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
type Appearance = 'warning' | 'error' | 'announcement';
|
|
50
|
-
|
|
51
|
-
const containerStyles = xcss({
|
|
52
|
-
overflow: 'hidden',
|
|
53
|
-
maxHeight: 'size.500',
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const iconWrapperStyles = xcss({
|
|
57
|
-
display: 'block',
|
|
58
|
-
width: 'size.200',
|
|
59
|
-
height: 'size.200', // This matches Icon's "medium" size, without this the (line-)height is greater than that of the Icon
|
|
60
|
-
flexShrink: '0',
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export interface BannerProps {
|
|
64
|
-
appearance?: Appearance;
|
|
65
|
-
children?: React.ReactNode;
|
|
66
|
-
icon?: React.ReactElement;
|
|
67
|
-
testId?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const Banner = forwardRef<HTMLDivElement, BannerProps>(
|
|
71
|
-
({ appearance = 'warning', children, icon, testId }, ref) => {
|
|
72
|
-
const appearanceType =
|
|
73
|
-
appearance in backgroundColors ? appearance : 'warning';
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<Box
|
|
77
|
-
xcss={containerStyles}
|
|
78
|
-
backgroundColor={backgroundColors[appearanceType]}
|
|
79
|
-
padding="space.150"
|
|
80
|
-
testId={testId}
|
|
81
|
-
ref={ref}
|
|
82
|
-
role="alert"
|
|
83
|
-
>
|
|
84
|
-
<Inline space="space.050" alignBlock="center" alignInline="start">
|
|
85
|
-
{icon ? (
|
|
86
|
-
<Box
|
|
87
|
-
as="span"
|
|
88
|
-
xcss={iconWrapperStyles}
|
|
89
|
-
style={{
|
|
90
|
-
fill: tokenBackgroundColors[appearanceType],
|
|
91
|
-
color: tokenTextColors[appearanceType],
|
|
92
|
-
}}
|
|
93
|
-
>
|
|
94
|
-
{icon}
|
|
95
|
-
</Box>
|
|
96
|
-
) : null}
|
|
97
|
-
<span
|
|
98
|
-
style={
|
|
99
|
-
{
|
|
100
|
-
[CSS_VAR_TEXT_COLOR]: tokenTextColors[appearanceType],
|
|
101
|
-
} as CSSProperties
|
|
102
|
-
}
|
|
103
|
-
css={textStyles}
|
|
104
|
-
>
|
|
105
|
-
{children}
|
|
106
|
-
</span>
|
|
107
|
-
</Inline>
|
|
108
|
-
</Box>
|
|
109
|
-
);
|
|
110
|
-
},
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
export default Banner;`;
|