@24city/web-console 0.3.1 → 0.3.2
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/CHANGELOG.md +8 -0
- package/GUIDELINES.md +2 -1
- package/dist/styles.css +8 -0
- package/dist/testing/guard.js +54 -48
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
- 修正:没有标题也没有关闭按钮的 SideSheet 顶上平白空出 44px。Semi 在这种情况下仍渲染一个空头部(上下内边距 24px + 20px),
|
|
6
|
+
内层透明、自己画面板的抽屉(如 AdFlow 的素材详情)会在这里露出遮罩。主题把空头部隐藏(`.semi-sidesheet-header:empty`),有标题的抽屉不变。
|
|
7
|
+
- 守卫:`checkUiLibraryUsage` 新增 `static-spinner`,`.tsx` 里不带 `spin` 的 `<IconSpin>` 报违规。Semi 的图标默认不转,从 Arco 的
|
|
8
|
+
`IconLoading`(默认会转)换过来时容易漏,AdFlow 有 9 处处理中的图标因此是静止的。升级后产品若有这种写法守卫测试会失败,加上 `spin` 即可。
|
|
9
|
+
- 组件总览页新增「Semi 侧边抽屉 · 无标题」。
|
|
10
|
+
|
|
3
11
|
## 0.3.1
|
|
4
12
|
|
|
5
13
|
- 账号菜单给产品留了一块额度:`customization.AccountAllowance` 是一个组件,排在套餐区之后、个人中心之前,收到当前空间和用户
|
package/GUIDELINES.md
CHANGED
|
@@ -237,6 +237,7 @@
|
|
|
237
237
|
|
|
238
238
|
- 图标只用 Semi 图标,默认实心风格;同一组入口不要实心和线性混用。图标跟随文字字号,单独定尺寸时取 12、14、16、18、20、24。
|
|
239
239
|
- 状态图标用对应的状态色,功能图标跟随文字颜色(`currentColor`),选中态转主色。
|
|
240
|
+
- 表示“处理中”的图标写 `<IconSpin spin />`:Semi 的图标默认不转(Arco 的 `IconLoading` 默认会转,迁移时容易漏),守卫会指出不带 `spin` 的写法。
|
|
240
241
|
- 空状态和结果页用 Semi 插画(`StatusResult` 已封装);产品自己的装饰插画保持同一套风格,只做装饰(`alt=""`、不接收指针)。
|
|
241
242
|
- 位图按最大显示尺寸的 2 倍导出再入库,不把生成的原图直接放进 `src/assets/`。产品图标用一张 SVG(`brand.markUrl`),favicon 用同一张。
|
|
242
243
|
|
|
@@ -262,7 +263,7 @@
|
|
|
262
263
|
|
|
263
264
|
## 14. 怎么检查
|
|
264
265
|
|
|
265
|
-
- **守卫测试**(`@24city/web-console/testing/guard`,每个产品一个测试文件):`checkUiLibraryUsage
|
|
266
|
+
- **守卫测试**(`@24city/web-console/testing/guard`,每个产品一个测试文件):`checkUiLibraryUsage`(组件来源、色值、主题变量、不转的 `IconSpin`)、
|
|
266
267
|
`checkSemiVersion`、`checkSemiCssLayer`、`checkDesignScale`(字号与断点在阶梯上)。存量页面先断言违规数量不超过现状,只减不增。
|
|
267
268
|
- **`checkSemiInternals`** 统计伸进 Semi 内部结构的选择器(`.mine :global(.semi-card-body)`):这类样式在 Semi 升级时会悄悄失效,
|
|
268
269
|
优先用组件属性(`bodyStyle`、`imgStyle`、`inputStyle`),多个产品都要的调整提给底座。产品断言数量只减不增。
|
package/dist/styles.css
CHANGED
|
@@ -4951,6 +4951,14 @@ body .semi-sidesheet-header {
|
|
|
4951
4951
|
border-bottom-color: var(--app-border-1);
|
|
4952
4952
|
}
|
|
4953
4953
|
|
|
4954
|
+
/*
|
|
4955
|
+
* 没有标题也没有关闭按钮时,Semi 仍然渲染一个空头部(上下内边距 24px + 20px),抽屉顶上平白空出 44px;
|
|
4956
|
+
* 内层透明、自己画面板的抽屉(如 AdFlow 的素材详情)会在这里露出遮罩。空的就不显示。
|
|
4957
|
+
*/
|
|
4958
|
+
body .semi-sidesheet-header:empty {
|
|
4959
|
+
display: none;
|
|
4960
|
+
}
|
|
4961
|
+
|
|
4954
4962
|
body .semi-sidesheet-title {
|
|
4955
4963
|
color: var(--semi-color-text-0);
|
|
4956
4964
|
font-size: var(--app-font-size-h6);
|
package/dist/testing/guard.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { readFileSync as
|
|
2
|
-
import { relative as
|
|
3
|
-
import { D as
|
|
4
|
-
const
|
|
5
|
-
peerDependencies:
|
|
6
|
-
},
|
|
1
|
+
import { readFileSync as f, readdirSync as L, statSync as _ } from "node:fs";
|
|
2
|
+
import { relative as y, join as v } from "node:path";
|
|
3
|
+
import { D as x, F as N, B as O } from "../chunks/scale-smFifpMm.js";
|
|
4
|
+
const C = { "@douyinfe/semi-ui": "2.104.0" }, D = {
|
|
5
|
+
peerDependencies: C
|
|
6
|
+
}, R = /<(button|input|select|textarea|option|label|form|table|thead|tbody|tr|td|th|details|summary|dialog|img|a|ul|ol|li|dl|dt|dd|h[1-6]|p)(\s|>|\/)/, T = [
|
|
7
7
|
"lucide-react",
|
|
8
8
|
"@nuwa/customer-ui",
|
|
9
9
|
"@nuwa/customer-shell",
|
|
@@ -15,43 +15,49 @@ const O = { "@douyinfe/semi-ui": "2.104.0" }, C = {
|
|
|
15
15
|
".arco-",
|
|
16
16
|
"@douyinfe/semi-ui/dist/css",
|
|
17
17
|
"theme-mode"
|
|
18
|
-
],
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
], w = ["--semi-", "--app-"], F = /#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{4}|[0-9a-fA-F]{3})\b/, P = /\b(?:rgba?|hsla?)\((?!\s*var\()/, k = new RegExp(`(?:^|[\\s{;'"])(${w.map((s) => s.replace(/-/g, "\\-")).join("|")})[a-z0-9_-]*\\s*['"]?\\s*:`, "m"), W = /<IconSpin\b([^>]*)>/g, j = (s) => {
|
|
19
|
+
for (const i of s.matchAll(W))
|
|
20
|
+
if (!/(?:^|\s)spin(?=[\s=/]|$)/.test(i[1])) return i[0];
|
|
21
|
+
return null;
|
|
22
|
+
}, h = (s) => L(s).flatMap((i) => {
|
|
23
|
+
const e = v(s, i);
|
|
24
|
+
return _(e).isDirectory() ? h(e) : [e];
|
|
25
|
+
}), S = (s) => /\.test\.(ts|tsx)$/.test(s) || s.startsWith("test/") || s.endsWith(".d.ts"), X = ({ sourceRoot: s, exclude: i = S }) => {
|
|
26
|
+
const e = [], r = h(s).map((o) => ({ path: o, file: y(s, o) })).filter(({ file: o }) => !i(o));
|
|
23
27
|
for (const { path: o, file: t } of r) {
|
|
24
28
|
const n = t.endsWith(".tsx");
|
|
25
29
|
if (!/\.(tsx?|css)$/.test(t)) continue;
|
|
26
|
-
const c =
|
|
30
|
+
const c = f(o, "utf8");
|
|
27
31
|
if (n) {
|
|
28
|
-
const m = c.match(
|
|
32
|
+
const m = c.match(R);
|
|
29
33
|
m && e.push({ file: t, rule: "raw-element", detail: `应改用 Semi 组件,而不是 ${m[0].trim()}` }), /className="/.test(c) && e.push({ file: t, rule: "class-string", detail: "className 应引用 CSS Module,不写工具类字符串" });
|
|
34
|
+
const g = j(c);
|
|
35
|
+
g && e.push({ file: t, rule: "static-spinner", detail: `${g} 不会转:Semi 的 IconSpin 要加 spin` });
|
|
30
36
|
}
|
|
31
|
-
for (const m of
|
|
37
|
+
for (const m of T)
|
|
32
38
|
c.includes(m) && e.push({ file: t, rule: "forbidden-import", detail: `不应引用 ${m}` });
|
|
33
|
-
const a = c.match(
|
|
39
|
+
const a = c.match(F);
|
|
34
40
|
a && e.push({ file: t, rule: "color-literal", detail: `含有写死的色值 ${a[0]}` });
|
|
35
|
-
const u = c.match(
|
|
41
|
+
const u = c.match(P);
|
|
36
42
|
u && e.push({ file: t, rule: "color-literal", detail: `含有写死的色值 ${u[0]}` });
|
|
37
|
-
const E = c.match(
|
|
43
|
+
const E = c.match(k);
|
|
38
44
|
E && e.push({ file: t, rule: "reserved-variable", detail: `不得声明主题变量 ${E[1]}…,品牌主色只能通过 runtime-config 的 brand.primaryColor 设置` });
|
|
39
45
|
}
|
|
40
46
|
return e;
|
|
41
|
-
},
|
|
47
|
+
}, M = ["@douyinfe/semi-ui", "@douyinfe/semi-icons", "@douyinfe/semi-illustrations"], z = D.peerDependencies, d = z["@douyinfe/semi-ui"], q = (s) => {
|
|
42
48
|
var r, o;
|
|
43
|
-
const i = JSON.parse(
|
|
44
|
-
for (const t of
|
|
49
|
+
const i = JSON.parse(f(s, "utf8")), e = [];
|
|
50
|
+
for (const t of M) {
|
|
45
51
|
const n = ((r = i.dependencies) == null ? void 0 : r[t]) ?? ((o = i.devDependencies) == null ? void 0 : o[t]);
|
|
46
|
-
!(t === "@douyinfe/semi-ui" || n !== void 0) || n ===
|
|
52
|
+
!(t === "@douyinfe/semi-ui" || n !== void 0) || n === d || e.push({
|
|
47
53
|
file: "package.json",
|
|
48
54
|
rule: "semi-version",
|
|
49
|
-
detail: n ? `${t} 必须精确声明为 ${
|
|
55
|
+
detail: n ? `${t} 必须精确声明为 ${d},现在是 ${n}` : `必须声明 ${t} ${d}`
|
|
50
56
|
});
|
|
51
57
|
}
|
|
52
58
|
return e;
|
|
53
|
-
},
|
|
54
|
-
const i =
|
|
59
|
+
}, G = (s) => {
|
|
60
|
+
const i = f(s, "utf8").replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g, ""), e = /import\s*\{[^}]*\bsemiCssLayer\b[^}]*\}\s*from\s*['"]@24city\/web-console\/vite['"]/.test(i), r = /\bsemiCssLayer\s*\(\s*\)/.test(i);
|
|
55
61
|
return e && r ? [] : [
|
|
56
62
|
{
|
|
57
63
|
file: "vite.config.ts",
|
|
@@ -59,38 +65,38 @@ const O = { "@douyinfe/semi-ui": "2.104.0" }, C = {
|
|
|
59
65
|
detail: "plugins 里要加 semiCssLayer()(import { semiCssLayer } from '@24city/web-console/vite'),把 Semi 的样式放进 semi 层"
|
|
60
66
|
}
|
|
61
67
|
];
|
|
62
|
-
},
|
|
63
|
-
`).length,
|
|
68
|
+
}, A = [...Object.values(N), ...x], b = Object.values(O), $ = (s) => s.replace(/\/\*[\s\S]*?\*\//g, (i) => i.replace(/[^\n]/g, " ")), p = (s, i) => s.slice(0, i).split(`
|
|
69
|
+
`).length, I = (s, i) => h(s).map((e) => ({ path: e, file: y(s, e) })).filter(({ file: e }) => e.endsWith(".css") && !i(e)), H = ({ sourceRoot: s, exclude: i = S }) => {
|
|
64
70
|
const e = [];
|
|
65
|
-
for (const { path: r, file: o } of
|
|
66
|
-
const t =
|
|
71
|
+
for (const { path: r, file: o } of I(s, i)) {
|
|
72
|
+
const t = $(f(r, "utf8"));
|
|
67
73
|
for (const n of t.matchAll(/font-size\s*:\s*(\d+(?:\.\d+)?)px/g))
|
|
68
|
-
|
|
74
|
+
A.includes(Number(n[1])) || e.push({
|
|
69
75
|
file: o,
|
|
70
76
|
line: p(t, n.index),
|
|
71
77
|
rule: "font-size-scale",
|
|
72
|
-
detail: `font-size: ${n[1]}px 不在字号阶梯上(${[...
|
|
78
|
+
detail: `font-size: ${n[1]}px 不在字号阶梯上(${[...A].sort((l, c) => l - c).join("、")})`
|
|
73
79
|
});
|
|
74
80
|
for (const n of t.matchAll(/@media[^{]*/g))
|
|
75
81
|
for (const l of n[0].matchAll(/(min|max)-width\s*:\s*(\d+(?:\.\d+)?)px/g))
|
|
76
|
-
|
|
82
|
+
b.includes(Number(l[2])) || e.push({
|
|
77
83
|
file: o,
|
|
78
84
|
line: p(t, n.index),
|
|
79
85
|
rule: "breakpoint",
|
|
80
|
-
detail: `@media 的 ${l[1]}-width: ${l[2]}px 不是规定的断点(${
|
|
86
|
+
detail: `@media 的 ${l[1]}-width: ${l[2]}px 不是规定的断点(${b.join("、")})`
|
|
81
87
|
});
|
|
82
88
|
}
|
|
83
89
|
return e;
|
|
84
|
-
},
|
|
90
|
+
}, B = /(?:^|[\s>+~])(?::global\(\s*)?\.(semi-[A-Za-z0-9-]+)/, V = /:not\((?:[^()]|\([^()]*\))*\)/g, J = ({ sourceRoot: s, exclude: i = S }) => {
|
|
85
91
|
const e = [];
|
|
86
|
-
for (const { path: r, file: o } of
|
|
87
|
-
const t =
|
|
92
|
+
for (const { path: r, file: o } of I(s, i)) {
|
|
93
|
+
const t = $(f(r, "utf8"));
|
|
88
94
|
for (const n of t.matchAll(/([^{}]+)\{/g)) {
|
|
89
95
|
const l = n[1];
|
|
90
96
|
if (l.trimStart().startsWith("@")) continue;
|
|
91
97
|
let c = 0;
|
|
92
98
|
for (const a of l.split(",")) {
|
|
93
|
-
const u = a.replace(
|
|
99
|
+
const u = a.replace(V, "").trim().match(B);
|
|
94
100
|
u && e.push({
|
|
95
101
|
file: o,
|
|
96
102
|
line: p(t, n.index + c + (a.length - a.trimStart().length)),
|
|
@@ -103,16 +109,16 @@ const O = { "@douyinfe/semi-ui": "2.104.0" }, C = {
|
|
|
103
109
|
return e;
|
|
104
110
|
};
|
|
105
111
|
export {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
b as ALLOWED_BREAKPOINTS,
|
|
113
|
+
A as ALLOWED_FONT_SIZES,
|
|
114
|
+
d as EXPECTED_SEMI_VERSION,
|
|
115
|
+
T as FORBIDDEN_SNIPPETS,
|
|
116
|
+
R as RAW_ELEMENT_PATTERN,
|
|
117
|
+
w as RESERVED_VARIABLE_PREFIXES,
|
|
118
|
+
M as SEMI_PACKAGES,
|
|
119
|
+
H as checkDesignScale,
|
|
120
|
+
G as checkSemiCssLayer,
|
|
121
|
+
J as checkSemiInternals,
|
|
122
|
+
q as checkSemiVersion,
|
|
123
|
+
X as checkUiLibraryUsage
|
|
118
124
|
};
|