-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement --spacing(…)
, --alpha(…)
and --theme(…)
CSS functions
#15572
Merged
Conversation
This file contains 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
Co-authored-by: Philipp Spiess <[email protected]> Co-authored-by: Jordan Pittman <[email protected]>
Co-authored-by: Philipp Spiess <[email protected]> Co-authored-by: Jordan Pittman <[email protected]>
Co-authored-by: Philipp Spiess <[email protected]> Co-authored-by: Jordan Pittman <[email protected]>
Co-authored-by: Philipp Spiess <[email protected]> Co-authored-by: Jordan Pittman <[email protected]>
CHANGELOG.md
Outdated
@@ -790,3 +791,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
## [4.0.0-alpha.1] - 2024-03-06 | |||
|
|||
- First 4.0.0-alpha.1 release | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol this came back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃
thecrypticace
requested changes
Jan 8, 2025
thecrypticace
approved these changes
Jan 8, 2025
reinink
reviewed
Jan 8, 2025
reinink
reviewed
Jan 8, 2025
reinink
reviewed
Jan 8, 2025
reinink
reviewed
Jan 8, 2025
reinink
reviewed
Jan 8, 2025
|
||
let multiplier = designSystem.theme.resolve(null, ['--spacing']) | ||
if (!multiplier) { | ||
throw new Error('--spacing(…) depends on the `--spacing` theme value, but it was not found.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
throw new Error('--spacing(…) depends on the `--spacing` theme value, but it was not found.') | |
throw new Error('The --spacing(…) function requires that the `--spacing` theme variable be set, but it was not found.') |
reinink
reviewed
Jan 8, 2025
reinink
reviewed
Jan 8, 2025
Co-authored-by: Jonathan Reinink <[email protected]>
RobinMalfait
force-pushed
the
feat/add-new-css-functions
branch
from
January 8, 2025 19:47
79e11c5
to
b995a5b
Compare
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.
This PR implements new CSS functions that you can use in your CSS (or even in arbitrary value position).
For starters, we renamed the
theme(…)
function to--theme(…)
. The legacytheme(…)
function is still available for backwards compatibility reasons, but this allows us to be future proof since--foo(…)
is the syntax the CSS spec recommends. See: https://drafts.csswg.org/css-mixins/In addition, this PR implements a new
--spacing(…)
function, this allows you to write:This is syntax sugar over:
If your
@theme
uses theinline
keyword, we will also make sure to inline the value:Boils down to:
Another new function function we added is the
--alpha(…)
function that requires a value, and a number / percentage value. This allows you to apply an alpha value to any color, but with a much shorter syntax:This is syntax sugar over: