UNPKG

@tokens-studio/graph-engine

Version:

An execution engine to handle Token Studios generators and resolvers

29 lines 1.01 kB
import { Node } from '../../programmatic/node.js'; import { StringSchema } from '../../schemas/index.js'; import cssFunctionsData from 'mdn-data/css/functions.json' with { type: 'json' }; const FUNCTION_NAMES = Object.keys(cssFunctionsData); export default class NodeDefinition extends Node { static title = 'CSS Function'; static type = 'studio.tokens.css.function'; static description = 'Applies a CSS function to the value'; constructor(props) { super(props); this.addInput('functionName', { type: { ...StringSchema, enum: FUNCTION_NAMES } }); this.addInput('value', { type: StringSchema }); this.addOutput('value', { type: StringSchema }); } execute() { const { functionName, value } = this.getAllInputs(); this.outputs.value.set(String(functionName).replace('()', `(${value})`)); } } //# sourceMappingURL=cssFunction.js.map