Add font-features-* utility for font-feature-settings (#19623)
Add a new arbitrary-value-only utility `font-features-*` that sets the `font-feature-settings` CSS property. This utility only accepts arbitrary values (e.g., `font-features-["smcp"]`, `font-features-[var(--features)]`). The utility is sorted directly after `font-family` in the property order. https://claude.ai/code/session_01EAccbTHJ9dTUJ53ttq2jc4 --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
This commit is contained in:
parent
5395c7e764
commit
53205f5dc5
4 changed files with 53 additions and 8 deletions
17
CHANGELOG.md
17
CHANGELOG.md
|
|
@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- _Experimental_: Add `@container-size` utility ([#18901](https://github.com/tailwindlabs/tailwindcss/pull/18901))
|
||||
- Add `@tailwindcss/webpack` loader for Tailwind CSS v4 ([#19610](https://github.com/tailwindlabs/tailwindcss/pull/19610))
|
||||
- Add `pbs-*`, `pbe-*`, `mbs-*`, `mbe-*`, `scroll-pbs-*`, `scroll-pbe-*`, `scroll-mbs-*`, `scroll-mbe-*`, `border-bs-*`, `border-be-*` utilities for `padding-block-start`, `padding-block-end`, `margin-block-start`, `margin-block-end`, `scroll-padding-block-start`, `scroll-padding-block-end`, `scroll-margin-block-start`, `scroll-margin-block-end`, `border-block-start`, and `border-block-end` ([`#19601`](https://github.com/tailwindlabs/tailwindcss/pull/19601))
|
||||
- Add `inline-*`, `min-inline-*`, `max-inline-*`, `block-*`, `min-block-*`, `max-block-*` utilities for `inline-size`, `min-inline-size`, `max-inline-size`, `block-size`, `min-block-size`, and `max-block-size` ([#19612](https://github.com/tailwindlabs/tailwindcss/pull/19612))
|
||||
- Add `inset-s-*`, `inset-e-*`, `inset-bs-*`, `inset-be-*` utilities for `inset-inline-start`, `inset-inline-end`, `inset-block-start`, and `inset-block-end` ([#19613](https://github.com/tailwindlabs/tailwindcss/pull/19613))
|
||||
- Add `font-features-*` utility for `font-feature-settings` ([#19623](https://github.com/tailwindlabs/tailwindcss/pull/19615))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Do not wrap `color-mix` in a `@supports` rule if one already exists ([#19450](https://github.com/tailwindlabs/tailwindcss/pull/19450))
|
||||
|
|
@ -16,14 +25,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fix class extraction for Rails' strict locals ([#19525](https://github.com/tailwindlabs/tailwindcss/pull/19525))
|
||||
- Align `@utility` name validation with Oxide scanner rules ([#19524](https://github.com/tailwindlabs/tailwindcss/pull/19524))
|
||||
|
||||
### Added
|
||||
|
||||
- _Experimental_: Add `@container-size` utility ([#18901](https://github.com/tailwindlabs/tailwindcss/pull/18901))
|
||||
- Add `@tailwindcss/webpack` loader for Tailwind CSS v4 ([#19610](https://github.com/tailwindlabs/tailwindcss/pull/19610))
|
||||
- Add `pbs-*`, `pbe-*`, `mbs-*`, `mbe-*`, `scroll-pbs-*`, `scroll-pbe-*`, `scroll-mbs-*`, `scroll-mbe-*`, `border-bs-*`, `border-be-*` utilities for `padding-block-start`, `padding-block-end`, `margin-block-start`, `margin-block-end`, `scroll-padding-block-start`, `scroll-padding-block-end`, `scroll-margin-block-start`, `scroll-margin-block-end`, `border-block-start`, and `border-block-end` ([`#19601`](https://github.com/tailwindlabs/tailwindcss/pull/19601))
|
||||
- Add `inline-*`, `min-inline-*`, `max-inline-*`, `block-*`, `min-block-*`, `max-block-*` utilities for `inline-size`, `min-inline-size`, `max-inline-size`, `block-size`, `min-block-size`, and `max-block-size` ([#19612](https://github.com/tailwindlabs/tailwindcss/pull/19612))
|
||||
- Add `inset-s-*`, `inset-e-*`, `inset-bs-*`, `inset-be-*` utilities for `inset-inline-start`, `inset-inline-end`, `inset-block-start`, and `inset-block-end` ([#19613](https://github.com/tailwindlabs/tailwindcss/pull/19613))
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Deprecate `start-*` and `end-*` utilities in favor of `inline-s-*` and `inline-e-*` ([#19613](https://github.com/tailwindlabs/tailwindcss/pull/19613))
|
||||
|
|
|
|||
|
|
@ -343,6 +343,7 @@ export default [
|
|||
'vertical-align',
|
||||
|
||||
'font-family',
|
||||
'font-feature-settings',
|
||||
'font-size',
|
||||
'line-height',
|
||||
'font-weight',
|
||||
|
|
|
|||
|
|
@ -22218,6 +22218,41 @@ test('font', async () => {
|
|||
).toEqual('')
|
||||
})
|
||||
|
||||
test('font-features', async () => {
|
||||
expect(
|
||||
await run([
|
||||
'font-features-["smcp"]',
|
||||
'font-features-["c2sc","smcp"]',
|
||||
'font-features-[var(--my-features)]',
|
||||
'font-features-(--my-features)',
|
||||
]),
|
||||
).toMatchInlineSnapshot(`
|
||||
".font-features-\\(--my-features\\) {
|
||||
font-feature-settings: var(--my-features);
|
||||
}
|
||||
|
||||
.font-features-\\[\\"c2sc\\"\\,\\"smcp\\"\\] {
|
||||
font-feature-settings: "c2sc", "smcp";
|
||||
}
|
||||
|
||||
.font-features-\\[\\"smcp\\"\\] {
|
||||
font-feature-settings: "smcp";
|
||||
}
|
||||
|
||||
.font-features-\\[var\\(--my-features\\)\\] {
|
||||
font-feature-settings: var(--my-features);
|
||||
}"
|
||||
`)
|
||||
expect(
|
||||
await run([
|
||||
'font-features',
|
||||
'-font-features-["smcp"]',
|
||||
'font-features-smcp',
|
||||
'font-features-["smcp"]/foo',
|
||||
]),
|
||||
).toEqual('')
|
||||
})
|
||||
|
||||
test('text-transform', async () => {
|
||||
expect(await run(['uppercase', 'lowercase', 'capitalize', 'normal-case'])).toMatchInlineSnapshot(`
|
||||
".capitalize {
|
||||
|
|
|
|||
|
|
@ -3909,6 +3909,14 @@ export function createUtilities(theme: Theme) {
|
|||
},
|
||||
])
|
||||
|
||||
/**
|
||||
* @css `font-feature-settings`
|
||||
*/
|
||||
functionalUtility('font-features', {
|
||||
themeKeys: [],
|
||||
handle: (value) => [decl('font-feature-settings', value)],
|
||||
})
|
||||
|
||||
staticUtility('uppercase', [['text-transform', 'uppercase']])
|
||||
staticUtility('lowercase', [['text-transform', 'lowercase']])
|
||||
staticUtility('capitalize', [['text-transform', 'capitalize']])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue