From 5fa475ff516df03e06be0ef1c9096cd8118def82 Mon Sep 17 00:00:00 2001 From: Adriano de Azevedo Date: Wed, 9 Mar 2022 10:30:41 -0300 Subject: [PATCH] fix(#943): TS @font-face descriptors --- packages/core/tests/issue-943.js | 24 ++++++++++++++++++++++++ packages/core/types/css.d.ts | 6 ++++++ 2 files changed, 30 insertions(+) create mode 100644 packages/core/tests/issue-943.js diff --git a/packages/core/tests/issue-943.js b/packages/core/tests/issue-943.js new file mode 100644 index 00000000..33db1def --- /dev/null +++ b/packages/core/tests/issue-943.js @@ -0,0 +1,24 @@ +import { createStitches } from '../src/index.js' + +describe('Issue #943', () => { + test('locally scoped token works 1 time', () => { + const { globalCss, getCssText } = createStitches() + + globalCss({ + $$syntax: 'red', + + '@font-face': [ + { + fontFamily: 'fallback-font', + ascentOverride: '83.6%', + descentOverride: '20.5%', + lineGapOverride: '0%', + advanceOverride: '10', + src: 'local(Arial)', + } + ] + })() + + expect(getCssText()).toBe('--sxs{--sxs:1 OxGnW}@media{---syntax:red@font-face{font-family:fallback-font;ascent-override:83.6%;descent-override:20.5%;line-gap-override:0%;advance-override:10;src:local(Arial)}}') + }) +}) diff --git a/packages/core/types/css.d.ts b/packages/core/types/css.d.ts index 3fc8b82e..24035cde 100644 --- a/packages/core/types/css.d.ts +++ b/packages/core/types/css.d.ts @@ -9303,6 +9303,9 @@ export namespace AtRule { fontWeight?: FontWeight; src?: string; unicodeRange?: string; + sizeAdjust?: string; + ascentOverride?: string; + descentOverride?: string; } export interface FontFaceHyphen { @@ -9316,6 +9319,9 @@ export namespace AtRule { "font-weight"?: FontWeight; src?: string; "unicode-range"?: string; + "size-adjust"?: string; + "ascent-override"?: string; + "descent-override"?: string; } export type FontFaceFallback = {