Repository: motion-canvas/motion-canvas
File: packages/2d/src/components/Layout.ts (TypeScript)

Code before:
    this.element.style.columnGap = this.parseLength(this.columnGap());
    this.element.style.gap = this.parseLength(this.gap());

    if (this.sizeLockCounter() > 0) {
      this.element.style.flexGrow = '0';
      this.element.style.flexShrink = '0';
    } else {
      this.element.style.flexGrow = this.grow().toString();
      this.element.style.flexShrink = this.shrink().toString();
    }
  }

  @computed()
  protected applyFont() {
    this.element.style.fontFamily = this.fontFamily.isInitial()
      ? ''
      : this.fontFamily();
    this.element.style.fontSize = this.fontSize.isInitial()
      ? ''
      : `${this.fontSize()}px`;
    this.element.style.fontStyle = this.fontStyle.isInitial()
      ? ''
      : this.fontStyle();
    this.element.style.lineHeight =
      typeof this.lineHeight() === 'string'
        ? String(Number((this.lineHeight() as string).slice(0, -1)) / 100)
        : `${this.lineHeight()}px`;
    this.element.style.fontWeight = this.fontWeight.isInitial()
      ? ''
      : this.fontWeight().toString();
    this.element.style.letterSpacing = this.letterSpacing.isInitial()
      ? ''
      : this.letterSpacing() === 'normal'
      ? 'normal'
      : `${this.letterSpacing()}px`;

    if (this.textWrap.isInitial()) {
      this.element.style.whiteSpace = '';
    } else {
      const wrap = this.textWrap();
      if (typeof wrap === 'boolean') {
        this.element.style.whiteSpace = wrap ? 'normal' : 'nowrap';
      } else {
        this.element.style.whiteSpace = wrap;
      }
    }
  }

  public override hit(position: Vector2): Node | null {
    const local = position.transformAsPoint(this.localToParent().inverse());
    if (this.cacheRect().includes(local)) {

Review comment (suggestion):
The rest of the code base uses `parseFloat`, `parseInt` and `toString`, so we should try to be consistent:
```suggestion
        ? (parseFloat(this.lineHeight() as string) / 100).toString()
```

Code after:
    this.element.style.columnGap = this.parseLength(this.columnGap());
    this.element.style.gap = this.parseLength(this.gap());

    if (this.sizeLockCounter() > 0) {
      this.element.style.flexGrow = '0';
      this.element.style.flexShrink = '0';
    } else {
      this.element.style.flexGrow = this.grow().toString();
      this.element.style.flexShrink = this.shrink().toString();
    }
  }

  @computed()
  protected applyFont() {
    this.element.style.fontFamily = this.fontFamily.isInitial()
      ? ''
      : this.fontFamily();
    this.element.style.fontSize = this.fontSize.isInitial()
      ? ''
      : `${this.fontSize()}px`;
    this.element.style.fontStyle = this.fontStyle.isInitial()
      ? ''
      : this.fontStyle();
    this.element.style.lineHeight =
      typeof this.lineHeight() === 'string'
        ? (parseFloat(this.lineHeight() as string) / 100).toString()
        : `${this.lineHeight()}px`;
    this.element.style.fontWeight = this.fontWeight.isInitial()
      ? ''
      : this.fontWeight().toString();
    this.element.style.letterSpacing = this.letterSpacing.isInitial()
      ? ''
      : this.letterSpacing() === 'normal'
      ? 'normal'
      : `${this.letterSpacing()}px`;

    if (this.textWrap.isInitial()) {
      this.element.style.whiteSpace = '';
    } else {
      const wrap = this.textWrap();
      if (typeof wrap === 'boolean') {
        this.element.style.whiteSpace = wrap ? 'normal' : 'nowrap';
      } else {
        this.element.style.whiteSpace = wrap;
      }
    }
  }

  public override hit(position: Vector2): Node | null {
    const local = position.transformAsPoint(this.localToParent().inverse());
    if (this.cacheRect().includes(local)) {