Skip to content

Commit dd01d2b

Browse files
committed
replace DEPRECATED_PATTERNS with new deprecated system
1 parent 3423f85 commit dd01d2b

File tree

4 files changed

+67
-48
lines changed

4 files changed

+67
-48
lines changed

apps/dialtone-documentation/docs/.vuepress/baseComponents/tokens/constants.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ export const SUBCATEGORY_MAP = {
4040
size: ['radius', 'border'],
4141
};
4242

43-
export const DEPRECATED_PATTERNS = [
44-
'typography-headline-',
45-
'typography-body-',
46-
'typography-label-',
47-
'typography-helper-',
48-
'typography-code-',
49-
];
50-
5143
export const getTokensStructure = () => ({
5244
color: {
5345
foreground: {

apps/dialtone-documentation/docs/.vuepress/baseComponents/tokens/utilities.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import tokensJson from '@dialpad/dialtone-tokens/dist/doc.json';
2-
import { CATEGORY_MAP, SUBCATEGORY_MAP, FORMAT_MAP, MODES, THEMES, DEPRECATED_PATTERNS, getTokensStructure } from './constants';
2+
import { CATEGORY_MAP, SUBCATEGORY_MAP, FORMAT_MAP, MODES, THEMES, getTokensStructure } from './constants';
33

44
/**
55
Process the file tokensJson and fill processedTokens with the data we want to show.
@@ -76,9 +76,8 @@ const addTokensToCategories = (token, format, structure) => {
7676
const [key, value] = token;
7777
if (!value[FORMAT_MAP[format]] || !value[FORMAT_MAP.CSS] || isBaseToken(key)) return;
7878

79-
const { name, value: tokenValue, description, keywords, isCompositionToken } = value[FORMAT_MAP[format]];
79+
const { name, value: tokenValue, description, keywords, isCompositionToken, deprecated } = value[FORMAT_MAP[format]];
8080
const { value: exampleValue, name: exampleName } = value[FORMAT_MAP.CSS];
81-
const deprecated = isDeprecatedToken(exampleName);
8281
const displayToken = { exampleValue, exampleName, name, tokenValue, description, keywords, deprecated };
8382

8483
if (isCompositionToken) {
@@ -215,7 +214,3 @@ const addTokenToSubcategory = (token, category, subcategory, structure) => {
215214
};
216215

217216
const isBaseToken = (name) => name.endsWith('base') || name.endsWith('root');
218-
219-
const isDeprecatedToken = (name) => {
220-
return DEPRECATED_PATTERNS.some(pattern => name.includes(pattern));
221-
};

packages/dialtone-tokens/build-docs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function buildDocs (platformName, theme, currentObj) {
1919
const tokenDescription = currentObj?.description;
2020
const tokenPath = currentObj?.path;
2121
const isCompositionToken = currentObj?.isCompositionToken ?? undefined;
22+
const tokenDeprecated = currentObj?.$deprecated ?? currentObj?.deprecated ?? undefined;
2223

2324
if (tokenValue && tokenPath) {
2425
const tokenKey = tokenPath.join('/');
@@ -31,6 +32,7 @@ export function buildDocs (platformName, theme, currentObj) {
3132
description: tokenDescription,
3233
keywords: getTokenKeywords(keywordsJson, tokenPath),
3334
isCompositionToken,
35+
deprecated: tokenDeprecated,
3436
},
3537
};
3638
return null;
@@ -50,7 +52,6 @@ export function buildDocs (platformName, theme, currentObj) {
5052
* @param {Array} keywords Array with the keywords. Is completed by recursively looping through obj
5153
* @returns {Array|undefined} Array with the keywords, or undefined if there are none
5254
*/
53-
// eslint-disable-next-line complexity
5455
function getTokenKeywords (obj, tokenPath, keywords = []) {
5556
if (tokenPath.legth === 0 || !obj) return;
5657
const currentCategory = tokenPath[0];

packages/dialtone-tokens/tokens/theme/dp/default.json

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"warning": {
7575
"value": "{color.gold.800}",
7676
"type": "color",
77-
"description": "Indicates information that requires user’s attention and further action may be necessary."
77+
"description": "Indicates information that requires user\u2019s attention and further action may be necessary."
7878
},
7979
"primary-inverted": {
8080
"value": "{color.black.100}",
@@ -2704,7 +2704,8 @@
27042704
"textCase": "{font.text-case.none}"
27052705
},
27062706
"type": "typography",
2707-
"description": "(DEPRECATED) Base default medium text style for main content."
2707+
"description": "Base default medium text style for main content.",
2708+
"$deprecated": "Use text tokens instead."
27082709
},
27092710
"md-compact": {
27102711
"value": {
@@ -2715,7 +2716,8 @@
27152716
"textCase": "{font.text-case.none}"
27162717
},
27172718
"type": "typography",
2718-
"description": "(DEPRECATED) A tighter-spaced version of medium body style."
2719+
"description": "A tighter-spaced version of medium body style.",
2720+
"$deprecated": "Use text tokens instead."
27192721
},
27202722
"sm": {
27212723
"value": {
@@ -2726,7 +2728,8 @@
27262728
"textCase": "{font.text-case.none}"
27272729
},
27282730
"type": "typography",
2729-
"description": "(DEPRECATED) Reduced small text style for less prominent or adjacent content."
2731+
"description": "Reduced small text style for less prominent or adjacent content.",
2732+
"$deprecated": "Use text tokens instead."
27302733
},
27312734
"sm-compact": {
27322735
"value": {
@@ -2737,7 +2740,8 @@
27372740
"textCase": "{font.text-case.none}"
27382741
},
27392742
"type": "typography",
2740-
"description": "(DEPRECATED) A tighter-spaced version of small body style."
2743+
"description": "A tighter-spaced version of small body style.",
2744+
"$deprecated": "Use text tokens instead."
27412745
}
27422746
},
27432747
"headline": {
@@ -2750,7 +2754,8 @@
27502754
"textCase": "{font.text-case.uppercase}"
27512755
},
27522756
"type": "typography",
2753-
"description": "(DEPRECATED) Visually concise and uppercase title text used above a paired headline. Also known as a kicker or overline."
2757+
"description": "Visually concise and uppercase title text used above a paired headline. Also known as a kicker or overline.",
2758+
"$deprecated": "Use text tokens instead."
27542759
},
27552760
"sm": {
27562761
"value": {
@@ -2761,7 +2766,8 @@
27612766
"textCase": "{font.text-case.none}"
27622767
},
27632768
"type": "typography",
2764-
"description": "(DEPRECATED) Smaller text size for secondary information or subheadings."
2769+
"description": "Smaller text size for secondary information or subheadings.",
2770+
"$deprecated": "Use text tokens instead."
27652771
},
27662772
"sm-compact": {
27672773
"value": {
@@ -2772,7 +2778,8 @@
27722778
"textCase": "{font.text-case.none}"
27732779
},
27742780
"type": "typography",
2775-
"description": "(DEPRECATED) A tighter-spaced version of small headline style."
2781+
"description": "A tighter-spaced version of small headline style.",
2782+
"$deprecated": "Use text tokens instead."
27762783
},
27772784
"sm-soft": {
27782785
"value": {
@@ -2783,7 +2790,8 @@
27832790
"textCase": "{font.text-case.none}"
27842791
},
27852792
"type": "typography",
2786-
"description": "(DEPRECATED) A softer font weight version of small headline style."
2793+
"description": "A softer font weight version of small headline style.",
2794+
"$deprecated": "Use text tokens instead."
27872795
},
27882796
"sm-soft-compact": {
27892797
"value": {
@@ -2794,7 +2802,8 @@
27942802
"textCase": "{font.text-case.none}"
27952803
},
27962804
"type": "typography",
2797-
"description": "(DEPRECATED) A softer font weight, tighter-spaced version of small headline style."
2805+
"description": "A softer font weight, tighter-spaced version of small headline style.",
2806+
"$deprecated": "Use text tokens instead."
27982807
},
27992808
"md": {
28002809
"value": {
@@ -2805,7 +2814,8 @@
28052814
"textCase": "{font.text-case.none}"
28062815
},
28072816
"type": "typography",
2808-
"description": "(DEPRECATED) Medium-sized base text style for headlines."
2817+
"description": "Medium-sized base text style for headlines.",
2818+
"$deprecated": "Use text tokens instead."
28092819
},
28102820
"md-compact": {
28112821
"value": {
@@ -2816,7 +2826,8 @@
28162826
"textCase": "{font.text-case.none}"
28172827
},
28182828
"type": "typography",
2819-
"description": "(DEPRECATED) A tighter-spaced version of medium headline style."
2829+
"description": "A tighter-spaced version of medium headline style.",
2830+
"$deprecated": "Use text tokens instead."
28202831
},
28212832
"lg": {
28222833
"value": {
@@ -2827,7 +2838,8 @@
28272838
"textCase": "{font.text-case.none}"
28282839
},
28292840
"type": "typography",
2830-
"description": "(DEPRECATED) Large text style for headlines to attract attention."
2841+
"description": "Large text style for headlines to attract attention.",
2842+
"$deprecated": "Use text tokens instead."
28312843
},
28322844
"lg-soft": {
28332845
"value": {
@@ -2838,7 +2850,8 @@
28382850
"textCase": "{font.text-case.none}"
28392851
},
28402852
"type": "typography",
2841-
"description": "(DEPRECATED) A softer font weight version of large headline style."
2853+
"description": "A softer font weight version of large headline style.",
2854+
"$deprecated": "Use text tokens instead."
28422855
},
28432856
"lg-compact": {
28442857
"value": {
@@ -2849,7 +2862,8 @@
28492862
"textCase": "{font.text-case.none}"
28502863
},
28512864
"type": "typography",
2852-
"description": "(DEPRECATED) A tighter-spaced version of large body style."
2865+
"description": "A tighter-spaced version of large body style.",
2866+
"$deprecated": "Use text tokens instead."
28532867
},
28542868
"lg-soft-compact": {
28552869
"value": {
@@ -2860,7 +2874,8 @@
28602874
"textCase": "{font.text-case.none}"
28612875
},
28622876
"type": "typography",
2863-
"description": "(DEPRECATED) A softer font weight, tighter spaced version of large headline style."
2877+
"description": "A softer font weight, tighter spaced version of large headline style.",
2878+
"$deprecated": "Use text tokens instead."
28642879
},
28652880
"xl": {
28662881
"value": {
@@ -2871,7 +2886,8 @@
28712886
"textCase": "{font.text-case.none}"
28722887
},
28732888
"type": "typography",
2874-
"description": "(DEPRECATED) Extra large text style for high importance headlines."
2889+
"description": "Extra large text style for high importance headlines.",
2890+
"$deprecated": "Use text tokens instead."
28752891
},
28762892
"xl-compact": {
28772893
"value": {
@@ -2882,7 +2898,8 @@
28822898
"textCase": "{font.text-case.none}"
28832899
},
28842900
"type": "typography",
2885-
"description": "(DEPRECATED) A tighter-spaced version of extra large headline style."
2901+
"description": "A tighter-spaced version of extra large headline style.",
2902+
"$deprecated": "Use text tokens instead."
28862903
},
28872904
"xxl": {
28882905
"value": {
@@ -2893,7 +2910,8 @@
28932910
"textCase": "{font.text-case.none}"
28942911
},
28952912
"type": "typography",
2896-
"description": "(DEPRECATED) Largest text style for extra extra large content."
2913+
"description": "Largest text style for extra extra large content.",
2914+
"$deprecated": "Use text tokens instead."
28972915
},
28982916
"xxl-compact": {
28992917
"value": {
@@ -2904,7 +2922,8 @@
29042922
"textCase": "{font.text-case.none}"
29052923
},
29062924
"type": "typography",
2907-
"description": "(DEPRECATED) A tighter-spaced version of extra extra large headline style."
2925+
"description": "A tighter-spaced version of extra extra large headline style.",
2926+
"$deprecated": "Use text tokens instead."
29082927
}
29092928
},
29102929
"label": {
@@ -2917,7 +2936,8 @@
29172936
"textCase": "{font.text-case.none}"
29182937
},
29192938
"type": "typography",
2920-
"description": "Base default medium-sized text style for labels, providing clear identification and categorization."
2939+
"description": "Base default medium-sized text style for labels, providing clear identification and categorization.",
2940+
"$deprecated": "Use text tokens instead."
29212941
},
29222942
"md-compact": {
29232943
"value": {
@@ -2928,7 +2948,8 @@
29282948
"textCase": "{font.text-case.none}"
29292949
},
29302950
"type": "typography",
2931-
"description": "A tighter-spaced version of medium label style."
2951+
"description": "A tighter-spaced version of medium label style.",
2952+
"$deprecated": "Use text tokens instead."
29322953
},
29332954
"md-plain": {
29342955
"value": {
@@ -2939,7 +2960,8 @@
29392960
"textCase": "{font.text-case.none}"
29402961
},
29412962
"type": "typography",
2942-
"description": "A non-bold version of medium label style."
2963+
"description": "A non-bold version of medium label style.",
2964+
"$deprecated": "Use text tokens instead."
29432965
},
29442966
"md-plain-compact": {
29452967
"value": {
@@ -2950,7 +2972,8 @@
29502972
"textCase": "{font.text-case.none}"
29512973
},
29522974
"type": "typography",
2953-
"description": "A non-bolded, tighter-spaced version of medium label style."
2975+
"description": "A non-bolded, tighter-spaced version of medium label style.",
2976+
"$deprecated": "Use text tokens instead."
29542977
},
29552978
"sm": {
29562979
"value": {
@@ -2961,7 +2984,8 @@
29612984
"textCase": "{font.text-case.none}"
29622985
},
29632986
"type": "typography",
2964-
"description": "Smaller text style for labels when space is limited or for secondary information or to convey a slightly lower hierachy."
2987+
"description": "Smaller text style for labels when space is limited or for secondary information or to convey a slightly lower hierachy.",
2988+
"$deprecated": "Use text tokens instead."
29652989
},
29662990
"sm-compact": {
29672991
"value": {
@@ -2972,7 +2996,8 @@
29722996
"textCase": "{font.text-case.none}"
29732997
},
29742998
"type": "typography",
2975-
"description": "A tighter-spaced version of small label style."
2999+
"description": "A tighter-spaced version of small label style.",
3000+
"$deprecated": "Use text tokens instead."
29763001
},
29773002
"sm-plain": {
29783003
"value": {
@@ -2983,7 +3008,8 @@
29833008
"textCase": "{font.text-case.none}"
29843009
},
29853010
"type": "typography",
2986-
"description": "A non-bold version of small label style."
3011+
"description": "A non-bold version of small label style.",
3012+
"$deprecated": "Use text tokens instead."
29873013
},
29883014
"sm-plain-compact": {
29893015
"value": {
@@ -2994,7 +3020,8 @@
29943020
"textCase": "{font.text-case.none}"
29953021
},
29963022
"type": "typography",
2997-
"description": "A non-bolded, tighter-spaced version of small label style."
3023+
"description": "A non-bolded, tighter-spaced version of small label style.",
3024+
"$deprecated": "Use text tokens instead."
29983025
}
29993026
},
30003027
"helper": {
@@ -3007,7 +3034,8 @@
30073034
"textCase": "{font.text-case.none}"
30083035
},
30093036
"type": "typography",
3010-
"description": "Base default medium-sized text style for supplementary contextual information."
3037+
"description": "Base default medium-sized text style for supplementary contextual information.",
3038+
"$deprecated": "Use text tokens instead."
30113039
},
30123040
"sm": {
30133041
"value": {
@@ -3018,7 +3046,8 @@
30183046
"textCase": "{font.text-case.none}"
30193047
},
30203048
"type": "typography",
3021-
"description": "Smaller text size for subtle guidance or additional context, minimizing visual disruption."
3049+
"description": "Smaller text size for subtle guidance or additional context, minimizing visual disruption.",
3050+
"$deprecated": "Use text tokens instead."
30223051
}
30233052
},
30243053
"code": {
@@ -3031,7 +3060,8 @@
30313060
"textCase": "{font.text-case.none}"
30323061
},
30333062
"type": "typography",
3034-
"description": "Base default medium-sized text style for monospace code snippets of technical content."
3063+
"description": "Base default medium-sized text style for monospace code snippets of technical content.",
3064+
"$deprecated": "Use text tokens instead."
30353065
},
30363066
"sm": {
30373067
"value": {
@@ -3042,7 +3072,8 @@
30423072
"textCase": "{font.text-case.none}"
30433073
},
30443074
"type": "typography",
3045-
"description": "Smaller text size for monospace code, suitable for inline references or less prominent code examples."
3075+
"description": "Smaller text size for monospace code, suitable for inline references or less prominent code examples.",
3076+
"$deprecated": "Use text tokens instead."
30463077
}
30473078
},
30483079
"inputs": {

0 commit comments

Comments
 (0)