@lmzhen/dsh-evolution-skill-health 0.25.5 → 0.25.6
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/lib/client.js +21 -14
- package/lib/types/client/Panel.d.ts +3 -5
- package/package.json +3 -3
package/lib/client.js
CHANGED
|
@@ -144,18 +144,18 @@ window.__ModuleLoader__.load({
|
|
|
144
144
|
* @param props - the face (`{ rows, truncated, openHistory? }`) and the locale seat's translator.
|
|
145
145
|
* @returns the panel body.
|
|
146
146
|
*/
|
|
147
|
-
function SkillHealthPanel(
|
|
148
|
-
const t =
|
|
149
|
-
const [
|
|
147
|
+
function SkillHealthPanel(face) {
|
|
148
|
+
const t = face.t;
|
|
149
|
+
const [view, setView] = (0, react.useState)(face);
|
|
150
150
|
const [failed, setFailed] = (0, react.useState)(void 0);
|
|
151
151
|
(0, react.useEffect)(() => {
|
|
152
|
-
const load =
|
|
152
|
+
const load = face.loadRows;
|
|
153
153
|
if (load === void 0) return;
|
|
154
154
|
let live = true;
|
|
155
155
|
load().then((outcome) => {
|
|
156
156
|
if (!live) return;
|
|
157
|
-
if (outcome.ok)
|
|
158
|
-
...
|
|
157
|
+
if (outcome.ok) setView({
|
|
158
|
+
...face,
|
|
159
159
|
rows: outcome.payload.rows,
|
|
160
160
|
truncated: outcome.payload.truncated
|
|
161
161
|
});
|
|
@@ -166,9 +166,9 @@ window.__ModuleLoader__.load({
|
|
|
166
166
|
return () => {
|
|
167
167
|
live = false;
|
|
168
168
|
};
|
|
169
|
-
}, [
|
|
170
|
-
const counts = new Map(KINDS.map((kind) => [kind,
|
|
171
|
-
return (0, react.createElement)("section", null, (0, react.createElement)("p", null, t("counts").replace("{ok}", String(counts.get("ok") ?? 0)).replace("{warn}", String(counts.get("warn") ?? 0)).replace("{error}", String(counts.get("error") ?? 0)).replace("{unreadable}", String(counts.get("unreadable") ?? 0))),
|
|
169
|
+
}, [face]);
|
|
170
|
+
const counts = new Map(KINDS.map((kind) => [kind, view.rows.filter((row) => row.verdict === kind).length]));
|
|
171
|
+
return (0, react.createElement)("section", null, (0, react.createElement)("p", null, t("counts").replace("{ok}", String(counts.get("ok") ?? 0)).replace("{warn}", String(counts.get("warn") ?? 0)).replace("{error}", String(counts.get("error") ?? 0)).replace("{unreadable}", String(counts.get("unreadable") ?? 0))), view.truncated ? (0, react.createElement)("p", null, t("loading.failed")) : null, failed === void 0 ? null : (0, react.createElement)("p", null, failed), view.rows.length === 0 ? (0, react.createElement)("p", null, t("empty.noneReported")) : null, (0, react.createElement)("h3", null, t("group.byRule")), ruleTable(view, t), view.rows.filter((row) => row.verdict === "unreadable").map((row) => (0, react.createElement)("p", { key: row.name + ":unreadable" }, row.name + " — " + t("unreadable.note"))));
|
|
172
172
|
}
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region src/client/styles.ts
|
|
@@ -254,6 +254,15 @@ window.__ModuleLoader__.load({
|
|
|
254
254
|
return fallback;
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
+
const t = (key) => {
|
|
258
|
+
const fallback = zh[key] ?? key;
|
|
259
|
+
if (!registered) return fallback;
|
|
260
|
+
try {
|
|
261
|
+
return seam.locale.bind(NS)(key);
|
|
262
|
+
} catch {
|
|
263
|
+
return fallback;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
257
266
|
seam.slots.inject("sidebar.panellist", function* () {
|
|
258
267
|
yield seam.slots.register({
|
|
259
268
|
name: "sidebar.panellist",
|
|
@@ -267,12 +276,10 @@ window.__ModuleLoader__.load({
|
|
|
267
276
|
inject: () => ({
|
|
268
277
|
rows: [],
|
|
269
278
|
truncated: false,
|
|
270
|
-
loadRows: rows
|
|
279
|
+
loadRows: rows,
|
|
280
|
+
t
|
|
271
281
|
})
|
|
272
|
-
},
|
|
273
|
-
face: props.face,
|
|
274
|
-
locale: seam.locale
|
|
275
|
-
}));
|
|
282
|
+
}, SkillHealthPanel);
|
|
276
283
|
});
|
|
277
284
|
}
|
|
278
285
|
//#endregion
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { type ReactNode } from 'react';
|
|
11
11
|
import type { HealthOutcome } from './api.ts';
|
|
12
|
-
import type { LocaleSeat } from './seam.ts';
|
|
13
12
|
/** One finding, as the host reports it: `line` is null when the position cannot be named. */
|
|
14
13
|
export interface HealthFinding {
|
|
15
14
|
rule: string;
|
|
@@ -33,14 +32,13 @@ export interface HealthFace {
|
|
|
33
32
|
openHistory?: (name: string) => void;
|
|
34
33
|
/** Reads the scan result from the host route. Absent faces render their seeded rows unchanged. */
|
|
35
34
|
loadRows?: () => Promise<HealthOutcome>;
|
|
35
|
+
/** The seat's translator for this bundle's dictionary — the panel never reaches for a service. */
|
|
36
|
+
t: (key: string) => string;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Render the panel.
|
|
39
40
|
* @param props - the face (`{ rows, truncated, openHistory? }`) and the locale seat's translator.
|
|
40
41
|
* @returns the panel body.
|
|
41
42
|
*/
|
|
42
|
-
export declare function SkillHealthPanel(
|
|
43
|
-
face: HealthFace;
|
|
44
|
-
locale: LocaleSeat;
|
|
45
|
-
}): ReactNode;
|
|
43
|
+
export declare function SkillHealthPanel(face: HealthFace): ReactNode;
|
|
46
44
|
//# sourceMappingURL=Panel.d.ts.map
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
]
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"version": "0.25.
|
|
14
|
+
"version": "0.25.6",
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
44
44
|
"@deepseek-ai/dsh-host-webserver": "^0.2.0-rc.1",
|
|
45
45
|
"react": "^18.2.0",
|
|
46
|
-
"@lmzhen/dsh-evolution-curator": "^0.25.
|
|
46
|
+
"@lmzhen/dsh-evolution-curator": "^0.25.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
50
50
|
"@deepseek-ai/dsh-host-webserver": "^0.2.0-rc.1",
|
|
51
51
|
"@types/react": "~18.3.1",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
|
-
"@lmzhen/dsh-evolution-curator": "^0.25.
|
|
53
|
+
"@lmzhen/dsh-evolution-curator": "^0.25.6"
|
|
54
54
|
}
|
|
55
55
|
}
|