UNPKG

@maggioli-design-system/design-tokens

Version:

This is the Design Token library of Maggioli Design System, here you'll find all the visual data used around the libraries.

48 lines (47 loc) 1.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.flutterTextThemeVariant = exports.ifFlutterTextThemeVariant = exports.ifFlutterCompatible = void 0; const magmaToFlutterMap = new Map([ ['title-h1', 'displayLarge'], ['title-h2', 'displayMedium'], ['title-h3', 'displaySmall'], ['title-h4', 'headlineLarge'], ['title-h5', 'headlineMedium'], ['title-h6', 'headlineSmall'], ['title-action', 'labelLarge'], ['info-detail', 'bodyMedium'], ['info-detail-bold', 'titleMedium'], ['info-caption', 'bodySmall'], ['info-caption-bold', 'titleSmall'], ['info-label', 'labelMedium'], ['info-option', 'labelSmall'], ['read-paragraph', 'bodyLarge'], ['read-paragraph-bold', 'titleLarge'], ]); const ifFlutterCompatible = (...args) => { // l'ultimo argomento passato alla funzione e' sempre options const options = args.pop(); const magmaFont = args.toString().replace(/,/g, '-'); return magmaToFlutterMap.has(magmaFont) ? options.fn(this) : options.inverse(this); }; exports.ifFlutterCompatible = ifFlutterCompatible; const ifFlutterTextThemeVariant = (property, options) => { const attributes = [ 'fontFamily', 'fontFamilyFallback', 'fontSize', 'letterSpacing', 'lineHeight', 'fontWeight', ]; return attributes.includes(property) ? options.fn(this) : options.inverse(this); }; exports.ifFlutterTextThemeVariant = ifFlutterTextThemeVariant; const flutterTextThemeVariant = (...args) => { // l'ultimo argomento passato alla funzione e' sempre options // e non viene utilizzato in questa funzione cosi lo si toglie da args args.pop(); const magmaFont = args.toString().replace(/,/g, '-'); return magmaToFlutterMap.get(magmaFont); }; exports.flutterTextThemeVariant = flutterTextThemeVariant;