{"name":"@ant-design/cssinjs","version":"1.22.1","description":"Component level cssinjs resolution for antd","keywords":["react","cssinjs","antd","ant-design"],"main":"./lib/index","module":"./es/index","homepage":"https://github.com/ant-design/cssinjs","repository":{"type":"git","url":"git+ssh://git@github.com/ant-design/cssinjs.git"},"bugs":{"url":"http://github.com/ant-design/cssinjs/issues"},"license":"MIT","scripts":{"start":"dumi dev","dev":"father dev","docs:build":"dumi build","docs:deploy":"gh-pages -d .doc","compile":"father build","gh-pages":"npm run docs:build && npm run docs:deploy","prepublishOnly":"npm run compile ","postpublish":"npm run gh-pages","lint":"eslint src/ --ext .ts,.tsx,.jsx,.js,.md","prettier":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","pretty-quick":"pretty-quick","test":"vitest --watch=false","test:watch":"vitest","coverage":"vitest run --coverage"},"dependencies":{"@babel/runtime":"^7.11.1","@emotion/hash":"^0.8.0","@emotion/unitless":"^0.7.5","classnames":"^2.3.1","csstype":"^3.1.3","rc-util":"^5.35.0","stylis":"^4.3.4"},"devDependencies":{"@ctrl/tinycolor":"^3.4.0","@rc-component/father-plugin":"^1.0.1","@testing-library/jest-dom":"^5.16.3","@testing-library/react":"^13.0.0","@types/classnames":"^2.2.9","@types/enzyme":"^3.10.11","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@types/responselike":"^1.0.0","@types/stylis":"^4.0.2","@types/testing-library__jest-dom":"^5.14.5","@umijs/fabric":"^2.0.8","@vitest/coverage-c8":"^0.31.0","coveralls":"^3.0.6","cross-env":"^7.0.2","dumi":"^2.1.13","eslint":"^7.0.0","father":"^4.0.0","gh-pages":"^3.1.0","husky":"^4.2.5","jsdom":"^22.0.0","np":"^7.0.0","prettier":"^2.0.5","pretty-quick":"^3.0.0","react":"^18.0.0","react-dom":"^18.0.0","typescript":"^4.0.5","vitest":"^0.31.0"},"peerDependencies":{"react":">=16.0.0","react-dom":">=16.0.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"_id":"@ant-design/cssinjs@1.22.1","gitHead":"5ab45803eedcc11f6a7270291e2a0c227da8dc31","types":"./lib/index.d.ts","_nodeVersion":"22.5.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-SLuXM4wiEE1blOx94iXrkOgseMZHzdr4ngdFu3VVDq6AOWh7rlwqTkMAtJho3EsBF6x/eUGOtK53VZXGQG7+sQ==","shasum":"00e943a6387a8080aba8b927df8236df3e07e964","tarball":"http://registry-npm.ywwl.com/@ant-design/cssinjs/download/@ant-design/cssinjs-1.22.1.tgz","fileCount":152,"unpackedSize":289981,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3oKxbN3ay7q2l7uXRv5/Pak+ru7y3Qpdsr578FINGcwIgFYvzwObM8E32XXIvYk7UQGuB2wmm5lZR8VyGESSyICs="}],"size":53975,"noattachment":false,"key":"/@ant-design/cssinjs/-/@ant-design/cssinjs-1.22.1.tgz"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cssinjs_1.22.1_1733303815820_0.8438091461001176"},"_hasShrinkwrap":false,"readme":"# @ant-design/cssinjs\n\n[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url]\n\n[npm-image]: http://img.shields.io/npm/v/@ant-design/cssinjs.svg?style=flat-square\n[npm-url]: http://npmjs.org/package/@ant-design/cssinjs\n[github-actions-image]: https://github.com/ant-design/cssinjs/workflows/CI/badge.svg\n[github-actions-url]: https://github.com/ant-design/cssinjs/actions\n[codecov-image]: https://img.shields.io/codecov/c/github/ant-design/cssinjs/master.svg?style=flat-square\n[codecov-url]: https://codecov.io/gh/ant-design/cssinjs/branch/master\n[download-image]: https://img.shields.io/npm/dm/@ant-design/cssinjs.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@ant-design/cssinjs\n[bundlephobia-url]: https://bundlephobia.com/result?p=@ant-design/cssinjs\n[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@ant-design/cssinjs\n\nComponent level cssinjs solution used in [ant.design](https://ant.design). It's a subset of [Emotion](https://emotion.sh/) 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:\n\n- stylis\n- @emotion/hash\n- @emotion/unitless\n\n## Live Demo\n\nhttps://ant-design.github.io/cssinjs/\n\n## Install\n\n```bash\nnpm install @ant-design/cssinjs\n```\n\nor\n\n```bash\nyarn add @ant-design/cssinjs\n```\n\n```bash\npnpm add @ant-design/cssinjs\n```\n\n## Development\n\n```\nnpm install\nnpm start\n```\n\n## License\n\n@ant-design/cssinjs is released under the MIT license.\n\n## API\n\n### StyleProvider\n\n| Prop | Desc | Type | Default |\n| --- | --- | --- | --- |\n| autoClear | Clear inject style element when component remove. | boolean | false |\n| cache | Config cssinjs cache entity. Only set when you need ssr to extract style on you own. | CacheEntity | - |\n| hashPriority | Use `:where` selector to reduce hashId css selector priority | `'low' \\| 'high'` | `'low'` |\n| container | Tell cssinjs where to inject style in. | Element \\| ShadowRoot | `document.head` |\n| ssrInline | Component wil render inline `<style />` for fallback in SSR. Not recommend. | boolean | false |\n| transformers | Transform css before inject in document. Please note that `transformers` do not support dynamic update | Transformer[] | - |\n\n### createCache\n\nreturn CacheEntity for StyleProvider.\n\n### createTheme\n\nCreate theme object. When same algorithm provided, it will return same object.\n\n### Design Token related API\n\nSince `@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.\n\n### extractStyle\n\nExtracts the styles from the cache and returns them as a string.\n\n#### Parameters\n\n- `cache` (Cache): The cache instance containing the styles.\n- `options` (object | boolean, optional): Options for extracting the styles.\n  - `plain` (boolean, optional): If true, the styles will be returned in plain format. Default is false.\n  - `types` (string | string[], optional): The types of styles to extract. Default is ['style', 'token', 'cssVar'].\n\n#### Returns\n\n- (string): The extracted styles as a string.\n\n#### Example\n\n```typescript\nimport { extractStyle, createCache } from '@ant-design/cssinjs';\n\n// 创建并填充缓存\nconst cache = createCache();\n// 注意：在实际使用中，缓存通常会在渲染组件时自动填充\n\n// 提取样式\nconst styles = extractStyle(cache, { plain: true, types: ['style', 'token'] });\n\n// 使用提取的样式\nconst styleElement = document.createElement('style');\nstyleElement.innerHTML = styles;\ndocument.head.appendChild(styleElement);\n```\n\n## Transform\n\nWhen you need transform CSSObject before inject style. You can use `transformers` to handle this:\n\n```tsx | pure\nimport {\n  legacyLogicalPropertiesTransformer,\n  StyleProvider,\n} from '@ant-design/cssinjs';\n\nexport default () => (\n  <StyleProvider transformers={[legacyLogicalPropertiesTransformer]}>\n    <MyApp />\n  </StyleProvider>\n);\n```\n\nFollow are the transform we provide:\n\n#### legacyLogicalPropertiesTransformer\n\nConvert logical properties to legacy properties. e.g. `marginBlockStart` to `marginTop`:\n\n- inset\n- margin\n- padding\n- border\n\n#### px2remTransformer\n\nConvert pixel units to rem units. [px2remTransformer.options](./src/transformers/px2rem.ts)\n","publish_time":1733303816001,"maintainers":[{"name":"afc163","email":"afc163@gmail.com"},{"name":"zombiej","email":"smith3816@gmail.com"},{"name":"chenshuai2144","email":"wasd2144@hotmail.com"},{"name":"vagusx","email":"onlylae@sina.com"},{"name":"arvinxx","email":"arvinx@foxmail.com"},{"name":"madccc","email":"1075746765@qq.com"}],"_cnpm_publish_time":1733303816001,"dist-tags":{"latest":"2.1.2","next":"2.0.0-alpha.9"}}