1.21.1 • Published 3 months ago

@ant-design/cssinjs v1.21.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@ant-design/cssinjs

NPM version npm download dumi build status Codecov bundle size

Component level cssinjs solution used in ant.design. It's a subset of Emotion with design token logic wrapper. Please feel free to use emotion directly if you want to find a web cssinjs solution. cssinjs related dep packages:

  • stylis
  • @emotion/hash
  • @emotion/unitless

Live Demo

https://ant-design.github.io/cssinjs/

Install

npm install @ant-design/cssinjs

or

yarn add @ant-design/cssinjs
pnpm add @ant-design/cssinjs

Development

npm install
npm start

License

@ant-design/cssinjs is released under the MIT license.

API

StyleProvider

PropDescTypeDefault
autoClearClear inject style element when component remove.booleanfalse
cacheConfig cssinjs cache entity. Only set when you need ssr to extract style on you own.CacheEntity-
hashPriorityUse :where selector to reduce hashId css selector priority'low' \| 'high''low'
containerTell cssinjs where to inject style in.Element | ShadowRootdocument.head
ssrInlineComponent wil render inline <style /> for fallback in SSR. Not recommend.booleanfalse
transformersTransform css before inject in document. Please note that transformers do not support dynamic updateTransformer[]-

createCache

return CacheEntity for StyleProvider.

createTheme

Create theme object. When same algorithm provided, it will return same object.

Design Token related API

Since @ant-design/cssinjs use strong constraints for cache hit performance, we recommend to view demo basic.tsx for usage and animation.tsx for animation usage.

Transform

When you need transform CSSObject before inject style. You can use transformers to handle this:

import {
  legacyLogicalPropertiesTransformer,
  StyleProvider,
} from '@ant-design/cssinjs';

export default () => (
  <StyleProvider transformers={[legacyLogicalPropertiesTransformer]}>
    <MyApp />
  </StyleProvider>
);

Follow are the transform we provide:

legacyLogicalPropertiesTransformer

Convert logical properties to legacy properties. e.g. marginBlockStart to marginTop:

  • inset
  • margin
  • padding
  • border

px2remTransformer

Convert pixel units to rem units. px2remTransformer.options

@dt-design/web-react@formlogic/component@everything-registry/sub-chunk-69emiya-components-modernjs-demointelligent-designhhg-workflowtable-decision-ruleswit-antdwood-deck-demoxenera-ui-componentsshatir-domainscmify-componentsrg-design-testsecd-uiswiftcrabvte-desktopvite-storybook-antdzmaelf-designsyky-ui-lib@vs-new/antdntn.muuri-analyticsntnhan-workflow-builder@gtplan/form-utils@gtplan/grid-utilsmin-web-react-distmfe-my-test-componentsllt-components-uiloft-editorhearken-basic-componentsgitee-uijlltdhy_dev_libimage-beautifiermollitiauthuaxin-antdlaboriosamquisquammark15manyidluokun_designorca-pro-utilsplasodo-rc-tableomdsnext-antd-tailwindnext-ant-storynext-ant-story-sanityphi-formily-antreact-salmonscwqnzs-uiqin-ui-reactsentinel-desktoprc-calendar-graphripin-ui-prors-antdui-pages-ecommerceui-pages-ecommercev2ui-components-protheme-krytowlang-antdtqsk-antdtopology-designabletuzhi-layout@ant-design/pro-layout@ant-design/pro-list@ant-design/pro-provider@ant-design/pro-table@ant-design/static-style-extract@ant-design/web3@ant-design/x@ant-design/pro-card@ant-design/happy-work-theme@ant-design/cssinjs-utils@ant-design/md-editor@ancademy/platform-components@ahooks.js/dumi-theme-antd@aelf-design/common@aelf-design/icons@aelf-design/internal-icons@aloudata/aloudata-design@baic/yolk-web@bairong/antd-pro-materials@cdzhxx/components@chaos-design/inspector@0fan/designable-flow@0fan/designable-react@0fan/designable-react-settings-form4399ywkf-design@acz2001/xyy-antd-layout@dataswapjs/webutils@dica/libsymf-componentyuan-designyuntu-headerunified-clitsc-layoutxt-design@dyrl/web@hezebin/dumi-theme-antd@hichat/hichat-ui@fle-ui/plus-config-provider
1.21.0

