@atlaskit/tokens 10.1.0 → 11.0.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 +17 -0
- package/codemods/css-to-design-tokens/lib/colors.tsx +6 -6
- package/codemods/css-to-design-tokens/lib/declaration.tsx +5 -5
- package/codemods/css-to-design-tokens/lib/meta.tsx +4 -4
- package/codemods/css-to-design-tokens/lib/tokens.tsx +1 -1
- package/codemods/css-to-design-tokens/transform.tsx +1 -1
- package/codemods/hypermod.config.tsx +7 -1
- package/codemods/remove-fallbacks-color/transform.tsx +1 -1
- package/codemods/theme-to-design-tokens/transform.tsx +5 -2
- package/codemods/theme-to-design-tokens/utils/ast-meta.tsx +1 -1
- package/codemods/theme-to-design-tokens/utils/ast.tsx +1 -1
- package/codemods/theme-to-design-tokens/utils/color.tsx +7 -5
- package/codemods/theme-to-design-tokens/utils/css-utils.tsx +1 -1
- package/codemods/theme-to-design-tokens/utils/fuzzy-search.tsx +6 -1
- package/codemods/theme-to-design-tokens/utils/legacy-colors.tsx +2 -2
- package/codemods/theme-to-design-tokens/utils/named-colors.tsx +1 -1
- package/codemods/theme-to-design-tokens/utils/string-utils.tsx +1 -1
- package/codemods/utils/tokens.tsx +2 -2
- package/dist/cjs/artifacts/theme-import-map.js +1 -13
- package/dist/cjs/babel-plugin/plugin.js +3 -7
- package/dist/cjs/entry-points/tokens-raw.js +0 -7
- package/dist/cjs/theme-config.js +1 -19
- package/dist/cjs/theme-state-transformer.js +4 -4
- package/dist/es2019/artifacts/theme-import-map.js +1 -5
- package/dist/es2019/babel-plugin/plugin.js +4 -7
- package/dist/es2019/entry-points/tokens-raw.js +0 -1
- package/dist/es2019/theme-config.js +1 -19
- package/dist/es2019/theme-state-transformer.js +4 -4
- package/dist/esm/artifacts/theme-import-map.js +1 -9
- package/dist/esm/babel-plugin/plugin.js +3 -7
- package/dist/esm/entry-points/tokens-raw.js +0 -1
- package/dist/esm/theme-config.js +1 -19
- package/dist/esm/theme-state-transformer.js +4 -4
- package/dist/types/artifacts/theme-import-map.d.ts +1 -1
- package/dist/types/babel-plugin/plugin.d.ts +1 -1
- package/dist/types/constants.d.ts +2 -2
- package/dist/types/entry-points/tokens-raw.d.ts +0 -1
- package/dist/types/theme-config.d.ts +16 -6
- package/dist/types/theme-state-transformer.d.ts +4 -4
- package/dist/types/utils/color-mode-listeners.d.ts +1 -1
- package/dist/types/utils/contrast-mode-listeners.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/theme-import-map.d.ts +1 -1
- package/dist/types-ts4.5/babel-plugin/plugin.d.ts +1 -1
- package/dist/types-ts4.5/constants.d.ts +2 -2
- package/dist/types-ts4.5/entry-points/tokens-raw.d.ts +0 -1
- package/dist/types-ts4.5/theme-config.d.ts +13 -17
- package/dist/types-ts4.5/theme-state-transformer.d.ts +4 -4
- package/dist/types-ts4.5/utils/color-mode-listeners.d.ts +1 -1
- package/dist/types-ts4.5/utils/contrast-mode-listeners.d.ts +1 -1
- package/offerings.json +16 -4
- package/package.json +8 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/tokens
|
|
2
2
|
|
|
3
|
+
## 11.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5db9e3f21a52f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5db9e3f21a52f) -
|
|
8
|
+
Internal refactoring
|
|
9
|
+
|
|
10
|
+
## 11.0.0
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- [`2abd451d54eb2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2abd451d54eb2) -
|
|
15
|
+
Removes atlassian-legacy-light/dark color themes from the tokens package. These themes are unused
|
|
16
|
+
and non-functional in terms of color contrast. As a result some primitive components may recieve
|
|
17
|
+
modern fallback color values in some scenarios, however these are inline with the latest token
|
|
18
|
+
themes.
|
|
19
|
+
|
|
3
20
|
## 10.1.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -48,22 +48,22 @@ const REGEXES = {
|
|
|
48
48
|
/^\s*(#([0-9a-f]{3}){1,2}|(rgba|hsla)\(\s*\d{1,3}%?\s*(,\s*\d{1,3}%?\s*){2},\s*-?\d*\.?\d+\s*\)|(rgb|hsl)\(\s*\d{1,3}%?\s*(,\s*\d{1,3}%?\s*){2}\)\s*|(lab|lch)\(\s*\d{1,3}%?\s+\d{1,3}%?\s+\d{1,3}%?\s*\)|hwb\(\s*\d{1,3}\s+\d{1,3}%?\s+\d{1,3}%?\s*\))\s*$/i,
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
export function isKnownCssVariable(value: string) {
|
|
51
|
+
export function isKnownCssVariable(value: string): boolean {
|
|
52
52
|
return value in knownVariables;
|
|
53
53
|
}
|
|
54
|
-
export function isRawColor(value: string) {
|
|
54
|
+
export function isRawColor(value: string): boolean {
|
|
55
55
|
return REGEXES.RAW_COLOR.test(value);
|
|
56
56
|
}
|
|
57
|
-
export function isNamedColor(value: string) {
|
|
57
|
+
export function isNamedColor(value: string): boolean {
|
|
58
58
|
return NAMED_COLORS.includes(value);
|
|
59
59
|
}
|
|
60
|
-
export function isGradient(value: string) {
|
|
60
|
+
export function isGradient(value: string): boolean {
|
|
61
61
|
return GRADIENT_TYPES.some((gradient) => value.startsWith(`${gradient}-gradient(`));
|
|
62
62
|
}
|
|
63
|
-
export function extractBetweenParentheses(value: string) {
|
|
63
|
+
export function extractBetweenParentheses(value: string): string {
|
|
64
64
|
const match = value.match(/\((.*?)\)/);
|
|
65
65
|
return match ? match[1] : '';
|
|
66
66
|
}
|
|
67
|
-
export function isLessFunction(value: string) {
|
|
67
|
+
export function isLessFunction(value: string): boolean {
|
|
68
68
|
return LESS_COLOR_FUNCTIONS.some((func) => value.startsWith(`${func}(`));
|
|
69
69
|
}
|
|
@@ -21,23 +21,23 @@ const COLOR_PROPERTIES = [
|
|
|
21
21
|
'text-stroke',
|
|
22
22
|
] as const;
|
|
23
23
|
|
|
24
|
-
export function isColorRelatedProperty(prop: string) {
|
|
24
|
+
export function isColorRelatedProperty(prop: string): boolean {
|
|
25
25
|
return COLOR_PROPERTIES.some((property) => property === prop);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function isCssDeclaration(prop: string) {
|
|
28
|
+
export function isCssDeclaration(prop: string): boolean {
|
|
29
29
|
return prop.startsWith('--');
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function extractCssVarName(prop: string) {
|
|
32
|
+
export function extractCssVarName(prop: string): string {
|
|
33
33
|
return prop.substring(prop.indexOf('(') + 1).split(/\,|\)/)[0];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export function extractLessVarName(prop: string) {
|
|
36
|
+
export function extractLessVarName(prop: string): string {
|
|
37
37
|
return prop.substring(1);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export function splitCssValue(value: string) {
|
|
40
|
+
export function splitCssValue(value: string): RegExpMatchArray | null {
|
|
41
41
|
const regex = /(?:[^\s()]+|\((?:[^()]+|\([^()]*\))*\))+/g;
|
|
42
42
|
return value.match(regex);
|
|
43
43
|
}
|
|
@@ -65,7 +65,7 @@ const ADDITIONAL_META: Record<string, string> = {
|
|
|
65
65
|
red: 'danger',
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
export function cleanMeta(meta: string[]) {
|
|
68
|
+
export function cleanMeta(meta: string[]): string[] {
|
|
69
69
|
const cleanMeta = meta
|
|
70
70
|
.reduce(
|
|
71
71
|
(accum: string[], val: string) => [
|
|
@@ -141,7 +141,7 @@ function getParentSelectors(node: Node): string {
|
|
|
141
141
|
return '';
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
export function getCssVarMeta(cssVariable: string) {
|
|
144
|
+
export function getCssVarMeta(cssVariable: string): string[] {
|
|
145
145
|
const tokenName = extractCssVarName(cssVariable);
|
|
146
146
|
const meta = knownVariables[tokenName];
|
|
147
147
|
|
|
@@ -152,7 +152,7 @@ export function getCssVarMeta(cssVariable: string) {
|
|
|
152
152
|
return meta;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
export function getRawColorMeta(rawColor: string) {
|
|
155
|
+
export function getRawColorMeta(rawColor: string): string[] {
|
|
156
156
|
let cleanColor = rawColor.toLowerCase();
|
|
157
157
|
|
|
158
158
|
if (cleanColor.length === 4) {
|
|
@@ -162,6 +162,6 @@ export function getRawColorMeta(rawColor: string) {
|
|
|
162
162
|
return knownRawColors[cleanColor] ?? [];
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
export function getNamedColorMeta(namedColor: string) {
|
|
165
|
+
export function getNamedColorMeta(namedColor: string): string[] {
|
|
166
166
|
return knownNamedColors[namedColor] ?? [];
|
|
167
167
|
}
|
|
@@ -31,7 +31,7 @@ function tokenToVar(token: string) {
|
|
|
31
31
|
return `--ds-${token.replace(/\./g, '-').replace('color-', '').replace('elevation-', '')}`;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export default function findToken(meta: string[]) {
|
|
34
|
+
export default function findToken(meta: string[]): string {
|
|
35
35
|
const filteredTokens = filterTokens(meta);
|
|
36
36
|
const tokenFuzzySearch = Search(filteredTokens, false);
|
|
37
37
|
const cleanSearchTerms = cleanMeta(meta).join(' ');
|
|
@@ -87,7 +87,7 @@ const plugin = (): Plugin => {
|
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
export default async function transformer(file: FileInfo | string) {
|
|
90
|
+
export default async function transformer(file: FileInfo | string): Promise<string> {
|
|
91
91
|
const processor = postcss([plugin()]);
|
|
92
92
|
const src = typeof file === 'string' ? file : file.source;
|
|
93
93
|
const { css } = await processor.process(src, POSTCSS_OPTIONS);
|
|
@@ -2,7 +2,13 @@ import cssToDesignTokens from './css-to-design-tokens/transform';
|
|
|
2
2
|
import removeFallbacksColor from './remove-fallbacks-color/transform';
|
|
3
3
|
import themeToDesignTokens from './theme-to-design-tokens/transform';
|
|
4
4
|
|
|
5
|
-
const config
|
|
5
|
+
const config: {
|
|
6
|
+
presets: {
|
|
7
|
+
'theme-to-design-tokens': typeof themeToDesignTokens;
|
|
8
|
+
'css-to-design-tokens': typeof cssToDesignTokens;
|
|
9
|
+
'remove-fallbacks-color': typeof removeFallbacksColor;
|
|
10
|
+
};
|
|
11
|
+
} = {
|
|
6
12
|
presets: {
|
|
7
13
|
'theme-to-design-tokens': themeToDesignTokens,
|
|
8
14
|
'css-to-design-tokens': cssToDesignTokens,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hasImportDeclaration } from '@hypermod/utils';
|
|
2
2
|
import type { API, FileInfo } from 'jscodeshift';
|
|
3
3
|
|
|
4
|
-
export default async function transformer(file: FileInfo, api: API) {
|
|
4
|
+
export default async function transformer(file: FileInfo, api: API): Promise<string> {
|
|
5
5
|
const j = api.jscodeshift;
|
|
6
6
|
const source = j(file.source);
|
|
7
7
|
|
|
@@ -239,8 +239,11 @@ function parseCSSPropertyName(cssString: string) {
|
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
export default async function transformer(
|
|
243
|
+
file: FileInfo,
|
|
244
|
+
api: API,
|
|
245
|
+
_debug = false,
|
|
246
|
+
): Promise<string> {
|
|
244
247
|
const j = api.jscodeshift;
|
|
245
248
|
const source = j(file.source);
|
|
246
249
|
let transformed = false;
|
|
@@ -26,7 +26,7 @@ export function isParentOfToken(j: JSCodeshift, path: any): boolean {
|
|
|
26
26
|
return j(path).find(j.CallExpression, { callee: { name: 'token' } }).length > 0;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export function getClosestDecendantOfType(j: JSCodeshift, path: ASTPath<any>, type: any) {
|
|
29
|
+
export function getClosestDecendantOfType(j: JSCodeshift, path: ASTPath<any>, type: any): any {
|
|
30
30
|
if (!isDecendantOfType(j, path, type)) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { legacyColorMixins, legacyColors } from './legacy-colors';
|
|
2
2
|
import { namedColors } from './named-colors';
|
|
3
3
|
|
|
4
|
-
export const isLegacyColor
|
|
4
|
+
export const isLegacyColor: (value: string) => boolean = (value: string) =>
|
|
5
|
+
legacyColors.includes(value);
|
|
5
6
|
|
|
6
|
-
export const isLegacyNamedColor
|
|
7
|
+
export const isLegacyNamedColor: (value: string) => boolean = (value: string) =>
|
|
8
|
+
legacyColorMixins.includes(value);
|
|
7
9
|
|
|
8
10
|
const colorRegexp =
|
|
9
11
|
/#(?:[a-f0-9]{3}|[a-f0-9]{6}|[a-f0-9]{8})\b|(?:rgb|rgba|hsl|hsla|lch|lab|color)\([^\)]*\)/;
|
|
10
12
|
|
|
11
|
-
export const includesHardCodedColor = (raw: string) => {
|
|
13
|
+
export const includesHardCodedColor: (raw: string) => boolean = (raw: string) => {
|
|
12
14
|
const value = raw.toLowerCase();
|
|
13
15
|
if (colorRegexp.exec(value)) {
|
|
14
16
|
return true;
|
|
@@ -23,7 +25,7 @@ export const includesHardCodedColor = (raw: string) => {
|
|
|
23
25
|
return false;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
export const isHardCodedColor = (raw: string) => {
|
|
28
|
+
export const isHardCodedColor: (raw: string) => boolean = (raw: string) => {
|
|
27
29
|
const value = raw.toLowerCase();
|
|
28
30
|
|
|
29
31
|
if (namedColors.includes(value)) {
|
|
@@ -38,7 +40,7 @@ export const isHardCodedColor = (raw: string) => {
|
|
|
38
40
|
return false;
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
export function isBoldColor(color: string) {
|
|
43
|
+
export function isBoldColor(color: string): boolean {
|
|
42
44
|
const number = parseInt(color.replace(/^./, ''), 10);
|
|
43
45
|
return number > 300;
|
|
44
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isColorRelatedProperty } from '../../css-to-design-tokens/lib/declaration';
|
|
2
2
|
|
|
3
|
-
export function containsReplaceableCSSDeclarations(input: string) {
|
|
3
|
+
export function containsReplaceableCSSDeclarations(input: string): boolean {
|
|
4
4
|
const cssPattern = /(\S+)\s*:/g;
|
|
5
5
|
|
|
6
6
|
let match;
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Fuzzy search ripped from the internet.
|
|
5
5
|
*/
|
|
6
|
-
const FuzzySet
|
|
6
|
+
const FuzzySet: (
|
|
7
|
+
arr?: string[],
|
|
8
|
+
useLevenshtein?: boolean,
|
|
9
|
+
gramSizeLower?: number,
|
|
10
|
+
gramSizeUpper?: number,
|
|
11
|
+
) => any = function (
|
|
7
12
|
arr: string[] = [],
|
|
8
13
|
useLevenshtein?: boolean,
|
|
9
14
|
gramSizeLower: number = 2,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const legacyColors = [
|
|
1
|
+
export const legacyColors: string[] = [
|
|
2
2
|
'R50',
|
|
3
3
|
'R75',
|
|
4
4
|
'R100',
|
|
@@ -115,7 +115,7 @@ export const legacyColors = [
|
|
|
115
115
|
'DN10A',
|
|
116
116
|
];
|
|
117
117
|
|
|
118
|
-
export const legacyColorMixins = [
|
|
118
|
+
export const legacyColorMixins: string[] = [
|
|
119
119
|
'background',
|
|
120
120
|
'backgroundActive',
|
|
121
121
|
'backgroundHover',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const kebabize = (str: string) =>
|
|
1
|
+
export const kebabize: (str: string) => string = (str: string) =>
|
|
2
2
|
str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
|
|
3
3
|
|
|
4
4
|
export function findFirstNonspaceIndexAfter(text: string, index: number): number {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const activeTokens = [
|
|
1
|
+
export const activeTokens: string[] = [
|
|
2
2
|
'color.text',
|
|
3
3
|
'color.text.accent.lime',
|
|
4
4
|
'color.text.accent.lime.bolder',
|
|
@@ -283,7 +283,7 @@ export const activeTokens = [
|
|
|
283
283
|
'utility.elevation.surface.current',
|
|
284
284
|
];
|
|
285
285
|
|
|
286
|
-
export const uniqueWordsFromTokens = [
|
|
286
|
+
export const uniqueWordsFromTokens: string[] = [
|
|
287
287
|
'color',
|
|
288
288
|
'text',
|
|
289
289
|
'accent',
|
|
@@ -15,7 +15,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
15
15
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
16
16
|
* When a new theme is created, the import should automatically be added to the map
|
|
17
17
|
*
|
|
18
|
-
* @codegen <<SignedSource::
|
|
18
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
19
19
|
* @codegenCommand yarn build tokens
|
|
20
20
|
*/
|
|
21
21
|
|
|
@@ -56,18 +56,6 @@ var themeImportsMap = {
|
|
|
56
56
|
'./themes/atlassian-dark-increased-contrast'));
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
|
-
'legacy-light': function legacyLight() {
|
|
60
|
-
return Promise.resolve().then(function () {
|
|
61
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-light" */
|
|
62
|
-
'./themes/atlassian-legacy-light'));
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
'legacy-dark': function legacyDark() {
|
|
66
|
-
return Promise.resolve().then(function () {
|
|
67
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-dark" */
|
|
68
|
-
'./themes/atlassian-legacy-dark'));
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
59
|
'spacing': function spacing() {
|
|
72
60
|
return Promise.resolve().then(function () {
|
|
73
61
|
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_atlassian-spacing" */
|
|
@@ -10,7 +10,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var t = _interopRequireWildcard(require("@babel/types"));
|
|
12
12
|
var _tokenNames = _interopRequireDefault(require("../artifacts/token-names"));
|
|
13
|
-
var _atlassianLegacyLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-legacy-light"));
|
|
14
13
|
var _atlassianLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-light"));
|
|
15
14
|
var _atlassianShape = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-shape"));
|
|
16
15
|
var _atlassianSpacing = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-spacing"));
|
|
@@ -125,7 +124,7 @@ function plugin() {
|
|
|
125
124
|
// if no fallback is set, optionally find one from the default theme
|
|
126
125
|
if (path.node.arguments.length < 2) {
|
|
127
126
|
if (state.opts.shouldUseAutoFallback !== false) {
|
|
128
|
-
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName
|
|
127
|
+
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName), ")"));
|
|
129
128
|
} else {
|
|
130
129
|
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ")"));
|
|
131
130
|
}
|
|
@@ -136,7 +135,7 @@ function plugin() {
|
|
|
136
135
|
var forceAutoFallbackExemptions = ['radius'].concat((0, _toConsumableArray2.default)(state.opts.forceAutoFallbackExemptions || []));
|
|
137
136
|
|
|
138
137
|
// Handle fallbacks
|
|
139
|
-
var fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName
|
|
138
|
+
var fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName)) : path.node.arguments[1];
|
|
140
139
|
if (t.isStringLiteral(fallback)) {
|
|
141
140
|
// String literals can be concatenated into css variable call
|
|
142
141
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
|
@@ -194,12 +193,10 @@ function plugin() {
|
|
|
194
193
|
};
|
|
195
194
|
}
|
|
196
195
|
var lightValues = getThemeValues(_atlassianLight.default);
|
|
197
|
-
var legacyLightValues = getThemeValues(_atlassianLegacyLight.default);
|
|
198
196
|
var shapeValues = getThemeValues(_atlassianShape.default);
|
|
199
197
|
var spacingValues = getThemeValues(_atlassianSpacing.default);
|
|
200
198
|
var typographyValues = getThemeValues(_atlassianTypography.default);
|
|
201
199
|
function getDefaultFallback(tokenName) {
|
|
202
|
-
var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'light';
|
|
203
200
|
if (shapeValues[tokenName]) {
|
|
204
201
|
return shapeValues[tokenName];
|
|
205
202
|
}
|
|
@@ -209,8 +206,7 @@ function getDefaultFallback(tokenName) {
|
|
|
209
206
|
if (typographyValues[tokenName]) {
|
|
210
207
|
return typographyValues[tokenName];
|
|
211
208
|
}
|
|
212
|
-
|
|
213
|
-
return colorValues[tokenName];
|
|
209
|
+
return lightValues[tokenName];
|
|
214
210
|
}
|
|
215
211
|
function getNonAliasedImportName(node) {
|
|
216
212
|
if (t.isIdentifier(node.imported)) {
|
|
@@ -10,12 +10,6 @@ Object.defineProperty(exports, "dark", {
|
|
|
10
10
|
return _atlassianDark.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "legacyLightTokens", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _atlassianLegacyLight.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
13
|
Object.defineProperty(exports, "light", {
|
|
20
14
|
enumerable: true,
|
|
21
15
|
get: function get() {
|
|
@@ -41,7 +35,6 @@ Object.defineProperty(exports, "typography", {
|
|
|
41
35
|
}
|
|
42
36
|
});
|
|
43
37
|
var _atlassianLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-light"));
|
|
44
|
-
var _atlassianLegacyLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-legacy-light"));
|
|
45
38
|
var _atlassianDark = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-dark"));
|
|
46
39
|
var _atlassianSpacing = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-spacing"));
|
|
47
40
|
var _atlassianTypography = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-typography"));
|
package/dist/cjs/theme-config.js
CHANGED
|
@@ -45,7 +45,7 @@ var themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
|
45
45
|
*
|
|
46
46
|
* These ids must be kebab case
|
|
47
47
|
*/
|
|
48
|
-
var themeIds = exports.themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', '
|
|
48
|
+
var themeIds = exports.themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'spacing', 'shape', 'typography'];
|
|
49
49
|
/**
|
|
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.
|
|
@@ -131,24 +131,6 @@ var themeConfig = {
|
|
|
131
131
|
extends: 'dark',
|
|
132
132
|
increasesContrastFor: 'dark'
|
|
133
133
|
},
|
|
134
|
-
'atlassian-legacy-light': {
|
|
135
|
-
id: 'legacy-light',
|
|
136
|
-
displayName: 'Light Theme (legacy)',
|
|
137
|
-
palette: 'legacyPalette',
|
|
138
|
-
attributes: {
|
|
139
|
-
type: 'color',
|
|
140
|
-
mode: 'light'
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
'atlassian-legacy-dark': {
|
|
144
|
-
id: 'legacy-dark',
|
|
145
|
-
displayName: 'Dark Theme (legacy)',
|
|
146
|
-
palette: 'legacyPalette',
|
|
147
|
-
attributes: {
|
|
148
|
-
type: 'color',
|
|
149
|
-
mode: 'dark'
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
134
|
'atlassian-spacing': {
|
|
153
135
|
id: 'spacing',
|
|
154
136
|
displayName: 'Atlassian Spacing',
|
|
@@ -31,8 +31,8 @@ var isColorMode = function isColorMode(modeId) {
|
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```
|
|
34
|
-
* themeStringToObject('dark:dark light:
|
|
35
|
-
* // returns { dark: 'dark', light: '
|
|
34
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
35
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
var themeStringToObject = exports.themeStringToObject = function themeStringToObject(themeState) {
|
|
@@ -69,8 +69,8 @@ var themeStringToObject = exports.themeStringToObject = function themeStringToOb
|
|
|
69
69
|
*
|
|
70
70
|
* @example
|
|
71
71
|
* ```
|
|
72
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
73
|
-
* // returns 'dark:dark light:
|
|
72
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
73
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
76
|
var themeObjectToString = exports.themeObjectToString = function themeObjectToString(themeState) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
7
7
|
* When a new theme is created, the import should automatically be added to the map
|
|
8
8
|
*
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -23,10 +23,6 @@ const themeImportsMap = {
|
|
|
23
23
|
'./themes/atlassian-dark-future'),
|
|
24
24
|
'dark-increased-contrast': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-dark-increased-contrast" */
|
|
25
25
|
'./themes/atlassian-dark-increased-contrast'),
|
|
26
|
-
'legacy-light': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-light" */
|
|
27
|
-
'./themes/atlassian-legacy-light'),
|
|
28
|
-
'legacy-dark': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-dark" */
|
|
29
|
-
'./themes/atlassian-legacy-dark'),
|
|
30
26
|
'spacing': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-spacing" */
|
|
31
27
|
'./themes/atlassian-spacing'),
|
|
32
28
|
'typography': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-typography" */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
2
|
import tokenNames from '../artifacts/token-names';
|
|
3
|
-
import legacyLight from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
4
3
|
import light from '../artifacts/tokens-raw/atlassian-light';
|
|
5
4
|
import shape from '../artifacts/tokens-raw/atlassian-shape';
|
|
6
5
|
import spacing from '../artifacts/tokens-raw/atlassian-spacing';
|
|
@@ -102,7 +101,7 @@ export default function plugin() {
|
|
|
102
101
|
// if no fallback is set, optionally find one from the default theme
|
|
103
102
|
if (path.node.arguments.length < 2) {
|
|
104
103
|
if (state.opts.shouldUseAutoFallback !== false) {
|
|
105
|
-
replacementNode = t.stringLiteral(`var(${cssTokenValue}, ${getDefaultFallback(tokenName
|
|
104
|
+
replacementNode = t.stringLiteral(`var(${cssTokenValue}, ${getDefaultFallback(tokenName)})`);
|
|
106
105
|
} else {
|
|
107
106
|
replacementNode = t.stringLiteral(`var(${cssTokenValue})`);
|
|
108
107
|
}
|
|
@@ -113,7 +112,7 @@ export default function plugin() {
|
|
|
113
112
|
const forceAutoFallbackExemptions = ['radius', ...(state.opts.forceAutoFallbackExemptions || [])];
|
|
114
113
|
|
|
115
114
|
// Handle fallbacks
|
|
116
|
-
const fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName
|
|
115
|
+
const fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName)) : path.node.arguments[1];
|
|
117
116
|
if (t.isStringLiteral(fallback)) {
|
|
118
117
|
// String literals can be concatenated into css variable call
|
|
119
118
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
|
@@ -171,11 +170,10 @@ export default function plugin() {
|
|
|
171
170
|
};
|
|
172
171
|
}
|
|
173
172
|
const lightValues = getThemeValues(light);
|
|
174
|
-
const legacyLightValues = getThemeValues(legacyLight);
|
|
175
173
|
const shapeValues = getThemeValues(shape);
|
|
176
174
|
const spacingValues = getThemeValues(spacing);
|
|
177
175
|
const typographyValues = getThemeValues(typography);
|
|
178
|
-
function getDefaultFallback(tokenName
|
|
176
|
+
function getDefaultFallback(tokenName) {
|
|
179
177
|
if (shapeValues[tokenName]) {
|
|
180
178
|
return shapeValues[tokenName];
|
|
181
179
|
}
|
|
@@ -185,8 +183,7 @@ function getDefaultFallback(tokenName, theme = 'light') {
|
|
|
185
183
|
if (typographyValues[tokenName]) {
|
|
186
184
|
return typographyValues[tokenName];
|
|
187
185
|
}
|
|
188
|
-
|
|
189
|
-
return colorValues[tokenName];
|
|
186
|
+
return lightValues[tokenName];
|
|
190
187
|
}
|
|
191
188
|
function getNonAliasedImportName(node) {
|
|
192
189
|
if (t.isIdentifier(node.imported)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as light } from '../artifacts/tokens-raw/atlassian-light';
|
|
2
|
-
export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
3
2
|
export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
|
|
4
3
|
export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
|
|
5
4
|
export { default as typography } from '../artifacts/tokens-raw/atlassian-typography';
|
|
@@ -40,7 +40,7 @@ const themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
|
40
40
|
*
|
|
41
41
|
* These ids must be kebab case
|
|
42
42
|
*/
|
|
43
|
-
export const themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', '
|
|
43
|
+
export const themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'spacing', 'shape', 'typography'];
|
|
44
44
|
/**
|
|
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.
|
|
@@ -126,24 +126,6 @@ const themeConfig = {
|
|
|
126
126
|
extends: 'dark',
|
|
127
127
|
increasesContrastFor: 'dark'
|
|
128
128
|
},
|
|
129
|
-
'atlassian-legacy-light': {
|
|
130
|
-
id: 'legacy-light',
|
|
131
|
-
displayName: 'Light Theme (legacy)',
|
|
132
|
-
palette: 'legacyPalette',
|
|
133
|
-
attributes: {
|
|
134
|
-
type: 'color',
|
|
135
|
-
mode: 'light'
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
'atlassian-legacy-dark': {
|
|
139
|
-
id: 'legacy-dark',
|
|
140
|
-
displayName: 'Dark Theme (legacy)',
|
|
141
|
-
palette: 'legacyPalette',
|
|
142
|
-
attributes: {
|
|
143
|
-
type: 'color',
|
|
144
|
-
mode: 'dark'
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
129
|
'atlassian-spacing': {
|
|
148
130
|
id: 'spacing',
|
|
149
131
|
displayName: 'Atlassian Spacing',
|
|
@@ -18,8 +18,8 @@ const isColorMode = modeId => {
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```
|
|
21
|
-
* themeStringToObject('dark:dark light:
|
|
22
|
-
* // returns { dark: 'dark', light: '
|
|
21
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
22
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export const themeStringToObject = themeState => {
|
|
@@ -51,8 +51,8 @@ export const themeStringToObject = themeState => {
|
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* ```
|
|
54
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
55
|
-
* // returns 'dark:dark light:
|
|
54
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
55
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
export const themeObjectToString = themeState => Object.entries(themeState).reduce((themeString, [kind, id]) => {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
7
7
|
* When a new theme is created, the import should automatically be added to the map
|
|
8
8
|
*
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -35,14 +35,6 @@ var themeImportsMap = {
|
|
|
35
35
|
return import( /* webpackChunkName: "@atlaskit-internal_atlassian-dark-increased-contrast" */
|
|
36
36
|
'./themes/atlassian-dark-increased-contrast');
|
|
37
37
|
},
|
|
38
|
-
'legacy-light': function legacyLight() {
|
|
39
|
-
return import( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-light" */
|
|
40
|
-
'./themes/atlassian-legacy-light');
|
|
41
|
-
},
|
|
42
|
-
'legacy-dark': function legacyDark() {
|
|
43
|
-
return import( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-dark" */
|
|
44
|
-
'./themes/atlassian-legacy-dark');
|
|
45
|
-
},
|
|
46
38
|
'spacing': function spacing() {
|
|
47
39
|
return import( /* webpackChunkName: "@atlaskit-internal_atlassian-spacing" */
|
|
48
40
|
'./themes/atlassian-spacing');
|
|
@@ -7,7 +7,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
7
7
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
8
|
import * as t from '@babel/types';
|
|
9
9
|
import tokenNames from '../artifacts/token-names';
|
|
10
|
-
import legacyLight from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
11
10
|
import light from '../artifacts/tokens-raw/atlassian-light';
|
|
12
11
|
import shape from '../artifacts/tokens-raw/atlassian-shape';
|
|
13
12
|
import spacing from '../artifacts/tokens-raw/atlassian-spacing';
|
|
@@ -116,7 +115,7 @@ export default function plugin() {
|
|
|
116
115
|
// if no fallback is set, optionally find one from the default theme
|
|
117
116
|
if (path.node.arguments.length < 2) {
|
|
118
117
|
if (state.opts.shouldUseAutoFallback !== false) {
|
|
119
|
-
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName
|
|
118
|
+
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName), ")"));
|
|
120
119
|
} else {
|
|
121
120
|
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ")"));
|
|
122
121
|
}
|
|
@@ -127,7 +126,7 @@ export default function plugin() {
|
|
|
127
126
|
var forceAutoFallbackExemptions = ['radius'].concat(_toConsumableArray(state.opts.forceAutoFallbackExemptions || []));
|
|
128
127
|
|
|
129
128
|
// Handle fallbacks
|
|
130
|
-
var fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName
|
|
129
|
+
var fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName)) : path.node.arguments[1];
|
|
131
130
|
if (t.isStringLiteral(fallback)) {
|
|
132
131
|
// String literals can be concatenated into css variable call
|
|
133
132
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
|
@@ -185,12 +184,10 @@ export default function plugin() {
|
|
|
185
184
|
};
|
|
186
185
|
}
|
|
187
186
|
var lightValues = getThemeValues(light);
|
|
188
|
-
var legacyLightValues = getThemeValues(legacyLight);
|
|
189
187
|
var shapeValues = getThemeValues(shape);
|
|
190
188
|
var spacingValues = getThemeValues(spacing);
|
|
191
189
|
var typographyValues = getThemeValues(typography);
|
|
192
190
|
function getDefaultFallback(tokenName) {
|
|
193
|
-
var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'light';
|
|
194
191
|
if (shapeValues[tokenName]) {
|
|
195
192
|
return shapeValues[tokenName];
|
|
196
193
|
}
|
|
@@ -200,8 +197,7 @@ function getDefaultFallback(tokenName) {
|
|
|
200
197
|
if (typographyValues[tokenName]) {
|
|
201
198
|
return typographyValues[tokenName];
|
|
202
199
|
}
|
|
203
|
-
|
|
204
|
-
return colorValues[tokenName];
|
|
200
|
+
return lightValues[tokenName];
|
|
205
201
|
}
|
|
206
202
|
function getNonAliasedImportName(node) {
|
|
207
203
|
if (t.isIdentifier(node.imported)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as light } from '../artifacts/tokens-raw/atlassian-light';
|
|
2
|
-
export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
3
2
|
export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
|
|
4
3
|
export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
|
|
5
4
|
export { default as typography } from '../artifacts/tokens-raw/atlassian-typography';
|
package/dist/esm/theme-config.js
CHANGED
|
@@ -40,7 +40,7 @@ var themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
|
40
40
|
*
|
|
41
41
|
* These ids must be kebab case
|
|
42
42
|
*/
|
|
43
|
-
export var themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', '
|
|
43
|
+
export var themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'spacing', 'shape', 'typography'];
|
|
44
44
|
/**
|
|
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.
|
|
@@ -126,24 +126,6 @@ var themeConfig = {
|
|
|
126
126
|
extends: 'dark',
|
|
127
127
|
increasesContrastFor: 'dark'
|
|
128
128
|
},
|
|
129
|
-
'atlassian-legacy-light': {
|
|
130
|
-
id: 'legacy-light',
|
|
131
|
-
displayName: 'Light Theme (legacy)',
|
|
132
|
-
palette: 'legacyPalette',
|
|
133
|
-
attributes: {
|
|
134
|
-
type: 'color',
|
|
135
|
-
mode: 'light'
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
'atlassian-legacy-dark': {
|
|
139
|
-
id: 'legacy-dark',
|
|
140
|
-
displayName: 'Dark Theme (legacy)',
|
|
141
|
-
palette: 'legacyPalette',
|
|
142
|
-
attributes: {
|
|
143
|
-
type: 'color',
|
|
144
|
-
mode: 'dark'
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
129
|
'atlassian-spacing': {
|
|
148
130
|
id: 'spacing',
|
|
149
131
|
displayName: 'Atlassian Spacing',
|
|
@@ -24,8 +24,8 @@ var isColorMode = function isColorMode(modeId) {
|
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```
|
|
27
|
-
* themeStringToObject('dark:dark light:
|
|
28
|
-
* // returns { dark: 'dark', light: '
|
|
27
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
28
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
export var themeStringToObject = function themeStringToObject(themeState) {
|
|
@@ -62,8 +62,8 @@ export var themeStringToObject = function themeStringToObject(themeState) {
|
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* ```
|
|
65
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
66
|
-
* // returns 'dark:dark light:
|
|
65
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
66
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
69
|
export var themeObjectToString = function themeObjectToString(themeState) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
7
7
|
* When a new theme is created, the import should automatically be added to the map
|
|
8
8
|
*
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
import { type ThemeIds, type ThemeOverrideIds } from '../theme-config';
|
|
@@ -5,5 +5,5 @@ export declare const CONTRAST_MODE_ATTRIBUTE = "data-contrast-mode";
|
|
|
5
5
|
export declare const CUSTOM_THEME_ATTRIBUTE = "data-custom-theme";
|
|
6
6
|
export declare const CSS_PREFIX = "ds";
|
|
7
7
|
export declare const CSS_VAR_FULL: string[];
|
|
8
|
-
export declare const TOKEN_NOT_FOUND_CSS_VAR
|
|
9
|
-
export declare const CURRENT_SURFACE_CSS_VAR:
|
|
8
|
+
export declare const TOKEN_NOT_FOUND_CSS_VAR: '--ds-token-not-found';
|
|
9
|
+
export declare const CURRENT_SURFACE_CSS_VAR: '--ds-elevation-surface-current';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as light } from '../artifacts/tokens-raw/atlassian-light';
|
|
2
|
-
export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
3
2
|
export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
|
|
4
3
|
export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
|
|
5
4
|
export { default as typography } from '../artifacts/tokens-raw/atlassian-typography';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* These ids are what the actual theme files/folders are called.
|
|
7
7
|
* style-dictionary will attempt to locate these in the file-system.
|
|
8
8
|
*/
|
|
9
|
-
export type Themes = 'atlassian-light' | 'atlassian-light-future' | 'atlassian-light-increased-contrast' | 'atlassian-dark' | 'atlassian-dark-future' | 'atlassian-dark-increased-contrast' | 'atlassian-
|
|
9
|
+
export type Themes = 'atlassian-light' | 'atlassian-light-future' | 'atlassian-light-increased-contrast' | 'atlassian-dark' | 'atlassian-dark-future' | 'atlassian-dark-increased-contrast' | 'atlassian-shape' | 'atlassian-spacing' | 'atlassian-typography';
|
|
10
10
|
export type ThemeFileNames = Themes;
|
|
11
11
|
/**
|
|
12
12
|
* ThemeOverrides: The internal identifier of a theme override. Which are themes that contain
|
|
@@ -42,7 +42,7 @@ export type DataContrastModes = 'more' | 'no-preference' | 'auto';
|
|
|
42
42
|
*
|
|
43
43
|
* These ids must be kebab case
|
|
44
44
|
*/
|
|
45
|
-
export declare const themeIds: readonly ["light-increased-contrast", "light", "light-future", "dark", "dark-future", "dark-increased-contrast", "
|
|
45
|
+
export declare const themeIds: readonly ["light-increased-contrast", "light", "light-future", "dark", "dark-future", "dark-increased-contrast", "spacing", "shape", "typography"];
|
|
46
46
|
export type ThemeIds = (typeof themeIds)[number];
|
|
47
47
|
/**
|
|
48
48
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
@@ -50,7 +50,17 @@ export type ThemeIds = (typeof themeIds)[number];
|
|
|
50
50
|
*/
|
|
51
51
|
declare const themeOverrideIds: readonly [];
|
|
52
52
|
export type ThemeOverrideIds = (typeof themeOverrideIds)[number];
|
|
53
|
-
export declare const themeIdsWithOverrides: readonly [
|
|
53
|
+
export declare const themeIdsWithOverrides: readonly [
|
|
54
|
+
'light-increased-contrast',
|
|
55
|
+
'light',
|
|
56
|
+
'light-future',
|
|
57
|
+
'dark',
|
|
58
|
+
'dark-future',
|
|
59
|
+
'dark-increased-contrast',
|
|
60
|
+
'spacing',
|
|
61
|
+
'shape',
|
|
62
|
+
'typography'
|
|
63
|
+
];
|
|
54
64
|
export type ThemeIdsWithOverrides = (typeof themeIdsWithOverrides)[number];
|
|
55
65
|
/**
|
|
56
66
|
* Theme to use a base. This will create the theme as
|
|
@@ -63,7 +73,7 @@ type ExtensionThemeId = ThemeIds;
|
|
|
63
73
|
* For example: legacy light & dark themes use the "legacyPalette" containing colors from our
|
|
64
74
|
* previous color set.
|
|
65
75
|
*/
|
|
66
|
-
export type Palettes = 'defaultPalette' | '
|
|
76
|
+
export type Palettes = 'defaultPalette' | 'spacingScale' | 'shapePalette' | 'typographyPalette';
|
|
67
77
|
/**
|
|
68
78
|
* ThemeConfig: the source of truth for all theme meta-data.
|
|
69
79
|
* This object should be used whenever interfacing with themes.
|
|
@@ -115,8 +125,8 @@ export interface ThemeOptionsSchema {
|
|
|
115
125
|
* ThemeState: the standard representation of an app's current theme and preferences
|
|
116
126
|
*/
|
|
117
127
|
export interface ThemeState {
|
|
118
|
-
light: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | '
|
|
119
|
-
dark: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | '
|
|
128
|
+
light: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | 'light-increased-contrast' | 'dark-increased-contrast'>;
|
|
129
|
+
dark: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | 'light-increased-contrast' | 'dark-increased-contrast'>;
|
|
120
130
|
colorMode: ThemeColorModes;
|
|
121
131
|
contrastMode: ThemeContrastModes;
|
|
122
132
|
shape?: Extract<ThemeIds, 'shape'>;
|
|
@@ -7,8 +7,8 @@ import { type ThemeState } from './theme-config';
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```
|
|
10
|
-
* themeStringToObject('dark:dark light:
|
|
11
|
-
* // returns { dark: 'dark', light: '
|
|
10
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
11
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export declare const themeStringToObject: (themeState: string) => Partial<ThemeState>;
|
|
@@ -19,8 +19,8 @@ export declare const themeStringToObject: (themeState: string) => Partial<ThemeS
|
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```
|
|
22
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
23
|
-
* // returns 'dark:dark light:
|
|
22
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
23
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export declare const themeObjectToString: (themeState: Partial<ThemeState>) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UnbindFn } from 'bind-event-listener';
|
|
2
2
|
declare class ContrastModeObserver {
|
|
3
3
|
unbindContrastChangeListener: UnbindFn | null;
|
|
4
|
-
getContrastMode():
|
|
4
|
+
getContrastMode(): 'more' | 'no-preference';
|
|
5
5
|
bind(): void;
|
|
6
6
|
unbind(): void;
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
7
7
|
* When a new theme is created, the import should automatically be added to the map
|
|
8
8
|
*
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
import { type ThemeIds, type ThemeOverrideIds } from '../theme-config';
|
|
@@ -5,5 +5,5 @@ export declare const CONTRAST_MODE_ATTRIBUTE = "data-contrast-mode";
|
|
|
5
5
|
export declare const CUSTOM_THEME_ATTRIBUTE = "data-custom-theme";
|
|
6
6
|
export declare const CSS_PREFIX = "ds";
|
|
7
7
|
export declare const CSS_VAR_FULL: string[];
|
|
8
|
-
export declare const TOKEN_NOT_FOUND_CSS_VAR
|
|
9
|
-
export declare const CURRENT_SURFACE_CSS_VAR:
|
|
8
|
+
export declare const TOKEN_NOT_FOUND_CSS_VAR: '--ds-token-not-found';
|
|
9
|
+
export declare const CURRENT_SURFACE_CSS_VAR: '--ds-elevation-surface-current';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as light } from '../artifacts/tokens-raw/atlassian-light';
|
|
2
|
-
export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
3
2
|
export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
|
|
4
3
|
export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
|
|
5
4
|
export { default as typography } from '../artifacts/tokens-raw/atlassian-typography';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* These ids are what the actual theme files/folders are called.
|
|
7
7
|
* style-dictionary will attempt to locate these in the file-system.
|
|
8
8
|
*/
|
|
9
|
-
export type Themes = 'atlassian-light' | 'atlassian-light-future' | 'atlassian-light-increased-contrast' | 'atlassian-dark' | 'atlassian-dark-future' | 'atlassian-dark-increased-contrast' | 'atlassian-
|
|
9
|
+
export type Themes = 'atlassian-light' | 'atlassian-light-future' | 'atlassian-light-increased-contrast' | 'atlassian-dark' | 'atlassian-dark-future' | 'atlassian-dark-increased-contrast' | 'atlassian-shape' | 'atlassian-spacing' | 'atlassian-typography';
|
|
10
10
|
export type ThemeFileNames = Themes;
|
|
11
11
|
/**
|
|
12
12
|
* ThemeOverrides: The internal identifier of a theme override. Which are themes that contain
|
|
@@ -57,8 +57,6 @@ export declare const themeIds: readonly [
|
|
|
57
57
|
"dark",
|
|
58
58
|
"dark-future",
|
|
59
59
|
"dark-increased-contrast",
|
|
60
|
-
"legacy-light",
|
|
61
|
-
"legacy-dark",
|
|
62
60
|
"spacing",
|
|
63
61
|
"shape",
|
|
64
62
|
"typography"
|
|
@@ -72,17 +70,15 @@ declare const themeOverrideIds: readonly [
|
|
|
72
70
|
];
|
|
73
71
|
export type ThemeOverrideIds = (typeof themeOverrideIds)[number];
|
|
74
72
|
export declare const themeIdsWithOverrides: readonly [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"shape",
|
|
85
|
-
"typography"
|
|
73
|
+
'light-increased-contrast',
|
|
74
|
+
'light',
|
|
75
|
+
'light-future',
|
|
76
|
+
'dark',
|
|
77
|
+
'dark-future',
|
|
78
|
+
'dark-increased-contrast',
|
|
79
|
+
'spacing',
|
|
80
|
+
'shape',
|
|
81
|
+
'typography'
|
|
86
82
|
];
|
|
87
83
|
export type ThemeIdsWithOverrides = (typeof themeIdsWithOverrides)[number];
|
|
88
84
|
/**
|
|
@@ -96,7 +92,7 @@ type ExtensionThemeId = ThemeIds;
|
|
|
96
92
|
* For example: legacy light & dark themes use the "legacyPalette" containing colors from our
|
|
97
93
|
* previous color set.
|
|
98
94
|
*/
|
|
99
|
-
export type Palettes = 'defaultPalette' | '
|
|
95
|
+
export type Palettes = 'defaultPalette' | 'spacingScale' | 'shapePalette' | 'typographyPalette';
|
|
100
96
|
/**
|
|
101
97
|
* ThemeConfig: the source of truth for all theme meta-data.
|
|
102
98
|
* This object should be used whenever interfacing with themes.
|
|
@@ -148,8 +144,8 @@ export interface ThemeOptionsSchema {
|
|
|
148
144
|
* ThemeState: the standard representation of an app's current theme and preferences
|
|
149
145
|
*/
|
|
150
146
|
export interface ThemeState {
|
|
151
|
-
light: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | '
|
|
152
|
-
dark: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | '
|
|
147
|
+
light: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | 'light-increased-contrast' | 'dark-increased-contrast'>;
|
|
148
|
+
dark: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | 'light-increased-contrast' | 'dark-increased-contrast'>;
|
|
153
149
|
colorMode: ThemeColorModes;
|
|
154
150
|
contrastMode: ThemeContrastModes;
|
|
155
151
|
shape?: Extract<ThemeIds, 'shape'>;
|
|
@@ -7,8 +7,8 @@ import { type ThemeState } from './theme-config';
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```
|
|
10
|
-
* themeStringToObject('dark:dark light:
|
|
11
|
-
* // returns { dark: 'dark', light: '
|
|
10
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
11
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export declare const themeStringToObject: (themeState: string) => Partial<ThemeState>;
|
|
@@ -19,8 +19,8 @@ export declare const themeStringToObject: (themeState: string) => Partial<ThemeS
|
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```
|
|
22
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
23
|
-
* // returns 'dark:dark light:
|
|
22
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
23
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export declare const themeObjectToString: (themeState: Partial<ThemeState>) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UnbindFn } from 'bind-event-listener';
|
|
2
2
|
declare class ContrastModeObserver {
|
|
3
3
|
unbindContrastChangeListener: UnbindFn | null;
|
|
4
|
-
getContrastMode():
|
|
4
|
+
getContrastMode(): 'more' | 'no-preference';
|
|
5
5
|
bind(): void;
|
|
6
6
|
unbind(): void;
|
|
7
7
|
}
|
package/offerings.json
CHANGED
|
@@ -8,7 +8,19 @@
|
|
|
8
8
|
"type": "named"
|
|
9
9
|
},
|
|
10
10
|
"type": "function",
|
|
11
|
-
"keywords": [
|
|
11
|
+
"keywords": [
|
|
12
|
+
"token",
|
|
13
|
+
"design",
|
|
14
|
+
"system",
|
|
15
|
+
"color",
|
|
16
|
+
"spacing",
|
|
17
|
+
"typography",
|
|
18
|
+
"radius",
|
|
19
|
+
"theme",
|
|
20
|
+
"css",
|
|
21
|
+
"style",
|
|
22
|
+
"variable"
|
|
23
|
+
],
|
|
12
24
|
"categories": ["tokens"],
|
|
13
25
|
"shortDescription": "Design tokens provide consistent, semantic values for colors, spacing, typography, and other design properties across the Atlassian Design System. Use tokens instead of hardcoded values to ensure consistency and proper theming.",
|
|
14
26
|
"status": "general-availability",
|
|
@@ -18,8 +30,8 @@
|
|
|
18
30
|
"Use semantic color names (success, warning, danger) for better meaning"
|
|
19
31
|
],
|
|
20
32
|
"usageGuidelines": [
|
|
21
|
-
"AVOID hardcoding any CSS values where a token exists for that type; in
|
|
22
|
-
"Use the `token()` function with
|
|
33
|
+
"AVOID hardcoding any CSS values where a token exists for that type; in many cases you may be forced to use a token",
|
|
34
|
+
"Use the `token()` function with CSS-in-JS",
|
|
23
35
|
"Use semantic token names for better maintainability"
|
|
24
36
|
],
|
|
25
37
|
"generativeInstructions": [
|
|
@@ -27,6 +39,6 @@
|
|
|
27
39
|
"./docs/ai/spacing-instructions.md",
|
|
28
40
|
"./docs/ai/border-radius-instructions.md"
|
|
29
41
|
],
|
|
30
|
-
"examples": ["./examples/ai/
|
|
42
|
+
"examples": ["./examples/ai/basic.tsx"]
|
|
31
43
|
}
|
|
32
44
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tokens",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.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/"
|
|
@@ -43,28 +43,28 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@af/formatting": "workspace:^",
|
|
45
45
|
"@af/visual-regression": "workspace:^",
|
|
46
|
-
"@atlaskit/avatar": "^25.
|
|
46
|
+
"@atlaskit/avatar": "^25.8.0",
|
|
47
47
|
"@atlaskit/button": "^23.9.0",
|
|
48
48
|
"@atlaskit/calendar": "^17.2.0",
|
|
49
49
|
"@atlaskit/checkbox": "^17.3.0",
|
|
50
50
|
"@atlaskit/code": "^17.4.0",
|
|
51
51
|
"@atlaskit/css": "^0.19.0",
|
|
52
|
-
"@atlaskit/docs": "^11.
|
|
52
|
+
"@atlaskit/docs": "^11.4.0",
|
|
53
53
|
"@atlaskit/dropdown-menu": "^16.4.0",
|
|
54
54
|
"@atlaskit/dynamic-table": "^18.3.0",
|
|
55
55
|
"@atlaskit/form": "^15.3.0",
|
|
56
56
|
"@atlaskit/grid": "^0.18.0",
|
|
57
|
-
"@atlaskit/heading": "^5.
|
|
58
|
-
"@atlaskit/icon": "^
|
|
57
|
+
"@atlaskit/heading": "^5.3.0",
|
|
58
|
+
"@atlaskit/icon": "^31.0.0",
|
|
59
59
|
"@atlaskit/inline-message": "^15.5.0",
|
|
60
60
|
"@atlaskit/link": "^3.3.0",
|
|
61
|
-
"@atlaskit/lozenge": "^13.
|
|
61
|
+
"@atlaskit/lozenge": "^13.4.0",
|
|
62
62
|
"@atlaskit/popup": "^4.13.0",
|
|
63
|
-
"@atlaskit/primitives": "^
|
|
63
|
+
"@atlaskit/primitives": "^18.0.0",
|
|
64
64
|
"@atlaskit/radio": "^8.4.0",
|
|
65
65
|
"@atlaskit/section-message": "^8.12.0",
|
|
66
66
|
"@atlaskit/select": "^21.7.0",
|
|
67
|
-
"@atlaskit/tag": "^14.
|
|
67
|
+
"@atlaskit/tag": "^14.5.0",
|
|
68
68
|
"@atlaskit/textarea": "^8.2.0",
|
|
69
69
|
"@atlaskit/textfield": "^8.2.0",
|
|
70
70
|
"@atlaskit/theme": "^21.0.0",
|
|
@@ -122,9 +122,6 @@
|
|
|
122
122
|
"platform_increased-contrast-themes": {
|
|
123
123
|
"type": "boolean"
|
|
124
124
|
},
|
|
125
|
-
"should-render-to-parent-should-be-true-design-syst": {
|
|
126
|
-
"type": "boolean"
|
|
127
|
-
},
|
|
128
125
|
"platform-dst-shape-theme-default": {
|
|
129
126
|
"type": "boolean"
|
|
130
127
|
},
|