@atlaskit/primitives 3.1.0 → 4.0.0
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 +16 -0
- package/constellation/text/code.mdx +1 -1
- package/constellation/text/examples.mdx +3 -3
- package/constellation/text/usage.mdx +2 -4
- package/dist/cjs/components/anchor.js +4 -2
- package/dist/cjs/components/bleed.js +3 -2
- package/dist/cjs/components/box.js +5 -5
- package/dist/cjs/components/flex.js +3 -2
- package/dist/cjs/components/grid.js +3 -2
- package/dist/cjs/components/inline.js +8 -3
- package/dist/cjs/components/pressable.js +5 -1
- package/dist/cjs/components/stack.js +8 -3
- package/dist/cjs/components/text.js +2 -5
- package/dist/cjs/xcss/style-maps.partial.js +8 -39
- package/dist/cjs/xcss/xcss.js +52 -14
- package/dist/es2019/components/anchor.js +4 -2
- package/dist/es2019/components/bleed.js +3 -2
- package/dist/es2019/components/box.js +5 -5
- package/dist/es2019/components/flex.js +3 -2
- package/dist/es2019/components/grid.js +3 -2
- package/dist/es2019/components/inline.js +8 -3
- package/dist/es2019/components/pressable.js +5 -1
- package/dist/es2019/components/stack.js +8 -3
- package/dist/es2019/components/text.js +2 -6
- package/dist/es2019/xcss/style-maps.partial.js +7 -38
- package/dist/es2019/xcss/xcss.js +38 -8
- package/dist/esm/components/anchor.js +4 -2
- package/dist/esm/components/bleed.js +3 -2
- package/dist/esm/components/box.js +5 -5
- package/dist/esm/components/flex.js +3 -2
- package/dist/esm/components/grid.js +3 -2
- package/dist/esm/components/inline.js +8 -3
- package/dist/esm/components/pressable.js +5 -1
- package/dist/esm/components/stack.js +8 -3
- package/dist/esm/components/text.js +2 -6
- package/dist/esm/xcss/style-maps.partial.js +7 -38
- package/dist/esm/xcss/xcss.js +52 -10
- package/dist/types/components/flex.d.ts +2 -2
- package/dist/types/components/grid.d.ts +3 -3
- package/dist/types/components/pressable.d.ts +1 -1
- package/dist/types/components/stack.d.ts +1 -1
- package/dist/types/components/text.d.ts +12 -23
- package/dist/types/components/types.d.ts +3 -2
- package/dist/types/xcss/style-maps.partial.d.ts +9 -49
- package/dist/types/xcss/xcss.d.ts +11 -5
- package/dist/types-ts4.5/components/flex.d.ts +2 -2
- package/dist/types-ts4.5/components/grid.d.ts +3 -3
- package/dist/types-ts4.5/components/pressable.d.ts +1 -1
- package/dist/types-ts4.5/components/stack.d.ts +1 -1
- package/dist/types-ts4.5/components/text.d.ts +12 -23
- package/dist/types-ts4.5/components/types.d.ts +3 -2
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +9 -49
- package/dist/types-ts4.5/xcss/xcss.d.ts +11 -5
- package/package.json +3 -2
- package/scripts/codegen-styles.tsx +1 -1
- package/scripts/typography-codegen-template.tsx +34 -56
|
@@ -10,58 +10,36 @@ type Token = {
|
|
|
10
10
|
fallback: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const activeTokens: Token[] = tokens
|
|
14
|
+
.filter(t => t.attributes.state === 'active')
|
|
15
|
+
.map(t => ({
|
|
16
|
+
name: t.name,
|
|
17
|
+
fallback: t.value,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const typographyProperties = [
|
|
21
|
+
{
|
|
22
|
+
objectName: 'bodyFont',
|
|
17
23
|
cssProperty: 'font',
|
|
18
|
-
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.heading'),
|
|
19
|
-
},
|
|
20
|
-
body: {
|
|
21
|
-
objectName: 'bodyText',
|
|
22
24
|
prefix: 'font.body',
|
|
23
|
-
cssProperty: 'font',
|
|
24
25
|
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.body'),
|
|
25
26
|
},
|
|
26
|
-
|
|
27
|
-
objectName: 'uiText',
|
|
28
|
-
prefix: 'font.ui',
|
|
29
|
-
cssProperty: 'font',
|
|
30
|
-
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.ui'),
|
|
31
|
-
},
|
|
32
|
-
fontSize: {
|
|
33
|
-
objectName: 'fontSize',
|
|
34
|
-
cssProperty: 'fontSize',
|
|
35
|
-
prefix: 'font.size',
|
|
36
|
-
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.size'),
|
|
37
|
-
},
|
|
38
|
-
fontWeight: {
|
|
27
|
+
{
|
|
39
28
|
objectName: 'fontWeight',
|
|
40
29
|
cssProperty: 'fontWeight',
|
|
41
30
|
prefix: 'font.weight.',
|
|
42
31
|
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.weight'),
|
|
43
32
|
},
|
|
44
|
-
|
|
33
|
+
{
|
|
45
34
|
objectName: 'fontFamily',
|
|
46
35
|
cssProperty: 'fontFamily',
|
|
47
36
|
prefix: 'font.family.',
|
|
48
37
|
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.family'),
|
|
49
38
|
},
|
|
50
|
-
|
|
51
|
-
objectName: 'lineHeight',
|
|
52
|
-
cssProperty: 'lineHeight',
|
|
53
|
-
prefix: 'font.',
|
|
54
|
-
filterFn: <T extends Token>(t: T) => t.name.startsWith('font.lineHeight'),
|
|
55
|
-
},
|
|
56
|
-
} as const;
|
|
57
|
-
|
|
58
|
-
const activeTokens: Token[] = tokens.map(t => ({
|
|
59
|
-
name: t.name,
|
|
60
|
-
fallback: t.value,
|
|
61
|
-
}));
|
|
39
|
+
] as const;
|
|
62
40
|
|
|
63
41
|
const removeVerbosity = (name: string): string => {
|
|
64
|
-
const partialRemove = ['font.
|
|
42
|
+
const partialRemove = ['font.body'];
|
|
65
43
|
if (partialRemove.some(s => name.includes(s))) {
|
|
66
44
|
return name.replace('font.', '');
|
|
67
45
|
}
|
|
@@ -75,18 +53,14 @@ const removeVerbosity = (name: string): string => {
|
|
|
75
53
|
return name;
|
|
76
54
|
};
|
|
77
55
|
|
|
78
|
-
export const createTypographyStylesFromTemplate = (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
throw new Error(`[codegen] Unknown option found "${typographyProperty}"`);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const { filterFn, objectName } = typographyProperties[typographyProperty];
|
|
56
|
+
export const createTypographyStylesFromTemplate = () => {
|
|
57
|
+
return typographyProperties
|
|
58
|
+
.map(typographyProperty => {
|
|
59
|
+
const { filterFn, objectName } = typographyProperty;
|
|
86
60
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
61
|
+
return (
|
|
62
|
+
prettier.format(
|
|
63
|
+
`
|
|
90
64
|
export const ${objectName}Map = {
|
|
91
65
|
${activeTokens
|
|
92
66
|
.filter(filterFn)
|
|
@@ -102,13 +76,17 @@ ${activeTokens
|
|
|
102
76
|
})
|
|
103
77
|
.join(',\n\t')}
|
|
104
78
|
};`,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
79
|
+
{
|
|
80
|
+
singleQuote: true,
|
|
81
|
+
trailingComma: 'all',
|
|
82
|
+
parser: 'typescript',
|
|
83
|
+
plugins: [parserTypeScript],
|
|
84
|
+
},
|
|
85
|
+
) +
|
|
86
|
+
`\nexport type ${capitalize(
|
|
87
|
+
objectName,
|
|
88
|
+
)} = keyof typeof ${objectName}Map;\n`
|
|
89
|
+
);
|
|
90
|
+
})
|
|
91
|
+
.join('\n');
|
|
114
92
|
};
|