Skip to content

Commit c43df5c

Browse files
committed
Make all ColorMode keys optional and allow unknown keys in ThemeStyles
1 parent e38b48b commit c43df5c

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

packages/css/src/types.ts

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -496,12 +496,12 @@ export interface ColorMode {
496496
/**
497497
* Body background color
498498
*/
499-
background: CSS.ColorProperty
499+
background?: CSS.ColorProperty
500500

501501
/**
502502
* Body foreground color
503503
*/
504-
text: CSS.ColorProperty
504+
text?: CSS.ColorProperty
505505

506506
/**
507507
* Primary brand color for links, buttons, etc.
@@ -537,6 +537,39 @@ interface ColorModesScale extends ColorMode {
537537
}
538538
}
539539

540+
interface ThemeStyles {
541+
tr?: SystemStyleObject
542+
th?: SystemStyleObject
543+
td?: SystemStyleObject
544+
em?: SystemStyleObject
545+
strong?: SystemStyleObject
546+
div?: SystemStyleObject
547+
p?: SystemStyleObject
548+
b?: SystemStyleObject
549+
i?: SystemStyleObject
550+
a?: SystemStyleObject
551+
h1?: SystemStyleObject
552+
h2?: SystemStyleObject
553+
h3?: SystemStyleObject
554+
h4?: SystemStyleObject
555+
h5?: SystemStyleObject
556+
h6?: SystemStyleObject
557+
img?: SystemStyleObject
558+
pre?: SystemStyleObject
559+
code?: SystemStyleObject
560+
ol?: SystemStyleObject
561+
ul?: SystemStyleObject
562+
li?: SystemStyleObject
563+
blockquote?: SystemStyleObject
564+
hr?: SystemStyleObject
565+
table?: SystemStyleObject
566+
delete?: SystemStyleObject
567+
inlineCode?: SystemStyleObject
568+
thematicBreak?: SystemStyleObject
569+
root?: SystemStyleObject
570+
[key: string]: SystemStyleObject
571+
}
572+
540573
export interface Theme {
541574
breakpoints?: Array<string>
542575
mediaQueries?: { [size: string]: string }
@@ -603,38 +636,5 @@ export interface Theme {
603636
* with @styled-system/css and have access to base theme values like colors,
604637
* fonts, etc.
605638
*/
606-
styles?: {
607-
[P in StyledTags]?: SystemStyleObject
608-
}
639+
styles?: ThemeStyles
609640
}
610-
611-
type StyledTags =
612-
| 'tr'
613-
| 'th'
614-
| 'td'
615-
| 'em'
616-
| 'strong'
617-
| 'div'
618-
| 'p'
619-
| 'b'
620-
| 'i'
621-
| 'a'
622-
| 'h1'
623-
| 'h2'
624-
| 'h3'
625-
| 'h4'
626-
| 'h5'
627-
| 'h6'
628-
| 'img'
629-
| 'pre'
630-
| 'code'
631-
| 'ol'
632-
| 'ul'
633-
| 'li'
634-
| 'blockquote'
635-
| 'hr'
636-
| 'table'
637-
| 'delete'
638-
| 'inlineCode'
639-
| 'thematicBreak'
640-
| 'root'

0 commit comments

Comments
 (0)