(v: number | string | undefined)
| 2509 | // Helpers |
| 2510 | |
| 2511 | function parseDimension(v: number | string | undefined): Value { |
| 2512 | if (v === undefined) return UNDEFINED_VALUE |
| 2513 | if (v === 'auto') return AUTO_VALUE |
| 2514 | if (typeof v === 'number') { |
| 2515 | // WASM yoga's YGFloatIsUndefined treats NaN and ±Infinity as undefined. |
| 2516 | // Ink passes height={Infinity} (e.g. LogSelector maxHeight default) and |
| 2517 | // expects it to mean "unconstrained" — storing it as a literal point value |
| 2518 | // makes the node height Infinity and breaks all downstream layout. |
| 2519 | return Number.isFinite(v) ? pointValue(v) : UNDEFINED_VALUE |
| 2520 | } |
| 2521 | if (typeof v === 'string' && v.endsWith('%')) { |
| 2522 | return percentValue(parseFloat(v)) |
| 2523 | } |
| 2524 | const n = parseFloat(v) |
| 2525 | return isNaN(n) ? UNDEFINED_VALUE : pointValue(n) |
| 2526 | } |
| 2527 | |
| 2528 | function physicalEdge(edge: Edge): number { |
| 2529 | switch (edge) { |
no test coverage detected