New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tfk-samf/figma-to-dtcg

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tfk-samf/figma-to-dtcg - npm Package Compare versions

Comparing version 0.3.8 to 0.4.0

5

dist/index.d.ts

@@ -32,4 +32,5 @@ import { RGB, LocalVariable, GetLocalVariablesResponse } from '@figma/rest-api-spec';

};
export type Options = {
export type Options<Collection> = {
verbosity?: 'silent' | 'verbose';
typeMap?: Record<FigmaTokenType, (category: Collection) => string>;
};

@@ -92,5 +93,5 @@ export type DesignTokenType = 'color' | 'number' | 'fontFamily' | 'boolean';

*/
declare function useFigmaToDTCG<Themes extends string = any, Variants extends string = any, SharedCollections extends string = any, InvariantCollections extends string = any, VariantCollections extends string = any>(props: RestAPIProps | PluginAPIProps, options?: Options): Promise<{
declare function useFigmaToDTCG<Themes extends string = any, Variants extends string = any, SharedCollections extends string = any, InvariantCollections extends string = any, VariantCollections extends string = any>(props: RestAPIProps | PluginAPIProps, options?: Options<SharedCollections | InvariantCollections | VariantCollections>): Promise<{
tokens: Tokens<Themes, Variants, SharedCollections, InvariantCollections, VariantCollections>;
}>;
export { useFigmaToDTCG };

24

dist/index.js
/* eslint-disable @typescript-eslint/no-explicit-any */
const figmaDesignTokenTypeMap = {
COLOR: 'color',
FLOAT: 'number',
STRING: 'fontFamily',
BOOLEAN: 'boolean',
let globalOptions;
const defaultOptions = {
verbosity: 'silent',
typeMap: {
COLOR: () => 'color',
FLOAT: () => 'number',
STRING: () => 'fontFamily',
BOOLEAN: () => 'boolean',
},
};
let globalOptions = {};
const isVerbose = () => globalOptions.verbosity === 'verbose';

@@ -175,3 +178,3 @@ let getVariableById;

obj.value = objValue;
obj.type = figmaDesignTokenTypeMap[resolvedType];
obj.type = globalOptions.typeMap[resolvedType](sanitizeName(collectionName));
obj.prefix = collectionPrefix;

@@ -213,4 +216,7 @@ }

*/
async function useFigmaToDTCG(props, options = { verbosity: 'silent' }) {
globalOptions = options;
async function useFigmaToDTCG(props, options) {
globalOptions = {
...defaultOptions,
...options,
};
const isRestApiEnv = (p) => p.api === 'rest';

@@ -217,0 +223,0 @@ getVariableById = isRestApiEnv(props)

{
"name": "@tfk-samf/figma-to-dtcg",
"version": "0.3.8",
"version": "0.4.0",
"description": "Parse Figma Variables Plugin API and REST API into design tokens.",

@@ -35,3 +35,3 @@ "files": [

},
"gitHead": "b50bedaad4e5b8e6c10c2a3550ed8491f832ed06"
"gitHead": "1742bde862d47482df3a0ce8c7a826c5d8ea6f28"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc