/** * Maps token files to Tailwind theme properties * This mapper is similar to tokenFilesMapper.ts but specific to Tailwind's theme structure * * @see https://github.com/tailwindlabs/tailwindcss/blob/v3/stubs/config.full.js * For the full list of Tailwind theme properties */ type TailwindThemeProperty = | 'core' | 'colors' | 'fontFamily' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'spacing' | 'borderRadius' | 'borderWidth' | 'boxShadow' | 'transitionDuration' | 'transitionTimingFunction'; export interface TailwindTokenMapping { themeProperty: TailwindThemeProperty; fileMatchPattern: string | RegExp; } export const tailwindTokenFilesMapper: TailwindTokenMapping[] = [ // Colors { themeProperty: 'colors', fileMatchPattern: 'tokens/core/color.json', }, { themeProperty: 'colors', fileMatchPattern: /tokens\/color\/.*/, }, // Typography { themeProperty: 'fontFamily', fileMatchPattern: 'tokens/core/font-family.json', }, { themeProperty: 'fontFamily', fileMatchPattern: 'tokens/typography/font-family.json', }, { themeProperty: 'fontSize', fileMatchPattern: 'tokens/core/typescale.json', }, { themeProperty: 'fontSize', fileMatchPattern: 'tokens/typography/font-size.json', }, { themeProperty: 'fontWeight', fileMatchPattern: 'tokens/core/font-weight.json', }, { themeProperty: 'fontWeight', fileMatchPattern: 'tokens/typography/font-weight.json', }, { themeProperty: 'lineHeight', fileMatchPattern: 'tokens/typography/line-height.json', }, // Spacing & Layout { themeProperty: 'spacing', fileMatchPattern: /tokens\/(size|layout)\/(area|grid|safe-area|dimension|indent|offset|padding|spacing|target)\.json/, }, // Borders & Radius { themeProperty: 'borderRadius', fileMatchPattern: 'tokens/size/radius.json', }, { themeProperty: 'borderWidth', fileMatchPattern: 'tokens/size/border.json', }, // Shadows { themeProperty: 'boxShadow', fileMatchPattern: 'tokens/elevation/elevation.json', }, // Transitions { themeProperty: 'transitionDuration', fileMatchPattern: 'tokens/core/transition-duration.json', }, { themeProperty: 'transitionDuration', fileMatchPattern: 'tokens/transition/duration.json', }, { themeProperty: 'transitionTimingFunction', fileMatchPattern: 'tokens/core/transition-easing.json', }, { themeProperty: 'transitionTimingFunction', fileMatchPattern: 'tokens/transition/easing.json', }, ];