MCPcopy Create free account
hub / github.com/codeaashu/claude-code / parseDimension

Function parseDimension

src/native-ts/yoga-layout/index.ts:2511–2526  ·  view source on GitHub ↗
(v: number | string | undefined)

Source from the content-addressed store, hash-verified

2509// Helpers
2510
2511function 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
2528function physicalEdge(edge: Edge): number {
2529 switch (edge) {

Callers 11

setWidthMethod · 0.85
setHeightMethod · 0.85
setMinWidthMethod · 0.85
setMinHeightMethod · 0.85
setMaxWidthMethod · 0.85
setMaxHeightMethod · 0.85
setFlexBasisMethod · 0.85
setPositionMethod · 0.85
setMarginMethod · 0.85
setPaddingMethod · 0.85
setGapMethod · 0.85

Calls 2

pointValueFunction · 0.85
percentValueFunction · 0.85

Tested by

no test coverage detected