UNPKG

style-dictionary-utils

Version:
24 lines (23 loc) 974 B
import { isStrokeStyleFilter } from '../filter/isStrokeStyle.js'; import { getValue } from '../utilities/getValue.js'; const StrokeStyleValues = ['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'outset', 'inset']; const transformStrokeStyleValue = (tokenValue) => { if (StrokeStyleValues.includes(tokenValue)) return tokenValue; // invalid stroke style value throw new Error(`Invalid value for strokeStyle${tokenValue ? `: ${tokenValue}` : ''}. Only the following values are supported: ${StrokeStyleValues.join(', ')}.`); }; /** * fontFamilyCss * @description if fontFamily is an array, join it with commas and wrap font names with spaces in quotes */ export const strokeStyleCss = { name: 'strokeStyle/css', type: `value`, transitive: true, filter: (token) => isStrokeStyleFilter(token), transform: (token) => { const tokenValue = getValue(token); return transformStrokeStyleValue(tokenValue); }, };