@atlaskit/ds-explorations 5.1.2 → 5.1.4
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 +13 -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 -3
- package/dist/types/components/surface-provider.d.ts +1 -1
- package/dist/types/internal/color-map.d.ts +2 -2
- package/dist/types-ts4.5/components/interaction-surface.partial.d.ts +3 -3
- package/dist/types-ts4.5/components/surface-provider.d.ts +1 -1
- package/dist/types-ts4.5/internal/color-map.d.ts +2 -2
- package/package.json +4 -4
- package/scripts/codegen-styles.tsx +2 -3
- package/scripts/color-codegen-template.tsx +9 -11
- package/scripts/interaction-codegen.tsx +3 -3
- package/scripts/utils.tsx +15 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/ds-explorations
|
|
2
2
|
|
|
3
|
+
## 5.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`22bf79dbdcdca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/22bf79dbdcdca) -
|
|
8
|
+
Internal changes to remove unnecessary token fallbacks and imports from `@atlaskit/theme`
|
|
9
|
+
|
|
10
|
+
## 5.1.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 5.1.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -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',
|
|
@@ -20,15 +20,15 @@ interface InteractionSurfaceProps extends BasePrimitiveProps {
|
|
|
20
20
|
* </Pressable>
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
declare const InteractionSurface: ({ appearance, children, testId }: InteractionSurfaceProps) => React.JSX.Element;
|
|
23
|
+
declare const InteractionSurface: ({ appearance, children, testId, }: InteractionSurfaceProps) => React.JSX.Element;
|
|
24
24
|
export default InteractionSurface;
|
|
25
25
|
/**
|
|
26
26
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
27
|
-
* @codegen <<SignedSource::
|
|
27
|
+
* @codegen <<SignedSource::2872a8059e6b2969c20ed7a592cc85ca>>
|
|
28
28
|
* @codegenId interactions
|
|
29
29
|
* @codegenCommand yarn codegen-styles
|
|
30
30
|
* @codegenParams ["background"]
|
|
31
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
31
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
32
32
|
*/
|
|
33
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';
|
|
34
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";
|
|
@@ -20,15 +20,15 @@ interface InteractionSurfaceProps extends BasePrimitiveProps {
|
|
|
20
20
|
* </Pressable>
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
declare const InteractionSurface: ({ appearance, children, testId }: InteractionSurfaceProps) => React.JSX.Element;
|
|
23
|
+
declare const InteractionSurface: ({ appearance, children, testId, }: InteractionSurfaceProps) => React.JSX.Element;
|
|
24
24
|
export default InteractionSurface;
|
|
25
25
|
/**
|
|
26
26
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
27
|
-
* @codegen <<SignedSource::
|
|
27
|
+
* @codegen <<SignedSource::2872a8059e6b2969c20ed7a592cc85ca>>
|
|
28
28
|
* @codegenId interactions
|
|
29
29
|
* @codegenCommand yarn codegen-styles
|
|
30
30
|
* @codegenParams ["background"]
|
|
31
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::
|
|
31
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
|
|
32
32
|
*/
|
|
33
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';
|
|
34
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.4",
|
|
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.4.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0",
|
|
30
30
|
"@emotion/react": "^11.7.1"
|
|
31
31
|
},
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@af/formatting": "workspace:^",
|
|
37
|
-
"@atlaskit/ds-lib": "^
|
|
38
|
-
"@atlaskit/primitives": "^
|
|
37
|
+
"@atlaskit/ds-lib": "^6.0.0",
|
|
38
|
+
"@atlaskit/primitives": "^18.1.0",
|
|
39
39
|
"@atlaskit/textfield": "^8.2.0",
|
|
40
40
|
"@atlassian/codegen": "^0.1.0",
|
|
41
41
|
"@testing-library/react": "^16.3.0",
|
|
@@ -8,9 +8,8 @@ import { createColorMapTemplate } from './color-map-template';
|
|
|
8
8
|
import { createInteractionStylesFromTemplate } from './interaction-codegen';
|
|
9
9
|
|
|
10
10
|
const colorMapOutputFolder = join(__dirname, '../', 'src', 'internal');
|
|
11
|
-
const colorTokensDependencyPath =
|
|
12
|
-
'../../tokens/src/artifacts/tokens-raw/atlassian-light'
|
|
13
|
-
);
|
|
11
|
+
const colorTokensDependencyPath =
|
|
12
|
+
require.resolve('../../tokens/src/artifacts/tokens-raw/atlassian-light');
|
|
14
13
|
|
|
15
14
|
writeFile(
|
|
16
15
|
join(colorMapOutputFolder, 'color-map.tsx'),
|
|
@@ -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,24 +39,22 @@ 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)))
|
|
@@ -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
|
|
package/scripts/utils.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
|
|
3
|
-
export const tokenToStyle
|
|
3
|
+
export const tokenToStyle: (
|
|
4
4
|
prop: keyof CSSProperties,
|
|
5
5
|
token: string,
|
|
6
6
|
fallback: string | ShadowDefintion,
|
|
7
|
-
) => {
|
|
7
|
+
) => string = (prop: keyof CSSProperties, token: string, fallback: string | ShadowDefintion) => {
|
|
8
8
|
if (Array.isArray(fallback)) {
|
|
9
9
|
fallback = constructShadow(fallback);
|
|
10
10
|
}
|
|
@@ -29,23 +29,26 @@ const constructShadow = (shadowObject: ShadowDefintion) => {
|
|
|
29
29
|
|
|
30
30
|
type BooleanCallback<T> = (args: T) => boolean;
|
|
31
31
|
|
|
32
|
-
export const compose =
|
|
32
|
+
export const compose: (...fns: ((...any: any[]) => any)[]) => (x: any) => any =
|
|
33
33
|
(...fns: ((...any: any[]) => any)[]) =>
|
|
34
34
|
(x: any): any =>
|
|
35
35
|
fns.reduce((res, fn) => fn(res), x);
|
|
36
|
-
export const pick =
|
|
36
|
+
export const pick: <T extends any>(key: keyof T) => (obj: T) => T[keyof T] =
|
|
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
|
|
42
|
-
|
|
43
|
-
export const
|
|
40
|
+
export const isAccent: (str: string) => boolean = (str: string): boolean => str.includes('accent');
|
|
41
|
+
export const isPressed: (str: string) => boolean = (str: string): boolean =>
|
|
42
|
+
str.includes('pressed');
|
|
43
|
+
export const isHovered: (str: string) => boolean = (str: string): boolean =>
|
|
44
|
+
str.includes('hovered');
|
|
45
|
+
export const not: <T extends any>(cb: BooleanCallback<T>) => (val: T) => boolean =
|
|
44
46
|
<T extends any>(cb: BooleanCallback<T>) =>
|
|
45
|
-
(val: T) =>
|
|
47
|
+
(val: T): boolean =>
|
|
46
48
|
!cb(val);
|
|
47
|
-
export const or =
|
|
49
|
+
export const or: <T extends any>(...fns: BooleanCallback<T>[]) => (val: T) => boolean =
|
|
48
50
|
<T extends any>(...fns: BooleanCallback<T>[]) =>
|
|
49
|
-
(val: T) =>
|
|
51
|
+
(val: T): boolean =>
|
|
50
52
|
fns.some((fn) => fn(val));
|
|
51
|
-
export const capitalize
|
|
53
|
+
export const capitalize: (str: string) => string = (str: string): string =>
|
|
54
|
+
str.charAt(0).toUpperCase() + str.slice(1);
|