- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- @suid/vite-plugin@0.3.1
- @suid/vite-plugin@0.3.0
- @suid/vite-plugin@0.2.0
- @suid/vite-plugin@0.1.5
- @suid/vite-plugin@0.1.4
- @suid/vite-plugin@0.1.3
- @suid/vite-plugin@0.1.2
- @suid/vite-plugin@0.1.1
- @suid/vite-plugin@0.1.0
- @suid/vite-plugin@0.1.0-next.0
- @suid/vite-plugin@0.0.3
- @suid/vite-plugin@0.0.2
- @suid/utils@0.10.1
- @suid/utils@0.10.0
- @suid/utils@0.9.0
- @suid/utils@0.8.0
- @suid/utils@0.7.3
- @suid/utils@0.7.2
- @suid/utils@0.7.1
- @suid/utils@0.7.0
- @suid/utils@0.6.1
- @suid/utils@0.6.0
- @suid/utils@0.6.0-next.1
- @suid/utils@0.6.0-next.0
- @suid/utils@0.5.0
- @suid/utils@0.4.0
- @suid/utils@0.3.0
- @suid/types@0.7.1
- @suid/types@0.7.0
- @suid/types@0.6.0
- @suid/types@0.5.3
- @suid/types@0.5.2
- @suid/types@0.5.1
- @suid/types@0.5.0
- @suid/types@0.4.0
- @suid/types@0.3.0
- @suid/types@0.3.0-next.0
- @suid/types@0.2.0
- @suid/system@0.13.0
- @suid/system@0.12.0
- @suid/system@0.11.0
- @suid/system@0.10.5
- @suid/system@0.10.4
- @suid/system@0.10.3
- @suid/system@0.10.2
- @suid/system@0.10.1
- @suid/system@0.10.0
- @suid/system@0.9.1
- @suid/system@0.9.0
- @suid/system@0.8.3
- @suid/system@0.8.2
- @suid/system@0.8.1
- @suid/system@0.8.0
- @suid/system@0.7.1
- @suid/system@0.7.0
- @suid/system@0.6.0
- @suid/system@0.6.0-next.1
- @suid/system@0.6.0-next.0
- @suid/system@0.5.2
- @suid/system@0.5.1
- @suid/system@0.5.0
- @suid/system@0.4.1
- @suid/system@0.4.0
- @suid/styled-engine@0.8.1
- @suid/styled-engine@0.8.0
- @suid/styled-engine@0.7.0
- @suid/styled-engine@0.6.1
- @suid/styled-engine@0.6.0
- @suid/styled-engine@0.5.2
- @suid/styled-engine@0.5.1
- @suid/styled-engine@0.5.0
- @suid/styled-engine@0.4.3
- @suid/styled-engine@0.4.2
- @suid/styled-engine@0.4.1
- @suid/styled-engine@0.4.0
- @suid/styled-engine@0.3.0
- @suid/styled-engine@0.3.0-next.1
- @suid/styled-engine@0.2.2-next.0
- @suid/styled-engine@0.2.1
- @suid/styled-engine@0.2.0
- @suid/styled-engine@0.1.0
- @suid/site@0.20.0
- @suid/site@0.19.0
- @suid/site@0.18.1
- @suid/site@0.18.0
- @suid/site@0.17.0
- @suid/site@0.16.0
- @suid/site@0.15.2
- @suid/site@0.15.1
- @suid/site@0.15.0
- @suid/site@0.14.0
- @suid/site@0.13.1
- @suid/site@0.13.0
- @suid/site@0.12.2
- @suid/site@0.12.1
- @suid/site@0.12.0
- @suid/site@0.11.1
- @suid/site@0.11.0
- @suid/site@0.10.1
- @suid/site@0.10.0
- @suid/site@0.9.0
- @suid/site@0.8.1
- @suid/site@0.8.0
- @suid/site@0.7.5
- @suid/site@0.7.4
- @suid/site@0.7.3
- @suid/site@0.7.2
- @suid/site@0.7.1
- @suid/site@0.7.0
- @suid/site@0.6.0
- @suid/site@0.6.0-next.1
- @suid/site@0.6.0-next.0
- @suid/site@0.5.4
- @suid/site@0.5.3
- @suid/site@0.5.2
- @suid/site@0.5.1
- @suid/site@0.5.0
- @suid/site@0.4.10
- @suid/site@0.4.9
- @suid/site@0.4.8
- @suid/site@0.4.7
- @suid/site@0.4.6
- @suid/site@0.4.5
- @suid/site@0.4.4
- @suid/site@0.4.3
- @suid/site@0.4.2
- @suid/site@0.4.1
- @suid/site@0.4.0
- @suid/material@0.18.0
- @suid/material@0.17.0
- @suid/material@0.16.0
- @suid/material@0.15.1
- @suid/material@0.15.0
- @suid/material@0.14.2
- @suid/material@0.14.1
- @suid/material@0.14.0
- @suid/material@0.13.2
- @suid/material@0.13.1
- @suid/material@0.13.0
- @suid/material@0.12.3
- @suid/material@0.12.2
- @suid/material@0.12.1
- @suid/material@0.12.0
- @suid/material@0.11.1
- @suid/material@0.11.0
- @suid/material@0.10.2
- @suid/material@0.10.1
- @suid/material@0.10.0
- @suid/material@0.9.2
- @suid/material@0.9.1
- @suid/material@0.9.0
- @suid/material@0.8.2
- @suid/material@0.8.1
- @suid/material@0.8.0
- @suid/material@0.7.0
- @suid/material@0.7.0-next.1
- @suid/material@0.7.0-next.0
- @suid/material@0.6.3
- @suid/material@0.6.2
- @suid/material@0.6.1
- @suid/material@0.6.0
- @suid/material@0.5.1
- @suid/material@0.5.0
- @suid/material@0.4.3
- @suid/material@0.4.1
- @suid/material@0.4.0
- @suid/icons-material@0.8.1
- @suid/icons-material@0.8.0
- @suid/icons-material@0.7.0
- @suid/icons-material@0.6.11
- @suid/icons-material@0.6.10
- @suid/icons-material@0.6.9
- @suid/icons-material@0.6.8
- @suid/icons-material@0.6.7
- @suid/icons-material@0.6.6
- @suid/icons-material@0.6.5
- @suid/icons-material@0.6.4
- @suid/icons-material@0.6.3
- @suid/icons-material@0.6.2
- @suid/icons-material@0.6.1
- @suid/icons-material@0.6.0
- @suid/icons-material@0.5.11
- @suid/icons-material@0.5.10
- @suid/icons-material@0.5.9
- @suid/icons-material@0.5.8
- @suid/icons-material@0.5.7
- @suid/icons-material@0.5.6
- @suid/icons-material@0.5.5
- @suid/icons-material@0.5.4
- @suid/icons-material@0.5.3
- @suid/icons-material@0.5.2
- @suid/icons-material@0.5.1
- @suid/icons-material@0.5.0
- @suid/icons-material@0.5.0-next.1
- @suid/icons-material@0.4.2-next.0
- @suid/icons-material@0.4.1
- @suid/icons-material@0.4.0
- @suid/icons-material@0.3.1
- @suid/icons-material@0.3.0
- @suid/icons-material@0.2.7
- @suid/icons-material@0.2.6
- @suid/icons-material@0.2.5
- @suid/icons-material@0.2.3
- @suid/icons-material@0.2.2
- @suid/css@0.4.0
- @suid/css@0.3.1
- @suid/css@0.3.0
- @suid/css@0.2.2
- @suid/css@0.2.1
- @suid/css@0.2.0
- @suid/css@0.1.7
- @suid/css@0.1.7-next.1
- @suid/css@0.1.7-next.0
- @suid/css@0.1.6
- @suid/css@0.1.5
- @suid/css@0.1.4
- @suid/css@0.1.3
- @suid/codemod@0.11.1
- @suid/codemod@0.11.0
- @suid/codemod@0.10.0
- @suid/codemod@0.9.6
- @suid/codemod@0.9.5
- @suid/codemod@0.9.4
- @suid/codemod@0.9.3
- @suid/codemod@0.9.2
- @suid/codemod@0.9.1
- @suid/codemod@0.9.0
- @suid/codemod@0.9.0-next.0
- @suid/codemod@0.8.0
- @suid/codemod@0.7.1
- @suid/codemod@0.7.0
- @suid/codemod@0.6.4
- @suid/codemod@0.6.3
- @suid/codemod@0.6.2
- @suid/codemod@0.6.1
- @suid/codemod@0.6.0
- @suid/codemod@0.4.0
- @suid/base@0.10.1
- @suid/base@0.10.0
- @suid/base@0.9.0
- @suid/base@0.8.5
- @suid/base@0.8.4
- @suid/base@0.8.3
- @suid/base@0.8.2
- @suid/base@0.8.1
- @suid/base@0.8.0
- @suid/base@0.7.1
- @suid/base@0.7.0
- @suid/base@0.6.3
- @suid/base@0.6.2
- @suid/base@0.6.1
- @suid/base@0.6.0
- @suid/base@0.5.1
- @suid/base@0.5.0
- @suid/base@0.4.0
- @suid/base@0.4.0-next.1
- @suid/base@0.3.3-next.0
- @suid/base@0.3.2
- @suid/base@0.3.1
- @suid/base@0.3.0
- @suid/base@0.2.4
- @suid/base@0.2.3
- create-suid@0.2.1
- create-suid@0.2.0
- create-suid@0.1.9
- create-suid@0.1.8
- create-suid@0.1.7
- create-suid@0.1.6
- create-suid@0.1.5
- create-suid@0.1.4
- create-suid@0.1.3
- create-suid@0.1.3-next.0
- create-suid@0.1.2
- create-suid@0.1.1
- create-suid@0.1.0
Showing
26 changed files
with
430 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@suid/material": minor | ||
"@suid/system": minor | ||
--- | ||
|
||
Global refactoring for separating style properties into `StyleProps`, `StyledProps`, `SxProps` and `SystemProps` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
import { Theme } from "./createTheme"; | ||
import getThemeValue from "./getThemeValue"; | ||
import { StyledPropsBase } from "./styledProps"; | ||
|
||
const dirMap = { | ||
x: ["Left", "Right"], | ||
y: ["Top", "Bottom"], | ||
}; | ||
|
||
type OnValue = (name: string, value: any, theme: Theme) => any; | ||
|
||
type PropReturn<V> = ( | ||
value: Exclude<V, undefined>, | ||
theme: Theme | ||
) => Record<string, any>; | ||
|
||
function asPx(value: unknown) { | ||
return typeof value === "number" ? `${value}px` : value; | ||
} | ||
|
||
function customProp<V>(name: string, onValue: OnValue): PropReturn<V> { | ||
return (value, theme) => onValue(name, value, theme); | ||
} | ||
|
||
function prop<N extends keyof StyledPropsBase>( | ||
name: N, | ||
onValue?: OnValue | ||
): PropReturn<StyledPropsBase[N]> { | ||
return onValue | ||
? (value, theme) => ({ | ||
[name]: onValue(name, value, theme), | ||
}) | ||
: (value) => ({ [name]: value }); | ||
} | ||
|
||
function pxProp<N extends keyof StyledPropsBase>(name: N) { | ||
return prop(name, (name, value) => asPx(value)); | ||
} | ||
|
||
function mProp<V>(name: string, suffix: string[], onValue?: OnValue) { | ||
const names = suffix.map((v) => `${name}${v}`); | ||
return onValue | ||
? (value: V, theme: Theme) => | ||
names.reduce((result, name) => { | ||
result[name] = onValue(name, value, theme); | ||
return result; | ||
}, {} as Record<string, any>) | ||
: (value: V) => | ||
names.reduce((result, name) => { | ||
result[name] = value; | ||
return result; | ||
}, {} as Record<string, any>); | ||
} | ||
|
||
function createSystemProps() { | ||
return { | ||
...createSystemPositionProps(), | ||
...createSystemPaletteProps(), | ||
...createSystemSizingProps(), | ||
...createSystemBorderProps(), | ||
...createSystemSpacingProps(), | ||
...createSystemTypographyProps(), | ||
}; | ||
} | ||
|
||
export function createSystemPositionProps() { | ||
return { | ||
position: prop("position"), | ||
zIndex: prop( | ||
"zIndex", | ||
(name, value, theme) => theme.zIndex?.[name] ?? value | ||
), | ||
top: pxProp("top"), | ||
right: pxProp("right"), | ||
bottom: pxProp("bottom"), | ||
left: pxProp("left"), | ||
}; | ||
} | ||
|
||
export function createSystemPaletteProps() { | ||
const paletteValue: OnValue = (name, value, theme) => | ||
getThemeValue(theme, "palette", value); | ||
return { | ||
color: prop("color", paletteValue), | ||
bgcolor: prop("backgroundColor", paletteValue), | ||
backgroundColor: prop("backgroundColor", paletteValue), | ||
}; | ||
} | ||
|
||
export function createSystemSizingProps() { | ||
const onValue: OnValue = (name, value, theme) => { | ||
if (name === "maxWidth") { | ||
value = theme.breakpoints.values[name as "xs"] ?? value; | ||
} | ||
if (typeof value === "number") { | ||
value = value > 0 && value <= 1 ? `${value * 100}%` : `${value}px`; | ||
} | ||
return value; | ||
}; | ||
return { | ||
width: prop("width", onValue), | ||
maxWidth: prop("maxWidth", onValue), | ||
minWidth: prop("minWidth", onValue), | ||
height: prop("height", onValue), | ||
maxHeight: prop("maxHeight", onValue), | ||
minHeight: prop("minHeight", onValue), | ||
boxSizing: prop("boxSizing", onValue), | ||
}; | ||
} | ||
|
||
export function createSystemBorderProps() { | ||
const borderValue: OnValue = (name, value) => | ||
typeof value === "number" ? `${value}px solid` : value; | ||
const paletteValue: OnValue = (name, value, theme) => | ||
getThemeValue(theme, "palette", value); | ||
return { | ||
border: prop("border", borderValue), | ||
borderTop: prop("borderTop", borderValue), | ||
borderRight: prop("borderRight", borderValue), | ||
borderBottom: prop("borderBottom", borderValue), | ||
borderLeft: prop("borderLeft", borderValue), | ||
borderColor: prop("borderColor", paletteValue), | ||
borderTopColor: prop("borderTopColor", paletteValue), | ||
borderRightColor: prop("borderRightColor", paletteValue), | ||
borderBottomColor: prop("borderBottomColor", paletteValue), | ||
borderLeftColor: prop("borderLeftColor", paletteValue), | ||
borderRadius: prop("borderRadius", (name, value, theme) => | ||
typeof value === "number" | ||
? `${theme.shape.borderRadius * value}px` | ||
: value | ||
), | ||
}; | ||
} | ||
|
||
export function createSystemTypographyProps() { | ||
const typographyValue: OnValue = (name, value, theme) => | ||
getThemeValue(theme, "typography", value); | ||
|
||
return { | ||
typography: customProp<string>("typography", (name, value, theme) => | ||
getThemeValue(theme, "typography", value) | ||
), | ||
fontFamily: prop("fontFamily", typographyValue), | ||
fontSize: prop("fontSize", (name, value, theme) => | ||
asPx(typographyValue(name, value, theme)) | ||
), | ||
fontStyle: prop("fontStyle", typographyValue), | ||
fontWeight: prop("fontWeight", typographyValue), | ||
letterSpacing: pxProp("letterSpacing"), | ||
lineHeight: prop("lineHeight"), | ||
textAlign: prop("textAlign"), | ||
textTransform: prop("textTransform"), | ||
}; | ||
} | ||
|
||
export function createSystemSpacingProps() { | ||
const spacing: OnValue = (name, value, theme) => theme.spacing(value); | ||
const m = "margin"; | ||
const p = "padding"; | ||
return { | ||
m: prop(m, spacing), | ||
mt: prop("marginTop", spacing), | ||
mr: prop("marginRight", spacing), | ||
mb: prop("marginBottom", spacing), | ||
ml: prop("marginLeft", spacing), | ||
mx: mProp(m, dirMap["x"], spacing), | ||
my: mProp(m, dirMap["y"], spacing), | ||
margin: prop(m, spacing), | ||
marginTop: prop("marginTop", spacing), | ||
marginRight: prop("marginRight", spacing), | ||
marginBottom: prop("marginBottom", spacing), | ||
marginLeft: prop("marginLeft", spacing), | ||
marginX: mProp(m, dirMap["x"], spacing), | ||
marginY: mProp(m, dirMap["y"], spacing), | ||
marginInline: mProp(m, ["Inline", "InlineStart"], spacing), | ||
marginInlineStart: prop("marginInlineStart", spacing), | ||
marginInlineEnd: prop("marginInlineEnd", spacing), | ||
marginBlock: mProp(m, ["BlockStart", "BlockEnd"], spacing), | ||
marginBlockStart: prop("marginBlockStart", spacing), | ||
marginBlockEnd: prop("marginBlockEnd", spacing), | ||
p: prop(p, spacing), | ||
pt: prop("paddingTop", spacing), | ||
pr: prop("paddingRight", spacing), | ||
pb: prop("paddingBottom", spacing), | ||
pl: prop("paddingLeft", spacing), | ||
px: mProp(p, dirMap["x"], spacing), | ||
py: mProp(p, dirMap["y"], spacing), | ||
padding: prop(p, spacing), | ||
paddingTop: prop("paddingTop", spacing), | ||
paddingRight: prop("paddingRight", spacing), | ||
paddingBottom: prop("paddingBottom", spacing), | ||
paddingLeft: prop("paddingLeft", spacing), | ||
paddingX: mProp(p, dirMap["x"], spacing), | ||
paddingY: mProp(p, dirMap["y"], spacing), | ||
paddingInline: mProp(p, ["Inline", "InlineStart"], spacing), | ||
paddingInlineStart: prop("paddingInlineStart", spacing), | ||
paddingInlineEnd: prop("paddingInlineEnd", spacing), | ||
paddingBlock: mProp(p, ["BlockStart", "BlockEnd"], spacing), | ||
paddingBlockStart: prop("paddingBlockStart", spacing), | ||
paddingBlockEnd: prop("paddingBlockEnd", spacing), | ||
}; | ||
} | ||
|
||
export default createSystemProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export * from "./colorManipulator"; | ||
export * from "./styleFunctionSx"; | ||
export * from "./breakpoints"; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export type SystemProps<Theme> = {}; | ||
|
||
export type { SxProps } from "./sxProps"; | ||
export type { SystemProps } from "./systemProps"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { resolvedPropKey } from "./createSxClass"; | ||
import { StyledProps } from "./styledProps"; | ||
import resolve from "@suid/css/resolve"; | ||
|
||
export const unitLess = new Set<string>([]); | ||
|
||
export function resolveStyledPropsValue(name: string, value: unknown) { | ||
if (typeof value === "number") { | ||
return { [name]: unitLess.has(name) ? value.toString() : `${value}px` }; | ||
} | ||
} | ||
|
||
function resolveStyledProps(v: StyledProps): StyledProps { | ||
return resolve(v, resolveStyledPropsValue, { [resolvedPropKey]: true }); | ||
} | ||
|
||
export default resolveStyledProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { resolvedPropKey } from "./createSxClass"; | ||
import { Theme } from "./createTheme"; | ||
import { resolveStyledPropsValue } from "./resolveStyledProps"; | ||
import { SxPropsObject } from "./sxProps"; | ||
import systemProps from "./systemProps"; | ||
import resolve from "@suid/css/resolve"; | ||
|
||
export function resolveSystemPropsValue( | ||
name: string, | ||
value: any, | ||
theme: Theme | ||
) { | ||
return systemProps[name as keyof typeof systemProps](value, theme); | ||
} | ||
|
||
export function reslveSxPropsValue(name: string, value: unknown, theme: Theme) { | ||
return name in systemProps | ||
? resolveSystemPropsValue(name, value, theme) | ||
: resolveStyledPropsValue(name, value); | ||
} | ||
|
||
function resolveSxProps(v: SxPropsObject, theme: Theme): SxPropsObject { | ||
return resolve(v, (name, value) => reslveSxPropsValue(name, value, theme), { | ||
[resolvedPropKey]: true, | ||
}); | ||
} | ||
|
||
export default resolveSxProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
StandardProperties, | ||
SvgProperties, | ||
VendorLonghandProperties, | ||
} from "csstype"; | ||
|
||
export type StyleProps = StandardProperties & | ||
SvgProperties & | ||
VendorLonghandProperties; | ||
|
||
export type StyleCascade<T> = | ||
| { | ||
[K in keyof T]?: T[K]; | ||
} | ||
| { | ||
[K: string]: StyleCascade<T>; | ||
}; | ||
|
||
export {}; | ||
export default StyleProps; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { StyleCascade } from "./styleProps"; | ||
import { | ||
StandardProperties, | ||
SvgProperties, | ||
VendorLonghandProperties, | ||
} from "csstype"; | ||
|
||
export type StyledPropsBase = StandardProperties<string | number> & | ||
SvgProperties<string | number> & | ||
VendorLonghandProperties<string | number>; | ||
|
||
export type StyledProps = StyleCascade<StyledPropsBase>; | ||
|
||
export {}; | ||
export default StyledProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,16 @@ | ||
import { StyleProps } from "./createStylePropsFactory"; | ||
import { Theme } from "./createTheme"; | ||
import { | ||
StandardProperties, | ||
SvgProperties, | ||
VendorLonghandProperties, | ||
} from "csstype"; | ||
import { StyleCascade } from "./styleProps"; | ||
import { StyledPropsBase } from "./styledProps"; | ||
import { SystemProps } from "./systemProps"; | ||
|
||
export type NativeStyleProps = StandardProperties & | ||
SvgProperties & | ||
VendorLonghandProperties; | ||
export type CSSProps = Omit<NativeStyleProps, keyof StyleProps> & StyleProps; | ||
export type SxPropsObject = | ||
| { | ||
[K in keyof CSSProps]?: CSSProps[K]; | ||
} | ||
| { | ||
[K: string]: SxPropsObject; | ||
}; | ||
export type SxPropsBase<T = Theme> = Omit< | ||
StyledPropsBase, | ||
keyof SystemProps<T> | ||
> & | ||
StyledPropsBase & | ||
SystemProps<Theme>; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export type SxProps<T = Theme> = SxPropsObject[] | SxPropsObject; | ||
export type SxPropsObject<T = Theme> = StyleCascade<SxPropsBase<T>>; | ||
export type SxProps<T = Theme> = SxPropsObject<T>[] | SxPropsObject<T>; | ||
|
||
export default SxProps; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import createSystemProps from "./createSystemProps"; | ||
import { Theme } from "./createTheme"; | ||
import { StyledPropsBase } from "./styledProps"; | ||
|
||
const systemProps = createSystemProps(); | ||
|
||
export type SystemPropName = keyof typeof systemProps; | ||
export const systemPropNames = Object.keys(systemProps) as SystemPropName[]; | ||
|
||
type SystemStyledPropName = Extract<SystemPropName, keyof StyledPropsBase>; | ||
export type SystemExtraPropName = Exclude<SystemPropName, SystemStyledPropName>; | ||
|
||
export type SystemExtraPropsBase = Partial<{ | ||
[K in SystemExtraPropName]: Parameters<typeof systemProps[K]>[0]; | ||
}>; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export type SystemProps<T = Theme> = Pick< | ||
StyledPropsBase, | ||
SystemStyledPropName | ||
> & | ||
SystemExtraPropsBase; | ||
|
||
export default systemProps; |