@atlaskit/codemod-cli 0.8.4 → 0.8.5
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/main.js +1 -1
- package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +20 -56
- package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +6 -22
- package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +7 -5
- package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +38 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +16 -53
- package/dist/es2019/presets/theme-to-design-tokens/utils/ast-meta.js +5 -12
- package/dist/es2019/presets/theme-to-design-tokens/utils/legacy-colors.js +7 -5
- package/dist/es2019/presets/theme-to-design-tokens/utils/tokens.js +12 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +19 -54
- package/dist/esm/presets/theme-to-design-tokens/utils/ast-meta.js +5 -18
- package/dist/esm/presets/theme-to-design-tokens/utils/legacy-colors.js +7 -5
- package/dist/esm/presets/theme-to-design-tokens/utils/tokens.js +24 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/presets/theme-to-design-tokens/utils/ast-meta.d.ts +0 -1
- package/dist/types/presets/theme-to-design-tokens/utils/tokens.d.ts +2 -0
- package/package.json +2 -3
- package/dist/cjs/presets/theme-to-design-tokens/utils/color-difference.js +0 -174
- package/dist/cjs/presets/theme-to-design-tokens/utils/color-palette-tokens-map.js +0 -129
- package/dist/cjs/presets/theme-to-design-tokens/utils/color-to-token.js +0 -88
- package/dist/es2019/presets/theme-to-design-tokens/utils/color-difference.js +0 -150
- package/dist/es2019/presets/theme-to-design-tokens/utils/color-palette-tokens-map.js +0 -122
- package/dist/es2019/presets/theme-to-design-tokens/utils/color-to-token.js +0 -75
- package/dist/esm/presets/theme-to-design-tokens/utils/color-difference.js +0 -160
- package/dist/esm/presets/theme-to-design-tokens/utils/color-palette-tokens-map.js +0 -122
- package/dist/esm/presets/theme-to-design-tokens/utils/color-to-token.js +0 -78
- package/dist/types/presets/theme-to-design-tokens/types.d.ts +0 -2
- package/dist/types/presets/theme-to-design-tokens/utils/color-difference.d.ts +0 -66
- package/dist/types/presets/theme-to-design-tokens/utils/color-palette-tokens-map.d.ts +0 -21
- package/dist/types/presets/theme-to-design-tokens/utils/color-to-token.d.ts +0 -12
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { findClosetMatchingToken } from './color-difference';
|
|
2
|
-
import colorTokensMap from './color-palette-tokens-map';
|
|
3
|
-
|
|
4
|
-
function normalizeName(name) {
|
|
5
|
-
if (!name) {
|
|
6
|
-
return 'unknown';
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
if (name.startsWith('background')) {
|
|
10
|
-
return 'background';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (name.toLowerCase().includes('color') || name === 'color' || name === 'fill' || name === 'stroke') {
|
|
14
|
-
return 'text';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (name.startsWith('border') || name.toLowerCase().replace('-', '') === 'boxshadow') {
|
|
18
|
-
return 'border';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return 'unknown';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default function colorToToken(paletteName, _ref) {
|
|
25
|
-
var _ref$state = _ref.state,
|
|
26
|
-
state = _ref$state === void 0 ? 'resting' : _ref$state,
|
|
27
|
-
propertyName = _ref.propertyName;
|
|
28
|
-
var getLowConfidenceFuzzyResult = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
29
|
-
return [];
|
|
30
|
-
};
|
|
31
|
-
var normalizedPropertyName = normalizeName(propertyName);
|
|
32
|
-
var value = paletteName.toUpperCase();
|
|
33
|
-
var tokenSuggestionProperties = colorTokensMap[state];
|
|
34
|
-
var tokenSuggestionProperty = tokenSuggestionProperties && normalizedPropertyName !== 'unknown' && tokenSuggestionProperties[normalizedPropertyName];
|
|
35
|
-
var tokenSuggestionValue = tokenSuggestionProperty && tokenSuggestionProperty[value];
|
|
36
|
-
|
|
37
|
-
if (tokenSuggestionValue && tokenSuggestionValue.length === 1) {
|
|
38
|
-
return {
|
|
39
|
-
confidence: 'high',
|
|
40
|
-
suggestion: tokenSuggestionValue,
|
|
41
|
-
fallbackNeeded: true
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (tokenSuggestionValue && tokenSuggestionValue.length > 2) {
|
|
46
|
-
return {
|
|
47
|
-
confidence: 'medium',
|
|
48
|
-
suggestion: tokenSuggestionValue,
|
|
49
|
-
fallbackNeeded: true
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var closestTokenName = findClosetMatchingToken(value);
|
|
54
|
-
|
|
55
|
-
if (closestTokenName) {
|
|
56
|
-
return {
|
|
57
|
-
confidence: 'low',
|
|
58
|
-
suggestion: [closestTokenName],
|
|
59
|
-
fallbackNeeded: true
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
var fuzzyResult = getLowConfidenceFuzzyResult();
|
|
64
|
-
|
|
65
|
-
if (fuzzyResult.length) {
|
|
66
|
-
return {
|
|
67
|
-
confidence: 'low',
|
|
68
|
-
suggestion: fuzzyResult,
|
|
69
|
-
fallbackNeeded: true
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
confidence: 'unknown',
|
|
75
|
-
suggestion: [],
|
|
76
|
-
fallbackNeeded: true
|
|
77
|
-
};
|
|
78
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { DesignTokenName } from '../types';
|
|
2
|
-
export declare type LegacyColorPalette = keyof typeof legacyColorPalette;
|
|
3
|
-
export declare const legacyColorPalette: {
|
|
4
|
-
readonly R50: "#FFEBE6";
|
|
5
|
-
readonly R75: "#FFBDAD";
|
|
6
|
-
readonly R100: "#FF8F73";
|
|
7
|
-
readonly R200: "#FF7452";
|
|
8
|
-
readonly R300: "#FF5630";
|
|
9
|
-
readonly R400: "#DE350B";
|
|
10
|
-
readonly R500: "#BF2600";
|
|
11
|
-
readonly Y50: "#FFFAE6";
|
|
12
|
-
readonly Y75: "#FFF0B3";
|
|
13
|
-
readonly Y100: "#FFE380";
|
|
14
|
-
readonly Y200: "#FFC400";
|
|
15
|
-
readonly Y300: "#FFAB00";
|
|
16
|
-
readonly Y400: "#FF991F";
|
|
17
|
-
readonly Y500: "#FF8B00";
|
|
18
|
-
readonly G50: "#E3FCEF";
|
|
19
|
-
readonly G75: "#ABF5D1";
|
|
20
|
-
readonly G100: "#79F2C0";
|
|
21
|
-
readonly G200: "#57D9A3";
|
|
22
|
-
readonly G300: "#36B37E";
|
|
23
|
-
readonly G400: "#00875A";
|
|
24
|
-
readonly G500: "#006644";
|
|
25
|
-
readonly B50: "#DEEBFF";
|
|
26
|
-
readonly B75: "#B3D4FF";
|
|
27
|
-
readonly B100: "#4C9AFF";
|
|
28
|
-
readonly B200: "#2684FF";
|
|
29
|
-
readonly B300: "#0065FF";
|
|
30
|
-
readonly B400: "#0052CC";
|
|
31
|
-
readonly B500: "#0747A6";
|
|
32
|
-
readonly P50: "#EAE6FF";
|
|
33
|
-
readonly P75: "#C0B6F2";
|
|
34
|
-
readonly P100: "#998DD9";
|
|
35
|
-
readonly P200: "#8777D9";
|
|
36
|
-
readonly P300: "#6554C0";
|
|
37
|
-
readonly P400: "#5243AA";
|
|
38
|
-
readonly P500: "#403294";
|
|
39
|
-
readonly T50: "#E6FCFF";
|
|
40
|
-
readonly T75: "#B3F5FF";
|
|
41
|
-
readonly T100: "#79E2F2";
|
|
42
|
-
readonly T200: "#00C7E6";
|
|
43
|
-
readonly T300: "#00B8D9";
|
|
44
|
-
readonly T400: "#00A3BF";
|
|
45
|
-
readonly T500: "#008DA6";
|
|
46
|
-
readonly N0: "#FFFFFF";
|
|
47
|
-
readonly N10: "#FAFBFC";
|
|
48
|
-
readonly N20: "#F4F5F7";
|
|
49
|
-
readonly N30: "#EBECF0";
|
|
50
|
-
readonly N40: "#DFE1E6";
|
|
51
|
-
readonly N50: "#C1C7D0";
|
|
52
|
-
readonly N60: "#B3BAC5";
|
|
53
|
-
readonly N70: "#A5ADBA";
|
|
54
|
-
readonly N80: "#97A0AF";
|
|
55
|
-
readonly N90: "#8993A4";
|
|
56
|
-
readonly N100: "#7A869A";
|
|
57
|
-
readonly N200: "#6B778C";
|
|
58
|
-
readonly N300: "#5E6C84";
|
|
59
|
-
readonly N400: "#505F79";
|
|
60
|
-
readonly N500: "#42526E";
|
|
61
|
-
readonly N600: "#344563";
|
|
62
|
-
readonly N700: "#253858";
|
|
63
|
-
readonly N800: "#172B4D";
|
|
64
|
-
readonly N900: "#091E42";
|
|
65
|
-
};
|
|
66
|
-
export declare function findClosetMatchingToken(paletteName: string): DesignTokenName | undefined;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { DesignTokenName } from '../types';
|
|
2
|
-
import type { LegacyColorPalette } from './color-difference';
|
|
3
|
-
interface TokenMap {
|
|
4
|
-
text: {
|
|
5
|
-
[key in LegacyColorPalette]?: DesignTokenName[];
|
|
6
|
-
};
|
|
7
|
-
background: {
|
|
8
|
-
[key in LegacyColorPalette]?: DesignTokenName[];
|
|
9
|
-
};
|
|
10
|
-
border: {
|
|
11
|
-
[key in LegacyColorPalette]?: DesignTokenName[];
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
interface ColorToTokenMap {
|
|
15
|
-
resting: TokenMap;
|
|
16
|
-
hover: TokenMap;
|
|
17
|
-
pressed: TokenMap;
|
|
18
|
-
disabled: TokenMap;
|
|
19
|
-
}
|
|
20
|
-
declare const colorMap: ColorToTokenMap;
|
|
21
|
-
export default colorMap;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DesignTokenName } from '../types';
|
|
2
|
-
interface MetaOpts {
|
|
3
|
-
state: 'resting' | 'hover' | 'pressed' | 'disabled';
|
|
4
|
-
propertyName: string | undefined;
|
|
5
|
-
}
|
|
6
|
-
export interface TokenResult {
|
|
7
|
-
suggestion: string[];
|
|
8
|
-
fallbackNeeded: boolean;
|
|
9
|
-
confidence: 'unknown' | 'low' | 'medium' | 'high';
|
|
10
|
-
}
|
|
11
|
-
export default function colorToToken(paletteName: string, { state, propertyName }: MetaOpts, getLowConfidenceFuzzyResult?: () => DesignTokenName[]): TokenResult;
|
|
12
|
-
export {};
|