@atlaskit/primitives 0.9.0 → 0.9.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 +12 -0
- package/README.md +6 -2
- package/box/package.json +2 -2
- package/constellation/box/code.mdx +6 -2
- package/constellation/box/usage.mdx +30 -0
- package/constellation/inline/code.mdx +1 -1
- package/constellation/inline/usage.mdx +36 -0
- package/constellation/overview/images/box-usage-example.png +0 -0
- package/constellation/overview/images/inline-usage-example.png +0 -0
- package/constellation/overview/images/stack-usage-example.png +0 -0
- package/constellation/overview/index.mdx +66 -0
- package/constellation/stack/code.mdx +1 -1
- package/constellation/stack/usage.mdx +31 -0
- package/constellation/xcss/examples.mdx +21 -0
- package/constellation/xcss/logo.png +0 -0
- package/constellation/xcss/migration.mdx +142 -0
- package/constellation/xcss/usage.mdx +115 -0
- package/dist/cjs/components/box.js +1 -1
- package/dist/cjs/components/inline.js +1 -1
- package/dist/cjs/components/internal/base-box.js +1 -1
- package/dist/cjs/components/stack.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/{internal → xcss}/style-maps.partial.js +13 -43
- package/dist/cjs/{internal → xcss}/xcss.js +38 -26
- package/dist/es2019/components/box.js +1 -1
- package/dist/es2019/components/inline.js +1 -1
- package/dist/es2019/components/internal/base-box.js +1 -1
- package/dist/es2019/components/stack.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/{internal → xcss}/style-maps.partial.js +12 -40
- package/dist/es2019/{internal → xcss}/xcss.js +38 -25
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/components/inline.js +1 -1
- package/dist/esm/components/internal/base-box.js +1 -1
- package/dist/esm/components/stack.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/{internal → xcss}/style-maps.partial.js +12 -40
- package/dist/esm/{internal → xcss}/xcss.js +39 -27
- package/dist/types/components/box.d.ts +2 -2
- package/dist/types/components/inline.d.ts +7 -7
- package/dist/types/components/internal/base-box.d.ts +15 -14
- package/dist/types/components/stack.d.ts +6 -6
- package/dist/types/components/types.d.ts +3 -3
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/helpers/responsive/types.d.ts +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/{internal → xcss}/style-maps.partial.d.ts +81 -130
- package/dist/types/xcss/xcss.d.ts +57 -0
- package/extract-react-types/box-props.tsx +95 -0
- package/extract-react-types/inline-props.tsx +86 -1
- package/extract-react-types/stack-props.tsx +70 -1
- package/inline/package.json +2 -2
- package/package.json +25 -8
- package/report.api.md +94 -354
- package/responsive/package.json +2 -2
- package/scripts/codegen-file-templates/dimensions.tsx +17 -16
- package/scripts/codegen-styles.tsx +2 -2
- package/scripts/spacing-codegen-template.tsx +24 -91
- package/stack/package.json +2 -2
- package/tmp/api-report-tmp.d.ts +649 -0
- package/constellation/overview/examples.mdx +0 -7
- package/dist/cjs/components/internal/extract-react-types/inline-props.js +0 -7
- package/dist/cjs/components/internal/extract-react-types/stack-props.js +0 -7
- package/dist/es2019/components/internal/extract-react-types/inline-props.js +0 -1
- package/dist/es2019/components/internal/extract-react-types/stack-props.js +0 -1
- package/dist/esm/components/internal/extract-react-types/inline-props.js +0 -1
- package/dist/esm/components/internal/extract-react-types/stack-props.js +0 -1
- package/dist/types/components/internal/extract-react-types/inline-props.d.ts +0 -2
- package/dist/types/components/internal/extract-react-types/stack-props.d.ts +0 -2
- package/dist/types/internal/xcss.d.ts +0 -50
|
@@ -3,98 +3,31 @@ import parserTypeScript from 'prettier/parser-typescript';
|
|
|
3
3
|
|
|
4
4
|
import { spacing as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const spacingProperties: Record<
|
|
9
|
-
string,
|
|
10
|
-
{
|
|
11
|
-
cssProperties: readonly string[];
|
|
12
|
-
propNameFormatter?: (propName: string) => string;
|
|
13
|
-
}
|
|
14
|
-
> = {
|
|
15
|
-
padding: {
|
|
16
|
-
cssProperties: [
|
|
17
|
-
'padding',
|
|
18
|
-
'paddingBlock',
|
|
19
|
-
'paddingBlockEnd',
|
|
20
|
-
'paddingBlockStart',
|
|
21
|
-
'paddingBottom',
|
|
22
|
-
'paddingInline',
|
|
23
|
-
'paddingInlineEnd',
|
|
24
|
-
'paddingInlineStart',
|
|
25
|
-
'paddingLeft',
|
|
26
|
-
'paddingRight',
|
|
27
|
-
'paddingTop',
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
space: {
|
|
31
|
-
cssProperties: ['gap', 'rowGap', 'columnGap'],
|
|
32
|
-
},
|
|
33
|
-
inset: {
|
|
34
|
-
cssProperties: [
|
|
35
|
-
'inset',
|
|
36
|
-
'insetBlock',
|
|
37
|
-
'insetBlockEnd',
|
|
38
|
-
'insetBlockStart',
|
|
39
|
-
'insetInline',
|
|
40
|
-
'insetInlineEnd',
|
|
41
|
-
'insetInlineStart',
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
} as const;
|
|
6
|
+
import { constructTokenFunctionCall } from './utils';
|
|
45
7
|
|
|
46
8
|
const spacingTokenPrefix = 'space.';
|
|
47
|
-
const
|
|
48
|
-
token.name.startsWith(spacingTokenPrefix)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
export const
|
|
57
|
-
|
|
58
|
-
) =>
|
|
59
|
-
|
|
60
|
-
throw new Error(`[codegen] Unknown option found "${spacingProperty}"`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const { cssProperties, propNameFormatter } =
|
|
64
|
-
spacingProperties[spacingProperty]!;
|
|
65
|
-
|
|
66
|
-
return prettier.format(
|
|
67
|
-
`
|
|
68
|
-
export const ${spacingProperty}Map = {
|
|
69
|
-
${activeTokens
|
|
70
|
-
.sort((a, b) =>
|
|
71
|
-
a.name.localeCompare(b.name, undefined, { numeric: true }),
|
|
9
|
+
const spaceTokens = tokens
|
|
10
|
+
.filter(token => token.name.startsWith(spacingTokenPrefix))
|
|
11
|
+
.map(t => ({
|
|
12
|
+
name: t.name,
|
|
13
|
+
fallback: t.attributes.pixelValue!,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
export const createSpacingStylesFromTemplate = () => {
|
|
17
|
+
const output = [
|
|
18
|
+
`export const spaceMap = {\n${spaceTokens
|
|
19
|
+
.map(
|
|
20
|
+
({ name, fallback }) =>
|
|
21
|
+
`'${name}': ${constructTokenFunctionCall(name, fallback)},`,
|
|
72
22
|
)
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
(cssProperties
|
|
84
|
-
.map(
|
|
85
|
-
cssProperty =>
|
|
86
|
-
// TODO: Update to use `keyof` when ERT supports it: https://github.com/atlassian/extract-react-types/issues/149
|
|
87
|
-
`\nexport type ${capitalize(cssProperty)} = ${activeTokens
|
|
88
|
-
.map(token => `'${token.name}'`)
|
|
89
|
-
.join(' | ')}`,
|
|
90
|
-
)
|
|
91
|
-
.join('') +
|
|
92
|
-
'\n'),
|
|
93
|
-
{
|
|
94
|
-
singleQuote: true,
|
|
95
|
-
trailingComma: 'all',
|
|
96
|
-
parser: 'typescript',
|
|
97
|
-
plugins: [parserTypeScript],
|
|
98
|
-
},
|
|
99
|
-
);
|
|
23
|
+
.join('\n')}}`,
|
|
24
|
+
`export type Space = keyof typeof spaceMap;\n`,
|
|
25
|
+
].join('\n');
|
|
26
|
+
|
|
27
|
+
return prettier.format(output, {
|
|
28
|
+
singleQuote: true,
|
|
29
|
+
trailingComma: 'all',
|
|
30
|
+
parser: 'typescript',
|
|
31
|
+
plugins: [parserTypeScript],
|
|
32
|
+
});
|
|
100
33
|
};
|
package/stack/package.json
CHANGED