@linxin666/dsh-client-ui-skin-center 0.4.18 → 0.4.20
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/contracts/semantic-attrs-v1.md +2 -5
- package/lib/client.js +15 -13
- package/lib/client.js.map +1 -1
- package/lib/index.js +28 -2
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +4 -1
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
皮肤中心不写委托插件的任何属性,委托插件不写 `data-dsh-skin`,双方都无法把
|
|
72
72
|
对方卡死。委托皮肤的选择会照常持久化、开机采纳与试穿还原;让路暂停的是
|
|
73
73
|
视觉,不是插件的设置页与偏好。
|
|
74
|
-
## part 组(
|
|
74
|
+
## part 组(97 行,含各 owner 行)
|
|
75
75
|
|
|
76
76
|
shell 区域(owner: shell):
|
|
77
77
|
|
|
@@ -126,8 +126,6 @@ family / 插件区域:
|
|
|
126
126
|
| `tab-bar` / `tab` | skill-explorer | 技能中心页签条/页签(中间列面板,同 ssh);`[data-dsh-plugin="skill-explorer"] [data-dsh-part="tab-bar"]` / `[data-dsh-plugin="skill-explorer"] [data-dsh-part="tab"]` |
|
|
127
127
|
| `skill-row` | skill-explorer | 技能卡行;`[data-dsh-plugin="skill-explorer"] [data-dsh-part="skill-row"]` |
|
|
128
128
|
| `filter-bar` | skill-explorer | 技能列表筛选条(搜索框 + 工作区选择 + 刷新);`[data-dsh-plugin="skill-explorer"] [data-dsh-part="filter-bar"]` |
|
|
129
|
-
| `entry` | message-edit | 回合末尾的「编辑并重发」触发按钮;`[data-dsh-plugin="message-edit"] [data-dsh-part="entry"]` |
|
|
130
|
-
| `editor` | message-edit | 回合末尾的内联编辑器根,包含文本框、分支副作用提示与提交操作;`[data-dsh-plugin="message-edit"] [data-dsh-part="editor"]` |
|
|
131
129
|
| `entry` | session-id | 侧栏 footer 触发器;`button[data-dsh-part="entry"]`(`[data-dsh-plugin="session-id"]` 容器内) |
|
|
132
130
|
| `panel` | session-id | 会话 ID 模态面板;`[role="dialog"]` 根(`[data-dsh-part="panel"]`) |
|
|
133
131
|
| `row` | session-id | 会话列表行;面板内行容器(`[data-dsh-part="row"]`) |
|
|
@@ -196,7 +194,7 @@ shell 的 `[class*="panelGlyph"]` 内)。shell 目前不把 entry id 透传到
|
|
|
196
194
|
不进 `data-dsh-plugin`:plugin 属性标记插件面板根,皮肤里已有
|
|
197
195
|
`[data-dsh-plugin="ssh"] [class*="panel"]` 一类把根当作面板子树起点的规则,把字形也算进去会误伤。
|
|
198
196
|
|
|
199
|
-
## plugin 组(
|
|
197
|
+
## plugin 组(16 个)
|
|
200
198
|
|
|
201
199
|
| data-dsh-plugin | owner | 锚定方式 |
|
|
202
200
|
| --- | --- | --- |
|
|
@@ -211,7 +209,6 @@ shell 的 `[class*="panelGlyph"]` 内)。shell 目前不把 entry id 透传到
|
|
|
211
209
|
| `dsh-web-ui-market` | dsh-market | 创意工坊商店页 `[data-dsh-plugin="dsh-web-ui-market"]`(Web 扩展 keyed id `dsh-workshop`,独立安装时为一级 settings.section id `dsh-workshop`),商店卡与目录条目容器 |
|
|
212
210
|
| `skin-center` | skins/skin-center | 设置卡 `[data-dsh-plugin="skin-center"]`(Web 扩展 keyed id `skin-center`,独立安装时为一级 settings.section id `skin-center`,列已安装皮肤,属内置源时显式标记) |
|
|
213
211
|
| `session-id` | dsh-session-id | footer action slot entry id `session-id`;`[data-dsh-plugin="session-id"]`(面板 overlay 根 + 入口触发器) |
|
|
214
|
-
| `message-edit` | dsh-message-edit | `conversation.chat.turnTail` slot entry id `message-edit`;`[data-dsh-plugin="message-edit"]`(触发按钮 + 内联编辑器根) |
|
|
215
212
|
| `usage` | dsh-usage | 设置页 `[data-dsh-plugin="usage"]`(Web 扩展 keyed id `dsh-usage`,独立安装时为一级 settings.section id `dsh-usage`);侧栏底部速览卡容器 `[data-dsh-usage-foot-card]` |
|
|
216
213
|
| `preset-center` | dsh-preset-center | 创意工坊卡片的「预设」标签页面板(`dsh-workshop.panel` keyed 槽 key `preset`);`[data-dsh-plugin="preset-center"]` |
|
|
217
214
|
| `liangshen` | dsh-liangshen | 首页输入框内的梁神模式拨杆;`[data-dsh-plugin="liangshen"][data-dsh-part="lever"]`,slot entry id `liangshen-lever` |
|
package/lib/client.js
CHANGED
|
@@ -84,6 +84,8 @@ window.__ModuleLoader__.load({
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
+
/** Document-relative v2 API base for the browser half and injected hrefs. */
|
|
88
|
+
const CLIENT_API_BASE = "/api/skin-center/v2".slice(1);
|
|
87
89
|
//#endregion
|
|
88
90
|
//#region src/client/runtime/semantic-adapter.ts
|
|
89
91
|
/**
|
|
@@ -1253,7 +1255,7 @@ window.__ModuleLoader__.load({
|
|
|
1253
1255
|
function createSkinController(deps) {
|
|
1254
1256
|
const doc = deps.doc;
|
|
1255
1257
|
const ledger = deps.ledger;
|
|
1256
|
-
const apiBase = deps.apiBase ??
|
|
1258
|
+
const apiBase = deps.apiBase ?? CLIENT_API_BASE;
|
|
1257
1259
|
const fetchImpl = deps.fetchImpl ?? fetch.bind(doc.defaultView);
|
|
1258
1260
|
const layers = ensureDecorationLayers(doc);
|
|
1259
1261
|
const onError = deps.onError ?? (() => {});
|
|
@@ -1681,7 +1683,7 @@ window.__ModuleLoader__.load({
|
|
|
1681
1683
|
}
|
|
1682
1684
|
function bootSkinRuntime(options = {}) {
|
|
1683
1685
|
const doc = options.doc ?? document;
|
|
1684
|
-
const apiBase = options.apiBase ??
|
|
1686
|
+
const apiBase = options.apiBase ?? CLIENT_API_BASE;
|
|
1685
1687
|
const fetchImpl = options.fetchImpl ?? fetch.bind(doc.defaultView);
|
|
1686
1688
|
const controller = createSkinController({
|
|
1687
1689
|
doc,
|
|
@@ -2223,8 +2225,8 @@ window.__ModuleLoader__.load({
|
|
|
2223
2225
|
* Nothing renders when the probe cannot be reached, so an older host never
|
|
2224
2226
|
* shows a false "not installed" prompt.
|
|
2225
2227
|
*/
|
|
2226
|
-
/**
|
|
2227
|
-
const EXTERNAL_WALLPAPER_API =
|
|
2228
|
+
/** Document-relative probe URL (the client base in src/core/api-prefix.ts). */
|
|
2229
|
+
const EXTERNAL_WALLPAPER_API = `${CLIENT_API_BASE}/external-wallpaper`;
|
|
2228
2230
|
/** Fallbacks used only when the host omits a field. */
|
|
2229
2231
|
const FALLBACK = {
|
|
2230
2232
|
packageName: "dsh-plugin-wallpaper-engine",
|
|
@@ -3375,7 +3377,7 @@ window.__ModuleLoader__.load({
|
|
|
3375
3377
|
setVerifying(true);
|
|
3376
3378
|
setError(null);
|
|
3377
3379
|
try {
|
|
3378
|
-
const res = await fetch(
|
|
3380
|
+
const res = await fetch(`${CLIENT_API_BASE}/verify`, {
|
|
3379
3381
|
method: "POST",
|
|
3380
3382
|
headers: { "content-type": "application/json" },
|
|
3381
3383
|
body: JSON.stringify({ autoRepair: true })
|
|
@@ -3418,7 +3420,7 @@ window.__ModuleLoader__.load({
|
|
|
3418
3420
|
});
|
|
3419
3421
|
let targets;
|
|
3420
3422
|
try {
|
|
3421
|
-
const res = await fetch(
|
|
3423
|
+
const res = await fetch(`${CLIENT_API_BASE}/skins/versions`, { cache: "no-store" });
|
|
3422
3424
|
const json = await res.json().catch(() => null);
|
|
3423
3425
|
if (!res.ok || json?.ok !== true || !Array.isArray(json.rows)) throw new Error("versions-unavailable");
|
|
3424
3426
|
targets = json.rows.filter((row) => row.outdated).map((row) => row.id);
|
|
@@ -3451,7 +3453,7 @@ window.__ModuleLoader__.load({
|
|
|
3451
3453
|
note: ""
|
|
3452
3454
|
});
|
|
3453
3455
|
try {
|
|
3454
|
-
if (!(await fetch(
|
|
3456
|
+
if (!(await fetch(`${CLIENT_API_BASE}/skins/${encodeURIComponent(id)}/repair`, { method: "POST" })).ok) failed++;
|
|
3455
3457
|
} catch {
|
|
3456
3458
|
failed++;
|
|
3457
3459
|
}
|
|
@@ -3509,7 +3511,7 @@ window.__ModuleLoader__.load({
|
|
|
3509
3511
|
note: ""
|
|
3510
3512
|
});
|
|
3511
3513
|
try {
|
|
3512
|
-
if (!(await fetch(
|
|
3514
|
+
if (!(await fetch(`${CLIENT_API_BASE}/skins/${encodeURIComponent(skin.manifest.id)}/uninstall`, { method: "POST" })).ok) failed++;
|
|
3513
3515
|
} catch {
|
|
3514
3516
|
failed++;
|
|
3515
3517
|
}
|
|
@@ -3533,7 +3535,7 @@ window.__ModuleLoader__.load({
|
|
|
3533
3535
|
try {
|
|
3534
3536
|
if (tryingId === id) await preview.runSkin(() => runtime.controller.exitTryOn());
|
|
3535
3537
|
if (activeId === id) await preview.runSkin(restoreOfficialLook);
|
|
3536
|
-
const res = await fetch(
|
|
3538
|
+
const res = await fetch(`${CLIENT_API_BASE}/skins/${encodeURIComponent(id)}/uninstall`, {
|
|
3537
3539
|
method: "POST",
|
|
3538
3540
|
headers: { "content-type": "application/json" }
|
|
3539
3541
|
});
|
|
@@ -3548,7 +3550,7 @@ window.__ModuleLoader__.load({
|
|
|
3548
3550
|
}
|
|
3549
3551
|
};
|
|
3550
3552
|
const dark = document.body.hasAttribute("data-ds-dark-theme");
|
|
3551
|
-
const apiBase = runtime.apiBase ??
|
|
3553
|
+
const apiBase = runtime.apiBase ?? CLIENT_API_BASE;
|
|
3552
3554
|
/** One row: try-on control + apply button + optional uninstall. Shared by the official card and every skin card. */
|
|
3553
3555
|
const actionButtons = (opts) => {
|
|
3554
3556
|
const isUser = opts.entry?.origin === "user";
|
|
@@ -5760,7 +5762,7 @@ window.__ModuleLoader__.load({
|
|
|
5760
5762
|
/** The building package's version, when the bundle carries it. */
|
|
5761
5763
|
function bakedVersion() {
|
|
5762
5764
|
try {
|
|
5763
|
-
return "0.4.
|
|
5765
|
+
return "0.4.20";
|
|
5764
5766
|
} catch {
|
|
5765
5767
|
return;
|
|
5766
5768
|
}
|
|
@@ -5981,7 +5983,7 @@ window.__ModuleLoader__.load({
|
|
|
5981
5983
|
*/
|
|
5982
5984
|
function beatHeartbeat() {
|
|
5983
5985
|
reportDailyHeartbeat(SELF_ITEM);
|
|
5984
|
-
fetch(
|
|
5986
|
+
fetch(`${CLIENT_API_BASE}/catalog`).then((res) => res.ok ? res.json() : null).then((catalog) => {
|
|
5985
5987
|
if (!catalog || !Array.isArray(catalog.skins)) return;
|
|
5986
5988
|
const items = [...SELF_ITEM];
|
|
5987
5989
|
for (const skin of catalog.skins) {
|
|
@@ -6020,7 +6022,7 @@ window.__ModuleLoader__.load({
|
|
|
6020
6022
|
}, "ui-skin-center: body scope");
|
|
6021
6023
|
const theme = ctx.get("theme");
|
|
6022
6024
|
const settings = bindConfigForm(ctx);
|
|
6023
|
-
const V2_ACTIVE_URL =
|
|
6025
|
+
const V2_ACTIVE_URL = `${CLIENT_API_BASE}/active`;
|
|
6024
6026
|
let persistTimer = null;
|
|
6025
6027
|
const postBackground = (next, keepalive = false) => {
|
|
6026
6028
|
fetch(V2_ACTIVE_URL, {
|