@atlaskit/code 15.1.2 → 15.2.1
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 +444 -183
- package/__perf__/source-code-examples/100-line-example.tsx +49 -40
- package/codemods/13.0.0-remove-unnecessary-code-props.tsx +61 -75
- package/codemods/13.0.0-rename-imports.tsx +214 -251
- package/codemods/14.0.0-lite-mode.tsx +5 -9
- package/codemods/__tests__/13.0.0-remove-unnecessary-code-props.tsx +43 -43
- package/codemods/__tests__/13.0.0-rename-imports.tsx +143 -143
- package/codemods/__tests__/14.0.0-lite-mode/14.0.0-lite-mode.tsx +35 -35
- package/codemods/__tests__/14.0.0-lite-mode/remove-language.tsx +21 -21
- package/codemods/__tests__/14.0.0-lite-mode/text-to-child.tsx +35 -35
- package/codemods/migrations/14.0.0-lite-mode/remove-language.tsx +1 -6
- package/codemods/migrations/14.0.0-lite-mode/text-to-child.tsx +53 -61
- package/codemods/utils/helpers.tsx +161 -201
- package/dist/cjs/internal/theme/styles.js +2 -1
- package/dist/es2019/internal/theme/styles.js +2 -1
- package/dist/esm/internal/theme/styles.js +2 -1
- package/dist/types/bidi-warning/ui/index.d.ts +1 -1
- package/dist/types/bidi-warning/ui/styled.d.ts +1 -1
- package/dist/types/extract-react-types/code-block.d.ts +16 -16
- package/dist/types/internal/hooks/use-highlight.d.ts +1 -1
- package/dist/types/internal/utils/get-normalized-language.d.ts +1 -1
- package/dist/types/syntax-highlighter/async.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/highlight.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/create-line-element.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/create-line.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/flatten-code-tree.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/get-code-tree.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/get-inline-line-number.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/index.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/react-renderer/create-children.d.ts +2 -2
- package/dist/types/syntax-highlighter/lib/react-renderer/create-element.d.ts +2 -2
- package/dist/types/syntax-highlighter/lib/react-renderer/index.d.ts +1 -1
- package/dist/types/syntax-highlighter/types.d.ts +2 -2
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/bidi-warning/ui/index.d.ts +1 -1
- package/dist/types-ts4.5/bidi-warning/ui/styled.d.ts +1 -1
- package/dist/types-ts4.5/extract-react-types/code-block.d.ts +16 -16
- package/dist/types-ts4.5/internal/hooks/use-highlight.d.ts +1 -1
- package/dist/types-ts4.5/internal/utils/get-normalized-language.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/async.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/highlight.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line-element.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/flatten-code-tree.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/get-code-tree.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/get-inline-line-number.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/index.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/create-children.d.ts +2 -2
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/create-element.d.ts +2 -2
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/index.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/types.d.ts +2 -2
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/package.json +11 -11
- package/report.api.md +807 -807
|
@@ -12,24 +12,24 @@ export default function CodeBlock(__: {
|
|
|
12
12
|
*/
|
|
13
13
|
showLineNumbers?: boolean;
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
Language reference designed to be populated from `SUPPORTED_LANGUAGES` in
|
|
16
|
+
`design-system/code`. Run against language grammars from PrismJS (full list
|
|
17
|
+
available at [PrismJS documentation](https://prismjs.com/#supported-languages)).
|
|
18
|
+
|
|
19
|
+
When set to `text` will not perform highlighting. If unsupported language
|
|
20
|
+
provided - code will be treated as "text" with no highlighting.
|
|
21
|
+
|
|
22
|
+
Defaults to `text`.
|
|
23
|
+
*/
|
|
24
24
|
language?: string;
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
Comma delimited lines to highlight.
|
|
27
|
+
|
|
28
|
+
Example uses:
|
|
29
|
+
- To highlight one line `highlight="3"`
|
|
30
|
+
- To highlight a group of lines `highlight="1-5"`
|
|
31
|
+
- To highlight multiple groups `highlight="1-5,7,10,15-20"`
|
|
32
|
+
*/
|
|
33
33
|
highlight?: string;
|
|
34
34
|
/**
|
|
35
35
|
* Screen reader text for the start of a highlighted line.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLProps } from 'react';
|
|
1
|
+
import { type HTMLProps } from 'react';
|
|
2
2
|
import type { CodeBlockProps } from '../types';
|
|
3
3
|
export declare const useHighlightLines: ({ highlight, testId, }: Pick<CodeBlockProps, 'highlight' | 'testId'>) => {
|
|
4
4
|
getHighlightStyles: (lineNumber: number, highlightedLines: number[]) => HTMLProps<HTMLElement>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SupportedLanguages } from '../types';
|
|
1
|
+
import { type SupportedLanguages } from '../types';
|
|
2
2
|
export declare const normalizeLanguage: import("memoize-one").MemoizedFn<(language?: SupportedLanguages) => string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SyntaxHighlighterProps } from '../types';
|
|
2
|
+
import { type SyntaxHighlighterProps } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Takes in a code string and (in the default behaviour):
|
|
5
5
|
* - Uses refractor to turn it into a tree structure with highlighting metadata
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RefractorNode, SyntaxHighlighterLineProps } from '../../types';
|
|
1
|
+
import { type RefractorNode, type SyntaxHighlighterLineProps } from '../../types';
|
|
2
2
|
declare function createLineGenerator(lineProps: SyntaxHighlighterLineProps, shouldCreateParentElementForLines: boolean, showLineNumbers: boolean): (children: RefractorNode[], lineNumber: number, className?: string[]) => RefractorNode | RefractorNode[];
|
|
3
3
|
export default createLineGenerator;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RefractorNode } from '../../types';
|
|
1
|
+
import { type RefractorNode } from '../../types';
|
|
2
2
|
export default function flattenCodeTree(tree: RefractorNode[], offset?: number, className?: string[]): RefractorNode[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AstGenerator, RefractorNode } from '../../types';
|
|
1
|
+
import { type AstGenerator, type RefractorNode } from '../../types';
|
|
2
2
|
export default function getCodeTree(language: string, code: string, astGenerator?: AstGenerator): RefractorNode[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RefractorNode } from '../../types';
|
|
1
|
+
import { type RefractorNode } from '../../types';
|
|
2
2
|
export default function getInlineLineNumber(lineNumber: number): RefractorNode;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { CodeBidiWarningConfig, RefractorNode } from '../../types';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type CodeBidiWarningConfig, type RefractorNode } from '../../types';
|
|
3
3
|
export default function createChildren(codeBidiWarningConfig: CodeBidiWarningConfig): (children: RefractorNode[]) => ReactNode[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { CodeBidiWarningConfig, RefractorNode } from '../../types';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type CodeBidiWarningConfig, type RefractorNode } from '../../types';
|
|
3
3
|
export default function createElement({ node, codeBidiWarningConfig, key, }: {
|
|
4
4
|
node: RefractorNode;
|
|
5
5
|
codeBidiWarningConfig: CodeBidiWarningConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SerializedStyles } from '@emotion/react';
|
|
3
|
-
import { AST, RefractorNode } from 'refractor';
|
|
2
|
+
import { type SerializedStyles } from '@emotion/react';
|
|
3
|
+
import { type AST, type RefractorNode } from 'refractor';
|
|
4
4
|
export type { AST, RefractorNode } from 'refractor';
|
|
5
5
|
export declare class SyntaxHighlighter extends React.PureComponent<SyntaxHighlighterProps> {
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLProps, ReactNode } from 'react';
|
|
2
|
-
export type { SupportedLanguages, Language, LanguageAlias, CodeBlockProps
|
|
2
|
+
export type { SupportedLanguages, Language, LanguageAlias, CodeBlockProps } from './internal/types';
|
|
3
3
|
export interface CodeProps extends HTMLProps<HTMLElement> {
|
|
4
4
|
/**
|
|
5
5
|
* A unique string that appears as a data attribute `data-testid`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/code",
|
|
3
|
-
"version": "15.1
|
|
3
|
+
"version": "15.2.1",
|
|
4
4
|
"description": "Code highlights short strings of code snippets inline with body text.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -20,33 +20,34 @@
|
|
|
20
20
|
"website": {
|
|
21
21
|
"name": "Code",
|
|
22
22
|
"category": "Components"
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
|
+
"runReact18": true
|
|
24
25
|
},
|
|
25
26
|
"config": {
|
|
26
27
|
"access": "public"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
30
|
-
"@atlaskit/theme": "^12.
|
|
31
|
-
"@atlaskit/tokens": "^1.
|
|
32
|
-
"@atlaskit/tooltip": "^18.
|
|
33
|
-
"@atlaskit/visually-hidden": "^1.
|
|
31
|
+
"@atlaskit/theme": "^12.9.0",
|
|
32
|
+
"@atlaskit/tokens": "^1.50.0",
|
|
33
|
+
"@atlaskit/tooltip": "^18.4.0",
|
|
34
|
+
"@atlaskit/visually-hidden": "^1.3.0",
|
|
34
35
|
"@babel/runtime": "^7.0.0",
|
|
35
36
|
"@emotion/react": "^11.7.1",
|
|
36
37
|
"memoize-one": "^6.0.0",
|
|
37
38
|
"refractor": "^3.6.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"react": "^16.8.0"
|
|
41
|
+
"react": "^16.8.0 || ^17.0.0 || ~18.2.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@af/accessibility-testing": "*",
|
|
44
45
|
"@af/integration-testing": "*",
|
|
45
46
|
"@af/visual-regression": "*",
|
|
46
|
-
"@atlaskit/ds-lib": "^2.
|
|
47
|
+
"@atlaskit/ds-lib": "^2.3.0",
|
|
47
48
|
"@atlaskit/ssr": "*",
|
|
49
|
+
"@atlaskit/toggle": "^13.1.0",
|
|
48
50
|
"@atlaskit/visual-regression": "*",
|
|
49
|
-
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
50
51
|
"@testing-library/react": "^12.1.5",
|
|
51
52
|
"@types/jscodeshift": "^0.11.0",
|
|
52
53
|
"@types/refractor": "^3.0.2",
|
|
@@ -104,6 +105,5 @@
|
|
|
104
105
|
"./inline": "./src/entry-points/inline.tsx",
|
|
105
106
|
"./constants": "./src/entry-points/constants.tsx"
|
|
106
107
|
},
|
|
107
|
-
"homepage": "https://atlassian.design/components/code/"
|
|
108
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
108
|
+
"homepage": "https://atlassian.design/components/code/"
|
|
109
109
|
}
|