@atlaskit/ds-explorations 5.1.1 → 5.1.3
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/dist/cjs/components/interaction-surface.partial.js +2 -2
- package/dist/cjs/internal/color-map.js +2 -2
- package/dist/es2019/components/interaction-surface.partial.js +2 -2
- package/dist/es2019/internal/color-map.js +2 -2
- package/dist/esm/components/interaction-surface.partial.js +2 -2
- package/dist/esm/internal/color-map.js +2 -2
- package/dist/types/components/interaction-surface.partial.d.ts +3 -4
- package/dist/types/internal/color-map.d.ts +2 -2
- package/dist/types-ts4.5/components/interaction-surface.partial.d.ts +3 -4
- package/dist/types-ts4.5/internal/color-map.d.ts +2 -2
- package/package.json +4 -4
- package/scripts/color-codegen-template.tsx +10 -12
- package/scripts/color-map-template.tsx +1 -1
- package/scripts/dimension-codegen-template.tsx +1 -1
- package/scripts/interaction-codegen.tsx +4 -4
- package/scripts/misc-codegen-template.tsx +1 -1
- package/scripts/utils.tsx +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -58,11 +58,11 @@ var InteractionSurface = function InteractionSurface(_ref) {
|
|
|
58
58
|
var _default = exports.default = InteractionSurface;
|
|
59
59
|
/**
|
|
60
60
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
61
|
-
* @codegen <<SignedSource::
|
|
61
|
+
* @codegen <<SignedSource::2872a8059e6b2969c20ed7a592cc85ca>>
|
|
62
62
|
* @codegenId interactions
|
|
63
63
|
* @codegenCommand yarn codegen-styles
|
|
64
64
|
* @codegenParams ["background"]
|
|
65
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
65
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
66
66
|
*/
|
|
67
67
|
var backgroundActiveColorMap = {
|
|
68
68
|
'accent.lime.subtlest': (0, _react2.css)({
|
|
@@ -9,9 +9,9 @@ exports.default = void 0;
|
|
|
9
9
|
*
|
|
10
10
|
* The color map is used to map a background color token to a matching text color that will meet contrast.
|
|
11
11
|
*
|
|
12
|
-
* @codegen <<SignedSource::
|
|
12
|
+
* @codegen <<SignedSource::d6bdd642b5973f7d1d9f1e5f085c36c9>>
|
|
13
13
|
* @codegenCommand yarn codegen-styles
|
|
14
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
14
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
15
15
|
*/
|
|
16
16
|
var _default = exports.default = {
|
|
17
17
|
'neutral.bold': 'inverse',
|
|
@@ -53,11 +53,11 @@ export default InteractionSurface;
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
56
|
-
* @codegen <<SignedSource::
|
|
56
|
+
* @codegen <<SignedSource::2872a8059e6b2969c20ed7a592cc85ca>>
|
|
57
57
|
* @codegenId interactions
|
|
58
58
|
* @codegenCommand yarn codegen-styles
|
|
59
59
|
* @codegenParams ["background"]
|
|
60
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
60
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
63
|
const backgroundActiveColorMap = {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The color map is used to map a background color token to a matching text color that will meet contrast.
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::d6bdd642b5973f7d1d9f1e5f085c36c9>>
|
|
7
7
|
* @codegenCommand yarn codegen-styles
|
|
8
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
8
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
'neutral.bold': 'inverse',
|
|
@@ -52,11 +52,11 @@ export default InteractionSurface;
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
55
|
-
* @codegen <<SignedSource::
|
|
55
|
+
* @codegen <<SignedSource::2872a8059e6b2969c20ed7a592cc85ca>>
|
|
56
56
|
* @codegenId interactions
|
|
57
57
|
* @codegenCommand yarn codegen-styles
|
|
58
58
|
* @codegenParams ["background"]
|
|
59
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
59
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
var backgroundActiveColorMap = {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The color map is used to map a background color token to a matching text color that will meet contrast.
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::d6bdd642b5973f7d1d9f1e5f085c36c9>>
|
|
7
7
|
* @codegenCommand yarn codegen-styles
|
|
8
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
8
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
'neutral.bold': 'inverse',
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
6
|
import { type BasePrimitiveProps } from './types';
|
|
8
7
|
interface InteractionSurfaceProps extends BasePrimitiveProps {
|
|
9
8
|
children: ReactNode;
|
|
@@ -21,15 +20,15 @@ interface InteractionSurfaceProps extends BasePrimitiveProps {
|
|
|
21
20
|
* </Pressable>
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
|
-
declare const InteractionSurface: ({ appearance, children, testId }: InteractionSurfaceProps) =>
|
|
23
|
+
declare const InteractionSurface: ({ appearance, children, testId }: InteractionSurfaceProps) => React.JSX.Element;
|
|
25
24
|
export default InteractionSurface;
|
|
26
25
|
/**
|
|
27
26
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
28
|
-
* @codegen <<SignedSource::
|
|
27
|
+
* @codegen <<SignedSource::2872a8059e6b2969c20ed7a592cc85ca>>
|
|
29
28
|
* @codegenId interactions
|
|
30
29
|
* @codegenCommand yarn codegen-styles
|
|
31
30
|
* @codegenParams ["background"]
|
|
32
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
31
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
33
32
|
*/
|
|
34
33
|
type InteractionBackgroundColor = 'accent.lime.subtlest' | 'accent.lime.subtler' | 'accent.lime.subtle' | 'accent.lime.bolder' | 'accent.red.subtlest' | 'accent.red.subtler' | 'accent.red.subtle' | 'accent.red.bolder' | 'accent.orange.subtlest' | 'accent.orange.subtler' | 'accent.orange.subtle' | 'accent.orange.bolder' | 'accent.yellow.subtlest' | 'accent.yellow.subtler' | 'accent.yellow.subtle' | 'accent.yellow.bolder' | 'accent.green.subtlest' | 'accent.green.subtler' | 'accent.green.subtle' | 'accent.green.bolder' | 'accent.teal.subtlest' | 'accent.teal.subtler' | 'accent.teal.subtle' | 'accent.teal.bolder' | 'accent.blue.subtlest' | 'accent.blue.subtler' | 'accent.blue.subtle' | 'accent.blue.bolder' | 'accent.purple.subtlest' | 'accent.purple.subtler' | 'accent.purple.subtle' | 'accent.purple.bolder' | 'accent.magenta.subtlest' | 'accent.magenta.subtler' | 'accent.magenta.subtle' | 'accent.magenta.bolder' | 'accent.gray.subtlest' | 'accent.gray.subtler' | 'accent.gray.subtle' | 'accent.gray.bolder' | 'input' | 'inverse.subtle' | 'neutral' | 'neutral.subtle' | 'neutral.bold' | 'selected' | 'selected.bold' | 'brand.subtlest' | 'brand.bold' | 'brand.boldest' | 'danger' | 'danger.subtler' | 'danger.bold' | 'warning' | 'warning.subtler' | 'warning.bold' | 'success' | 'success.subtler' | 'success.bold' | 'discovery' | 'discovery.subtler' | 'discovery.bold' | 'information' | 'information.subtler' | 'information.bold' | 'elevation.surface' | 'elevation.surface.overlay' | 'elevation.surface.raised';
|
|
35
34
|
/**
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The color map is used to map a background color token to a matching text color that will meet contrast.
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::d6bdd642b5973f7d1d9f1e5f085c36c9>>
|
|
7
7
|
* @codegenCommand yarn codegen-styles
|
|
8
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
8
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
9
9
|
*/
|
|
10
10
|
declare const _default: {
|
|
11
11
|
readonly 'neutral.bold': "inverse";
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
6
|
import { type BasePrimitiveProps } from './types';
|
|
8
7
|
interface InteractionSurfaceProps extends BasePrimitiveProps {
|
|
9
8
|
children: ReactNode;
|
|
@@ -21,15 +20,15 @@ interface InteractionSurfaceProps extends BasePrimitiveProps {
|
|
|
21
20
|
* </Pressable>
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
|
-
declare const InteractionSurface: ({ appearance, children, testId }: InteractionSurfaceProps) =>
|
|
23
|
+
declare const InteractionSurface: ({ appearance, children, testId }: InteractionSurfaceProps) => React.JSX.Element;
|
|
25
24
|
export default InteractionSurface;
|
|
26
25
|
/**
|
|
27
26
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
28
|
-
* @codegen <<SignedSource::
|
|
27
|
+
* @codegen <<SignedSource::2872a8059e6b2969c20ed7a592cc85ca>>
|
|
29
28
|
* @codegenId interactions
|
|
30
29
|
* @codegenCommand yarn codegen-styles
|
|
31
30
|
* @codegenParams ["background"]
|
|
32
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
31
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
33
32
|
*/
|
|
34
33
|
type InteractionBackgroundColor = 'accent.lime.subtlest' | 'accent.lime.subtler' | 'accent.lime.subtle' | 'accent.lime.bolder' | 'accent.red.subtlest' | 'accent.red.subtler' | 'accent.red.subtle' | 'accent.red.bolder' | 'accent.orange.subtlest' | 'accent.orange.subtler' | 'accent.orange.subtle' | 'accent.orange.bolder' | 'accent.yellow.subtlest' | 'accent.yellow.subtler' | 'accent.yellow.subtle' | 'accent.yellow.bolder' | 'accent.green.subtlest' | 'accent.green.subtler' | 'accent.green.subtle' | 'accent.green.bolder' | 'accent.teal.subtlest' | 'accent.teal.subtler' | 'accent.teal.subtle' | 'accent.teal.bolder' | 'accent.blue.subtlest' | 'accent.blue.subtler' | 'accent.blue.subtle' | 'accent.blue.bolder' | 'accent.purple.subtlest' | 'accent.purple.subtler' | 'accent.purple.subtle' | 'accent.purple.bolder' | 'accent.magenta.subtlest' | 'accent.magenta.subtler' | 'accent.magenta.subtle' | 'accent.magenta.bolder' | 'accent.gray.subtlest' | 'accent.gray.subtler' | 'accent.gray.subtle' | 'accent.gray.bolder' | 'input' | 'inverse.subtle' | 'neutral' | 'neutral.subtle' | 'neutral.bold' | 'selected' | 'selected.bold' | 'brand.subtlest' | 'brand.bold' | 'brand.boldest' | 'danger' | 'danger.subtler' | 'danger.bold' | 'warning' | 'warning.subtler' | 'warning.bold' | 'success' | 'success.subtler' | 'success.bold' | 'discovery' | 'discovery.subtler' | 'discovery.bold' | 'information' | 'information.subtler' | 'information.bold' | 'elevation.surface' | 'elevation.surface.overlay' | 'elevation.surface.raised';
|
|
35
34
|
/**
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The color map is used to map a background color token to a matching text color that will meet contrast.
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::d6bdd642b5973f7d1d9f1e5f085c36c9>>
|
|
7
7
|
* @codegenCommand yarn codegen-styles
|
|
8
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
8
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
9
9
|
*/
|
|
10
10
|
declare const _default: {
|
|
11
11
|
readonly 'neutral.bold': "inverse";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/ds-explorations",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"description": "DEPRECATED. Use @atlaskit/primitives. An experimental package for exploration and validation of spacing / typography foundations.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prepare": "yarn ak-postbuild"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaskit/tokens": "^
|
|
28
|
+
"@atlaskit/tokens": "^11.0.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0",
|
|
30
30
|
"@emotion/react": "^11.7.1"
|
|
31
31
|
},
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@af/formatting": "workspace:^",
|
|
37
37
|
"@atlaskit/ds-lib": "^5.3.0",
|
|
38
|
-
"@atlaskit/primitives": "^
|
|
38
|
+
"@atlaskit/primitives": "^18.0.0",
|
|
39
39
|
"@atlaskit/textfield": "^8.2.0",
|
|
40
40
|
"@atlassian/codegen": "^0.1.0",
|
|
41
|
-
"@testing-library/react": "^
|
|
41
|
+
"@testing-library/react": "^16.3.0",
|
|
42
42
|
"fs-extra": "^4.0.2",
|
|
43
43
|
"react-dom": "^18.2.0",
|
|
44
44
|
"ts-node": "^10.9.1"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import format from '@af/formatting/sync';
|
|
2
|
-
import {
|
|
2
|
+
import { light as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
capitalize,
|
|
@@ -24,13 +24,13 @@ const tokenStyles = {
|
|
|
24
24
|
objectName: 'textColor',
|
|
25
25
|
prefix: 'color.text.',
|
|
26
26
|
cssProperty: 'color',
|
|
27
|
-
filterFn: <T extends Token>(t: T) => t.token.startsWith(tokenStyles.text.prefix),
|
|
27
|
+
filterFn: <T extends Token>(t: T): boolean => t.token.startsWith(tokenStyles.text.prefix),
|
|
28
28
|
},
|
|
29
29
|
background: {
|
|
30
30
|
objectName: 'backgroundColor',
|
|
31
31
|
prefix: 'color.background.',
|
|
32
32
|
cssProperty: 'backgroundColor',
|
|
33
|
-
filterFn: <T extends Token>(t: T) =>
|
|
33
|
+
filterFn: <T extends Token>(t: T): boolean =>
|
|
34
34
|
t.token.startsWith(tokenStyles.background.prefix) ||
|
|
35
35
|
t.token.startsWith('elevation.surface') ||
|
|
36
36
|
t.token.startsWith('color.blanket'),
|
|
@@ -39,31 +39,29 @@ const tokenStyles = {
|
|
|
39
39
|
objectName: 'borderColor',
|
|
40
40
|
prefix: 'color.border.',
|
|
41
41
|
cssProperty: 'borderColor',
|
|
42
|
-
filterFn: <T extends Token>(t: T) => t.token.startsWith(tokenStyles.border.prefix),
|
|
42
|
+
filterFn: <T extends Token>(t: T): boolean => t.token.startsWith(tokenStyles.border.prefix),
|
|
43
43
|
},
|
|
44
44
|
shadow: {
|
|
45
45
|
objectName: 'shadow',
|
|
46
46
|
prefix: 'elevation.shadow.',
|
|
47
47
|
cssProperty: 'boxShadow',
|
|
48
|
-
filterFn: <T extends Token>(t: T) => t.token.startsWith(tokenStyles.shadow.prefix),
|
|
48
|
+
filterFn: <T extends Token>(t: T): boolean => t.token.startsWith(tokenStyles.shadow.prefix),
|
|
49
49
|
},
|
|
50
50
|
} as const;
|
|
51
51
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
const activeTokens = bothTokens
|
|
55
|
-
.filter(([t]) => t.attributes.state !== 'deleted' && t.attributes.state !== 'deprecated')
|
|
52
|
+
const activeTokens = tokens
|
|
53
|
+
.filter((t) => t.attributes.state !== 'deleted' && t.attributes.state !== 'deprecated')
|
|
56
54
|
.map(
|
|
57
|
-
(
|
|
55
|
+
(t): Token => ({
|
|
58
56
|
token: t.name,
|
|
59
|
-
fallback:
|
|
57
|
+
fallback: t.value as string | ShadowDefintion,
|
|
60
58
|
}),
|
|
61
59
|
)
|
|
62
60
|
.filter(compose(pick('token'), not(isAccent)))
|
|
63
61
|
.filter(compose(pick('token'), not(isPressed)))
|
|
64
62
|
.filter(compose(pick('token'), not(isHovered)));
|
|
65
63
|
|
|
66
|
-
export const createColorStylesFromTemplate = (colorProperty: keyof typeof tokenStyles) => {
|
|
64
|
+
export const createColorStylesFromTemplate = (colorProperty: keyof typeof tokenStyles): string => {
|
|
67
65
|
if (!tokenStyles[colorProperty]) {
|
|
68
66
|
throw new Error(`[codegen] Unknown option found "${colorProperty}"`);
|
|
69
67
|
}
|
|
@@ -22,7 +22,7 @@ const activeTokens = tokens
|
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
.map((t) => ({ ...t, token: t.token.replaceAll('.[default]', '') }));
|
|
24
24
|
|
|
25
|
-
export const createColorMapTemplate = () => {
|
|
25
|
+
export const createColorMapTemplate = (): string => {
|
|
26
26
|
return format(
|
|
27
27
|
`
|
|
28
28
|
export default {
|
|
@@ -30,7 +30,7 @@ const activeTokens = Object.entries(dimensions).map(([name, value]) => ({
|
|
|
30
30
|
|
|
31
31
|
export const createDimensionStylesFromTemplate = (
|
|
32
32
|
spacingProperty: keyof typeof dimensionProperties,
|
|
33
|
-
) => {
|
|
33
|
+
): string => {
|
|
34
34
|
if (!dimensionProperties[spacingProperty]) {
|
|
35
35
|
throw new Error(`[codegen] Unknown option found "${spacingProperty}"`);
|
|
36
36
|
}
|
|
@@ -13,12 +13,12 @@ const colors = {
|
|
|
13
13
|
text: {
|
|
14
14
|
prefix: 'color.text.',
|
|
15
15
|
cssProperty: 'color',
|
|
16
|
-
filterFn: <T extends Token>(t: T) => t.token.startsWith(colors.text.prefix),
|
|
16
|
+
filterFn: <T extends Token>(t: T): boolean => t.token.startsWith(colors.text.prefix),
|
|
17
17
|
},
|
|
18
18
|
background: {
|
|
19
19
|
prefix: 'color.background.',
|
|
20
20
|
cssProperty: 'backgroundColor',
|
|
21
|
-
filterFn: <T extends Token>(t: T) =>
|
|
21
|
+
filterFn: <T extends Token>(t: T): boolean =>
|
|
22
22
|
t.token.startsWith(colors.background.prefix) ||
|
|
23
23
|
t.token.startsWith('elevation.surface') ||
|
|
24
24
|
t.token.startsWith('color.blanket'),
|
|
@@ -26,7 +26,7 @@ const colors = {
|
|
|
26
26
|
border: {
|
|
27
27
|
prefix: 'color.border.',
|
|
28
28
|
cssProperty: 'borderColor',
|
|
29
|
-
filterFn: <T extends Token>(t: T) => t.token.startsWith(colors.border.prefix),
|
|
29
|
+
filterFn: <T extends Token>(t: T): boolean => t.token.startsWith(colors.border.prefix),
|
|
30
30
|
},
|
|
31
31
|
} as const;
|
|
32
32
|
|
|
@@ -43,7 +43,7 @@ const activeTokens = tokens
|
|
|
43
43
|
const pressedTokens = activeTokens.filter(compose(pick('token'), isPressed));
|
|
44
44
|
const hoveredTokens = activeTokens.filter(compose(pick('token'), isHovered));
|
|
45
45
|
|
|
46
|
-
export const createInteractionStylesFromTemplate = (colorProperty: keyof typeof colors) => {
|
|
46
|
+
export const createInteractionStylesFromTemplate = (colorProperty: keyof typeof colors): string => {
|
|
47
47
|
if (!colors[colorProperty]) {
|
|
48
48
|
throw new Error(`[codegen] Unknown option found "${colorProperty}"`);
|
|
49
49
|
}
|
|
@@ -16,7 +16,7 @@ const styleProperties: Record<'layer', Record<Layer, number>> = {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const createStylesFromTemplate = (property: keyof typeof styleProperties) => {
|
|
19
|
+
export const createStylesFromTemplate = (property: keyof typeof styleProperties): string => {
|
|
20
20
|
if (!styleProperties[property]) {
|
|
21
21
|
throw new Error(`[codegen] Unknown option found "${property}"`);
|
|
22
22
|
}
|
package/scripts/utils.tsx
CHANGED
|
@@ -31,21 +31,21 @@ type BooleanCallback<T> = (args: T) => boolean;
|
|
|
31
31
|
|
|
32
32
|
export const compose =
|
|
33
33
|
(...fns: ((...any: any[]) => any)[]) =>
|
|
34
|
-
(x: any) =>
|
|
34
|
+
(x: any): any =>
|
|
35
35
|
fns.reduce((res, fn) => fn(res), x);
|
|
36
36
|
export const pick =
|
|
37
37
|
<T extends any>(key: keyof T) =>
|
|
38
38
|
(obj: T) =>
|
|
39
39
|
obj[key];
|
|
40
|
-
export const isAccent = (str: string) => str.includes('accent');
|
|
41
|
-
export const isPressed = (str: string) => str.includes('pressed');
|
|
42
|
-
export const isHovered = (str: string) => str.includes('hovered');
|
|
40
|
+
export const isAccent = (str: string): boolean => str.includes('accent');
|
|
41
|
+
export const isPressed = (str: string): boolean => str.includes('pressed');
|
|
42
|
+
export const isHovered = (str: string): boolean => str.includes('hovered');
|
|
43
43
|
export const not =
|
|
44
44
|
<T extends any>(cb: BooleanCallback<T>) =>
|
|
45
|
-
(val: T) =>
|
|
45
|
+
(val: T): boolean =>
|
|
46
46
|
!cb(val);
|
|
47
47
|
export const or =
|
|
48
48
|
<T extends any>(...fns: BooleanCallback<T>[]) =>
|
|
49
|
-
(val: T) =>
|
|
49
|
+
(val: T): boolean =>
|
|
50
50
|
fns.some((fn) => fn(val));
|
|
51
|
-
export const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
51
|
+
export const capitalize = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1);
|