( styles: Record<string, string | number>, )
| 269 | * fallback so borders show up immediately after setting a width. |
| 270 | */ |
| 271 | export function ensureBorderStyleFallback( |
| 272 | styles: Record<string, string | number>, |
| 273 | ): Record<string, string | number> { |
| 274 | for (const [widthKey, styleKey] of Object.entries(BORDER_WIDTH_TO_STYLE)) { |
| 275 | const widthValue = styles[widthKey]; |
| 276 | if (!widthValue || widthValue === '0' || widthValue === '0px') { |
| 277 | continue; |
| 278 | } |
| 279 | if (!styles[styleKey]) { |
| 280 | // Keep shorthand borderStyle authoritative for each side when present. |
| 281 | if (styleKey !== 'borderStyle' && styles.borderStyle) { |
| 282 | continue; |
| 283 | } |
| 284 | styles[styleKey] = 'solid'; |
| 285 | } |
| 286 | } |
| 287 | return styles; |
| 288 | } |
| 289 | |
| 290 | /** |
| 291 | * Resolves conflicts between reset styles and inline styles by expanding |
no outgoing calls
no test coverage detected