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.

50 lines (49 loc) 1.99 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.jsTailwindPropsFormat = exports.tailwindcssAspetctRationTransform = exports.tailwindPxToRemTransform = void 0; /* eslint-disable quote-props */ const handlebars_1 = __importDefault(require("handlebars")); const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const helpers_1 = require("../helpers"); const package_json_1 = require("../../../package.json"); const templatePath = path_1.default.resolve(__dirname, './template.hbs'); const template = handlebars_1.default.compile(fs_1.default.readFileSync(templatePath).toString()); handlebars_1.default.registerHelper('getSafeFontName', helpers_1.safeString); handlebars_1.default.registerHelper('ifEquals', helpers_1.ifEquals); handlebars_1.default.registerHelper('ifTailwindFontSizeProp', helpers_1.ifTailwindFontSizeProp); handlebars_1.default.registerHelper('tailwindFontSize', helpers_1.tailwindFontSize); exports.tailwindPxToRemTransform = { name: 'tailwind/pxToRem', type: 'value', matcher: token => { return String(token.value).endsWith('px'); }, transformer: function (token) { return (0, helpers_1.pixelToRem)(token.value); }, }; exports.tailwindcssAspetctRationTransform = { name: 'tailwind/cssAspectRatio', type: 'value', matcher: token => { return String(token.value).includes(':'); }, transformer: function (token) { return token.value.replace(':', '/'); }, }; exports.jsTailwindPropsFormat = { name: 'js/tailwind-props', formatter: ({ dictionary, platform }) => { return template({ properties: dictionary.properties, date: new Date().toUTCString(), options: platform, version: package_json_1.version, }); }, };