diff --git a/example/tokens/colors.ts b/example/tokens/colors.ts index 34fb798..fe543dd 100644 --- a/example/tokens/colors.ts +++ b/example/tokens/colors.ts @@ -66,4 +66,4 @@ export const light = { "muted1": "#8e8e93" }; -export type Token = "backdrop" | "background" | "border" | "elevated" | "error" | "errorMuted" | "errorText" | "focusRing" | "hoverHighlight" | "info" | "infoMuted" | "infoText" | "muted1" | "muted2" | "muted3" | "muted4" | "muted5" | "muted6" | "pressHighlight" | "primary" | "primaryMuted" | "primaryText" | "success" | "successMuted" | "successText" | "surface" | "text" | "textMuted" | "warn" | "warnMuted" | "warnText"; +export type ColorsToken = "backdrop" | "background" | "border" | "elevated" | "error" | "errorMuted" | "errorText" | "focusRing" | "hoverHighlight" | "info" | "infoMuted" | "infoText" | "muted1" | "muted2" | "muted3" | "muted4" | "muted5" | "muted6" | "pressHighlight" | "primary" | "primaryMuted" | "primaryText" | "success" | "successMuted" | "successText" | "surface" | "text" | "textMuted" | "warn" | "warnMuted" | "warnText"; diff --git a/example/tokens/icons.ts b/example/tokens/icons.ts index 31fd462..e7a4308 100644 --- a/example/tokens/icons.ts +++ b/example/tokens/icons.ts @@ -54,4 +54,4 @@ export const userCicleOutline = ""; export const x = ""; -export type Token = "arrowDown" | "arrowLeft" | "arrowRight" | "arrowUp" | "bell" | "calendar" | "camera" | "checkmark" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "clock" | "ellipsisHorizontal" | "ellipsisVertical" | "envelope" | "envelopeFilled" | "eyeFilled" | "eyeOutline" | "faceNeutral" | "faceSmile" | "filter" | "fullBody" | "graduationCapFilled" | "graduationCapOutline" | "heartFilled" | "heartOutlined" | "homeFilled" | "homeOutline" | "language" | "languageGlobe" | "lightningFilled" | "lightningOutline" | "logout" | "movieFilled" | "movieOpenFilled" | "movieOpenOutline" | "movieOutline" | "paperclip" | "pencil" | "phone" | "piggybank" | "pin" | "plus" | "questionMark" | "questionMarkFull" | "search" | "send" | "sortVertical" | "trash" | "userCicleFilled" | "userCicleOutline" | "warningTriangle" | "x"; +export type IconsToken = "arrowDown" | "arrowLeft" | "arrowRight" | "arrowUp" | "bell" | "calendar" | "camera" | "checkmark" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "clock" | "ellipsisHorizontal" | "ellipsisVertical" | "envelope" | "envelopeFilled" | "eyeFilled" | "eyeOutline" | "faceNeutral" | "faceSmile" | "filter" | "fullBody" | "graduationCapFilled" | "graduationCapOutline" | "heartFilled" | "heartOutlined" | "homeFilled" | "homeOutline" | "language" | "languageGlobe" | "lightningFilled" | "lightningOutline" | "logout" | "movieFilled" | "movieOpenFilled" | "movieOpenOutline" | "movieOutline" | "paperclip" | "pencil" | "phone" | "piggybank" | "pin" | "plus" | "questionMark" | "questionMarkFull" | "search" | "send" | "sortVertical" | "trash" | "userCicleFilled" | "userCicleOutline" | "warningTriangle" | "x"; diff --git a/example/tokens/radii.ts b/example/tokens/radii.ts index a047d4b..a48f2f0 100644 --- a/example/tokens/radii.ts +++ b/example/tokens/radii.ts @@ -5,4 +5,4 @@ export const medium = 16; export const normal = 8; export const small = 4; -export type Token = "full" | "large" | "medium" | "normal" | "small"; +export type RadiiToken = "full" | "large" | "medium" | "normal" | "small"; diff --git a/example/tokens/shadows.ts b/example/tokens/shadows.ts index 1f81b7d..48c17a3 100644 --- a/example/tokens/shadows.ts +++ b/example/tokens/shadows.ts @@ -52,4 +52,4 @@ export const shadowSmall = { } }; -export type Token = "shadowLarge" | "shadowMedium" | "shadowNormal" | "shadowSmall"; +export type ShadowsToken = "shadowLarge" | "shadowMedium" | "shadowNormal" | "shadowSmall"; diff --git a/example/tokens/sizing.ts b/example/tokens/sizing.ts index f79a37b..92b682f 100644 --- a/example/tokens/sizing.ts +++ b/example/tokens/sizing.ts @@ -8,4 +8,4 @@ export const iconSizeLarge = 32; export const iconSizeNormal = 24; export const iconSizeSmall = 16; -export type Token = "buttonHeightLarge" | "buttonHeightNormal" | "buttonHeightSmall" | "focusRingOffset" | "focusRingSize" | "iconSizeLarge" | "iconSizeNormal" | "iconSizeSmall"; +export type SizingToken = "buttonHeightLarge" | "buttonHeightNormal" | "buttonHeightSmall" | "focusRingOffset" | "focusRingSize" | "iconSizeLarge" | "iconSizeNormal" | "iconSizeSmall"; diff --git a/example/tokens/spacing.ts b/example/tokens/spacing.ts index 558ce94..550e7d7 100644 --- a/example/tokens/spacing.ts +++ b/example/tokens/spacing.ts @@ -9,4 +9,4 @@ export const xxlarge = 56; export const xxsmall = 4; export const xxxlarge = 72; -export type Token = "large" | "medium" | "normal" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | "xxxlarge"; +export type SpacingToken = "large" | "medium" | "normal" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | "xxxlarge"; diff --git a/example/tokens/typography.ts b/example/tokens/typography.ts index e70ff52..6427197 100644 --- a/example/tokens/typography.ts +++ b/example/tokens/typography.ts @@ -172,4 +172,4 @@ export const web = { } }; -export type Token = "body" | "bodyBold" | "bodyLarge" | "bodyLargeBold" | "bodySmall" | "bodySmallBold" | "caption" | "overline" | "subtitle" | "title1" | "title2" | "title3"; +export type TypographyToken = "body" | "bodyBold" | "bodyLarge" | "bodyLargeBold" | "bodySmall" | "bodySmallBold" | "caption" | "overline" | "subtitle" | "title1" | "title2" | "title3"; diff --git a/src/codegen.js b/src/codegen.js index 2516bf8..e02facf 100644 --- a/src/codegen.js +++ b/src/codegen.js @@ -96,7 +96,7 @@ export default class Codegen { fs.writeFileSync( `${outDir}/${filename}.${config.filetype}`, - compiled({ tokens, tokenNames: Array.from(tokenNames).sort() }) + compiled({ name, tokens, tokenNames: Array.from(tokenNames).sort() }) ); } @@ -185,7 +185,7 @@ const TOKEN_TEMPLATE = "<% tokens.forEach(function(x) { %>" + "export const <%= x[0] %> = <%= JSON.stringify(x[1], null, 2) %>;\n" + "<% }); %>\n" + - "export type Token = " + + "export type <%= name.charAt(0).toUpperCase() + name.slice(1) %>Token = " + "<%= tokenNames.map(t => JSON.stringify(t)).join(' | ') %>;\n"; const SVG_SPRITE_TEMPLATE =