nex_animation/frontend/nexprobe.tsx

21 lines
867 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import React from 'react'
import { renderToString } from 'react-dom/server'
import { StyleProvider, createCache, extractStyle } from '@ant-design/cssinjs'
import { Form, Input, ConfigProvider } from 'antd'
// 只渲染【没有 Form 包裹】的 Form.Item,看 vertical 样式是否存在
const App = () => (
<ConfigProvider theme={{ cssVar: true, hashed: false }}>
<Form.Item label="孤立字段" layout="vertical" style={{ width: 128 }}>
<Input />
</Form.Item>
</ConfigProvider>
)
const cache = createCache()
renderToString(<StyleProvider cache={cache}><App /></StyleProvider>)
const css = String(extractStyle(cache, { plain: true } as never))
console.log('len', css.length)
const hits = css.replace(/\s+/g, ' ').split('}').filter(r => /-vertical/.test(r))
console.log('vertical rules:', hits.length)
console.log(hits.slice(0, 6).join('\n}\n'))