dsh-plugin-skill-folder 0.0.0-stage → 0.1.0
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/License +21 -0
- package/README.md +91 -2
- package/cordis.patch.yml +4 -0
- package/dist/catalog.d.ts +56 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/client/api.d.ts +14 -0
- package/dist/client/api.d.ts.map +1 -0
- package/dist/client/auto-group.d.ts +18 -0
- package/dist/client/auto-group.d.ts.map +1 -0
- package/dist/client/folder-card.d.ts +52 -0
- package/dist/client/folder-card.d.ts.map +1 -0
- package/dist/client/folder-form.d.ts +99 -0
- package/dist/client/folder-form.d.ts.map +1 -0
- package/dist/client/folder-page.d.ts +29 -0
- package/dist/client/folder-page.d.ts.map +1 -0
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/locales.d.ts +72 -0
- package/dist/client/locales.d.ts.map +1 -0
- package/dist/client/skill-chip.d.ts +32 -0
- package/dist/client/skill-chip.d.ts.map +1 -0
- package/dist/client/styles.d.ts +86 -0
- package/dist/client/styles.d.ts.map +1 -0
- package/dist/client.js +3756 -0
- package/dist/config.d.ts +45 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants.d.ts +31 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/folders.d.ts +39 -0
- package/dist/folders.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +701 -0
- package/dist/routes.d.ts +46 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/search-tool.d.ts +176 -0
- package/dist/search-tool.d.ts.map +1 -0
- package/dist/search.d.ts +54 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/skills.d.ts +72 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +103 -4
package/dist/client.js
ADDED
|
@@ -0,0 +1,3756 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "dsh-plugin-skill-folder",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
//#region \0rolldown/runtime.js
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
//#endregion
|
|
10
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
11
|
+
let react = require("react");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
//#region src/constants.ts
|
|
14
|
+
/** 共享常量:插件标识、工具名、配置默认值与路由路径。 */
|
|
15
|
+
/** 插件标识,同时是包名、字典命名空间与 cordis.patch.yml 的行 id。 */
|
|
16
|
+
const PLUGIN_ID = "dsh-plugin-skill-folder";
|
|
17
|
+
/** 全局技能列表路由。 */
|
|
18
|
+
const ROUTE_PATH = "/api/skill-folder/skills";
|
|
19
|
+
/** 摘要字符上限范围。 */
|
|
20
|
+
const DESCRIPTION_MAX_LENGTH_RANGE = {
|
|
21
|
+
min: 40,
|
|
22
|
+
max: 2e3
|
|
23
|
+
};
|
|
24
|
+
/** 未分组区域在界面与拖放中的标识。 */
|
|
25
|
+
const UNGROUPED_ID = "__ungrouped__";
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/client/api.ts
|
|
28
|
+
/**
|
|
29
|
+
* 配置页调用的同源路由:读取全局技能列表。
|
|
30
|
+
* 导出 SkillItem、SkillsPayload 与 fetchSkills。
|
|
31
|
+
*/
|
|
32
|
+
/** 判断值是否是普通对象。 */
|
|
33
|
+
function isRecord$1(value) {
|
|
34
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
35
|
+
}
|
|
36
|
+
/** 把路由响应规范为技能条目,忽略无法识别的项。 */
|
|
37
|
+
function parseSkillsPayload(value) {
|
|
38
|
+
if (!isRecord$1(value) || !Array.isArray(value["skills"])) throw new Error("unexpected skills response");
|
|
39
|
+
const skills = [];
|
|
40
|
+
for (const entry of value["skills"]) {
|
|
41
|
+
if (!isRecord$1(entry) || typeof entry["name"] !== "string") continue;
|
|
42
|
+
skills.push({
|
|
43
|
+
name: entry["name"],
|
|
44
|
+
description: typeof entry["description"] === "string" ? entry["description"] : "",
|
|
45
|
+
...typeof entry["whenToUse"] === "string" ? { whenToUse: entry["whenToUse"] } : {},
|
|
46
|
+
source: typeof entry["source"] === "string" ? entry["source"] : "",
|
|
47
|
+
...typeof entry["path"] === "string" ? { path: entry["path"] } : {}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
complete: value["complete"] !== false,
|
|
52
|
+
skills
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** 读取全局技能列表;失败时抛出带路由错误文本的异常。 */
|
|
56
|
+
async function fetchSkills(signal) {
|
|
57
|
+
const response = await fetch(ROUTE_PATH, {
|
|
58
|
+
method: "GET",
|
|
59
|
+
credentials: "same-origin",
|
|
60
|
+
cache: "no-store",
|
|
61
|
+
...signal === void 0 ? {} : { signal }
|
|
62
|
+
});
|
|
63
|
+
const text = await response.text();
|
|
64
|
+
let body;
|
|
65
|
+
try {
|
|
66
|
+
body = text === "" ? {} : JSON.parse(text);
|
|
67
|
+
} catch {
|
|
68
|
+
throw new Error(`HTTP ${String(response.status)}`);
|
|
69
|
+
}
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
const error = isRecord$1(body) ? body["error"] : void 0;
|
|
72
|
+
throw new Error(typeof error === "string" ? error : `HTTP ${String(response.status)}`);
|
|
73
|
+
}
|
|
74
|
+
return parseSkillsPayload(body);
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/folders.ts
|
|
78
|
+
/** 比较名称用的键:忽略大小写与首尾空白。 */
|
|
79
|
+
function autoGroupNameKey(name) {
|
|
80
|
+
return name.trim().toLowerCase();
|
|
81
|
+
}
|
|
82
|
+
/** 技能名到文件夹名的映射。 */
|
|
83
|
+
function folderIndex(folders) {
|
|
84
|
+
const index = /* @__PURE__ */ new Map();
|
|
85
|
+
for (const folder of folders) for (const skill of folder.skills) index.set(skill, folder.name);
|
|
86
|
+
return index;
|
|
87
|
+
}
|
|
88
|
+
/** 未归入任何文件夹的技能名,按名称排序。 */
|
|
89
|
+
function ungroupedOf(folders, skills) {
|
|
90
|
+
const index = folderIndex(folders);
|
|
91
|
+
return skills.filter((name) => !index.has(name)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
92
|
+
}
|
|
93
|
+
/** 校验文件夹列表,返回按索引定位的错误。 */
|
|
94
|
+
function validateFolders(folders) {
|
|
95
|
+
const errors = [];
|
|
96
|
+
const names = /* @__PURE__ */ new Set();
|
|
97
|
+
const members = /* @__PURE__ */ new Set();
|
|
98
|
+
for (const [index, folder] of folders.entries()) {
|
|
99
|
+
const name = folder.name.trim();
|
|
100
|
+
if (name === "") errors.push({
|
|
101
|
+
index,
|
|
102
|
+
code: "name-empty"
|
|
103
|
+
});
|
|
104
|
+
else {
|
|
105
|
+
if (name.length > 64) errors.push({
|
|
106
|
+
index,
|
|
107
|
+
code: "name-too-long"
|
|
108
|
+
});
|
|
109
|
+
const key = autoGroupNameKey(name);
|
|
110
|
+
if (names.has(key)) errors.push({
|
|
111
|
+
index,
|
|
112
|
+
code: "name-duplicate"
|
|
113
|
+
});
|
|
114
|
+
names.add(key);
|
|
115
|
+
}
|
|
116
|
+
if (folder.description.length > 500) errors.push({
|
|
117
|
+
index,
|
|
118
|
+
code: "description-too-long"
|
|
119
|
+
});
|
|
120
|
+
let duplicate = false;
|
|
121
|
+
for (const skill of folder.skills) {
|
|
122
|
+
if (members.has(skill)) duplicate = true;
|
|
123
|
+
members.add(skill);
|
|
124
|
+
}
|
|
125
|
+
if (duplicate) errors.push({
|
|
126
|
+
index,
|
|
127
|
+
code: "skill-duplicate"
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return errors;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/client/folder-form.ts
|
|
134
|
+
/** 行 id,同时是宿主配置条目 id 与表单命名空间。 */
|
|
135
|
+
const ROW_ID = PLUGIN_ID;
|
|
136
|
+
/** 插件在“插件”页的配置页键:`<包名>#<行 id>`。 */
|
|
137
|
+
const ROW_KEY = `${PLUGIN_ID}#${ROW_ID}`;
|
|
138
|
+
/** 判断值是否是普通对象。 */
|
|
139
|
+
function isRecord(value) {
|
|
140
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
141
|
+
}
|
|
142
|
+
/** 把任意值规范为文件夹列表;无法识别的项丢弃。 */
|
|
143
|
+
function coerceFolders(value) {
|
|
144
|
+
if (!Array.isArray(value)) return [];
|
|
145
|
+
const folders = [];
|
|
146
|
+
for (const entry of value) {
|
|
147
|
+
if (!isRecord(entry)) continue;
|
|
148
|
+
const name = typeof entry["name"] === "string" ? entry["name"] : "";
|
|
149
|
+
const description = typeof entry["description"] === "string" ? entry["description"] : "";
|
|
150
|
+
const skills = Array.isArray(entry["skills"]) ? entry["skills"].filter((skill) => typeof skill === "string") : [];
|
|
151
|
+
folders.push({
|
|
152
|
+
name,
|
|
153
|
+
description,
|
|
154
|
+
skills
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return folders;
|
|
158
|
+
}
|
|
159
|
+
/** 文件夹列表字段:草稿是 JSON 文本,非法或未通过校验时阻止保存。 */
|
|
160
|
+
const foldersSpec = {
|
|
161
|
+
field: "folders",
|
|
162
|
+
format: (value) => JSON.stringify(coerceFolders(value)),
|
|
163
|
+
parse: (text) => {
|
|
164
|
+
let parsed;
|
|
165
|
+
try {
|
|
166
|
+
parsed = JSON.parse(text);
|
|
167
|
+
} catch {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (!Array.isArray(parsed)) return void 0;
|
|
171
|
+
const folders = coerceFolders(parsed).map((folder) => ({
|
|
172
|
+
name: folder.name.trim(),
|
|
173
|
+
description: folder.description.trim(),
|
|
174
|
+
skills: folder.skills
|
|
175
|
+
}));
|
|
176
|
+
if (validateFolders(folders).length > 0) return void 0;
|
|
177
|
+
return {
|
|
178
|
+
kind: "set",
|
|
179
|
+
value: folders
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
/** 整数字段:空草稿恢复默认,越界或非整数时阻止保存。 */
|
|
184
|
+
function integerSpec(field, min, max) {
|
|
185
|
+
return {
|
|
186
|
+
field,
|
|
187
|
+
format: (value) => typeof value === "number" ? String(value) : "",
|
|
188
|
+
parse: (text) => {
|
|
189
|
+
const trimmed = text.trim();
|
|
190
|
+
if (trimmed === "") return { kind: "clear" };
|
|
191
|
+
const value = Number(trimmed);
|
|
192
|
+
return Number.isInteger(value) && value >= min && value <= max ? {
|
|
193
|
+
kind: "set",
|
|
194
|
+
value
|
|
195
|
+
} : void 0;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 暂存文件夹与搜索选项的编辑,保存时一次写入宿主配置。
|
|
201
|
+
* 离开配置页丢弃草稿,写入只发生在保存。
|
|
202
|
+
*/
|
|
203
|
+
var FolderForm = class {
|
|
204
|
+
form;
|
|
205
|
+
state;
|
|
206
|
+
actions;
|
|
207
|
+
/** @param scope - 宿主为该行提供的配置表单。 */
|
|
208
|
+
constructor(scope) {
|
|
209
|
+
this.form = new _deepseek_ai_dsh_client_ui_primitives.SettingsFormModel(scope, [
|
|
210
|
+
foldersSpec,
|
|
211
|
+
integerSpec("defaultLimit", 1, 20),
|
|
212
|
+
integerSpec("descriptionMaxLength", DESCRIPTION_MAX_LENGTH_RANGE.min, DESCRIPTION_MAX_LENGTH_RANGE.max)
|
|
213
|
+
]);
|
|
214
|
+
this.actions = this.form.actions();
|
|
215
|
+
this.state = this.form.bind(() => ({
|
|
216
|
+
...this.form.shell(),
|
|
217
|
+
folders: this.form.field("folders"),
|
|
218
|
+
defaultLimit: this.form.field("defaultLimit"),
|
|
219
|
+
descriptionMaxLength: this.form.field("descriptionMaxLength")
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
/** @returns 当前草稿中的文件夹列表副本。 */
|
|
223
|
+
draftFolders() {
|
|
224
|
+
const text = this.form.field("folders").text;
|
|
225
|
+
try {
|
|
226
|
+
return coerceFolders(JSON.parse(text === "" ? "[]" : text));
|
|
227
|
+
} catch {
|
|
228
|
+
return [];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/** @returns 当前草稿的校验错误。 */
|
|
232
|
+
errors() {
|
|
233
|
+
return validateFolders(this.draftFolders());
|
|
234
|
+
}
|
|
235
|
+
/** @returns 给定技能中未归入草稿文件夹的名称,按名称排序。 */
|
|
236
|
+
ungrouped(skills) {
|
|
237
|
+
return ungroupedOf(this.draftFolders(), skills);
|
|
238
|
+
}
|
|
239
|
+
/** 暂存一个字段的草稿文本。 */
|
|
240
|
+
edit(field, text) {
|
|
241
|
+
this.actions.edit(field, text);
|
|
242
|
+
}
|
|
243
|
+
/** 把字段恢复到组合层默认值。 */
|
|
244
|
+
resetField(field) {
|
|
245
|
+
this.actions.resetField(field);
|
|
246
|
+
}
|
|
247
|
+
/** 写入全部草稿。 */
|
|
248
|
+
async save() {
|
|
249
|
+
await this.form.save();
|
|
250
|
+
}
|
|
251
|
+
/** 丢弃全部草稿。 */
|
|
252
|
+
discard() {
|
|
253
|
+
this.actions.discard();
|
|
254
|
+
}
|
|
255
|
+
/** 把文件夹列表写入草稿。 */
|
|
256
|
+
replaceFolders(folders) {
|
|
257
|
+
this.actions.edit("folders", JSON.stringify(folders.map((folder) => ({
|
|
258
|
+
name: folder.name,
|
|
259
|
+
description: folder.description,
|
|
260
|
+
skills: [...folder.skills]
|
|
261
|
+
}))));
|
|
262
|
+
}
|
|
263
|
+
/** 新建文件夹。 */
|
|
264
|
+
addFolder(name, description = "") {
|
|
265
|
+
this.replaceFolders([...this.draftFolders(), {
|
|
266
|
+
name,
|
|
267
|
+
description,
|
|
268
|
+
skills: []
|
|
269
|
+
}]);
|
|
270
|
+
}
|
|
271
|
+
/** 改名,保留成员。 */
|
|
272
|
+
renameFolder(index, name) {
|
|
273
|
+
this.update(index, (folder) => ({
|
|
274
|
+
...folder,
|
|
275
|
+
name
|
|
276
|
+
}));
|
|
277
|
+
}
|
|
278
|
+
/** 改简介。 */
|
|
279
|
+
describeFolder(index, description) {
|
|
280
|
+
this.update(index, (folder) => ({
|
|
281
|
+
...folder,
|
|
282
|
+
description
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
/** 删除文件夹,成员回到未分组。 */
|
|
286
|
+
removeFolder(index) {
|
|
287
|
+
this.replaceFolders(this.draftFolders().filter((_folder, at) => at !== index));
|
|
288
|
+
}
|
|
289
|
+
/** 把技能移到目标文件夹;`null` 表示未分组。 */
|
|
290
|
+
moveSkill(skill, target) {
|
|
291
|
+
const folders = this.draftFolders().map((folder) => ({
|
|
292
|
+
...folder,
|
|
293
|
+
skills: folder.skills.filter((name) => name !== skill)
|
|
294
|
+
}));
|
|
295
|
+
if (target !== null) {
|
|
296
|
+
const folder = folders.find((entry) => entry.name === target);
|
|
297
|
+
if (folder !== void 0) folder.skills.push(skill);
|
|
298
|
+
}
|
|
299
|
+
this.replaceFolders(folders);
|
|
300
|
+
}
|
|
301
|
+
/** @returns 配置页向槽位组件提供的注入值。 */
|
|
302
|
+
inject() {
|
|
303
|
+
return {
|
|
304
|
+
hooks: { configForm: this.state },
|
|
305
|
+
...this.actions,
|
|
306
|
+
addFolder: (name, description) => this.addFolder(name, description),
|
|
307
|
+
renameFolder: (index, name) => this.renameFolder(index, name),
|
|
308
|
+
describeFolder: (index, description) => this.describeFolder(index, description),
|
|
309
|
+
removeFolder: (index) => this.removeFolder(index),
|
|
310
|
+
moveSkill: (skill, target) => this.moveSkill(skill, target),
|
|
311
|
+
replaceFolders: (folders) => this.replaceFolders(folders)
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
/** 释放对宿主表单的订阅。 */
|
|
315
|
+
dispose() {
|
|
316
|
+
this.form.dispose();
|
|
317
|
+
}
|
|
318
|
+
/** 修改一个文件夹。 */
|
|
319
|
+
update(index, change) {
|
|
320
|
+
this.replaceFolders(this.draftFolders().map((folder, at) => at === index ? change(folder) : folder));
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region node_modules/.pnpm/@dnd-kit+utilities@3.2.2_react@18.3.1/node_modules/@dnd-kit/utilities/dist/utilities.cjs.production.min.js
|
|
325
|
+
var require_utilities_cjs_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
326
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
327
|
+
var e = require("react");
|
|
328
|
+
const t = "undefined" != typeof window && void 0 !== window.document && void 0 !== window.document.createElement;
|
|
329
|
+
function n(e) {
|
|
330
|
+
const t = Object.prototype.toString.call(e);
|
|
331
|
+
return "[object Window]" === t || "[object global]" === t;
|
|
332
|
+
}
|
|
333
|
+
function r(e) {
|
|
334
|
+
return "nodeType" in e;
|
|
335
|
+
}
|
|
336
|
+
function o(e) {
|
|
337
|
+
var t, o;
|
|
338
|
+
return e ? n(e) ? e : r(e) && null != (t = null == (o = e.ownerDocument) ? void 0 : o.defaultView) ? t : window : window;
|
|
339
|
+
}
|
|
340
|
+
function u(e) {
|
|
341
|
+
const { Document: t } = o(e);
|
|
342
|
+
return e instanceof t;
|
|
343
|
+
}
|
|
344
|
+
function c(e) {
|
|
345
|
+
return !n(e) && e instanceof o(e).HTMLElement;
|
|
346
|
+
}
|
|
347
|
+
function s(e) {
|
|
348
|
+
return e instanceof o(e).SVGElement;
|
|
349
|
+
}
|
|
350
|
+
const i = t ? e.useLayoutEffect : e.useEffect;
|
|
351
|
+
function a(t) {
|
|
352
|
+
const n = e.useRef(t);
|
|
353
|
+
return i(() => {
|
|
354
|
+
n.current = t;
|
|
355
|
+
}), e.useCallback((function() {
|
|
356
|
+
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
|
|
357
|
+
return null == n.current ? void 0 : n.current(...t);
|
|
358
|
+
}), []);
|
|
359
|
+
}
|
|
360
|
+
let l = {};
|
|
361
|
+
function f(e) {
|
|
362
|
+
return function(t) {
|
|
363
|
+
for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++) r[o - 1] = arguments[o];
|
|
364
|
+
return r.reduce((t, n) => {
|
|
365
|
+
const r = Object.entries(n);
|
|
366
|
+
for (const [n, o] of r) {
|
|
367
|
+
const r = t[n];
|
|
368
|
+
null != r && (t[n] = r + e * o);
|
|
369
|
+
}
|
|
370
|
+
return t;
|
|
371
|
+
}, { ...t });
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
const d = f(1);
|
|
375
|
+
const p = f(-1);
|
|
376
|
+
function x(e) {
|
|
377
|
+
return "clientX" in e && "clientY" in e;
|
|
378
|
+
}
|
|
379
|
+
function m(e) {
|
|
380
|
+
if (!e) return !1;
|
|
381
|
+
const { TouchEvent: t } = o(e.target);
|
|
382
|
+
return t && e instanceof t;
|
|
383
|
+
}
|
|
384
|
+
const h = Object.freeze({
|
|
385
|
+
Translate: { toString(e) {
|
|
386
|
+
if (!e) return;
|
|
387
|
+
const { x: t, y: n } = e;
|
|
388
|
+
return "translate3d(" + (t ? Math.round(t) : 0) + "px, " + (n ? Math.round(n) : 0) + "px, 0)";
|
|
389
|
+
} },
|
|
390
|
+
Scale: { toString(e) {
|
|
391
|
+
if (!e) return;
|
|
392
|
+
const { scaleX: t, scaleY: n } = e;
|
|
393
|
+
return "scaleX(" + t + ") scaleY(" + n + ")";
|
|
394
|
+
} },
|
|
395
|
+
Transform: { toString(e) {
|
|
396
|
+
if (e) return [h.Translate.toString(e), h.Scale.toString(e)].join(" ");
|
|
397
|
+
} },
|
|
398
|
+
Transition: { toString(e) {
|
|
399
|
+
let { property: t, duration: n, easing: r } = e;
|
|
400
|
+
return t + " " + n + "ms " + r;
|
|
401
|
+
} }
|
|
402
|
+
});
|
|
403
|
+
const b = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
|
|
404
|
+
exports.CSS = h, exports.add = d, exports.canUseDOM = t, exports.findFirstFocusableNode = function(e) {
|
|
405
|
+
return e.matches(b) ? e : e.querySelector(b);
|
|
406
|
+
}, exports.getEventCoordinates = function(e) {
|
|
407
|
+
if (m(e)) {
|
|
408
|
+
if (e.touches && e.touches.length) {
|
|
409
|
+
const { clientX: t, clientY: n } = e.touches[0];
|
|
410
|
+
return {
|
|
411
|
+
x: t,
|
|
412
|
+
y: n
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
if (e.changedTouches && e.changedTouches.length) {
|
|
416
|
+
const { clientX: t, clientY: n } = e.changedTouches[0];
|
|
417
|
+
return {
|
|
418
|
+
x: t,
|
|
419
|
+
y: n
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return x(e) ? {
|
|
424
|
+
x: e.clientX,
|
|
425
|
+
y: e.clientY
|
|
426
|
+
} : null;
|
|
427
|
+
}, exports.getOwnerDocument = function(e) {
|
|
428
|
+
return e ? n(e) ? e.document : r(e) ? u(e) ? e : c(e) || s(e) ? e.ownerDocument : document : document : document;
|
|
429
|
+
}, exports.getWindow = o, exports.hasViewportRelativeCoordinates = x, exports.isDocument = u, exports.isHTMLElement = c, exports.isKeyboardEvent = function(e) {
|
|
430
|
+
if (!e) return !1;
|
|
431
|
+
const { KeyboardEvent: t } = o(e.target);
|
|
432
|
+
return t && e instanceof t;
|
|
433
|
+
}, exports.isNode = r, exports.isSVGElement = s, exports.isTouchEvent = m, exports.isWindow = n, exports.subtract = p, exports.useCombinedRefs = function() {
|
|
434
|
+
for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r];
|
|
435
|
+
return e.useMemo(() => (e) => {
|
|
436
|
+
n.forEach((t) => t(e));
|
|
437
|
+
}, n);
|
|
438
|
+
}, exports.useEvent = a, exports.useInterval = function() {
|
|
439
|
+
const t = e.useRef(null);
|
|
440
|
+
return [e.useCallback((e, n) => {
|
|
441
|
+
t.current = setInterval(e, n);
|
|
442
|
+
}, []), e.useCallback(() => {
|
|
443
|
+
null !== t.current && (clearInterval(t.current), t.current = null);
|
|
444
|
+
}, [])];
|
|
445
|
+
}, exports.useIsomorphicLayoutEffect = i, exports.useLatestValue = function(t, n) {
|
|
446
|
+
void 0 === n && (n = [t]);
|
|
447
|
+
const r = e.useRef(t);
|
|
448
|
+
return i(() => {
|
|
449
|
+
r.current !== t && (r.current = t);
|
|
450
|
+
}, n), r;
|
|
451
|
+
}, exports.useLazyMemo = function(t, n) {
|
|
452
|
+
const r = e.useRef();
|
|
453
|
+
return e.useMemo(() => {
|
|
454
|
+
const e = t(r.current);
|
|
455
|
+
return r.current = e, e;
|
|
456
|
+
}, [...n]);
|
|
457
|
+
}, exports.useNodeRef = function(t) {
|
|
458
|
+
const n = a(t), r = e.useRef(null);
|
|
459
|
+
return [r, e.useCallback((e) => {
|
|
460
|
+
e !== r.current && n?.(e, r.current), r.current = e;
|
|
461
|
+
}, [])];
|
|
462
|
+
}, exports.usePrevious = function(t) {
|
|
463
|
+
const n = e.useRef();
|
|
464
|
+
return e.useEffect(() => {
|
|
465
|
+
n.current = t;
|
|
466
|
+
}, [t]), n.current;
|
|
467
|
+
}, exports.useUniqueId = function(t, n) {
|
|
468
|
+
return e.useMemo(() => {
|
|
469
|
+
if (n) return n;
|
|
470
|
+
const e = null == l[t] ? 0 : l[t] + 1;
|
|
471
|
+
return l[t] = e, t + "-" + e;
|
|
472
|
+
}, [t, n]);
|
|
473
|
+
};
|
|
474
|
+
}));
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region node_modules/.pnpm/@dnd-kit+utilities@3.2.2_react@18.3.1/node_modules/@dnd-kit/utilities/dist/index.js
|
|
477
|
+
var require_dist$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
478
|
+
module.exports = require_utilities_cjs_production_min();
|
|
479
|
+
}));
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region node_modules/.pnpm/@dnd-kit+accessibility@3.1.1_react@18.3.1/node_modules/@dnd-kit/accessibility/dist/accessibility.cjs.production.min.js
|
|
482
|
+
var require_accessibility_cjs_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
483
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
484
|
+
var e;
|
|
485
|
+
var t$1 = require("react");
|
|
486
|
+
var n = (e = t$1) && "object" == typeof e && "default" in e ? e.default : e;
|
|
487
|
+
const i = { display: "none" };
|
|
488
|
+
exports.HiddenText = function(e) {
|
|
489
|
+
let { id: t, value: r } = e;
|
|
490
|
+
return n.createElement("div", {
|
|
491
|
+
id: t,
|
|
492
|
+
style: i
|
|
493
|
+
}, r);
|
|
494
|
+
}, exports.LiveRegion = function(e) {
|
|
495
|
+
let { id: t, announcement: i, ariaLiveType: r = "assertive" } = e;
|
|
496
|
+
return n.createElement("div", {
|
|
497
|
+
id: t,
|
|
498
|
+
style: {
|
|
499
|
+
position: "fixed",
|
|
500
|
+
top: 0,
|
|
501
|
+
left: 0,
|
|
502
|
+
width: 1,
|
|
503
|
+
height: 1,
|
|
504
|
+
margin: -1,
|
|
505
|
+
border: 0,
|
|
506
|
+
padding: 0,
|
|
507
|
+
overflow: "hidden",
|
|
508
|
+
clip: "rect(0 0 0 0)",
|
|
509
|
+
clipPath: "inset(100%)",
|
|
510
|
+
whiteSpace: "nowrap"
|
|
511
|
+
},
|
|
512
|
+
role: "status",
|
|
513
|
+
"aria-live": r,
|
|
514
|
+
"aria-atomic": !0
|
|
515
|
+
}, i);
|
|
516
|
+
}, exports.useAnnouncement = function() {
|
|
517
|
+
const [e, n] = t$1.useState("");
|
|
518
|
+
return {
|
|
519
|
+
announce: t$1.useCallback((e) => {
|
|
520
|
+
null != e && n(e);
|
|
521
|
+
}, []),
|
|
522
|
+
announcement: e
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
}));
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region node_modules/.pnpm/@dnd-kit+accessibility@3.1.1_react@18.3.1/node_modules/@dnd-kit/accessibility/dist/index.js
|
|
528
|
+
var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
529
|
+
module.exports = require_accessibility_cjs_production_min();
|
|
530
|
+
}));
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region node_modules/.pnpm/@dnd-kit+core@6.3.1_react-d_dd28f9613915b34fadb5fb09ef9e129f/node_modules/@dnd-kit/core/dist/core.cjs.production.min.js
|
|
533
|
+
var require_core_cjs_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
534
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
535
|
+
var e;
|
|
536
|
+
var t = require("react");
|
|
537
|
+
var n = (e = t) && "object" == typeof e && "default" in e ? e.default : e;
|
|
538
|
+
var r = require("react-dom");
|
|
539
|
+
var o = require_dist$2();
|
|
540
|
+
var i = require_dist$1();
|
|
541
|
+
const a = t.createContext(null);
|
|
542
|
+
function s(e) {
|
|
543
|
+
const n = t.useContext(a);
|
|
544
|
+
t.useEffect(() => {
|
|
545
|
+
if (!n) throw new Error("useDndMonitor must be used within a children of <DndContext>");
|
|
546
|
+
return n(e);
|
|
547
|
+
}, [e, n]);
|
|
548
|
+
}
|
|
549
|
+
const l = { draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " };
|
|
550
|
+
const c = {
|
|
551
|
+
onDragStart(e) {
|
|
552
|
+
let { active: t } = e;
|
|
553
|
+
return "Picked up draggable item " + t.id + ".";
|
|
554
|
+
},
|
|
555
|
+
onDragOver(e) {
|
|
556
|
+
let { active: t, over: n } = e;
|
|
557
|
+
return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
|
|
558
|
+
},
|
|
559
|
+
onDragEnd(e) {
|
|
560
|
+
let { active: t, over: n } = e;
|
|
561
|
+
return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
|
|
562
|
+
},
|
|
563
|
+
onDragCancel(e) {
|
|
564
|
+
let { active: t } = e;
|
|
565
|
+
return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
function d(e) {
|
|
569
|
+
let { announcements: a = c, container: d, hiddenTextDescribedById: u, screenReaderInstructions: f = l } = e;
|
|
570
|
+
const { announce: v, announcement: g } = i.useAnnouncement(), p = o.useUniqueId("DndLiveRegion"), [h, b] = t.useState(!1);
|
|
571
|
+
if (t.useEffect(() => {
|
|
572
|
+
b(!0);
|
|
573
|
+
}, []), s(t.useMemo(() => ({
|
|
574
|
+
onDragStart(e) {
|
|
575
|
+
let { active: t } = e;
|
|
576
|
+
v(a.onDragStart({ active: t }));
|
|
577
|
+
},
|
|
578
|
+
onDragMove(e) {
|
|
579
|
+
let { active: t, over: n } = e;
|
|
580
|
+
a.onDragMove && v(a.onDragMove({
|
|
581
|
+
active: t,
|
|
582
|
+
over: n
|
|
583
|
+
}));
|
|
584
|
+
},
|
|
585
|
+
onDragOver(e) {
|
|
586
|
+
let { active: t, over: n } = e;
|
|
587
|
+
v(a.onDragOver({
|
|
588
|
+
active: t,
|
|
589
|
+
over: n
|
|
590
|
+
}));
|
|
591
|
+
},
|
|
592
|
+
onDragEnd(e) {
|
|
593
|
+
let { active: t, over: n } = e;
|
|
594
|
+
v(a.onDragEnd({
|
|
595
|
+
active: t,
|
|
596
|
+
over: n
|
|
597
|
+
}));
|
|
598
|
+
},
|
|
599
|
+
onDragCancel(e) {
|
|
600
|
+
let { active: t, over: n } = e;
|
|
601
|
+
v(a.onDragCancel({
|
|
602
|
+
active: t,
|
|
603
|
+
over: n
|
|
604
|
+
}));
|
|
605
|
+
}
|
|
606
|
+
}), [v, a])), !h) return null;
|
|
607
|
+
const m = n.createElement(n.Fragment, null, n.createElement(i.HiddenText, {
|
|
608
|
+
id: u,
|
|
609
|
+
value: f.draggable
|
|
610
|
+
}), n.createElement(i.LiveRegion, {
|
|
611
|
+
id: p,
|
|
612
|
+
announcement: g
|
|
613
|
+
}));
|
|
614
|
+
return d ? r.createPortal(m, d) : m;
|
|
615
|
+
}
|
|
616
|
+
var u;
|
|
617
|
+
function f() {}
|
|
618
|
+
(function(e) {
|
|
619
|
+
e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
|
|
620
|
+
})(u || (u = {}));
|
|
621
|
+
const v = Object.freeze({
|
|
622
|
+
x: 0,
|
|
623
|
+
y: 0
|
|
624
|
+
});
|
|
625
|
+
function g(e, t) {
|
|
626
|
+
return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
|
|
627
|
+
}
|
|
628
|
+
function p(e, t) {
|
|
629
|
+
const n = o.getEventCoordinates(e);
|
|
630
|
+
return n ? (n.x - t.left) / t.width * 100 + "% " + (n.y - t.top) / t.height * 100 + "%" : "0 0";
|
|
631
|
+
}
|
|
632
|
+
function h(e, t) {
|
|
633
|
+
let { data: { value: n } } = e, { data: { value: r } } = t;
|
|
634
|
+
return n - r;
|
|
635
|
+
}
|
|
636
|
+
function b(e, t) {
|
|
637
|
+
let { data: { value: n } } = e, { data: { value: r } } = t;
|
|
638
|
+
return r - n;
|
|
639
|
+
}
|
|
640
|
+
function m(e) {
|
|
641
|
+
let { left: t, top: n, height: r, width: o } = e;
|
|
642
|
+
return [
|
|
643
|
+
{
|
|
644
|
+
x: t,
|
|
645
|
+
y: n
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
x: t + o,
|
|
649
|
+
y: n
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
x: t,
|
|
653
|
+
y: n + r
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
x: t + o,
|
|
657
|
+
y: n + r
|
|
658
|
+
}
|
|
659
|
+
];
|
|
660
|
+
}
|
|
661
|
+
function y(e, t) {
|
|
662
|
+
if (!e || 0 === e.length) return null;
|
|
663
|
+
const [n] = e;
|
|
664
|
+
return t ? n[t] : n;
|
|
665
|
+
}
|
|
666
|
+
function x(e, t, n) {
|
|
667
|
+
return void 0 === t && (t = e.left), void 0 === n && (n = e.top), {
|
|
668
|
+
x: t + .5 * e.width,
|
|
669
|
+
y: n + .5 * e.height
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
function w(e, t) {
|
|
673
|
+
const n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), o = Math.min(t.left + t.width, e.left + e.width), i = Math.min(t.top + t.height, e.top + e.height);
|
|
674
|
+
if (r < o && n < i) {
|
|
675
|
+
const a = (o - r) * (i - n);
|
|
676
|
+
return Number((a / (t.width * t.height + e.width * e.height - a)).toFixed(4));
|
|
677
|
+
}
|
|
678
|
+
return 0;
|
|
679
|
+
}
|
|
680
|
+
const C = (e) => {
|
|
681
|
+
let { collisionRect: t, droppableRects: n, droppableContainers: r } = e;
|
|
682
|
+
const o = [];
|
|
683
|
+
for (const e of r) {
|
|
684
|
+
const { id: r } = e, i = n.get(r);
|
|
685
|
+
if (i) {
|
|
686
|
+
const n = w(i, t);
|
|
687
|
+
n > 0 && o.push({
|
|
688
|
+
id: r,
|
|
689
|
+
data: {
|
|
690
|
+
droppableContainer: e,
|
|
691
|
+
value: n
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return o.sort(b);
|
|
697
|
+
};
|
|
698
|
+
function E(e, t) {
|
|
699
|
+
const { top: n, left: r, bottom: o, right: i } = t;
|
|
700
|
+
return n <= e.y && e.y <= o && r <= e.x && e.x <= i;
|
|
701
|
+
}
|
|
702
|
+
function D(e, t) {
|
|
703
|
+
return e && t ? {
|
|
704
|
+
x: e.left - t.left,
|
|
705
|
+
y: e.top - t.top
|
|
706
|
+
} : v;
|
|
707
|
+
}
|
|
708
|
+
function R(e) {
|
|
709
|
+
return function(t) {
|
|
710
|
+
for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++) r[o - 1] = arguments[o];
|
|
711
|
+
return r.reduce((t, n) => ({
|
|
712
|
+
...t,
|
|
713
|
+
top: t.top + e * n.y,
|
|
714
|
+
bottom: t.bottom + e * n.y,
|
|
715
|
+
left: t.left + e * n.x,
|
|
716
|
+
right: t.right + e * n.x
|
|
717
|
+
}), { ...t });
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
const S = R(1);
|
|
721
|
+
function M(e) {
|
|
722
|
+
if (e.startsWith("matrix3d(")) {
|
|
723
|
+
const t = e.slice(9, -1).split(/, /);
|
|
724
|
+
return {
|
|
725
|
+
x: +t[12],
|
|
726
|
+
y: +t[13],
|
|
727
|
+
scaleX: +t[0],
|
|
728
|
+
scaleY: +t[5]
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
if (e.startsWith("matrix(")) {
|
|
732
|
+
const t = e.slice(7, -1).split(/, /);
|
|
733
|
+
return {
|
|
734
|
+
x: +t[4],
|
|
735
|
+
y: +t[5],
|
|
736
|
+
scaleX: +t[0],
|
|
737
|
+
scaleY: +t[3]
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
return null;
|
|
741
|
+
}
|
|
742
|
+
const N = { ignoreTransform: !1 };
|
|
743
|
+
function O(e, t) {
|
|
744
|
+
void 0 === t && (t = N);
|
|
745
|
+
let n = e.getBoundingClientRect();
|
|
746
|
+
if (t.ignoreTransform) {
|
|
747
|
+
const { transform: t, transformOrigin: r } = o.getWindow(e).getComputedStyle(e);
|
|
748
|
+
t && (n = function(e, t, n) {
|
|
749
|
+
const r = M(t);
|
|
750
|
+
if (!r) return e;
|
|
751
|
+
const { scaleX: o, scaleY: i, x: a, y: s } = r, l = e.left - a - (1 - o) * parseFloat(n), c = e.top - s - (1 - i) * parseFloat(n.slice(n.indexOf(" ") + 1)), d = o ? e.width / o : e.width, u = i ? e.height / i : e.height;
|
|
752
|
+
return {
|
|
753
|
+
width: d,
|
|
754
|
+
height: u,
|
|
755
|
+
top: c,
|
|
756
|
+
right: l + d,
|
|
757
|
+
bottom: c + u,
|
|
758
|
+
left: l
|
|
759
|
+
};
|
|
760
|
+
}(n, t, r));
|
|
761
|
+
}
|
|
762
|
+
const { top: r, left: i, width: a, height: s, bottom: l, right: c } = n;
|
|
763
|
+
return {
|
|
764
|
+
top: r,
|
|
765
|
+
left: i,
|
|
766
|
+
width: a,
|
|
767
|
+
height: s,
|
|
768
|
+
bottom: l,
|
|
769
|
+
right: c
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
function A(e) {
|
|
773
|
+
return O(e, { ignoreTransform: !0 });
|
|
774
|
+
}
|
|
775
|
+
function L(e, t) {
|
|
776
|
+
const n = [];
|
|
777
|
+
return e ? function r(i) {
|
|
778
|
+
if (null != t && n.length >= t) return n;
|
|
779
|
+
if (!i) return n;
|
|
780
|
+
if (o.isDocument(i) && null != i.scrollingElement && !n.includes(i.scrollingElement)) return n.push(i.scrollingElement), n;
|
|
781
|
+
if (!o.isHTMLElement(i) || o.isSVGElement(i)) return n;
|
|
782
|
+
if (n.includes(i)) return n;
|
|
783
|
+
const a = o.getWindow(e).getComputedStyle(i);
|
|
784
|
+
return i !== e && function(e, t) {
|
|
785
|
+
void 0 === t && (t = o.getWindow(e).getComputedStyle(e));
|
|
786
|
+
const n = /(auto|scroll|overlay)/;
|
|
787
|
+
return [
|
|
788
|
+
"overflow",
|
|
789
|
+
"overflowX",
|
|
790
|
+
"overflowY"
|
|
791
|
+
].some((e) => {
|
|
792
|
+
const r = t[e];
|
|
793
|
+
return "string" == typeof r && n.test(r);
|
|
794
|
+
});
|
|
795
|
+
}(i, a) && n.push(i), function(e, t) {
|
|
796
|
+
return void 0 === t && (t = o.getWindow(e).getComputedStyle(e)), "fixed" === t.position;
|
|
797
|
+
}(i, a) ? n : r(i.parentNode);
|
|
798
|
+
}(e) : n;
|
|
799
|
+
}
|
|
800
|
+
function k(e) {
|
|
801
|
+
const [t] = L(e, 1);
|
|
802
|
+
return null != t ? t : null;
|
|
803
|
+
}
|
|
804
|
+
function T(e) {
|
|
805
|
+
return o.canUseDOM && e ? o.isWindow(e) ? e : o.isNode(e) ? o.isDocument(e) || e === o.getOwnerDocument(e).scrollingElement ? window : o.isHTMLElement(e) ? e : null : null : null;
|
|
806
|
+
}
|
|
807
|
+
function K(e) {
|
|
808
|
+
return o.isWindow(e) ? e.scrollX : e.scrollLeft;
|
|
809
|
+
}
|
|
810
|
+
function P(e) {
|
|
811
|
+
return o.isWindow(e) ? e.scrollY : e.scrollTop;
|
|
812
|
+
}
|
|
813
|
+
function I(e) {
|
|
814
|
+
return {
|
|
815
|
+
x: K(e),
|
|
816
|
+
y: P(e)
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
var B;
|
|
820
|
+
function z(e) {
|
|
821
|
+
return !(!o.canUseDOM || !e) && e === document.scrollingElement;
|
|
822
|
+
}
|
|
823
|
+
function F(e) {
|
|
824
|
+
const t = {
|
|
825
|
+
x: 0,
|
|
826
|
+
y: 0
|
|
827
|
+
}, n = z(e) ? {
|
|
828
|
+
height: window.innerHeight,
|
|
829
|
+
width: window.innerWidth
|
|
830
|
+
} : {
|
|
831
|
+
height: e.clientHeight,
|
|
832
|
+
width: e.clientWidth
|
|
833
|
+
}, r = {
|
|
834
|
+
x: e.scrollWidth - n.width,
|
|
835
|
+
y: e.scrollHeight - n.height
|
|
836
|
+
};
|
|
837
|
+
return {
|
|
838
|
+
isTop: e.scrollTop <= t.y,
|
|
839
|
+
isLeft: e.scrollLeft <= t.x,
|
|
840
|
+
isBottom: e.scrollTop >= r.y,
|
|
841
|
+
isRight: e.scrollLeft >= r.x,
|
|
842
|
+
maxScroll: r,
|
|
843
|
+
minScroll: t
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
(function(e) {
|
|
847
|
+
e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
|
|
848
|
+
})(B || (B = {}));
|
|
849
|
+
const W = {
|
|
850
|
+
x: .2,
|
|
851
|
+
y: .2
|
|
852
|
+
};
|
|
853
|
+
function U(e, t, n, r, o) {
|
|
854
|
+
let { top: i, left: a, right: s, bottom: l } = n;
|
|
855
|
+
void 0 === r && (r = 10), void 0 === o && (o = W);
|
|
856
|
+
const { isTop: c, isBottom: d, isLeft: u, isRight: f } = F(e), v = {
|
|
857
|
+
x: 0,
|
|
858
|
+
y: 0
|
|
859
|
+
}, g = {
|
|
860
|
+
x: 0,
|
|
861
|
+
y: 0
|
|
862
|
+
}, p = t.height * o.y, h = t.width * o.x;
|
|
863
|
+
return !c && i <= t.top + p ? (v.y = B.Backward, g.y = r * Math.abs((t.top + p - i) / p)) : !d && l >= t.bottom - p && (v.y = B.Forward, g.y = r * Math.abs((t.bottom - p - l) / p)), !f && s >= t.right - h ? (v.x = B.Forward, g.x = r * Math.abs((t.right - h - s) / h)) : !u && a <= t.left + h && (v.x = B.Backward, g.x = r * Math.abs((t.left + h - a) / h)), {
|
|
864
|
+
direction: v,
|
|
865
|
+
speed: g
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
function j(e) {
|
|
869
|
+
if (e === document.scrollingElement) {
|
|
870
|
+
const { innerWidth: e, innerHeight: t } = window;
|
|
871
|
+
return {
|
|
872
|
+
top: 0,
|
|
873
|
+
left: 0,
|
|
874
|
+
right: e,
|
|
875
|
+
bottom: t,
|
|
876
|
+
width: e,
|
|
877
|
+
height: t
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
const { top: t, left: n, right: r, bottom: o } = e.getBoundingClientRect();
|
|
881
|
+
return {
|
|
882
|
+
top: t,
|
|
883
|
+
left: n,
|
|
884
|
+
right: r,
|
|
885
|
+
bottom: o,
|
|
886
|
+
width: e.clientWidth,
|
|
887
|
+
height: e.clientHeight
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
function q(e) {
|
|
891
|
+
return e.reduce((e, t) => o.add(e, I(t)), v);
|
|
892
|
+
}
|
|
893
|
+
function H(e, t) {
|
|
894
|
+
if (void 0 === t && (t = O), !e) return;
|
|
895
|
+
const { top: n, left: r, bottom: o, right: i } = t(e);
|
|
896
|
+
k(e) && (o <= 0 || i <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
|
|
897
|
+
block: "center",
|
|
898
|
+
inline: "center"
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
const X = [[
|
|
902
|
+
"x",
|
|
903
|
+
["left", "right"],
|
|
904
|
+
function(e) {
|
|
905
|
+
return e.reduce((e, t) => e + K(t), 0);
|
|
906
|
+
}
|
|
907
|
+
], [
|
|
908
|
+
"y",
|
|
909
|
+
["top", "bottom"],
|
|
910
|
+
function(e) {
|
|
911
|
+
return e.reduce((e, t) => e + P(t), 0);
|
|
912
|
+
}
|
|
913
|
+
]];
|
|
914
|
+
var Y = class {
|
|
915
|
+
constructor(e, t) {
|
|
916
|
+
this.rect = void 0, this.width = void 0, this.height = void 0, this.top = void 0, this.bottom = void 0, this.right = void 0, this.left = void 0;
|
|
917
|
+
const n = L(t), r = q(n);
|
|
918
|
+
this.rect = { ...e }, this.width = e.width, this.height = e.height;
|
|
919
|
+
for (const [e, t, o] of X) for (const i of t) Object.defineProperty(this, i, {
|
|
920
|
+
get: () => {
|
|
921
|
+
const t = o(n);
|
|
922
|
+
return this.rect[i] + (r[e] - t);
|
|
923
|
+
},
|
|
924
|
+
enumerable: !0
|
|
925
|
+
});
|
|
926
|
+
Object.defineProperty(this, "rect", { enumerable: !1 });
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
var V = class {
|
|
930
|
+
constructor(e) {
|
|
931
|
+
this.target = void 0, this.listeners = [], this.removeAll = () => {
|
|
932
|
+
this.listeners.forEach((e) => {
|
|
933
|
+
var t;
|
|
934
|
+
return null == (t = this.target) ? void 0 : t.removeEventListener(...e);
|
|
935
|
+
});
|
|
936
|
+
}, this.target = e;
|
|
937
|
+
}
|
|
938
|
+
add(e, t, n) {
|
|
939
|
+
var r;
|
|
940
|
+
null == (r = this.target) || r.addEventListener(e, t, n), this.listeners.push([
|
|
941
|
+
e,
|
|
942
|
+
t,
|
|
943
|
+
n
|
|
944
|
+
]);
|
|
945
|
+
}
|
|
946
|
+
};
|
|
947
|
+
function J(e, t) {
|
|
948
|
+
const n = Math.abs(e.x), r = Math.abs(e.y);
|
|
949
|
+
return "number" == typeof t ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t && r > t.y;
|
|
950
|
+
}
|
|
951
|
+
var _;
|
|
952
|
+
var G;
|
|
953
|
+
function Q(e) {
|
|
954
|
+
e.preventDefault();
|
|
955
|
+
}
|
|
956
|
+
function Z(e) {
|
|
957
|
+
e.stopPropagation();
|
|
958
|
+
}
|
|
959
|
+
(function(e) {
|
|
960
|
+
e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
|
|
961
|
+
})(_ || (_ = {})), (G = exports.KeyboardCode || (exports.KeyboardCode = {})).Space = "Space", G.Down = "ArrowDown", G.Right = "ArrowRight", G.Left = "ArrowLeft", G.Up = "ArrowUp", G.Esc = "Escape", G.Enter = "Enter", G.Tab = "Tab";
|
|
962
|
+
const $ = {
|
|
963
|
+
start: [exports.KeyboardCode.Space, exports.KeyboardCode.Enter],
|
|
964
|
+
cancel: [exports.KeyboardCode.Esc],
|
|
965
|
+
end: [
|
|
966
|
+
exports.KeyboardCode.Space,
|
|
967
|
+
exports.KeyboardCode.Enter,
|
|
968
|
+
exports.KeyboardCode.Tab
|
|
969
|
+
]
|
|
970
|
+
};
|
|
971
|
+
const ee = (e, t) => {
|
|
972
|
+
let { currentCoordinates: n } = t;
|
|
973
|
+
switch (e.code) {
|
|
974
|
+
case exports.KeyboardCode.Right: return {
|
|
975
|
+
...n,
|
|
976
|
+
x: n.x + 25
|
|
977
|
+
};
|
|
978
|
+
case exports.KeyboardCode.Left: return {
|
|
979
|
+
...n,
|
|
980
|
+
x: n.x - 25
|
|
981
|
+
};
|
|
982
|
+
case exports.KeyboardCode.Down: return {
|
|
983
|
+
...n,
|
|
984
|
+
y: n.y + 25
|
|
985
|
+
};
|
|
986
|
+
case exports.KeyboardCode.Up: return {
|
|
987
|
+
...n,
|
|
988
|
+
y: n.y - 25
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
var te = class {
|
|
993
|
+
constructor(e) {
|
|
994
|
+
this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = e;
|
|
995
|
+
const { event: { target: t } } = e;
|
|
996
|
+
this.props = e, this.listeners = new V(o.getOwnerDocument(t)), this.windowListeners = new V(o.getWindow(t)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
|
|
997
|
+
}
|
|
998
|
+
attach() {
|
|
999
|
+
this.handleStart(), this.windowListeners.add(_.Resize, this.handleCancel), this.windowListeners.add(_.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(_.Keydown, this.handleKeyDown));
|
|
1000
|
+
}
|
|
1001
|
+
handleStart() {
|
|
1002
|
+
const { activeNode: e, onStart: t } = this.props, n = e.node.current;
|
|
1003
|
+
n && H(n), t(v);
|
|
1004
|
+
}
|
|
1005
|
+
handleKeyDown(e) {
|
|
1006
|
+
if (o.isKeyboardEvent(e)) {
|
|
1007
|
+
const { active: t, context: n, options: r } = this.props, { keyboardCodes: i = $, coordinateGetter: a = ee, scrollBehavior: s = "smooth" } = r, { code: l } = e;
|
|
1008
|
+
if (i.end.includes(l)) return void this.handleEnd(e);
|
|
1009
|
+
if (i.cancel.includes(l)) return void this.handleCancel(e);
|
|
1010
|
+
const { collisionRect: c } = n.current, d = c ? {
|
|
1011
|
+
x: c.left,
|
|
1012
|
+
y: c.top
|
|
1013
|
+
} : v;
|
|
1014
|
+
this.referenceCoordinates || (this.referenceCoordinates = d);
|
|
1015
|
+
const u = a(e, {
|
|
1016
|
+
active: t,
|
|
1017
|
+
context: n.current,
|
|
1018
|
+
currentCoordinates: d
|
|
1019
|
+
});
|
|
1020
|
+
if (u) {
|
|
1021
|
+
const t = o.subtract(u, d), r = {
|
|
1022
|
+
x: 0,
|
|
1023
|
+
y: 0
|
|
1024
|
+
}, { scrollableAncestors: i } = n.current;
|
|
1025
|
+
for (const n of i) {
|
|
1026
|
+
const o = e.code, { isTop: i, isRight: a, isLeft: l, isBottom: c, maxScroll: d, minScroll: f } = F(n), v = j(n), g = {
|
|
1027
|
+
x: Math.min(o === exports.KeyboardCode.Right ? v.right - v.width / 2 : v.right, Math.max(o === exports.KeyboardCode.Right ? v.left : v.left + v.width / 2, u.x)),
|
|
1028
|
+
y: Math.min(o === exports.KeyboardCode.Down ? v.bottom - v.height / 2 : v.bottom, Math.max(o === exports.KeyboardCode.Down ? v.top : v.top + v.height / 2, u.y))
|
|
1029
|
+
}, p = o === exports.KeyboardCode.Right && !a || o === exports.KeyboardCode.Left && !l, h = o === exports.KeyboardCode.Down && !c || o === exports.KeyboardCode.Up && !i;
|
|
1030
|
+
if (p && g.x !== u.x) {
|
|
1031
|
+
const e = n.scrollLeft + t.x, i = o === exports.KeyboardCode.Right && e <= d.x || o === exports.KeyboardCode.Left && e >= f.x;
|
|
1032
|
+
if (i && !t.y) return void n.scrollTo({
|
|
1033
|
+
left: e,
|
|
1034
|
+
behavior: s
|
|
1035
|
+
});
|
|
1036
|
+
r.x = i ? n.scrollLeft - e : o === exports.KeyboardCode.Right ? n.scrollLeft - d.x : n.scrollLeft - f.x, r.x && n.scrollBy({
|
|
1037
|
+
left: -r.x,
|
|
1038
|
+
behavior: s
|
|
1039
|
+
});
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
if (h && g.y !== u.y) {
|
|
1043
|
+
const e = n.scrollTop + t.y, i = o === exports.KeyboardCode.Down && e <= d.y || o === exports.KeyboardCode.Up && e >= f.y;
|
|
1044
|
+
if (i && !t.x) return void n.scrollTo({
|
|
1045
|
+
top: e,
|
|
1046
|
+
behavior: s
|
|
1047
|
+
});
|
|
1048
|
+
r.y = i ? n.scrollTop - e : o === exports.KeyboardCode.Down ? n.scrollTop - d.y : n.scrollTop - f.y, r.y && n.scrollBy({
|
|
1049
|
+
top: -r.y,
|
|
1050
|
+
behavior: s
|
|
1051
|
+
});
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
this.handleMove(e, o.add(o.subtract(u, this.referenceCoordinates), r));
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
handleMove(e, t) {
|
|
1060
|
+
const { onMove: n } = this.props;
|
|
1061
|
+
e.preventDefault(), n(t);
|
|
1062
|
+
}
|
|
1063
|
+
handleEnd(e) {
|
|
1064
|
+
const { onEnd: t } = this.props;
|
|
1065
|
+
e.preventDefault(), this.detach(), t();
|
|
1066
|
+
}
|
|
1067
|
+
handleCancel(e) {
|
|
1068
|
+
const { onCancel: t } = this.props;
|
|
1069
|
+
e.preventDefault(), this.detach(), t();
|
|
1070
|
+
}
|
|
1071
|
+
detach() {
|
|
1072
|
+
this.listeners.removeAll(), this.windowListeners.removeAll();
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
function ne(e) {
|
|
1076
|
+
return Boolean(e && "distance" in e);
|
|
1077
|
+
}
|
|
1078
|
+
function re(e) {
|
|
1079
|
+
return Boolean(e && "delay" in e);
|
|
1080
|
+
}
|
|
1081
|
+
te.activators = [{
|
|
1082
|
+
eventName: "onKeyDown",
|
|
1083
|
+
handler: (e, t, n) => {
|
|
1084
|
+
let { keyboardCodes: r = $, onActivation: o } = t, { active: i } = n;
|
|
1085
|
+
const { code: a } = e.nativeEvent;
|
|
1086
|
+
if (r.start.includes(a)) {
|
|
1087
|
+
const t = i.activatorNode.current;
|
|
1088
|
+
return !(t && e.target !== t || (e.preventDefault(), o?.({ event: e.nativeEvent }), 0));
|
|
1089
|
+
}
|
|
1090
|
+
return !1;
|
|
1091
|
+
}
|
|
1092
|
+
}];
|
|
1093
|
+
var oe = class {
|
|
1094
|
+
constructor(e, t, n) {
|
|
1095
|
+
var r;
|
|
1096
|
+
void 0 === n && (n = function(e) {
|
|
1097
|
+
const { EventTarget: t } = o.getWindow(e);
|
|
1098
|
+
return e instanceof t ? e : o.getOwnerDocument(e);
|
|
1099
|
+
}(e.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = e, this.events = t;
|
|
1100
|
+
const { event: i } = e, { target: a } = i;
|
|
1101
|
+
this.props = e, this.events = t, this.document = o.getOwnerDocument(a), this.documentListeners = new V(this.document), this.listeners = new V(n), this.windowListeners = new V(o.getWindow(a)), this.initialCoordinates = null != (r = o.getEventCoordinates(i)) ? r : v, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach();
|
|
1102
|
+
}
|
|
1103
|
+
attach() {
|
|
1104
|
+
const { events: e, props: { options: { activationConstraint: t, bypassActivationConstraint: n } } } = this;
|
|
1105
|
+
if (this.listeners.add(e.move.name, this.handleMove, { passive: !1 }), this.listeners.add(e.end.name, this.handleEnd), e.cancel && this.listeners.add(e.cancel.name, this.handleCancel), this.windowListeners.add(_.Resize, this.handleCancel), this.windowListeners.add(_.DragStart, Q), this.windowListeners.add(_.VisibilityChange, this.handleCancel), this.windowListeners.add(_.ContextMenu, Q), this.documentListeners.add(_.Keydown, this.handleKeydown), t) {
|
|
1106
|
+
if (null != n && n({
|
|
1107
|
+
event: this.props.event,
|
|
1108
|
+
activeNode: this.props.activeNode,
|
|
1109
|
+
options: this.props.options
|
|
1110
|
+
})) return this.handleStart();
|
|
1111
|
+
if (re(t)) return this.timeoutId = setTimeout(this.handleStart, t.delay), void this.handlePending(t);
|
|
1112
|
+
if (ne(t)) return void this.handlePending(t);
|
|
1113
|
+
}
|
|
1114
|
+
this.handleStart();
|
|
1115
|
+
}
|
|
1116
|
+
detach() {
|
|
1117
|
+
this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), null !== this.timeoutId && (clearTimeout(this.timeoutId), this.timeoutId = null);
|
|
1118
|
+
}
|
|
1119
|
+
handlePending(e, t) {
|
|
1120
|
+
const { active: n, onPending: r } = this.props;
|
|
1121
|
+
r(n, e, this.initialCoordinates, t);
|
|
1122
|
+
}
|
|
1123
|
+
handleStart() {
|
|
1124
|
+
const { initialCoordinates: e } = this, { onStart: t } = this.props;
|
|
1125
|
+
e && (this.activated = !0, this.documentListeners.add(_.Click, Z, { capture: !0 }), this.removeTextSelection(), this.documentListeners.add(_.SelectionChange, this.removeTextSelection), t(e));
|
|
1126
|
+
}
|
|
1127
|
+
handleMove(e) {
|
|
1128
|
+
var t;
|
|
1129
|
+
const { activated: n, initialCoordinates: r, props: i } = this, { onMove: a, options: { activationConstraint: s } } = i;
|
|
1130
|
+
if (!r) return;
|
|
1131
|
+
const l = null != (t = o.getEventCoordinates(e)) ? t : v, c = o.subtract(r, l);
|
|
1132
|
+
if (!n && s) {
|
|
1133
|
+
if (ne(s)) {
|
|
1134
|
+
if (null != s.tolerance && J(c, s.tolerance)) return this.handleCancel();
|
|
1135
|
+
if (J(c, s.distance)) return this.handleStart();
|
|
1136
|
+
}
|
|
1137
|
+
return re(s) && J(c, s.tolerance) ? this.handleCancel() : void this.handlePending(s, c);
|
|
1138
|
+
}
|
|
1139
|
+
e.cancelable && e.preventDefault(), a(l);
|
|
1140
|
+
}
|
|
1141
|
+
handleEnd() {
|
|
1142
|
+
const { onAbort: e, onEnd: t } = this.props;
|
|
1143
|
+
this.detach(), this.activated || e(this.props.active), t();
|
|
1144
|
+
}
|
|
1145
|
+
handleCancel() {
|
|
1146
|
+
const { onAbort: e, onCancel: t } = this.props;
|
|
1147
|
+
this.detach(), this.activated || e(this.props.active), t();
|
|
1148
|
+
}
|
|
1149
|
+
handleKeydown(e) {
|
|
1150
|
+
e.code === exports.KeyboardCode.Esc && this.handleCancel();
|
|
1151
|
+
}
|
|
1152
|
+
removeTextSelection() {
|
|
1153
|
+
var e;
|
|
1154
|
+
null == (e = this.document.getSelection()) || e.removeAllRanges();
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
const ie = {
|
|
1158
|
+
cancel: { name: "pointercancel" },
|
|
1159
|
+
move: { name: "pointermove" },
|
|
1160
|
+
end: { name: "pointerup" }
|
|
1161
|
+
};
|
|
1162
|
+
var ae = class extends oe {
|
|
1163
|
+
constructor(e) {
|
|
1164
|
+
const { event: t } = e, n = o.getOwnerDocument(t.target);
|
|
1165
|
+
super(e, ie, n);
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
ae.activators = [{
|
|
1169
|
+
eventName: "onPointerDown",
|
|
1170
|
+
handler: (e, t) => {
|
|
1171
|
+
let { nativeEvent: n } = e, { onActivation: r } = t;
|
|
1172
|
+
return !(!n.isPrimary || 0 !== n.button || (r?.({ event: n }), 0));
|
|
1173
|
+
}
|
|
1174
|
+
}];
|
|
1175
|
+
const se = {
|
|
1176
|
+
move: { name: "mousemove" },
|
|
1177
|
+
end: { name: "mouseup" }
|
|
1178
|
+
};
|
|
1179
|
+
var le;
|
|
1180
|
+
(function(e) {
|
|
1181
|
+
e[e.RightClick = 2] = "RightClick";
|
|
1182
|
+
})(le || (le = {}));
|
|
1183
|
+
var ce = class extends oe {
|
|
1184
|
+
constructor(e) {
|
|
1185
|
+
super(e, se, o.getOwnerDocument(e.event.target));
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
ce.activators = [{
|
|
1189
|
+
eventName: "onMouseDown",
|
|
1190
|
+
handler: (e, t) => {
|
|
1191
|
+
let { nativeEvent: n } = e, { onActivation: r } = t;
|
|
1192
|
+
return n.button !== le.RightClick && (r?.({ event: n }), !0);
|
|
1193
|
+
}
|
|
1194
|
+
}];
|
|
1195
|
+
const de = {
|
|
1196
|
+
cancel: { name: "touchcancel" },
|
|
1197
|
+
move: { name: "touchmove" },
|
|
1198
|
+
end: { name: "touchend" }
|
|
1199
|
+
};
|
|
1200
|
+
var ue = class extends oe {
|
|
1201
|
+
constructor(e) {
|
|
1202
|
+
super(e, de);
|
|
1203
|
+
}
|
|
1204
|
+
static setup() {
|
|
1205
|
+
return window.addEventListener(de.move.name, e, {
|
|
1206
|
+
capture: !1,
|
|
1207
|
+
passive: !1
|
|
1208
|
+
}), function() {
|
|
1209
|
+
window.removeEventListener(de.move.name, e);
|
|
1210
|
+
};
|
|
1211
|
+
function e() {}
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
var fe;
|
|
1215
|
+
var ve;
|
|
1216
|
+
ue.activators = [{
|
|
1217
|
+
eventName: "onTouchStart",
|
|
1218
|
+
handler: (e, t) => {
|
|
1219
|
+
let { nativeEvent: n } = e, { onActivation: r } = t;
|
|
1220
|
+
const { touches: o } = n;
|
|
1221
|
+
return !(o.length > 1 || (r?.({ event: n }), 0));
|
|
1222
|
+
}
|
|
1223
|
+
}], (fe = exports.AutoScrollActivator || (exports.AutoScrollActivator = {}))[fe.Pointer = 0] = "Pointer", fe[fe.DraggableRect = 1] = "DraggableRect", (ve = exports.TraversalOrder || (exports.TraversalOrder = {}))[ve.TreeOrder = 0] = "TreeOrder", ve[ve.ReversedTreeOrder = 1] = "ReversedTreeOrder";
|
|
1224
|
+
const ge = {
|
|
1225
|
+
x: {
|
|
1226
|
+
[B.Backward]: !1,
|
|
1227
|
+
[B.Forward]: !1
|
|
1228
|
+
},
|
|
1229
|
+
y: {
|
|
1230
|
+
[B.Backward]: !1,
|
|
1231
|
+
[B.Forward]: !1
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
var pe;
|
|
1235
|
+
(pe = exports.MeasuringStrategy || (exports.MeasuringStrategy = {}))[pe.Always = 0] = "Always", pe[pe.BeforeDragging = 1] = "BeforeDragging", pe[pe.WhileDragging = 2] = "WhileDragging", (exports.MeasuringFrequency || (exports.MeasuringFrequency = {})).Optimized = "optimized";
|
|
1236
|
+
const he = /* @__PURE__ */ new Map();
|
|
1237
|
+
function be(e, t) {
|
|
1238
|
+
return o.useLazyMemo((n) => e ? n || ("function" == typeof t ? t(e) : e) : null, [t, e]);
|
|
1239
|
+
}
|
|
1240
|
+
function me(e) {
|
|
1241
|
+
let { callback: n, disabled: r } = e;
|
|
1242
|
+
const i = o.useEvent(n), a = t.useMemo(() => {
|
|
1243
|
+
if (r || "undefined" == typeof window || void 0 === window.ResizeObserver) return;
|
|
1244
|
+
const { ResizeObserver: e } = window;
|
|
1245
|
+
return new e(i);
|
|
1246
|
+
}, [r]);
|
|
1247
|
+
return t.useEffect(() => () => null == a ? void 0 : a.disconnect(), [a]), a;
|
|
1248
|
+
}
|
|
1249
|
+
function ye(e) {
|
|
1250
|
+
return new Y(O(e), e);
|
|
1251
|
+
}
|
|
1252
|
+
function xe(e, n, r) {
|
|
1253
|
+
void 0 === n && (n = ye);
|
|
1254
|
+
const [i, a] = t.useState(null);
|
|
1255
|
+
function s() {
|
|
1256
|
+
a((t) => {
|
|
1257
|
+
if (!e) return null;
|
|
1258
|
+
var o;
|
|
1259
|
+
if (!1 === e.isConnected) return null != (o = null != t ? t : r) ? o : null;
|
|
1260
|
+
const i = n(e);
|
|
1261
|
+
return JSON.stringify(t) === JSON.stringify(i) ? t : i;
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
const l = function(e) {
|
|
1265
|
+
let { callback: n, disabled: r } = e;
|
|
1266
|
+
const i = o.useEvent(n), a = t.useMemo(() => {
|
|
1267
|
+
if (r || "undefined" == typeof window || void 0 === window.MutationObserver) return;
|
|
1268
|
+
const { MutationObserver: e } = window;
|
|
1269
|
+
return new e(i);
|
|
1270
|
+
}, [i, r]);
|
|
1271
|
+
return t.useEffect(() => () => null == a ? void 0 : a.disconnect(), [a]), a;
|
|
1272
|
+
}({ callback(t) {
|
|
1273
|
+
if (e) for (const n of t) {
|
|
1274
|
+
const { type: t, target: r } = n;
|
|
1275
|
+
if ("childList" === t && r instanceof HTMLElement && r.contains(e)) {
|
|
1276
|
+
s();
|
|
1277
|
+
break;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
} }), c = me({ callback: s });
|
|
1281
|
+
return o.useIsomorphicLayoutEffect(() => {
|
|
1282
|
+
s(), e ? (c?.observe(e), l?.observe(document.body, {
|
|
1283
|
+
childList: !0,
|
|
1284
|
+
subtree: !0
|
|
1285
|
+
})) : (c?.disconnect(), l?.disconnect());
|
|
1286
|
+
}, [e]), i;
|
|
1287
|
+
}
|
|
1288
|
+
const we = [];
|
|
1289
|
+
function Ce(e, n) {
|
|
1290
|
+
void 0 === n && (n = []);
|
|
1291
|
+
const r = t.useRef(null);
|
|
1292
|
+
return t.useEffect(() => {
|
|
1293
|
+
r.current = null;
|
|
1294
|
+
}, n), t.useEffect(() => {
|
|
1295
|
+
const t = e !== v;
|
|
1296
|
+
t && !r.current && (r.current = e), !t && r.current && (r.current = null);
|
|
1297
|
+
}, [e]), r.current ? o.subtract(e, r.current) : v;
|
|
1298
|
+
}
|
|
1299
|
+
function Ee(e) {
|
|
1300
|
+
return t.useMemo(() => e ? function(e) {
|
|
1301
|
+
const t = e.innerWidth, n = e.innerHeight;
|
|
1302
|
+
return {
|
|
1303
|
+
top: 0,
|
|
1304
|
+
left: 0,
|
|
1305
|
+
right: t,
|
|
1306
|
+
bottom: n,
|
|
1307
|
+
width: t,
|
|
1308
|
+
height: n
|
|
1309
|
+
};
|
|
1310
|
+
}(e) : null, [e]);
|
|
1311
|
+
}
|
|
1312
|
+
const De = [];
|
|
1313
|
+
function Re(e) {
|
|
1314
|
+
if (!e) return null;
|
|
1315
|
+
if (e.children.length > 1) return e;
|
|
1316
|
+
const t = e.children[0];
|
|
1317
|
+
return o.isHTMLElement(t) ? t : e;
|
|
1318
|
+
}
|
|
1319
|
+
const Se = [{
|
|
1320
|
+
sensor: ae,
|
|
1321
|
+
options: {}
|
|
1322
|
+
}, {
|
|
1323
|
+
sensor: te,
|
|
1324
|
+
options: {}
|
|
1325
|
+
}];
|
|
1326
|
+
const Me = { current: {} };
|
|
1327
|
+
const Ne = {
|
|
1328
|
+
draggable: { measure: A },
|
|
1329
|
+
droppable: {
|
|
1330
|
+
measure: A,
|
|
1331
|
+
strategy: exports.MeasuringStrategy.WhileDragging,
|
|
1332
|
+
frequency: exports.MeasuringFrequency.Optimized
|
|
1333
|
+
},
|
|
1334
|
+
dragOverlay: { measure: O }
|
|
1335
|
+
};
|
|
1336
|
+
var Oe = class extends Map {
|
|
1337
|
+
get(e) {
|
|
1338
|
+
var t;
|
|
1339
|
+
return null != e && null != (t = super.get(e)) ? t : void 0;
|
|
1340
|
+
}
|
|
1341
|
+
toArray() {
|
|
1342
|
+
return Array.from(this.values());
|
|
1343
|
+
}
|
|
1344
|
+
getEnabled() {
|
|
1345
|
+
return this.toArray().filter((e) => {
|
|
1346
|
+
let { disabled: t } = e;
|
|
1347
|
+
return !t;
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
getNodeFor(e) {
|
|
1351
|
+
var t, n;
|
|
1352
|
+
return null != (t = null == (n = this.get(e)) ? void 0 : n.node.current) ? t : void 0;
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
const Ae = {
|
|
1356
|
+
activatorEvent: null,
|
|
1357
|
+
active: null,
|
|
1358
|
+
activeNode: null,
|
|
1359
|
+
activeNodeRect: null,
|
|
1360
|
+
collisions: null,
|
|
1361
|
+
containerNodeRect: null,
|
|
1362
|
+
draggableNodes: /* @__PURE__ */ new Map(),
|
|
1363
|
+
droppableRects: /* @__PURE__ */ new Map(),
|
|
1364
|
+
droppableContainers: new Oe(),
|
|
1365
|
+
over: null,
|
|
1366
|
+
dragOverlay: {
|
|
1367
|
+
nodeRef: { current: null },
|
|
1368
|
+
rect: null,
|
|
1369
|
+
setRef: f
|
|
1370
|
+
},
|
|
1371
|
+
scrollableAncestors: [],
|
|
1372
|
+
scrollableAncestorRects: [],
|
|
1373
|
+
measuringConfiguration: Ne,
|
|
1374
|
+
measureDroppableContainers: f,
|
|
1375
|
+
windowRect: null,
|
|
1376
|
+
measuringScheduled: !1
|
|
1377
|
+
};
|
|
1378
|
+
const Le = {
|
|
1379
|
+
activatorEvent: null,
|
|
1380
|
+
activators: [],
|
|
1381
|
+
active: null,
|
|
1382
|
+
activeNodeRect: null,
|
|
1383
|
+
ariaDescribedById: { draggable: "" },
|
|
1384
|
+
dispatch: f,
|
|
1385
|
+
draggableNodes: /* @__PURE__ */ new Map(),
|
|
1386
|
+
over: null,
|
|
1387
|
+
measureDroppableContainers: f
|
|
1388
|
+
};
|
|
1389
|
+
const ke = t.createContext(Le);
|
|
1390
|
+
const Te = t.createContext(Ae);
|
|
1391
|
+
function Ke() {
|
|
1392
|
+
return {
|
|
1393
|
+
draggable: {
|
|
1394
|
+
active: null,
|
|
1395
|
+
initialCoordinates: {
|
|
1396
|
+
x: 0,
|
|
1397
|
+
y: 0
|
|
1398
|
+
},
|
|
1399
|
+
nodes: /* @__PURE__ */ new Map(),
|
|
1400
|
+
translate: {
|
|
1401
|
+
x: 0,
|
|
1402
|
+
y: 0
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
droppable: { containers: new Oe() }
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
function Pe(e, t) {
|
|
1409
|
+
switch (t.type) {
|
|
1410
|
+
case u.DragStart: return {
|
|
1411
|
+
...e,
|
|
1412
|
+
draggable: {
|
|
1413
|
+
...e.draggable,
|
|
1414
|
+
initialCoordinates: t.initialCoordinates,
|
|
1415
|
+
active: t.active
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
case u.DragMove: return null == e.draggable.active ? e : {
|
|
1419
|
+
...e,
|
|
1420
|
+
draggable: {
|
|
1421
|
+
...e.draggable,
|
|
1422
|
+
translate: {
|
|
1423
|
+
x: t.coordinates.x - e.draggable.initialCoordinates.x,
|
|
1424
|
+
y: t.coordinates.y - e.draggable.initialCoordinates.y
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
case u.DragEnd:
|
|
1429
|
+
case u.DragCancel: return {
|
|
1430
|
+
...e,
|
|
1431
|
+
draggable: {
|
|
1432
|
+
...e.draggable,
|
|
1433
|
+
active: null,
|
|
1434
|
+
initialCoordinates: {
|
|
1435
|
+
x: 0,
|
|
1436
|
+
y: 0
|
|
1437
|
+
},
|
|
1438
|
+
translate: {
|
|
1439
|
+
x: 0,
|
|
1440
|
+
y: 0
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
case u.RegisterDroppable: {
|
|
1445
|
+
const { element: n } = t, { id: r } = n, o = new Oe(e.droppable.containers);
|
|
1446
|
+
return o.set(r, n), {
|
|
1447
|
+
...e,
|
|
1448
|
+
droppable: {
|
|
1449
|
+
...e.droppable,
|
|
1450
|
+
containers: o
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
case u.SetDroppableDisabled: {
|
|
1455
|
+
const { id: n, key: r, disabled: o } = t, i = e.droppable.containers.get(n);
|
|
1456
|
+
if (!i || r !== i.key) return e;
|
|
1457
|
+
const a = new Oe(e.droppable.containers);
|
|
1458
|
+
return a.set(n, {
|
|
1459
|
+
...i,
|
|
1460
|
+
disabled: o
|
|
1461
|
+
}), {
|
|
1462
|
+
...e,
|
|
1463
|
+
droppable: {
|
|
1464
|
+
...e.droppable,
|
|
1465
|
+
containers: a
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
case u.UnregisterDroppable: {
|
|
1470
|
+
const { id: n, key: r } = t, o = e.droppable.containers.get(n);
|
|
1471
|
+
if (!o || r !== o.key) return e;
|
|
1472
|
+
const i = new Oe(e.droppable.containers);
|
|
1473
|
+
return i.delete(n), {
|
|
1474
|
+
...e,
|
|
1475
|
+
droppable: {
|
|
1476
|
+
...e.droppable,
|
|
1477
|
+
containers: i
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
default: return e;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
function Ie(e) {
|
|
1485
|
+
let { disabled: n } = e;
|
|
1486
|
+
const { active: r, activatorEvent: i, draggableNodes: a } = t.useContext(ke), s = o.usePrevious(i), l = o.usePrevious(null == r ? void 0 : r.id);
|
|
1487
|
+
return t.useEffect(() => {
|
|
1488
|
+
if (!n && !i && s && null != l) {
|
|
1489
|
+
if (!o.isKeyboardEvent(s)) return;
|
|
1490
|
+
if (document.activeElement === s.target) return;
|
|
1491
|
+
const e = a.get(l);
|
|
1492
|
+
if (!e) return;
|
|
1493
|
+
const { activatorNode: t, node: n } = e;
|
|
1494
|
+
if (!t.current && !n.current) return;
|
|
1495
|
+
requestAnimationFrame(() => {
|
|
1496
|
+
for (const e of [t.current, n.current]) {
|
|
1497
|
+
if (!e) continue;
|
|
1498
|
+
const t = o.findFirstFocusableNode(e);
|
|
1499
|
+
if (t) {
|
|
1500
|
+
t.focus();
|
|
1501
|
+
break;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
}, [
|
|
1507
|
+
i,
|
|
1508
|
+
n,
|
|
1509
|
+
a,
|
|
1510
|
+
l,
|
|
1511
|
+
s
|
|
1512
|
+
]), null;
|
|
1513
|
+
}
|
|
1514
|
+
function Be(e, t) {
|
|
1515
|
+
let { transform: n, ...r } = t;
|
|
1516
|
+
return null != e && e.length ? e.reduce((e, t) => t({
|
|
1517
|
+
transform: e,
|
|
1518
|
+
...r
|
|
1519
|
+
}), n) : n;
|
|
1520
|
+
}
|
|
1521
|
+
const ze = t.createContext({
|
|
1522
|
+
...v,
|
|
1523
|
+
scaleX: 1,
|
|
1524
|
+
scaleY: 1
|
|
1525
|
+
});
|
|
1526
|
+
var Fe;
|
|
1527
|
+
(function(e) {
|
|
1528
|
+
e[e.Uninitialized = 0] = "Uninitialized", e[e.Initializing = 1] = "Initializing", e[e.Initialized = 2] = "Initialized";
|
|
1529
|
+
})(Fe || (Fe = {}));
|
|
1530
|
+
const We = t.memo((function(e) {
|
|
1531
|
+
var i, s, l, c;
|
|
1532
|
+
let { id: f, accessibility: g, autoScroll: p = !0, children: h, sensors: b = Se, collisionDetection: m = C, measuring: x, modifiers: w, ...E } = e;
|
|
1533
|
+
const [M, N] = t.useReducer(Pe, void 0, Ke), [A, K] = function() {
|
|
1534
|
+
const [e] = t.useState(() => /* @__PURE__ */ new Set()), n = t.useCallback((t) => (e.add(t), () => e.delete(t)), [e]);
|
|
1535
|
+
return [t.useCallback((t) => {
|
|
1536
|
+
let { type: n, event: r } = t;
|
|
1537
|
+
e.forEach((e) => {
|
|
1538
|
+
var t;
|
|
1539
|
+
return null == (t = e[n]) ? void 0 : t.call(e, r);
|
|
1540
|
+
});
|
|
1541
|
+
}, [e]), n];
|
|
1542
|
+
}(), [P, F] = t.useState(Fe.Uninitialized), W = P === Fe.Initialized, { draggable: { active: j, nodes: H, translate: X }, droppable: { containers: V } } = M, J = null != j ? H.get(j) : null, _ = t.useRef({
|
|
1543
|
+
initial: null,
|
|
1544
|
+
translated: null
|
|
1545
|
+
}), G = t.useMemo(() => {
|
|
1546
|
+
var e;
|
|
1547
|
+
return null != j ? {
|
|
1548
|
+
id: j,
|
|
1549
|
+
data: null != (e = null == J ? void 0 : J.data) ? e : Me,
|
|
1550
|
+
rect: _
|
|
1551
|
+
} : null;
|
|
1552
|
+
}, [j, J]), Q = t.useRef(null), [Z, $] = t.useState(null), [ee, te] = t.useState(null), ne = o.useLatestValue(E, Object.values(E)), re = o.useUniqueId("DndDescribedBy", f), oe = t.useMemo(() => V.getEnabled(), [V]), ie = t.useMemo(() => ({
|
|
1553
|
+
draggable: {
|
|
1554
|
+
...Ne.draggable,
|
|
1555
|
+
...null == ae ? void 0 : ae.draggable
|
|
1556
|
+
},
|
|
1557
|
+
droppable: {
|
|
1558
|
+
...Ne.droppable,
|
|
1559
|
+
...null == ae ? void 0 : ae.droppable
|
|
1560
|
+
},
|
|
1561
|
+
dragOverlay: {
|
|
1562
|
+
...Ne.dragOverlay,
|
|
1563
|
+
...null == ae ? void 0 : ae.dragOverlay
|
|
1564
|
+
}
|
|
1565
|
+
}), [
|
|
1566
|
+
null == (ae = x) ? void 0 : ae.draggable,
|
|
1567
|
+
null == ae ? void 0 : ae.droppable,
|
|
1568
|
+
null == ae ? void 0 : ae.dragOverlay
|
|
1569
|
+
]);
|
|
1570
|
+
var ae;
|
|
1571
|
+
const { droppableRects: se, measureDroppableContainers: le, measuringScheduled: ce } = function(e, n) {
|
|
1572
|
+
let { dragging: r, dependencies: i, config: a } = n;
|
|
1573
|
+
const [s, l] = t.useState(null), { frequency: c, measure: d, strategy: u } = a, f = t.useRef(e), v = function() {
|
|
1574
|
+
switch (u) {
|
|
1575
|
+
case exports.MeasuringStrategy.Always: return !1;
|
|
1576
|
+
case exports.MeasuringStrategy.BeforeDragging: return r;
|
|
1577
|
+
default: return !r;
|
|
1578
|
+
}
|
|
1579
|
+
}(), g = o.useLatestValue(v), p = t.useCallback((function(e) {
|
|
1580
|
+
void 0 === e && (e = []), g.current || l((t) => null === t ? e : t.concat(e.filter((e) => !t.includes(e))));
|
|
1581
|
+
}), [g]), h = t.useRef(null), b = o.useLazyMemo((t) => {
|
|
1582
|
+
if (v && !r) return he;
|
|
1583
|
+
if (!t || t === he || f.current !== e || null != s) {
|
|
1584
|
+
const t = /* @__PURE__ */ new Map();
|
|
1585
|
+
for (let n of e) {
|
|
1586
|
+
if (!n) continue;
|
|
1587
|
+
if (s && s.length > 0 && !s.includes(n.id) && n.rect.current) {
|
|
1588
|
+
t.set(n.id, n.rect.current);
|
|
1589
|
+
continue;
|
|
1590
|
+
}
|
|
1591
|
+
const e = n.node.current, r = e ? new Y(d(e), e) : null;
|
|
1592
|
+
n.rect.current = r, r && t.set(n.id, r);
|
|
1593
|
+
}
|
|
1594
|
+
return t;
|
|
1595
|
+
}
|
|
1596
|
+
return t;
|
|
1597
|
+
}, [
|
|
1598
|
+
e,
|
|
1599
|
+
s,
|
|
1600
|
+
r,
|
|
1601
|
+
v,
|
|
1602
|
+
d
|
|
1603
|
+
]);
|
|
1604
|
+
return t.useEffect(() => {
|
|
1605
|
+
f.current = e;
|
|
1606
|
+
}, [e]), t.useEffect(() => {
|
|
1607
|
+
v || p();
|
|
1608
|
+
}, [r, v]), t.useEffect(() => {
|
|
1609
|
+
s && s.length > 0 && l(null);
|
|
1610
|
+
}, [JSON.stringify(s)]), t.useEffect(() => {
|
|
1611
|
+
v || "number" != typeof c || null !== h.current || (h.current = setTimeout(() => {
|
|
1612
|
+
p(), h.current = null;
|
|
1613
|
+
}, c));
|
|
1614
|
+
}, [
|
|
1615
|
+
c,
|
|
1616
|
+
v,
|
|
1617
|
+
p,
|
|
1618
|
+
...i
|
|
1619
|
+
]), {
|
|
1620
|
+
droppableRects: b,
|
|
1621
|
+
measureDroppableContainers: p,
|
|
1622
|
+
measuringScheduled: null != s
|
|
1623
|
+
};
|
|
1624
|
+
}(oe, {
|
|
1625
|
+
dragging: W,
|
|
1626
|
+
dependencies: [X.x, X.y],
|
|
1627
|
+
config: ie.droppable
|
|
1628
|
+
}), de = function(e, t) {
|
|
1629
|
+
const n = null != t ? e.get(t) : void 0, r = n ? n.node.current : null;
|
|
1630
|
+
return o.useLazyMemo((e) => {
|
|
1631
|
+
var n;
|
|
1632
|
+
return null == t ? null : null != (n = null != r ? r : e) ? n : null;
|
|
1633
|
+
}, [r, t]);
|
|
1634
|
+
}(H, j), ue = t.useMemo(() => ee ? o.getEventCoordinates(ee) : null, [ee]), fe = function() {
|
|
1635
|
+
const e = W && !(!1 === (null == Z ? void 0 : Z.autoScrollEnabled)) && !("object" == typeof p ? !1 === p.enabled : !1 === p);
|
|
1636
|
+
return "object" == typeof p ? {
|
|
1637
|
+
...p,
|
|
1638
|
+
enabled: e
|
|
1639
|
+
} : { enabled: e };
|
|
1640
|
+
}(), ve = function(e, t) {
|
|
1641
|
+
return be(e, t);
|
|
1642
|
+
}(de, ie.draggable.measure);
|
|
1643
|
+
(function(e) {
|
|
1644
|
+
let { activeNode: n, measure: r, initialRect: i, config: a = !0 } = e;
|
|
1645
|
+
const s = t.useRef(!1), { x: l, y: c } = "boolean" == typeof a ? {
|
|
1646
|
+
x: a,
|
|
1647
|
+
y: a
|
|
1648
|
+
} : a;
|
|
1649
|
+
o.useIsomorphicLayoutEffect(() => {
|
|
1650
|
+
if (!l && !c || !n) return void (s.current = !1);
|
|
1651
|
+
if (s.current || !i) return;
|
|
1652
|
+
const e = null == n ? void 0 : n.node.current;
|
|
1653
|
+
if (!e || !1 === e.isConnected) return;
|
|
1654
|
+
const t = D(r(e), i);
|
|
1655
|
+
if (l || (t.x = 0), c || (t.y = 0), s.current = !0, Math.abs(t.x) > 0 || Math.abs(t.y) > 0) {
|
|
1656
|
+
const n = k(e);
|
|
1657
|
+
n && n.scrollBy({
|
|
1658
|
+
top: t.y,
|
|
1659
|
+
left: t.x
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
}, [
|
|
1663
|
+
n,
|
|
1664
|
+
l,
|
|
1665
|
+
c,
|
|
1666
|
+
i,
|
|
1667
|
+
r
|
|
1668
|
+
]);
|
|
1669
|
+
})({
|
|
1670
|
+
activeNode: null != j ? H.get(j) : null,
|
|
1671
|
+
config: fe.layoutShiftCompensation,
|
|
1672
|
+
initialRect: ve,
|
|
1673
|
+
measure: ie.draggable.measure
|
|
1674
|
+
});
|
|
1675
|
+
const pe = xe(de, ie.draggable.measure, ve), ye = xe(de ? de.parentElement : null), Oe = t.useRef({
|
|
1676
|
+
activatorEvent: null,
|
|
1677
|
+
active: null,
|
|
1678
|
+
activeNode: de,
|
|
1679
|
+
collisionRect: null,
|
|
1680
|
+
collisions: null,
|
|
1681
|
+
droppableRects: se,
|
|
1682
|
+
draggableNodes: H,
|
|
1683
|
+
draggingNode: null,
|
|
1684
|
+
draggingNodeRect: null,
|
|
1685
|
+
droppableContainers: V,
|
|
1686
|
+
over: null,
|
|
1687
|
+
scrollableAncestors: [],
|
|
1688
|
+
scrollAdjustedTranslate: null
|
|
1689
|
+
}), Ae = V.getNodeFor(null == (i = Oe.current.over) ? void 0 : i.id), Le = function(e) {
|
|
1690
|
+
let { measure: n } = e;
|
|
1691
|
+
const [r, i] = t.useState(null), a = me({ callback: t.useCallback((e) => {
|
|
1692
|
+
for (const { target: t } of e) if (o.isHTMLElement(t)) {
|
|
1693
|
+
i((e) => {
|
|
1694
|
+
const r = n(t);
|
|
1695
|
+
return e ? {
|
|
1696
|
+
...e,
|
|
1697
|
+
width: r.width,
|
|
1698
|
+
height: r.height
|
|
1699
|
+
} : r;
|
|
1700
|
+
});
|
|
1701
|
+
break;
|
|
1702
|
+
}
|
|
1703
|
+
}, [n]) }), s = t.useCallback((e) => {
|
|
1704
|
+
const t = Re(e);
|
|
1705
|
+
a?.disconnect(), t && a?.observe(t), i(t ? n(t) : null);
|
|
1706
|
+
}, [n, a]), [l, c] = o.useNodeRef(s);
|
|
1707
|
+
return t.useMemo(() => ({
|
|
1708
|
+
nodeRef: l,
|
|
1709
|
+
rect: r,
|
|
1710
|
+
setRef: c
|
|
1711
|
+
}), [
|
|
1712
|
+
r,
|
|
1713
|
+
l,
|
|
1714
|
+
c
|
|
1715
|
+
]);
|
|
1716
|
+
}({ measure: ie.dragOverlay.measure }), We = null != (s = Le.nodeRef.current) ? s : de, Ue = W ? null != (l = Le.rect) ? l : pe : null, je = Boolean(Le.nodeRef.current && Le.rect), qe = D(He = je ? null : pe, be(He));
|
|
1717
|
+
var He;
|
|
1718
|
+
const Xe = Ee(We ? o.getWindow(We) : null), Ye = function(e) {
|
|
1719
|
+
const n = t.useRef(e), r = o.useLazyMemo((t) => e ? t && t !== we && e && n.current && e.parentNode === n.current.parentNode ? t : L(e) : we, [e]);
|
|
1720
|
+
return t.useEffect(() => {
|
|
1721
|
+
n.current = e;
|
|
1722
|
+
}, [e]), r;
|
|
1723
|
+
}(W ? null != Ae ? Ae : de : null), Ve = function(e, n) {
|
|
1724
|
+
void 0 === n && (n = O);
|
|
1725
|
+
const [r] = e, i = Ee(r ? o.getWindow(r) : null), [a, s] = t.useState(De);
|
|
1726
|
+
function l() {
|
|
1727
|
+
s(() => e.length ? e.map((e) => z(e) ? i : new Y(n(e), e)) : De);
|
|
1728
|
+
}
|
|
1729
|
+
const c = me({ callback: l });
|
|
1730
|
+
return o.useIsomorphicLayoutEffect(() => {
|
|
1731
|
+
c?.disconnect(), l(), e.forEach((e) => null == c ? void 0 : c.observe(e));
|
|
1732
|
+
}, [e]), a;
|
|
1733
|
+
}(Ye), Je = Be(w, {
|
|
1734
|
+
transform: {
|
|
1735
|
+
x: X.x - qe.x,
|
|
1736
|
+
y: X.y - qe.y,
|
|
1737
|
+
scaleX: 1,
|
|
1738
|
+
scaleY: 1
|
|
1739
|
+
},
|
|
1740
|
+
activatorEvent: ee,
|
|
1741
|
+
active: G,
|
|
1742
|
+
activeNodeRect: pe,
|
|
1743
|
+
containerNodeRect: ye,
|
|
1744
|
+
draggingNodeRect: Ue,
|
|
1745
|
+
over: Oe.current.over,
|
|
1746
|
+
overlayNodeRect: Le.rect,
|
|
1747
|
+
scrollableAncestors: Ye,
|
|
1748
|
+
scrollableAncestorRects: Ve,
|
|
1749
|
+
windowRect: Xe
|
|
1750
|
+
}), _e = ue ? o.add(ue, X) : null, Ge = function(e) {
|
|
1751
|
+
const [n, r] = t.useState(null), i = t.useRef(e), a = t.useCallback((e) => {
|
|
1752
|
+
const t = T(e.target);
|
|
1753
|
+
t && r((e) => e ? (e.set(t, I(t)), new Map(e)) : null);
|
|
1754
|
+
}, []);
|
|
1755
|
+
return t.useEffect(() => {
|
|
1756
|
+
const t = i.current;
|
|
1757
|
+
if (e !== t) {
|
|
1758
|
+
n(t);
|
|
1759
|
+
const o = e.map((e) => {
|
|
1760
|
+
const t = T(e);
|
|
1761
|
+
return t ? (t.addEventListener("scroll", a, { passive: !0 }), [t, I(t)]) : null;
|
|
1762
|
+
}).filter((e) => null != e);
|
|
1763
|
+
r(o.length ? new Map(o) : null), i.current = e;
|
|
1764
|
+
}
|
|
1765
|
+
return () => {
|
|
1766
|
+
n(e), n(t);
|
|
1767
|
+
};
|
|
1768
|
+
function n(e) {
|
|
1769
|
+
e.forEach((e) => {
|
|
1770
|
+
T(e)?.removeEventListener("scroll", a);
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
}, [a, e]), t.useMemo(() => e.length ? n ? Array.from(n.values()).reduce((e, t) => o.add(e, t), v) : q(e) : v, [e, n]);
|
|
1774
|
+
}(Ye), Qe = Ce(Ge), Ze = Ce(Ge, [pe]), $e = o.add(Je, Qe), et = Ue ? S(Ue, Je) : null, tt = G && et ? m({
|
|
1775
|
+
active: G,
|
|
1776
|
+
collisionRect: et,
|
|
1777
|
+
droppableRects: se,
|
|
1778
|
+
droppableContainers: oe,
|
|
1779
|
+
pointerCoordinates: _e
|
|
1780
|
+
}) : null, nt = y(tt, "id"), [rt, ot] = t.useState(null), it = function(e, t, n) {
|
|
1781
|
+
return {
|
|
1782
|
+
...e,
|
|
1783
|
+
scaleX: t && n ? t.width / n.width : 1,
|
|
1784
|
+
scaleY: t && n ? t.height / n.height : 1
|
|
1785
|
+
};
|
|
1786
|
+
}(je ? Je : o.add(Je, Ze), null != (c = null == rt ? void 0 : rt.rect) ? c : null, pe), at = t.useRef(null), st = t.useCallback((e, t) => {
|
|
1787
|
+
let { sensor: n, options: o } = t;
|
|
1788
|
+
if (null == Q.current) return;
|
|
1789
|
+
const i = H.get(Q.current);
|
|
1790
|
+
if (!i) return;
|
|
1791
|
+
const a = e.nativeEvent, s = new n({
|
|
1792
|
+
active: Q.current,
|
|
1793
|
+
activeNode: i,
|
|
1794
|
+
event: a,
|
|
1795
|
+
options: o,
|
|
1796
|
+
context: Oe,
|
|
1797
|
+
onAbort(e) {
|
|
1798
|
+
if (!H.get(e)) return;
|
|
1799
|
+
const { onDragAbort: t } = ne.current, n = { id: e };
|
|
1800
|
+
t?.(n), A({
|
|
1801
|
+
type: "onDragAbort",
|
|
1802
|
+
event: n
|
|
1803
|
+
});
|
|
1804
|
+
},
|
|
1805
|
+
onPending(e, t, n, r) {
|
|
1806
|
+
if (!H.get(e)) return;
|
|
1807
|
+
const { onDragPending: o } = ne.current, i = {
|
|
1808
|
+
id: e,
|
|
1809
|
+
constraint: t,
|
|
1810
|
+
initialCoordinates: n,
|
|
1811
|
+
offset: r
|
|
1812
|
+
};
|
|
1813
|
+
o?.(i), A({
|
|
1814
|
+
type: "onDragPending",
|
|
1815
|
+
event: i
|
|
1816
|
+
});
|
|
1817
|
+
},
|
|
1818
|
+
onStart(e) {
|
|
1819
|
+
const t = Q.current;
|
|
1820
|
+
if (null == t) return;
|
|
1821
|
+
const n = H.get(t);
|
|
1822
|
+
if (!n) return;
|
|
1823
|
+
const { onDragStart: o } = ne.current, i = {
|
|
1824
|
+
activatorEvent: a,
|
|
1825
|
+
active: {
|
|
1826
|
+
id: t,
|
|
1827
|
+
data: n.data,
|
|
1828
|
+
rect: _
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1831
|
+
r.unstable_batchedUpdates(() => {
|
|
1832
|
+
o?.(i), F(Fe.Initializing), N({
|
|
1833
|
+
type: u.DragStart,
|
|
1834
|
+
initialCoordinates: e,
|
|
1835
|
+
active: t
|
|
1836
|
+
}), A({
|
|
1837
|
+
type: "onDragStart",
|
|
1838
|
+
event: i
|
|
1839
|
+
}), $(at.current), te(a);
|
|
1840
|
+
});
|
|
1841
|
+
},
|
|
1842
|
+
onMove(e) {
|
|
1843
|
+
N({
|
|
1844
|
+
type: u.DragMove,
|
|
1845
|
+
coordinates: e
|
|
1846
|
+
});
|
|
1847
|
+
},
|
|
1848
|
+
onEnd: l(u.DragEnd),
|
|
1849
|
+
onCancel: l(u.DragCancel)
|
|
1850
|
+
});
|
|
1851
|
+
function l(e) {
|
|
1852
|
+
return async function() {
|
|
1853
|
+
const { active: t, collisions: n, over: o, scrollAdjustedTranslate: i } = Oe.current;
|
|
1854
|
+
let s = null;
|
|
1855
|
+
if (t && i) {
|
|
1856
|
+
const { cancelDrop: r } = ne.current;
|
|
1857
|
+
s = {
|
|
1858
|
+
activatorEvent: a,
|
|
1859
|
+
active: t,
|
|
1860
|
+
collisions: n,
|
|
1861
|
+
delta: i,
|
|
1862
|
+
over: o
|
|
1863
|
+
}, e === u.DragEnd && "function" == typeof r && await Promise.resolve(r(s)) && (e = u.DragCancel);
|
|
1864
|
+
}
|
|
1865
|
+
Q.current = null, r.unstable_batchedUpdates(() => {
|
|
1866
|
+
N({ type: e }), F(Fe.Uninitialized), ot(null), $(null), te(null), at.current = null;
|
|
1867
|
+
const t = e === u.DragEnd ? "onDragEnd" : "onDragCancel";
|
|
1868
|
+
if (s) {
|
|
1869
|
+
const e = ne.current[t];
|
|
1870
|
+
e?.(s), A({
|
|
1871
|
+
type: t,
|
|
1872
|
+
event: s
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
});
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
at.current = s;
|
|
1879
|
+
}, [H]), lt = function(e, n) {
|
|
1880
|
+
return t.useMemo(() => e.reduce((e, t) => {
|
|
1881
|
+
const { sensor: r } = t;
|
|
1882
|
+
return [...e, ...r.activators.map((e) => ({
|
|
1883
|
+
eventName: e.eventName,
|
|
1884
|
+
handler: n(e.handler, t)
|
|
1885
|
+
}))];
|
|
1886
|
+
}, []), [e, n]);
|
|
1887
|
+
}(b, t.useCallback((e, t) => (n, r) => {
|
|
1888
|
+
const o = n.nativeEvent, i = H.get(r);
|
|
1889
|
+
null !== Q.current || !i || o.dndKit || o.defaultPrevented || !0 === e(n, t.options, { active: i }) && (o.dndKit = { capturedBy: t.sensor }, Q.current = r, st(n, t));
|
|
1890
|
+
}, [H, st]));
|
|
1891
|
+
(function(e) {
|
|
1892
|
+
t.useEffect(() => {
|
|
1893
|
+
if (!o.canUseDOM) return;
|
|
1894
|
+
const t = e.map((e) => {
|
|
1895
|
+
let { sensor: t } = e;
|
|
1896
|
+
return null == t.setup ? void 0 : t.setup();
|
|
1897
|
+
});
|
|
1898
|
+
return () => {
|
|
1899
|
+
for (const e of t) e?.();
|
|
1900
|
+
};
|
|
1901
|
+
}, e.map((e) => {
|
|
1902
|
+
let { sensor: t } = e;
|
|
1903
|
+
return t;
|
|
1904
|
+
}));
|
|
1905
|
+
})(b), o.useIsomorphicLayoutEffect(() => {
|
|
1906
|
+
pe && P === Fe.Initializing && F(Fe.Initialized);
|
|
1907
|
+
}, [pe, P]), t.useEffect(() => {
|
|
1908
|
+
const { onDragMove: e } = ne.current, { active: t, activatorEvent: n, collisions: o, over: i } = Oe.current;
|
|
1909
|
+
if (!t || !n) return;
|
|
1910
|
+
const a = {
|
|
1911
|
+
active: t,
|
|
1912
|
+
activatorEvent: n,
|
|
1913
|
+
collisions: o,
|
|
1914
|
+
delta: {
|
|
1915
|
+
x: $e.x,
|
|
1916
|
+
y: $e.y
|
|
1917
|
+
},
|
|
1918
|
+
over: i
|
|
1919
|
+
};
|
|
1920
|
+
r.unstable_batchedUpdates(() => {
|
|
1921
|
+
e?.(a), A({
|
|
1922
|
+
type: "onDragMove",
|
|
1923
|
+
event: a
|
|
1924
|
+
});
|
|
1925
|
+
});
|
|
1926
|
+
}, [$e.x, $e.y]), t.useEffect(() => {
|
|
1927
|
+
const { active: e, activatorEvent: t, collisions: n, droppableContainers: o, scrollAdjustedTranslate: i } = Oe.current;
|
|
1928
|
+
if (!e || null == Q.current || !t || !i) return;
|
|
1929
|
+
const { onDragOver: a } = ne.current, s = o.get(nt), l = s && s.rect.current ? {
|
|
1930
|
+
id: s.id,
|
|
1931
|
+
rect: s.rect.current,
|
|
1932
|
+
data: s.data,
|
|
1933
|
+
disabled: s.disabled
|
|
1934
|
+
} : null, c = {
|
|
1935
|
+
active: e,
|
|
1936
|
+
activatorEvent: t,
|
|
1937
|
+
collisions: n,
|
|
1938
|
+
delta: {
|
|
1939
|
+
x: i.x,
|
|
1940
|
+
y: i.y
|
|
1941
|
+
},
|
|
1942
|
+
over: l
|
|
1943
|
+
};
|
|
1944
|
+
r.unstable_batchedUpdates(() => {
|
|
1945
|
+
ot(l), a?.(c), A({
|
|
1946
|
+
type: "onDragOver",
|
|
1947
|
+
event: c
|
|
1948
|
+
});
|
|
1949
|
+
});
|
|
1950
|
+
}, [nt]), o.useIsomorphicLayoutEffect(() => {
|
|
1951
|
+
Oe.current = {
|
|
1952
|
+
activatorEvent: ee,
|
|
1953
|
+
active: G,
|
|
1954
|
+
activeNode: de,
|
|
1955
|
+
collisionRect: et,
|
|
1956
|
+
collisions: tt,
|
|
1957
|
+
droppableRects: se,
|
|
1958
|
+
draggableNodes: H,
|
|
1959
|
+
draggingNode: We,
|
|
1960
|
+
draggingNodeRect: Ue,
|
|
1961
|
+
droppableContainers: V,
|
|
1962
|
+
over: rt,
|
|
1963
|
+
scrollableAncestors: Ye,
|
|
1964
|
+
scrollAdjustedTranslate: $e
|
|
1965
|
+
}, _.current = {
|
|
1966
|
+
initial: Ue,
|
|
1967
|
+
translated: et
|
|
1968
|
+
};
|
|
1969
|
+
}, [
|
|
1970
|
+
G,
|
|
1971
|
+
de,
|
|
1972
|
+
tt,
|
|
1973
|
+
et,
|
|
1974
|
+
H,
|
|
1975
|
+
We,
|
|
1976
|
+
Ue,
|
|
1977
|
+
se,
|
|
1978
|
+
V,
|
|
1979
|
+
rt,
|
|
1980
|
+
Ye,
|
|
1981
|
+
$e
|
|
1982
|
+
]), function(e) {
|
|
1983
|
+
let { acceleration: n, activator: r = exports.AutoScrollActivator.Pointer, canScroll: i, draggingRect: a, enabled: s, interval: l = 5, order: c = exports.TraversalOrder.TreeOrder, pointerCoordinates: d, scrollableAncestors: u, scrollableAncestorRects: f, delta: v, threshold: g } = e;
|
|
1984
|
+
const p = function(e) {
|
|
1985
|
+
let { delta: t, disabled: n } = e;
|
|
1986
|
+
const r = o.usePrevious(t);
|
|
1987
|
+
return o.useLazyMemo((e) => {
|
|
1988
|
+
if (n || !r || !e) return ge;
|
|
1989
|
+
const o = Math.sign(t.x - r.x), i = Math.sign(t.y - r.y);
|
|
1990
|
+
return {
|
|
1991
|
+
x: {
|
|
1992
|
+
[B.Backward]: e.x[B.Backward] || -1 === o,
|
|
1993
|
+
[B.Forward]: e.x[B.Forward] || 1 === o
|
|
1994
|
+
},
|
|
1995
|
+
y: {
|
|
1996
|
+
[B.Backward]: e.y[B.Backward] || -1 === i,
|
|
1997
|
+
[B.Forward]: e.y[B.Forward] || 1 === i
|
|
1998
|
+
}
|
|
1999
|
+
};
|
|
2000
|
+
}, [
|
|
2001
|
+
n,
|
|
2002
|
+
t,
|
|
2003
|
+
r
|
|
2004
|
+
]);
|
|
2005
|
+
}({
|
|
2006
|
+
delta: v,
|
|
2007
|
+
disabled: !s
|
|
2008
|
+
}), [h, b] = o.useInterval(), m = t.useRef({
|
|
2009
|
+
x: 0,
|
|
2010
|
+
y: 0
|
|
2011
|
+
}), y = t.useRef({
|
|
2012
|
+
x: 0,
|
|
2013
|
+
y: 0
|
|
2014
|
+
}), x = t.useMemo(() => {
|
|
2015
|
+
switch (r) {
|
|
2016
|
+
case exports.AutoScrollActivator.Pointer: return d ? {
|
|
2017
|
+
top: d.y,
|
|
2018
|
+
bottom: d.y,
|
|
2019
|
+
left: d.x,
|
|
2020
|
+
right: d.x
|
|
2021
|
+
} : null;
|
|
2022
|
+
case exports.AutoScrollActivator.DraggableRect: return a;
|
|
2023
|
+
}
|
|
2024
|
+
}, [
|
|
2025
|
+
r,
|
|
2026
|
+
a,
|
|
2027
|
+
d
|
|
2028
|
+
]), w = t.useRef(null), C = t.useCallback(() => {
|
|
2029
|
+
const e = w.current;
|
|
2030
|
+
e && e.scrollBy(m.current.x * y.current.x, m.current.y * y.current.y);
|
|
2031
|
+
}, []), E = t.useMemo(() => c === exports.TraversalOrder.TreeOrder ? [...u].reverse() : u, [c, u]);
|
|
2032
|
+
t.useEffect(() => {
|
|
2033
|
+
if (s && u.length && x) {
|
|
2034
|
+
for (const e of E) {
|
|
2035
|
+
if (!1 === (null == i ? void 0 : i(e))) continue;
|
|
2036
|
+
const t = u.indexOf(e), r = f[t];
|
|
2037
|
+
if (!r) continue;
|
|
2038
|
+
const { direction: o, speed: a } = U(e, r, x, n, g);
|
|
2039
|
+
for (const e of ["x", "y"]) p[e][o[e]] || (a[e] = 0, o[e] = 0);
|
|
2040
|
+
if (a.x > 0 || a.y > 0) return b(), w.current = e, h(C, l), m.current = a, void (y.current = o);
|
|
2041
|
+
}
|
|
2042
|
+
m.current = {
|
|
2043
|
+
x: 0,
|
|
2044
|
+
y: 0
|
|
2045
|
+
}, y.current = {
|
|
2046
|
+
x: 0,
|
|
2047
|
+
y: 0
|
|
2048
|
+
}, b();
|
|
2049
|
+
} else b();
|
|
2050
|
+
}, [
|
|
2051
|
+
n,
|
|
2052
|
+
C,
|
|
2053
|
+
i,
|
|
2054
|
+
b,
|
|
2055
|
+
s,
|
|
2056
|
+
l,
|
|
2057
|
+
JSON.stringify(x),
|
|
2058
|
+
JSON.stringify(p),
|
|
2059
|
+
h,
|
|
2060
|
+
u,
|
|
2061
|
+
E,
|
|
2062
|
+
f,
|
|
2063
|
+
JSON.stringify(g)
|
|
2064
|
+
]);
|
|
2065
|
+
}({
|
|
2066
|
+
...fe,
|
|
2067
|
+
delta: X,
|
|
2068
|
+
draggingRect: et,
|
|
2069
|
+
pointerCoordinates: _e,
|
|
2070
|
+
scrollableAncestors: Ye,
|
|
2071
|
+
scrollableAncestorRects: Ve
|
|
2072
|
+
});
|
|
2073
|
+
const ct = t.useMemo(() => ({
|
|
2074
|
+
active: G,
|
|
2075
|
+
activeNode: de,
|
|
2076
|
+
activeNodeRect: pe,
|
|
2077
|
+
activatorEvent: ee,
|
|
2078
|
+
collisions: tt,
|
|
2079
|
+
containerNodeRect: ye,
|
|
2080
|
+
dragOverlay: Le,
|
|
2081
|
+
draggableNodes: H,
|
|
2082
|
+
droppableContainers: V,
|
|
2083
|
+
droppableRects: se,
|
|
2084
|
+
over: rt,
|
|
2085
|
+
measureDroppableContainers: le,
|
|
2086
|
+
scrollableAncestors: Ye,
|
|
2087
|
+
scrollableAncestorRects: Ve,
|
|
2088
|
+
measuringConfiguration: ie,
|
|
2089
|
+
measuringScheduled: ce,
|
|
2090
|
+
windowRect: Xe
|
|
2091
|
+
}), [
|
|
2092
|
+
G,
|
|
2093
|
+
de,
|
|
2094
|
+
pe,
|
|
2095
|
+
ee,
|
|
2096
|
+
tt,
|
|
2097
|
+
ye,
|
|
2098
|
+
Le,
|
|
2099
|
+
H,
|
|
2100
|
+
V,
|
|
2101
|
+
se,
|
|
2102
|
+
rt,
|
|
2103
|
+
le,
|
|
2104
|
+
Ye,
|
|
2105
|
+
Ve,
|
|
2106
|
+
ie,
|
|
2107
|
+
ce,
|
|
2108
|
+
Xe
|
|
2109
|
+
]), dt = t.useMemo(() => ({
|
|
2110
|
+
activatorEvent: ee,
|
|
2111
|
+
activators: lt,
|
|
2112
|
+
active: G,
|
|
2113
|
+
activeNodeRect: pe,
|
|
2114
|
+
ariaDescribedById: { draggable: re },
|
|
2115
|
+
dispatch: N,
|
|
2116
|
+
draggableNodes: H,
|
|
2117
|
+
over: rt,
|
|
2118
|
+
measureDroppableContainers: le
|
|
2119
|
+
}), [
|
|
2120
|
+
ee,
|
|
2121
|
+
lt,
|
|
2122
|
+
G,
|
|
2123
|
+
pe,
|
|
2124
|
+
N,
|
|
2125
|
+
re,
|
|
2126
|
+
H,
|
|
2127
|
+
rt,
|
|
2128
|
+
le
|
|
2129
|
+
]);
|
|
2130
|
+
return n.createElement(a.Provider, { value: K }, n.createElement(ke.Provider, { value: dt }, n.createElement(Te.Provider, { value: ct }, n.createElement(ze.Provider, { value: it }, h)), n.createElement(Ie, { disabled: !1 === (null == g ? void 0 : g.restoreFocus) })), n.createElement(d, {
|
|
2131
|
+
...g,
|
|
2132
|
+
hiddenTextDescribedById: re
|
|
2133
|
+
}));
|
|
2134
|
+
}));
|
|
2135
|
+
const Ue = t.createContext(null);
|
|
2136
|
+
const je = "button";
|
|
2137
|
+
function qe() {
|
|
2138
|
+
return t.useContext(Te);
|
|
2139
|
+
}
|
|
2140
|
+
const He = { timeout: 25 };
|
|
2141
|
+
function Xe(e) {
|
|
2142
|
+
let { animation: r, children: i } = e;
|
|
2143
|
+
const [a, s] = t.useState(null), [l, c] = t.useState(null), d = o.usePrevious(i);
|
|
2144
|
+
return i || a || !d || s(d), o.useIsomorphicLayoutEffect(() => {
|
|
2145
|
+
if (!l) return;
|
|
2146
|
+
const e = null == a ? void 0 : a.props.id;
|
|
2147
|
+
null != (null == a ? void 0 : a.key) && null != e ? Promise.resolve(r(e, l)).then(() => {
|
|
2148
|
+
s(null);
|
|
2149
|
+
}) : s(null);
|
|
2150
|
+
}, [
|
|
2151
|
+
r,
|
|
2152
|
+
a,
|
|
2153
|
+
l
|
|
2154
|
+
]), n.createElement(n.Fragment, null, i, a ? t.cloneElement(a, { ref: c }) : null);
|
|
2155
|
+
}
|
|
2156
|
+
const Ye = {
|
|
2157
|
+
x: 0,
|
|
2158
|
+
y: 0,
|
|
2159
|
+
scaleX: 1,
|
|
2160
|
+
scaleY: 1
|
|
2161
|
+
};
|
|
2162
|
+
function Ve(e) {
|
|
2163
|
+
let { children: t } = e;
|
|
2164
|
+
return n.createElement(ke.Provider, { value: Le }, n.createElement(ze.Provider, { value: Ye }, t));
|
|
2165
|
+
}
|
|
2166
|
+
const Je = {
|
|
2167
|
+
position: "fixed",
|
|
2168
|
+
touchAction: "none"
|
|
2169
|
+
};
|
|
2170
|
+
const _e = (e) => o.isKeyboardEvent(e) ? "transform 250ms ease" : void 0;
|
|
2171
|
+
const Ge = t.forwardRef((e, t) => {
|
|
2172
|
+
let { as: r, activatorEvent: i, adjustScale: a, children: s, className: l, rect: c, style: d, transform: u, transition: f = _e } = e;
|
|
2173
|
+
if (!c) return null;
|
|
2174
|
+
const v = a ? u : {
|
|
2175
|
+
...u,
|
|
2176
|
+
scaleX: 1,
|
|
2177
|
+
scaleY: 1
|
|
2178
|
+
}, g = {
|
|
2179
|
+
...Je,
|
|
2180
|
+
width: c.width,
|
|
2181
|
+
height: c.height,
|
|
2182
|
+
top: c.top,
|
|
2183
|
+
left: c.left,
|
|
2184
|
+
transform: o.CSS.Transform.toString(v),
|
|
2185
|
+
transformOrigin: a && i ? p(i, c) : void 0,
|
|
2186
|
+
transition: "function" == typeof f ? f(i) : f,
|
|
2187
|
+
...d
|
|
2188
|
+
};
|
|
2189
|
+
return n.createElement(r, {
|
|
2190
|
+
className: l,
|
|
2191
|
+
style: g,
|
|
2192
|
+
ref: t
|
|
2193
|
+
}, s);
|
|
2194
|
+
});
|
|
2195
|
+
const Qe = (e) => (t) => {
|
|
2196
|
+
let { active: n, dragOverlay: r } = t;
|
|
2197
|
+
const o = {}, { styles: i, className: a } = e;
|
|
2198
|
+
if (null != i && i.active) for (const [e, t] of Object.entries(i.active)) void 0 !== t && (o[e] = n.node.style.getPropertyValue(e), n.node.style.setProperty(e, t));
|
|
2199
|
+
if (null != i && i.dragOverlay) for (const [e, t] of Object.entries(i.dragOverlay)) void 0 !== t && r.node.style.setProperty(e, t);
|
|
2200
|
+
return null != a && a.active && n.node.classList.add(a.active), null != a && a.dragOverlay && r.node.classList.add(a.dragOverlay), function() {
|
|
2201
|
+
for (const [e, t] of Object.entries(o)) n.node.style.setProperty(e, t);
|
|
2202
|
+
null != a && a.active && n.node.classList.remove(a.active);
|
|
2203
|
+
};
|
|
2204
|
+
};
|
|
2205
|
+
const Ze = {
|
|
2206
|
+
duration: 250,
|
|
2207
|
+
easing: "ease",
|
|
2208
|
+
keyframes: (e) => {
|
|
2209
|
+
let { transform: { initial: t, final: n } } = e;
|
|
2210
|
+
return [{ transform: o.CSS.Transform.toString(t) }, { transform: o.CSS.Transform.toString(n) }];
|
|
2211
|
+
},
|
|
2212
|
+
sideEffects: Qe({ styles: { active: { opacity: "0" } } })
|
|
2213
|
+
};
|
|
2214
|
+
let $e = 0;
|
|
2215
|
+
function et(e) {
|
|
2216
|
+
return t.useMemo(() => {
|
|
2217
|
+
if (null != e) return $e++, $e;
|
|
2218
|
+
}, [e]);
|
|
2219
|
+
}
|
|
2220
|
+
const tt = n.memo((e) => {
|
|
2221
|
+
let { adjustScale: r = !1, children: i, dropAnimation: a, style: s, transition: l, modifiers: c, wrapperElement: d = "div", className: u, zIndex: f = 999 } = e;
|
|
2222
|
+
const { activatorEvent: v, active: g, activeNodeRect: p, containerNodeRect: h, draggableNodes: b, droppableContainers: m, dragOverlay: y, over: x, measuringConfiguration: w, scrollableAncestors: C, scrollableAncestorRects: E, windowRect: D } = qe(), R = t.useContext(ze), S = et(null == g ? void 0 : g.id), N = Be(c, {
|
|
2223
|
+
activatorEvent: v,
|
|
2224
|
+
active: g,
|
|
2225
|
+
activeNodeRect: p,
|
|
2226
|
+
containerNodeRect: h,
|
|
2227
|
+
draggingNodeRect: y.rect,
|
|
2228
|
+
over: x,
|
|
2229
|
+
overlayNodeRect: y.rect,
|
|
2230
|
+
scrollableAncestors: C,
|
|
2231
|
+
scrollableAncestorRects: E,
|
|
2232
|
+
transform: R,
|
|
2233
|
+
windowRect: D
|
|
2234
|
+
}), O = be(p), A = function(e) {
|
|
2235
|
+
let { config: t, draggableNodes: n, droppableContainers: r, measuringConfiguration: i } = e;
|
|
2236
|
+
return o.useEvent((e, a) => {
|
|
2237
|
+
if (null === t) return;
|
|
2238
|
+
const s = n.get(e);
|
|
2239
|
+
if (!s) return;
|
|
2240
|
+
const l = s.node.current;
|
|
2241
|
+
if (!l) return;
|
|
2242
|
+
const c = Re(a);
|
|
2243
|
+
if (!c) return;
|
|
2244
|
+
const { transform: d } = o.getWindow(a).getComputedStyle(a), u = M(d);
|
|
2245
|
+
if (!u) return;
|
|
2246
|
+
const f = "function" == typeof t ? t : function(e) {
|
|
2247
|
+
const { duration: t, easing: n, sideEffects: r, keyframes: o } = {
|
|
2248
|
+
...Ze,
|
|
2249
|
+
...e
|
|
2250
|
+
};
|
|
2251
|
+
return (e) => {
|
|
2252
|
+
let { active: i, dragOverlay: a, transform: s, ...l } = e;
|
|
2253
|
+
if (!t) return;
|
|
2254
|
+
const c = {
|
|
2255
|
+
x: s.x - (a.rect.left - i.rect.left),
|
|
2256
|
+
y: s.y - (a.rect.top - i.rect.top),
|
|
2257
|
+
scaleX: 1 !== s.scaleX ? i.rect.width * s.scaleX / a.rect.width : 1,
|
|
2258
|
+
scaleY: 1 !== s.scaleY ? i.rect.height * s.scaleY / a.rect.height : 1
|
|
2259
|
+
}, d = o({
|
|
2260
|
+
...l,
|
|
2261
|
+
active: i,
|
|
2262
|
+
dragOverlay: a,
|
|
2263
|
+
transform: {
|
|
2264
|
+
initial: s,
|
|
2265
|
+
final: c
|
|
2266
|
+
}
|
|
2267
|
+
}), [u] = d, f = d[d.length - 1];
|
|
2268
|
+
if (JSON.stringify(u) === JSON.stringify(f)) return;
|
|
2269
|
+
const v = null == r ? void 0 : r({
|
|
2270
|
+
active: i,
|
|
2271
|
+
dragOverlay: a,
|
|
2272
|
+
...l
|
|
2273
|
+
}), g = a.node.animate(d, {
|
|
2274
|
+
duration: t,
|
|
2275
|
+
easing: n,
|
|
2276
|
+
fill: "forwards"
|
|
2277
|
+
});
|
|
2278
|
+
return new Promise((e) => {
|
|
2279
|
+
g.onfinish = () => {
|
|
2280
|
+
v?.(), e();
|
|
2281
|
+
};
|
|
2282
|
+
});
|
|
2283
|
+
};
|
|
2284
|
+
}(t);
|
|
2285
|
+
return H(l, i.draggable.measure), f({
|
|
2286
|
+
active: {
|
|
2287
|
+
id: e,
|
|
2288
|
+
data: s.data,
|
|
2289
|
+
node: l,
|
|
2290
|
+
rect: i.draggable.measure(l)
|
|
2291
|
+
},
|
|
2292
|
+
draggableNodes: n,
|
|
2293
|
+
dragOverlay: {
|
|
2294
|
+
node: a,
|
|
2295
|
+
rect: i.dragOverlay.measure(c)
|
|
2296
|
+
},
|
|
2297
|
+
droppableContainers: r,
|
|
2298
|
+
measuringConfiguration: i,
|
|
2299
|
+
transform: u
|
|
2300
|
+
});
|
|
2301
|
+
});
|
|
2302
|
+
}({
|
|
2303
|
+
config: a,
|
|
2304
|
+
draggableNodes: b,
|
|
2305
|
+
droppableContainers: m,
|
|
2306
|
+
measuringConfiguration: w
|
|
2307
|
+
});
|
|
2308
|
+
return n.createElement(Ve, null, n.createElement(Xe, { animation: A }, g && S ? n.createElement(Ge, {
|
|
2309
|
+
key: S,
|
|
2310
|
+
id: g.id,
|
|
2311
|
+
ref: O ? y.setRef : void 0,
|
|
2312
|
+
as: d,
|
|
2313
|
+
activatorEvent: v,
|
|
2314
|
+
adjustScale: r,
|
|
2315
|
+
className: u,
|
|
2316
|
+
transition: l,
|
|
2317
|
+
rect: O,
|
|
2318
|
+
style: {
|
|
2319
|
+
zIndex: f,
|
|
2320
|
+
...s
|
|
2321
|
+
},
|
|
2322
|
+
transform: N
|
|
2323
|
+
}, i) : null));
|
|
2324
|
+
});
|
|
2325
|
+
exports.DndContext = We, exports.DragOverlay = tt, exports.KeyboardSensor = te, exports.MouseSensor = ce, exports.PointerSensor = ae, exports.TouchSensor = ue, exports.applyModifiers = Be, exports.closestCenter = (e) => {
|
|
2326
|
+
let { collisionRect: t, droppableRects: n, droppableContainers: r } = e;
|
|
2327
|
+
const o = x(t, t.left, t.top), i = [];
|
|
2328
|
+
for (const e of r) {
|
|
2329
|
+
const { id: t } = e, r = n.get(t);
|
|
2330
|
+
if (r) {
|
|
2331
|
+
const n = g(x(r), o);
|
|
2332
|
+
i.push({
|
|
2333
|
+
id: t,
|
|
2334
|
+
data: {
|
|
2335
|
+
droppableContainer: e,
|
|
2336
|
+
value: n
|
|
2337
|
+
}
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
return i.sort(h);
|
|
2342
|
+
}, exports.closestCorners = (e) => {
|
|
2343
|
+
let { collisionRect: t, droppableRects: n, droppableContainers: r } = e;
|
|
2344
|
+
const o = m(t), i = [];
|
|
2345
|
+
for (const e of r) {
|
|
2346
|
+
const { id: t } = e, r = n.get(t);
|
|
2347
|
+
if (r) {
|
|
2348
|
+
const n = m(r), a = o.reduce((e, t, r) => e + g(n[r], t), 0), s = Number((a / 4).toFixed(4));
|
|
2349
|
+
i.push({
|
|
2350
|
+
id: t,
|
|
2351
|
+
data: {
|
|
2352
|
+
droppableContainer: e,
|
|
2353
|
+
value: s
|
|
2354
|
+
}
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
return i.sort(h);
|
|
2359
|
+
}, exports.defaultAnnouncements = c, exports.defaultCoordinates = v, exports.defaultDropAnimation = Ze, exports.defaultDropAnimationSideEffects = Qe, exports.defaultKeyboardCoordinateGetter = ee, exports.defaultScreenReaderInstructions = l, exports.getClientRect = O, exports.getFirstCollision = y, exports.getScrollableAncestors = L, exports.pointerWithin = (e) => {
|
|
2360
|
+
let { droppableContainers: t, droppableRects: n, pointerCoordinates: r } = e;
|
|
2361
|
+
if (!r) return [];
|
|
2362
|
+
const o = [];
|
|
2363
|
+
for (const e of t) {
|
|
2364
|
+
const { id: t } = e, i = n.get(t);
|
|
2365
|
+
if (i && E(r, i)) {
|
|
2366
|
+
const n = m(i).reduce((e, t) => e + g(r, t), 0), a = Number((n / 4).toFixed(4));
|
|
2367
|
+
o.push({
|
|
2368
|
+
id: t,
|
|
2369
|
+
data: {
|
|
2370
|
+
droppableContainer: e,
|
|
2371
|
+
value: a
|
|
2372
|
+
}
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
return o.sort(h);
|
|
2377
|
+
}, exports.rectIntersection = C, exports.useDndContext = qe, exports.useDndMonitor = s, exports.useDraggable = function(e) {
|
|
2378
|
+
let { id: n, data: r, disabled: i = !1, attributes: a } = e;
|
|
2379
|
+
const s = o.useUniqueId("Draggable"), { activators: l, activatorEvent: c, active: d, activeNodeRect: u, ariaDescribedById: f, draggableNodes: v, over: g } = t.useContext(ke), { role: p = je, roleDescription: h = "draggable", tabIndex: b = 0 } = null != a ? a : {}, m = (null == d ? void 0 : d.id) === n, y = t.useContext(m ? ze : Ue), [x, w] = o.useNodeRef(), [C, E] = o.useNodeRef(), D = function(e, n) {
|
|
2380
|
+
return t.useMemo(() => e.reduce((e, t) => {
|
|
2381
|
+
let { eventName: r, handler: o } = t;
|
|
2382
|
+
return e[r] = (e) => {
|
|
2383
|
+
o(e, n);
|
|
2384
|
+
}, e;
|
|
2385
|
+
}, {}), [e, n]);
|
|
2386
|
+
}(l, n), R = o.useLatestValue(r);
|
|
2387
|
+
return o.useIsomorphicLayoutEffect(() => (v.set(n, {
|
|
2388
|
+
id: n,
|
|
2389
|
+
key: s,
|
|
2390
|
+
node: x,
|
|
2391
|
+
activatorNode: C,
|
|
2392
|
+
data: R
|
|
2393
|
+
}), () => {
|
|
2394
|
+
const e = v.get(n);
|
|
2395
|
+
e && e.key === s && v.delete(n);
|
|
2396
|
+
}), [v, n]), {
|
|
2397
|
+
active: d,
|
|
2398
|
+
activatorEvent: c,
|
|
2399
|
+
activeNodeRect: u,
|
|
2400
|
+
attributes: t.useMemo(() => ({
|
|
2401
|
+
role: p,
|
|
2402
|
+
tabIndex: b,
|
|
2403
|
+
"aria-disabled": i,
|
|
2404
|
+
"aria-pressed": !(!m || p !== je) || void 0,
|
|
2405
|
+
"aria-roledescription": h,
|
|
2406
|
+
"aria-describedby": f.draggable
|
|
2407
|
+
}), [
|
|
2408
|
+
i,
|
|
2409
|
+
p,
|
|
2410
|
+
b,
|
|
2411
|
+
m,
|
|
2412
|
+
h,
|
|
2413
|
+
f.draggable
|
|
2414
|
+
]),
|
|
2415
|
+
isDragging: m,
|
|
2416
|
+
listeners: i ? void 0 : D,
|
|
2417
|
+
node: x,
|
|
2418
|
+
over: g,
|
|
2419
|
+
setNodeRef: w,
|
|
2420
|
+
setActivatorNodeRef: E,
|
|
2421
|
+
transform: y
|
|
2422
|
+
};
|
|
2423
|
+
}, exports.useDroppable = function(e) {
|
|
2424
|
+
let { data: n, disabled: r = !1, id: i, resizeObserverConfig: a } = e;
|
|
2425
|
+
const s = o.useUniqueId("Droppable"), { active: l, dispatch: c, over: d, measureDroppableContainers: f } = t.useContext(ke), v = t.useRef({ disabled: r }), g = t.useRef(!1), p = t.useRef(null), h = t.useRef(null), { disabled: b, updateMeasurementsFor: m, timeout: y } = {
|
|
2426
|
+
...He,
|
|
2427
|
+
...a
|
|
2428
|
+
}, x = o.useLatestValue(null != m ? m : i), w = me({
|
|
2429
|
+
callback: t.useCallback(() => {
|
|
2430
|
+
g.current ? (null != h.current && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
2431
|
+
f(Array.isArray(x.current) ? x.current : [x.current]), h.current = null;
|
|
2432
|
+
}, y)) : g.current = !0;
|
|
2433
|
+
}, [y]),
|
|
2434
|
+
disabled: b || !l
|
|
2435
|
+
}), C = t.useCallback((e, t) => {
|
|
2436
|
+
w && (t && (w.unobserve(t), g.current = !1), e && w.observe(e));
|
|
2437
|
+
}, [w]), [E, D] = o.useNodeRef(C), R = o.useLatestValue(n);
|
|
2438
|
+
return t.useEffect(() => {
|
|
2439
|
+
w && E.current && (w.disconnect(), g.current = !1, w.observe(E.current));
|
|
2440
|
+
}, [E, w]), t.useEffect(() => (c({
|
|
2441
|
+
type: u.RegisterDroppable,
|
|
2442
|
+
element: {
|
|
2443
|
+
id: i,
|
|
2444
|
+
key: s,
|
|
2445
|
+
disabled: r,
|
|
2446
|
+
node: E,
|
|
2447
|
+
rect: p,
|
|
2448
|
+
data: R
|
|
2449
|
+
}
|
|
2450
|
+
}), () => c({
|
|
2451
|
+
type: u.UnregisterDroppable,
|
|
2452
|
+
key: s,
|
|
2453
|
+
id: i
|
|
2454
|
+
})), [i]), t.useEffect(() => {
|
|
2455
|
+
r !== v.current.disabled && (c({
|
|
2456
|
+
type: u.SetDroppableDisabled,
|
|
2457
|
+
id: i,
|
|
2458
|
+
key: s,
|
|
2459
|
+
disabled: r
|
|
2460
|
+
}), v.current.disabled = r);
|
|
2461
|
+
}, [
|
|
2462
|
+
i,
|
|
2463
|
+
s,
|
|
2464
|
+
r,
|
|
2465
|
+
c
|
|
2466
|
+
]), {
|
|
2467
|
+
active: l,
|
|
2468
|
+
rect: p,
|
|
2469
|
+
isOver: (null == d ? void 0 : d.id) === i,
|
|
2470
|
+
node: E,
|
|
2471
|
+
over: d,
|
|
2472
|
+
setNodeRef: D
|
|
2473
|
+
};
|
|
2474
|
+
}, exports.useSensor = function(e, n) {
|
|
2475
|
+
return t.useMemo(() => ({
|
|
2476
|
+
sensor: e,
|
|
2477
|
+
options: null != n ? n : {}
|
|
2478
|
+
}), [e, n]);
|
|
2479
|
+
}, exports.useSensors = function() {
|
|
2480
|
+
for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r];
|
|
2481
|
+
return t.useMemo(() => [...n].filter((e) => null != e), [...n]);
|
|
2482
|
+
};
|
|
2483
|
+
}));
|
|
2484
|
+
//#endregion
|
|
2485
|
+
//#region src/client/auto-group.ts
|
|
2486
|
+
var import_dist = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2487
|
+
module.exports = require_core_cjs_production_min();
|
|
2488
|
+
})))();
|
|
2489
|
+
/** 分组所需的最少成员数。 */
|
|
2490
|
+
const MIN_GROUP_SIZE = 2;
|
|
2491
|
+
/** 取技能名第一个 `-` 之前的部分;没有 `-` 时取整个名称。 */
|
|
2492
|
+
function segmentPrefix(name) {
|
|
2493
|
+
const index = name.indexOf("-");
|
|
2494
|
+
return index <= 0 ? name : name.slice(0, index);
|
|
2495
|
+
}
|
|
2496
|
+
/** 取一组技能名按 `-` 分段的最长公共前缀;没有公共分段时返回空串。 */
|
|
2497
|
+
function longestSegmentPrefix(names) {
|
|
2498
|
+
if (names.length === 0) return "";
|
|
2499
|
+
const [first, ...rest] = names.map((name) => name.split("-"));
|
|
2500
|
+
const common = [];
|
|
2501
|
+
for (const [index, segment] of (first ?? []).entries()) if (rest.every((parts) => parts[index] === segment)) common.push(segment);
|
|
2502
|
+
else break;
|
|
2503
|
+
return common.join("-");
|
|
2504
|
+
}
|
|
2505
|
+
/** 按名称比较。 */
|
|
2506
|
+
function compare(a, b) {
|
|
2507
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
2508
|
+
}
|
|
2509
|
+
/** 判断技能是否属于该文件夹:名称相等或以「文件夹名-」开头。 */
|
|
2510
|
+
function matchesFolder(skill, folderName) {
|
|
2511
|
+
const name = folderName.trim().toLowerCase();
|
|
2512
|
+
if (name === "") return false;
|
|
2513
|
+
const target = skill.toLowerCase();
|
|
2514
|
+
return target === name || target.startsWith(`${name}-`);
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* 为未分组技能生成文件夹,保留已在文件夹中的成员与现有文件夹顺序。
|
|
2518
|
+
* @param folders - 现有文件夹。
|
|
2519
|
+
* @param skills - 全部技能名。
|
|
2520
|
+
* @param describe - 为新文件夹生成简介,参数是分组前缀。
|
|
2521
|
+
* @returns 新的文件夹列表。
|
|
2522
|
+
*/
|
|
2523
|
+
function autoGroup(folders, skills, describe) {
|
|
2524
|
+
const index = folderIndex(folders);
|
|
2525
|
+
const result = folders.map((folder) => ({
|
|
2526
|
+
...folder,
|
|
2527
|
+
skills: [...folder.skills]
|
|
2528
|
+
}));
|
|
2529
|
+
const pending = skills.filter((skill) => !index.has(skill)).sort(compare);
|
|
2530
|
+
if (pending.length === 0) return result;
|
|
2531
|
+
const byName = /* @__PURE__ */ new Map();
|
|
2532
|
+
for (const folder of result) byName.set(autoGroupNameKey(folder.name), folder);
|
|
2533
|
+
const remaining = [];
|
|
2534
|
+
for (const skill of pending) {
|
|
2535
|
+
const target = result.filter((folder) => matchesFolder(skill, folder.name)).sort((a, b) => b.name.trim().length - a.name.trim().length)[0];
|
|
2536
|
+
if (target === void 0) remaining.push(skill);
|
|
2537
|
+
else target.skills.push(skill);
|
|
2538
|
+
}
|
|
2539
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
2540
|
+
for (const skill of remaining) {
|
|
2541
|
+
const prefix = segmentPrefix(skill);
|
|
2542
|
+
const bucket = buckets.get(prefix);
|
|
2543
|
+
if (bucket === void 0) buckets.set(prefix, [skill]);
|
|
2544
|
+
else bucket.push(skill);
|
|
2545
|
+
}
|
|
2546
|
+
const created = [];
|
|
2547
|
+
for (const [bucketPrefix, members] of [...buckets].sort(([a], [b]) => compare(a, b))) {
|
|
2548
|
+
if (members.length < MIN_GROUP_SIZE) continue;
|
|
2549
|
+
members.sort(compare);
|
|
2550
|
+
const name = longestSegmentPrefix(members) || bucketPrefix;
|
|
2551
|
+
const existing = byName.get(autoGroupNameKey(name));
|
|
2552
|
+
if (existing !== void 0) {
|
|
2553
|
+
existing.skills.push(...members.filter((skill) => !existing.skills.includes(skill)));
|
|
2554
|
+
continue;
|
|
2555
|
+
}
|
|
2556
|
+
const folder = {
|
|
2557
|
+
name,
|
|
2558
|
+
description: describe(name),
|
|
2559
|
+
skills: members
|
|
2560
|
+
};
|
|
2561
|
+
created.push(folder);
|
|
2562
|
+
byName.set(autoGroupNameKey(name), folder);
|
|
2563
|
+
}
|
|
2564
|
+
for (const folder of created) if (!result.includes(folder)) result.push(folder);
|
|
2565
|
+
return result;
|
|
2566
|
+
}
|
|
2567
|
+
//#endregion
|
|
2568
|
+
//#region src/client/styles.ts
|
|
2569
|
+
/** 页面纵向栈,限制内容宽度并允许窄屏收缩。 */
|
|
2570
|
+
const pageStyle = {
|
|
2571
|
+
display: "flex",
|
|
2572
|
+
flexDirection: "column",
|
|
2573
|
+
gap: 20,
|
|
2574
|
+
width: "100%",
|
|
2575
|
+
maxWidth: 1200,
|
|
2576
|
+
minWidth: 0,
|
|
2577
|
+
margin: "0 auto",
|
|
2578
|
+
padding: "8px 0",
|
|
2579
|
+
boxSizing: "border-box"
|
|
2580
|
+
};
|
|
2581
|
+
/** 页面标题与用途说明。 */
|
|
2582
|
+
const pageHeaderStyle = {
|
|
2583
|
+
display: "flex",
|
|
2584
|
+
flexDirection: "column",
|
|
2585
|
+
gap: 4
|
|
2586
|
+
};
|
|
2587
|
+
/** 页面主标题。 */
|
|
2588
|
+
const pageTitleStyle = {
|
|
2589
|
+
margin: 0,
|
|
2590
|
+
fontSize: 18,
|
|
2591
|
+
fontWeight: 600,
|
|
2592
|
+
lineHeight: 1.4,
|
|
2593
|
+
color: "var(--dsw-alias-label-primary)"
|
|
2594
|
+
};
|
|
2595
|
+
/** 页面用途说明。 */
|
|
2596
|
+
const pageDescriptionStyle = {
|
|
2597
|
+
margin: 0,
|
|
2598
|
+
maxWidth: 720,
|
|
2599
|
+
fontSize: 13,
|
|
2600
|
+
lineHeight: "20px",
|
|
2601
|
+
color: "var(--dsw-alias-label-secondary)"
|
|
2602
|
+
};
|
|
2603
|
+
/** 分组操作与筛选所在的工具面板。 */
|
|
2604
|
+
const toolbarStyle = {
|
|
2605
|
+
display: "flex",
|
|
2606
|
+
flexWrap: "wrap",
|
|
2607
|
+
alignItems: "center",
|
|
2608
|
+
gap: 8,
|
|
2609
|
+
padding: 12,
|
|
2610
|
+
border: "0.5px solid var(--dsw-alias-border-l2)",
|
|
2611
|
+
borderRadius: 10,
|
|
2612
|
+
background: "var(--dsw-alias-bg-layer-1)"
|
|
2613
|
+
};
|
|
2614
|
+
/** 工具栏内的主要操作组。 */
|
|
2615
|
+
const toolbarActionsStyle = {
|
|
2616
|
+
display: "flex",
|
|
2617
|
+
flexWrap: "wrap",
|
|
2618
|
+
gap: 8
|
|
2619
|
+
};
|
|
2620
|
+
/** 筛选输入与结果计数的容器。 */
|
|
2621
|
+
const filterGroupStyle = {
|
|
2622
|
+
display: "flex",
|
|
2623
|
+
flex: "1 1 240px",
|
|
2624
|
+
alignItems: "center",
|
|
2625
|
+
justifyContent: "flex-end",
|
|
2626
|
+
gap: 8,
|
|
2627
|
+
minWidth: 0
|
|
2628
|
+
};
|
|
2629
|
+
/** 自适应文件夹卡片网格。 */
|
|
2630
|
+
const folderGridStyle = {
|
|
2631
|
+
display: "grid",
|
|
2632
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 280px), 1fr))",
|
|
2633
|
+
gap: 12,
|
|
2634
|
+
alignItems: "start"
|
|
2635
|
+
};
|
|
2636
|
+
/** 文件夹与未分组区域的共同容器。 */
|
|
2637
|
+
const folderSectionStyle = {
|
|
2638
|
+
display: "flex",
|
|
2639
|
+
flexDirection: "column",
|
|
2640
|
+
gap: 10,
|
|
2641
|
+
minWidth: 0
|
|
2642
|
+
};
|
|
2643
|
+
/** 区块标题行。 */
|
|
2644
|
+
const sectionHeaderStyle = {
|
|
2645
|
+
display: "flex",
|
|
2646
|
+
alignItems: "center",
|
|
2647
|
+
justifyContent: "space-between",
|
|
2648
|
+
gap: 8
|
|
2649
|
+
};
|
|
2650
|
+
/** 区域计数与状态 badge。 */
|
|
2651
|
+
const badgeStyle = {
|
|
2652
|
+
display: "inline-flex",
|
|
2653
|
+
alignItems: "center",
|
|
2654
|
+
minHeight: 20,
|
|
2655
|
+
padding: "0 7px",
|
|
2656
|
+
borderRadius: 10,
|
|
2657
|
+
background: "var(--dsw-alias-bg-layer-2)",
|
|
2658
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
2659
|
+
fontSize: 11,
|
|
2660
|
+
lineHeight: "18px",
|
|
2661
|
+
whiteSpace: "nowrap"
|
|
2662
|
+
};
|
|
2663
|
+
/** 加载、错误与警告状态的统一容器。 */
|
|
2664
|
+
const statusStyle = {
|
|
2665
|
+
display: "flex",
|
|
2666
|
+
flexWrap: "wrap",
|
|
2667
|
+
alignItems: "center",
|
|
2668
|
+
gap: 8,
|
|
2669
|
+
margin: 0,
|
|
2670
|
+
padding: "8px 10px",
|
|
2671
|
+
border: "0.5px solid var(--dsw-alias-border-l2)",
|
|
2672
|
+
borderRadius: 8,
|
|
2673
|
+
background: "var(--dsw-alias-bg-layer-1)"
|
|
2674
|
+
};
|
|
2675
|
+
/** 区块标题。 */
|
|
2676
|
+
const sectionTitleStyle = {
|
|
2677
|
+
margin: 0,
|
|
2678
|
+
fontSize: 13,
|
|
2679
|
+
fontWeight: 500,
|
|
2680
|
+
lineHeight: 1.5,
|
|
2681
|
+
color: "var(--dsw-alias-label-primary)"
|
|
2682
|
+
};
|
|
2683
|
+
/** 次级说明文字。 */
|
|
2684
|
+
const hintStyle = {
|
|
2685
|
+
margin: 0,
|
|
2686
|
+
fontSize: 12,
|
|
2687
|
+
lineHeight: "18px",
|
|
2688
|
+
color: "var(--dsw-alias-label-secondary)"
|
|
2689
|
+
};
|
|
2690
|
+
/** 错误状态容器与文字。 */
|
|
2691
|
+
const errorStyle = {
|
|
2692
|
+
...statusStyle,
|
|
2693
|
+
...hintStyle,
|
|
2694
|
+
borderColor: "var(--dsw-alias-state-error-primary)",
|
|
2695
|
+
color: "var(--dsw-alias-state-error-primary)"
|
|
2696
|
+
};
|
|
2697
|
+
/** 警告状态容器与文字。 */
|
|
2698
|
+
const warnStyle = {
|
|
2699
|
+
...statusStyle,
|
|
2700
|
+
...hintStyle,
|
|
2701
|
+
borderColor: "var(--dsw-alias-state-warn-primary)",
|
|
2702
|
+
color: "var(--dsw-alias-state-warn-primary)"
|
|
2703
|
+
};
|
|
2704
|
+
/** 次级按钮。 */
|
|
2705
|
+
const buttonStyle = {
|
|
2706
|
+
minHeight: 30,
|
|
2707
|
+
padding: "0 12px",
|
|
2708
|
+
border: "0.5px solid var(--dsw-alias-border-l2)",
|
|
2709
|
+
borderRadius: 6,
|
|
2710
|
+
background: "var(--dsw-alias-bg-layer-2)",
|
|
2711
|
+
color: "var(--dsw-alias-label-primary)",
|
|
2712
|
+
fontSize: 12,
|
|
2713
|
+
fontWeight: 500,
|
|
2714
|
+
cursor: "pointer"
|
|
2715
|
+
};
|
|
2716
|
+
/** 主要操作按钮。 */
|
|
2717
|
+
const primaryButtonStyle = {
|
|
2718
|
+
...buttonStyle,
|
|
2719
|
+
borderColor: "var(--dsw-alias-brand-primary)",
|
|
2720
|
+
background: "var(--dsw-alias-brand-primary)",
|
|
2721
|
+
color: "var(--dsw-alias-bg-base)"
|
|
2722
|
+
};
|
|
2723
|
+
/** 折叠等紧凑图标按钮。 */
|
|
2724
|
+
const iconButtonStyle = {
|
|
2725
|
+
display: "inline-flex",
|
|
2726
|
+
flex: "0 0 28px",
|
|
2727
|
+
alignItems: "center",
|
|
2728
|
+
justifyContent: "center",
|
|
2729
|
+
width: 28,
|
|
2730
|
+
height: 28,
|
|
2731
|
+
padding: 0,
|
|
2732
|
+
border: "none",
|
|
2733
|
+
borderRadius: 6,
|
|
2734
|
+
background: "transparent",
|
|
2735
|
+
color: "var(--dsw-alias-label-primary)",
|
|
2736
|
+
cursor: "pointer",
|
|
2737
|
+
fontSize: 16
|
|
2738
|
+
};
|
|
2739
|
+
/** 文字按钮,用于删除等低强调操作。 */
|
|
2740
|
+
const textButtonStyle = {
|
|
2741
|
+
height: 24,
|
|
2742
|
+
padding: "0 6px",
|
|
2743
|
+
border: "none",
|
|
2744
|
+
borderRadius: 4,
|
|
2745
|
+
background: "transparent",
|
|
2746
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
2747
|
+
fontSize: 12,
|
|
2748
|
+
cursor: "pointer"
|
|
2749
|
+
};
|
|
2750
|
+
/** 单行输入框。 */
|
|
2751
|
+
const inputStyle = {
|
|
2752
|
+
height: 30,
|
|
2753
|
+
minWidth: 0,
|
|
2754
|
+
padding: "0 9px",
|
|
2755
|
+
border: "0.5px solid var(--dsw-alias-border-l2)",
|
|
2756
|
+
borderRadius: 6,
|
|
2757
|
+
background: "var(--dsw-alias-bg-base)",
|
|
2758
|
+
color: "var(--dsw-alias-label-primary)",
|
|
2759
|
+
fontSize: 12,
|
|
2760
|
+
boxSizing: "border-box"
|
|
2761
|
+
};
|
|
2762
|
+
/** 文件夹名称输入框。 */
|
|
2763
|
+
const folderNameInputStyle = {
|
|
2764
|
+
...inputStyle,
|
|
2765
|
+
flex: "1 1 160px",
|
|
2766
|
+
fontWeight: 600
|
|
2767
|
+
};
|
|
2768
|
+
/** 筛选输入框。 */
|
|
2769
|
+
const filterInputStyle = {
|
|
2770
|
+
...inputStyle,
|
|
2771
|
+
flex: "1 1 140px",
|
|
2772
|
+
width: "100%"
|
|
2773
|
+
};
|
|
2774
|
+
/** 非法输入框。 */
|
|
2775
|
+
const invalidInputStyle = {
|
|
2776
|
+
...inputStyle,
|
|
2777
|
+
borderColor: "var(--dsw-alias-state-error-primary)"
|
|
2778
|
+
};
|
|
2779
|
+
/** 文件夹卡片与未分组区域的外框。 */
|
|
2780
|
+
const cardStyle = {
|
|
2781
|
+
display: "flex",
|
|
2782
|
+
flexDirection: "column",
|
|
2783
|
+
gap: 10,
|
|
2784
|
+
minWidth: 0,
|
|
2785
|
+
padding: 14,
|
|
2786
|
+
border: "0.5px solid var(--dsw-alias-border-l2)",
|
|
2787
|
+
borderRadius: 10,
|
|
2788
|
+
background: "var(--dsw-alias-bg-layer-1)",
|
|
2789
|
+
boxSizing: "border-box"
|
|
2790
|
+
};
|
|
2791
|
+
/** 拖拽经过时的放置区高亮。 */
|
|
2792
|
+
const cardActiveStyle = {
|
|
2793
|
+
...cardStyle,
|
|
2794
|
+
borderColor: "var(--dsw-alias-brand-primary)",
|
|
2795
|
+
background: "var(--dsw-alias-bg-layer-2)"
|
|
2796
|
+
};
|
|
2797
|
+
/** 卡片标题行:名称、计数与删除按钮。 */
|
|
2798
|
+
const cardHeaderStyle = {
|
|
2799
|
+
display: "flex",
|
|
2800
|
+
flexWrap: "wrap",
|
|
2801
|
+
alignItems: "center",
|
|
2802
|
+
gap: 8
|
|
2803
|
+
};
|
|
2804
|
+
/** 卡片右侧计数与操作。 */
|
|
2805
|
+
const cardActionsStyle = {
|
|
2806
|
+
display: "flex",
|
|
2807
|
+
alignItems: "center",
|
|
2808
|
+
gap: 4,
|
|
2809
|
+
marginLeft: "auto"
|
|
2810
|
+
};
|
|
2811
|
+
/** 折叠箭头。 */
|
|
2812
|
+
const collapseIconStyle = {
|
|
2813
|
+
display: "inline-block",
|
|
2814
|
+
lineHeight: 1,
|
|
2815
|
+
transition: "transform 120ms ease"
|
|
2816
|
+
};
|
|
2817
|
+
/** 成员列表:技能条目折行排列。 */
|
|
2818
|
+
const chipListStyle = {
|
|
2819
|
+
display: "flex",
|
|
2820
|
+
flexWrap: "wrap",
|
|
2821
|
+
gap: 6,
|
|
2822
|
+
minHeight: 30,
|
|
2823
|
+
minWidth: 0
|
|
2824
|
+
};
|
|
2825
|
+
/** 一个技能条目。 */
|
|
2826
|
+
const chipStyle = {
|
|
2827
|
+
display: "inline-flex",
|
|
2828
|
+
alignItems: "center",
|
|
2829
|
+
gap: 4,
|
|
2830
|
+
maxWidth: "100%",
|
|
2831
|
+
minHeight: 28,
|
|
2832
|
+
padding: "2px 4px 2px 8px",
|
|
2833
|
+
border: "0.5px solid var(--dsw-alias-border-l1)",
|
|
2834
|
+
borderRadius: 6,
|
|
2835
|
+
background: "var(--dsw-alias-bg-layer-2)",
|
|
2836
|
+
boxSizing: "border-box",
|
|
2837
|
+
color: "var(--dsw-alias-label-primary)",
|
|
2838
|
+
fontSize: 12,
|
|
2839
|
+
cursor: "grab",
|
|
2840
|
+
touchAction: "none",
|
|
2841
|
+
userSelect: "none"
|
|
2842
|
+
};
|
|
2843
|
+
/** 未找到的成员。 */
|
|
2844
|
+
const missingChipStyle = {
|
|
2845
|
+
...chipStyle,
|
|
2846
|
+
color: "var(--dsw-alias-state-warn-primary)",
|
|
2847
|
+
borderStyle: "dashed",
|
|
2848
|
+
cursor: "default"
|
|
2849
|
+
};
|
|
2850
|
+
/** 条目名称:超长时省略。 */
|
|
2851
|
+
const chipNameStyle = {
|
|
2852
|
+
overflow: "hidden",
|
|
2853
|
+
textOverflow: "ellipsis",
|
|
2854
|
+
whiteSpace: "nowrap"
|
|
2855
|
+
};
|
|
2856
|
+
/** 独立拖拽手柄与技能名称。 */
|
|
2857
|
+
const dragHandleStyle = {
|
|
2858
|
+
display: "inline-flex",
|
|
2859
|
+
alignItems: "center",
|
|
2860
|
+
gap: 4,
|
|
2861
|
+
minWidth: 0,
|
|
2862
|
+
padding: 0,
|
|
2863
|
+
border: 0,
|
|
2864
|
+
borderRadius: 4,
|
|
2865
|
+
background: "transparent",
|
|
2866
|
+
color: "inherit",
|
|
2867
|
+
font: "inherit",
|
|
2868
|
+
cursor: "grab",
|
|
2869
|
+
touchAction: "none"
|
|
2870
|
+
};
|
|
2871
|
+
/** 拖拽手柄图标。 */
|
|
2872
|
+
const dragIconStyle = {
|
|
2873
|
+
flexShrink: 0,
|
|
2874
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
2875
|
+
fontSize: 12,
|
|
2876
|
+
letterSpacing: -2
|
|
2877
|
+
};
|
|
2878
|
+
/** 仅供读屏播报的实时状态。 */
|
|
2879
|
+
const srOnlyStyle = {
|
|
2880
|
+
position: "absolute",
|
|
2881
|
+
width: 1,
|
|
2882
|
+
height: 1,
|
|
2883
|
+
padding: 0,
|
|
2884
|
+
margin: -1,
|
|
2885
|
+
overflow: "hidden",
|
|
2886
|
+
clip: "rect(0, 0, 0, 0)",
|
|
2887
|
+
whiteSpace: "nowrap",
|
|
2888
|
+
border: 0
|
|
2889
|
+
};
|
|
2890
|
+
/** 「移动到」下拉框。 */
|
|
2891
|
+
const selectStyle = {
|
|
2892
|
+
height: 20,
|
|
2893
|
+
maxWidth: 96,
|
|
2894
|
+
border: "none",
|
|
2895
|
+
background: "transparent",
|
|
2896
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
2897
|
+
fontSize: 11,
|
|
2898
|
+
cursor: "pointer"
|
|
2899
|
+
};
|
|
2900
|
+
/** 区块分隔:0.5px 的 l2 分隔线。 */
|
|
2901
|
+
const dividerStyle = { borderTop: "0.5px solid var(--dsw-alias-border-l2)" };
|
|
2902
|
+
/** 搜索选项的自适应两列布局。 */
|
|
2903
|
+
const optionsGridStyle = {
|
|
2904
|
+
display: "grid",
|
|
2905
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 240px), 1fr))",
|
|
2906
|
+
gap: 12,
|
|
2907
|
+
paddingTop: 4
|
|
2908
|
+
};
|
|
2909
|
+
/** 页面内控件的键盘焦点样式。 */
|
|
2910
|
+
const focusStyleText = `
|
|
2911
|
+
[data-skill-folder-page] button:focus-visible,
|
|
2912
|
+
[data-skill-folder-page] input:focus-visible,
|
|
2913
|
+
[data-skill-folder-page] select:focus-visible,
|
|
2914
|
+
[data-skill-folder-page] [data-skill-drag-handle]:focus-visible {
|
|
2915
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
2916
|
+
outline-offset: 2px;
|
|
2917
|
+
}
|
|
2918
|
+
[data-skill-folder-page] button:disabled,
|
|
2919
|
+
[data-skill-folder-page] input:disabled,
|
|
2920
|
+
[data-skill-folder-page] select:disabled {
|
|
2921
|
+
cursor: not-allowed;
|
|
2922
|
+
opacity: 0.55;
|
|
2923
|
+
}
|
|
2924
|
+
`;
|
|
2925
|
+
//#endregion
|
|
2926
|
+
//#region src/client/skill-chip.tsx
|
|
2927
|
+
/** 下拉框中「未分组」选项的值。 */
|
|
2928
|
+
const UNGROUPED_VALUE = "";
|
|
2929
|
+
/**
|
|
2930
|
+
* 渲染一个技能条目。
|
|
2931
|
+
* @param props - 技能、归属、可选文件夹与移动动作。
|
|
2932
|
+
* @returns 可拖拽的条目。
|
|
2933
|
+
*/
|
|
2934
|
+
function SkillChip(props) {
|
|
2935
|
+
const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, isDragging } = (0, import_dist.useDraggable)({
|
|
2936
|
+
id: props.name,
|
|
2937
|
+
disabled: props.disabled || props.missing === true,
|
|
2938
|
+
data: { folder: props.folder }
|
|
2939
|
+
});
|
|
2940
|
+
const style = {
|
|
2941
|
+
...props.missing === true ? missingChipStyle : chipStyle,
|
|
2942
|
+
...transform === null ? {} : { transform: `translate3d(${String(transform.x)}px, ${String(transform.y)}px, 0)` },
|
|
2943
|
+
...isDragging ? {
|
|
2944
|
+
opacity: .6,
|
|
2945
|
+
zIndex: 1,
|
|
2946
|
+
position: "relative"
|
|
2947
|
+
} : {}
|
|
2948
|
+
};
|
|
2949
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2950
|
+
ref: setNodeRef,
|
|
2951
|
+
style,
|
|
2952
|
+
title: props.missing === true ? props.t("folder.missing") : props.description,
|
|
2953
|
+
"data-skill-chip": props.name,
|
|
2954
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2955
|
+
ref: setActivatorNodeRef,
|
|
2956
|
+
type: "button",
|
|
2957
|
+
style: dragHandleStyle,
|
|
2958
|
+
"data-skill-drag-handle": props.name,
|
|
2959
|
+
"aria-label": props.t("skill.drag", { name: props.name }),
|
|
2960
|
+
...listeners,
|
|
2961
|
+
...attributes,
|
|
2962
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2963
|
+
"aria-hidden": "true",
|
|
2964
|
+
style: dragIconStyle,
|
|
2965
|
+
children: "⠿"
|
|
2966
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2967
|
+
style: {
|
|
2968
|
+
...chipNameStyle,
|
|
2969
|
+
minWidth: 0
|
|
2970
|
+
},
|
|
2971
|
+
children: props.name
|
|
2972
|
+
})]
|
|
2973
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
2974
|
+
"aria-label": `${props.t("skill.move")} ${props.name}`,
|
|
2975
|
+
"data-skill-move": props.name,
|
|
2976
|
+
style: {
|
|
2977
|
+
...selectStyle,
|
|
2978
|
+
flexShrink: 0
|
|
2979
|
+
},
|
|
2980
|
+
value: props.folder ?? UNGROUPED_VALUE,
|
|
2981
|
+
disabled: props.disabled,
|
|
2982
|
+
onPointerDown: (event) => {
|
|
2983
|
+
event.stopPropagation();
|
|
2984
|
+
},
|
|
2985
|
+
onKeyDown: (event) => {
|
|
2986
|
+
event.stopPropagation();
|
|
2987
|
+
},
|
|
2988
|
+
onChange: (event) => {
|
|
2989
|
+
const value = event.target.value;
|
|
2990
|
+
props.onMove(props.name, value === UNGROUPED_VALUE ? null : value);
|
|
2991
|
+
},
|
|
2992
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2993
|
+
value: UNGROUPED_VALUE,
|
|
2994
|
+
children: props.t("skill.moveToUngrouped")
|
|
2995
|
+
}), props.folders.map((folder) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2996
|
+
value: folder,
|
|
2997
|
+
children: folder
|
|
2998
|
+
}, folder))]
|
|
2999
|
+
})]
|
|
3000
|
+
});
|
|
3001
|
+
}
|
|
3002
|
+
//#endregion
|
|
3003
|
+
//#region src/client/folder-card.tsx
|
|
3004
|
+
/** 文件夹放置区的 id:用下标,名称编辑时保持稳定。 */
|
|
3005
|
+
function folderDropId(index) {
|
|
3006
|
+
return `folder:${String(index)}`;
|
|
3007
|
+
}
|
|
3008
|
+
/** 名称错误对应的文案。 */
|
|
3009
|
+
function nameError(errors, t) {
|
|
3010
|
+
for (const error of errors) {
|
|
3011
|
+
if (error.code === "name-empty") return t("folder.nameEmpty");
|
|
3012
|
+
if (error.code === "name-too-long") return t("folder.nameTooLong", { max: String(64) });
|
|
3013
|
+
if (error.code === "name-duplicate") return t("folder.nameDuplicate");
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
/**
|
|
3017
|
+
* 渲染一个文件夹卡片。
|
|
3018
|
+
* @param props - 文件夹、技能描述、错误与编辑动作。
|
|
3019
|
+
* @returns 可放置技能的卡片。
|
|
3020
|
+
*/
|
|
3021
|
+
function FolderCard(props) {
|
|
3022
|
+
const { t, folder, index } = props;
|
|
3023
|
+
const id = (0, react.useId)();
|
|
3024
|
+
const { setNodeRef, isOver } = (0, import_dist.useDroppable)({
|
|
3025
|
+
id: folderDropId(index),
|
|
3026
|
+
disabled: props.disabled
|
|
3027
|
+
});
|
|
3028
|
+
const nameMessage = nameError(props.errors, t);
|
|
3029
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
3030
|
+
ref: setNodeRef,
|
|
3031
|
+
style: isOver ? cardActiveStyle : cardStyle,
|
|
3032
|
+
"data-folder-card": folder.name,
|
|
3033
|
+
"aria-label": folder.name,
|
|
3034
|
+
children: [
|
|
3035
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3036
|
+
style: cardHeaderStyle,
|
|
3037
|
+
children: [
|
|
3038
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3039
|
+
type: "button",
|
|
3040
|
+
style: iconButtonStyle,
|
|
3041
|
+
"aria-label": t(props.collapsed ? "folder.expand" : "folder.collapse", { name: folder.name || t("folder.name") }),
|
|
3042
|
+
"aria-expanded": !props.collapsed,
|
|
3043
|
+
"aria-controls": `${id}-members`,
|
|
3044
|
+
onClick: () => {
|
|
3045
|
+
props.onToggle(index);
|
|
3046
|
+
},
|
|
3047
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3048
|
+
"aria-hidden": "true",
|
|
3049
|
+
style: {
|
|
3050
|
+
...collapseIconStyle,
|
|
3051
|
+
transform: props.collapsed ? "rotate(-90deg)" : "rotate(0deg)"
|
|
3052
|
+
},
|
|
3053
|
+
children: "▾"
|
|
3054
|
+
})
|
|
3055
|
+
}),
|
|
3056
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3057
|
+
id: `${id}-name`,
|
|
3058
|
+
"data-folder-name-index": index,
|
|
3059
|
+
"aria-label": t("folder.name"),
|
|
3060
|
+
"aria-invalid": nameMessage === void 0 ? void 0 : true,
|
|
3061
|
+
"aria-errormessage": nameMessage === void 0 ? void 0 : `${id}-name-error`,
|
|
3062
|
+
placeholder: t("folder.namePlaceholder"),
|
|
3063
|
+
style: nameMessage === void 0 ? folderNameInputStyle : {
|
|
3064
|
+
...folderNameInputStyle,
|
|
3065
|
+
...invalidInputStyle
|
|
3066
|
+
},
|
|
3067
|
+
value: folder.name,
|
|
3068
|
+
disabled: props.disabled,
|
|
3069
|
+
onChange: (event) => {
|
|
3070
|
+
props.onRename(index, event.target.value);
|
|
3071
|
+
}
|
|
3072
|
+
}),
|
|
3073
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3074
|
+
style: cardActionsStyle,
|
|
3075
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3076
|
+
style: badgeStyle,
|
|
3077
|
+
children: props.filterActive ? t("folder.visibleMembers", {
|
|
3078
|
+
visible: String(props.visibleSkills.length),
|
|
3079
|
+
total: String(folder.skills.length)
|
|
3080
|
+
}) : t("folder.members", { count: String(folder.skills.length) })
|
|
3081
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3082
|
+
type: "button",
|
|
3083
|
+
style: textButtonStyle,
|
|
3084
|
+
disabled: props.disabled,
|
|
3085
|
+
onClick: () => {
|
|
3086
|
+
props.onRemove(index);
|
|
3087
|
+
},
|
|
3088
|
+
children: t("folder.delete")
|
|
3089
|
+
})]
|
|
3090
|
+
})
|
|
3091
|
+
]
|
|
3092
|
+
}),
|
|
3093
|
+
nameMessage === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3094
|
+
id: `${id}-name-error`,
|
|
3095
|
+
style: errorStyle,
|
|
3096
|
+
role: "alert",
|
|
3097
|
+
children: nameMessage
|
|
3098
|
+
}),
|
|
3099
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3100
|
+
"aria-label": t("folder.description"),
|
|
3101
|
+
placeholder: t("folder.descriptionPlaceholder"),
|
|
3102
|
+
style: inputStyle,
|
|
3103
|
+
value: folder.description,
|
|
3104
|
+
disabled: props.disabled,
|
|
3105
|
+
onChange: (event) => {
|
|
3106
|
+
props.onDescribe(index, event.target.value);
|
|
3107
|
+
}
|
|
3108
|
+
}),
|
|
3109
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3110
|
+
id: `${id}-members`,
|
|
3111
|
+
style: props.collapsed ? {
|
|
3112
|
+
...chipListStyle,
|
|
3113
|
+
display: "none"
|
|
3114
|
+
} : chipListStyle,
|
|
3115
|
+
"data-folder-members": folder.name,
|
|
3116
|
+
hidden: props.collapsed,
|
|
3117
|
+
children: folder.skills.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3118
|
+
style: hintStyle,
|
|
3119
|
+
children: t("folder.empty")
|
|
3120
|
+
}) : props.visibleSkills.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3121
|
+
style: hintStyle,
|
|
3122
|
+
children: t("folder.noMatches")
|
|
3123
|
+
}) : props.visibleSkills.map((skill) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SkillChip, {
|
|
3124
|
+
name: skill,
|
|
3125
|
+
description: props.descriptions.get(skill),
|
|
3126
|
+
folder: folder.name,
|
|
3127
|
+
folders: props.folderNames,
|
|
3128
|
+
missing: props.loaded && !props.descriptions.has(skill),
|
|
3129
|
+
disabled: props.disabled,
|
|
3130
|
+
t,
|
|
3131
|
+
onMove: props.onMove
|
|
3132
|
+
}, skill))
|
|
3133
|
+
})
|
|
3134
|
+
]
|
|
3135
|
+
});
|
|
3136
|
+
}
|
|
3137
|
+
//#endregion
|
|
3138
|
+
//#region src/client/folder-page.tsx
|
|
3139
|
+
/** 表单框架文案。 */
|
|
3140
|
+
function formLabels(t) {
|
|
3141
|
+
return {
|
|
3142
|
+
unavailable: t("page.unavailable"),
|
|
3143
|
+
readOnly: t("page.readOnly"),
|
|
3144
|
+
saveFailed: t("page.saveFailed"),
|
|
3145
|
+
save: t("page.save"),
|
|
3146
|
+
saving: t("page.saving")
|
|
3147
|
+
};
|
|
3148
|
+
}
|
|
3149
|
+
/** 读取全局技能列表,返回状态与重新读取函数。 */
|
|
3150
|
+
function useSkills(load) {
|
|
3151
|
+
const [state, setState] = (0, react.useState)({ status: "loading" });
|
|
3152
|
+
const [attempt, setAttempt] = (0, react.useState)(0);
|
|
3153
|
+
(0, react.useEffect)(() => {
|
|
3154
|
+
const controller = new AbortController();
|
|
3155
|
+
setState({ status: "loading" });
|
|
3156
|
+
load(controller.signal).then((payload) => {
|
|
3157
|
+
if (!controller.signal.aborted) setState({
|
|
3158
|
+
status: "ready",
|
|
3159
|
+
skills: payload.skills,
|
|
3160
|
+
complete: payload.complete
|
|
3161
|
+
});
|
|
3162
|
+
}, (error) => {
|
|
3163
|
+
if (!controller.signal.aborted) setState({
|
|
3164
|
+
status: "error",
|
|
3165
|
+
message: error instanceof Error ? error.message : String(error)
|
|
3166
|
+
});
|
|
3167
|
+
});
|
|
3168
|
+
return () => {
|
|
3169
|
+
controller.abort();
|
|
3170
|
+
};
|
|
3171
|
+
}, [load, attempt]);
|
|
3172
|
+
return {
|
|
3173
|
+
state,
|
|
3174
|
+
retry: (0, react.useCallback)(() => {
|
|
3175
|
+
setAttempt((value) => value + 1);
|
|
3176
|
+
}, [])
|
|
3177
|
+
};
|
|
3178
|
+
}
|
|
3179
|
+
/** 按名称或描述筛选技能名。 */
|
|
3180
|
+
function matchesFilter(name, description, filter) {
|
|
3181
|
+
const needle = filter.trim().toLowerCase();
|
|
3182
|
+
if (needle === "") return true;
|
|
3183
|
+
return name.toLowerCase().includes(needle) || description.toLowerCase().includes(needle);
|
|
3184
|
+
}
|
|
3185
|
+
/** 返回名称或描述匹配当前筛选词的技能,保持原顺序。 */
|
|
3186
|
+
function filterSkillNames(names, descriptions, filter) {
|
|
3187
|
+
return names.filter((name) => matchesFilter(name, descriptions.get(name) ?? "", filter));
|
|
3188
|
+
}
|
|
3189
|
+
/** 删除文件夹后调整折叠下标,让状态继续属于原文件夹。 */
|
|
3190
|
+
function collapsedAfterRemoval(collapsed, removedIndex) {
|
|
3191
|
+
const result = /* @__PURE__ */ new Set();
|
|
3192
|
+
for (const index of collapsed) {
|
|
3193
|
+
if (index === removedIndex) continue;
|
|
3194
|
+
result.add(index > removedIndex ? index - 1 : index);
|
|
3195
|
+
}
|
|
3196
|
+
return result;
|
|
3197
|
+
}
|
|
3198
|
+
/** 筛选时临时展开有匹配项的文件夹,清除后恢复原折叠状态。 */
|
|
3199
|
+
function effectiveFolderCollapsed(collapsed, filterActive, visibleCount) {
|
|
3200
|
+
return collapsed && (!filterActive || visibleCount === 0);
|
|
3201
|
+
}
|
|
3202
|
+
/** 未分组区域为空时的提示:列表未就绪时不下「全部已分组」的结论。 */
|
|
3203
|
+
function ungroupedEmptyText(status, filter, t) {
|
|
3204
|
+
if (status === "loading") return t("page.loading");
|
|
3205
|
+
if (status === "error") return t("ungrouped.unavailable");
|
|
3206
|
+
return filter.trim() === "" ? t("ungrouped.empty") : t("filter.empty");
|
|
3207
|
+
}
|
|
3208
|
+
/** 未分组区域:也是一个放置区。 */
|
|
3209
|
+
function UngroupedArea(props) {
|
|
3210
|
+
const { setNodeRef, isOver } = (0, import_dist.useDroppable)({
|
|
3211
|
+
id: UNGROUPED_ID,
|
|
3212
|
+
disabled: props.disabled
|
|
3213
|
+
});
|
|
3214
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
3215
|
+
ref: setNodeRef,
|
|
3216
|
+
style: isOver ? cardActiveStyle : cardStyle,
|
|
3217
|
+
"data-ungrouped": true,
|
|
3218
|
+
"aria-label": props.t("ungrouped.title"),
|
|
3219
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3220
|
+
style: sectionHeaderStyle,
|
|
3221
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
3222
|
+
style: sectionTitleStyle,
|
|
3223
|
+
children: props.t("ungrouped.title")
|
|
3224
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3225
|
+
style: badgeStyle,
|
|
3226
|
+
children: String(props.names.length)
|
|
3227
|
+
})]
|
|
3228
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3229
|
+
style: chipListStyle,
|
|
3230
|
+
children: props.names.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3231
|
+
style: hintStyle,
|
|
3232
|
+
children: props.emptyText
|
|
3233
|
+
}) : props.names.map((name) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SkillChip, {
|
|
3234
|
+
name,
|
|
3235
|
+
description: props.descriptions.get(name),
|
|
3236
|
+
folder: null,
|
|
3237
|
+
folders: props.folderNames,
|
|
3238
|
+
disabled: props.disabled,
|
|
3239
|
+
t: props.t,
|
|
3240
|
+
onMove: props.onMove
|
|
3241
|
+
}, name))
|
|
3242
|
+
})]
|
|
3243
|
+
});
|
|
3244
|
+
}
|
|
3245
|
+
/**
|
|
3246
|
+
* 渲染技能文件夹配置。
|
|
3247
|
+
* @param props - 视图名、已暂存的表单、技能读取,以及编辑、保存与放弃动作。
|
|
3248
|
+
* @returns `page` 渲染分组界面,`summary` 渲染一行描述。
|
|
3249
|
+
*/
|
|
3250
|
+
function FolderPage(props) {
|
|
3251
|
+
const { t } = props;
|
|
3252
|
+
const id = (0, react.useId)();
|
|
3253
|
+
const form = props.useConfigForm((value) => value);
|
|
3254
|
+
const { state: skillsState, retry } = useSkills(props.loadSkills);
|
|
3255
|
+
const [filter, setFilter] = (0, react.useState)("");
|
|
3256
|
+
const [collapsed, setCollapsed] = (0, react.useState)(/* @__PURE__ */ new Set());
|
|
3257
|
+
const [pendingFocus, setPendingFocus] = (0, react.useState)(null);
|
|
3258
|
+
const [announcement, setAnnouncement] = (0, react.useState)("");
|
|
3259
|
+
const rootRef = (0, react.useRef)(null);
|
|
3260
|
+
const filterRef = (0, react.useRef)(null);
|
|
3261
|
+
const createButtonRef = (0, react.useRef)(null);
|
|
3262
|
+
const sensors = (0, import_dist.useSensors)((0, import_dist.useSensor)(import_dist.PointerSensor, { activationConstraint: { distance: 4 } }), (0, import_dist.useSensor)(import_dist.KeyboardSensor));
|
|
3263
|
+
const folders = (0, react.useMemo)(() => {
|
|
3264
|
+
try {
|
|
3265
|
+
return coerceFolders(JSON.parse(form.folders.text === "" ? "[]" : form.folders.text));
|
|
3266
|
+
} catch {
|
|
3267
|
+
return [];
|
|
3268
|
+
}
|
|
3269
|
+
}, [form.folders.text]);
|
|
3270
|
+
const errors = (0, react.useMemo)(() => validateFolders(folders), [folders]);
|
|
3271
|
+
const skills = skillsState.status === "ready" ? skillsState.skills : [];
|
|
3272
|
+
const descriptions = (0, react.useMemo)(() => new Map(skills.map((skill) => [skill.name, skill.description])), [skills]);
|
|
3273
|
+
const folderNames = (0, react.useMemo)(() => folders.map((folder) => folder.name).filter((name) => name.trim() !== ""), [folders]);
|
|
3274
|
+
const allUngrouped = (0, react.useMemo)(() => ungroupedOf(folders, skills.map((skill) => skill.name)), [folders, skills]);
|
|
3275
|
+
const visibleFolderSkills = (0, react.useMemo)(() => folders.map((folder) => filterSkillNames(folder.skills, descriptions, filter)), [
|
|
3276
|
+
folders,
|
|
3277
|
+
descriptions,
|
|
3278
|
+
filter
|
|
3279
|
+
]);
|
|
3280
|
+
const ungrouped = (0, react.useMemo)(() => filterSkillNames(allUngrouped, descriptions, filter), [
|
|
3281
|
+
allUngrouped,
|
|
3282
|
+
descriptions,
|
|
3283
|
+
filter
|
|
3284
|
+
]);
|
|
3285
|
+
const totalCount = folders.reduce((count, folder) => count + folder.skills.length, 0) + allUngrouped.length;
|
|
3286
|
+
const visibleCount = visibleFolderSkills.reduce((count, names) => count + names.length, 0) + ungrouped.length;
|
|
3287
|
+
const filterActive = filter.trim() !== "";
|
|
3288
|
+
const { moveSkill, removeFolder } = props;
|
|
3289
|
+
const onMoveSkill = (0, react.useCallback)((skill, target) => {
|
|
3290
|
+
moveSkill(skill, target);
|
|
3291
|
+
setAnnouncement(t("skill.moved", {
|
|
3292
|
+
name: skill,
|
|
3293
|
+
folder: target ?? t("skill.moveToUngrouped")
|
|
3294
|
+
}));
|
|
3295
|
+
setPendingFocus({
|
|
3296
|
+
type: "move",
|
|
3297
|
+
skill
|
|
3298
|
+
});
|
|
3299
|
+
}, [moveSkill, t]);
|
|
3300
|
+
const onDragEnd = (0, react.useCallback)((event) => {
|
|
3301
|
+
const over = event.over?.id;
|
|
3302
|
+
if (over === void 0) return;
|
|
3303
|
+
const skill = String(event.active.id);
|
|
3304
|
+
if (over === "__ungrouped__") {
|
|
3305
|
+
onMoveSkill(skill, null);
|
|
3306
|
+
return;
|
|
3307
|
+
}
|
|
3308
|
+
const index = Number(String(over).slice(7));
|
|
3309
|
+
const target = folders[index];
|
|
3310
|
+
if (target !== void 0) onMoveSkill(skill, target.name);
|
|
3311
|
+
}, [folders, onMoveSkill]);
|
|
3312
|
+
const toggleCollapsed = (0, react.useCallback)((index) => {
|
|
3313
|
+
setCollapsed((current) => {
|
|
3314
|
+
const next = new Set(current);
|
|
3315
|
+
if (next.has(index)) next.delete(index);
|
|
3316
|
+
else next.add(index);
|
|
3317
|
+
return next;
|
|
3318
|
+
});
|
|
3319
|
+
}, []);
|
|
3320
|
+
const onRemoveFolder = (0, react.useCallback)((index) => {
|
|
3321
|
+
setCollapsed((current) => collapsedAfterRemoval(current, index));
|
|
3322
|
+
removeFolder(index);
|
|
3323
|
+
const nextIndex = Math.min(index, folders.length - 2);
|
|
3324
|
+
setPendingFocus(nextIndex >= 0 ? {
|
|
3325
|
+
type: "folder",
|
|
3326
|
+
index: nextIndex
|
|
3327
|
+
} : { type: "create" });
|
|
3328
|
+
}, [folders.length, removeFolder]);
|
|
3329
|
+
(0, react.useEffect)(() => {
|
|
3330
|
+
if (pendingFocus === null || props.view === "summary") return;
|
|
3331
|
+
let target;
|
|
3332
|
+
if (pendingFocus.type === "filter") target = filterRef.current;
|
|
3333
|
+
if (pendingFocus.type === "create") target = createButtonRef.current;
|
|
3334
|
+
if (pendingFocus.type === "folder") target = rootRef.current?.querySelector(`[data-folder-name-index="${String(pendingFocus.index)}"]`);
|
|
3335
|
+
if (pendingFocus.type === "move") target = Array.from(rootRef.current?.querySelectorAll("[data-skill-move]") ?? []).find((element) => element.dataset.skillMove === pendingFocus.skill);
|
|
3336
|
+
target?.focus();
|
|
3337
|
+
setPendingFocus(null);
|
|
3338
|
+
}, [pendingFocus, props.view]);
|
|
3339
|
+
if (props.view === "summary") return t("page.summary");
|
|
3340
|
+
const disabled = !form.writable || form.saving;
|
|
3341
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsForm, {
|
|
3342
|
+
labels: formLabels(t),
|
|
3343
|
+
state: form,
|
|
3344
|
+
onSave: props.save,
|
|
3345
|
+
onDiscard: props.discard,
|
|
3346
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3347
|
+
ref: rootRef,
|
|
3348
|
+
style: pageStyle,
|
|
3349
|
+
"data-skill-folder-page": true,
|
|
3350
|
+
children: [
|
|
3351
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
|
|
3352
|
+
"data-skill-folder-focus-styles": true,
|
|
3353
|
+
children: focusStyleText
|
|
3354
|
+
}),
|
|
3355
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3356
|
+
style: srOnlyStyle,
|
|
3357
|
+
"data-skill-folder-live": true,
|
|
3358
|
+
role: "status",
|
|
3359
|
+
"aria-live": "polite",
|
|
3360
|
+
children: announcement
|
|
3361
|
+
}),
|
|
3362
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
3363
|
+
style: pageHeaderStyle,
|
|
3364
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
3365
|
+
style: pageTitleStyle,
|
|
3366
|
+
children: t("page.title")
|
|
3367
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3368
|
+
style: pageDescriptionStyle,
|
|
3369
|
+
children: t("page.description")
|
|
3370
|
+
})]
|
|
3371
|
+
}),
|
|
3372
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3373
|
+
style: toolbarStyle,
|
|
3374
|
+
"data-skill-folder-toolbar": true,
|
|
3375
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3376
|
+
style: toolbarActionsStyle,
|
|
3377
|
+
children: [
|
|
3378
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3379
|
+
ref: createButtonRef,
|
|
3380
|
+
type: "button",
|
|
3381
|
+
style: primaryButtonStyle,
|
|
3382
|
+
disabled,
|
|
3383
|
+
onClick: () => {
|
|
3384
|
+
props.addFolder("");
|
|
3385
|
+
setPendingFocus({
|
|
3386
|
+
type: "folder",
|
|
3387
|
+
index: folders.length
|
|
3388
|
+
});
|
|
3389
|
+
},
|
|
3390
|
+
children: t("folder.create")
|
|
3391
|
+
}),
|
|
3392
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3393
|
+
type: "button",
|
|
3394
|
+
style: buttonStyle,
|
|
3395
|
+
disabled: disabled || skillsState.status !== "ready",
|
|
3396
|
+
onClick: () => {
|
|
3397
|
+
props.replaceFolders(autoGroup(folders, skills.map((skill) => skill.name), (prefix) => t("autoGroup.description", { prefix })));
|
|
3398
|
+
},
|
|
3399
|
+
children: t("autoGroup.label")
|
|
3400
|
+
}),
|
|
3401
|
+
form.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3402
|
+
type: "button",
|
|
3403
|
+
style: buttonStyle,
|
|
3404
|
+
disabled: form.saving,
|
|
3405
|
+
onClick: props.discard,
|
|
3406
|
+
children: t("page.discard")
|
|
3407
|
+
}) : null
|
|
3408
|
+
]
|
|
3409
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3410
|
+
style: filterGroupStyle,
|
|
3411
|
+
children: [
|
|
3412
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3413
|
+
ref: filterRef,
|
|
3414
|
+
type: "search",
|
|
3415
|
+
"aria-label": t("filter.label"),
|
|
3416
|
+
"aria-describedby": `${id}-filter-count`,
|
|
3417
|
+
autoComplete: "off",
|
|
3418
|
+
spellCheck: false,
|
|
3419
|
+
placeholder: t("filter.placeholder"),
|
|
3420
|
+
style: filterInputStyle,
|
|
3421
|
+
value: filter,
|
|
3422
|
+
onChange: (event) => {
|
|
3423
|
+
setFilter(event.target.value);
|
|
3424
|
+
}
|
|
3425
|
+
}),
|
|
3426
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3427
|
+
id: `${id}-filter-count`,
|
|
3428
|
+
style: badgeStyle,
|
|
3429
|
+
role: "status",
|
|
3430
|
+
"aria-live": "polite",
|
|
3431
|
+
children: filterActive ? t("filter.results", {
|
|
3432
|
+
visible: String(visibleCount),
|
|
3433
|
+
total: String(totalCount)
|
|
3434
|
+
}) : t("filter.total", { total: String(totalCount) })
|
|
3435
|
+
}),
|
|
3436
|
+
filterActive ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3437
|
+
type: "button",
|
|
3438
|
+
style: buttonStyle,
|
|
3439
|
+
onClick: () => {
|
|
3440
|
+
setFilter("");
|
|
3441
|
+
setPendingFocus({ type: "filter" });
|
|
3442
|
+
},
|
|
3443
|
+
children: t("filter.clear")
|
|
3444
|
+
}) : null
|
|
3445
|
+
]
|
|
3446
|
+
})]
|
|
3447
|
+
}),
|
|
3448
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3449
|
+
style: hintStyle,
|
|
3450
|
+
children: t("autoGroup.hint")
|
|
3451
|
+
}),
|
|
3452
|
+
skillsState.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3453
|
+
style: {
|
|
3454
|
+
...statusStyle,
|
|
3455
|
+
...hintStyle
|
|
3456
|
+
},
|
|
3457
|
+
role: "status",
|
|
3458
|
+
children: t("page.loading")
|
|
3459
|
+
}) : null,
|
|
3460
|
+
skillsState.status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
3461
|
+
style: errorStyle,
|
|
3462
|
+
role: "alert",
|
|
3463
|
+
children: [
|
|
3464
|
+
t("page.loadFailed", { message: skillsState.message }),
|
|
3465
|
+
" ",
|
|
3466
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3467
|
+
type: "button",
|
|
3468
|
+
style: buttonStyle,
|
|
3469
|
+
onClick: retry,
|
|
3470
|
+
children: t("page.retry")
|
|
3471
|
+
})
|
|
3472
|
+
]
|
|
3473
|
+
}) : null,
|
|
3474
|
+
skillsState.status === "ready" && !skillsState.complete ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
3475
|
+
style: warnStyle,
|
|
3476
|
+
role: "status",
|
|
3477
|
+
children: [t("page.incomplete"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3478
|
+
type: "button",
|
|
3479
|
+
style: buttonStyle,
|
|
3480
|
+
onClick: retry,
|
|
3481
|
+
children: t("page.retry")
|
|
3482
|
+
})]
|
|
3483
|
+
}) : null,
|
|
3484
|
+
errors.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3485
|
+
style: errorStyle,
|
|
3486
|
+
role: "alert",
|
|
3487
|
+
children: t("folder.invalid")
|
|
3488
|
+
}) : null,
|
|
3489
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(import_dist.DndContext, {
|
|
3490
|
+
sensors,
|
|
3491
|
+
onDragEnd,
|
|
3492
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
3493
|
+
style: folderSectionStyle,
|
|
3494
|
+
"aria-label": t("page.folders"),
|
|
3495
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3496
|
+
style: sectionHeaderStyle,
|
|
3497
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
3498
|
+
style: sectionTitleStyle,
|
|
3499
|
+
children: t("page.folders")
|
|
3500
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3501
|
+
style: badgeStyle,
|
|
3502
|
+
children: String(folders.length)
|
|
3503
|
+
})]
|
|
3504
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3505
|
+
style: folderGridStyle,
|
|
3506
|
+
"data-skill-folder-grid": true,
|
|
3507
|
+
children: folders.map((folder, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FolderCard, {
|
|
3508
|
+
index,
|
|
3509
|
+
folder,
|
|
3510
|
+
visibleSkills: visibleFolderSkills[index] ?? [],
|
|
3511
|
+
collapsed: effectiveFolderCollapsed(collapsed.has(index), filterActive, visibleFolderSkills[index]?.length ?? 0),
|
|
3512
|
+
filterActive,
|
|
3513
|
+
folderNames,
|
|
3514
|
+
descriptions,
|
|
3515
|
+
loaded: skillsState.status === "ready",
|
|
3516
|
+
errors: errors.filter((error) => error.index === index),
|
|
3517
|
+
disabled,
|
|
3518
|
+
t,
|
|
3519
|
+
onRename: props.renameFolder,
|
|
3520
|
+
onDescribe: props.describeFolder,
|
|
3521
|
+
onRemove: onRemoveFolder,
|
|
3522
|
+
onToggle: toggleCollapsed,
|
|
3523
|
+
onMove: onMoveSkill
|
|
3524
|
+
}, folderDropId(index)))
|
|
3525
|
+
})]
|
|
3526
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UngroupedArea, {
|
|
3527
|
+
names: ungrouped,
|
|
3528
|
+
descriptions,
|
|
3529
|
+
folderNames,
|
|
3530
|
+
disabled,
|
|
3531
|
+
emptyText: ungroupedEmptyText(skillsState.status, filter, t),
|
|
3532
|
+
t,
|
|
3533
|
+
onMove: onMoveSkill
|
|
3534
|
+
})]
|
|
3535
|
+
}),
|
|
3536
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3537
|
+
style: {
|
|
3538
|
+
...dividerStyle,
|
|
3539
|
+
paddingTop: 12
|
|
3540
|
+
},
|
|
3541
|
+
"data-skill-folder-options": true,
|
|
3542
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
3543
|
+
style: {
|
|
3544
|
+
...sectionTitleStyle,
|
|
3545
|
+
marginBottom: 10
|
|
3546
|
+
},
|
|
3547
|
+
children: t("options.title")
|
|
3548
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3549
|
+
style: optionsGridStyle,
|
|
3550
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
|
|
3551
|
+
id: `${id}-default-limit`,
|
|
3552
|
+
label: t("options.defaultLimit"),
|
|
3553
|
+
hint: t("options.defaultLimitHint"),
|
|
3554
|
+
invalidLabel: t("options.defaultLimitHint"),
|
|
3555
|
+
overriddenLabel: t("page.overridden"),
|
|
3556
|
+
resetLabel: t("page.reset"),
|
|
3557
|
+
text: form.defaultLimit.text,
|
|
3558
|
+
overridden: form.defaultLimit.overridden,
|
|
3559
|
+
invalid: form.defaultLimit.invalid,
|
|
3560
|
+
disabled,
|
|
3561
|
+
numeric: true,
|
|
3562
|
+
onEdit: (text) => {
|
|
3563
|
+
props.edit("defaultLimit", text);
|
|
3564
|
+
},
|
|
3565
|
+
onReset: () => {
|
|
3566
|
+
props.resetField("defaultLimit");
|
|
3567
|
+
}
|
|
3568
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
|
|
3569
|
+
id: `${id}-description-max`,
|
|
3570
|
+
label: t("options.descriptionMaxLength"),
|
|
3571
|
+
hint: t("options.descriptionMaxLengthHint"),
|
|
3572
|
+
invalidLabel: t("options.descriptionMaxLengthHint"),
|
|
3573
|
+
overriddenLabel: t("page.overridden"),
|
|
3574
|
+
resetLabel: t("page.reset"),
|
|
3575
|
+
text: form.descriptionMaxLength.text,
|
|
3576
|
+
overridden: form.descriptionMaxLength.overridden,
|
|
3577
|
+
invalid: form.descriptionMaxLength.invalid,
|
|
3578
|
+
disabled,
|
|
3579
|
+
numeric: true,
|
|
3580
|
+
onEdit: (text) => {
|
|
3581
|
+
props.edit("descriptionMaxLength", text);
|
|
3582
|
+
},
|
|
3583
|
+
onReset: () => {
|
|
3584
|
+
props.resetField("descriptionMaxLength");
|
|
3585
|
+
}
|
|
3586
|
+
})]
|
|
3587
|
+
})]
|
|
3588
|
+
})
|
|
3589
|
+
]
|
|
3590
|
+
})
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
//#endregion
|
|
3594
|
+
//#region src/client/locales.ts
|
|
3595
|
+
/**
|
|
3596
|
+
* 前端字典与命名空间。
|
|
3597
|
+
* 导出 NS、FolderKey、zh、en;中文字典是键集事实源。
|
|
3598
|
+
*/
|
|
3599
|
+
/** 前端使用的字典命名空间,与插件名一致。 */
|
|
3600
|
+
const NS = PLUGIN_ID;
|
|
3601
|
+
/** 中文字典。 */
|
|
3602
|
+
const zh = {
|
|
3603
|
+
"page.summary": "把全局技能归入文件夹,模型目录只显示文件夹摘要",
|
|
3604
|
+
"page.title": "技能文件夹",
|
|
3605
|
+
"page.description": "按用途整理全局技能,让模型目录更简洁。所有修改在保存后生效。",
|
|
3606
|
+
"page.folders": "文件夹",
|
|
3607
|
+
"page.loading": "正在读取技能…",
|
|
3608
|
+
"page.loadFailed": "读取技能失败:{message}",
|
|
3609
|
+
"page.incomplete": "技能列表可能不完整,稍后重试读取。",
|
|
3610
|
+
"page.retry": "重新读取",
|
|
3611
|
+
"page.unavailable": "技能文件夹配置不可用。",
|
|
3612
|
+
"page.readOnly": "此部署以只读方式保存设置。",
|
|
3613
|
+
"page.saveFailed": "此部署未接受这些值,已保留以便修改。",
|
|
3614
|
+
"page.save": "保存",
|
|
3615
|
+
"page.saving": "保存中…",
|
|
3616
|
+
"page.discard": "放弃修改",
|
|
3617
|
+
"page.overridden": "已覆盖",
|
|
3618
|
+
"page.reset": "恢复默认",
|
|
3619
|
+
"folder.create": "新建文件夹",
|
|
3620
|
+
"folder.name": "文件夹名称",
|
|
3621
|
+
"folder.namePlaceholder": "例如 lark",
|
|
3622
|
+
"folder.description": "简介",
|
|
3623
|
+
"folder.descriptionPlaceholder": "这个文件夹里的技能用来做什么",
|
|
3624
|
+
"folder.delete": "删除文件夹",
|
|
3625
|
+
"folder.members": "{count} 个技能",
|
|
3626
|
+
"folder.visibleMembers": "显示 {visible} / {total}",
|
|
3627
|
+
"folder.collapse": "折叠 {name}",
|
|
3628
|
+
"folder.expand": "展开 {name}",
|
|
3629
|
+
"folder.empty": "把技能拖到这里",
|
|
3630
|
+
"folder.noMatches": "此文件夹没有匹配的技能。",
|
|
3631
|
+
"folder.missing": "未找到",
|
|
3632
|
+
"folder.removeMember": "移出文件夹",
|
|
3633
|
+
"folder.nameEmpty": "文件夹名称不能为空。",
|
|
3634
|
+
"folder.nameTooLong": "文件夹名称最多 {max} 个字符。",
|
|
3635
|
+
"folder.nameDuplicate": "已有同名文件夹。",
|
|
3636
|
+
"folder.invalid": "文件夹配置有误,修正后才能保存。",
|
|
3637
|
+
"ungrouped.title": "未分组的技能",
|
|
3638
|
+
"ungrouped.empty": "全部技能都已分组。",
|
|
3639
|
+
"ungrouped.unavailable": "技能列表读取失败,暂时无法显示未分组的技能。",
|
|
3640
|
+
"ungrouped.drop": "拖到这里移出文件夹",
|
|
3641
|
+
"skill.move": "移动到",
|
|
3642
|
+
"skill.moveToUngrouped": "未分组",
|
|
3643
|
+
"skill.drag": "拖拽 {name}",
|
|
3644
|
+
"skill.moved": "已将 {name} 移动到 {folder}",
|
|
3645
|
+
"autoGroup.label": "按前缀自动分组",
|
|
3646
|
+
"autoGroup.hint": "先按文件夹名匹配,其余按 - 分段最长公共前缀合并,成员不少于 2 个才成组。",
|
|
3647
|
+
"autoGroup.description": "{prefix} 系列技能",
|
|
3648
|
+
"filter.label": "筛选技能",
|
|
3649
|
+
"filter.placeholder": "按名称或描述筛选",
|
|
3650
|
+
"filter.clear": "清除筛选",
|
|
3651
|
+
"filter.total": "共 {total} 个技能",
|
|
3652
|
+
"filter.results": "匹配 {visible} / {total}",
|
|
3653
|
+
"filter.empty": "没有匹配的技能。",
|
|
3654
|
+
"options.title": "搜索选项",
|
|
3655
|
+
"options.defaultLimit": "默认返回数量",
|
|
3656
|
+
"options.defaultLimitHint": "1–20,模型未指定数量时使用。",
|
|
3657
|
+
"options.descriptionMaxLength": "摘要长度上限",
|
|
3658
|
+
"options.descriptionMaxLengthHint": "40–2000 字符,超出部分用省略号截断。"
|
|
3659
|
+
};
|
|
3660
|
+
/** 英文字典,键集与中文一致。 */
|
|
3661
|
+
const en = {
|
|
3662
|
+
"page.summary": "Group global skills into folders so the model catalog lists folder summaries",
|
|
3663
|
+
"page.title": "Skill folders",
|
|
3664
|
+
"page.description": "Organize global skills by purpose to keep the model catalog concise. Changes apply after you save.",
|
|
3665
|
+
"page.folders": "Folders",
|
|
3666
|
+
"page.loading": "Loading skills…",
|
|
3667
|
+
"page.loadFailed": "Could not load skills: {message}",
|
|
3668
|
+
"page.incomplete": "The skill list may be incomplete; reload to retry.",
|
|
3669
|
+
"page.retry": "Reload",
|
|
3670
|
+
"page.unavailable": "Skill folder settings are unavailable.",
|
|
3671
|
+
"page.readOnly": "This deployment stores settings read-only.",
|
|
3672
|
+
"page.saveFailed": "The deployment did not accept these values; they were left for you to correct.",
|
|
3673
|
+
"page.save": "Save",
|
|
3674
|
+
"page.saving": "Saving…",
|
|
3675
|
+
"page.discard": "Discard changes",
|
|
3676
|
+
"page.overridden": "Overridden",
|
|
3677
|
+
"page.reset": "Restore default",
|
|
3678
|
+
"folder.create": "New folder",
|
|
3679
|
+
"folder.name": "Folder name",
|
|
3680
|
+
"folder.namePlaceholder": "for example lark",
|
|
3681
|
+
"folder.description": "Description",
|
|
3682
|
+
"folder.descriptionPlaceholder": "What the skills in this folder are for",
|
|
3683
|
+
"folder.delete": "Delete folder",
|
|
3684
|
+
"folder.members": "{count} skills",
|
|
3685
|
+
"folder.visibleMembers": "Showing {visible} / {total}",
|
|
3686
|
+
"folder.collapse": "Collapse {name}",
|
|
3687
|
+
"folder.expand": "Expand {name}",
|
|
3688
|
+
"folder.empty": "Drop skills here",
|
|
3689
|
+
"folder.noMatches": "No skills in this folder match the filter.",
|
|
3690
|
+
"folder.missing": "Not found",
|
|
3691
|
+
"folder.removeMember": "Remove from folder",
|
|
3692
|
+
"folder.nameEmpty": "A folder name is required.",
|
|
3693
|
+
"folder.nameTooLong": "A folder name holds at most {max} characters.",
|
|
3694
|
+
"folder.nameDuplicate": "Another folder already uses this name.",
|
|
3695
|
+
"folder.invalid": "Fix the folder settings before saving.",
|
|
3696
|
+
"ungrouped.title": "Ungrouped skills",
|
|
3697
|
+
"ungrouped.empty": "Every skill is grouped.",
|
|
3698
|
+
"ungrouped.unavailable": "The skill list could not be loaded, so ungrouped skills cannot be shown.",
|
|
3699
|
+
"ungrouped.drop": "Drop here to remove from a folder",
|
|
3700
|
+
"skill.move": "Move to",
|
|
3701
|
+
"skill.moveToUngrouped": "Ungrouped",
|
|
3702
|
+
"skill.drag": "Drag {name}",
|
|
3703
|
+
"skill.moved": "Moved {name} to {folder}",
|
|
3704
|
+
"autoGroup.label": "Group by prefix",
|
|
3705
|
+
"autoGroup.hint": "Matches folder names first, then merges the rest by their longest shared - segment prefix; a group needs at least 2 members.",
|
|
3706
|
+
"autoGroup.description": "Skills in the {prefix} family",
|
|
3707
|
+
"filter.label": "Filter skills",
|
|
3708
|
+
"filter.placeholder": "Filter by name or description",
|
|
3709
|
+
"filter.clear": "Clear filter",
|
|
3710
|
+
"filter.total": "{total} skills",
|
|
3711
|
+
"filter.results": "{visible} / {total} matches",
|
|
3712
|
+
"filter.empty": "No skill matches this filter.",
|
|
3713
|
+
"options.title": "Search options",
|
|
3714
|
+
"options.defaultLimit": "Default result count",
|
|
3715
|
+
"options.defaultLimitHint": "1–20, used when the model omits a count.",
|
|
3716
|
+
"options.descriptionMaxLength": "Summary length limit",
|
|
3717
|
+
"options.descriptionMaxLengthHint": "40–2000 characters; longer text is cut with an ellipsis."
|
|
3718
|
+
};
|
|
3719
|
+
//#endregion
|
|
3720
|
+
//#region src/client/index.ts
|
|
3721
|
+
/**
|
|
3722
|
+
* 插件在前端启用时调用。
|
|
3723
|
+
* 每个功能用 `ctx.inject` 只等待自己用到的服务:服务缺失时该功能不加载,就绪后加载,撤掉后卸载。
|
|
3724
|
+
*/
|
|
3725
|
+
function apply(ctx) {
|
|
3726
|
+
ctx.inject(["locale"], (ctx) => {
|
|
3727
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
3728
|
+
zh,
|
|
3729
|
+
en
|
|
3730
|
+
}), "skill-folder: dictionaries");
|
|
3731
|
+
});
|
|
3732
|
+
ctx.inject([
|
|
3733
|
+
"slots",
|
|
3734
|
+
"locale",
|
|
3735
|
+
"configForms"
|
|
3736
|
+
], (ctx) => {
|
|
3737
|
+
const form = new FolderForm(ctx.configForms.get(ROW_ID));
|
|
3738
|
+
ctx.effect(() => () => {
|
|
3739
|
+
form.dispose();
|
|
3740
|
+
}, "skill-folder: config form");
|
|
3741
|
+
ctx.slots.inject("plugins.row.config", () => ctx.slots.register({
|
|
3742
|
+
name: "plugins.row.config",
|
|
3743
|
+
key: ROW_KEY,
|
|
3744
|
+
locale: NS,
|
|
3745
|
+
inject: () => ({
|
|
3746
|
+
...form.inject(),
|
|
3747
|
+
loadSkills: fetchSkills
|
|
3748
|
+
})
|
|
3749
|
+
}, FolderPage));
|
|
3750
|
+
});
|
|
3751
|
+
}
|
|
3752
|
+
//#endregion
|
|
3753
|
+
exports.apply = apply;
|
|
3754
|
+
return module.exports;
|
|
3755
|
+
}
|
|
3756
|
+
});
|