@jayyuen66/dsh-dir-prep-organize 0.1.7 → 0.1.9
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 +47 -3
- package/LICENSE +1 -8
- package/README.md +9 -9
- package/README.zh-CN.md +9 -9
- package/THIRD_PARTY_NOTICES.md +4 -4
- package/client.js +119 -200
- package/cordis.patch.yml +3 -0
- package/host.js +92 -39
- package/package.json +59 -53
- package/types/host.d.ts +8 -2
- package/types/src/templates.d.ts +28 -4
- package/types/src/ui-messages.d.ts +5 -0
package/client.js
CHANGED
|
@@ -7,9 +7,10 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
let exports = module.exports;
|
|
8
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
9
|
let react = require("react");
|
|
10
|
+
let _jayyuen66_dsh_plugin_shared_client = require("@jayyuen66/dsh-plugin-shared/client");
|
|
10
11
|
let zod = require("zod");
|
|
11
12
|
// node_modules/@jayyuen66/dsh-plugin-shared/dist/record.js
|
|
12
|
-
function e
|
|
13
|
+
function e(e) {
|
|
13
14
|
return typeof e == `object` && !!e && !Array.isArray(e);
|
|
14
15
|
}
|
|
15
16
|
// src/templates.ts
|
|
@@ -18,18 +19,35 @@ function e$1(e) {
|
|
|
18
19
|
* 为必填(空串表示未设置),保证下拉与设置卡无缺字段分支。 */
|
|
19
20
|
/** 视觉标记进入下拉前缀的最大字符数。 */
|
|
20
21
|
const EMOJI_MAX_LENGTH = 12;
|
|
22
|
+
/** 按 Unicode 码点截断:`String#slice` 数的是 UTF-16 码元,会把一个 emoji(代理对)或
|
|
23
|
+
* 组合字符劈成半个,落进模板后显示成空白方块。两个截断点(frontmatter 与设置卡草稿)
|
|
24
|
+
* 共用这一份实现,scripts/gen-defaults-lib.mjs 有同源镜像。 */
|
|
25
|
+
function truncateCodePoints(value, max) {
|
|
26
|
+
const points = Array.from(value);
|
|
27
|
+
return points.length > max ? points.slice(0, max).join("") : value;
|
|
28
|
+
}
|
|
29
|
+
/** id 缺失或与已收集 id 撞名 → 确定性补 `tpl-<index>`(仍撞则追加 `-<index>` 直到唯一)。
|
|
30
|
+
* 只负责取名,不登记 `seen`——登记由调用方在装配条目时按装配顺序做。 */
|
|
31
|
+
function uniqueEntryId(candidate, index, seen) {
|
|
32
|
+
if (candidate !== "" && !seen.has(candidate)) return candidate;
|
|
33
|
+
let id = `tpl-${index}`;
|
|
34
|
+
while (seen.has(id)) id = `${id}-${index}`;
|
|
35
|
+
return id;
|
|
36
|
+
}
|
|
21
37
|
/**
|
|
22
38
|
* 导入条目并入现有草稿:与既有 id 碰撞时确定性改写(追加 `-i` 直到唯一)。
|
|
23
|
-
* 返回新数组(不改输入),保证 pre-save 阶段 React key
|
|
24
|
-
*
|
|
39
|
+
* 返回新数组(不改输入),保证 pre-save 阶段 React key 唯一。sanitizeTemplateList 对**存量
|
|
40
|
+
* 快照**同样按序号补 id(缺失/空/撞名三档都管),这边要额外做的是避开草稿里已有的 id
|
|
41
|
+
* ——两个入口各管一段,不靠对方兜底。
|
|
25
42
|
*/
|
|
26
43
|
function mergeImportedTemplates(existing, incoming) {
|
|
27
44
|
const ids = new Set(existing.map(({ id }) => id));
|
|
28
45
|
const out = [...existing];
|
|
29
46
|
for (const { id: baseId, ...rest } of incoming) {
|
|
30
|
-
let id = baseId;
|
|
31
|
-
if (
|
|
32
|
-
|
|
47
|
+
let id = baseId.trim();
|
|
48
|
+
if (id === "") id = uniqueEntryId("", out.length, ids);
|
|
49
|
+
else if (ids.has(id)) {
|
|
50
|
+
id = `${id}-i`;
|
|
33
51
|
while (ids.has(id)) id = `${id}i`;
|
|
34
52
|
}
|
|
35
53
|
ids.add(id);
|
|
@@ -40,31 +58,15 @@ function mergeImportedTemplates(existing, incoming) {
|
|
|
40
58
|
}
|
|
41
59
|
return out;
|
|
42
60
|
}
|
|
43
|
-
/** 任意来源(settings 快照 / 设置卡草稿)→ 合法模板列表(纯函数,测试锁死)。
|
|
44
|
-
*
|
|
45
|
-
* - 非数组输入 → [](调用方自行决定是否回落 DEFAULT_TEMPLATES);
|
|
46
|
-
* - 剔除非对象条目与 name/text trim 后为空的条目;
|
|
47
|
-
* - name/text/description/group 一律 trim;emoji trim 后截断至 12 字符;
|
|
48
|
-
* - id 缺失或与已收集 id 撞名 → 确定性补 `tpl-<index>`(仍撞则追加
|
|
49
|
-
* `-<index>` 直到唯一)——同输入同输出,可测试;
|
|
50
|
-
* - 绝不修改输入(深比较测试锁死)。 */
|
|
51
61
|
/** 字段 → trim 后的 string;非字符串一律 ""。 */
|
|
52
62
|
function trimField(value) {
|
|
53
63
|
return typeof value === "string" ? value.trim() : "";
|
|
54
64
|
}
|
|
55
|
-
/** id 缺失或与已收集 id 撞名 → 确定性补 `tpl-<index>`(仍撞则追加 `-<index>` 直到唯一)。
|
|
56
|
-
* 只负责取名,不登记 `seen`——登记由调用方在装配条目时按装配顺序做。 */
|
|
57
|
-
function uniqueEntryId(candidate, index, seen) {
|
|
58
|
-
if (candidate !== "" && !seen.has(candidate)) return candidate;
|
|
59
|
-
let id = `tpl-${index}`;
|
|
60
|
-
while (seen.has(id)) id = `${id}-${index}`;
|
|
61
|
-
return id;
|
|
62
|
-
}
|
|
63
65
|
/** 单条归一化:剔除坏条目/空 name|text;id 缺失或撞名 → 确定性补 tpl-<index>,
|
|
64
66
|
* 返回 undefined 表示该条应被剔除。 */
|
|
65
67
|
function normalizeEntry(item, index, seen) {
|
|
66
68
|
let result;
|
|
67
|
-
if (e
|
|
69
|
+
if (e(item)) {
|
|
68
70
|
const { id, name, description, text, group, emoji } = item;
|
|
69
71
|
const nextName = trimField(name);
|
|
70
72
|
const nextText = trimField(text);
|
|
@@ -77,12 +79,19 @@ function normalizeEntry(item, index, seen) {
|
|
|
77
79
|
description: trimField(description),
|
|
78
80
|
text: nextText,
|
|
79
81
|
group: trimField(group),
|
|
80
|
-
emoji: trimField(emoji)
|
|
82
|
+
emoji: truncateCodePoints(trimField(emoji), EMOJI_MAX_LENGTH)
|
|
81
83
|
};
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
return result;
|
|
85
87
|
}
|
|
88
|
+
/** 任意来源(settings 快照 / 设置卡草稿)→ 合法模板列表(纯函数,测试锁死)。
|
|
89
|
+
*
|
|
90
|
+
* - 非数组输入 → [](调用方自行决定是否回落 DEFAULT_TEMPLATES);
|
|
91
|
+
* - 剔除非对象条目与 name/text trim 后为空的条目;
|
|
92
|
+
* - name/text/description/group 一律 trim;emoji trim 后按码点截断至 12 个字符;
|
|
93
|
+
* - id 缺失与已收集 id 撞名都由 uniqueEntryId 按序号补成唯一(同输入同输出,可测试);
|
|
94
|
+
* - 绝不修改输入(深比较测试锁死)。 */
|
|
86
95
|
function sanitizeTemplateList(raw) {
|
|
87
96
|
if (!Array.isArray(raw)) return [];
|
|
88
97
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -93,18 +102,40 @@ function sanitizeTemplateList(raw) {
|
|
|
93
102
|
}
|
|
94
103
|
return out;
|
|
95
104
|
}
|
|
105
|
+
const BACKSLASH = String.fromCodePoint(92);
|
|
106
|
+
const WIN_DRIVE_LETTER = /^[A-Za-z]:$/u;
|
|
107
|
+
const TRAILING_SEPARATORS = /[/\\]+$/u;
|
|
108
|
+
/** 绝对路径形状(与 host 侧 path.isAbsolute 同口径的宽松版:POSIX 根、win32 盘符、UNC)。
|
|
109
|
+
* client 半跑在浏览器里,没有 node:path 可用,故按形状判。 */
|
|
110
|
+
function isAbsolutePath(value) {
|
|
111
|
+
const winDrive = WIN_DRIVE_LETTER.test(value.slice(0, 2)) && (value[2] === "/" || value[2] === BACKSLASH);
|
|
112
|
+
return value.startsWith("/") || winDrive || value.startsWith(BACKSLASH + BACKSLASH);
|
|
113
|
+
}
|
|
114
|
+
/** 剥末尾分隔符;剥完为空(POSIX 根 `/`)或只剩盘符(`C:`)时留原值——后者在 win32
|
|
115
|
+
* 是「该盘当前目录」的相对形式,不是根。 */
|
|
116
|
+
function normalizeRootShape(value) {
|
|
117
|
+
const stripped = value.replace(TRAILING_SEPARATORS, "");
|
|
118
|
+
if (stripped.length === 0 || WIN_DRIVE_LETTER.test(stripped)) return value;
|
|
119
|
+
return stripped;
|
|
120
|
+
}
|
|
96
121
|
/** 任意来源(settings 快照 / 设置卡草稿)→ 合法的「导入允许目录」列表(纯函数)。
|
|
97
122
|
* host 的导入策略是「会话 cwd + 内置角色库 + importAllowRoots」,绝对路径默认拒绝,
|
|
98
123
|
* 这里登记的每一项都是**放一个读盘口子**,故:
|
|
99
124
|
* - 非数组 → [](未设置 = 一条都不登记,不是"全放行");
|
|
100
125
|
* - 非字符串 / trim 后为空 → 丢弃(空串在 host 侧 path.resolve 会落到进程 cwd,
|
|
101
126
|
* 绝不能让它变成一个隐式允许根);
|
|
102
|
-
* -
|
|
127
|
+
* - **非绝对路径 → 丢弃**:契约是「额外允许的绝对目录」,相对项会被 host 按它自己的
|
|
128
|
+
* 进程 cwd 解析,等于登记了一条用户没写过、界面上也看不出指向哪里的允许根;`~`
|
|
129
|
+
* 靠 shell 展开,host 的 path.resolve 不展开它,同归这一档;
|
|
130
|
+
* - 末尾分隔符归一后去重(`/a` 与 `/a/` 是同一棵树,不该在界面上摆两行);
|
|
131
|
+
* - 条数与单条长度都不设上限:静默丢一条就是「看着成功、内容没进去」;条目多撑长的
|
|
132
|
+
* 越界回执由 host 侧的列举上限收口。 */
|
|
103
133
|
function sanitizeAllowRoots(raw) {
|
|
104
134
|
const out = [];
|
|
105
135
|
if (Array.isArray(raw)) for (const item of raw) {
|
|
106
136
|
const root = typeof item === "string" ? item.trim() : "";
|
|
107
|
-
|
|
137
|
+
const shaped = normalizeRootShape(root);
|
|
138
|
+
if (root.length > 0 && isAbsolutePath(shaped) && !out.includes(shaped)) out.push(shaped);
|
|
108
139
|
}
|
|
109
140
|
return out;
|
|
110
141
|
}
|
|
@@ -119,6 +150,10 @@ const MAX_TIMER_MS = 2147483647;
|
|
|
119
150
|
const ORGANIZE_TIMEOUT_FALLBACK_MS = 12e4;
|
|
120
151
|
/** 客户端比 host 多等的余量:host 先超时,客户端留一点时间把它的回执读回来。 */
|
|
121
152
|
const ORGANIZE_TIMEOUT_SLACK_MS = 5e3;
|
|
153
|
+
/** 配置投影值是否可当作毫秒数用(有限且 > 0;两处取表共用同一判据)。 */
|
|
154
|
+
function isUsableTimeoutMs(value) {
|
|
155
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
156
|
+
}
|
|
122
157
|
/**
|
|
123
158
|
* `organizeTimeoutMs` 的前端取表。
|
|
124
159
|
*
|
|
@@ -130,7 +165,7 @@ const ORGANIZE_TIMEOUT_SLACK_MS = 5e3;
|
|
|
130
165
|
*/
|
|
131
166
|
function rawOrganizeTimeoutMsOf(value) {
|
|
132
167
|
const raw = value["organizeTimeoutMs"];
|
|
133
|
-
return
|
|
168
|
+
return isUsableTimeoutMs(raw) ? Math.min(Math.max(Math.trunc(raw), 1), MAX_TIMER_MS) : void 0;
|
|
134
169
|
}
|
|
135
170
|
/**
|
|
136
171
|
* 润色请求的客户端超时:host 的润色时限 + 余量,整条结果同样夹进 `[1, MAX_TIMER_MS]`。
|
|
@@ -142,7 +177,8 @@ function rawOrganizeTimeoutMsOf(value) {
|
|
|
142
177
|
* @returns 可安全交给 setTimeout 的毫秒数
|
|
143
178
|
*/
|
|
144
179
|
function organizeFetchTimeoutMs(raw) {
|
|
145
|
-
|
|
180
|
+
const base = isUsableTimeoutMs(raw) ? raw : ORGANIZE_TIMEOUT_FALLBACK_MS;
|
|
181
|
+
return Math.trunc(Math.min(Math.max(Math.min(base, 2147478647) + ORGANIZE_TIMEOUT_SLACK_MS, 1), MAX_TIMER_MS));
|
|
146
182
|
}
|
|
147
183
|
// src/client-styles.ts
|
|
148
184
|
const CARD_STYLES = [
|
|
@@ -223,6 +259,7 @@ const UI_MESSAGES = {
|
|
|
223
259
|
importEmpty: "目录下没有符合条件的角色 .md(需含 name 的 frontmatter)",
|
|
224
260
|
importAllDone: "已从内置角色库导入全部 {count} 条{skips},编辑后点「保存」生效",
|
|
225
261
|
importFromDone: "已从 {path} 导入 {count} 条{skips},编辑后点「保存」生效",
|
|
262
|
+
importTruncated: "(回执标记本次导入有内容被上限截断)",
|
|
226
263
|
importPlaceholder: "留空 = 导入内置全部角色;或填 .md / 目录路径(须在允许根内)",
|
|
227
264
|
importAriaPath: "角色导入路径",
|
|
228
265
|
importBtnTitle: "留空 = 一键导入内置全部角色;填路径 = 导入该 .md 或目录下的角色(路径须在允许根内)",
|
|
@@ -257,6 +294,7 @@ const UI_MESSAGES = {
|
|
|
257
294
|
organizeErrContextFailed: "目录上下文读取失败:{message}",
|
|
258
295
|
organizeErrModelFailed: "读取模型失败:{message}",
|
|
259
296
|
organizeErrEmpty: "输入框为空,无内容可润色",
|
|
297
|
+
organizeErrTimeout: "润色请求超时:宿主没有在时限内回报结果",
|
|
260
298
|
organizeErrUnknownReason: "未知错误",
|
|
261
299
|
organizeErrUnknown: "润色失败(未知错误)",
|
|
262
300
|
organizeCaretAria: "选择润色的角色风格",
|
|
@@ -314,6 +352,7 @@ const UI_MESSAGES = {
|
|
|
314
352
|
importEmpty: "No qualifying role .md in that directory (frontmatter must contain name)",
|
|
315
353
|
importAllDone: "Imported all {count} entries from the built-in role library{skips}; press \"Save\" after editing",
|
|
316
354
|
importFromDone: "Imported {count} entries from {path}{skips}; press \"Save\" after editing",
|
|
355
|
+
importTruncated: " (the reply flagged some content as truncated by a limit)",
|
|
317
356
|
importPlaceholder: "Empty = import every built-in role; or a .md / directory path (must be inside an allowed root)",
|
|
318
357
|
importAriaPath: "Role import path",
|
|
319
358
|
importBtnTitle: "Empty imports the whole built-in role library in one click; a path imports that .md or the roles in that directory (must be inside an allowed root)",
|
|
@@ -348,6 +387,7 @@ const UI_MESSAGES = {
|
|
|
348
387
|
organizeErrContextFailed: "Failed to read the directory context: {message}",
|
|
349
388
|
organizeErrModelFailed: "Failed to read the model: {message}",
|
|
350
389
|
organizeErrEmpty: "The input box is empty; nothing to polish",
|
|
390
|
+
organizeErrTimeout: "Polish request timed out: the host did not reply in time",
|
|
351
391
|
organizeErrUnknownReason: "unknown error",
|
|
352
392
|
organizeErrUnknown: "Polish failed (unknown error)",
|
|
353
393
|
organizeCaretAria: "Choose a role style to polish with",
|
|
@@ -370,138 +410,6 @@ const UI_MESSAGES = {
|
|
|
370
410
|
builtinRetry: "Retry"
|
|
371
411
|
}
|
|
372
412
|
};
|
|
373
|
-
// node_modules/@jayyuen66/dsh-plugin-shared/dist/errors.js
|
|
374
|
-
function t$1(e) {
|
|
375
|
-
let t = Object.getOwnPropertyDescriptor(e, `message`);
|
|
376
|
-
return t !== void 0 && `value` in t && typeof t.value == `string` ? t.value : void 0;
|
|
377
|
-
}
|
|
378
|
-
function n$1(e, r) {
|
|
379
|
-
if (r.has(e)) return `<circular cause>`;
|
|
380
|
-
r.add(e);
|
|
381
|
-
try {
|
|
382
|
-
if (!(e instanceof Error)) {
|
|
383
|
-
if (typeof e == `object` && e) {
|
|
384
|
-
let n = t$1(e);
|
|
385
|
-
if (n !== void 0 && n !== ``) return n;
|
|
386
|
-
}
|
|
387
|
-
return String(e);
|
|
388
|
-
}
|
|
389
|
-
let i = e.message === `` ? e.name : e.message, a = typeof globalThis.AggregateError == `function` && e instanceof AggregateError && e.errors.length > 0 ? ` [${e.errors.map((e) => n$1(e, r)).join(`; `)}]` : ``, o = e.cause === void 0 || e.cause === null ? `` : n$1(e.cause, r);
|
|
390
|
-
return `${i}${a}${o === `` || o === i ? `` : `: ${o}`}`;
|
|
391
|
-
} catch {
|
|
392
|
-
return `<unrenderable value>`;
|
|
393
|
-
} finally {
|
|
394
|
-
r.delete(e);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
function r$1(e) {
|
|
398
|
-
return n$1(e, /* @__PURE__ */ new Set());
|
|
399
|
-
}
|
|
400
|
-
// node_modules/@jayyuen66/dsh-plugin-shared/dist/card-ui.js
|
|
401
|
-
const c = `
|
|
402
|
-
.dsu-form{display:flex;flex-direction:column}
|
|
403
|
-
.dsu-section{margin-top:24px;padding-top:24px;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
404
|
-
.dsu-form>.dsu-section:first-child{margin-top:0;padding-top:0;border-top:0}
|
|
405
|
-
.dsu-sectionTitle{margin:0;font-size:15px;font-weight:600;line-height:1.4;color:var(--dsw-alias-label-primary)}
|
|
406
|
-
.dsu-sectionHint{margin:4px 0 0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
|
|
407
|
-
.dsu-statusbar{display:flex;flex-wrap:wrap;gap:4px 8px;margin-top:8px;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
|
|
408
|
-
.dsu-field{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,360px);column-gap:32px;align-items:center;padding:12px 0;border-top:.5px solid var(--dsw-alias-border-l2)}
|
|
409
|
-
.dsu-fieldMeta{display:flex;flex-direction:column;gap:4px;min-width:0}
|
|
410
|
-
.dsu-labelRow{display:flex;align-items:center;gap:6px;min-width:0}
|
|
411
|
-
.dsu-label{font-size:13px;font-weight:500;line-height:1.5;color:var(--dsw-alias-label-primary)}
|
|
412
|
-
.dsu-labelMono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}
|
|
413
|
-
.dsu-hint{margin:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
|
|
414
|
-
.dsu-control{min-width:0;display:flex;align-items:center;gap:8px}
|
|
415
|
-
.dsu-fieldWide{grid-template-columns:minmax(0,1fr);align-items:start}
|
|
416
|
-
.dsu-fieldWide .dsu-control{width:100%;max-width:720px;margin-top:2px}
|
|
417
|
-
.dsu-help{display:inline-flex;align-items:center;gap:6px;min-width:0}
|
|
418
|
-
.dsu-helpBtn{appearance:none;border:0;background:transparent;padding:0;width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary);cursor:help;border-radius:50%;flex:none}
|
|
419
|
-
.dsu-help:hover .dsu-helpBtn,.dsu-helpBtn:focus-visible{color:var(--dsw-alias-label-primary)}
|
|
420
|
-
.dsu-helpBtn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
421
|
-
.dsu-tip{position:fixed;z-index:60;box-sizing:border-box;max-width:min(340px,calc(100vw - 16px));max-height:calc(100vh - 16px);overflow:auto;overflow-wrap:anywhere;padding:10px 12px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);border:.5px solid var(--dsw-alias-border-l3);box-shadow:0 12px 32px rgb(0 0 0 / 45%);font-size:12px;line-height:1.6;font-weight:400;color:var(--dsw-alias-label-secondary)}
|
|
422
|
-
.dsu-input{width:100%;height:34px;padding:0 12px;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px}
|
|
423
|
-
.dsu-input:focus-visible{outline:none;border-color:var(--dsw-alias-state-business-primary)}
|
|
424
|
-
.dsu-input[aria-invalid="true"]{border-color:var(--dsw-alias-state-error-primary)}
|
|
425
|
-
.dsu-input:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}
|
|
426
|
-
.dsu-input::placeholder{color:var(--dsw-alias-label-tertiary)}
|
|
427
|
-
.dsu-textarea{height:auto;min-height:96px;padding:8px 12px;line-height:1.6;resize:vertical}
|
|
428
|
-
.dsu-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
|
|
429
|
-
.dsu-numberWrap{display:flex;flex-direction:column;gap:4px;width:100%;min-width:0}
|
|
430
|
-
.dsu-number{display:flex;align-items:center;gap:8px;min-width:0}
|
|
431
|
-
.dsu-number .dsu-input{min-width:0}
|
|
432
|
-
.dsu-unit{flex:none;font-size:12px;color:var(--dsw-alias-label-tertiary)}
|
|
433
|
-
.dsu-error{margin:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-state-error-primary)}
|
|
434
|
-
.dsu-switch{appearance:none;width:36px;height:20px;border-radius:999px;border:0;padding:2px;background:var(--dsw-alias-border-l3);display:flex;align-items:center;cursor:pointer;flex:none;transition:background-color .16s}
|
|
435
|
-
.dsu-knob{width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-primary);transition:transform .16s,background-color .16s}
|
|
436
|
-
.dsu-switch[aria-checked="true"]{background:var(--dsw-alias-label-primary)}
|
|
437
|
-
.dsu-switch[aria-checked="true"] .dsu-knob{transform:translateX(16px);background:var(--dsw-alias-label-primary-foreground)}
|
|
438
|
-
.dsu-switch:disabled{opacity:.4;cursor:not-allowed}
|
|
439
|
-
.dsu-switch:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
|
|
440
|
-
.dsu-selectWrap{position:relative;width:100%;min-width:0}
|
|
441
|
-
.dsu-select{display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;cursor:pointer}
|
|
442
|
-
.dsu-select[aria-expanded="true"]{border-color:var(--dsw-alias-state-business-primary)}
|
|
443
|
-
.dsu-selectValue{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
444
|
-
.dsu-chevron{flex:none;color:var(--dsw-alias-label-tertiary);transition:transform .16s}
|
|
445
|
-
.dsu-select[aria-expanded="true"] .dsu-chevron{transform:rotate(180deg)}
|
|
446
|
-
.dsu-menu{position:fixed;z-index:70;padding:4px;background:var(--dsw-alias-bg-layer-2);border:.5px solid var(--dsw-alias-border-l3);border-radius:12px;box-shadow:0 12px 32px rgb(0 0 0 / 50%);max-height:280px;overflow:auto}
|
|
447
|
-
.dsu-option{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:1.4;width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 10px;border-radius:8px;cursor:pointer;text-align:left}
|
|
448
|
-
.dsu-option:hover,.dsu-option[data-active="true"]{background:var(--dsw-alias-bg-layer-3)}
|
|
449
|
-
.dsu-option:disabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}
|
|
450
|
-
.dsu-option:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
|
|
451
|
-
.dsu-optionGroup{padding:6px 10px 2px;font-size:11px;font-weight:600;color:var(--dsw-alias-label-tertiary)}
|
|
452
|
-
.dsu-check{opacity:0;flex:none}
|
|
453
|
-
.dsu-option[aria-selected="true"] .dsu-check{opacity:1}
|
|
454
|
-
.dsu-savebar{display:flex;align-items:center;gap:8px;padding:12px 0;margin-top:24px;border-top:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base)}
|
|
455
|
-
.dsu-savebar[data-dirty="true"]{position:sticky;bottom:0;z-index:2;box-shadow:0 -12px 24px rgb(0 0 0 / 35%)}
|
|
456
|
-
.dsu-btn{appearance:none;border:.5px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:1.5;border-radius:var(--dsw-radius-md);padding:5px 14px;cursor:pointer;transition:background-color .12s,border-color .12s,color .12s,filter .12s}
|
|
457
|
-
.dsu-btn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-border-l3)}
|
|
458
|
-
.dsu-btn:active:not(:disabled){background:var(--dsw-alias-bg-layer-1)}
|
|
459
|
-
.dsu-btn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
460
|
-
.dsu-btn:disabled{opacity:.4;cursor:not-allowed}
|
|
461
|
-
.dsu-btnPrimary{background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}
|
|
462
|
-
.dsu-btnPrimary:hover:not(:disabled){background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);filter:brightness(.9)}
|
|
463
|
-
.dsu-btnPrimary:active:not(:disabled){background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);filter:brightness(.84)}
|
|
464
|
-
.dsu-btnDanger{color:var(--dsw-alias-state-error-primary)}
|
|
465
|
-
.dsu-btnDanger:hover:not(:disabled){color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-bg-layer-2)}
|
|
466
|
-
.dsu-status{margin-left:auto;font-size:12px;color:var(--dsw-alias-label-tertiary)}
|
|
467
|
-
.dsu-statusError{color:var(--dsw-alias-state-error-primary)}
|
|
468
|
-
.dsu-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:0 24px}
|
|
469
|
-
.dsu-grid>.dsu-field{display:flex;flex-direction:column;align-items:stretch;gap:6px;padding:10px 0;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
470
|
-
.dsu-grid>.dsu-field .dsu-control{width:100%}
|
|
471
|
-
@media (max-width:640px){
|
|
472
|
-
.dsu-field{grid-template-columns:minmax(0,1fr);align-items:start}
|
|
473
|
-
.dsu-control{width:100%;max-width:720px}
|
|
474
|
-
.dsu-section{margin-top:20px;padding-top:20px}
|
|
475
|
-
}
|
|
476
|
-
@media (prefers-reduced-motion:reduce){
|
|
477
|
-
.dsu-switch,.dsu-knob,.dsu-chevron,.dsu-btn{transition:none}
|
|
478
|
-
}
|
|
479
|
-
`;
|
|
480
|
-
function u(t) {
|
|
481
|
-
return (0, react.createElement)(`div`, { className: `dsu-form` }, t.children);
|
|
482
|
-
}
|
|
483
|
-
function d(t) {
|
|
484
|
-
return (0, react.createElement)(`section`, { className: `dsu-section` }, (0, react.createElement)(`h2`, { className: `dsu-sectionTitle` }, t.title), t.hint === void 0 ? null : (0, react.createElement)(`p`, { className: `dsu-sectionHint` }, t.hint), t.children);
|
|
485
|
-
}
|
|
486
|
-
function S(t) {
|
|
487
|
-
let n = !t.writable || t.busy || !t.dirty, r;
|
|
488
|
-
return r = t.error === null ? t.writable ? t.dirty ? t.dirtyLabel : t.cleanLabel : t.readOnlyLabel : t.error, (0, react.createElement)(`div`, {
|
|
489
|
-
className: `dsu-savebar`,
|
|
490
|
-
"data-dirty": t.dirty
|
|
491
|
-
}, (0, react.createElement)(`button`, {
|
|
492
|
-
type: `button`,
|
|
493
|
-
className: `dsu-btn dsu-btnPrimary`,
|
|
494
|
-
"data-field": `save`,
|
|
495
|
-
disabled: n,
|
|
496
|
-
onClick: t.onSave
|
|
497
|
-
}, t.busy ? t.savingLabel : t.saveLabel), (0, react.createElement)(`button`, {
|
|
498
|
-
type: `button`,
|
|
499
|
-
className: `dsu-btn`,
|
|
500
|
-
"data-field": `discard`,
|
|
501
|
-
disabled: n,
|
|
502
|
-
onClick: t.onDiscard
|
|
503
|
-
}, t.revertLabel), (0, react.createElement)(`span`, { className: t.error === null ? `dsu-status` : `dsu-status dsu-statusError` }, r));
|
|
504
|
-
}
|
|
505
413
|
// src/input-writeback.ts
|
|
506
414
|
/**
|
|
507
415
|
* 输入框异步写回的凭据与判定。
|
|
@@ -530,6 +438,13 @@ function useWriteBack(input, messages) {
|
|
|
530
438
|
if (ticket === void 0) return;
|
|
531
439
|
if (ticket.sessionId !== input.sessionId || ticket.actions !== input.actions || input.phase !== "plain") ticket.invalidated = true;
|
|
532
440
|
}, [input]);
|
|
441
|
+
(0, react.useEffect)(() => () => {
|
|
442
|
+
const ticket = active.current;
|
|
443
|
+
if (ticket !== void 0) {
|
|
444
|
+
ticket.invalidated = true;
|
|
445
|
+
active.current = void 0;
|
|
446
|
+
}
|
|
447
|
+
}, []);
|
|
533
448
|
return {
|
|
534
449
|
begin: () => {
|
|
535
450
|
const ticket = {
|
|
@@ -545,9 +460,11 @@ function useWriteBack(input, messages) {
|
|
|
545
460
|
if (active.current === ticket) active.current = void 0;
|
|
546
461
|
},
|
|
547
462
|
commit: (content, ticket) => {
|
|
548
|
-
const
|
|
463
|
+
const live = latest.current;
|
|
464
|
+
const { actions } = live;
|
|
549
465
|
if (!hasDraftFace(actions)) throw new Error(messages.unavailable);
|
|
550
|
-
|
|
466
|
+
if (ticket.sessionId !== live.sessionId || live.phase !== "plain") throw new Error(messages.stale);
|
|
467
|
+
let liveRev = live.draftRev;
|
|
551
468
|
if (hasInsertFace(actions)) liveRev = actions.captureInsertion().draftRev;
|
|
552
469
|
if (ticket.invalidated || liveRev !== ticket.draftRev) throw new Error(messages.stale);
|
|
553
470
|
actions.setDraft(content);
|
|
@@ -677,13 +594,13 @@ const DIR_PREP_DESCRIPTORS = [
|
|
|
677
594
|
result: { mode: "src-json" }
|
|
678
595
|
}
|
|
679
596
|
];
|
|
680
|
-
const isMounter = (value) =>
|
|
681
|
-
const isNamespace = (value) =>
|
|
597
|
+
const isMounter = (value) => (0, _jayyuen66_dsh_plugin_shared_client.isRecord)(value) && typeof value["$mount"] === "function";
|
|
598
|
+
const isNamespace = (value) => (0, _jayyuen66_dsh_plugin_shared_client.isRecord)(value) && typeof value["defaults"] === "function" && typeof value["context"] === "function" && typeof value["model"] === "function" && typeof value["organize"] === "function" && typeof value["importTemplates"] === "function";
|
|
682
599
|
const unwrap = (raw) => {
|
|
683
|
-
if (!
|
|
600
|
+
if (!(0, _jayyuen66_dsh_plugin_shared_client.isRecord)(raw) || typeof raw["ok"] !== "boolean") throw new TypeError("Typert Remote 应答不是 RemoteResult:缺少布尔字段 ok");
|
|
684
601
|
if (!raw["ok"]) {
|
|
685
602
|
const { error } = raw;
|
|
686
|
-
if (!
|
|
603
|
+
if (!(0, _jayyuen66_dsh_plugin_shared_client.isRecord)(error) || typeof error["code"] !== "string" || typeof error["message"] !== "string") throw new TypeError("Typert Remote 应答的 error 分支缺 code/message");
|
|
687
604
|
throw new Error(`${error["code"]}: ${error["message"]}`);
|
|
688
605
|
}
|
|
689
606
|
if (!("value" in raw)) throw new TypeError("Typert Remote 应答的 ok 分支缺 value 字段");
|
|
@@ -748,7 +665,7 @@ const CLASS_ROW_HEAD = "dpic-rowhead";
|
|
|
748
665
|
const CLASS_IMPORT_PATH = "dpic-importpath";
|
|
749
666
|
const SLOT_INPUT_RIGHT = "conversation.input.right";
|
|
750
667
|
function parseDirEntry(raw) {
|
|
751
|
-
const { name, isDir, sizeBytes, snippet } =
|
|
668
|
+
const { name, isDir, sizeBytes, snippet } = (0, _jayyuen66_dsh_plugin_shared_client.isRecord)(raw) ? raw : {};
|
|
752
669
|
return {
|
|
753
670
|
name: typeof name === "string" ? name : "",
|
|
754
671
|
isDir: isDir === true,
|
|
@@ -779,7 +696,7 @@ function skipCountsOf(skips) {
|
|
|
779
696
|
];
|
|
780
697
|
}
|
|
781
698
|
function parseContextResponse(raw) {
|
|
782
|
-
const rec =
|
|
699
|
+
const rec = (0, _jayyuen66_dsh_plugin_shared_client.isRecord)(raw) ? raw : {};
|
|
783
700
|
const { ok, truncated, entries } = rec;
|
|
784
701
|
const parsedEntries = Array.isArray(entries) ? entries.map((entry) => parseDirEntry(entry)) : void 0;
|
|
785
702
|
return {
|
|
@@ -791,7 +708,7 @@ function parseContextResponse(raw) {
|
|
|
791
708
|
};
|
|
792
709
|
}
|
|
793
710
|
function parseModelResponse(raw) {
|
|
794
|
-
const rec =
|
|
711
|
+
const rec = (0, _jayyuen66_dsh_plugin_shared_client.isRecord)(raw) ? raw : {};
|
|
795
712
|
return {
|
|
796
713
|
ok: rec["ok"] === true,
|
|
797
714
|
...spreadIfDefined(optionalString(rec, "error"), "error"),
|
|
@@ -801,7 +718,7 @@ function parseModelResponse(raw) {
|
|
|
801
718
|
};
|
|
802
719
|
}
|
|
803
720
|
function parseOrganizeResponse(raw) {
|
|
804
|
-
const rec =
|
|
721
|
+
const rec = (0, _jayyuen66_dsh_plugin_shared_client.isRecord)(raw) ? raw : {};
|
|
805
722
|
return {
|
|
806
723
|
ok: rec["ok"] === true,
|
|
807
724
|
...spreadIfDefined(optionalString(rec, "error"), "error"),
|
|
@@ -829,14 +746,14 @@ function formatImportSkips(t, skips) {
|
|
|
829
746
|
return parts.length === 0 ? "" : t("skipSummary", { list: parts.join(t("skipSeparator")) });
|
|
830
747
|
}
|
|
831
748
|
function parseImportResponse(raw) {
|
|
832
|
-
const { ok, error, count, truncated, skipped, entries } =
|
|
749
|
+
const { ok, error, count, truncated, skipped, entries } = (0, _jayyuen66_dsh_plugin_shared_client.isRecord)(raw) ? raw : {};
|
|
833
750
|
const parsedEntries = Array.isArray(entries) ? sanitizeTemplateList(entries) : void 0;
|
|
834
751
|
return {
|
|
835
752
|
ok: ok === true,
|
|
836
753
|
...typeof error === "string" ? { error } : {},
|
|
837
754
|
...typeof count === "number" ? { count } : {},
|
|
838
755
|
...truncated === true ? { truncated: true } : {},
|
|
839
|
-
...
|
|
756
|
+
...(0, _jayyuen66_dsh_plugin_shared_client.isRecord)(skipped) ? { skipped: parseImportSkips(skipped) } : {},
|
|
840
757
|
...parsedEntries === void 0 ? {} : { entries: parsedEntries }
|
|
841
758
|
};
|
|
842
759
|
}
|
|
@@ -887,11 +804,26 @@ function requireReader() {
|
|
|
887
804
|
if (dirPrepReader === void 0) throw new Error(`远程读面不可用:宿主网关没有挂上 ${DIR_PREP_NAMESPACE}`);
|
|
888
805
|
return dirPrepReader;
|
|
889
806
|
}
|
|
807
|
+
/**
|
|
808
|
+
* 润色链路里由客户端自己产生的错误:messageKey 指向 ui-messages 的键,捕获侧用当前
|
|
809
|
+
* 语言的 t 渲染成 tooltip——把文案直接写进 Error.message 会让英文界面看到硬编码中文。
|
|
810
|
+
* 宿主回执携带的原文(ctxRes.error / modelRes.error)不翻译,作为 {message} 原样带出。
|
|
811
|
+
*/
|
|
812
|
+
var LocalizedOrganizeError = class extends Error {
|
|
813
|
+
messageKey;
|
|
814
|
+
params;
|
|
815
|
+
constructor(messageKey, params = {}) {
|
|
816
|
+
super(messageKey);
|
|
817
|
+
this.name = "LocalizedOrganizeError";
|
|
818
|
+
this.messageKey = messageKey;
|
|
819
|
+
this.params = params;
|
|
820
|
+
}
|
|
821
|
+
};
|
|
890
822
|
/** 客户端超时只影响等待:宿主侧的润色超时仍由它自己的 AbortController 收口。 */
|
|
891
823
|
async function within(pending, timeoutMs) {
|
|
892
824
|
const gate = Promise.withResolvers();
|
|
893
825
|
const timer = setTimeout(() => {
|
|
894
|
-
gate.reject(
|
|
826
|
+
gate.reject(new LocalizedOrganizeError("organizeErrTimeout"));
|
|
895
827
|
}, timeoutMs);
|
|
896
828
|
try {
|
|
897
829
|
return await Promise.race([pending, gate.promise]);
|
|
@@ -912,7 +844,7 @@ async function loadBuiltinTemplates() {
|
|
|
912
844
|
let settled;
|
|
913
845
|
try {
|
|
914
846
|
const body = await within(requireReader().defaults(), REMOTE_TIMEOUT_MS);
|
|
915
|
-
const payload =
|
|
847
|
+
const payload = (0, _jayyuen66_dsh_plugin_shared_client.isRecord)(body) ? body : void 0;
|
|
916
848
|
const okKey = "ok";
|
|
917
849
|
const templatesKey = "templates";
|
|
918
850
|
const rawReason = payload?.["error"];
|
|
@@ -929,7 +861,7 @@ async function loadBuiltinTemplates() {
|
|
|
929
861
|
settled = {
|
|
930
862
|
phase: "error",
|
|
931
863
|
list: [],
|
|
932
|
-
error:
|
|
864
|
+
error: (0, _jayyuen66_dsh_plugin_shared_client.errorText)(error)
|
|
933
865
|
};
|
|
934
866
|
} finally {
|
|
935
867
|
if (builtinGeneration === generation) builtinInflight = null;
|
|
@@ -966,21 +898,6 @@ function builtinStatusRow(snap, t) {
|
|
|
966
898
|
if (!snap.fromSettings && snap.builtinPhase !== "ready") row = snap.builtinPhase === "error" ? (0, react.createElement)("div", attrs, t("builtinFailed", { message: snap.builtinError }), retryButton) : (0, react.createElement)("div", attrs, t("builtinLoading"));
|
|
967
899
|
return row;
|
|
968
900
|
}
|
|
969
|
-
/**
|
|
970
|
-
* 润色链路里由客户端自己产生的错误:messageKey 指向 ui-messages 的键,捕获侧用当前
|
|
971
|
-
* 语言的 t 渲染成 tooltip——把文案直接写进 Error.message 会让英文界面看到硬编码中文。
|
|
972
|
-
* 宿主回执携带的原文(ctxRes.error / modelRes.error)不翻译,作为 {message} 原样带出。
|
|
973
|
-
*/
|
|
974
|
-
var LocalizedOrganizeError = class extends Error {
|
|
975
|
-
messageKey;
|
|
976
|
-
params;
|
|
977
|
-
constructor(messageKey, params = {}) {
|
|
978
|
-
super(messageKey);
|
|
979
|
-
this.name = "LocalizedOrganizeError";
|
|
980
|
-
this.messageKey = messageKey;
|
|
981
|
-
this.params = params;
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
901
|
function assertOrganizeReady(ctxRes, modelRes, prompt, unknownReason) {
|
|
985
902
|
if (!ctxRes.ok) throw new LocalizedOrganizeError("organizeErrContextFailed", { message: ctxRes.error ?? unknownReason });
|
|
986
903
|
if (!modelRes.ok || modelRes.provider === void 0 || modelRes.model === void 0) throw new LocalizedOrganizeError("organizeErrModelFailed", { message: modelRes.error ?? unknownReason });
|
|
@@ -1227,7 +1144,7 @@ async function runOrganizeClick(args) {
|
|
|
1227
1144
|
writeDraft(content);
|
|
1228
1145
|
} catch (error) {
|
|
1229
1146
|
if (seq.current !== mySeq) return;
|
|
1230
|
-
setFailed(error instanceof LocalizedOrganizeError ? t(error.messageKey, error.params) :
|
|
1147
|
+
setFailed(error instanceof LocalizedOrganizeError ? t(error.messageKey, error.params) : (0, _jayyuen66_dsh_plugin_shared_client.errorText)(error));
|
|
1231
1148
|
if (flashTimer.current !== null) clearTimeout(flashTimer.current);
|
|
1232
1149
|
flashTimer.current = setTimeout(() => {
|
|
1233
1150
|
setFailed(void 0);
|
|
@@ -1635,14 +1552,16 @@ function ImportPanel(props) {
|
|
|
1635
1552
|
}), REMOTE_TIMEOUT_MS));
|
|
1636
1553
|
if (!resp.ok || resp.entries === void 0) throw new Error(resp.error ?? t("importFailedUnknown"));
|
|
1637
1554
|
const usable = resp.entries.length;
|
|
1638
|
-
const
|
|
1555
|
+
const declared = countField(resp.count);
|
|
1556
|
+
const count = declared === 0 ? usable : Math.min(declared, usable);
|
|
1639
1557
|
if (count === 0) {
|
|
1640
1558
|
setImportError(t("importEmpty"));
|
|
1641
1559
|
return;
|
|
1642
1560
|
}
|
|
1643
1561
|
props.onImported(resp.entries);
|
|
1644
1562
|
setImportPath("");
|
|
1645
|
-
const
|
|
1563
|
+
const truncatedNote = resp.truncated === true ? t("importTruncated") : "";
|
|
1564
|
+
const skipNote = `${formatImportSkips(t, resp.skipped)}${truncatedNote}`;
|
|
1646
1565
|
setImportMsg(target.length === 0 ? t("importAllDone", {
|
|
1647
1566
|
count,
|
|
1648
1567
|
skips: skipNote
|
|
@@ -1652,7 +1571,7 @@ function ImportPanel(props) {
|
|
|
1652
1571
|
skips: skipNote
|
|
1653
1572
|
}));
|
|
1654
1573
|
} catch (error) {
|
|
1655
|
-
setImportError(
|
|
1574
|
+
setImportError((0, _jayyuen66_dsh_plugin_shared_client.errorText)(error));
|
|
1656
1575
|
} finally {
|
|
1657
1576
|
setImportBusy(false);
|
|
1658
1577
|
}
|
|
@@ -1845,7 +1764,7 @@ function createPersistActions(args) {
|
|
|
1845
1764
|
const { t, editable, dirty, rootsDirty, anythingDirty, confirmReset, templates, allowRoots, draft, rootsDraft, set, unset, readBack, setDraft, setDraftFor, setRootsDraft, setBusy, setSaveError, setConfirmReset } = args;
|
|
1846
1765
|
function reportError(err) {
|
|
1847
1766
|
console.error("[dir-prep-organize] templates settings write failed:", err);
|
|
1848
|
-
setSaveError(
|
|
1767
|
+
setSaveError((0, _jayyuen66_dsh_plugin_shared_client.errorText)(err));
|
|
1849
1768
|
}
|
|
1850
1769
|
async function onSave() {
|
|
1851
1770
|
if (!editable || !anythingDirty) return;
|
|
@@ -1863,8 +1782,8 @@ function createPersistActions(args) {
|
|
|
1863
1782
|
verifyRootsPersisted(t, readBack(), nextRoots);
|
|
1864
1783
|
}
|
|
1865
1784
|
setBusy(false);
|
|
1866
|
-
setDraft(next);
|
|
1867
|
-
setRootsDraft(nextRoots);
|
|
1785
|
+
setDraft((prev) => prev === draft ? next : prev);
|
|
1786
|
+
setRootsDraft((prev) => prev === rootsDraft ? nextRoots : prev);
|
|
1868
1787
|
} catch (error) {
|
|
1869
1788
|
setBusy(false);
|
|
1870
1789
|
reportError(error);
|
|
@@ -1911,7 +1830,7 @@ function createCardBody(view) {
|
|
|
1911
1830
|
const { onCommit, onDelete, onAdd, onImported, onRootChange, onRootDelete, onRootAdd } = view.draftActions;
|
|
1912
1831
|
const { onSave, onDiscard, onReset } = view.persistActions;
|
|
1913
1832
|
const footHint = (0, react.createElement)("p", { className: "dpic-hint" }, t("footHint"));
|
|
1914
|
-
const saveBar = (0, react.createElement)(
|
|
1833
|
+
const saveBar = (0, react.createElement)(_jayyuen66_dsh_plugin_shared_client.SaveBar, {
|
|
1915
1834
|
dirty: anythingDirty,
|
|
1916
1835
|
busy,
|
|
1917
1836
|
writable: editable,
|
|
@@ -1927,7 +1846,7 @@ function createCardBody(view) {
|
|
|
1927
1846
|
},
|
|
1928
1847
|
onDiscard
|
|
1929
1848
|
});
|
|
1930
|
-
return (0, react.createElement)(
|
|
1849
|
+
return (0, react.createElement)(_jayyuen66_dsh_plugin_shared_client.CardForm, null, statusHint === "" ? null : (0, react.createElement)("p", { className: "dpic-hint" }, statusHint), (0, react.createElement)(_jayyuen66_dsh_plugin_shared_client.Section, {
|
|
1931
1850
|
title: t("rolesSection"),
|
|
1932
1851
|
hint: t("rolesHint")
|
|
1933
1852
|
}, (0, react.createElement)(CardToolbar, {
|
|
@@ -2098,7 +2017,7 @@ function apply(ctx) {
|
|
|
2098
2017
|
ctx.effect(() => {
|
|
2099
2018
|
const tag = document.createElement("style");
|
|
2100
2019
|
tag.id = "dir-prep-organize-css";
|
|
2101
|
-
tag.textContent = `${CARD_STYLES}\n${
|
|
2020
|
+
tag.textContent = `${CARD_STYLES}\n${_jayyuen66_dsh_plugin_shared_client.CARD_UI_CSS}`;
|
|
2102
2021
|
document.head.append(tag);
|
|
2103
2022
|
return () => {
|
|
2104
2023
|
tag.remove();
|
package/cordis.patch.yml
CHANGED
|
@@ -3,5 +3,8 @@
|
|
|
3
3
|
# 内置精选集由 host 半从 templates.data.mjs 经 defaults 方法按需下发。
|
|
4
4
|
# 架构与数据流见 README 与 host.ts / src/client-entry.ts。
|
|
5
5
|
- insert:
|
|
6
|
+
# 故意不写 id:shared 是本包 patch 启用的内部组件行,不是用户可停用的独立组件;
|
|
7
|
+
# 写 id 会让插件页出现一个可关闭的组件,关闭后本包设置卡会失去组件供应。
|
|
8
|
+
- name: "@jayyuen66/dsh-plugin-shared"
|
|
6
9
|
- id: dir-prep-organize
|
|
7
10
|
name: "@jayyuen66/dsh-dir-prep-organize"
|