@@ -9,6 +9,8 @@ export interface TokenSchema {
99type AllowedTokenName =
1010 // This token does not exist in semantic tokens and is new to CAP.
1111 | `cap/${string } `
12+ // This token should exist in Fluent v9 (we expect it to be pushed upstream to fluent core).
13+ | `fluent-ext/${string } `
1214 // This token exists in semantic tokens v1
1315 | `smtc/v1/${string } `
1416 // This token exists in semantic tokens v2
@@ -21,11 +23,29 @@ export function formatCAPTokenCssVar(varName: string): string {
2123}
2224
2325/**
24- * Extensions to existing fluent tokens (we expect these to be pushed upstream to fluent core).
26+ * FluentExtendedTokens are tokens that should exist in Fluent v9 but don't yet.
27+ * We expect them to be pushed upstream to Fluent core, at which point you can swap them:
28+ *
29+ * ```ts
30+ * // before
31+ * borderRadius: CAP_TOKENS['fluent-ext/borderRadius2XLarge']
32+ *
33+ * // after
34+ * import { tokens } from '@fluentui/react-components';
35+ * borderRadius: tokens.borderRadius2XLarge
36+ * ```
2537 */
26- const tokensExt = {
27- borderRadius2XLarge : '12px' ,
28- } as const satisfies Record < string , string > ;
38+ const FluentExtendedTokens = {
39+ 'fluent-ext/borderRadius2XLarge' : { type : 'dimension' } ,
40+ } as const satisfies Record < AllowedTokenName , TokenSchema > ;
41+
42+ /**
43+ * ControlTokens are used across multiple components to control a particular aspect
44+ * of the design system (e.g. border radii).
45+ */
46+ const ControlTokens = {
47+ 'smtc/v1/ctrl/corner/rest' : { type : 'dimension' } ,
48+ } as const satisfies Record < AllowedTokenName , TokenSchema > ;
2949
3050const BadgeTokens = {
3151 'fixme/ctrl/badge/color-brand-foreground-compound' : { type : 'color' } ,
@@ -75,6 +95,8 @@ const TooltipTokens = {} as const satisfies Record<
7595> ;
7696
7797export const CAPTokensSchema = {
98+ ...FluentExtendedTokens ,
99+ ...ControlTokens ,
78100 ...BadgeTokens ,
79101 ...ButtonTokens ,
80102 ...CardTokens ,
@@ -93,15 +115,19 @@ export type CAPTheme = {
93115} ;
94116
95117export const CAP_THEME_DEFAULTS = {
96- ...tokensExt ,
118+ // fluent-ext
119+ 'fluent-ext/borderRadius2XLarge' : '12px' ,
120+
121+ // smtc/v1
122+ 'smtc/v1/ctrl/corner/rest' : CAP_TOKENS [ 'fluent-ext/borderRadius2XLarge' ] ,
97123
98124 // badge
99125 // TODO: switch to BrandForegroundCompound when available
100126 'fixme/ctrl/badge/color-brand-foreground-compound' :
101127 tokens . colorBrandForeground1 ,
102128
103129 // button
104- 'fixme/ctrl/button/corner-radius' : tokensExt . borderRadius2XLarge ,
130+ 'fixme/ctrl/button/corner-radius' : CAP_TOKENS [ 'smtc/v1/ctrl/corner/rest' ] ,
105131 'fixme/ctrl/button/primary-background-color' : tokens . colorBrandBackground ,
106132 'fixme/ctrl/button/primary-background-color-hover' :
107133 tokens . colorBrandBackgroundHover ,
0 commit comments