+
默认情况下不会自动删除添加的样式
+
+
+
+ {show && (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )}
+
+ );
+}
diff --git a/docs/examples/ssr-hydrate-file.tsx b/docs/examples/ssr-hydrate-file.tsx
index dbd60e53..4ba2fc07 100644
--- a/docs/examples/ssr-hydrate-file.tsx
+++ b/docs/examples/ssr-hydrate-file.tsx
@@ -2,7 +2,7 @@ import { createCache, StyleProvider } from '@ant-design/cssinjs';
import React from 'react';
import { hydrateRoot } from 'react-dom/client';
import { Demo } from './ssr-advanced';
-import './ssr-hydrate-file.css';
+// import './ssr-hydrate-file.css';
// Copy from `ssr-advanced-hydrate.tsx`
const HTML = `
diff --git a/package.json b/package.json
index e8a40e9b..064b817c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@ant-design/cssinjs",
- "version": "1.17.2",
+ "version": "1.18.0-alpha.1",
"description": "Component level cssinjs resolution for antd",
"keywords": [
"react",
@@ -25,11 +25,12 @@
"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 && np --yolo --no-publish",
+ "prepublishOnly": "npm run compile && np --yolo --no-publish --branch=next --tag=next",
"postpublish": "npm run gh-pages",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
diff --git a/src/extractStyle.ts b/src/extractStyle.ts
new file mode 100644
index 00000000..871a0c66
--- /dev/null
+++ b/src/extractStyle.ts
@@ -0,0 +1,83 @@
+import type Cache from './Cache';
+import {
+ extract as tokenExtractStyle,
+ TOKEN_PREFIX,
+} from './hooks/useCacheToken';
+import {
+ CSS_VAR_PREFIX,
+ extract as cssVarExtractStyle,
+} from './hooks/useCSSVarRegister';
+import {
+ extract as styleExtractStyle,
+ STYLE_PREFIX,
+} from './hooks/useStyleRegister';
+import { toStyleStr } from './util';
+import {
+ ATTR_CACHE_MAP,
+ serialize as serializeCacheMap,
+} from './util/cacheMapUtil';
+
+const ExtractStyleFns = {
+ [STYLE_PREFIX]: styleExtractStyle,
+ [TOKEN_PREFIX]: tokenExtractStyle,
+ [CSS_VAR_PREFIX]: cssVarExtractStyle,
+};
+
+function isNotNull