-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support aspect ratio token (#1979)
* feat: add aspect ratio token * test: update snaps * docs: update aspect ratio * docs: update changeset
- Loading branch information
1 parent
24e9766
commit bee3ec8
Showing
18 changed files
with
163 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
'@pandacss/token-dictionary': minor | ||
'@pandacss/preset-panda': minor | ||
'@pandacss/preset-base': minor | ||
--- | ||
|
||
Add support for aspect ratio tokens in the panda config or preset. Aspect ratio tokens are used to define the aspect | ||
ratio of an element. | ||
|
||
```js | ||
export default defineConfig({ | ||
// ... | ||
theme: { | ||
extend: { | ||
// add aspect ratio tokens | ||
tokens: { | ||
aspectRatios: { | ||
'1:1': '1', | ||
'16:9': '16/9', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) | ||
``` | ||
|
||
Here's what the default aspect ratio tokens in the base preset looks like: | ||
|
||
```json | ||
{ | ||
"square": { "value": "1 / 1" }, | ||
"landscape": { "value": "4 / 3" }, | ||
"portrait": { "value": "3 / 4" }, | ||
"wide": { "value": "16 / 9" }, | ||
"ultrawide": { "value": "18 / 5" }, | ||
"golden": { "value": "1.618 / 1" } | ||
} | ||
``` | ||
|
||
**Breaking Change** | ||
|
||
The built-in token values has been removed from the `aspectRatio` utility to the `@pandacss/preset-base` as a token. | ||
|
||
For most users, this change should be a drop-in replacement. However, if you used a custom preset in the config, you | ||
might need to update it to include the new aspect ratio tokens. |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const aspectRatios = { | ||
square: { value: '1 / 1' }, | ||
landscape: { value: '4 / 3' }, | ||
portrait: { value: '3 / 4' }, | ||
wide: { value: '16 / 9' }, | ||
ultrawide: { value: '18 / 5' }, | ||
golden: { value: '1.618 / 1' }, | ||
} |
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,4 +235,5 @@ const TOKEN_TYPES = { | |
borders: 'border', | ||
components: 'cti', | ||
assets: 'asset', | ||
aspectRatios: 'aspectRatio', | ||
} |
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
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
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
bee3ec8
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.
Successfully deployed to the following URLs:
panda-docs – ./website
panda-docs-git-main-chakra-ui.vercel.app
panda-css.com
panda-docs-chakra-ui.vercel.app
panda-docs.vercel.app
bee3ec8
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.
Successfully deployed to the following URLs:
panda-studio – ./
panda-app.vercel.app
panda-studio-chakra-ui.vercel.app
panda-studio-git-main-chakra-ui.vercel.app
bee3ec8
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.
Successfully deployed to the following URLs:
panda-playground – ./playground
panda-playground.vercel.app
panda-playground-git-main-chakra-ui.vercel.app
panda-playground-chakra-ui.vercel.app
play.panda-css.com