(classRoot: string, desc: BorderDescription)
| 2430 | } |
| 2431 | |
| 2432 | function borderSideUtility(classRoot: string, desc: BorderDescription) { |
| 2433 | utilities.functional(classRoot, (candidate) => { |
| 2434 | if (!candidate.value) { |
| 2435 | if (candidate.modifier) return |
| 2436 | let value = theme.get(['--default-border-width']) ?? '1px' |
| 2437 | let decls = desc.width(value) |
| 2438 | if (!decls) return |
| 2439 | return [borderProperties(), ...decls] |
| 2440 | } |
| 2441 | |
| 2442 | if (candidate.value.kind === 'arbitrary') { |
| 2443 | let value: string | null = candidate.value.value |
| 2444 | let type = |
| 2445 | candidate.value.dataType ?? inferDataType(value, ['color', 'line-width', 'length']) |
| 2446 | |
| 2447 | switch (type) { |
| 2448 | case 'line-width': |
| 2449 | case 'length': { |
| 2450 | if (candidate.modifier) return |
| 2451 | let decls = desc.width(value) |
| 2452 | if (!decls) return |
| 2453 | return [borderProperties(), ...decls] |
| 2454 | } |
| 2455 | default: { |
| 2456 | value = asColor(value, candidate.modifier, theme) |
| 2457 | if (value === null) return |
| 2458 | |
| 2459 | return desc.color(value) |
| 2460 | } |
| 2461 | } |
| 2462 | } |
| 2463 | |
| 2464 | // `border-color` property |
| 2465 | { |
| 2466 | let value = resolveThemeColor(candidate, theme, ['--border-color', '--color']) |
| 2467 | if (value) { |
| 2468 | return desc.color(value) |
| 2469 | } |
| 2470 | } |
| 2471 | |
| 2472 | // `border-width` property |
| 2473 | { |
| 2474 | if (candidate.modifier) return |
| 2475 | let value = theme.resolve(candidate.value.value, ['--border-width']) |
| 2476 | if (value) { |
| 2477 | let decls = desc.width(value) |
| 2478 | if (!decls) return |
| 2479 | return [borderProperties(), ...decls] |
| 2480 | } |
| 2481 | |
| 2482 | if (isPositiveInteger(candidate.value.value)) { |
| 2483 | let decls = desc.width(`${candidate.value.value}px`) |
| 2484 | if (!decls) return |
| 2485 | return [borderProperties(), ...decls] |
| 2486 | } |
| 2487 | } |
| 2488 | }) |
| 2489 |
no test coverage detected