@atlaskit/code 17.2.3 → 17.2.5
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 +14 -0
- package/bidi-warning/package.json +1 -1
- package/bidi-warning-decorator/package.json +1 -1
- package/block/package.json +1 -1
- package/constants/package.json +1 -1
- package/dist/cjs/bidi-warning/ui/index.js +8 -3
- package/dist/cjs/code-block.compiled.css +21 -21
- package/dist/cjs/code-block.js +17 -7
- package/dist/cjs/code.compiled.css +1 -1
- package/dist/cjs/code.js +10 -4
- package/dist/cjs/constants.js +4 -0
- package/dist/cjs/syntax-highlighter/lib/process/create-line-element.js +4 -1
- package/dist/cjs/syntax-highlighter/lib/react-renderer/create-element.js +1 -1
- package/dist/es2019/bidi-warning/ui/index.js +8 -3
- package/dist/es2019/code-block.compiled.css +21 -21
- package/dist/es2019/code-block.js +17 -7
- package/dist/es2019/code.compiled.css +1 -1
- package/dist/es2019/code.js +9 -3
- package/dist/es2019/constants.js +4 -0
- package/dist/es2019/syntax-highlighter/lib/process/create-line-element.js +4 -1
- package/dist/es2019/syntax-highlighter/lib/react-renderer/create-element.js +1 -1
- package/dist/esm/bidi-warning/ui/index.js +8 -3
- package/dist/esm/code-block.compiled.css +21 -21
- package/dist/esm/code-block.js +17 -7
- package/dist/esm/code.compiled.css +1 -1
- package/dist/esm/code.js +10 -4
- package/dist/esm/constants.js +4 -0
- package/dist/esm/syntax-highlighter/lib/process/create-line-element.js +4 -1
- package/dist/esm/syntax-highlighter/lib/react-renderer/create-element.js +1 -1
- package/dist/types/bidi-warning/ui/index.d.ts +1 -1
- package/dist/types/bidi-warning/ui/types.d.ts +15 -0
- package/dist/types/code-block.d.ts +0 -1
- package/dist/types/constants.d.ts +4 -0
- package/dist/types/internal/hooks/use-highlight.d.ts +1 -1
- package/dist/types/internal/types.d.ts +20 -0
- package/dist/types/syntax-highlighter/lib/highlight.d.ts +0 -1
- package/dist/types/syntax-highlighter/lib/process/create-line-element.d.ts +9 -1
- package/dist/types/types.d.ts +13 -0
- package/dist/types-ts4.5/bidi-warning/ui/index.d.ts +1 -1
- package/dist/types-ts4.5/bidi-warning/ui/types.d.ts +15 -0
- package/dist/types-ts4.5/code-block.d.ts +0 -1
- package/dist/types-ts4.5/constants.d.ts +7 -0
- package/dist/types-ts4.5/internal/hooks/use-highlight.d.ts +1 -1
- package/dist/types-ts4.5/internal/types.d.ts +20 -0
- package/dist/types-ts4.5/syntax-highlighter/lib/highlight.d.ts +0 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line-element.d.ts +9 -1
- package/dist/types-ts4.5/types.d.ts +13 -0
- package/inline/package.json +1 -1
- package/offerings.json +65 -0
- package/package.json +10 -20
- package/types/package.json +1 -1
|
@@ -2,8 +2,16 @@ import { type AST, type RefractorNode, type SyntaxHighlighterLineProps } from '.
|
|
|
2
2
|
export type CreateLineElementProps = {
|
|
3
3
|
children: RefractorNode[];
|
|
4
4
|
lineNumber: number;
|
|
5
|
+
/**
|
|
6
|
+
* Sets whether to display code line numbers or not.
|
|
7
|
+
* @deprecated Use `shouldShowLineNumbers` instead
|
|
8
|
+
*/
|
|
5
9
|
showLineNumbers?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Sets whether to display code line numbers or not.
|
|
12
|
+
*/
|
|
13
|
+
shouldShowLineNumbers?: boolean;
|
|
6
14
|
lineProps?: SyntaxHighlighterLineProps;
|
|
7
15
|
className?: string[];
|
|
8
16
|
};
|
|
9
|
-
export default function createLineElement({ children, lineNumber, showLineNumbers, lineProps, className, }: CreateLineElementProps): AST.Element;
|
|
17
|
+
export default function createLineElement({ children, lineNumber, showLineNumbers, shouldShowLineNumbers, lineProps, className, }: CreateLineElementProps): AST.Element;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -12,8 +12,13 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
|
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
/**
|
|
14
14
|
* When set to `false`, disables code decorating with bidi warnings. Defaults to `true`.
|
|
15
|
+
* @deprecated Use `hasBidiWarnings` instead
|
|
15
16
|
*/
|
|
16
17
|
codeBidiWarnings?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* When set to `false`, disables code decorating with bidi warnings. Defaults to `true`.
|
|
20
|
+
*/
|
|
21
|
+
hasBidiWarnings?: boolean;
|
|
17
22
|
/**
|
|
18
23
|
* Label for the bidi warning tooltip.
|
|
19
24
|
*
|
|
@@ -26,6 +31,14 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
|
|
|
26
31
|
* disabled when used in a mobile view, such as in the editor via mobile
|
|
27
32
|
* bridge, where the tooltip could end up being cut off or otherwise not work
|
|
28
33
|
* as expected. Defaults to `true`.
|
|
34
|
+
* @deprecated Use `isBidiWarningTooltipEnabled` instead
|
|
29
35
|
*/
|
|
30
36
|
codeBidiWarningTooltipEnabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Sets whether to render tooltip with the warning or not. Intended to be
|
|
39
|
+
* disabled when used in a mobile view, such as in the editor via mobile
|
|
40
|
+
* bridge, where the tooltip could end up being cut off or otherwise not work
|
|
41
|
+
* as expected. Defaults to `true`.
|
|
42
|
+
*/
|
|
43
|
+
isBidiWarningTooltipEnabled?: boolean;
|
|
31
44
|
}
|
|
@@ -8,4 +8,4 @@ import { type CodeBidiWarningProps } from './types';
|
|
|
8
8
|
*
|
|
9
9
|
* See https://hello.atlassian.net/wiki/spaces/PRODSEC/pages/1347434677/PSHELP-2943+Investigate+Trojan+Source+Attack+Vulnerability#1)-Providing-visual-cues-for-our-Customers-in-our-affected-products
|
|
10
10
|
*/
|
|
11
|
-
export default function BidiWarning({ testId, bidiCharacter, skipChildren, tooltipEnabled, label, }: CodeBidiWarningProps): React.JSX.Element;
|
|
11
|
+
export default function BidiWarning({ testId, bidiCharacter, skipChildren, shouldSkipChildren, tooltipEnabled, isTooltipEnabled, label, }: CodeBidiWarningProps): React.JSX.Element;
|
|
@@ -13,14 +13,29 @@ export type CodeBidiWarningProps = {
|
|
|
13
13
|
* Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
|
|
14
14
|
* where the tooltip could end up being cut off or otherwise not work as expected.
|
|
15
15
|
* @default true
|
|
16
|
+
* @deprecated Use `isTooltipEnabled` instead
|
|
16
17
|
*/
|
|
17
18
|
tooltipEnabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Sets whether to render tooltip with the warning or not.
|
|
21
|
+
* Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
|
|
22
|
+
* where the tooltip could end up being cut off or otherwise not work as expected.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
isTooltipEnabled?: boolean;
|
|
18
26
|
/**
|
|
19
27
|
* Sets whether bidi character should be wrapped in decorator.
|
|
20
28
|
* Useful when wrapping the bidi character with the decoration is not achievable.
|
|
21
29
|
* @default false
|
|
30
|
+
* @deprecated Use `shouldSkipChildren` instead
|
|
22
31
|
*/
|
|
23
32
|
skipChildren?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Sets whether bidi character should be wrapped in decorator.
|
|
35
|
+
* Useful when wrapping the bidi character with the decoration is not achievable.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
shouldSkipChildren?: boolean;
|
|
24
39
|
/**
|
|
25
40
|
* Label for the bidi warning tooltip.
|
|
26
41
|
* @default "Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code."
|
|
@@ -641,6 +641,13 @@ export declare const SUPPORTED_LANGUAGES: readonly [
|
|
|
641
641
|
];
|
|
642
642
|
readonly value: "protobuf";
|
|
643
643
|
},
|
|
644
|
+
{
|
|
645
|
+
readonly name: "TOML";
|
|
646
|
+
readonly alias: readonly [
|
|
647
|
+
"toml"
|
|
648
|
+
];
|
|
649
|
+
readonly value: "toml";
|
|
650
|
+
},
|
|
644
651
|
{
|
|
645
652
|
readonly name: "Handlebars";
|
|
646
653
|
readonly alias: readonly [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HTMLProps } from 'react';
|
|
2
2
|
import type { CodeBlockProps } from '../types';
|
|
3
|
-
export declare const useHighlightLines: ({ highlight, testId, }: Pick<CodeBlockProps,
|
|
3
|
+
export declare const useHighlightLines: ({ highlight, testId, }: Pick<CodeBlockProps, "highlight" | "testId">) => {
|
|
4
4
|
getHighlightStyles: (lineNumber: number, highlightedLines: number[]) => HTMLProps<HTMLElement>;
|
|
5
5
|
highlightedLines: number[];
|
|
6
6
|
};
|
|
@@ -12,8 +12,14 @@ export interface CodeBlockProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* Sets whether to display code line numbers or not.
|
|
14
14
|
* @default true
|
|
15
|
+
* @deprecated Use `shouldShowLineNumbers` instead
|
|
15
16
|
*/
|
|
16
17
|
showLineNumbers?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Sets whether to display code line numbers or not.
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
shouldShowLineNumbers?: boolean;
|
|
17
23
|
/**
|
|
18
24
|
* Sets the number of the first line, if showLineNumbers is set to true.
|
|
19
25
|
* @default 1
|
|
@@ -50,8 +56,14 @@ export interface CodeBlockProps {
|
|
|
50
56
|
/**
|
|
51
57
|
* When set to `false`, disables code decorating with bidi warnings.
|
|
52
58
|
* @default true
|
|
59
|
+
* @deprecated Use `hasBidiWarnings` instead
|
|
53
60
|
*/
|
|
54
61
|
codeBidiWarnings?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* When set to `false`, disables code decorating with bidi warnings.
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
hasBidiWarnings?: boolean;
|
|
55
67
|
/**
|
|
56
68
|
* Label for the bidi warning tooltip.
|
|
57
69
|
* @default 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.'
|
|
@@ -62,8 +74,16 @@ export interface CodeBlockProps {
|
|
|
62
74
|
* Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
|
|
63
75
|
* where the tooltip could end up being cut off or otherwise not work as expected.
|
|
64
76
|
* @default true
|
|
77
|
+
* @deprecated Use `isBidiWarningTooltipEnabled` instead
|
|
65
78
|
*/
|
|
66
79
|
codeBidiWarningTooltipEnabled?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Sets whether to render tooltip with the warning or not.
|
|
82
|
+
* Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
|
|
83
|
+
* where the tooltip could end up being cut off or otherwise not work as expected.
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
isBidiWarningTooltipEnabled?: boolean;
|
|
67
87
|
/**
|
|
68
88
|
* Sets whether long lines will create a horizontally scrolling container.
|
|
69
89
|
* When set to `true`, these lines will visually wrap instead.
|
|
@@ -2,8 +2,16 @@ import { type AST, type RefractorNode, type SyntaxHighlighterLineProps } from '.
|
|
|
2
2
|
export type CreateLineElementProps = {
|
|
3
3
|
children: RefractorNode[];
|
|
4
4
|
lineNumber: number;
|
|
5
|
+
/**
|
|
6
|
+
* Sets whether to display code line numbers or not.
|
|
7
|
+
* @deprecated Use `shouldShowLineNumbers` instead
|
|
8
|
+
*/
|
|
5
9
|
showLineNumbers?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Sets whether to display code line numbers or not.
|
|
12
|
+
*/
|
|
13
|
+
shouldShowLineNumbers?: boolean;
|
|
6
14
|
lineProps?: SyntaxHighlighterLineProps;
|
|
7
15
|
className?: string[];
|
|
8
16
|
};
|
|
9
|
-
export default function createLineElement({ children, lineNumber, showLineNumbers, lineProps, className, }: CreateLineElementProps): AST.Element;
|
|
17
|
+
export default function createLineElement({ children, lineNumber, showLineNumbers, shouldShowLineNumbers, lineProps, className, }: CreateLineElementProps): AST.Element;
|
|
@@ -12,8 +12,13 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
|
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
/**
|
|
14
14
|
* When set to `false`, disables code decorating with bidi warnings. Defaults to `true`.
|
|
15
|
+
* @deprecated Use `hasBidiWarnings` instead
|
|
15
16
|
*/
|
|
16
17
|
codeBidiWarnings?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* When set to `false`, disables code decorating with bidi warnings. Defaults to `true`.
|
|
20
|
+
*/
|
|
21
|
+
hasBidiWarnings?: boolean;
|
|
17
22
|
/**
|
|
18
23
|
* Label for the bidi warning tooltip.
|
|
19
24
|
*
|
|
@@ -26,6 +31,14 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
|
|
|
26
31
|
* disabled when used in a mobile view, such as in the editor via mobile
|
|
27
32
|
* bridge, where the tooltip could end up being cut off or otherwise not work
|
|
28
33
|
* as expected. Defaults to `true`.
|
|
34
|
+
* @deprecated Use `isBidiWarningTooltipEnabled` instead
|
|
29
35
|
*/
|
|
30
36
|
codeBidiWarningTooltipEnabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Sets whether to render tooltip with the warning or not. Intended to be
|
|
39
|
+
* disabled when used in a mobile view, such as in the editor via mobile
|
|
40
|
+
* bridge, where the tooltip could end up being cut off or otherwise not work
|
|
41
|
+
* as expected. Defaults to `true`.
|
|
42
|
+
*/
|
|
43
|
+
isBidiWarningTooltipEnabled?: boolean;
|
|
31
44
|
}
|
package/inline/package.json
CHANGED
package/offerings.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Code",
|
|
4
|
+
"package": "@atlaskit/code",
|
|
5
|
+
"import": {
|
|
6
|
+
"name": "Code",
|
|
7
|
+
"package": "@atlaskit/code",
|
|
8
|
+
"type": "named"
|
|
9
|
+
},
|
|
10
|
+
"keywords": ["code", "snippet", "inline", "syntax", "programming"],
|
|
11
|
+
"categories": ["data-display"],
|
|
12
|
+
"shortDescription": "A component for displaying code snippets.",
|
|
13
|
+
"status": "general-availability",
|
|
14
|
+
"accessibilityGuidelines": [
|
|
15
|
+
"Ensure code content is announced properly by screen readers",
|
|
16
|
+
"Use appropriate contrast for code readability",
|
|
17
|
+
"Consider code context and meaning"
|
|
18
|
+
],
|
|
19
|
+
"usageGuidelines": [
|
|
20
|
+
"Use for inline code snippets",
|
|
21
|
+
"Consider syntax highlighting needs",
|
|
22
|
+
"Use appropriate font styling",
|
|
23
|
+
"Consider code block vs inline code"
|
|
24
|
+
],
|
|
25
|
+
"contentGuidelines": [
|
|
26
|
+
"Use clear, readable code examples",
|
|
27
|
+
"Consider code formatting and indentation",
|
|
28
|
+
"Use meaningful variable names in examples",
|
|
29
|
+
"Keep code snippets concise"
|
|
30
|
+
],
|
|
31
|
+
"examples": ["./examples/ai/code.tsx"]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "CodeBlock",
|
|
35
|
+
"package": "@atlaskit/code",
|
|
36
|
+
"import": {
|
|
37
|
+
"name": "CodeBlock",
|
|
38
|
+
"package": "@atlaskit/code",
|
|
39
|
+
"type": "named"
|
|
40
|
+
},
|
|
41
|
+
"keywords": ["code", "block", "syntax", "highlighting", "multiline"],
|
|
42
|
+
"categories": ["data-display"],
|
|
43
|
+
"shortDescription": "A component for displaying multi-line code blocks with syntax highlighting.",
|
|
44
|
+
"status": "general-availability",
|
|
45
|
+
"accessibilityGuidelines": [
|
|
46
|
+
"Ensure code blocks are announced properly by screen readers",
|
|
47
|
+
"Use appropriate contrast for code readability",
|
|
48
|
+
"Consider code context and meaning",
|
|
49
|
+
"Provide proper language identification"
|
|
50
|
+
],
|
|
51
|
+
"usageGuidelines": [
|
|
52
|
+
"Use for multi-line code examples",
|
|
53
|
+
"Specify appropriate language for syntax highlighting",
|
|
54
|
+
"Consider code block sizing and scrolling",
|
|
55
|
+
"Use for code snippets that need formatting"
|
|
56
|
+
],
|
|
57
|
+
"contentGuidelines": [
|
|
58
|
+
"Use clear, readable code examples",
|
|
59
|
+
"Consider code formatting and indentation",
|
|
60
|
+
"Use meaningful variable names in examples",
|
|
61
|
+
"Keep code blocks focused and relevant"
|
|
62
|
+
],
|
|
63
|
+
"examples": ["./examples/ai/code-block.tsx"]
|
|
64
|
+
}
|
|
65
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/code",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.5",
|
|
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,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
|
-
"@atlaskit/tokens": "^6.
|
|
32
|
+
"@atlaskit/tokens": "^6.3.0",
|
|
33
33
|
"@atlaskit/tooltip": "^20.4.0",
|
|
34
34
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"@af/accessibility-testing": "workspace:^",
|
|
47
47
|
"@af/integration-testing": "workspace:^",
|
|
48
48
|
"@af/visual-regression": "workspace:^",
|
|
49
|
-
"@atlaskit/button": "^23.
|
|
50
|
-
"@atlaskit/docs": "^11.
|
|
49
|
+
"@atlaskit/button": "^23.4.0",
|
|
50
|
+
"@atlaskit/docs": "^11.1.0",
|
|
51
51
|
"@atlaskit/ds-lib": "^5.0.0",
|
|
52
|
-
"@atlaskit/form": "^12.
|
|
52
|
+
"@atlaskit/form": "^12.7.0",
|
|
53
53
|
"@atlaskit/link": "^3.2.0",
|
|
54
|
-
"@atlaskit/primitives": "^14.
|
|
55
|
-
"@atlaskit/section-message": "^8.
|
|
54
|
+
"@atlaskit/primitives": "^14.14.0",
|
|
55
|
+
"@atlaskit/section-message": "^8.7.0",
|
|
56
56
|
"@atlaskit/ssr": "workspace:^",
|
|
57
|
-
"@atlaskit/theme": "^
|
|
57
|
+
"@atlaskit/theme": "^21.0.0",
|
|
58
58
|
"@atlaskit/toggle": "^15.1.0",
|
|
59
|
-
"@atlassian/ssr-tests": "^0.
|
|
59
|
+
"@atlassian/ssr-tests": "^0.3.0",
|
|
60
60
|
"@testing-library/react": "^13.4.0",
|
|
61
61
|
"@types/jscodeshift": "^0.11.0",
|
|
62
62
|
"@types/refractor": "^3.0.2",
|
|
@@ -64,8 +64,7 @@
|
|
|
64
64
|
"css-loader": "^2.0.0",
|
|
65
65
|
"prismjs": "^1.30.0",
|
|
66
66
|
"react-dom": "^18.2.0",
|
|
67
|
-
"style-loader": "^0.16.1"
|
|
68
|
-
"typescript": "~5.4.2"
|
|
67
|
+
"style-loader": "^0.16.1"
|
|
69
68
|
},
|
|
70
69
|
"keywords": [
|
|
71
70
|
"atlaskit",
|
|
@@ -106,14 +105,5 @@
|
|
|
106
105
|
]
|
|
107
106
|
}
|
|
108
107
|
},
|
|
109
|
-
"af:exports": {
|
|
110
|
-
"./types": "./src/entry-points/types.tsx",
|
|
111
|
-
".": "./src/index.tsx",
|
|
112
|
-
"./bidi-warning": "./src/bidi-warning/index.tsx",
|
|
113
|
-
"./bidi-warning-decorator": "./src/bidi-warning/bidi-warning-decorator.tsx",
|
|
114
|
-
"./block": "./src/entry-points/block.tsx",
|
|
115
|
-
"./inline": "./src/entry-points/inline.tsx",
|
|
116
|
-
"./constants": "./src/entry-points/constants.tsx"
|
|
117
|
-
},
|
|
118
108
|
"homepage": "https://atlassian.design/components/code/"
|
|
119
109
|
}
|