Skip to content

feat: add validation for letter spacing that allows negative values#138

Merged
mxschll merged 5 commits intomainfrom
dev-v3-schomax-letter-spacing
Feb 20, 2026
Merged

feat: add validation for letter spacing that allows negative values#138
mxschll merged 5 commits intomainfrom
dev-v3-schomax-letter-spacing

Conversation

@mxschll
Copy link
Copy Markdown
Member

@mxschll mxschll commented Feb 19, 2026

Issue #, if available:

Description of changes:

We want to make our heading letter-spacing tokens public and themable. However, because these tokens can contain negative values (which are valid), the current validation fails, preventing us from making them public. This PR separates letter-spacing validation from other font-sizing logic.

With this change, css keyword values are possible and numeric values in the following format:

'1px', '-0.5rem', '0em', '0.25px', '-1.5em', '.5px', '-.5rem'

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mxschll mxschll requested a review from a team as a code owner February 19, 2026 15:45
@mxschll mxschll requested a review from amanabiy February 19, 2026 15:45
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.51%. Comparing base (b545df9) to head (665a8f1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #138   +/-   ##
=======================================
  Coverage   97.51%   97.51%           
=======================================
  Files          48       48           
  Lines        2612     2616    +4     
  Branches      508      540   +32     
=======================================
+ Hits         2547     2551    +4     
  Misses         65       65           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mxschll mxschll enabled auto-merge February 19, 2026 17:08
@mxschll mxschll removed the request for review from a team February 19, 2026 19:49
};
const letterSpacingValueSchema: GenericSchema = {
type: 'string',
pattern: 'normal|inherit|initial|revert|revert-layer|unset|-?\\d*\\.?\\d+(px|rem|em)',
Copy link
Copy Markdown
Member

@amanabiy amanabiy Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern match partial strings like revert-something or 12px extra-text. Should we use anchors and word boundaries to ensure only exact matches are accepted something like this: ^(\b(normal|inherit|initial|revert-layer|revert|unset)\b|-?\d*\.?\d+(px|rem|em))$.

I see the others also have similar implementation so I am wondering if we can do this maybe as a follow up.

@mxschll mxschll added this pull request to the merge queue Feb 20, 2026
Merged via the queue into main with commit 1091192 Feb 20, 2026
45 checks passed
@mxschll mxschll deleted the dev-v3-schomax-letter-spacing branch February 20, 2026 08:44
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.

2 participants