@atlaskit/heading 2.3.1 → 2.3.2
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 +10 -1
- package/LICENSE.md +6 -8
- package/codemods/1.6.0-level-to-size.tsx +51 -66
- package/dist/cjs/heading.partial.js +1 -1
- package/dist/es2019/heading.partial.js +1 -1
- package/dist/esm/heading.partial.js +1 -1
- package/dist/types/heading-context.d.ts +1 -1
- package/dist/types/heading.partial.d.ts +2 -2
- package/dist/types-ts4.5/heading-context.d.ts +1 -1
- package/dist/types-ts4.5/heading.partial.d.ts +2 -2
- package/package.json +2 -2
- package/report.api.md +26 -37
- package/scripts/codegen.tsx +25 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/heading
|
|
2
2
|
|
|
3
|
+
## 2.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#110191](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110191)
|
|
8
|
+
[`c3dc02298f8aa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c3dc02298f8aa) -
|
|
9
|
+
[ux] Change heading xsmall lineheight from 16 to 20 for minor third theme.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 2.3.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -20,7 +29,7 @@
|
|
|
20
29
|
|
|
21
30
|
- [#91625](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91625)
|
|
22
31
|
[`d7770083ff25`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d7770083ff25) -
|
|
23
|
-
Add support for React 18.
|
|
32
|
+
Add support for React 18 in non-strict mode.
|
|
24
33
|
|
|
25
34
|
## 2.1.2
|
|
26
35
|
|
package/LICENSE.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Copyright 2020 Atlassian Pty Ltd
|
|
2
2
|
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
|
|
5
|
-
You may obtain a copy of the License at
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
4
|
+
compliance with the License. You may obtain a copy of the License at
|
|
6
5
|
|
|
7
6
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
7
|
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
limitations under the License.
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
9
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
10
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
|
11
|
+
License.
|
|
@@ -1,81 +1,66 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
API,
|
|
3
|
+
ASTPath,
|
|
4
|
+
default as core,
|
|
5
|
+
FileInfo,
|
|
6
|
+
ImportDeclaration,
|
|
7
|
+
Options,
|
|
8
8
|
} from 'jscodeshift';
|
|
9
9
|
|
|
10
|
-
export default function transformer(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const headingSpecifier = getDefaultSpecifier(j, base, '@atlaskit/heading');
|
|
17
|
-
if (!headingSpecifier) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
10
|
+
export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
11
|
+
const base = j(fileInfo.source);
|
|
12
|
+
const headingSpecifier = getDefaultSpecifier(j, base, '@atlaskit/heading');
|
|
13
|
+
if (!headingSpecifier) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
replaceLevelWithSize(j, base, headingSpecifier);
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
return base.toSource();
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
const levelToSizeMap = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
h900: 'xxlarge',
|
|
24
|
+
h800: 'xlarge',
|
|
25
|
+
h700: 'large',
|
|
26
|
+
h600: 'medium',
|
|
27
|
+
h500: 'small',
|
|
28
|
+
h400: 'xsmall',
|
|
29
|
+
h300: 'xxsmall',
|
|
30
|
+
// We may want to auto-transform h100s and h200s in the future
|
|
31
|
+
// h200: 'xxsmall',
|
|
32
|
+
// h100: 'xxsmall',
|
|
37
33
|
};
|
|
38
34
|
|
|
39
35
|
function replaceLevelWithSize(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
j: core.JSCodeshift,
|
|
37
|
+
source: ReturnType<typeof j>,
|
|
38
|
+
specifier: string,
|
|
43
39
|
) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
40
|
+
source.findJSXElements(specifier).forEach((element) => {
|
|
41
|
+
j(element)
|
|
42
|
+
.find(j.JSXAttribute, { name: { type: 'JSXIdentifier', name: 'level' } })
|
|
43
|
+
.forEach((attr) => {
|
|
44
|
+
const attrValue = j(attr).nodes()[0].value;
|
|
45
|
+
if (attrValue.type === 'StringLiteral') {
|
|
46
|
+
const replacementValue = levelToSizeMap[attrValue.value as keyof typeof levelToSizeMap];
|
|
47
|
+
if (replacementValue) {
|
|
48
|
+
j(attr).replaceWith(
|
|
49
|
+
j.jsxAttribute(j.jsxIdentifier('size'), j.stringLiteral(replacementValue)),
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
63
55
|
}
|
|
64
56
|
|
|
65
|
-
function getDefaultSpecifier(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
path.node.source.value === specifier,
|
|
75
|
-
)
|
|
76
|
-
.find(j.ImportDefaultSpecifier);
|
|
77
|
-
if (!specifiers.length) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return specifiers.nodes()[0]!.local!.name;
|
|
57
|
+
function getDefaultSpecifier(j: core.JSCodeshift, source: any, specifier: string) {
|
|
58
|
+
const specifiers = source
|
|
59
|
+
.find(j.ImportDeclaration)
|
|
60
|
+
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
|
|
61
|
+
.find(j.ImportDefaultSpecifier);
|
|
62
|
+
if (!specifiers.length) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return specifiers.nodes()[0]!.local!.name;
|
|
81
66
|
}
|
|
@@ -93,7 +93,7 @@ var headingColorStylesMap = exports.headingColorStylesMap = {
|
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
96
|
-
* @codegen <<SignedSource::
|
|
96
|
+
* @codegen <<SignedSource::df829c6c0aa19bb57c0c77dc08d12d60>>
|
|
97
97
|
* @codegenId typography
|
|
98
98
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
99
99
|
*/
|
|
@@ -82,7 +82,7 @@ export const headingColorStylesMap = {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
85
|
-
* @codegen <<SignedSource::
|
|
85
|
+
* @codegen <<SignedSource::df829c6c0aa19bb57c0c77dc08d12d60>>
|
|
86
86
|
* @codegenId typography
|
|
87
87
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
88
88
|
*/
|
|
@@ -85,7 +85,7 @@ export var headingColorStylesMap = {
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
88
|
-
* @codegen <<SignedSource::
|
|
88
|
+
* @codegen <<SignedSource::df829c6c0aa19bb57c0c77dc08d12d60>>
|
|
89
89
|
* @codegenId typography
|
|
90
90
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
91
91
|
*/
|
|
@@ -36,5 +36,5 @@ export interface HeadingLevelContextProps {
|
|
|
36
36
|
* </HeadingContext>
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
declare const HeadingLevelContextProvider: ({ children, value
|
|
39
|
+
declare const HeadingLevelContextProvider: ({ children, value }: HeadingLevelContextProps) => JSX.Element;
|
|
40
40
|
export default HeadingLevelContextProvider;
|
|
@@ -12,11 +12,11 @@ import type { HeadingColor, NewHeadingProps } from './types';
|
|
|
12
12
|
* <Heading size="xxlarge">Page title</Heading>
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
declare const Heading: ({ children, size, id, testId, as, color: colorProp
|
|
15
|
+
declare const Heading: ({ children, size, id, testId, as, color: colorProp }: NewHeadingProps) => jsx.JSX.Element;
|
|
16
16
|
export declare const headingColorStylesMap: Record<HeadingColor, SerializedStyles>;
|
|
17
17
|
/**
|
|
18
18
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
19
|
-
* @codegen <<SignedSource::
|
|
19
|
+
* @codegen <<SignedSource::df829c6c0aa19bb57c0c77dc08d12d60>>
|
|
20
20
|
* @codegenId typography
|
|
21
21
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
22
22
|
*/
|
|
@@ -39,5 +39,5 @@ export interface HeadingLevelContextProps {
|
|
|
39
39
|
* </HeadingContext>
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
declare const HeadingLevelContextProvider: ({ children, value
|
|
42
|
+
declare const HeadingLevelContextProvider: ({ children, value }: HeadingLevelContextProps) => JSX.Element;
|
|
43
43
|
export default HeadingLevelContextProvider;
|
|
@@ -12,11 +12,11 @@ import type { HeadingColor, NewHeadingProps } from './types';
|
|
|
12
12
|
* <Heading size="xxlarge">Page title</Heading>
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
declare const Heading: ({ children, size, id, testId, as, color: colorProp
|
|
15
|
+
declare const Heading: ({ children, size, id, testId, as, color: colorProp }: NewHeadingProps) => jsx.JSX.Element;
|
|
16
16
|
export declare const headingColorStylesMap: Record<HeadingColor, SerializedStyles>;
|
|
17
17
|
/**
|
|
18
18
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
19
|
-
* @codegen <<SignedSource::
|
|
19
|
+
* @codegen <<SignedSource::df829c6c0aa19bb57c0c77dc08d12d60>>
|
|
20
20
|
* @codegenId typography
|
|
21
21
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
22
22
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/heading",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "A heading is a typography component used to display text in different sizes and formats.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/primitives": "^7.0.0",
|
|
37
|
-
"@atlaskit/tokens": "^1.
|
|
37
|
+
"@atlaskit/tokens": "^1.50.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
39
|
"@emotion/react": "^11.7.1"
|
|
40
40
|
},
|
package/report.api.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/heading"
|
|
4
4
|
|
|
5
|
-
> Do not edit this file. This report is auto-generated using
|
|
5
|
+
> Do not edit this file. This report is auto-generated using
|
|
6
|
+
> [API Extractor](https://api-extractor.com/).
|
|
6
7
|
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
8
|
|
|
8
9
|
### Table of contents
|
|
@@ -24,45 +25,33 @@ const _default: ({ level, variant, ...props }: HeadingProps) => jsx.JSX.Element;
|
|
|
24
25
|
export default _default;
|
|
25
26
|
|
|
26
27
|
// @public
|
|
27
|
-
export const HeadingContextProvider: ({
|
|
28
|
-
children,
|
|
29
|
-
value,
|
|
30
|
-
}: HeadingLevelContextProps) => JSX.Element;
|
|
28
|
+
export const HeadingContextProvider: ({ children, value }: HeadingLevelContextProps) => JSX.Element;
|
|
31
29
|
|
|
32
30
|
// @public (undocumented)
|
|
33
31
|
type HeadingLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
34
32
|
|
|
35
33
|
// @public (undocumented)
|
|
36
34
|
interface HeadingLevelContextProps {
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
value?: HeadingLevel;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
// @public (undocumented)
|
|
42
40
|
export type HeadingProps = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
testId?: string;
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
id?: string;
|
|
44
|
+
as?: 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';
|
|
45
|
+
color?: 'default' | 'inverse';
|
|
48
46
|
} & (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
| 'h700'
|
|
58
|
-
| 'h800'
|
|
59
|
-
| 'h900';
|
|
60
|
-
variant?: never;
|
|
61
|
-
}
|
|
62
|
-
| {
|
|
63
|
-
level?: never;
|
|
64
|
-
variant?: HeadingVariant;
|
|
65
|
-
}
|
|
47
|
+
| {
|
|
48
|
+
level?: 'h100' | 'h200' | 'h300' | 'h400' | 'h500' | 'h600' | 'h700' | 'h800' | 'h900';
|
|
49
|
+
variant?: never;
|
|
50
|
+
}
|
|
51
|
+
| {
|
|
52
|
+
level?: never;
|
|
53
|
+
variant?: HeadingVariant;
|
|
54
|
+
}
|
|
66
55
|
);
|
|
67
56
|
|
|
68
57
|
// @public (undocumented)
|
|
@@ -70,13 +59,13 @@ type HeadingVariant = keyof typeof headingVariantStylesMap;
|
|
|
70
59
|
|
|
71
60
|
// @public
|
|
72
61
|
const headingVariantStylesMap: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
62
|
+
large: SerializedStyles;
|
|
63
|
+
medium: SerializedStyles;
|
|
64
|
+
small: SerializedStyles;
|
|
65
|
+
xlarge: SerializedStyles;
|
|
66
|
+
xsmall: SerializedStyles;
|
|
67
|
+
xxlarge: SerializedStyles;
|
|
68
|
+
xxsmall: SerializedStyles;
|
|
80
69
|
};
|
|
81
70
|
|
|
82
71
|
// (No @packageDocumentation comment for this package)
|
|
@@ -90,7 +79,7 @@ const headingVariantStylesMap: {
|
|
|
90
79
|
|
|
91
80
|
```json
|
|
92
81
|
{
|
|
93
|
-
|
|
82
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
94
83
|
}
|
|
95
84
|
```
|
|
96
85
|
|
package/scripts/codegen.tsx
CHANGED
|
@@ -9,47 +9,47 @@ import { createPartialSignedArtifact } from '@atlassian/codegen';
|
|
|
9
9
|
import { typographyAdg3 as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
10
10
|
|
|
11
11
|
const constructTokenFunctionCall = (tokenName: string) => {
|
|
12
|
-
|
|
12
|
+
return `token('${tokenName}')`;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const headingTokens = tokens
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
.filter((t) => t.attributes.group === 'typography')
|
|
17
|
+
.filter((t) => t.cleanName.includes('heading'));
|
|
18
18
|
|
|
19
19
|
const removeVerbosity = (name: string): string => {
|
|
20
|
-
|
|
20
|
+
return name.replace('font.heading.', '');
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export const createTypographyStylesFromTemplate = () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
return (
|
|
25
|
+
format(
|
|
26
|
+
`
|
|
27
27
|
const headingSizeStylesMap = {
|
|
28
28
|
${headingTokens
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
.map((token) => {
|
|
30
|
+
return `
|
|
31
31
|
'${removeVerbosity(
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
token.name,
|
|
33
|
+
)}': css({ font: ${constructTokenFunctionCall(token.cleanName)} })
|
|
34
34
|
`.trim();
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
})
|
|
36
|
+
.join(',\n\t')}
|
|
37
37
|
};`,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
'typescript',
|
|
39
|
+
) + `\nexport type HeadingSize = keyof typeof headingSizeStylesMap;\n`
|
|
40
|
+
);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
const targetPath = join(__dirname, '../', 'src', 'heading.partial.tsx');
|
|
44
44
|
|
|
45
45
|
writeFileSync(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
join(__dirname, '../src/heading.partial.tsx'),
|
|
47
|
+
createPartialSignedArtifact(
|
|
48
|
+
createTypographyStylesFromTemplate(),
|
|
49
|
+
'yarn workspace @atlaskit/heading codegen',
|
|
50
|
+
{
|
|
51
|
+
id: 'typography',
|
|
52
|
+
absoluteFilePath: targetPath,
|
|
53
|
+
},
|
|
54
|
+
),
|
|
55
55
|
);
|