Skip to content

fix(masonkit): resolve CSS font-weight bolder and lighter keywords - #252

Open
herefishyfish wants to merge 2 commits into
triniwiz:mainfrom
herefishyfish:pr/font-weight-bolder-lighter
Open

herefishyfish wants to merge 2 commits into
triniwiz:mainfrom
herefishyfish:pr/font-weight-bolder-lighter

Conversation

@herefishyfish

@herefishyfish herefishyfish commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Why

Web UA and Tailwind preflight stylesheets declare b, strong { font-weight: bolder; }. NativeScript core's FontWeight.parse rejects bolder and lighter with Error: Invalid value: bolder, forcing app-level CSS overrides.

What changed

  • packages/nativescript-masonkit/properties.ts overrides fontWeightProperty valueConverter to resolve bolder and lighter relative to the parent view's font weight per CSS Fonts 4 §2.2, returning valid core FontWeight strings (100, 400, normal, bold, 900) and delegating all other values to FontWeight.parse.
  • packages/nativescript-masonkit/style.ts accepts bolder (700) and lighter (100) in Style.fontWeight.
  • Added unit tests in packages/nativescript-masonkit/properties.spec.ts covering bolder, lighter, parent-relative thresholds, and invalid values.

Blast Radius

All non-relative font-weight values still pass straight through FontWeight.parse, so invalid values keep throwing and plain NativeScript views are unaffected.

Verification

  • npx vitest run --config tools/testing/vitest.config.ts packages/nativescript-masonkit/properties.spec.ts failed before the fix (Error: Invalid value: bolder) and passed after.
  • npx tsc -p packages/nativescript-masonkit/tsconfig.json --noEmit and npx tsc -p tools/testing/consumer-types/tsconfig.json passed.
  • npx vitest run --config tools/testing/vitest.config.ts --project masonkit --project android passed (1315/1315).

Before / After

Before and after: CSS font-weight bolder and lighter

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant