Extended Type Functionality and Adapted for newer DTCG format #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for additional token types and improves compatibility with both legacy and modern token formats. It adds handling for
fontSize,borderRadius,lineHeight,letterSpacing,fontFamily, andfontWeighttokens, and ensures that bothtype/valueand$type/$valueproperties are supported. The update also includes utility functions for font and line height conversions and improves robustness in token alias and value handling.This update was prompted to support more token types and kept all previous functionality.
Token Type Support and Handling:
fontSize,borderRadius,lineHeight,letterSpacing,fontFamily,fontWeight) throughout the import pipeline and token type resolution, including mapping to Figma types and value conversions. [1] [2] [3] [4]JsonTokeninterface and related type guards to support both legacy ($type,$value,$extensions) and modern (type,value,extensions) token property formats, ensuring backward compatibility. [1] [2]Utility Functions for Value Conversion:
extractFirstFontFamilyto parse the first font family from a CSS string,mapFontWeightto map numeric font weights to Figma-friendly names, andconvertLineHeightPercentageToMultiplierto convert line height percentages to multipliers. [1] [2] [3]convertRemToPxto convertremvalues to pixel values for font size tokens.Robustness and Error Handling:
valueand$valueproperties, and clarified error messages for missing or unsupported tokens. [1] [2] [3]Dependency Updates:
@figma/plugin-typingsto the latest version and replacednode-sasswithsassin the development dependencies for better compatibility and maintenance. [1] [2]