@atlaskit/heading 4.2.0 → 4.3.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 +20 -0
- package/package.json +4 -5
- package/codemods/1.6.0-level-to-size.tsx +0 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/heading
|
|
2
2
|
|
|
3
|
+
## 4.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#114791](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114791)
|
|
8
|
+
[`084765a9c326c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/084765a9c326c) -
|
|
9
|
+
Remove old codemods and update dependencies.
|
|
10
|
+
|
|
11
|
+
## 4.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#116138](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116138)
|
|
16
|
+
[`b50c5d5d65ae2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b50c5d5d65ae2) -
|
|
17
|
+
Bump to the latest version of @compiled/react
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 4.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/heading",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
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/"
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"codegen": "ts-node ./scripts/codegen.tsx"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/css": "^0.
|
|
35
|
-
"@atlaskit/primitives": "^13.
|
|
34
|
+
"@atlaskit/css": "^0.9.0",
|
|
35
|
+
"@atlaskit/primitives": "^13.6.0",
|
|
36
36
|
"@atlaskit/tokens": "^3.3.0",
|
|
37
37
|
"@babel/runtime": "^7.0.0",
|
|
38
|
-
"@compiled/react": "^0.18.
|
|
38
|
+
"@compiled/react": "^0.18.2",
|
|
39
39
|
"@emotion/react": "^11.7.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"@atlaskit/ssr": "*",
|
|
52
52
|
"@atlassian/codegen": "^0.1.0",
|
|
53
53
|
"@testing-library/react": "^13.4.0",
|
|
54
|
-
"jscodeshift": "^0.13.0",
|
|
55
54
|
"react-dom": "^18.2.0",
|
|
56
55
|
"ts-node": "^10.9.1",
|
|
57
56
|
"typescript": "~5.4.2"
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
API,
|
|
3
|
-
ASTPath,
|
|
4
|
-
default as core,
|
|
5
|
-
FileInfo,
|
|
6
|
-
ImportDeclaration,
|
|
7
|
-
Options,
|
|
8
|
-
} from 'jscodeshift';
|
|
9
|
-
|
|
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
|
-
}
|
|
16
|
-
|
|
17
|
-
replaceLevelWithSize(j, base, headingSpecifier);
|
|
18
|
-
|
|
19
|
-
return base.toSource();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const levelToSizeMap = {
|
|
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',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
function replaceLevelWithSize(
|
|
36
|
-
j: core.JSCodeshift,
|
|
37
|
-
source: ReturnType<typeof j>,
|
|
38
|
-
specifier: string,
|
|
39
|
-
) {
|
|
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
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
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;
|
|
66
|
-
}
|