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

fix(#943): TS @font-face descriptors #980

Merged
merged 1 commit into from
Jun 8, 2022
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
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