Skip to content

Commit

Permalink
fix(font-face) export FontFace type (stitchesjs#1011)
Browse files Browse the repository at this point in the history
* fix(font-face) export FontFace type

* Add endline
  • Loading branch information
csantos1113 authored Apr 25, 2022
1 parent c268db3 commit 397222f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export { $$PropertyValue, $$ScaleValue, $$ThemeValue} from './css-util'
export type CreateStitches = Config.CreateStitches
export type CSSProperties = CSSUtil.CSSProperties
export type DefaultThemeMap = Config.DefaultThemeMap
export type FontFace = CSSUtil.Native.AtRule.FontFace

/** Returns a Style interface from a configuration, leveraging the given media and style map. */
export type CSS<
Expand Down
23 changes: 22 additions & 1 deletion packages/react/tests/types.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// core types.tests.ts
import * as Stitches from '../types/index'
import { createStitches } from '../types/index'
import { createStitches, FontFace } from '../types/index'

const { css, globalCss, keyframes, styled, theme } = createStitches({
utils: {
Expand Down Expand Up @@ -182,3 +182,24 @@ void function Test() {
<StyledUnionComponent type="multiple" collapsible />
</>
}

/* -------------------------------------------------------------------------------------------------
* Issue #1010
* -----------------------------------------------------------------------------------------------*/
const fontFaceArray: FontFace[] = [
{
fontFamily: "Inter",
src: `url(file.woff2) format("woff2")`,
fontDisplay: "swap"
}
];
const styles = {
"@font-face": fontFaceArray,
body: {
// Falbacking to a serif font so it's easier to see that the swap is hapenning
fontFamily: "Inter, serif"
}
};
void function Test() {
globalCss(styles)
}
1 change: 1 addition & 0 deletions packages/react/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export { $$PropertyValue, $$ScaleValue, $$ThemeValue } from './css-util'
export type CreateStitches = Config.CreateStitches
export type CSSProperties = CSSUtil.CSSProperties
export type DefaultThemeMap = Config.DefaultThemeMap
export type FontFace = CSSUtil.Native.AtRule.FontFace

/** Returns a Style interface from a configuration, leveraging the given media and style map. */
export type CSS<
Expand Down

0 comments on commit 397222f

Please sign in to comment.