(value: string)
| 411 | } |
| 412 | |
| 413 | function extractLeadingGradient(value: string): string | null { |
| 414 | const input = value.trim() |
| 415 | if (!input) return null |
| 416 | |
| 417 | const lower = input.toLowerCase() |
| 418 | if (!GRADIENT_FUNCTION_PREFIXES.some((prefix) => lower.startsWith(prefix))) { |
| 419 | return null |
| 420 | } |
| 421 | |
| 422 | let depth = 0 |
| 423 | let quote: '"' | "'" | null = null |
| 424 | |
| 425 | for (let i = 0; i < input.length; i++) { |
| 426 | const ch = input[i] |
| 427 | |
| 428 | if (quote) { |
| 429 | if (ch === '\\') { |
| 430 | i++ |
| 431 | continue |
| 432 | } |
| 433 | if (ch === quote) quote = null |
| 434 | continue |
| 435 | } |
| 436 | |
| 437 | if (ch === '"' || ch === "'") { |
| 438 | quote = ch |
| 439 | continue |
| 440 | } |
| 441 | |
| 442 | if (ch === '(') { |
| 443 | depth++ |
| 444 | continue |
| 445 | } |
| 446 | |
| 447 | if (ch === ')') { |
| 448 | depth = Math.max(0, depth - 1) |
| 449 | if (depth === 0) { |
| 450 | return input.slice(0, i + 1).trim() |
| 451 | } |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | return null |
| 456 | } |
| 457 | |
| 458 | function getBorderWidth(style: Record<string, string>): string | null { |
| 459 | if (style.border) { |
no outgoing calls
no test coverage detected