-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c06de6
commit d18b4b0
Showing
13 changed files
with
81 additions
and
508 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 |
---|---|---|
@@ -1,27 +1,41 @@ | ||
--- | ||
outline: deep | ||
--- | ||
|
||
# API | ||
|
||
`flexstyled`仅提供了少量的API。 | ||
|
||
|
||
## styled | ||
|
||
核心API`styled`可以用于: | ||
```ts | ||
|
||
- 创建样式对象 | ||
- 封装高阶组件 | ||
- 创建`HTML Tag`样式组件 | ||
// 创建样式对象 | ||
function styled<Props=any,Styles extends CSSRuleObject<Props> = CSSRuleObject<Props>, CombindStyles extends StyledObject[]=StyledObject[]>(styles:Styles,options?:StyledOptions):StyledObject<CSSVars<Styles>> | ||
// 创建样式对象,并指定组合样式 | ||
function styled<Props=any,Styles extends CSSRuleObject<Props> = CSSRuleObject<Props>, CombindStyles extends StyledObject[]=StyledObject[]>(styles:Styles,combindStyles:CombindStyles,options?:StyledOptions):StyledObject<CSSVars<Styles>> | ||
// 封装React组件 | ||
function styled<Props=any,Styles extends CSSRuleObject<Props> = CSSRuleObject<Props>, CombindStyles extends StyledObject[]=StyledObject[]>(FC: StyledComponent<Props>,styles:Styles,options?:StyledOptions):(props:Props)=>ReactElement | ||
// 封装React组件, 并指定组合样式 | ||
function styled<Props=any,Styles extends CSSRuleObject<Props> = CSSRuleObject<Props>, CombindStyles extends StyledObject[]=StyledObject[]>(FC: StyledComponent<Props>,styles:Styles,combindStyles:CombindStyles,options?:StyledOptions):(props:Props)=>ReactElement | ||
``` | ||
|
||
`styled`函数签名如下: | ||
|
||
## createTheme | ||
|
||
```ts | ||
type ThemeOptions = { | ||
id?:string | ||
prefix ?: string // 为css变量自动添加前缀 | ||
} | ||
type Theme<T extends CSSVariables> = T & { | ||
load(vars:Partial<T>):void | ||
update(vars:Partial<T>):void | ||
save(fn:(vars:T)=>void):void | ||
reset():void | ||
} | ||
## keyframes | ||
function createTheme<T extends CSSVariables = CSSVariables>(vars:T,options?:ThemeOptions):Theme | ||
``` | ||
|
||
## useStyled | ||
|
||
|
||
## ThemeManager | ||
## keyframes |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
/** | ||
* 显示颜色按钮 | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { styled } from "../../src" | ||
|
||
|
||
|
Oops, something went wrong.