Skip to content
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

Read from --default-outline-width #16469

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix sorting numeric utilities when they have different magnitudes ([#16414](/~https://github.com/tailwindlabs/tailwindcss/pull/16414))
- Show suggestions for fractions in IntelliSense ([#16353](/~https://github.com/tailwindlabs/tailwindcss/pull/16353))
- Don’t replace `_` in suggested theme keys ([#16433](/~https://github.com/tailwindlabs/tailwindcss/pull/16433))
- Ensure `--default-outline-width` can be used to change the `outline-width` value of the `outline` utility

## [4.0.6] - 2025-02-10

Expand Down
113 changes: 113 additions & 0 deletions packages/tailwindcss/src/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14736,6 +14736,32 @@ test('outline', async () => {
initial-value: solid;
}"
`)
expect(
await compileCss(
css`
@theme {
--default-outline-width: 2px;
}
@tailwind utilities;
`,
['outline'],
),
).toMatchInlineSnapshot(`
":root, :host {
--default-outline-width: 2px;
}

.outline {
outline-style: var(--tw-outline-style);
outline-width: 2px;
}

@property --tw-outline-style {
syntax: "*";
inherits: false;
initial-value: solid;
}"
`)
expect(
await run([
'-outline',
Expand Down Expand Up @@ -15849,6 +15875,93 @@ test('ring', async () => {
initial-value: 0 0 #0000;
}"
`)
expect(
await compileCss(
css`
@theme {
--default-ring-width: 2px;
}
@tailwind utilities;
`,
['ring'],
),
).toMatchInlineSnapshot(`
":root, :host {
--default-ring-width: 2px;
}

.ring {
--tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentColor);
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
}

@property --tw-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}

@property --tw-shadow-color {
syntax: "*";
inherits: false
}

@property --tw-inset-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}

@property --tw-inset-shadow-color {
syntax: "*";
inherits: false
}

@property --tw-ring-color {
syntax: "*";
inherits: false
}

@property --tw-ring-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}

@property --tw-inset-ring-color {
syntax: "*";
inherits: false
}

@property --tw-inset-ring-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}

@property --tw-ring-inset {
syntax: "*";
inherits: false
}

@property --tw-ring-offset-width {
syntax: "<length>";
inherits: false;
initial-value: 0;
}

@property --tw-ring-offset-color {
syntax: "*";
inherits: false;
initial-value: #fff;
}

@property --tw-ring-offset-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}"
`)
expect(
await run([
// ring color
Expand Down
3 changes: 2 additions & 1 deletion packages/tailwindcss/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3928,10 +3928,11 @@ export function createUtilities(theme: Theme) {
utilities.functional('outline', (candidate) => {
if (candidate.value === null) {
if (candidate.modifier) return
let value = theme.get(['--default-outline-width']) ?? '1px'
return [
outlineProperties(),
decl('outline-style', 'var(--tw-outline-style)'),
decl('outline-width', '1px'),
decl('outline-width', value),
]
}

Expand Down