Skip to content

Commit

Permalink
fix(stitchesjs#943): TS @font-face descriptors (stitchesjs#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
drianoaz authored Jun 8, 2022
1 parent 456c505 commit 96e8a52
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/core/tests/issue-943.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createStitches } from '../src/index.js'

describe('Issue #943', () => {
test('@font-face descriptors', () => {
const { globalCss, getCssText } = createStitches()

globalCss({
'@font-face': [
{
fontFamily: 'fallback-font',
ascentOverride: '83.6%',
descentOverride: '20.5%',
lineGapOverride: '0%',
advanceOverride: '10',
src: 'local(Arial)',
}
]
})()

expect(getCssText()).toBe('--sxs{--sxs:1 jGZRm}@media{@font-face{font-family:fallback-font;ascent-override:83.6%;descent-override:20.5%;line-gap-override:0%;advance-override:10;src:local(Arial)}}')
})
})
10 changes: 10 additions & 0 deletions packages/core/types/css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9303,6 +9303,11 @@ export namespace AtRule {
fontWeight?: FontWeight;
src?: string;
unicodeRange?: string;
sizeAdjust?: string;
ascentOverride?: string;
descentOverride?: string;
lineGapOverride?: string;
advanceOverride?: string;
}

export interface FontFaceHyphen {
Expand All @@ -9316,6 +9321,11 @@ export namespace AtRule {
"font-weight"?: FontWeight;
src?: string;
"unicode-range"?: string;
"size-adjust"?: string;
"ascent-override"?: string;
"descent-override"?: string;
"line-gap-override"?: string;
"advance-override"?: string;
}

export type FontFaceFallback = {
Expand Down
22 changes: 22 additions & 0 deletions packages/react/tests/issue-943.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createStitches } from '../src/index.js'

describe('Issue #943', () => {
test('@font-face descriptors', () => {
const { globalCss, getCssText } = createStitches()

globalCss({
'@font-face': [
{
fontFamily: 'fallback-font',
ascentOverride: '83.6%',
descentOverride: '20.5%',
lineGapOverride: '0%',
advanceOverride: '10',
src: 'local(Arial)',
}
]
})()

expect(getCssText()).toBe('--sxs{--sxs:1 jGZRm}@media{@font-face{font-family:fallback-font;ascent-override:83.6%;descent-override:20.5%;line-gap-override:0%;advance-override:10;src:local(Arial)}}')
})
})
8 changes: 8 additions & 0 deletions packages/react/types/css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9305,6 +9305,9 @@ export namespace AtRule {
unicodeRange?: string;
sizeAdjust?: string;
ascentOverride?: string;
descentOverride?: string;
lineGapOverride?: string;
advanceOverride?: string;
}

export interface FontFaceHyphen {
Expand All @@ -9318,6 +9321,11 @@ export namespace AtRule {
"font-weight"?: FontWeight;
src?: string;
"unicode-range"?: string;
"size-adjust"?: string;
"ascent-override"?: string;
"descent-override"?: string;
"line-gap-override"?: string;
"advance-override"?: string;
}

export type FontFaceFallback = {
Expand Down

0 comments on commit 96e8a52

Please sign in to comment.