(value: string)
| 262 | } |
| 263 | |
| 264 | function parseGradient(value: string): { fn: string; args: string[] } | null { |
| 265 | const match = value.match(GRADIENT_FN_RE) |
| 266 | if (!match || match.index == null) return null |
| 267 | |
| 268 | const fn = match[1] |
| 269 | const start = value.indexOf('(', match.index) |
| 270 | if (start < 0) return null |
| 271 | |
| 272 | let depth = 0 |
| 273 | let end = -1 |
| 274 | for (let i = start; i < value.length; i += 1) { |
| 275 | const ch = value[i] |
| 276 | if (ch === '(') depth += 1 |
| 277 | else if (ch === ')') { |
| 278 | depth -= 1 |
| 279 | if (depth === 0) { |
| 280 | end = i |
| 281 | break |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | if (end < 0) return null |
| 286 | |
| 287 | const inner = value.slice(start + 1, end) |
| 288 | return { fn, args: splitByTopLevelComma(inner) } |
| 289 | } |
| 290 | |
| 291 | function formatPercent(pos: number): string { |
| 292 | const pct = Math.round(pos * 10000) / 100 |
no test coverage detected