5 months ago

1.21.1

3 months ago

1.20.0

7 months ago

1.19.0

7 months ago

1.19.1

7 months ago

1.18.5

8 months ago

1.18.4

10 months ago

1.18.2

11 months ago

1.18.1

11 months ago

1.18.0

11 months ago

1.17.5

12 months ago

1.17.4

12 months ago

1.17.3

12 months ago

1.18.0-alpha.5

12 months ago

1.18.0-alpha.3

12 months ago

1.18.0-alpha.4

12 months ago

1.18.0-alpha.1

12 months ago

1.18.0-alpha.2

12 months ago

1.18.0-alpha.0

12 months ago

2.0.0-alpha.0

1 year ago

2.0.0-alpha.1

1 year ago

1.14.0

1 year ago

1.15.0

1 year ago

1.11.0-0

1 year ago

1.11.0-1

1 year ago

1.11.2

1 year ago

1.11.1

1 year ago

1.15.0-alpha.0

1 year ago

1.12.0

1 year ago

1.16.2

1 year ago

1.16.1

1 year ago

1.16.0

1 year ago

1.16.2-1

1 year ago

1.16.2-0

1 year ago

1.11.0

1 year ago

1.13.2

1 year ago

1.13.1

1 year ago

1.13.0

1 year ago

1.17.2

1 year ago

1.17.1

1 year ago

1.17.0

1 year ago

1.10.1

1 year ago

1.10.0

1 year ago

1.9.1

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.4.0

2 years ago

1.5.6

2 years ago

1.5.5

2 years ago

1.5.4

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.2.0

2 years ago

1.0.2

2 years ago

1.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.3.0

2 years ago

0.0.0-alpha.60

2 years ago

0.0.0-alpha.54

2 years ago

0.0.0-alpha.53

2 years ago

0.0.0-alpha.52

2 years ago

0.0.0-alpha.50

2 years ago

0.0.0-alpha.41

2 years ago

0.0.0-alpha.40

2 years ago

0.0.0-alpha.46

2 years ago

0.0.0-alpha.45

2 years ago

0.0.0-alpha.44

2 years ago

0.0.0-alpha.43

2 years ago

0.0.0-alpha.49

2 years ago

0.0.0-alpha.47

2 years ago

0.0.0-alpha.39

2 years ago

0.0.0-alpha.35

2 years ago

0.0.0-alpha.38

2 years ago

0.0.0-alpha.37

2 years ago

0.0.0-alpha.36

2 years ago

0.0.0-alpha.34

3 years ago

0.0.0-alpha.19

3 years ago

0.0.0-alpha.18

3 years ago

0.0.0-alpha.31

3 years ago

0.0.0-alpha.30

3 years ago

0.0.0-alpha.33

3 years ago

0.0.0-alpha.32

3 years ago

0.0.0-alpha.17

3 years ago

0.0.0-alpha.16

3 years ago

0.0.0-alpha.15

3 years ago

0.0.0-alpha.29

3 years ago

0.0.0-alpha.20

3 years ago

0.0.0-alpha.24

3 years ago

0.0.0-alpha.23

3 years ago

0.0.0-alpha.22

3 years ago

0.0.0-alpha.21

3 years ago

0.0.0-alpha.28

3 years ago

0.0.0-alpha.27

3 years ago

0.0.0-alpha.26

3 years ago

0.0.0-alpha.25

3 years ago

0.0.0-alpha.12

3 years ago

0.0.0-alpha.11

3 years ago

0.0.0-alpha.10

3 years ago

0.0.0-alpha.9

3 years ago

0.0.0-alpha.8

3 years ago

0.0.0-alpha.7

3 years ago

0.0.0-alpha.6

3 years ago

0.0.0-alpha.5

3 years ago

0.0.0-alpha.4

3 years ago

0.0.0-alpha.3

3 years ago

0.0.0-alpha.2

3 years ago

0.0.0-alpha.1

3 years ago