@atlaskit/editor-palette 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/background.js +89 -37
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/table-charts.js +128 -47
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/background.js +45 -33
- package/dist/es2019/index.js +2 -2
- package/dist/es2019/table-charts.js +54 -41
- package/dist/es2019/version.json +1 -1
- package/dist/esm/background.js +87 -34
- package/dist/esm/index.js +2 -2
- package/dist/esm/table-charts.js +126 -43
- package/dist/esm/version.json +1 -1
- package/dist/types/background.d.ts +41 -25
- package/dist/types/index.d.ts +2 -2
- package/dist/types/table-charts.d.ts +50 -39
- package/dist/types-ts4.5/background.d.ts +41 -25
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/table-charts.d.ts +50 -39
- package/package.json +2 -4
- package/report.api.md +64 -143
- package/tmp/api-report-tmp.d.ts +62 -74
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// This import will be stripped on build
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
import { getTokenValue } from '@atlaskit/tokens';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* This takes an adf hex color and returns a matching background palette
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
19
20
|
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
20
21
|
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
21
|
-
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
22
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
|
22
23
|
*/
|
|
23
24
|
export function hexToEditorBackgroundPaletteColor(hexColor) {
|
|
24
25
|
// Ts ignore used to allow use of conditional return type
|
|
@@ -27,37 +28,51 @@ export function hexToEditorBackgroundPaletteColor(hexColor) {
|
|
|
27
28
|
const tokenData = editorBackgroundPalette[hexColor.toUpperCase()];
|
|
28
29
|
return tokenData ? tokenData.token : undefined;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Takes an ADF hex color and returns the rendered hex code for the associated background palette design token using getTokenValue.
|
|
34
|
+
* If the provided color does not exist in the Editor color palette, this function returns undefined.
|
|
35
|
+
*
|
|
36
|
+
* This should only be used when rendering content where CSS variables are not feasible, such as a non-CSS environment
|
|
37
|
+
* or to enable cross-app copy/paste.
|
|
38
|
+
*
|
|
39
|
+
* WARNING: If the rendered theme changes (such as from light -> dark mode) the value returned here will no longer match
|
|
40
|
+
* the surrounding UI and will need to be re-fetched.
|
|
41
|
+
* In addition, the values of tokens will differ between themes and the value for a given theme can and will change.
|
|
42
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
43
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
|
44
|
+
*/
|
|
45
|
+
export function hexToEditorBackgroundPaletteRawValue(hexColor) {
|
|
31
46
|
// Ts ignore used to allow use of conditional return type
|
|
32
47
|
// (preferencing better type on consumption over safety in implementation)
|
|
33
48
|
// @ts-ignore
|
|
34
49
|
const tokenData = editorBackgroundPalette[hexColor.toUpperCase()];
|
|
35
|
-
return tokenData ? tokenData.
|
|
50
|
+
return tokenData ? tokenData.getValue(hexColor) : undefined;
|
|
36
51
|
}
|
|
37
52
|
// Colors taken from
|
|
38
53
|
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Values are asserted to improve generated type declarations
|
|
56
|
+
* Using object structure as getValue() function needed for table values, and other
|
|
57
|
+
* properties may be needed in the future.
|
|
58
|
+
*/
|
|
44
59
|
export const editorBackgroundPalette = {
|
|
45
60
|
// blue
|
|
46
61
|
/** blue - light */
|
|
47
62
|
['#DEEBFF']: {
|
|
48
|
-
|
|
63
|
+
getValue: fallback => getTokenValue('color.background.accent.blue.subtlest', fallback),
|
|
49
64
|
token: "var(--ds-background-accent-blue-subtlest, #DEEBFF)"
|
|
50
65
|
},
|
|
51
66
|
// source for hex code was legacy token B50
|
|
52
67
|
/** blue - medium */
|
|
53
68
|
['#B3D4FF']: {
|
|
54
|
-
|
|
69
|
+
getValue: fallback => getTokenValue('color.background.accent.blue.subtler', fallback),
|
|
55
70
|
token: "var(--ds-background-accent-blue-subtler, #B3D4FF)"
|
|
56
71
|
},
|
|
57
72
|
// source for hex code was legacy token B75
|
|
58
73
|
/** blue - strong */
|
|
59
74
|
['#4C9AFF']: {
|
|
60
|
-
|
|
75
|
+
getValue: fallback => getTokenValue('color.background.accent.blue.subtle', fallback),
|
|
61
76
|
token: "var(--ds-background-accent-blue-subtle, #4C9AFF)"
|
|
62
77
|
},
|
|
63
78
|
// source for hex code was legacy token B100
|
|
@@ -65,117 +80,114 @@ export const editorBackgroundPalette = {
|
|
|
65
80
|
// teal
|
|
66
81
|
/** teal - light */
|
|
67
82
|
['#E6FCFF']: {
|
|
68
|
-
|
|
83
|
+
getValue: fallback => getTokenValue('color.background.accent.teal.subtlest', fallback),
|
|
69
84
|
token: "var(--ds-background-accent-teal-subtlest, #E6FCFF)" // source for hex code was legacy token T50,
|
|
70
85
|
},
|
|
71
86
|
|
|
72
87
|
/** teal - medium */
|
|
73
88
|
['#B3F5FF']: {
|
|
74
|
-
|
|
89
|
+
getValue: fallback => getTokenValue('color.background.accent.teal.subtler', fallback),
|
|
75
90
|
token: "var(--ds-background-accent-teal-subtler, #B3F5FF)" // source for hex code was legacy token T75,
|
|
76
91
|
},
|
|
77
92
|
|
|
78
93
|
/** teal - strong */
|
|
79
94
|
['#79E2F2']: {
|
|
80
|
-
|
|
95
|
+
getValue: fallback => getTokenValue('color.background.accent.teal.subtle', fallback),
|
|
81
96
|
token: "var(--ds-background-accent-teal-subtle, #79E2F2)" // source for hex code was legacy token T100,
|
|
82
97
|
},
|
|
83
98
|
|
|
84
99
|
// green
|
|
85
100
|
/** green - light */
|
|
86
101
|
['#E3FCEF']: {
|
|
87
|
-
|
|
102
|
+
getValue: fallback => getTokenValue('color.background.accent.green.subtlest', fallback),
|
|
88
103
|
token: "var(--ds-background-accent-green-subtlest, #E3FCEF)" // source for hex code was legacy token G50,
|
|
89
104
|
},
|
|
90
105
|
|
|
91
106
|
/** green - medium */
|
|
92
107
|
['#ABF5D1']: {
|
|
93
|
-
|
|
108
|
+
getValue: fallback => getTokenValue('color.background.accent.green.subtler', fallback),
|
|
94
109
|
token: "var(--ds-background-accent-green-subtler, #ABF5D1)" // source for hex code was legacy token G75,
|
|
95
110
|
},
|
|
96
111
|
|
|
97
112
|
/** green - strong */
|
|
98
113
|
['#57D9A3']: {
|
|
99
|
-
|
|
114
|
+
getValue: fallback => getTokenValue('color.background.accent.green.subtle', fallback),
|
|
100
115
|
token: "var(--ds-background-accent-green-subtle, #57D9A3)" // source for hex code was legacy token G200,
|
|
101
116
|
},
|
|
102
117
|
|
|
103
118
|
// yellowOrange
|
|
104
119
|
/** yellowOrange - light */
|
|
105
120
|
['#FFFAE6']: {
|
|
106
|
-
|
|
121
|
+
getValue: fallback => getTokenValue('color.background.accent.yellow.subtlest', fallback),
|
|
107
122
|
token: "var(--ds-background-accent-yellow-subtlest, #FFFAE6)" // source for hex code was legacy token Y50,
|
|
108
123
|
},
|
|
109
124
|
|
|
110
125
|
/** yellowOrange - medium */
|
|
111
126
|
['#FFF0B3']: {
|
|
112
|
-
|
|
127
|
+
getValue: fallback => getTokenValue('color.background.accent.yellow.subtler', fallback),
|
|
113
128
|
token: "var(--ds-background-accent-yellow-subtler, #FFF0B3)" // source for hex code was legacy token Y75,
|
|
114
129
|
},
|
|
115
130
|
|
|
116
131
|
/** yellowOrange - strong */
|
|
117
132
|
['#FFC400']: {
|
|
118
|
-
|
|
133
|
+
getValue: fallback => getTokenValue('color.background.accent.orange.subtle', fallback),
|
|
119
134
|
token: "var(--ds-background-accent-orange-subtle, #FFC400)" // source for hex code was legacy token Y200,
|
|
120
135
|
},
|
|
121
136
|
|
|
122
137
|
// red
|
|
123
138
|
/** red - light */
|
|
124
139
|
['#FFEBE6']: {
|
|
125
|
-
|
|
140
|
+
getValue: fallback => getTokenValue('color.background.accent.red.subtlest', fallback),
|
|
126
141
|
token: "var(--ds-background-accent-red-subtlest, #FFEBE6)" // source for hex code was legacy token R50,
|
|
127
142
|
},
|
|
128
143
|
|
|
129
144
|
/** red - medium */
|
|
130
145
|
['#FFBDAD']: {
|
|
131
|
-
|
|
146
|
+
getValue: fallback => getTokenValue('color.background.accent.red.subtler', fallback),
|
|
132
147
|
token: "var(--ds-background-accent-red-subtler, #FFBDAD)" // source for hex code was legacy token R75,
|
|
133
148
|
},
|
|
134
149
|
|
|
135
150
|
/** red - strong */
|
|
136
151
|
['#FF8F73']: {
|
|
137
|
-
|
|
152
|
+
getValue: fallback => getTokenValue('color.background.accent.red.subtle', fallback),
|
|
138
153
|
token: "var(--ds-background-accent-red-subtle, #FF8F73)" // source for hex code was legacy token R100,
|
|
139
154
|
},
|
|
140
155
|
|
|
141
156
|
// purple
|
|
142
157
|
/** purple - light */
|
|
143
158
|
['#EAE6FF']: {
|
|
144
|
-
|
|
159
|
+
getValue: fallback => getTokenValue('color.background.accent.purple.subtlest', fallback),
|
|
145
160
|
token: "var(--ds-background-accent-purple-subtlest, #EAE6FF)" // source for hex code was legacy token P50,
|
|
146
161
|
},
|
|
147
162
|
|
|
148
163
|
/** purple - medium */
|
|
149
164
|
['#C0B6F2']: {
|
|
150
|
-
|
|
165
|
+
getValue: fallback => getTokenValue('color.background.accent.purple.subtler', fallback),
|
|
151
166
|
token: "var(--ds-background-accent-purple-subtler, #C0B6F2)" // source for hex code was legacy token P75,
|
|
152
167
|
},
|
|
153
168
|
|
|
154
169
|
/** purple - strong */
|
|
155
170
|
['#998DD9']: {
|
|
156
|
-
|
|
171
|
+
getValue: fallback => getTokenValue('color.background.accent.purple.subtle', fallback),
|
|
157
172
|
token: "var(--ds-background-accent-purple-subtle, #998DD9)" // source for hex code was legacy token P100,
|
|
158
173
|
},
|
|
159
174
|
|
|
160
175
|
// whiteGray
|
|
161
176
|
/** whiteGray - light */
|
|
162
177
|
['#FFFFFF']: {
|
|
163
|
-
|
|
178
|
+
getValue: fallback => getTokenValue('elevation.surface', fallback),
|
|
164
179
|
token: "var(--ds-surface, #FFFFFF)" // source for hex code was legacy token N0,
|
|
165
180
|
},
|
|
166
181
|
|
|
167
182
|
/** whiteGray - medium */
|
|
168
183
|
['#F4F5F7']: {
|
|
169
|
-
|
|
184
|
+
getValue: fallback => getTokenValue('color.background.accent.gray.subtlest', fallback),
|
|
170
185
|
token: "var(--ds-background-accent-gray-subtlest, #F4F5F7)" // source for hex code was legacy token N20,
|
|
171
186
|
},
|
|
172
187
|
|
|
173
188
|
/** whiteGray - strong */
|
|
174
189
|
['#B3BAC5']: {
|
|
175
|
-
|
|
190
|
+
getValue: fallback => getTokenValue('color.background.accent.gray.subtle', fallback),
|
|
176
191
|
token: "var(--ds-background-accent-gray-subtle, #B3BAC5)" // source for hex code was legacy token N60,
|
|
177
192
|
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const backgroundPaletteKeys = Object.keys(editorBackgroundPalette);
|
|
181
|
-
const tokenNames = backgroundPaletteKeys.map(hexCode => editorBackgroundPalette[hexCode].tokenName);
|
|
193
|
+
};
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { hexToEditorBackgroundPaletteColor,
|
|
1
|
+
export { hexToEditorBackgroundPaletteColor, hexToEditorBackgroundPaletteRawValue } from './background';
|
|
2
2
|
export { hexToEditorBorderPaletteColor } from './border';
|
|
3
3
|
export { hexToEditorTextPaletteColor } from './text';
|
|
4
|
-
export { hexToEditorTableChartsPaletteColor,
|
|
4
|
+
export { hexToEditorTableChartsPaletteColor, hexToEditorTableChartsPaletteRawValue } from './table-charts';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// This import will be stripped on build
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
import { getTokenValue } from '@atlaskit/tokens';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* This takes an adf hex color and returns a matching chart palette
|
|
@@ -27,12 +28,26 @@ export function hexToEditorTableChartsPaletteColor(hexColor) {
|
|
|
27
28
|
const tokenData = editorTableChartsPalette[hexColor.toUpperCase()];
|
|
28
29
|
return tokenData ? tokenData.token : undefined;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Takes an ADF hex color and returns the rendered hex code for the associated chart palette design token using getTokenValue.
|
|
34
|
+
* If the provided color does not exist in the Editor color palette, this function returns undefined.
|
|
35
|
+
*
|
|
36
|
+
* This should only be used when rendering content where CSS variables are not feasible, such as a non-CSS environment
|
|
37
|
+
* or to enable cross-app copy/paste.
|
|
38
|
+
*
|
|
39
|
+
* WARNING: If the rendered theme changes (such as from light -> dark mode) the value returned here will no longer match
|
|
40
|
+
* the surrounding UI and will need to be re-fetched.
|
|
41
|
+
* In addition, the values of tokens will differ between themes and the value for a given theme can and will change.
|
|
42
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
43
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
|
44
|
+
*/
|
|
45
|
+
export function hexToEditorTableChartsPaletteRawValue(hexColor) {
|
|
31
46
|
// Ts ignore used to allow use of conditional return type
|
|
32
47
|
// (preferencing better type on consumption over safety in implementation)
|
|
33
48
|
// @ts-ignore
|
|
34
49
|
const tokenData = editorTableChartsPalette[hexColor.toUpperCase()];
|
|
35
|
-
return tokenData ? tokenData.
|
|
50
|
+
return tokenData ? tokenData.getValue(hexColor) : undefined;
|
|
36
51
|
}
|
|
37
52
|
// Colors taken from
|
|
38
53
|
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
@@ -49,149 +64,147 @@ export function hexToEditorTableChartsPaletteColorTokenName(hexColor) {
|
|
|
49
64
|
*/
|
|
50
65
|
const editorTableChartsPalette = {
|
|
51
66
|
['#7AB2FF']: {
|
|
52
|
-
|
|
67
|
+
getValue: fallback => getTokenValue('color.background.accent.blue.subtle', fallback),
|
|
53
68
|
token: "var(--ds-background-accent-blue-subtle, #7AB2FF)"
|
|
54
69
|
},
|
|
55
70
|
['#60C6D2']: {
|
|
56
|
-
|
|
71
|
+
getValue: fallback => getTokenValue('color.background.accent.teal.subtle', fallback),
|
|
57
72
|
token: "var(--ds-background-accent-teal-subtle, #60C6D2)"
|
|
58
73
|
},
|
|
59
74
|
['#6BE1B0']: {
|
|
60
|
-
|
|
75
|
+
getValue: fallback => getTokenValue('color.background.accent.green.subtle', fallback),
|
|
61
76
|
token: "var(--ds-background-accent-green-subtle, #6BE1B0)"
|
|
62
77
|
},
|
|
63
78
|
['#FFDB57']: {
|
|
64
|
-
|
|
79
|
+
getValue: fallback => getTokenValue('color.background.accent.yellow.subtle', fallback),
|
|
65
80
|
token: "var(--ds-background-accent-yellow-subtle, #FFDB57)"
|
|
66
81
|
},
|
|
67
82
|
['#FAA53D']: {
|
|
68
|
-
|
|
83
|
+
getValue: fallback => getTokenValue('color.background.accent.orange.subtle', fallback),
|
|
69
84
|
token: "var(--ds-background-accent-orange-subtle, #FAA53D)"
|
|
70
85
|
},
|
|
71
86
|
['#FF8F73']: {
|
|
72
|
-
|
|
87
|
+
getValue: fallback => getTokenValue('color.background.accent.red.subtle', fallback),
|
|
73
88
|
token: "var(--ds-background-accent-red-subtle, #FF8F73)"
|
|
74
89
|
},
|
|
75
90
|
['#E774BB']: {
|
|
76
|
-
|
|
91
|
+
getValue: fallback => getTokenValue('color.background.accent.magenta.subtle', fallback),
|
|
77
92
|
token: "var(--ds-background-accent-magenta-subtle, #E774BB)"
|
|
78
93
|
},
|
|
79
94
|
['#B5A7FB']: {
|
|
80
|
-
|
|
95
|
+
getValue: fallback => getTokenValue('color.background.accent.purple.subtle', fallback),
|
|
81
96
|
token: "var(--ds-background-accent-purple-subtle, #B5A7FB)"
|
|
82
97
|
},
|
|
83
98
|
['#8993A5']: {
|
|
84
|
-
|
|
99
|
+
getValue: fallback => getTokenValue('color.background.accent.gray.subtler', fallback),
|
|
85
100
|
token: "var(--ds-background-accent-gray-subtler, #8993A5)"
|
|
86
101
|
},
|
|
87
102
|
['#247FFF']: {
|
|
88
|
-
|
|
103
|
+
getValue: fallback => getTokenValue('color.chart.blue.bold', fallback),
|
|
89
104
|
token: "var(--ds-chart-blue-bold, #247FFF)"
|
|
90
105
|
},
|
|
91
106
|
['#1D9AAA']: {
|
|
92
|
-
|
|
107
|
+
getValue: fallback => getTokenValue('color.chart.teal.bold', fallback),
|
|
93
108
|
token: "var(--ds-chart-teal-bold, #1D9AAA)"
|
|
94
109
|
},
|
|
95
110
|
['#23A971']: {
|
|
96
|
-
|
|
111
|
+
getValue: fallback => getTokenValue('color.chart.green.bold', fallback),
|
|
97
112
|
token: "var(--ds-chart-green-bold, #23A971)"
|
|
98
113
|
},
|
|
99
114
|
['#FFBE33']: {
|
|
100
|
-
|
|
115
|
+
getValue: fallback => getTokenValue('color.chart.yellow.bold', fallback),
|
|
101
116
|
token: "var(--ds-chart-yellow-bold, #FFBE33)"
|
|
102
117
|
},
|
|
103
118
|
['#D97008']: {
|
|
104
|
-
|
|
119
|
+
getValue: fallback => getTokenValue('color.chart.orange.bold', fallback),
|
|
105
120
|
token: "var(--ds-chart-orange-bold, #D97008)"
|
|
106
121
|
},
|
|
107
122
|
['#FC552C']: {
|
|
108
|
-
|
|
123
|
+
getValue: fallback => getTokenValue('color.chart.red.bold', fallback),
|
|
109
124
|
token: "var(--ds-chart-red-bold, #FC552C)"
|
|
110
125
|
},
|
|
111
126
|
['#DA62AC']: {
|
|
112
|
-
|
|
127
|
+
getValue: fallback => getTokenValue('color.chart.magenta.bold', fallback),
|
|
113
128
|
token: "var(--ds-chart-magenta-bold, #DA62AC)"
|
|
114
129
|
},
|
|
115
130
|
['#8B77EE']: {
|
|
116
|
-
|
|
131
|
+
getValue: fallback => getTokenValue('color.chart.purple.bold', fallback),
|
|
117
132
|
token: "var(--ds-chart-purple-bold, #8B77EE)"
|
|
118
133
|
},
|
|
119
134
|
['#8590A2']: {
|
|
120
|
-
|
|
135
|
+
getValue: fallback => getTokenValue('color.chart.gray.bold', fallback),
|
|
121
136
|
token: "var(--ds-chart-gray-bold, #8590A2)"
|
|
122
137
|
},
|
|
123
138
|
['#0055CC']: {
|
|
124
|
-
|
|
139
|
+
getValue: fallback => getTokenValue('color.chart.blue.bolder', fallback),
|
|
125
140
|
token: "var(--ds-chart-blue-bolder, #0055CC)"
|
|
126
141
|
},
|
|
127
142
|
['#1D7F8C']: {
|
|
128
|
-
|
|
143
|
+
getValue: fallback => getTokenValue('color.chart.teal.bolder', fallback),
|
|
129
144
|
token: "var(--ds-chart-teal-bolder, #1D7F8C)"
|
|
130
145
|
},
|
|
131
146
|
['#177D52']: {
|
|
132
|
-
|
|
147
|
+
getValue: fallback => getTokenValue('color.chart.green.bolder', fallback),
|
|
133
148
|
token: "var(--ds-chart-green-bolder, #177D52)"
|
|
134
149
|
},
|
|
135
150
|
['#FF9D00']: {
|
|
136
|
-
|
|
151
|
+
getValue: fallback => getTokenValue('color.chart.yellow.bolder', fallback),
|
|
137
152
|
token: "var(--ds-chart-yellow-bolder, #FF9D00)"
|
|
138
153
|
},
|
|
139
154
|
['#B65C02']: {
|
|
140
|
-
|
|
155
|
+
getValue: fallback => getTokenValue('color.chart.orange.bolder', fallback),
|
|
141
156
|
token: "var(--ds-chart-orange-bolder, #B65C02)"
|
|
142
157
|
},
|
|
143
158
|
['#D32D03']: {
|
|
144
|
-
|
|
159
|
+
getValue: fallback => getTokenValue('color.chart.red.bolder', fallback),
|
|
145
160
|
token: "var(--ds-chart-red-bolder, #D32D03)"
|
|
146
161
|
},
|
|
147
162
|
['#CD519D']: {
|
|
148
|
-
|
|
163
|
+
getValue: fallback => getTokenValue('color.chart.magenta.bolder', fallback),
|
|
149
164
|
token: "var(--ds-chart-magenta-bolder, #CD519D)"
|
|
150
165
|
},
|
|
151
166
|
['#5A43D0']: {
|
|
152
|
-
|
|
167
|
+
getValue: fallback => getTokenValue('color.chart.purple.bolder', fallback),
|
|
153
168
|
token: "var(--ds-chart-purple-bolder, #5A43D0)"
|
|
154
169
|
},
|
|
155
170
|
['#758195']: {
|
|
156
|
-
|
|
171
|
+
getValue: fallback => getTokenValue('color.chart.gray.bolder', fallback),
|
|
157
172
|
token: "var(--ds-chart-gray-bolder, #758195)"
|
|
158
173
|
},
|
|
159
174
|
['#003884']: {
|
|
160
|
-
|
|
175
|
+
getValue: fallback => getTokenValue('color.chart.blue.boldest', fallback),
|
|
161
176
|
token: "var(--ds-chart-blue-boldest, #003884)"
|
|
162
177
|
},
|
|
163
178
|
['#206B74']: {
|
|
164
|
-
|
|
179
|
+
getValue: fallback => getTokenValue('color.chart.teal.boldest', fallback),
|
|
165
180
|
token: "var(--ds-chart-teal-boldest, #206B74)"
|
|
166
181
|
},
|
|
167
182
|
['#055C3F']: {
|
|
168
|
-
|
|
183
|
+
getValue: fallback => getTokenValue('color.chart.green.boldest', fallback),
|
|
169
184
|
token: "var(--ds-chart-green-boldest, #055C3F)"
|
|
170
185
|
},
|
|
171
186
|
['#946104']: {
|
|
172
|
-
|
|
187
|
+
getValue: fallback => getTokenValue('color.chart.yellow.boldest', fallback),
|
|
173
188
|
token: "var(--ds-chart-yellow-boldest, #946104)"
|
|
174
189
|
},
|
|
175
190
|
['#974F0C']: {
|
|
176
|
-
|
|
191
|
+
getValue: fallback => getTokenValue('color.chart.orange.boldest', fallback),
|
|
177
192
|
token: "var(--ds-chart-orange-boldest, #974F0C)"
|
|
178
193
|
},
|
|
179
194
|
['#A32000']: {
|
|
180
|
-
|
|
195
|
+
getValue: fallback => getTokenValue('color.chart.red.boldest', fallback),
|
|
181
196
|
token: "var(--ds-chart-red-boldest, #A32000)"
|
|
182
197
|
},
|
|
183
198
|
['#943D73']: {
|
|
184
|
-
|
|
199
|
+
getValue: fallback => getTokenValue('color.chart.magenta.boldest', fallback),
|
|
185
200
|
token: "var(--ds-chart-magenta-boldest, #943D73)"
|
|
186
201
|
},
|
|
187
202
|
['#44368B']: {
|
|
188
|
-
|
|
203
|
+
getValue: fallback => getTokenValue('color.chart.purple.boldest', fallback),
|
|
189
204
|
token: "var(--ds-chart-purple-boldest, #44368B)"
|
|
190
205
|
},
|
|
191
206
|
['#44546F']: {
|
|
192
|
-
|
|
207
|
+
getValue: fallback => getTokenValue('color.chart.gray.boldest', fallback),
|
|
193
208
|
token: "var(--ds-chart-gray-boldest, #44546F)"
|
|
194
209
|
}
|
|
195
|
-
};
|
|
196
|
-
const tableChartsPaletteKeys = Object.keys(editorTableChartsPalette);
|
|
197
|
-
const tokenNames = tableChartsPaletteKeys.map(hexCode => editorTableChartsPalette[hexCode].tokenName);
|
|
210
|
+
};
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/background.js
CHANGED
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
var _editorBackgroundPale;
|
|
3
3
|
// This import will be stripped on build
|
|
4
4
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
+
import { getTokenValue } from '@atlaskit/tokens';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* This takes an adf hex color and returns a matching background palette
|
|
@@ -20,7 +21,7 @@ var _editorBackgroundPale;
|
|
|
20
21
|
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
21
22
|
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
22
23
|
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
23
|
-
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
24
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
|
24
25
|
*/
|
|
25
26
|
export function hexToEditorBackgroundPaletteColor(hexColor) {
|
|
26
27
|
// Ts ignore used to allow use of conditional return type
|
|
@@ -29,85 +30,137 @@ export function hexToEditorBackgroundPaletteColor(hexColor) {
|
|
|
29
30
|
var tokenData = editorBackgroundPalette[hexColor.toUpperCase()];
|
|
30
31
|
return tokenData ? tokenData.token : undefined;
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Takes an ADF hex color and returns the rendered hex code for the associated background palette design token using getTokenValue.
|
|
36
|
+
* If the provided color does not exist in the Editor color palette, this function returns undefined.
|
|
37
|
+
*
|
|
38
|
+
* This should only be used when rendering content where CSS variables are not feasible, such as a non-CSS environment
|
|
39
|
+
* or to enable cross-app copy/paste.
|
|
40
|
+
*
|
|
41
|
+
* WARNING: If the rendered theme changes (such as from light -> dark mode) the value returned here will no longer match
|
|
42
|
+
* the surrounding UI and will need to be re-fetched.
|
|
43
|
+
* In addition, the values of tokens will differ between themes and the value for a given theme can and will change.
|
|
44
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
45
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
|
46
|
+
*/
|
|
47
|
+
export function hexToEditorBackgroundPaletteRawValue(hexColor) {
|
|
33
48
|
// Ts ignore used to allow use of conditional return type
|
|
34
49
|
// (preferencing better type on consumption over safety in implementation)
|
|
35
50
|
// @ts-ignore
|
|
36
51
|
var tokenData = editorBackgroundPalette[hexColor.toUpperCase()];
|
|
37
|
-
return tokenData ? tokenData.
|
|
52
|
+
return tokenData ? tokenData.getValue(hexColor) : undefined;
|
|
38
53
|
}
|
|
39
54
|
// Colors taken from
|
|
40
55
|
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Values are asserted to improve generated type declarations
|
|
58
|
+
* Using object structure as getValue() function needed for table values, and other
|
|
59
|
+
* properties may be needed in the future.
|
|
60
|
+
*/
|
|
46
61
|
export var editorBackgroundPalette = (_editorBackgroundPale = {}, _defineProperty(_editorBackgroundPale, '#DEEBFF', {
|
|
47
|
-
|
|
62
|
+
getValue: function getValue(fallback) {
|
|
63
|
+
return getTokenValue('color.background.accent.blue.subtlest', fallback);
|
|
64
|
+
},
|
|
48
65
|
token: "var(--ds-background-accent-blue-subtlest, #DEEBFF)"
|
|
49
66
|
}), _defineProperty(_editorBackgroundPale, '#B3D4FF', {
|
|
50
|
-
|
|
67
|
+
getValue: function getValue(fallback) {
|
|
68
|
+
return getTokenValue('color.background.accent.blue.subtler', fallback);
|
|
69
|
+
},
|
|
51
70
|
token: "var(--ds-background-accent-blue-subtler, #B3D4FF)"
|
|
52
71
|
}), _defineProperty(_editorBackgroundPale, '#4C9AFF', {
|
|
53
|
-
|
|
72
|
+
getValue: function getValue(fallback) {
|
|
73
|
+
return getTokenValue('color.background.accent.blue.subtle', fallback);
|
|
74
|
+
},
|
|
54
75
|
token: "var(--ds-background-accent-blue-subtle, #4C9AFF)"
|
|
55
76
|
}), _defineProperty(_editorBackgroundPale, '#E6FCFF', {
|
|
56
|
-
|
|
77
|
+
getValue: function getValue(fallback) {
|
|
78
|
+
return getTokenValue('color.background.accent.teal.subtlest', fallback);
|
|
79
|
+
},
|
|
57
80
|
token: "var(--ds-background-accent-teal-subtlest, #E6FCFF)" // source for hex code was legacy token T50,
|
|
58
81
|
}), _defineProperty(_editorBackgroundPale, '#B3F5FF', {
|
|
59
|
-
|
|
82
|
+
getValue: function getValue(fallback) {
|
|
83
|
+
return getTokenValue('color.background.accent.teal.subtler', fallback);
|
|
84
|
+
},
|
|
60
85
|
token: "var(--ds-background-accent-teal-subtler, #B3F5FF)" // source for hex code was legacy token T75,
|
|
61
86
|
}), _defineProperty(_editorBackgroundPale, '#79E2F2', {
|
|
62
|
-
|
|
87
|
+
getValue: function getValue(fallback) {
|
|
88
|
+
return getTokenValue('color.background.accent.teal.subtle', fallback);
|
|
89
|
+
},
|
|
63
90
|
token: "var(--ds-background-accent-teal-subtle, #79E2F2)" // source for hex code was legacy token T100,
|
|
64
91
|
}), _defineProperty(_editorBackgroundPale, '#E3FCEF', {
|
|
65
|
-
|
|
92
|
+
getValue: function getValue(fallback) {
|
|
93
|
+
return getTokenValue('color.background.accent.green.subtlest', fallback);
|
|
94
|
+
},
|
|
66
95
|
token: "var(--ds-background-accent-green-subtlest, #E3FCEF)" // source for hex code was legacy token G50,
|
|
67
96
|
}), _defineProperty(_editorBackgroundPale, '#ABF5D1', {
|
|
68
|
-
|
|
97
|
+
getValue: function getValue(fallback) {
|
|
98
|
+
return getTokenValue('color.background.accent.green.subtler', fallback);
|
|
99
|
+
},
|
|
69
100
|
token: "var(--ds-background-accent-green-subtler, #ABF5D1)" // source for hex code was legacy token G75,
|
|
70
101
|
}), _defineProperty(_editorBackgroundPale, '#57D9A3', {
|
|
71
|
-
|
|
102
|
+
getValue: function getValue(fallback) {
|
|
103
|
+
return getTokenValue('color.background.accent.green.subtle', fallback);
|
|
104
|
+
},
|
|
72
105
|
token: "var(--ds-background-accent-green-subtle, #57D9A3)" // source for hex code was legacy token G200,
|
|
73
106
|
}), _defineProperty(_editorBackgroundPale, '#FFFAE6', {
|
|
74
|
-
|
|
107
|
+
getValue: function getValue(fallback) {
|
|
108
|
+
return getTokenValue('color.background.accent.yellow.subtlest', fallback);
|
|
109
|
+
},
|
|
75
110
|
token: "var(--ds-background-accent-yellow-subtlest, #FFFAE6)" // source for hex code was legacy token Y50,
|
|
76
111
|
}), _defineProperty(_editorBackgroundPale, '#FFF0B3', {
|
|
77
|
-
|
|
112
|
+
getValue: function getValue(fallback) {
|
|
113
|
+
return getTokenValue('color.background.accent.yellow.subtler', fallback);
|
|
114
|
+
},
|
|
78
115
|
token: "var(--ds-background-accent-yellow-subtler, #FFF0B3)" // source for hex code was legacy token Y75,
|
|
79
116
|
}), _defineProperty(_editorBackgroundPale, '#FFC400', {
|
|
80
|
-
|
|
117
|
+
getValue: function getValue(fallback) {
|
|
118
|
+
return getTokenValue('color.background.accent.orange.subtle', fallback);
|
|
119
|
+
},
|
|
81
120
|
token: "var(--ds-background-accent-orange-subtle, #FFC400)" // source for hex code was legacy token Y200,
|
|
82
121
|
}), _defineProperty(_editorBackgroundPale, '#FFEBE6', {
|
|
83
|
-
|
|
122
|
+
getValue: function getValue(fallback) {
|
|
123
|
+
return getTokenValue('color.background.accent.red.subtlest', fallback);
|
|
124
|
+
},
|
|
84
125
|
token: "var(--ds-background-accent-red-subtlest, #FFEBE6)" // source for hex code was legacy token R50,
|
|
85
126
|
}), _defineProperty(_editorBackgroundPale, '#FFBDAD', {
|
|
86
|
-
|
|
127
|
+
getValue: function getValue(fallback) {
|
|
128
|
+
return getTokenValue('color.background.accent.red.subtler', fallback);
|
|
129
|
+
},
|
|
87
130
|
token: "var(--ds-background-accent-red-subtler, #FFBDAD)" // source for hex code was legacy token R75,
|
|
88
131
|
}), _defineProperty(_editorBackgroundPale, '#FF8F73', {
|
|
89
|
-
|
|
132
|
+
getValue: function getValue(fallback) {
|
|
133
|
+
return getTokenValue('color.background.accent.red.subtle', fallback);
|
|
134
|
+
},
|
|
90
135
|
token: "var(--ds-background-accent-red-subtle, #FF8F73)" // source for hex code was legacy token R100,
|
|
91
136
|
}), _defineProperty(_editorBackgroundPale, '#EAE6FF', {
|
|
92
|
-
|
|
137
|
+
getValue: function getValue(fallback) {
|
|
138
|
+
return getTokenValue('color.background.accent.purple.subtlest', fallback);
|
|
139
|
+
},
|
|
93
140
|
token: "var(--ds-background-accent-purple-subtlest, #EAE6FF)" // source for hex code was legacy token P50,
|
|
94
141
|
}), _defineProperty(_editorBackgroundPale, '#C0B6F2', {
|
|
95
|
-
|
|
142
|
+
getValue: function getValue(fallback) {
|
|
143
|
+
return getTokenValue('color.background.accent.purple.subtler', fallback);
|
|
144
|
+
},
|
|
96
145
|
token: "var(--ds-background-accent-purple-subtler, #C0B6F2)" // source for hex code was legacy token P75,
|
|
97
146
|
}), _defineProperty(_editorBackgroundPale, '#998DD9', {
|
|
98
|
-
|
|
147
|
+
getValue: function getValue(fallback) {
|
|
148
|
+
return getTokenValue('color.background.accent.purple.subtle', fallback);
|
|
149
|
+
},
|
|
99
150
|
token: "var(--ds-background-accent-purple-subtle, #998DD9)" // source for hex code was legacy token P100,
|
|
100
151
|
}), _defineProperty(_editorBackgroundPale, '#FFFFFF', {
|
|
101
|
-
|
|
152
|
+
getValue: function getValue(fallback) {
|
|
153
|
+
return getTokenValue('elevation.surface', fallback);
|
|
154
|
+
},
|
|
102
155
|
token: "var(--ds-surface, #FFFFFF)" // source for hex code was legacy token N0,
|
|
103
156
|
}), _defineProperty(_editorBackgroundPale, '#F4F5F7', {
|
|
104
|
-
|
|
157
|
+
getValue: function getValue(fallback) {
|
|
158
|
+
return getTokenValue('color.background.accent.gray.subtlest', fallback);
|
|
159
|
+
},
|
|
105
160
|
token: "var(--ds-background-accent-gray-subtlest, #F4F5F7)" // source for hex code was legacy token N20,
|
|
106
161
|
}), _defineProperty(_editorBackgroundPale, '#B3BAC5', {
|
|
107
|
-
|
|
162
|
+
getValue: function getValue(fallback) {
|
|
163
|
+
return getTokenValue('color.background.accent.gray.subtle', fallback);
|
|
164
|
+
},
|
|
108
165
|
token: "var(--ds-background-accent-gray-subtle, #B3BAC5)" // source for hex code was legacy token N60,
|
|
109
|
-
}), _editorBackgroundPale);
|
|
110
|
-
var backgroundPaletteKeys = Object.keys(editorBackgroundPalette);
|
|
111
|
-
var tokenNames = backgroundPaletteKeys.map(function (hexCode) {
|
|
112
|
-
return editorBackgroundPalette[hexCode].tokenName;
|
|
113
|
-
});
|
|
166
|
+
}), _editorBackgroundPale);
|