Skip to content

Commit

Permalink
feat(text-styles): expand support properties
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed May 1, 2024
1 parent c3e797e commit 221c9a2
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 25 deletions.
6 changes: 6 additions & 0 deletions .changeset/flat-crews-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@pandacss/generator": minor
"@pandacss/types": minor
---

Add support for more typography related properties in text styles such as `fontFeatureSettings`, `fontPalette`, etc.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"content": "import type { CompositionStyleObject } from './system-types'\n\ninterface Token<T> {\n value: T\n description?: string\n}\n\ninterface Recursive<T> {\n [key: string]: Recursive<T> | T\n}\n\n/* -----------------------------------------------------------------------------\n * Text styles\n * -----------------------------------------------------------------------------*/\n\ntype TextStyleProperty =\n | 'fontSize'\n | 'fontSizeAdjust'\n | 'fontVariationSettings'\n | 'fontVariantPosition'\n | 'fontVariantCaps'\n | 'fontVariantNumeric'\n | 'fontVariantAlternates'\n | 'fontVariantLigatures'\n | 'fontFamily'\n | 'fontWeight'\n | 'fontSynthesis'\n | 'fontStyle'\n | 'fontVariant'\n | 'lineHeight'\n | 'letterSpacing'\n | 'textDecoration'\n | 'textTransform'\n | 'textIndent'\n | 'textDecorationColor'\n | 'textDecorationLine'\n | 'textDecorationStyle'\n | 'textEmphasisColor'\n | 'textEmphasisPosition'\n | 'textEmphasisStyle'\n | 'hyphenateCharacter'\n | 'textOrientation'\n | 'textOverflow'\n | 'textRendering'\n\nexport type TextStyle = CompositionStyleObject<TextStyleProperty>\n\nexport type TextStyles = Recursive<Token<TextStyle>>\n\n/* -----------------------------------------------------------------------------\n * Layer styles\n * -----------------------------------------------------------------------------*/\n\ntype Placement =\n | 'Top'\n | 'Right'\n | 'Bottom'\n | 'Left'\n | 'Inline'\n | 'Block'\n | 'InlineStart'\n | 'InlineEnd'\n | 'BlockStart'\n | 'BlockEnd'\n\ntype Radius =\n | `Top${'Right' | 'Left'}`\n | `Bottom${'Right' | 'Left'}`\n | `Start${'Start' | 'End'}`\n | `End${'Start' | 'End'}`\n\ntype LayerStyleProperty =\n | 'background'\n | 'backgroundColor'\n | 'backgroundImage'\n | 'borderRadius'\n | 'border'\n | 'borderWidth'\n | 'borderColor'\n | 'borderStyle'\n | 'boxShadow'\n | 'filter'\n | 'backdropFilter'\n | 'transform'\n | 'color'\n | 'opacity'\n | 'backgroundBlendMode'\n | 'backgroundAttachment'\n | 'backgroundClip'\n | 'backgroundOrigin'\n | 'backgroundPosition'\n | 'backgroundRepeat'\n | 'backgroundSize'\n | `border${Placement}`\n | `border${Placement}Width`\n | 'borderRadius'\n | `border${Radius}Radius`\n | `border${Placement}Color`\n | `border${Placement}Style`\n | 'padding'\n | `padding${Placement}`\n\nexport type LayerStyle = CompositionStyleObject<LayerStyleProperty>\n\nexport type LayerStyles = Recursive<Token<LayerStyle>>\n\nexport interface CompositionStyles {\n textStyles: TextStyles\n layerStyles: LayerStyles\n}\n"
"content": "import type { CompositionStyleObject } from './system-types'\n\ninterface Token<T> {\n value: T\n description?: string\n}\n\ninterface Recursive<T> {\n [key: string]: Recursive<T> | T\n}\n\n/* -----------------------------------------------------------------------------\n * Text styles\n * -----------------------------------------------------------------------------*/\n\ntype TextStyleProperty =\n | 'font'\n | 'fontFamily'\n | 'fontFeatureSettings'\n | 'fontKerning'\n | 'fontLanguageOverride'\n | 'fontOpticalSizing'\n | 'fontPalette'\n | 'fontSize'\n | 'fontSizeAdjust'\n | 'fontStretch'\n | 'fontStyle'\n | 'fontSynthesis'\n | 'fontVariant'\n | 'fontVariantAlternates'\n | 'fontVariantCaps'\n | 'fontVariantLigatures'\n | 'fontVariantNumeric'\n | 'fontVariantPosition'\n | 'fontVariationSettings'\n | 'fontWeight'\n | 'hypens'\n | 'hyphenateCharacter'\n | 'hyphenateLimitChars'\n | 'letterSpacing'\n | 'lineBreak'\n | 'lineHeight'\n | 'quotes'\n | 'overflowWrap'\n | 'textCombineUpright'\n | 'textDecoration'\n | 'textDecorationColor'\n | 'textDecorationLine'\n | 'textDecorationSkipInk'\n | 'textDecorationStyle'\n | 'textDecorationThickness'\n | 'textEmphasis'\n | 'textEmphasisColor'\n | 'textEmphasisPosition'\n | 'textEmphasisStyle'\n | 'textIndent'\n | 'textJustify'\n | 'textOrientation'\n | 'textOverflow'\n | 'textRendering'\n | 'textShadow'\n | 'textTransform'\n | 'textUnderlineOffset'\n | 'textUnderlinePosition'\n | 'textWrap'\n | 'textWrapMode'\n | 'textWrapStyle'\n | 'verticalAlign'\n | 'whiteSpace'\n | 'wordBreak'\n | 'wordSpacing'\n\nexport type TextStyle = CompositionStyleObject<TextStyleProperty>\n\nexport type TextStyles = Recursive<Token<TextStyle>>\n\n/* -----------------------------------------------------------------------------\n * Layer styles\n * -----------------------------------------------------------------------------*/\n\ntype Placement =\n | 'Top'\n | 'Right'\n | 'Bottom'\n | 'Left'\n | 'Inline'\n | 'Block'\n | 'InlineStart'\n | 'InlineEnd'\n | 'BlockStart'\n | 'BlockEnd'\n\ntype Radius =\n | `Top${'Right' | 'Left'}`\n | `Bottom${'Right' | 'Left'}`\n | `Start${'Start' | 'End'}`\n | `End${'Start' | 'End'}`\n\ntype LayerStyleProperty =\n | 'background'\n | 'backgroundColor'\n | 'backgroundImage'\n | 'borderRadius'\n | 'border'\n | 'borderWidth'\n | 'borderColor'\n | 'borderStyle'\n | 'boxShadow'\n | 'filter'\n | 'backdropFilter'\n | 'transform'\n | 'color'\n | 'opacity'\n | 'backgroundBlendMode'\n | 'backgroundAttachment'\n | 'backgroundClip'\n | 'backgroundOrigin'\n | 'backgroundPosition'\n | 'backgroundRepeat'\n | 'backgroundSize'\n | `border${Placement}`\n | `border${Placement}Width`\n | 'borderRadius'\n | `border${Radius}Radius`\n | `border${Placement}Color`\n | `border${Placement}Style`\n | 'padding'\n | `padding${Placement}`\n\nexport type LayerStyle = CompositionStyleObject<LayerStyleProperty>\n\nexport type LayerStyles = Recursive<Token<LayerStyle>>\n\nexport interface CompositionStyles {\n textStyles: TextStyles\n layerStyles: LayerStyles\n}\n"
}
51 changes: 39 additions & 12 deletions packages/studio/styled-system/types/composition.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,61 @@ interface Recursive<T> {
* -----------------------------------------------------------------------------*/

type TextStyleProperty =
| 'font'
| 'fontFamily'
| 'fontFeatureSettings'
| 'fontKerning'
| 'fontLanguageOverride'
| 'fontOpticalSizing'
| 'fontPalette'
| 'fontSize'
| 'fontSizeAdjust'
| 'fontVariationSettings'
| 'fontVariantPosition'
| 'fontVariantCaps'
| 'fontVariantNumeric'
| 'fontStretch'
| 'fontStyle'
| 'fontSynthesis'
| 'fontVariant'
| 'fontVariantAlternates'
| 'fontVariantCaps'
| 'fontVariantLigatures'
| 'fontFamily'
| 'fontVariantNumeric'
| 'fontVariantPosition'
| 'fontVariationSettings'
| 'fontWeight'
| 'fontSynthesis'
| 'fontStyle'
| 'fontVariant'
| 'lineHeight'
| 'hypens'
| 'hyphenateCharacter'
| 'hyphenateLimitChars'
| 'letterSpacing'
| 'lineBreak'
| 'lineHeight'
| 'quotes'
| 'overflowWrap'
| 'textCombineUpright'
| 'textDecoration'
| 'textTransform'
| 'textIndent'
| 'textDecorationColor'
| 'textDecorationLine'
| 'textDecorationSkipInk'
| 'textDecorationStyle'
| 'textDecorationThickness'
| 'textEmphasis'
| 'textEmphasisColor'
| 'textEmphasisPosition'
| 'textEmphasisStyle'
| 'hyphenateCharacter'
| 'textIndent'
| 'textJustify'
| 'textOrientation'
| 'textOverflow'
| 'textRendering'
| 'textShadow'
| 'textTransform'
| 'textUnderlineOffset'
| 'textUnderlinePosition'
| 'textWrap'
| 'textWrapMode'
| 'textWrapStyle'
| 'verticalAlign'
| 'whiteSpace'
| 'wordBreak'
| 'wordSpacing'

export type TextStyle = CompositionStyleObject<TextStyleProperty>

Expand Down
51 changes: 39 additions & 12 deletions packages/types/src/composition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,61 @@ interface Recursive<T> {
* -----------------------------------------------------------------------------*/

type TextStyleProperty =
| 'font'
| 'fontFamily'
| 'fontFeatureSettings'
| 'fontKerning'
| 'fontLanguageOverride'
| 'fontOpticalSizing'
| 'fontPalette'
| 'fontSize'
| 'fontSizeAdjust'
| 'fontVariationSettings'
| 'fontVariantPosition'
| 'fontVariantCaps'
| 'fontVariantNumeric'
| 'fontStretch'
| 'fontStyle'
| 'fontSynthesis'
| 'fontVariant'
| 'fontVariantAlternates'
| 'fontVariantCaps'
| 'fontVariantLigatures'
| 'fontFamily'
| 'fontVariantNumeric'
| 'fontVariantPosition'
| 'fontVariationSettings'
| 'fontWeight'
| 'fontSynthesis'
| 'fontStyle'
| 'fontVariant'
| 'lineHeight'
| 'hypens'
| 'hyphenateCharacter'
| 'hyphenateLimitChars'
| 'letterSpacing'
| 'lineBreak'
| 'lineHeight'
| 'quotes'
| 'overflowWrap'
| 'textCombineUpright'
| 'textDecoration'
| 'textTransform'
| 'textIndent'
| 'textDecorationColor'
| 'textDecorationLine'
| 'textDecorationSkipInk'
| 'textDecorationStyle'
| 'textDecorationThickness'
| 'textEmphasis'
| 'textEmphasisColor'
| 'textEmphasisPosition'
| 'textEmphasisStyle'
| 'hyphenateCharacter'
| 'textIndent'
| 'textJustify'
| 'textOrientation'
| 'textOverflow'
| 'textRendering'
| 'textShadow'
| 'textTransform'
| 'textUnderlineOffset'
| 'textUnderlinePosition'
| 'textWrap'
| 'textWrapMode'
| 'textWrapStyle'
| 'verticalAlign'
| 'whiteSpace'
| 'wordBreak'
| 'wordSpacing'

export type TextStyle = CompositionStyleObject<TextStyleProperty>

Expand Down

0 comments on commit 221c9a2

Please sign in to comment.