1.20.0 • Published 14 days ago

@ant-design/cssinjs v1.20.0

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days 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-designjlltdhuaxin-antdgitee-uiluokun_designmanyidloft-editorllt-components-uimark15syky-ui-lib@vs-new/antddumi-theme-antd-web3dumi-theme-antddumi-theme-antd-forkdumi-theme-yizhufan.zhang-designftauiorca-pro-utilsomdslaboriosamquisquamntn.muuri-analyticsntnhan-workflow-buildero-rc-tablenext-ant-storynext-ant-story-sanityplasodmfe-my-test-componentsmollitiautmin-web-react-distqin-ui-reactrc-calendar-graphsecd-uiripin-ui-prors-antdreact-salmonscwrg-design-testshatir-domaincalendar-carousel@cscec/udp-antd-basebyron-pro-providerbyron-antdbitz-react-adminbitz-react-admin-uichoerodon-ui-pro-providertuzhi-layouttsc-layoutcomponent.generalcms4-js-transformertowlang-antdtopology-designableui-components-pro@cdzhxx/componentsappflow-cliant-color-panel@baic/yolk-mobileantd-v5antd-xijingantd-zjkantd-token-previewerantd-token-previewer-web3antd5_compatible4antd-transfer-perfantd-kinerantd-stripes-lddantd-styleantdwqwqchatbot-ui-react-testchat-webkittheme-krycbdesignbhd-componentsswiftcrab@dataswapjs/webutils@m-tools/antd-ext@krinopotam/ui-message-box@lockerpm/design@plasmicapp/pro-provider@plaso-design/pro-provider@nicecode/meta@pf-ui/pf-ui-react@nocobase/clientyuan-design@eflag/design@eflag/uizmaelf-designyuntu-header@formily/antd-v5@quarkunlimit/uiculinary-portal-preview-componentvite-storybook-antd@moezx/antd@mozyun/designable-formily-antd@mozyun/formily-antd@levellink/web3@lxzy/components@odinlin/formily-antd
1.20.0

14 days ago

1.19.0

30 days ago

1.19.1

30 days ago

1.18.5

1 month ago

1.18.4

3 months ago

1.18.2

4 months ago

1.18.1

5 months ago

1.18.0

5 months ago

1.17.5

5 months ago

1.17.4

5 months ago

1.17.3

5 months ago

1.18.0-alpha.5

5 months ago

1.18.0-alpha.3

5 months ago

1.18.0-alpha.4

5 months ago

1.18.0-alpha.1

5 months ago

1.18.0-alpha.2

5 months ago

1.18.0-alpha.0

6 months ago

2.0.0-alpha.0

6 months ago

2.0.0-alpha.1

6 months ago

1.14.0

9 months ago

1.15.0

9 months ago

1.11.0-0

10 months ago

1.11.0-1

10 months ago

1.11.2

10 months ago

1.11.1

10 months ago

1.15.0-alpha.0

9 months ago

1.12.0

10 months ago

1.16.2

9 months ago

1.16.1

9 months ago

1.16.0

9 months ago

1.16.2-1

9 months ago

1.16.2-0

9 months ago

1.11.0

10 months ago

1.13.2

10 months ago

1.13.1

10 months ago

1.13.0

10 months ago

1.17.2

7 months ago

1.17.1

7 months ago

1.17.0

8 months ago

1.10.1

11 months ago

1.10.0

11 months ago

1.9.1

1 year ago

1.9.0

1 year ago

1.8.1

1 year ago

1.6.2

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.4.0

1 year ago

1.5.6

1 year ago

1.5.5

1 year ago

1.5.4

1 year ago

1.5.3

1 year ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.2.0

1 year ago

1.0.2

1 year ago

1.0.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.3.0

1 year ago

0.0.0-alpha.60

1 year 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

2 years ago

0.0.0-alpha.19

2 years ago

0.0.0-alpha.18

2 years ago

0.0.0-alpha.31

2 years ago

0.0.0-alpha.30

2 years ago

0.0.0-alpha.33

2 years ago

0.0.0-alpha.32

2 years ago

0.0.0-alpha.17

2 years ago

0.0.0-alpha.16

2 years ago

0.0.0-alpha.15

2 years ago

0.0.0-alpha.29

2 years ago

0.0.0-alpha.20

2 years ago

0.0.0-alpha.24

2 years ago

0.0.0-alpha.23

2 years ago

0.0.0-alpha.22

2 years ago

0.0.0-alpha.21

2 years ago

0.0.0-alpha.28

2 years ago

0.0.0-alpha.27

2 years ago

0.0.0-alpha.26

2 years ago

0.0.0-alpha.25

2 years ago

0.0.0-alpha.12

2 years ago

0.0.0-alpha.11

2 years ago

0.0.0-alpha.10

2 years ago

0.0.0-alpha.9

2 years ago

0.0.0-alpha.8

2 years ago

0.0.0-alpha.7

2 years ago

0.0.0-alpha.6

2 years ago

0.0.0-alpha.5

2 years ago

0.0.0-alpha.4

2 years ago

0.0.0-alpha.3

2 years ago

0.0.0-alpha.2

2 years ago

0.0.0-alpha.1

2 years ago