@antdv-next/docs-plugins 0.0.2 → 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.2",
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',
@@ -158,9 +161,18 @@ const useStyles = createStyles(({ token }) => ({
158
161
  '& .cm-content': {
159
162
  lineHeight: 2,
160
163
  },
164
+ // CodeMirror 挂载/聚焦时首行会带激活行样式与聚焦描边,与 antdv-next 原
165
+ // code-demo 一致地隐藏,避免展开/收起代码时首行出现样式变化
166
+ // (选择器特异性足够,无需 !important)
161
167
  '& .cm-activeLine, & .cm-activeLineGutter': {
162
168
  background: 'transparent',
163
169
  },
170
+ '&.cm-focused': {
171
+ outline: 'none',
172
+ },
173
+ '&.cm-focused .cm-activeLine, &.cm-focused .cm-activeLineGutter': {
174
+ background: 'transparent',
175
+ },
164
176
  },
165
177
  '& .cm-gutters': {
166
178
  background: 'transparent',
@@ -186,14 +198,14 @@ const useStyles = createStyles(({ token }) => ({
186
198
  '& .ant-doc-demo-box-compile-error': {
187
199
  margin: 0,
188
200
  padding: '8px 16px',
189
- background: token.colorErrorBg,
190
- color: token.colorError,
201
+ background: cssVar.colorErrorBg,
202
+ color: cssVar.colorError,
191
203
  fontSize: 12,
192
204
  lineHeight: 1.6,
193
205
  whiteSpace: 'pre-wrap',
194
206
  },
195
207
  '& .ant-doc-demo-box-code-tabs': {
196
- borderTop: `1px dashed ${token.colorSplit}`,
208
+ borderTop: `1px dashed ${cssVar.colorSplit}`,
197
209
  },
198
210
  '& .ant-doc-demo-box-code-tabs .ant-tabs-nav': {
199
211
  marginBottom: 0,
@@ -214,11 +226,11 @@ const useStyles = createStyles(({ token }) => ({
214
226
  border: 0,
215
227
  padding: 0,
216
228
  background: 'transparent',
217
- color: token.colorIcon,
229
+ color: cssVar.colorIcon,
218
230
  cursor: 'pointer',
219
231
  },
220
232
  '& .ant-doc-demo-box-code-copied': {
221
- color: token.colorSuccess,
233
+ color: cssVar.colorSuccess,
222
234
  },
223
235
  },
224
236
  }))