diff --git a/README.md b/README.md
index 42c5bf7..87862ca 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# coral-system
+
+
一个轻量级的样式系统和 React 布局原子组件库。
文档地址:https://wwsun.github.io/coral-system/
@@ -14,13 +16,10 @@
- [x] css 传入自定义属性 `css={css}`
- [x] css 逻辑的动态表达 `css=[css1, css2]`
- [x] Coral Factory: ` coral('input', css``, { prefix: '' }); `
-- [ ] SystemProvider 支持主题快速生成:`primaryColor="hexColor"`
- [ ] 提供 FusionDesign 主题的导入支持
- [ ] 提供 Antd 主题的导入支持
- [ ] 响应式支持
- [ ] 常用伪类支持 \_hover...
-- [ ] 常用布局原子:List/Center/...
-- [ ] pointerEvents
## Usage
@@ -41,12 +40,14 @@ function App() {
使用 coral 方法可以创建具备 style props 的组件。
```tsx
-import { coral } from 'coral-system';
+import { coral, css } from 'coral-system';
-const Section = coral('section');
+const Section = coral('section', css`
+ /* your initial style */
+`);
function App() {
- return
+ return ;
}
```
diff --git a/package.json b/package.json
index 6e63483..7af470e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "coral-system",
- "version": "0.6.0",
+ "version": "0.6.1",
"description": "a lightweight style system with react ui primitives",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
diff --git a/src/core/color.ts b/src/core/color.ts
index 547ae6a..d2fa14c 100644
--- a/src/core/color.ts
+++ b/src/core/color.ts
@@ -9,9 +9,13 @@ const config: StylePropConfig = {
property: 'backgroundColor',
scale: 'colors',
},
+ background: {
+ property: 'background',
+ scale: 'colors',
+ },
opacity: true,
};
-config.bg = config.backgroundColor;
+config.bg = config.background;
export const color = system(config);
diff --git a/src/types/system.ts b/src/types/system.ts
index 88b0d83..53a0ae4 100644
--- a/src/types/system.ts
+++ b/src/types/system.ts
@@ -68,7 +68,8 @@ export interface SpaceProps {
export interface ColorProps {
color?: CSS.Property.Color;
- bg?: CSS.Property.Color;
+ bg?: CSS.Property.Background;
+ background?: CSS.Property.Background;
backgroundColor?: CSS.Property.Color;
opacity?: CSS.Property.Opacity;
}
@@ -199,11 +200,8 @@ export type OmitCommonProps;
-export type RightJoinProps = OmitCommonProps<
- SourceProps,
- keyof OverrideProps
-> &
- OverrideProps;
+export type RightJoinProps =
+ OmitCommonProps & OverrideProps;
export type MergeWithAs<
ComponentProps extends object,
@@ -226,7 +224,12 @@ export type PropsOf = React.ComponentPropsWithoutRef & {
export type ComponentWithAs = {
(
- props: MergeWithAs, React.ComponentProps, Props, AsComponent>,
+ props: MergeWithAs<
+ React.ComponentProps,
+ React.ComponentProps,
+ Props,
+ AsComponent
+ >,
): JSX.Element;
displayName?: string;