( config: MD3FontsConfig )
| 79 | } |
| 80 | |
| 81 | function configureV3Fonts( |
| 82 | config: MD3FontsConfig |
| 83 | ): MD3Typescale | (MD3Typescale & { [key: string]: MD3Type }) { |
| 84 | if (!config) { |
| 85 | return typescale; |
| 86 | } |
| 87 | |
| 88 | const isFlatConfig = Object.keys(config).every( |
| 89 | (key) => typeof config[key as keyof typeof config] !== 'object' |
| 90 | ); |
| 91 | |
| 92 | if (isFlatConfig) { |
| 93 | return Object.fromEntries( |
| 94 | Object.entries(typescale).map(([variantName, variantProperties]) => [ |
| 95 | variantName, |
| 96 | { ...variantProperties, ...config }, |
| 97 | ]) |
| 98 | ) as MD3Typescale; |
| 99 | } |
| 100 | |
| 101 | return Object.assign( |
| 102 | {}, |
| 103 | typescale, |
| 104 | ...Object.entries(config).map(([variantName, variantProperties]) => ({ |
| 105 | [variantName]: { |
| 106 | ...typescale[variantName as MD3TypescaleKey], |
| 107 | ...variantProperties, |
| 108 | }, |
| 109 | })) |
| 110 | ); |
| 111 | } |
| 112 | |
| 113 | // eslint-disable-next-line no-redeclare |
| 114 | export default function configureFonts(params: { isV3: false }): Fonts; |
no outgoing calls
no test coverage detected
searching dependent graphs…