Repository navigation
fix(masonkit): resolve CSS font-weight bolder and lighter keywords - #252
Open
herefishyfish wants to merge 2 commits into
Open
herefishyfish wants to merge 2 commits into
herefishyfish wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Web UA and Tailwind preflight stylesheets declare
b, strong { font-weight: bolder; }. NativeScript core'sFontWeight.parserejectsbolderandlighterwithError: Invalid value: bolder, forcing app-level CSS overrides.What changed
packages/nativescript-masonkit/properties.tsoverridesfontWeightPropertyvalueConverterto resolvebolderandlighterrelative to the parent view's font weight per CSS Fonts 4 §2.2, returning valid coreFontWeightstrings (100,400,normal,bold,900) and delegating all other values toFontWeight.parse.packages/nativescript-masonkit/style.tsacceptsbolder(700) andlighter(100) inStyle.fontWeight.packages/nativescript-masonkit/properties.spec.tscoveringbolder,lighter, parent-relative thresholds, and invalid values.Blast Radius
All non-relative
font-weightvalues still pass straight throughFontWeight.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.tsfailed before the fix (Error: Invalid value: bolder) and passed after.npx tsc -p packages/nativescript-masonkit/tsconfig.json --noEmitandnpx tsc -p tools/testing/consumer-types/tsconfig.jsonpassed.npx vitest run --config tools/testing/vitest.config.ts --project masonkit --project androidpassed (1315/1315).Before / After