@atlaskit/tokens 0.10.27 → 0.10.29

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/css/atlassian-dark.css +298 -2
  3. package/css/atlassian-legacy-dark.css +298 -2
  4. package/css/atlassian-legacy-light.css +298 -2
  5. package/css/atlassian-light.css +298 -2
  6. package/css/atlassian-spacing.css +3 -3
  7. package/dist/cjs/artifacts/palettes-raw/spacing-scale.js +3 -3
  8. package/dist/cjs/artifacts/rename-mapping/atlassian-spacing.js +1 -49
  9. package/dist/cjs/artifacts/tokens-raw/atlassian-spacing.js +26 -50
  10. package/dist/cjs/artifacts/typescript/atlassian-spacing-token-default-values.js +2 -2
  11. package/dist/cjs/constants.js +4 -13
  12. package/dist/cjs/entry-points/spacing-raw.js +15 -0
  13. package/dist/cjs/get-token.js +1 -1
  14. package/dist/cjs/index.js +8 -0
  15. package/dist/cjs/palettes/spacing-scale.js +1 -1
  16. package/dist/cjs/set-global-theme.js +30 -4
  17. package/dist/cjs/theme-change-observer.js +3 -2
  18. package/dist/cjs/theme-config.js +95 -0
  19. package/dist/cjs/tokens/default/spacing/spacing.js +12 -24
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/artifacts/palettes-raw/spacing-scale.js +3 -3
  22. package/dist/es2019/artifacts/rename-mapping/atlassian-spacing.js +1 -49
  23. package/dist/es2019/artifacts/tokens-raw/atlassian-spacing.js +26 -50
  24. package/dist/es2019/artifacts/typescript/atlassian-spacing-token-default-values.js +2 -2
  25. package/dist/es2019/artifacts/typescript/atlassian-spacing-types-internal.js +0 -6
  26. package/dist/es2019/artifacts/typescript/atlassian-spacing-types.js +0 -6
  27. package/dist/es2019/constants.js +2 -10
  28. package/dist/es2019/entry-points/spacing-raw.js +1 -0
  29. package/dist/es2019/get-token.js +1 -1
  30. package/dist/es2019/index.js +1 -0
  31. package/dist/es2019/palettes/spacing-scale.js +1 -1
  32. package/dist/es2019/set-global-theme.js +25 -5
  33. package/dist/es2019/theme-change-observer.js +5 -3
  34. package/dist/es2019/theme-config.js +87 -0
  35. package/dist/es2019/tokens/default/spacing/spacing.js +12 -24
  36. package/dist/es2019/version.json +1 -1
  37. package/dist/esm/artifacts/palettes-raw/spacing-scale.js +3 -3
  38. package/dist/esm/artifacts/rename-mapping/atlassian-spacing.js +1 -49
  39. package/dist/esm/artifacts/tokens-raw/atlassian-spacing.js +26 -50
  40. package/dist/esm/artifacts/typescript/atlassian-spacing-token-default-values.js +2 -2
  41. package/dist/esm/artifacts/typescript/atlassian-spacing-types-internal.js +0 -6
  42. package/dist/esm/artifacts/typescript/atlassian-spacing-types.js +0 -6
  43. package/dist/esm/constants.js +2 -10
  44. package/dist/esm/entry-points/spacing-raw.js +1 -0
  45. package/dist/esm/get-token.js +1 -1
  46. package/dist/esm/index.js +1 -0
  47. package/dist/esm/palettes/spacing-scale.js +1 -1
  48. package/dist/esm/set-global-theme.js +28 -5
  49. package/dist/esm/theme-change-observer.js +5 -3
  50. package/dist/esm/theme-config.js +87 -0
  51. package/dist/esm/tokens/default/spacing/spacing.js +12 -24
  52. package/dist/esm/version.json +1 -1
  53. package/dist/types/artifacts/palettes-raw/spacing-scale.d.ts +1 -1
  54. package/dist/types/artifacts/rename-mapping/atlassian-spacing.d.ts +1 -1
  55. package/dist/types/artifacts/token-default-values.d.ts +1 -1
  56. package/dist/types/artifacts/tokens-raw/atlassian-spacing.d.ts +26 -3
  57. package/dist/types/artifacts/typescript/atlassian-spacing-token-default-values.d.ts +2 -2
  58. package/dist/types/artifacts/typescript/atlassian-spacing-types-internal.d.ts +2 -2
  59. package/dist/types/artifacts/typescript/atlassian-spacing-types.d.ts +2 -2
  60. package/dist/types/constants.d.ts +1 -8
  61. package/dist/types/entry-points/spacing-raw.d.ts +1 -0
  62. package/dist/types/index.d.ts +2 -1
  63. package/dist/types/set-global-theme.d.ts +2 -2
  64. package/dist/types/theme-change-observer.d.ts +4 -3
  65. package/dist/types/theme-config.d.ts +53 -0
  66. package/dist/types/types.d.ts +0 -3
  67. package/dist/types-ts4.0/artifacts/palettes-raw/spacing-scale.d.ts +1 -1
  68. package/dist/types-ts4.0/artifacts/rename-mapping/atlassian-spacing.d.ts +1 -1
  69. package/dist/types-ts4.0/artifacts/token-default-values.d.ts +1 -1
  70. package/dist/types-ts4.0/artifacts/tokens-raw/atlassian-spacing.d.ts +26 -3
  71. package/dist/types-ts4.0/artifacts/typescript/atlassian-spacing-token-default-values.d.ts +2 -2
  72. package/dist/types-ts4.0/artifacts/typescript/atlassian-spacing-types-internal.d.ts +2 -2
  73. package/dist/types-ts4.0/artifacts/typescript/atlassian-spacing-types.d.ts +2 -2
  74. package/dist/types-ts4.0/constants.d.ts +1 -14
  75. package/dist/types-ts4.0/entry-points/spacing-raw.d.ts +1 -0
  76. package/dist/types-ts4.0/index.d.ts +2 -1
  77. package/dist/types-ts4.0/set-global-theme.d.ts +2 -2
  78. package/dist/types-ts4.0/theme-change-observer.d.ts +4 -3
  79. package/dist/types-ts4.0/theme-config.d.ts +53 -0
  80. package/dist/types-ts4.0/types.d.ts +0 -3
  81. package/package.json +3 -1
  82. package/report.api.md +51 -14
  83. package/spacing-raw/package.json +17 -0
  84. package/tmp/api-report-tmp.d.ts +36 -8
@@ -21,8 +21,7 @@ var spacing = {
21
21
  '0': {
22
22
  attributes: {
23
23
  group: 'spacing',
24
- state: 'experimental',
25
- replacement: '0',
24
+ state: 'active',
26
25
  introduced: '0.10.16',
27
26
  description: 'Equates to `0`. Can be used for resetting default spacing styles.'
28
27
  }
@@ -30,8 +29,7 @@ var spacing = {
30
29
  '025': {
31
30
  attributes: {
32
31
  group: 'spacing',
33
- state: 'experimental',
34
- replacement: '2px',
32
+ state: 'active',
35
33
  introduced: '0.10.16',
36
34
  description: 'Use for spacing in compact scenarios. The smallest value in our scale.'
37
35
  }
@@ -39,8 +37,7 @@ var spacing = {
39
37
  '050': {
40
38
  attributes: {
41
39
  group: 'spacing',
42
- state: 'experimental',
43
- replacement: '4px',
40
+ state: 'active',
44
41
  introduced: '0.10.16',
45
42
  description: 'Helpful guidance goes here'
46
43
  }
@@ -48,8 +45,7 @@ var spacing = {
48
45
  '075': {
49
46
  attributes: {
50
47
  group: 'spacing',
51
- state: 'experimental',
52
- replacement: '6px',
48
+ state: 'active',
53
49
  introduced: '0.10.16',
54
50
  description: 'Helpful guidance goes here'
55
51
  }
@@ -57,8 +53,7 @@ var spacing = {
57
53
  '100': {
58
54
  attributes: {
59
55
  group: 'spacing',
60
- state: 'experimental',
61
- replacement: '8px',
56
+ state: 'active',
62
57
  introduced: '0.10.16',
63
58
  description: 'Helpful guidance goes here'
64
59
  }
@@ -66,8 +61,7 @@ var spacing = {
66
61
  '150': {
67
62
  attributes: {
68
63
  group: 'spacing',
69
- state: 'experimental',
70
- replacement: '12px',
64
+ state: 'active',
71
65
  introduced: '0.10.16',
72
66
  description: 'Helpful guidance goes here'
73
67
  }
@@ -75,8 +69,7 @@ var spacing = {
75
69
  '200': {
76
70
  attributes: {
77
71
  group: 'spacing',
78
- state: 'experimental',
79
- replacement: '16px',
72
+ state: 'active',
80
73
  introduced: '0.10.16',
81
74
  description: 'Helpful guidance goes here'
82
75
  }
@@ -84,8 +77,7 @@ var spacing = {
84
77
  '250': {
85
78
  attributes: {
86
79
  group: 'spacing',
87
- state: 'experimental',
88
- replacement: '20px',
80
+ state: 'active',
89
81
  introduced: '0.10.16',
90
82
  description: 'Helpful guidance goes here'
91
83
  }
@@ -93,8 +85,7 @@ var spacing = {
93
85
  '300': {
94
86
  attributes: {
95
87
  group: 'spacing',
96
- state: 'experimental',
97
- replacement: '24px',
88
+ state: 'active',
98
89
  introduced: '0.10.16',
99
90
  description: 'Helpful guidance goes here'
100
91
  }
@@ -102,8 +93,7 @@ var spacing = {
102
93
  '400': {
103
94
  attributes: {
104
95
  group: 'spacing',
105
- state: 'experimental',
106
- replacement: '32px',
96
+ state: 'active',
107
97
  introduced: '0.10.16',
108
98
  description: 'Helpful guidance goes here'
109
99
  }
@@ -111,8 +101,7 @@ var spacing = {
111
101
  '500': {
112
102
  attributes: {
113
103
  group: 'spacing',
114
- state: 'experimental',
115
- replacement: '40px',
104
+ state: 'active',
116
105
  introduced: '0.10.16',
117
106
  description: 'Helpful guidance goes here'
118
107
  }
@@ -120,8 +109,7 @@ var spacing = {
120
109
  '600': {
121
110
  attributes: {
122
111
  group: 'spacing',
123
- state: 'experimental',
124
- replacement: '48px',
112
+ state: 'active',
125
113
  introduced: '0.10.16',
126
114
  description: 'Helpful guidance goes here'
127
115
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "0.10.27",
3
+ "version": "0.10.29",
4
4
  "sideEffects": [
5
5
  "**/*.css"
6
6
  ]
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::08ae35ae5d6bfe790b538db89c5876de>>
3
+ * @codegen <<SignedSource::9ec4d3766ad54f86aa1d9891b0f32317>>
4
4
  * @codegenCommand yarn build tokens
5
5
  */
6
6
  const tokens = [{
7
- "value": "0",
7
+ "value": "0px",
8
8
  "attributes": {
9
9
  "group": "scale"
10
10
  },
11
11
  "filePath": "src/palettes/spacing-scale.tsx",
12
12
  "isSource": true,
13
13
  "original": {
14
- "value": "0",
14
+ "value": "0px",
15
15
  "attributes": {
16
16
  "group": "scale"
17
17
  }
@@ -12,60 +12,12 @@
12
12
  * These changes will then be picked up by our tooling which will attempt to
13
13
  * migrate as many of these renames as possible.
14
14
  *
15
- * @codegen <<SignedSource::96a569b32686a2088f106c2ec4cd75d3>>
15
+ * @codegen <<SignedSource::a90d6d19262ac37cb4095da71ba3035c>>
16
16
  * @codegenCommand yarn build tokens
17
17
  */
18
18
  const renameMapper = [{
19
19
  "path": "spacing.container.gutter",
20
20
  "state": "experimental",
21
21
  "replacement": "8px"
22
- }, {
23
- "path": "spacing.scale.0",
24
- "state": "experimental",
25
- "replacement": "0"
26
- }, {
27
- "path": "spacing.scale.100",
28
- "state": "experimental",
29
- "replacement": "8px"
30
- }, {
31
- "path": "spacing.scale.150",
32
- "state": "experimental",
33
- "replacement": "12px"
34
- }, {
35
- "path": "spacing.scale.200",
36
- "state": "experimental",
37
- "replacement": "16px"
38
- }, {
39
- "path": "spacing.scale.250",
40
- "state": "experimental",
41
- "replacement": "20px"
42
- }, {
43
- "path": "spacing.scale.300",
44
- "state": "experimental",
45
- "replacement": "24px"
46
- }, {
47
- "path": "spacing.scale.400",
48
- "state": "experimental",
49
- "replacement": "32px"
50
- }, {
51
- "path": "spacing.scale.500",
52
- "state": "experimental",
53
- "replacement": "40px"
54
- }, {
55
- "path": "spacing.scale.600",
56
- "state": "experimental",
57
- "replacement": "48px"
58
- }, {
59
- "path": "spacing.scale.025",
60
- "state": "experimental",
61
- "replacement": "2px"
62
- }, {
63
- "path": "spacing.scale.050",
64
- "state": "experimental",
65
- "replacement": "4px"
66
- }, {
67
- "path": "spacing.scale.075",
68
- "state": "experimental",
69
- "replacement": "6px"
70
22
  }];
71
23
  export default renameMapper;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::fd4d0992b574a7a22bc1b95ebcdaafc8>>
3
+ * @codegen <<SignedSource::e19d1d58b2463145dd0eae095e3d0b36>>
4
4
  * @codegenCommand yarn build tokens
5
5
  */
6
6
  const tokens = [{
@@ -29,19 +29,17 @@ const tokens = [{
29
29
  }, {
30
30
  "attributes": {
31
31
  "group": "spacing",
32
- "state": "experimental",
33
- "replacement": "0",
32
+ "state": "active",
34
33
  "introduced": "0.10.16",
35
34
  "description": "Equates to `0`. Can be used for resetting default spacing styles."
36
35
  },
37
- "value": "0",
36
+ "value": "0px",
38
37
  "filePath": "src/tokens/atlassian-spacing/spacing.tsx",
39
38
  "isSource": true,
40
39
  "original": {
41
40
  "attributes": {
42
41
  "group": "spacing",
43
- "state": "experimental",
44
- "replacement": "0",
42
+ "state": "active",
45
43
  "introduced": "0.10.16",
46
44
  "description": "Equates to `0`. Can be used for resetting default spacing styles."
47
45
  },
@@ -52,8 +50,7 @@ const tokens = [{
52
50
  }, {
53
51
  "attributes": {
54
52
  "group": "spacing",
55
- "state": "experimental",
56
- "replacement": "8px",
53
+ "state": "active",
57
54
  "introduced": "0.10.16",
58
55
  "description": "Helpful guidance goes here"
59
56
  },
@@ -63,8 +60,7 @@ const tokens = [{
63
60
  "original": {
64
61
  "attributes": {
65
62
  "group": "spacing",
66
- "state": "experimental",
67
- "replacement": "8px",
63
+ "state": "active",
68
64
  "introduced": "0.10.16",
69
65
  "description": "Helpful guidance goes here"
70
66
  },
@@ -75,8 +71,7 @@ const tokens = [{
75
71
  }, {
76
72
  "attributes": {
77
73
  "group": "spacing",
78
- "state": "experimental",
79
- "replacement": "12px",
74
+ "state": "active",
80
75
  "introduced": "0.10.16",
81
76
  "description": "Helpful guidance goes here"
82
77
  },
@@ -86,8 +81,7 @@ const tokens = [{
86
81
  "original": {
87
82
  "attributes": {
88
83
  "group": "spacing",
89
- "state": "experimental",
90
- "replacement": "12px",
84
+ "state": "active",
91
85
  "introduced": "0.10.16",
92
86
  "description": "Helpful guidance goes here"
93
87
  },
@@ -98,8 +92,7 @@ const tokens = [{
98
92
  }, {
99
93
  "attributes": {
100
94
  "group": "spacing",
101
- "state": "experimental",
102
- "replacement": "16px",
95
+ "state": "active",
103
96
  "introduced": "0.10.16",
104
97
  "description": "Helpful guidance goes here"
105
98
  },
@@ -109,8 +102,7 @@ const tokens = [{
109
102
  "original": {
110
103
  "attributes": {
111
104
  "group": "spacing",
112
- "state": "experimental",
113
- "replacement": "16px",
105
+ "state": "active",
114
106
  "introduced": "0.10.16",
115
107
  "description": "Helpful guidance goes here"
116
108
  },
@@ -121,8 +113,7 @@ const tokens = [{
121
113
  }, {
122
114
  "attributes": {
123
115
  "group": "spacing",
124
- "state": "experimental",
125
- "replacement": "20px",
116
+ "state": "active",
126
117
  "introduced": "0.10.16",
127
118
  "description": "Helpful guidance goes here"
128
119
  },
@@ -132,8 +123,7 @@ const tokens = [{
132
123
  "original": {
133
124
  "attributes": {
134
125
  "group": "spacing",
135
- "state": "experimental",
136
- "replacement": "20px",
126
+ "state": "active",
137
127
  "introduced": "0.10.16",
138
128
  "description": "Helpful guidance goes here"
139
129
  },
@@ -144,8 +134,7 @@ const tokens = [{
144
134
  }, {
145
135
  "attributes": {
146
136
  "group": "spacing",
147
- "state": "experimental",
148
- "replacement": "24px",
137
+ "state": "active",
149
138
  "introduced": "0.10.16",
150
139
  "description": "Helpful guidance goes here"
151
140
  },
@@ -155,8 +144,7 @@ const tokens = [{
155
144
  "original": {
156
145
  "attributes": {
157
146
  "group": "spacing",
158
- "state": "experimental",
159
- "replacement": "24px",
147
+ "state": "active",
160
148
  "introduced": "0.10.16",
161
149
  "description": "Helpful guidance goes here"
162
150
  },
@@ -167,8 +155,7 @@ const tokens = [{
167
155
  }, {
168
156
  "attributes": {
169
157
  "group": "spacing",
170
- "state": "experimental",
171
- "replacement": "32px",
158
+ "state": "active",
172
159
  "introduced": "0.10.16",
173
160
  "description": "Helpful guidance goes here"
174
161
  },
@@ -178,8 +165,7 @@ const tokens = [{
178
165
  "original": {
179
166
  "attributes": {
180
167
  "group": "spacing",
181
- "state": "experimental",
182
- "replacement": "32px",
168
+ "state": "active",
183
169
  "introduced": "0.10.16",
184
170
  "description": "Helpful guidance goes here"
185
171
  },
@@ -190,8 +176,7 @@ const tokens = [{
190
176
  }, {
191
177
  "attributes": {
192
178
  "group": "spacing",
193
- "state": "experimental",
194
- "replacement": "40px",
179
+ "state": "active",
195
180
  "introduced": "0.10.16",
196
181
  "description": "Helpful guidance goes here"
197
182
  },
@@ -201,8 +186,7 @@ const tokens = [{
201
186
  "original": {
202
187
  "attributes": {
203
188
  "group": "spacing",
204
- "state": "experimental",
205
- "replacement": "40px",
189
+ "state": "active",
206
190
  "introduced": "0.10.16",
207
191
  "description": "Helpful guidance goes here"
208
192
  },
@@ -213,8 +197,7 @@ const tokens = [{
213
197
  }, {
214
198
  "attributes": {
215
199
  "group": "spacing",
216
- "state": "experimental",
217
- "replacement": "48px",
200
+ "state": "active",
218
201
  "introduced": "0.10.16",
219
202
  "description": "Helpful guidance goes here"
220
203
  },
@@ -224,8 +207,7 @@ const tokens = [{
224
207
  "original": {
225
208
  "attributes": {
226
209
  "group": "spacing",
227
- "state": "experimental",
228
- "replacement": "48px",
210
+ "state": "active",
229
211
  "introduced": "0.10.16",
230
212
  "description": "Helpful guidance goes here"
231
213
  },
@@ -236,8 +218,7 @@ const tokens = [{
236
218
  }, {
237
219
  "attributes": {
238
220
  "group": "spacing",
239
- "state": "experimental",
240
- "replacement": "2px",
221
+ "state": "active",
241
222
  "introduced": "0.10.16",
242
223
  "description": "Use for spacing in compact scenarios. The smallest value in our scale."
243
224
  },
@@ -247,8 +228,7 @@ const tokens = [{
247
228
  "original": {
248
229
  "attributes": {
249
230
  "group": "spacing",
250
- "state": "experimental",
251
- "replacement": "2px",
231
+ "state": "active",
252
232
  "introduced": "0.10.16",
253
233
  "description": "Use for spacing in compact scenarios. The smallest value in our scale."
254
234
  },
@@ -259,8 +239,7 @@ const tokens = [{
259
239
  }, {
260
240
  "attributes": {
261
241
  "group": "spacing",
262
- "state": "experimental",
263
- "replacement": "4px",
242
+ "state": "active",
264
243
  "introduced": "0.10.16",
265
244
  "description": "Helpful guidance goes here"
266
245
  },
@@ -270,8 +249,7 @@ const tokens = [{
270
249
  "original": {
271
250
  "attributes": {
272
251
  "group": "spacing",
273
- "state": "experimental",
274
- "replacement": "4px",
252
+ "state": "active",
275
253
  "introduced": "0.10.16",
276
254
  "description": "Helpful guidance goes here"
277
255
  },
@@ -282,8 +260,7 @@ const tokens = [{
282
260
  }, {
283
261
  "attributes": {
284
262
  "group": "spacing",
285
- "state": "experimental",
286
- "replacement": "6px",
263
+ "state": "active",
287
264
  "introduced": "0.10.16",
288
265
  "description": "Helpful guidance goes here"
289
266
  },
@@ -293,8 +270,7 @@ const tokens = [{
293
270
  "original": {
294
271
  "attributes": {
295
272
  "group": "spacing",
296
- "state": "experimental",
297
- "replacement": "6px",
273
+ "state": "active",
298
274
  "introduced": "0.10.16",
299
275
  "description": "Helpful guidance goes here"
300
276
  },
@@ -4,12 +4,12 @@
4
4
  * Token names mapped to their value in the default Atlassian themes ('light spacing').
5
5
  * These default values are used by the Babel plugin to optionally provide automatic fallbacks.
6
6
  *
7
- * @codegen <<SignedSource::c5f4991ca82e83d24ff38509c8df5121>>
7
+ * @codegen <<SignedSource::e575bc332dcc60d3fe9e378605bc9100>>
8
8
  * @codegenCommand yarn build tokens
9
9
  */
10
10
  const defaultTokenValues = {
11
11
  'spacing.container.gutter': '8px',
12
- 'spacing.scale.0': '0',
12
+ 'spacing.scale.0': '0px',
13
13
  'spacing.scale.100': '8px',
14
14
  'spacing.scale.150': '12px',
15
15
  'spacing.scale.200': '16px',
@@ -1,7 +1 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::09e6dd0e22e09011160890dfb93241da>>
4
- * @codegenCommand yarn build tokens
5
- */
6
- // No active tokens in this theme
7
1
  export {};
@@ -1,7 +1 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::09e6dd0e22e09011160890dfb93241da>>
4
- * @codegenCommand yarn build tokens
5
- */
6
- // No active tokens in this theme
7
1
  export {};
@@ -1,14 +1,6 @@
1
- export const THEMES = ['light', 'dark', 'legacy-light', 'legacy-dark', 'spacing'];
2
1
  export const THEME_DATA_ATTRIBUTE = 'data-theme';
2
+ export const COLOR_MODE_ATTRIBUTE = 'data-color-mode';
3
3
  export const DEFAULT_THEME = 'light spacing';
4
4
  export const CSS_PREFIX = 'ds';
5
- export const CSS_VAR_FULL = ['opacity']; // Maps the longer theme name to a shorthand used in css/code
6
-
7
- export const THEME_NAME_MAP = {
8
- 'atlassian-light': 'light',
9
- 'atlassian-dark': 'dark',
10
- 'atlassian-legacy-light': 'legacy-light',
11
- 'atlassian-legacy-dark': 'legacy-dark',
12
- 'atlassian-spacing': 'spacing'
13
- };
5
+ export const CSS_VAR_FULL = ['opacity'];
14
6
  export const TOKEN_NOT_FOUND_CSS_VAR = `--${CSS_PREFIX}-token-not-found`;
@@ -0,0 +1 @@
1
+ export { default } from '../artifacts/tokens-raw/atlassian-spacing';
@@ -2,7 +2,7 @@ import warnOnce from '@atlaskit/ds-lib/warn-once';
2
2
  import tokens from './artifacts/token-names';
3
3
  import { TOKEN_NOT_FOUND_CSS_VAR } from './constants';
4
4
  const name = "@atlaskit/tokens";
5
- const version = "0.10.27";
5
+ const version = "0.10.29";
6
6
 
7
7
  function token(path, fallback) {
8
8
  let token = tokens[path];
@@ -1,3 +1,4 @@
1
1
  export { default as token } from './get-token';
2
2
  export { default as setGlobalTheme } from './set-global-theme';
3
+ export { default as themeConfig } from './theme-config';
3
4
  export { useThemeObserver, ThemeMutationObserver } from './theme-change-observer';
@@ -2,7 +2,7 @@ const scale = {
2
2
  spacing: {
3
3
  scale: {
4
4
  Space0: {
5
- value: '0',
5
+ value: '0px',
6
6
  attributes: {
7
7
  group: 'scale'
8
8
  }
@@ -1,14 +1,34 @@
1
- import { THEMES } from './constants';
1
+ import { COLOR_MODE_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
2
+ import themeConfig from './theme-config';
3
+
4
+ const setGlobalTheme = (themeId, shouldMatchSystem = false) => {
5
+ const theme = Object.values(themeConfig).find(({
6
+ id
7
+ }) => id === themeId);
2
8
 
3
- const setGlobalTheme = theme => {
4
9
  if (process.env.NODE_ENV !== 'production') {
5
- if (!THEMES.includes(theme)) {
6
- throw new Error(`setGlobalTheme only accepts themes: ${THEMES.join(', ')}`);
10
+ if (!theme) {
11
+ const themeIds = Object.values(themeConfig).map(({
12
+ id
13
+ }) => id);
14
+ throw new Error(`setGlobalTheme only accepts themes: ${themeIds.join(', ')}`);
7
15
  }
8
16
  }
9
17
 
18
+ if (!theme) {
19
+ return;
20
+ }
21
+
10
22
  const element = document.documentElement;
11
- element.setAttribute('data-theme', theme);
23
+ element.setAttribute(THEME_DATA_ATTRIBUTE, theme.id);
24
+
25
+ if (theme.attributes.type === 'color') {
26
+ element.setAttribute(COLOR_MODE_ATTRIBUTE, theme.attributes.mode);
27
+ }
28
+
29
+ if (shouldMatchSystem) {
30
+ element.setAttribute(COLOR_MODE_ATTRIBUTE, 'auto');
31
+ }
12
32
  };
13
33
 
14
34
  export default setGlobalTheme;
@@ -1,8 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { useEffect, useState } from 'react';
3
- import { THEME_DATA_ATTRIBUTE } from './constants';
3
+ import { COLOR_MODE_ATTRIBUTE } from './constants';
4
4
 
5
- const getGlobalTheme = () => typeof document !== 'undefined' ? document.documentElement.getAttribute(THEME_DATA_ATTRIBUTE) : null;
5
+ const getGlobalTheme = () => typeof document !== 'undefined' ? document.documentElement.getAttribute(COLOR_MODE_ATTRIBUTE) : null;
6
6
  /**
7
7
  * A MutationObserver which watches the `<html>` element for changes to the theme.
8
8
  *
@@ -22,6 +22,8 @@ export class ThemeMutationObserver {
22
22
  constructor(callback) {
23
23
  _defineProperty(this, "observer", null);
24
24
 
25
+ _defineProperty(this, "mediaObserver", null);
26
+
25
27
  this.callback = callback;
26
28
  }
27
29
 
@@ -33,7 +35,7 @@ export class ThemeMutationObserver {
33
35
  }
34
36
 
35
37
  this.observer.observe(document.documentElement, {
36
- attributeFilter: [THEME_DATA_ATTRIBUTE]
38
+ attributeFilter: [COLOR_MODE_ATTRIBUTE]
37
39
  });
38
40
  }
39
41