MCPcopy Index your code
hub / github.com/codeaashu/claude-code / applyDimensionStyles

Function applyDimensionStyles

src/ink/styles.ts:630–682  ·  view source on GitHub ↗
(node: LayoutNode, style: Styles)

Source from the content-addressed store, hash-verified

628}
629
630const applyDimensionStyles = (node: LayoutNode, style: Styles): void => {
631 if ('width' in style) {
632 if (typeof style.width === 'number') {
633 node.setWidth(style.width)
634 } else if (typeof style.width === 'string') {
635 node.setWidthPercent(Number.parseInt(style.width, 10))
636 } else {
637 node.setWidthAuto()
638 }
639 }
640
641 if ('height' in style) {
642 if (typeof style.height === 'number') {
643 node.setHeight(style.height)
644 } else if (typeof style.height === 'string') {
645 node.setHeightPercent(Number.parseInt(style.height, 10))
646 } else {
647 node.setHeightAuto()
648 }
649 }
650
651 if ('minWidth' in style) {
652 if (typeof style.minWidth === 'string') {
653 node.setMinWidthPercent(Number.parseInt(style.minWidth, 10))
654 } else {
655 node.setMinWidth(style.minWidth ?? 0)
656 }
657 }
658
659 if ('minHeight' in style) {
660 if (typeof style.minHeight === 'string') {
661 node.setMinHeightPercent(Number.parseInt(style.minHeight, 10))
662 } else {
663 node.setMinHeight(style.minHeight ?? 0)
664 }
665 }
666
667 if ('maxWidth' in style) {
668 if (typeof style.maxWidth === 'string') {
669 node.setMaxWidthPercent(Number.parseInt(style.maxWidth, 10))
670 } else {
671 node.setMaxWidth(style.maxWidth ?? 0)
672 }
673 }
674
675 if ('maxHeight' in style) {
676 if (typeof style.maxHeight === 'string') {
677 node.setMaxHeightPercent(Number.parseInt(style.maxHeight, 10))
678 } else {
679 node.setMaxHeight(style.maxHeight ?? 0)
680 }
681 }
682}
683
684const applyDisplayStyles = (node: LayoutNode, style: Styles): void => {
685 if ('display' in style) {

Callers 1

stylesFunction · 0.85

Calls 14

setWidthMethod · 0.45
setWidthPercentMethod · 0.45
setWidthAutoMethod · 0.45
setHeightMethod · 0.45
setHeightPercentMethod · 0.45
setHeightAutoMethod · 0.45
setMinWidthPercentMethod · 0.45
setMinWidthMethod · 0.45
setMinHeightPercentMethod · 0.45
setMinHeightMethod · 0.45
setMaxWidthPercentMethod · 0.45
setMaxWidthMethod · 0.45

Tested by

no test coverage detected