@atlaskit/code 15.2.0 → 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.
Files changed (54) hide show
  1. package/CHANGELOG.md +644 -645
  2. package/__perf__/source-code-examples/100-line-example.tsx +49 -40
  3. package/codemods/13.0.0-remove-unnecessary-code-props.tsx +61 -75
  4. package/codemods/13.0.0-rename-imports.tsx +214 -251
  5. package/codemods/14.0.0-lite-mode.tsx +5 -9
  6. package/codemods/__tests__/13.0.0-remove-unnecessary-code-props.tsx +43 -43
  7. package/codemods/__tests__/13.0.0-rename-imports.tsx +143 -143
  8. package/codemods/__tests__/14.0.0-lite-mode/14.0.0-lite-mode.tsx +35 -35
  9. package/codemods/__tests__/14.0.0-lite-mode/remove-language.tsx +21 -21
  10. package/codemods/__tests__/14.0.0-lite-mode/text-to-child.tsx +35 -35
  11. package/codemods/migrations/14.0.0-lite-mode/remove-language.tsx +1 -6
  12. package/codemods/migrations/14.0.0-lite-mode/text-to-child.tsx +53 -61
  13. package/codemods/utils/helpers.tsx +161 -201
  14. package/dist/cjs/internal/theme/styles.js +2 -1
  15. package/dist/es2019/internal/theme/styles.js +2 -1
  16. package/dist/esm/internal/theme/styles.js +2 -1
  17. package/dist/types/bidi-warning/ui/index.d.ts +1 -1
  18. package/dist/types/bidi-warning/ui/styled.d.ts +1 -1
  19. package/dist/types/extract-react-types/code-block.d.ts +16 -16
  20. package/dist/types/internal/hooks/use-highlight.d.ts +1 -1
  21. package/dist/types/internal/utils/get-normalized-language.d.ts +1 -1
  22. package/dist/types/syntax-highlighter/async.d.ts +1 -1
  23. package/dist/types/syntax-highlighter/lib/highlight.d.ts +1 -1
  24. package/dist/types/syntax-highlighter/lib/process/create-line-element.d.ts +1 -1
  25. package/dist/types/syntax-highlighter/lib/process/create-line.d.ts +1 -1
  26. package/dist/types/syntax-highlighter/lib/process/flatten-code-tree.d.ts +1 -1
  27. package/dist/types/syntax-highlighter/lib/process/get-code-tree.d.ts +1 -1
  28. package/dist/types/syntax-highlighter/lib/process/get-inline-line-number.d.ts +1 -1
  29. package/dist/types/syntax-highlighter/lib/process/index.d.ts +1 -1
  30. package/dist/types/syntax-highlighter/lib/react-renderer/create-children.d.ts +2 -2
  31. package/dist/types/syntax-highlighter/lib/react-renderer/create-element.d.ts +2 -2
  32. package/dist/types/syntax-highlighter/lib/react-renderer/index.d.ts +1 -1
  33. package/dist/types/syntax-highlighter/types.d.ts +2 -2
  34. package/dist/types/types.d.ts +1 -1
  35. package/dist/types-ts4.5/bidi-warning/ui/index.d.ts +1 -1
  36. package/dist/types-ts4.5/bidi-warning/ui/styled.d.ts +1 -1
  37. package/dist/types-ts4.5/extract-react-types/code-block.d.ts +16 -16
  38. package/dist/types-ts4.5/internal/hooks/use-highlight.d.ts +1 -1
  39. package/dist/types-ts4.5/internal/utils/get-normalized-language.d.ts +1 -1
  40. package/dist/types-ts4.5/syntax-highlighter/async.d.ts +1 -1
  41. package/dist/types-ts4.5/syntax-highlighter/lib/highlight.d.ts +1 -1
  42. package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line-element.d.ts +1 -1
  43. package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line.d.ts +1 -1
  44. package/dist/types-ts4.5/syntax-highlighter/lib/process/flatten-code-tree.d.ts +1 -1
  45. package/dist/types-ts4.5/syntax-highlighter/lib/process/get-code-tree.d.ts +1 -1
  46. package/dist/types-ts4.5/syntax-highlighter/lib/process/get-inline-line-number.d.ts +1 -1
  47. package/dist/types-ts4.5/syntax-highlighter/lib/process/index.d.ts +1 -1
  48. package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/create-children.d.ts +2 -2
  49. package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/create-element.d.ts +2 -2
  50. package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/index.d.ts +1 -1
  51. package/dist/types-ts4.5/syntax-highlighter/types.d.ts +2 -2
  52. package/dist/types-ts4.5/types.d.ts +1 -1
  53. package/package.json +5 -7
  54. package/report.api.md +807 -807
@@ -12,24 +12,24 @@ export default function CodeBlock(__: {
12
12
  */
13
13
  showLineNumbers?: boolean;
14
14
  /**
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
- */
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
- 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
- */
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,3 +1,3 @@
1
- import { SyntaxHighlighter } from './types';
1
+ import { type SyntaxHighlighter } from './types';
2
2
  declare const _default: typeof SyntaxHighlighter;
3
3
  export default _default;
@@ -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,4 +1,4 @@
1
- import { AST, RefractorNode, SyntaxHighlighterLineProps } from '../../types';
1
+ import { type AST, type RefractorNode, type SyntaxHighlighterLineProps } from '../../types';
2
2
  export type CreateLineElementProps = {
3
3
  children: RefractorNode[];
4
4
  lineNumber: number;
@@ -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,4 +1,4 @@
1
- import { AstGenerator, RefractorNode, SyntaxHighlighterLineProps } from '../../types';
1
+ import { type AstGenerator, type RefractorNode, type SyntaxHighlighterLineProps } from '../../types';
2
2
  interface ProcessLines {
3
3
  astGenerator: AstGenerator;
4
4
  code: string;
@@ -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,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CodeBidiWarningConfig, RefractorNode } from '../../types';
2
+ import { type CodeBidiWarningConfig, type RefractorNode } from '../../types';
3
3
  /**
4
4
  * __React Renderer__
5
5
  *
@@ -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, } from './internal/types';
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.2.0",
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/"
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@atlaskit/codemod-utils": "^4.2.0",
31
- "@atlaskit/theme": "^12.8.0",
32
- "@atlaskit/tokens": "^1.46.0",
33
- "@atlaskit/tooltip": "^18.3.0",
31
+ "@atlaskit/theme": "^12.9.0",
32
+ "@atlaskit/tokens": "^1.50.0",
33
+ "@atlaskit/tooltip": "^18.4.0",
34
34
  "@atlaskit/visually-hidden": "^1.3.0",
35
35
  "@babel/runtime": "^7.0.0",
36
36
  "@emotion/react": "^11.7.1",
@@ -48,7 +48,6 @@
48
48
  "@atlaskit/ssr": "*",
49
49
  "@atlaskit/toggle": "^13.1.0",
50
50
  "@atlaskit/visual-regression": "*",
51
- "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
52
51
  "@testing-library/react": "^12.1.5",
53
52
  "@types/jscodeshift": "^0.11.0",
54
53
  "@types/refractor": "^3.0.2",
@@ -106,6 +105,5 @@
106
105
  "./inline": "./src/entry-points/inline.tsx",
107
106
  "./constants": "./src/entry-points/constants.tsx"
108
107
  },
109
- "homepage": "https://atlassian.design/components/code/",
110
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
108
+ "homepage": "https://atlassian.design/components/code/"
111
109
  }