@atlaskit/tokens 4.4.1 → 4.5.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 +16 -0
- package/dist/cjs/babel-plugin/plugin.js +2 -1
- package/dist/cjs/constants.js +1 -2
- package/dist/cjs/theme-config.js +3 -3
- package/dist/cjs/utils/hct-color-utils/color-utils.js +0 -13
- package/dist/cjs/utils/hct-color-utils/math-utils.js +0 -43
- package/dist/es2019/babel-plugin/plugin.js +2 -1
- package/dist/es2019/constants.js +0 -1
- package/dist/es2019/theme-config.js +2 -2
- package/dist/es2019/utils/hct-color-utils/color-utils.js +5 -12
- package/dist/es2019/utils/hct-color-utils/math-utils.js +0 -40
- package/dist/esm/babel-plugin/plugin.js +2 -1
- package/dist/esm/constants.js +0 -1
- package/dist/esm/theme-config.js +2 -2
- package/dist/esm/utils/hct-color-utils/color-utils.js +5 -12
- package/dist/esm/utils/hct-color-utils/math-utils.js +0 -40
- package/dist/types/constants.d.ts +0 -1
- package/dist/types/theme-config.d.ts +5 -5
- package/dist/types/types.d.ts +13 -19
- package/dist/types/utils/hct-color-utils/color-utils.d.ts +2 -25
- package/dist/types/utils/hct-color-utils/math-utils.d.ts +0 -26
- package/dist/types-ts4.5/constants.d.ts +0 -1
- package/dist/types-ts4.5/theme-config.d.ts +5 -5
- package/dist/types-ts4.5/types.d.ts +13 -19
- package/dist/types-ts4.5/utils/hct-color-utils/color-utils.d.ts +2 -25
- package/dist/types-ts4.5/utils/hct-color-utils/math-utils.d.ts +0 -26
- package/package.json +21 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/tokens
|
|
2
2
|
|
|
3
|
+
## 4.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#127074](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127074)
|
|
8
|
+
[`9bb9fc17a4eaa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9bb9fc17a4eaa) -
|
|
9
|
+
Update dependencies and remove unused internal exports.
|
|
10
|
+
|
|
11
|
+
## 4.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#126172](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126172)
|
|
16
|
+
[`38625fdee341d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/38625fdee341d) -
|
|
17
|
+
Exclude border.radius tokens from shouldForceAutoFallback mode
|
|
18
|
+
|
|
3
19
|
## 4.4.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -98,7 +98,8 @@ function plugin() {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
// Handle fallbacks
|
|
101
|
-
|
|
101
|
+
// The border.radius tokens are skipped in shouldForceAutoFallback mode because these tokens are not enabled in the live products and enforcing default values on them will override all the fallback values that are currently being used to render the actual UI.
|
|
102
|
+
var fallback = state.opts.shouldForceAutoFallback && !tokenName.startsWith('border.radius') ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
|
|
102
103
|
if (t.isStringLiteral(fallback)) {
|
|
103
104
|
// String literals can be concatenated into css variable call
|
|
104
105
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
package/dist/cjs/constants.js
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TOKEN_NOT_FOUND_CSS_VAR = exports.THEME_DATA_ATTRIBUTE = exports.
|
|
6
|
+
exports.TOKEN_NOT_FOUND_CSS_VAR = exports.THEME_DATA_ATTRIBUTE = exports.CUSTOM_THEME_ATTRIBUTE = exports.CURRENT_SURFACE_CSS_VAR = exports.CSS_VAR_FULL = exports.CSS_PREFIX = exports.CONTRAST_MODE_ATTRIBUTE = exports.COLOR_MODE_ATTRIBUTE = void 0;
|
|
7
7
|
var THEME_DATA_ATTRIBUTE = exports.THEME_DATA_ATTRIBUTE = 'data-theme';
|
|
8
8
|
var COLOR_MODE_ATTRIBUTE = exports.COLOR_MODE_ATTRIBUTE = 'data-color-mode';
|
|
9
9
|
var CONTRAST_MODE_ATTRIBUTE = exports.CONTRAST_MODE_ATTRIBUTE = 'data-contrast-mode';
|
|
10
10
|
var CUSTOM_THEME_ATTRIBUTE = exports.CUSTOM_THEME_ATTRIBUTE = 'data-custom-theme';
|
|
11
|
-
var DEFAULT_THEME = exports.DEFAULT_THEME = 'light';
|
|
12
11
|
var CSS_PREFIX = exports.CSS_PREFIX = 'ds';
|
|
13
12
|
var CSS_VAR_FULL = exports.CSS_VAR_FULL = ['opacity', 'font', 'space', 'border'];
|
|
14
13
|
var TOKEN_NOT_FOUND_CSS_VAR = exports.TOKEN_NOT_FOUND_CSS_VAR = "--".concat(CSS_PREFIX, "-token-not-found");
|
package/dist/cjs/theme-config.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.themeStateDefaults = exports.
|
|
6
|
+
exports.themeStateDefaults = exports.themeIdsWithOverrides = exports.themeIds = exports.themeColorModes = exports.default = void 0;
|
|
7
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
8
|
/**
|
|
9
9
|
* This file contains the source of truth for themes and all associated meta data.
|
|
@@ -38,7 +38,7 @@ var themeColorModes = exports.themeColorModes = ['light', 'dark', 'auto'];
|
|
|
38
38
|
/**
|
|
39
39
|
* Contrast preferences: The system contrast preference
|
|
40
40
|
*/
|
|
41
|
-
var themeContrastModes =
|
|
41
|
+
var themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
42
42
|
/**
|
|
43
43
|
* Theme ids: The value that will be mounted to the DOM as a data attr
|
|
44
44
|
* For example: `data-theme="light:light dark:dark spacing:spacing"
|
|
@@ -50,7 +50,7 @@ var themeIds = exports.themeIds = ['light-increased-contrast', 'light', 'light-f
|
|
|
50
50
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
51
51
|
* Theme overrides are temporary and there may not be any defined at times.
|
|
52
52
|
*/
|
|
53
|
-
var themeOverrideIds =
|
|
53
|
+
var themeOverrideIds = [];
|
|
54
54
|
var themeIdsWithOverrides = exports.themeIdsWithOverrides = [].concat(themeIds, themeOverrideIds);
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -4,23 +4,17 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.alphaFromArgb = alphaFromArgb;
|
|
8
7
|
exports.argbFromLinrgb = argbFromLinrgb;
|
|
9
8
|
exports.argbFromLstar = argbFromLstar;
|
|
10
9
|
exports.argbFromRgb = argbFromRgb;
|
|
11
10
|
exports.argbFromRgba = argbFromRgba;
|
|
12
11
|
exports.argbFromXyz = argbFromXyz;
|
|
13
|
-
exports.blueFromArgb = blueFromArgb;
|
|
14
12
|
exports.delinearized = delinearized;
|
|
15
|
-
exports.greenFromArgb = greenFromArgb;
|
|
16
|
-
exports.isOpaque = isOpaque;
|
|
17
13
|
exports.linearized = linearized;
|
|
18
14
|
exports.lstarFromArgb = lstarFromArgb;
|
|
19
15
|
exports.lstarFromY = lstarFromY;
|
|
20
|
-
exports.redFromArgb = redFromArgb;
|
|
21
16
|
exports.rgbaFromArgb = rgbaFromArgb;
|
|
22
17
|
exports.whitePointD65 = whitePointD65;
|
|
23
|
-
exports.xyzFromArgb = xyzFromArgb;
|
|
24
18
|
exports.yFromLstar = yFromLstar;
|
|
25
19
|
var mathUtils = _interopRequireWildcard(require("./math-utils"));
|
|
26
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -105,13 +99,6 @@ function blueFromArgb(argb) {
|
|
|
105
99
|
return argb & 255;
|
|
106
100
|
}
|
|
107
101
|
|
|
108
|
-
/**
|
|
109
|
-
* Returns whether a color in ARGB format is opaque.
|
|
110
|
-
*/
|
|
111
|
-
function isOpaque(argb) {
|
|
112
|
-
return alphaFromArgb(argb) >= 255;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
102
|
/**
|
|
116
103
|
* Converts a color from ARGB to XYZ.
|
|
117
104
|
*/
|
|
@@ -5,12 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.clampDouble = clampDouble;
|
|
7
7
|
exports.clampInt = clampInt;
|
|
8
|
-
exports.differenceDegrees = differenceDegrees;
|
|
9
8
|
exports.lerp = lerp;
|
|
10
9
|
exports.matrixMultiply = matrixMultiply;
|
|
11
|
-
exports.rotationDirection = rotationDirection;
|
|
12
10
|
exports.sanitizeDegreesDouble = sanitizeDegreesDouble;
|
|
13
|
-
exports.sanitizeDegreesInt = sanitizeDegreesInt;
|
|
14
11
|
exports.signum = signum;
|
|
15
12
|
/**
|
|
16
13
|
* Below lines are copied from @material/material-color-utilities.
|
|
@@ -94,20 +91,6 @@ function clampDouble(min, max, input) {
|
|
|
94
91
|
return input;
|
|
95
92
|
}
|
|
96
93
|
|
|
97
|
-
/**
|
|
98
|
-
* Sanitizes a degree measure as an integer.
|
|
99
|
-
*
|
|
100
|
-
* @return a degree measure between 0 (inclusive) and 360
|
|
101
|
-
* (exclusive).
|
|
102
|
-
*/
|
|
103
|
-
function sanitizeDegreesInt(degrees) {
|
|
104
|
-
degrees = degrees % 360;
|
|
105
|
-
if (degrees < 0) {
|
|
106
|
-
degrees = degrees + 360;
|
|
107
|
-
}
|
|
108
|
-
return degrees;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
94
|
/**
|
|
112
95
|
* Sanitizes a degree measure as a floating-point number.
|
|
113
96
|
*
|
|
@@ -122,32 +105,6 @@ function sanitizeDegreesDouble(degrees) {
|
|
|
122
105
|
return degrees;
|
|
123
106
|
}
|
|
124
107
|
|
|
125
|
-
/**
|
|
126
|
-
* Sign of direction change needed to travel from one angle to
|
|
127
|
-
* another.
|
|
128
|
-
*
|
|
129
|
-
* For angles that are 180 degrees apart from each other, both
|
|
130
|
-
* directions have the same travel distance, so either direction is
|
|
131
|
-
* shortest. The value 1.0 is returned in this case.
|
|
132
|
-
*
|
|
133
|
-
* @param from The angle travel starts from, in degrees.
|
|
134
|
-
* @param to The angle travel ends at, in degrees.
|
|
135
|
-
* @return -1 if decreasing from leads to the shortest travel
|
|
136
|
-
* distance, 1 if increasing from leads to the shortest travel
|
|
137
|
-
* distance.
|
|
138
|
-
*/
|
|
139
|
-
function rotationDirection(from, to) {
|
|
140
|
-
var increasingDifference = sanitizeDegreesDouble(to - from);
|
|
141
|
-
return increasingDifference <= 180.0 ? 1.0 : -1.0;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Distance of two points on a circle, represented using degrees.
|
|
146
|
-
*/
|
|
147
|
-
function differenceDegrees(a, b) {
|
|
148
|
-
return 180.0 - Math.abs(Math.abs(a - b) - 180.0);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
108
|
/**
|
|
152
109
|
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
153
110
|
*/
|
|
@@ -88,7 +88,8 @@ export default function plugin() {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// Handle fallbacks
|
|
91
|
-
|
|
91
|
+
// The border.radius tokens are skipped in shouldForceAutoFallback mode because these tokens are not enabled in the live products and enforcing default values on them will override all the fallback values that are currently being used to render the actual UI.
|
|
92
|
+
const fallback = state.opts.shouldForceAutoFallback && !tokenName.startsWith('border.radius') ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
|
|
92
93
|
if (t.isStringLiteral(fallback)) {
|
|
93
94
|
// String literals can be concatenated into css variable call
|
|
94
95
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
package/dist/es2019/constants.js
CHANGED
|
@@ -2,7 +2,6 @@ export const THEME_DATA_ATTRIBUTE = 'data-theme';
|
|
|
2
2
|
export const COLOR_MODE_ATTRIBUTE = 'data-color-mode';
|
|
3
3
|
export const CONTRAST_MODE_ATTRIBUTE = 'data-contrast-mode';
|
|
4
4
|
export const CUSTOM_THEME_ATTRIBUTE = 'data-custom-theme';
|
|
5
|
-
export const DEFAULT_THEME = 'light';
|
|
6
5
|
export const CSS_PREFIX = 'ds';
|
|
7
6
|
export const CSS_VAR_FULL = ['opacity', 'font', 'space', 'border'];
|
|
8
7
|
export const TOKEN_NOT_FOUND_CSS_VAR = `--${CSS_PREFIX}-token-not-found`;
|
|
@@ -33,7 +33,7 @@ export const themeColorModes = ['light', 'dark', 'auto'];
|
|
|
33
33
|
/**
|
|
34
34
|
* Contrast preferences: The system contrast preference
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
const themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
37
37
|
/**
|
|
38
38
|
* Theme ids: The value that will be mounted to the DOM as a data attr
|
|
39
39
|
* For example: `data-theme="light:light dark:dark spacing:spacing"
|
|
@@ -45,7 +45,7 @@ export const themeIds = ['light-increased-contrast', 'light', 'light-future', 'l
|
|
|
45
45
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
46
46
|
* Theme overrides are temporary and there may not be any defined at times.
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
const themeOverrideIds = [];
|
|
49
49
|
export const themeIdsWithOverrides = [...themeIds, ...themeOverrideIds];
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -55,38 +55,31 @@ export function argbFromLinrgb(linrgb) {
|
|
|
55
55
|
/**
|
|
56
56
|
* Returns the alpha component of a color in ARGB format.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
function alphaFromArgb(argb) {
|
|
59
59
|
return argb >> 24 & 255;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Returns the red component of a color in ARGB format.
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
function redFromArgb(argb) {
|
|
66
66
|
return argb >> 16 & 255;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Returns the green component of a color in ARGB format.
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
function greenFromArgb(argb) {
|
|
73
73
|
return argb >> 8 & 255;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Returns the blue component of a color in ARGB format.
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
function blueFromArgb(argb) {
|
|
80
80
|
return argb & 255;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* Returns whether a color in ARGB format is opaque.
|
|
85
|
-
*/
|
|
86
|
-
export function isOpaque(argb) {
|
|
87
|
-
return alphaFromArgb(argb) >= 255;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
83
|
/**
|
|
91
84
|
* Converts a color from ARGB to XYZ.
|
|
92
85
|
*/
|
|
@@ -104,7 +97,7 @@ export function argbFromXyz(x, y, z) {
|
|
|
104
97
|
/**
|
|
105
98
|
* Converts a color from XYZ to ARGB.
|
|
106
99
|
*/
|
|
107
|
-
|
|
100
|
+
function xyzFromArgb(argb) {
|
|
108
101
|
const r = linearized(redFromArgb(argb));
|
|
109
102
|
const g = linearized(greenFromArgb(argb));
|
|
110
103
|
const b = linearized(blueFromArgb(argb));
|
|
@@ -80,20 +80,6 @@ export function clampDouble(min, max, input) {
|
|
|
80
80
|
return input;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* Sanitizes a degree measure as an integer.
|
|
85
|
-
*
|
|
86
|
-
* @return a degree measure between 0 (inclusive) and 360
|
|
87
|
-
* (exclusive).
|
|
88
|
-
*/
|
|
89
|
-
export function sanitizeDegreesInt(degrees) {
|
|
90
|
-
degrees = degrees % 360;
|
|
91
|
-
if (degrees < 0) {
|
|
92
|
-
degrees = degrees + 360;
|
|
93
|
-
}
|
|
94
|
-
return degrees;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
83
|
/**
|
|
98
84
|
* Sanitizes a degree measure as a floating-point number.
|
|
99
85
|
*
|
|
@@ -108,32 +94,6 @@ export function sanitizeDegreesDouble(degrees) {
|
|
|
108
94
|
return degrees;
|
|
109
95
|
}
|
|
110
96
|
|
|
111
|
-
/**
|
|
112
|
-
* Sign of direction change needed to travel from one angle to
|
|
113
|
-
* another.
|
|
114
|
-
*
|
|
115
|
-
* For angles that are 180 degrees apart from each other, both
|
|
116
|
-
* directions have the same travel distance, so either direction is
|
|
117
|
-
* shortest. The value 1.0 is returned in this case.
|
|
118
|
-
*
|
|
119
|
-
* @param from The angle travel starts from, in degrees.
|
|
120
|
-
* @param to The angle travel ends at, in degrees.
|
|
121
|
-
* @return -1 if decreasing from leads to the shortest travel
|
|
122
|
-
* distance, 1 if increasing from leads to the shortest travel
|
|
123
|
-
* distance.
|
|
124
|
-
*/
|
|
125
|
-
export function rotationDirection(from, to) {
|
|
126
|
-
const increasingDifference = sanitizeDegreesDouble(to - from);
|
|
127
|
-
return increasingDifference <= 180.0 ? 1.0 : -1.0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Distance of two points on a circle, represented using degrees.
|
|
132
|
-
*/
|
|
133
|
-
export function differenceDegrees(a, b) {
|
|
134
|
-
return 180.0 - Math.abs(Math.abs(a - b) - 180.0);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
97
|
/**
|
|
138
98
|
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
139
99
|
*/
|
|
@@ -88,7 +88,8 @@ export default function plugin() {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// Handle fallbacks
|
|
91
|
-
|
|
91
|
+
// The border.radius tokens are skipped in shouldForceAutoFallback mode because these tokens are not enabled in the live products and enforcing default values on them will override all the fallback values that are currently being used to render the actual UI.
|
|
92
|
+
var fallback = state.opts.shouldForceAutoFallback && !tokenName.startsWith('border.radius') ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
|
|
92
93
|
if (t.isStringLiteral(fallback)) {
|
|
93
94
|
// String literals can be concatenated into css variable call
|
|
94
95
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
package/dist/esm/constants.js
CHANGED
|
@@ -2,7 +2,6 @@ export var THEME_DATA_ATTRIBUTE = 'data-theme';
|
|
|
2
2
|
export var COLOR_MODE_ATTRIBUTE = 'data-color-mode';
|
|
3
3
|
export var CONTRAST_MODE_ATTRIBUTE = 'data-contrast-mode';
|
|
4
4
|
export var CUSTOM_THEME_ATTRIBUTE = 'data-custom-theme';
|
|
5
|
-
export var DEFAULT_THEME = 'light';
|
|
6
5
|
export var CSS_PREFIX = 'ds';
|
|
7
6
|
export var CSS_VAR_FULL = ['opacity', 'font', 'space', 'border'];
|
|
8
7
|
export var TOKEN_NOT_FOUND_CSS_VAR = "--".concat(CSS_PREFIX, "-token-not-found");
|
package/dist/esm/theme-config.js
CHANGED
|
@@ -33,7 +33,7 @@ export var themeColorModes = ['light', 'dark', 'auto'];
|
|
|
33
33
|
/**
|
|
34
34
|
* Contrast preferences: The system contrast preference
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
var themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
37
37
|
/**
|
|
38
38
|
* Theme ids: The value that will be mounted to the DOM as a data attr
|
|
39
39
|
* For example: `data-theme="light:light dark:dark spacing:spacing"
|
|
@@ -45,7 +45,7 @@ export var themeIds = ['light-increased-contrast', 'light', 'light-future', 'lig
|
|
|
45
45
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
46
46
|
* Theme overrides are temporary and there may not be any defined at times.
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
var themeOverrideIds = [];
|
|
49
49
|
export var themeIdsWithOverrides = [].concat(themeIds, themeOverrideIds);
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -55,38 +55,31 @@ export function argbFromLinrgb(linrgb) {
|
|
|
55
55
|
/**
|
|
56
56
|
* Returns the alpha component of a color in ARGB format.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
function alphaFromArgb(argb) {
|
|
59
59
|
return argb >> 24 & 255;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Returns the red component of a color in ARGB format.
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
function redFromArgb(argb) {
|
|
66
66
|
return argb >> 16 & 255;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Returns the green component of a color in ARGB format.
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
function greenFromArgb(argb) {
|
|
73
73
|
return argb >> 8 & 255;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Returns the blue component of a color in ARGB format.
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
function blueFromArgb(argb) {
|
|
80
80
|
return argb & 255;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* Returns whether a color in ARGB format is opaque.
|
|
85
|
-
*/
|
|
86
|
-
export function isOpaque(argb) {
|
|
87
|
-
return alphaFromArgb(argb) >= 255;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
83
|
/**
|
|
91
84
|
* Converts a color from ARGB to XYZ.
|
|
92
85
|
*/
|
|
@@ -104,7 +97,7 @@ export function argbFromXyz(x, y, z) {
|
|
|
104
97
|
/**
|
|
105
98
|
* Converts a color from XYZ to ARGB.
|
|
106
99
|
*/
|
|
107
|
-
|
|
100
|
+
function xyzFromArgb(argb) {
|
|
108
101
|
var r = linearized(redFromArgb(argb));
|
|
109
102
|
var g = linearized(greenFromArgb(argb));
|
|
110
103
|
var b = linearized(blueFromArgb(argb));
|
|
@@ -80,20 +80,6 @@ export function clampDouble(min, max, input) {
|
|
|
80
80
|
return input;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* Sanitizes a degree measure as an integer.
|
|
85
|
-
*
|
|
86
|
-
* @return a degree measure between 0 (inclusive) and 360
|
|
87
|
-
* (exclusive).
|
|
88
|
-
*/
|
|
89
|
-
export function sanitizeDegreesInt(degrees) {
|
|
90
|
-
degrees = degrees % 360;
|
|
91
|
-
if (degrees < 0) {
|
|
92
|
-
degrees = degrees + 360;
|
|
93
|
-
}
|
|
94
|
-
return degrees;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
83
|
/**
|
|
98
84
|
* Sanitizes a degree measure as a floating-point number.
|
|
99
85
|
*
|
|
@@ -108,32 +94,6 @@ export function sanitizeDegreesDouble(degrees) {
|
|
|
108
94
|
return degrees;
|
|
109
95
|
}
|
|
110
96
|
|
|
111
|
-
/**
|
|
112
|
-
* Sign of direction change needed to travel from one angle to
|
|
113
|
-
* another.
|
|
114
|
-
*
|
|
115
|
-
* For angles that are 180 degrees apart from each other, both
|
|
116
|
-
* directions have the same travel distance, so either direction is
|
|
117
|
-
* shortest. The value 1.0 is returned in this case.
|
|
118
|
-
*
|
|
119
|
-
* @param from The angle travel starts from, in degrees.
|
|
120
|
-
* @param to The angle travel ends at, in degrees.
|
|
121
|
-
* @return -1 if decreasing from leads to the shortest travel
|
|
122
|
-
* distance, 1 if increasing from leads to the shortest travel
|
|
123
|
-
* distance.
|
|
124
|
-
*/
|
|
125
|
-
export function rotationDirection(from, to) {
|
|
126
|
-
var increasingDifference = sanitizeDegreesDouble(to - from);
|
|
127
|
-
return increasingDifference <= 180.0 ? 1.0 : -1.0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Distance of two points on a circle, represented using degrees.
|
|
132
|
-
*/
|
|
133
|
-
export function differenceDegrees(a, b) {
|
|
134
|
-
return 180.0 - Math.abs(Math.abs(a - b) - 180.0);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
97
|
/**
|
|
138
98
|
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
139
99
|
*/
|
|
@@ -2,7 +2,6 @@ export declare const THEME_DATA_ATTRIBUTE = "data-theme";
|
|
|
2
2
|
export declare const COLOR_MODE_ATTRIBUTE = "data-color-mode";
|
|
3
3
|
export declare const CONTRAST_MODE_ATTRIBUTE = "data-contrast-mode";
|
|
4
4
|
export declare const CUSTOM_THEME_ATTRIBUTE = "data-custom-theme";
|
|
5
|
-
export declare const DEFAULT_THEME = "light";
|
|
6
5
|
export declare const CSS_PREFIX = "ds";
|
|
7
6
|
export declare const CSS_VAR_FULL: string[];
|
|
8
7
|
export declare const TOKEN_NOT_FOUND_CSS_VAR = "--ds-token-not-found";
|
|
@@ -20,7 +20,7 @@ export type ThemeOverrides = Themes;
|
|
|
20
20
|
* Some themes are entirely focused on Color, whilst others are purely focused on spacing.
|
|
21
21
|
* In the future other types may be introduced such as typography.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
type ThemeKinds = 'color' | 'spacing' | 'typography' | 'shape';
|
|
24
24
|
/**
|
|
25
25
|
* Theme modes: The general purpose of a theme.
|
|
26
26
|
* This attr is used to apply the appropriate system-preference option
|
|
@@ -33,8 +33,8 @@ export type DataColorModes = Exclude<ThemeColorModes, 'auto'>;
|
|
|
33
33
|
/**
|
|
34
34
|
* Contrast preferences: The system contrast preference
|
|
35
35
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
declare const themeContrastModes: readonly ["more", "no-preference", "auto"];
|
|
37
|
+
type ThemeContrastModes = (typeof themeContrastModes)[number];
|
|
38
38
|
export type DataContrastModes = 'more' | 'no-preference' | 'auto';
|
|
39
39
|
/**
|
|
40
40
|
* Theme ids: The value that will be mounted to the DOM as a data attr
|
|
@@ -48,7 +48,7 @@ export type ThemeIds = (typeof themeIds)[number];
|
|
|
48
48
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
49
49
|
* Theme overrides are temporary and there may not be any defined at times.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
declare const themeOverrideIds: readonly [];
|
|
52
52
|
export type ThemeOverrideIds = (typeof themeOverrideIds)[number];
|
|
53
53
|
export declare const themeIdsWithOverrides: readonly ["light-increased-contrast", "light", "light-future", "light-brand-refresh", "dark", "dark-future", "dark-increased-contrast", "dark-brand-refresh", "legacy-light", "legacy-dark", "spacing", "shape", "typography-adg3", "typography-modernized", "typography-refreshed"];
|
|
54
54
|
export type ThemeIdsWithOverrides = (typeof themeIdsWithOverrides)[number];
|
|
@@ -57,7 +57,7 @@ export type ThemeIdsWithOverrides = (typeof themeIdsWithOverrides)[number];
|
|
|
57
57
|
* an extension with all token values marked as optional
|
|
58
58
|
* to allow tokens to be overridden as required.
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
type ExtensionThemeId = ThemeIds;
|
|
61
61
|
/**
|
|
62
62
|
* Palettes: The set of base tokens a given theme may be populated with.
|
|
63
63
|
* For example: legacy light & dark themes use the "legacyPalette" containing colors from our
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { InternalTokenIds } from './artifacts/types-internal';
|
|
2
2
|
export type Groups = 'raw' | 'paint' | 'shadow' | 'palette' | 'opacity' | 'spacing' | 'shape' | 'typography' | 'fontSize' | 'fontWeight' | 'fontFamily' | 'lineHeight' | 'letterSpacing';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
type ActiveTokenState = 'active';
|
|
4
|
+
type DeprecatedTokenState = 'deprecated';
|
|
5
|
+
type DeletedTokenState = 'deleted';
|
|
6
|
+
type ExperimentalTokenState = 'experimental';
|
|
7
|
+
type TokenState = ActiveTokenState | DeprecatedTokenState | DeletedTokenState | ExperimentalTokenState;
|
|
8
|
+
type Replacement = InternalTokenIds | InternalTokenIds[];
|
|
9
|
+
type ExperimentalReplacement = InternalTokenIds | InternalTokenIds[] | string;
|
|
10
|
+
type PaletteCategory = 'blue' | 'purple' | 'red' | 'magenta' | 'orange' | 'yellow' | 'green' | 'teal' | 'lime' | 'light mode neutral' | 'dark mode neutral';
|
|
11
|
+
type ValueCategory = 'opacity';
|
|
12
|
+
interface Token<TValue, Group extends Groups> {
|
|
13
13
|
value: TValue;
|
|
14
14
|
attributes: {
|
|
15
15
|
group: Group;
|
|
@@ -62,7 +62,7 @@ export interface DesignToken<TValue, Group extends Groups> extends Token<TValue,
|
|
|
62
62
|
suggest?: string[];
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
interface TypographyDesignToken<TValue> extends DesignToken<TValue, 'typography'> {
|
|
66
66
|
attributes: DesignToken<TValue, 'typography'>['attributes'];
|
|
67
67
|
}
|
|
68
68
|
type OmitDistributive<T, K extends PropertyKey> = T extends any ? T extends object ? Id<DeepOmit<T, K>> : T : never;
|
|
@@ -78,13 +78,13 @@ export type DeepPartial<T> = T extends object ? {
|
|
|
78
78
|
export type ValueSchema<Schema extends object> = DeepOmit<Schema, 'attributes'>;
|
|
79
79
|
export type ExtendedValueSchema<Schema extends object> = DeepPartial<ValueSchema<Schema>>;
|
|
80
80
|
export type AttributeSchema<Schema extends object> = DeepOmit<Schema, 'value'>;
|
|
81
|
-
|
|
81
|
+
interface PaletteToken extends BaseToken<string, 'palette'> {
|
|
82
82
|
attributes: {
|
|
83
83
|
group: 'palette';
|
|
84
84
|
category: PaletteCategory;
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
interface ValueToken extends BaseToken<number, 'palette'> {
|
|
88
88
|
attributes: {
|
|
89
89
|
group: 'palette';
|
|
90
90
|
category: ValueCategory;
|
|
@@ -105,11 +105,8 @@ export type ShadowToken<BaseToken> = DesignToken<Array<{
|
|
|
105
105
|
export type OpacityToken = DesignToken<string, 'opacity'>;
|
|
106
106
|
export type SpacingToken<BaseToken> = DesignToken<BaseToken, 'spacing'>;
|
|
107
107
|
export type ShapeToken<BaseToken> = DesignToken<BaseToken, 'shape'>;
|
|
108
|
-
export type FontSizeToken<BaseToken> = DesignToken<BaseToken, 'fontSize'>;
|
|
109
108
|
export type FontWeightToken<BaseToken> = DesignToken<BaseToken, 'fontWeight'>;
|
|
110
109
|
export type FontFamilyToken<BaseToken> = DesignToken<BaseToken, 'fontFamily'>;
|
|
111
|
-
export type LineHeightToken<BaseToken> = DesignToken<BaseToken, 'lineHeight'>;
|
|
112
|
-
export type LetterSpacingToken<BaseToken> = DesignToken<BaseToken, 'letterSpacing'>;
|
|
113
110
|
export type DeprecatedTypographyToken<BaseToken> = DesignToken<BaseToken, 'fontSize' | 'fontWeight' | 'fontFamily' | 'lineHeight' | 'letterSpacing'>;
|
|
114
111
|
export type RawToken = DesignToken<string, 'raw'>;
|
|
115
112
|
export interface PaletteColorTokenSchema<PaletteValues extends string> {
|
|
@@ -954,9 +951,6 @@ export interface OpacityTokenSchema {
|
|
|
954
951
|
disabled: OpacityToken;
|
|
955
952
|
};
|
|
956
953
|
}
|
|
957
|
-
export type ElevationTokenSchema<BaseToken> = SurfaceTokenSchema<BaseToken> & ShadowTokenSchema<BaseToken>;
|
|
958
|
-
export type ColorTokenSchema<BaseToken> = BackgroundColorTokenSchema<BaseToken> & BorderColorTokenSchema<BaseToken> & IconColorTokenSchema<BaseToken> & TextColorTokenSchema<BaseToken> & AccentColorTokenSchema<BaseToken> & UtilTokenSchema<BaseToken>;
|
|
959
|
-
export type TokenSchema<BaseToken> = ColorTokenSchema<BaseToken> & ElevationTokenSchema<BaseToken>;
|
|
960
954
|
export interface SpacingTokenSchema<BaseToken> {
|
|
961
955
|
space: {
|
|
962
956
|
'0': SpacingToken<BaseToken>;
|
|
@@ -10,34 +10,10 @@ export declare function argbFromRgb(red: number, green: number, blue: number): n
|
|
|
10
10
|
* Converts a color from linear RGB components to ARGB format.
|
|
11
11
|
*/
|
|
12
12
|
export declare function argbFromLinrgb(linrgb: number[]): number;
|
|
13
|
-
/**
|
|
14
|
-
* Returns the alpha component of a color in ARGB format.
|
|
15
|
-
*/
|
|
16
|
-
export declare function alphaFromArgb(argb: number): number;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the red component of a color in ARGB format.
|
|
19
|
-
*/
|
|
20
|
-
export declare function redFromArgb(argb: number): number;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the green component of a color in ARGB format.
|
|
23
|
-
*/
|
|
24
|
-
export declare function greenFromArgb(argb: number): number;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the blue component of a color in ARGB format.
|
|
27
|
-
*/
|
|
28
|
-
export declare function blueFromArgb(argb: number): number;
|
|
29
|
-
/**
|
|
30
|
-
* Returns whether a color in ARGB format is opaque.
|
|
31
|
-
*/
|
|
32
|
-
export declare function isOpaque(argb: number): boolean;
|
|
33
13
|
/**
|
|
34
14
|
* Converts a color from ARGB to XYZ.
|
|
35
15
|
*/
|
|
36
16
|
export declare function argbFromXyz(x: number, y: number, z: number): number;
|
|
37
|
-
/**
|
|
38
|
-
* Converts a color from XYZ to ARGB.
|
|
39
|
-
*/
|
|
40
|
-
export declare function xyzFromArgb(argb: number): number[];
|
|
41
17
|
/**
|
|
42
18
|
* Converts an L* value to an ARGB representation.
|
|
43
19
|
*
|
|
@@ -109,7 +85,7 @@ export declare function whitePointD65(): number[];
|
|
|
109
85
|
* @param b Blue value should be between 0-255
|
|
110
86
|
* @param a Alpha value should be between 0-255
|
|
111
87
|
*/
|
|
112
|
-
|
|
88
|
+
interface Rgba {
|
|
113
89
|
r: number;
|
|
114
90
|
g: number;
|
|
115
91
|
b: number;
|
|
@@ -129,3 +105,4 @@ export declare function rgbaFromArgb(argb: number): Rgba;
|
|
|
129
105
|
* @returns ARGB representation of a int32 color.
|
|
130
106
|
*/
|
|
131
107
|
export declare function argbFromRgba({ r, g, b, a }: Rgba): number;
|
|
108
|
+
export {};
|
|
@@ -47,13 +47,6 @@ export declare function clampInt(min: number, max: number, input: number): numbe
|
|
|
47
47
|
* otherwise.
|
|
48
48
|
*/
|
|
49
49
|
export declare function clampDouble(min: number, max: number, input: number): number;
|
|
50
|
-
/**
|
|
51
|
-
* Sanitizes a degree measure as an integer.
|
|
52
|
-
*
|
|
53
|
-
* @return a degree measure between 0 (inclusive) and 360
|
|
54
|
-
* (exclusive).
|
|
55
|
-
*/
|
|
56
|
-
export declare function sanitizeDegreesInt(degrees: number): number;
|
|
57
50
|
/**
|
|
58
51
|
* Sanitizes a degree measure as a floating-point number.
|
|
59
52
|
*
|
|
@@ -61,25 +54,6 @@ export declare function sanitizeDegreesInt(degrees: number): number;
|
|
|
61
54
|
* (exclusive).
|
|
62
55
|
*/
|
|
63
56
|
export declare function sanitizeDegreesDouble(degrees: number): number;
|
|
64
|
-
/**
|
|
65
|
-
* Sign of direction change needed to travel from one angle to
|
|
66
|
-
* another.
|
|
67
|
-
*
|
|
68
|
-
* For angles that are 180 degrees apart from each other, both
|
|
69
|
-
* directions have the same travel distance, so either direction is
|
|
70
|
-
* shortest. The value 1.0 is returned in this case.
|
|
71
|
-
*
|
|
72
|
-
* @param from The angle travel starts from, in degrees.
|
|
73
|
-
* @param to The angle travel ends at, in degrees.
|
|
74
|
-
* @return -1 if decreasing from leads to the shortest travel
|
|
75
|
-
* distance, 1 if increasing from leads to the shortest travel
|
|
76
|
-
* distance.
|
|
77
|
-
*/
|
|
78
|
-
export declare function rotationDirection(from: number, to: number): number;
|
|
79
|
-
/**
|
|
80
|
-
* Distance of two points on a circle, represented using degrees.
|
|
81
|
-
*/
|
|
82
|
-
export declare function differenceDegrees(a: number, b: number): number;
|
|
83
57
|
/**
|
|
84
58
|
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
85
59
|
*/
|
|
@@ -2,7 +2,6 @@ export declare const THEME_DATA_ATTRIBUTE = "data-theme";
|
|
|
2
2
|
export declare const COLOR_MODE_ATTRIBUTE = "data-color-mode";
|
|
3
3
|
export declare const CONTRAST_MODE_ATTRIBUTE = "data-contrast-mode";
|
|
4
4
|
export declare const CUSTOM_THEME_ATTRIBUTE = "data-custom-theme";
|
|
5
|
-
export declare const DEFAULT_THEME = "light";
|
|
6
5
|
export declare const CSS_PREFIX = "ds";
|
|
7
6
|
export declare const CSS_VAR_FULL: string[];
|
|
8
7
|
export declare const TOKEN_NOT_FOUND_CSS_VAR = "--ds-token-not-found";
|
|
@@ -20,7 +20,7 @@ export type ThemeOverrides = Themes;
|
|
|
20
20
|
* Some themes are entirely focused on Color, whilst others are purely focused on spacing.
|
|
21
21
|
* In the future other types may be introduced such as typography.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
type ThemeKinds = 'color' | 'spacing' | 'typography' | 'shape';
|
|
24
24
|
/**
|
|
25
25
|
* Theme modes: The general purpose of a theme.
|
|
26
26
|
* This attr is used to apply the appropriate system-preference option
|
|
@@ -37,12 +37,12 @@ export type DataColorModes = Exclude<ThemeColorModes, 'auto'>;
|
|
|
37
37
|
/**
|
|
38
38
|
* Contrast preferences: The system contrast preference
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
declare const themeContrastModes: readonly [
|
|
41
41
|
"more",
|
|
42
42
|
"no-preference",
|
|
43
43
|
"auto"
|
|
44
44
|
];
|
|
45
|
-
|
|
45
|
+
type ThemeContrastModes = (typeof themeContrastModes)[number];
|
|
46
46
|
export type DataContrastModes = 'more' | 'no-preference' | 'auto';
|
|
47
47
|
/**
|
|
48
48
|
* Theme ids: The value that will be mounted to the DOM as a data attr
|
|
@@ -72,7 +72,7 @@ export type ThemeIds = (typeof themeIds)[number];
|
|
|
72
72
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
73
73
|
* Theme overrides are temporary and there may not be any defined at times.
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
declare const themeOverrideIds: readonly [
|
|
76
76
|
];
|
|
77
77
|
export type ThemeOverrideIds = (typeof themeOverrideIds)[number];
|
|
78
78
|
export declare const themeIdsWithOverrides: readonly [
|
|
@@ -98,7 +98,7 @@ export type ThemeIdsWithOverrides = (typeof themeIdsWithOverrides)[number];
|
|
|
98
98
|
* an extension with all token values marked as optional
|
|
99
99
|
* to allow tokens to be overridden as required.
|
|
100
100
|
*/
|
|
101
|
-
|
|
101
|
+
type ExtensionThemeId = ThemeIds;
|
|
102
102
|
/**
|
|
103
103
|
* Palettes: The set of base tokens a given theme may be populated with.
|
|
104
104
|
* For example: legacy light & dark themes use the "legacyPalette" containing colors from our
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { InternalTokenIds } from './artifacts/types-internal';
|
|
2
2
|
export type Groups = 'raw' | 'paint' | 'shadow' | 'palette' | 'opacity' | 'spacing' | 'shape' | 'typography' | 'fontSize' | 'fontWeight' | 'fontFamily' | 'lineHeight' | 'letterSpacing';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
type ActiveTokenState = 'active';
|
|
4
|
+
type DeprecatedTokenState = 'deprecated';
|
|
5
|
+
type DeletedTokenState = 'deleted';
|
|
6
|
+
type ExperimentalTokenState = 'experimental';
|
|
7
|
+
type TokenState = ActiveTokenState | DeprecatedTokenState | DeletedTokenState | ExperimentalTokenState;
|
|
8
|
+
type Replacement = InternalTokenIds | InternalTokenIds[];
|
|
9
|
+
type ExperimentalReplacement = InternalTokenIds | InternalTokenIds[] | string;
|
|
10
|
+
type PaletteCategory = 'blue' | 'purple' | 'red' | 'magenta' | 'orange' | 'yellow' | 'green' | 'teal' | 'lime' | 'light mode neutral' | 'dark mode neutral';
|
|
11
|
+
type ValueCategory = 'opacity';
|
|
12
|
+
interface Token<TValue, Group extends Groups> {
|
|
13
13
|
value: TValue;
|
|
14
14
|
attributes: {
|
|
15
15
|
group: Group;
|
|
@@ -62,7 +62,7 @@ export interface DesignToken<TValue, Group extends Groups> extends Token<TValue,
|
|
|
62
62
|
suggest?: string[];
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
interface TypographyDesignToken<TValue> extends DesignToken<TValue, 'typography'> {
|
|
66
66
|
attributes: DesignToken<TValue, 'typography'>['attributes'];
|
|
67
67
|
}
|
|
68
68
|
type OmitDistributive<T, K extends PropertyKey> = T extends any ? T extends object ? Id<DeepOmit<T, K>> : T : never;
|
|
@@ -78,13 +78,13 @@ export type DeepPartial<T> = T extends object ? {
|
|
|
78
78
|
export type ValueSchema<Schema extends object> = DeepOmit<Schema, 'attributes'>;
|
|
79
79
|
export type ExtendedValueSchema<Schema extends object> = DeepPartial<ValueSchema<Schema>>;
|
|
80
80
|
export type AttributeSchema<Schema extends object> = DeepOmit<Schema, 'value'>;
|
|
81
|
-
|
|
81
|
+
interface PaletteToken extends BaseToken<string, 'palette'> {
|
|
82
82
|
attributes: {
|
|
83
83
|
group: 'palette';
|
|
84
84
|
category: PaletteCategory;
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
interface ValueToken extends BaseToken<number, 'palette'> {
|
|
88
88
|
attributes: {
|
|
89
89
|
group: 'palette';
|
|
90
90
|
category: ValueCategory;
|
|
@@ -105,11 +105,8 @@ export type ShadowToken<BaseToken> = DesignToken<Array<{
|
|
|
105
105
|
export type OpacityToken = DesignToken<string, 'opacity'>;
|
|
106
106
|
export type SpacingToken<BaseToken> = DesignToken<BaseToken, 'spacing'>;
|
|
107
107
|
export type ShapeToken<BaseToken> = DesignToken<BaseToken, 'shape'>;
|
|
108
|
-
export type FontSizeToken<BaseToken> = DesignToken<BaseToken, 'fontSize'>;
|
|
109
108
|
export type FontWeightToken<BaseToken> = DesignToken<BaseToken, 'fontWeight'>;
|
|
110
109
|
export type FontFamilyToken<BaseToken> = DesignToken<BaseToken, 'fontFamily'>;
|
|
111
|
-
export type LineHeightToken<BaseToken> = DesignToken<BaseToken, 'lineHeight'>;
|
|
112
|
-
export type LetterSpacingToken<BaseToken> = DesignToken<BaseToken, 'letterSpacing'>;
|
|
113
110
|
export type DeprecatedTypographyToken<BaseToken> = DesignToken<BaseToken, 'fontSize' | 'fontWeight' | 'fontFamily' | 'lineHeight' | 'letterSpacing'>;
|
|
114
111
|
export type RawToken = DesignToken<string, 'raw'>;
|
|
115
112
|
export interface PaletteColorTokenSchema<PaletteValues extends string> {
|
|
@@ -954,9 +951,6 @@ export interface OpacityTokenSchema {
|
|
|
954
951
|
disabled: OpacityToken;
|
|
955
952
|
};
|
|
956
953
|
}
|
|
957
|
-
export type ElevationTokenSchema<BaseToken> = SurfaceTokenSchema<BaseToken> & ShadowTokenSchema<BaseToken>;
|
|
958
|
-
export type ColorTokenSchema<BaseToken> = BackgroundColorTokenSchema<BaseToken> & BorderColorTokenSchema<BaseToken> & IconColorTokenSchema<BaseToken> & TextColorTokenSchema<BaseToken> & AccentColorTokenSchema<BaseToken> & UtilTokenSchema<BaseToken>;
|
|
959
|
-
export type TokenSchema<BaseToken> = ColorTokenSchema<BaseToken> & ElevationTokenSchema<BaseToken>;
|
|
960
954
|
export interface SpacingTokenSchema<BaseToken> {
|
|
961
955
|
space: {
|
|
962
956
|
'0': SpacingToken<BaseToken>;
|
|
@@ -10,34 +10,10 @@ export declare function argbFromRgb(red: number, green: number, blue: number): n
|
|
|
10
10
|
* Converts a color from linear RGB components to ARGB format.
|
|
11
11
|
*/
|
|
12
12
|
export declare function argbFromLinrgb(linrgb: number[]): number;
|
|
13
|
-
/**
|
|
14
|
-
* Returns the alpha component of a color in ARGB format.
|
|
15
|
-
*/
|
|
16
|
-
export declare function alphaFromArgb(argb: number): number;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the red component of a color in ARGB format.
|
|
19
|
-
*/
|
|
20
|
-
export declare function redFromArgb(argb: number): number;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the green component of a color in ARGB format.
|
|
23
|
-
*/
|
|
24
|
-
export declare function greenFromArgb(argb: number): number;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the blue component of a color in ARGB format.
|
|
27
|
-
*/
|
|
28
|
-
export declare function blueFromArgb(argb: number): number;
|
|
29
|
-
/**
|
|
30
|
-
* Returns whether a color in ARGB format is opaque.
|
|
31
|
-
*/
|
|
32
|
-
export declare function isOpaque(argb: number): boolean;
|
|
33
13
|
/**
|
|
34
14
|
* Converts a color from ARGB to XYZ.
|
|
35
15
|
*/
|
|
36
16
|
export declare function argbFromXyz(x: number, y: number, z: number): number;
|
|
37
|
-
/**
|
|
38
|
-
* Converts a color from XYZ to ARGB.
|
|
39
|
-
*/
|
|
40
|
-
export declare function xyzFromArgb(argb: number): number[];
|
|
41
17
|
/**
|
|
42
18
|
* Converts an L* value to an ARGB representation.
|
|
43
19
|
*
|
|
@@ -109,7 +85,7 @@ export declare function whitePointD65(): number[];
|
|
|
109
85
|
* @param b Blue value should be between 0-255
|
|
110
86
|
* @param a Alpha value should be between 0-255
|
|
111
87
|
*/
|
|
112
|
-
|
|
88
|
+
interface Rgba {
|
|
113
89
|
r: number;
|
|
114
90
|
g: number;
|
|
115
91
|
b: number;
|
|
@@ -129,3 +105,4 @@ export declare function rgbaFromArgb(argb: number): Rgba;
|
|
|
129
105
|
* @returns ARGB representation of a int32 color.
|
|
130
106
|
*/
|
|
131
107
|
export declare function argbFromRgba({ r, g, b, a }: Rgba): number;
|
|
108
|
+
export {};
|
|
@@ -47,13 +47,6 @@ export declare function clampInt(min: number, max: number, input: number): numbe
|
|
|
47
47
|
* otherwise.
|
|
48
48
|
*/
|
|
49
49
|
export declare function clampDouble(min: number, max: number, input: number): number;
|
|
50
|
-
/**
|
|
51
|
-
* Sanitizes a degree measure as an integer.
|
|
52
|
-
*
|
|
53
|
-
* @return a degree measure between 0 (inclusive) and 360
|
|
54
|
-
* (exclusive).
|
|
55
|
-
*/
|
|
56
|
-
export declare function sanitizeDegreesInt(degrees: number): number;
|
|
57
50
|
/**
|
|
58
51
|
* Sanitizes a degree measure as a floating-point number.
|
|
59
52
|
*
|
|
@@ -61,25 +54,6 @@ export declare function sanitizeDegreesInt(degrees: number): number;
|
|
|
61
54
|
* (exclusive).
|
|
62
55
|
*/
|
|
63
56
|
export declare function sanitizeDegreesDouble(degrees: number): number;
|
|
64
|
-
/**
|
|
65
|
-
* Sign of direction change needed to travel from one angle to
|
|
66
|
-
* another.
|
|
67
|
-
*
|
|
68
|
-
* For angles that are 180 degrees apart from each other, both
|
|
69
|
-
* directions have the same travel distance, so either direction is
|
|
70
|
-
* shortest. The value 1.0 is returned in this case.
|
|
71
|
-
*
|
|
72
|
-
* @param from The angle travel starts from, in degrees.
|
|
73
|
-
* @param to The angle travel ends at, in degrees.
|
|
74
|
-
* @return -1 if decreasing from leads to the shortest travel
|
|
75
|
-
* distance, 1 if increasing from leads to the shortest travel
|
|
76
|
-
* distance.
|
|
77
|
-
*/
|
|
78
|
-
export declare function rotationDirection(from: number, to: number): number;
|
|
79
|
-
/**
|
|
80
|
-
* Distance of two points on a circle, represented using degrees.
|
|
81
|
-
*/
|
|
82
|
-
export declare function differenceDegrees(a: number, b: number): number;
|
|
83
57
|
/**
|
|
84
58
|
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
85
59
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tokens",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "Design tokens are the single source of truth to name and store design decisions.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -42,40 +42,50 @@
|
|
|
42
42
|
"react": "^18.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@af/accessibility-testing": "^2.0.0",
|
|
46
45
|
"@af/formatting": "^0.0.4",
|
|
46
|
+
"@af/visual-regression": "^1.3.0",
|
|
47
|
+
"@atlaskit/avatar": "^25.0.0",
|
|
47
48
|
"@atlaskit/button": "^21.1.0",
|
|
48
49
|
"@atlaskit/calendar": "^17.1.0",
|
|
49
50
|
"@atlaskit/checkbox": "^17.0.0",
|
|
51
|
+
"@atlaskit/code": "^16.0.0",
|
|
52
|
+
"@atlaskit/docs": "^10.0.0",
|
|
53
|
+
"@atlaskit/dropdown-menu": "^13.0.0",
|
|
54
|
+
"@atlaskit/dynamic-table": "^18.0.0",
|
|
55
|
+
"@atlaskit/form": "^12.0.0",
|
|
56
|
+
"@atlaskit/grid": "^0.18.0",
|
|
57
|
+
"@atlaskit/heading": "^5.1.0",
|
|
58
|
+
"@atlaskit/icon": "^25.0.0",
|
|
59
|
+
"@atlaskit/inline-message": "^14.0.0",
|
|
60
|
+
"@atlaskit/link": "^3.0.0",
|
|
61
|
+
"@atlaskit/lozenge": "^12.2.0",
|
|
62
|
+
"@atlaskit/popup": "^2.0.0",
|
|
63
|
+
"@atlaskit/primitives": "^14.2.0",
|
|
50
64
|
"@atlaskit/radio": "^8.0.0",
|
|
65
|
+
"@atlaskit/section-message": "^8.2.0",
|
|
66
|
+
"@atlaskit/select": "^20.0.0",
|
|
67
|
+
"@atlaskit/tag": "^14.0.0",
|
|
68
|
+
"@atlaskit/textarea": "^8.0.0",
|
|
51
69
|
"@atlaskit/textfield": "^8.0.0",
|
|
70
|
+
"@atlaskit/theme": "^18.0.0",
|
|
52
71
|
"@atlaskit/tooltip": "^20.0.0",
|
|
53
|
-
"@atlaskit/visual-regression": "^0.10.0",
|
|
54
72
|
"@atlassian/codegen": "^0.1.0",
|
|
55
73
|
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
56
74
|
"@atlassian/ts-loader": "^0.1.0",
|
|
57
75
|
"@babel/core": "7.24.9",
|
|
58
76
|
"@emotion/react": "^11.7.1",
|
|
59
77
|
"@hypermod/utils": "^0.4.2",
|
|
60
|
-
"@testing-library/dom": "^10.1.0",
|
|
61
78
|
"@testing-library/react": "^13.4.0",
|
|
62
79
|
"@testing-library/react-hooks": "^8.0.1",
|
|
63
|
-
"@testing-library/user-event": "^14.4.3",
|
|
64
|
-
"@types/chrome": "^0.0.171",
|
|
65
80
|
"color-blend": "^4.0.0",
|
|
66
|
-
"copy-webpack-plugin": "^6.4.0",
|
|
67
81
|
"echarts": "^5.4.1",
|
|
68
82
|
"echarts-for-react": "^3.0.2",
|
|
69
|
-
"fuse.js": "^6.6.2",
|
|
70
83
|
"jscodeshift": "^0.13.0",
|
|
71
84
|
"lodash": "^4.17.21",
|
|
72
85
|
"postcss": "^8.4.7",
|
|
73
86
|
"postcss-less": "^6.0.0",
|
|
74
|
-
"prettier": "^3.2.5",
|
|
75
87
|
"react": "^18.2.0",
|
|
76
|
-
"react-use-clipboard": "^1.0.0",
|
|
77
88
|
"react-window": "^1.8.8",
|
|
78
|
-
"recharts": "^2.15.1",
|
|
79
89
|
"style-dictionary": "^3.8.0",
|
|
80
90
|
"typescript": "~5.4.2"
|
|
81
91
|
},
|