From 97d1c02a7962b43f050a9b0f15f9725100c02a58 Mon Sep 17 00:00:00 2001 From: horam-deriv <64075768+horam-deriv@users.noreply.github.com> Date: Fri, 17 Nov 2023 17:30:31 +0800 Subject: [PATCH] add the remaining files --- src/generators/tailwind/index.ts | 10 +++++++--- src/transformers/tailwind.transformers.ts | 13 ++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/generators/tailwind/index.ts b/src/generators/tailwind/index.ts index 003b599..16f5217 100644 --- a/src/generators/tailwind/index.ts +++ b/src/generators/tailwind/index.ts @@ -13,6 +13,7 @@ import { stringValueTransformer, tailwindTransforms, tokenPathTransformer, + mobileColorTransformer, } from '../../transformers/tailwind.transformers'; import { makeFontStylesAction, makeStylesAction } from '../../actions/tailwind.actions'; import { desktopTargetFormatter } from '../../formatters/desktop-target.formatter'; @@ -30,6 +31,7 @@ StyleDictionary.registerAction(makeFontStylesAction); StyleDictionary.registerFormat(desktopTargetFormatter); StyleDictionary.registerTransform(stringValueTransformer); StyleDictionary.registerFormat(TokenNamesFormatter); +StyleDictionary.registerTransform(mobileColorTransformer); export const CoreSdConfig = StyleDictionary.extend({ source: [RAW_CORE_SOURCE_FOLDER], @@ -100,7 +102,8 @@ export const SemanticLightMobileConfig = StyleDictionary.extend({ source: [RAW_CORE_SOURCE_FOLDER, `${RAW_TOKENS_BASE_FOLDER}/semantic/theme/light.json`], platforms: { semantic_mobile_flutter_light: { - transforms: [...TokenStudioTransforms, 'deriv/mobile-color', 'color/hex8flutter'], + // Todo(Horam): remove the commented code before merging the PR. + transforms:['color/hex8flutter'], //[...TokenStudioTransforms,], // 'deriv/mobile-color', 'color/hex8flutter' buildPath: QUILL_TAILWIND_BUILD_PATH, files: [ { @@ -121,13 +124,14 @@ export const SemanticDarkMobileConfig = StyleDictionary.extend({ source: [RAW_CORE_SOURCE_FOLDER, `${RAW_TOKENS_BASE_FOLDER}/semantic/theme/dark.json`], platforms: { semantic_mobile_flutter_dark: { - transforms: [...TokenStudioTransforms, 'deriv/mobile-color', 'color/hex8flutter'], + // Todo(Horam): remove the commented code before merging the PR. + transforms: ['deriv/mobile-color'],//[...TokenStudioTransforms, ], // 'deriv/mobile-color', 'color/hex8flutter' buildPath: QUILL_TAILWIND_BUILD_PATH, files: [ { destination: 'mobile_dark_colors.dart', format: 'flutter/class.dart', - filter: (token) => token.path.includes('semantic'), + filter: (token) => token.path.includes('semantic'), options: { outputReferences: false, showFileHeader: false, diff --git a/src/transformers/tailwind.transformers.ts b/src/transformers/tailwind.transformers.ts index 97f0642..ab0b4ba 100644 --- a/src/transformers/tailwind.transformers.ts +++ b/src/transformers/tailwind.transformers.ts @@ -35,12 +35,16 @@ export const spacingNameTransformer: Named = { transformer: (token) => token.path.join('-'), }; -export const mobileColorTransforner: Named = { +export const mobileColorTransformer: Named = { name: 'deriv/mobile-color', type: 'value', - matcher:(token)=>token.type === 'color', - transformer: (token)=> token.value, - + matcher:(token)=> token.type === 'color', + transformer: (token)=>{ + // Todo (Horam): remove commented codes. + // console.log(token.name); + // console.log(token.path); + return token.value; + }, }; export const tokenPathTransformer: Named = { @@ -96,7 +100,6 @@ export const tailwindTransforms = [ 'deriv/spacing-name', 'deriv/token-path', 'deriv/tw/string-value', - 'deriv/mobile-color', ]; export const tailwindTransferGroup: Named = {