@antd-tiny-vue/cssinjs

Component level cssinjs resolution for antd in vue
1,392
Install
npm install @antd-tiny-vue/cssinjs
Latest Version:0.0.11
Vue:3
License:MIT
Last Updated:Jun 11, 2023
Links: npm
Maintainer: aibayanyu

@antd-tiny-vue/cssinjs

NPM version npm download vitepress Codecov bundle size

Component level cssinjs solution used in antd-tiny-vue. 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

Install

@antd-tiny-vue/cssinjs

Development

npm install
npm dev

License

@antd-tiny-vue/cssinjs is released under the MIT license.

API

StyleProvider

Prop Desc Type Default
autoClear Clear inject style element when component remove. boolean false
cache Config cssinjs cache entity. Only set when you need ssr to extract style on you own. CacheEntity -
hashPriority Use :where selector to reduce hashId css selector priority 'low' | 'high' 'low'
container Tell cssinjs where to inject style in. Element | ShadowRoot document.head
ssrInline Component wil render inline <style /> for fallback in SSR. Not recommend. boolean false
transformers Transform css before inject in document. Please note that transformers do not support dynamic update Transformer[] -

createCache

return CacheEntity for StyleProvider.

createTheme

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

Since @antd-tiny-vue/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:

<script lang="ts" setup>
import {legacyLogicalPropertiesTransformer, StyleProvider} from '@antd-tiny-vue/cssinjs';

</script>
<template>
  <StyleProvider :transformers="[legacyLogicalPropertiesTransformer]">
    <MyApp />
  </StyleProvider>
</template>

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

Related Packages

@sarafapp/ant-design

Saraf AntDesign Components Library

3,507
use-antdv-css

更加简单的应用 ant-design-vue 的主题

312 2
@antdv/ui

Fork from Ant Design Vue. An enterprise-class UI design language and Vue-based i...

3,585 21,685
@hmfw/ant-design

基于 Ant Design v6 的 Vue3 组件库 —— 71 个高质量组件,完整 TypeScript 支持

10,269 1

Version History

Version Released Vue License
0.0.11 ^3.2.0 MIT
0.0.10 ^3.2.0 MIT
0.0.9 ^3.2.0 MIT
0.0.8 ^3.2.0 MIT
0.0.7 ^3.2.0 MIT
Pre-releases (3)
Version Released Vue License
0.0.8-beta.2 ^3.2.0 MIT
0.0.8-beta.1 ^3.2.0 MIT
0.0.1-beta.1 ^3.2.45 MIT