@antdv-next/docs-plugins 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antdv-next/docs-plugins",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "private": false,
6
6
  "description": "Vite / markdown-it plugins and demo components for docs-base documentation sites",
7
7
  "license": "MIT",
@@ -44,30 +44,33 @@ const TabPane = Tabs.TabPane
44
44
 
45
45
  const context = useDemoContext()
46
46
 
47
- const useStyles = createStyles(({ token }) => ({
47
+ // 样式统一走 `--ant-*` CSS 变量(cssVar)而非解析后的 token 字面量:
48
+ // 站点切换暗黑模式时 antdv-next 仅更新 `:root`/`.css-var-*` 上的变量值,
49
+ // 字面量会被 emotion 缓存为固定颜色导致 demo 面板在暗黑下仍是亮色(白底白字)。
50
+ const useStyles = createStyles(({ token, cssVar }) => ({
48
51
  root: {
49
52
  'breakInside': 'avoid',
50
53
  'display': 'flow-root',
51
54
  'overflow': 'hidden',
52
55
  'position': 'relative',
53
56
  'boxSizing': 'border-box',
54
- 'border': `1px solid ${token.colorSplit}`,
57
+ 'border': `1px solid ${cssVar.colorSplit}`,
55
58
  'borderRadius': token.borderRadiusLG,
56
- 'background': token.colorBgContainer,
59
+ 'background': cssVar.colorBgContainer,
57
60
  'transition': 'border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease',
58
61
  'margin': '16px 0',
59
62
  '&.border-primary': {
60
- borderColor: token.colorPrimary,
61
- boxShadow: `0 0 0 3px color-mix(in srgb, ${token.colorPrimary} 12%, transparent)`,
63
+ borderColor: cssVar.colorPrimary,
64
+ boxShadow: `0 0 0 3px color-mix(in srgb, ${cssVar.colorPrimary} 12%, transparent)`,
62
65
  },
63
66
  '&.ant-doc-demo-box-debug': {
64
67
  borderColor: '#d3adf7',
65
68
  },
66
69
  '& .ant-doc-demo-box-demo': {
67
70
  padding: '24px',
68
- borderBottom: `1px solid ${token.colorSplit}`,
71
+ borderBottom: `1px solid ${cssVar.colorSplit}`,
69
72
  borderRadius: '8px 8px 0 0',
70
- background: token.colorBgContainer,
73
+ background: cssVar.colorBgContainer,
71
74
  },
72
75
  '& .ant-doc-demo-box-skeleton': {
73
76
  minHeight: 160,
@@ -100,11 +103,11 @@ const useStyles = createStyles(({ token }) => ({
100
103
  marginLeft: 16,
101
104
  padding: '1px 8px',
102
105
  borderRadius: '6px 6px 0 0',
103
- backgroundColor: token.colorBgContainer,
106
+ backgroundColor: cssVar.colorBgContainer,
104
107
  transition: 'background-color 0.4s',
105
108
  },
106
109
  '& .ant-doc-demo-box-title a': {
107
- color: token.colorText,
110
+ color: cssVar.colorText,
108
111
  textDecoration: 'none',
109
112
  fontSize: 16,
110
113
  fontWeight: 500,
@@ -113,7 +116,7 @@ const useStyles = createStyles(({ token }) => ({
113
116
  display: 'flex',
114
117
  justifyContent: 'center',
115
118
  padding: '12px 0',
116
- borderTop: `1px dashed ${token.colorSplit}`,
119
+ borderTop: `1px dashed ${cssVar.colorSplit}`,
117
120
  opacity: 0.7,
118
121
  transition: 'opacity 0.3s',
119
122
  },
@@ -129,16 +132,16 @@ const useStyles = createStyles(({ token }) => ({
129
132
  border: 0,
130
133
  padding: 0,
131
134
  background: 'transparent',
132
- color: token.colorTextSecondary,
135
+ color: cssVar.colorTextSecondary,
133
136
  cursor: 'pointer',
134
137
  transition: 'color 0.24s ease',
135
138
  },
136
139
  '& .ant-doc-demo-box-code-action:hover': {
137
- color: token.colorPrimary,
140
+ color: cssVar.colorPrimary,
138
141
  },
139
142
  '& .ant-doc-demo-box-edit-icon': {
140
143
  marginInlineStart: 4,
141
- color: token.colorTextTertiary,
144
+ color: cssVar.colorTextTertiary,
142
145
  },
143
146
  '& .ant-doc-demo-box-code': {
144
147
  'position': 'relative',
@@ -195,14 +198,14 @@ const useStyles = createStyles(({ token }) => ({
195
198
  '& .ant-doc-demo-box-compile-error': {
196
199
  margin: 0,
197
200
  padding: '8px 16px',
198
- background: token.colorErrorBg,
199
- color: token.colorError,
201
+ background: cssVar.colorErrorBg,
202
+ color: cssVar.colorError,
200
203
  fontSize: 12,
201
204
  lineHeight: 1.6,
202
205
  whiteSpace: 'pre-wrap',
203
206
  },
204
207
  '& .ant-doc-demo-box-code-tabs': {
205
- borderTop: `1px dashed ${token.colorSplit}`,
208
+ borderTop: `1px dashed ${cssVar.colorSplit}`,
206
209
  },
207
210
  '& .ant-doc-demo-box-code-tabs .ant-tabs-nav': {
208
211
  marginBottom: 0,
@@ -223,11 +226,11 @@ const useStyles = createStyles(({ token }) => ({
223
226
  border: 0,
224
227
  padding: 0,
225
228
  background: 'transparent',
226
- color: token.colorIcon,
229
+ color: cssVar.colorIcon,
227
230
  cursor: 'pointer',
228
231
  },
229
232
  '& .ant-doc-demo-box-code-copied': {
230
- color: token.colorSuccess,
233
+ color: cssVar.colorSuccess,
231
234
  },
232
235
  },
233
236
  }))