fix(frontend-embed): 型チェックエラーを修正 (#15216)

* fix(frontend): frontend / frontend-embedにあるtsconfig.jsonのmoduleをES2022にする

* fixed errors

* fixed errors

* fixed errors

* fix(frontend-embed): 型チェックエラーを修正
This commit is contained in:
おさむのひと
2025-01-08 21:00:02 +09:00
committed by GitHub
parent bb4457266d
commit 13439e04c4
3 changed files with 16 additions and 12 deletions

View File

@@ -75,16 +75,21 @@ function compile(theme: Theme): Record<string, string> {
return getColor(theme.props[val]);
} else if (val[0] === ':') { // func
const parts = val.split('<');
const func = parts.shift().substring(1);
const arg = parseFloat(parts.shift());
const color = getColor(parts.join('<'));
const funcTxt = parts.shift();
const argTxt = parts.shift();
switch (func) {
case 'darken': return color.darken(arg);
case 'lighten': return color.lighten(arg);
case 'alpha': return color.setAlpha(arg);
case 'hue': return color.spin(arg);
case 'saturate': return color.saturate(arg);
if (funcTxt && argTxt) {
const func = funcTxt.substring(1);
const arg = parseFloat(argTxt);
const color = getColor(parts.join('<'));
switch (func) {
case 'darken': return color.darken(arg);
case 'lighten': return color.lighten(arg);
case 'alpha': return color.setAlpha(arg);
case 'hue': return color.spin(arg);
case 'saturate': return color.saturate(arg);
}
}
}