@nestim/koishi-plugin-qqgm-webui 0.2.20 → 0.2.22
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/index.js +1 -1
- package/lib/main-schema.js +1 -1
- package/package.json +1 -1
- package/public/app.js +11 -13
- package/public/index.html +6 -3
package/index.js
CHANGED
package/lib/main-schema.js
CHANGED
|
@@ -19,7 +19,7 @@ function loadMainPlugin() {
|
|
|
19
19
|
|
|
20
20
|
function humanLabel(key, description) {
|
|
21
21
|
const text = String(description || '').replace(/\s+/g, ' ').trim();
|
|
22
|
-
const first = text.split(/[::((]/)[0].trim();
|
|
22
|
+
const first = text.split(/[::((,,。;;]/)[0].trim();
|
|
23
23
|
if (first && first.length >= 2 && first.length <= 28) return first;
|
|
24
24
|
return key;
|
|
25
25
|
}
|
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -37,7 +37,11 @@ function go(page) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
$$('.nav-item').forEach((item) => item.addEventListener('click', () => go(item.dataset.page)));
|
|
40
|
-
$$('.nav-sub').forEach((item) => item.addEventListener('click', () =>
|
|
40
|
+
$$('.nav-sub').forEach((item) => item.addEventListener('click', () => {
|
|
41
|
+
const page = item.dataset.page;
|
|
42
|
+
go(page);
|
|
43
|
+
if (page === 'main-schema' && mainSchema) openMainGroup(activeMainGroup || 0);
|
|
44
|
+
}));
|
|
41
45
|
$$('[data-nav]').forEach((item) => item.addEventListener('click', (event) => {
|
|
42
46
|
event.preventDefault();
|
|
43
47
|
go(item.dataset.nav);
|
|
@@ -330,8 +334,6 @@ function tokenQuery() {
|
|
|
330
334
|
}
|
|
331
335
|
|
|
332
336
|
function openMainGroup(index) {
|
|
333
|
-
if (!mainSchema || !mainSchema.groups[index]) return;
|
|
334
|
-
go('main-schema');
|
|
335
337
|
renderMainGroup(index);
|
|
336
338
|
}
|
|
337
339
|
|
|
@@ -341,12 +343,7 @@ function renderMainGroup(index) {
|
|
|
341
343
|
const group = mainSchema.groups[index];
|
|
342
344
|
const form = $('#mainSchemaForm');
|
|
343
345
|
if (!form) return;
|
|
344
|
-
|
|
345
|
-
const subtitle = $('#mainSchemaSubtitle');
|
|
346
|
-
if (title) title.textContent = group.title;
|
|
347
|
-
if (subtitle) subtitle.textContent = `主插件 · ${group.fields.length} 项 · 来自 Schema`;
|
|
348
|
-
$('#pageTitle').textContent = group.title;
|
|
349
|
-
$$('#mainSchemaSubnav .nav-sub').forEach((btn, i) => btn.classList.toggle('active', i === index));
|
|
346
|
+
$$('#mainSchemaNav .config-plugin').forEach((btn, i) => btn.classList.toggle('active', i === index));
|
|
350
347
|
form.innerHTML = `<div class="form-head"><div><h2>${group.title}</h2><p>${group.fields.length} 个字段 · 与 Koishi 配置页同源</p></div><span class="status ok">运行中</span></div>`
|
|
351
348
|
+ group.fields.map((field) => {
|
|
352
349
|
const value = mainSchema.values[field.key] ?? field.default;
|
|
@@ -421,10 +418,11 @@ async function initMainSchema() {
|
|
|
421
418
|
$('#mainSchemaForm').innerHTML = '<div class="schema-loading">未找到主插件 Config Schema</div>';
|
|
422
419
|
return;
|
|
423
420
|
}
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
426
|
-
|
|
427
|
-
|
|
421
|
+
const nav = $('#mainSchemaNav');
|
|
422
|
+
if (nav) {
|
|
423
|
+
nav.innerHTML = '<div class="config-group-label">配置分组</div>'
|
|
424
|
+
+ mainSchema.groups.map((group, index) => `<button class="config-plugin ${index === 0 ? 'active' : ''}" data-main-group="${index}"><span class="plugin-ico slate">${index + 1}</span><div><b>${group.title}</b><small>${group.fields.length} 项</small></div></button>`).join('');
|
|
425
|
+
$$('#mainSchemaNav .config-plugin').forEach((btn) => btn.addEventListener('click', () => openMainGroup(Number(btn.dataset.mainGroup))));
|
|
428
426
|
}
|
|
429
427
|
const params = new URLSearchParams(location.search);
|
|
430
428
|
const groupParam = Number(params.get('group'));
|
package/public/index.html
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<span class="nav-badge">128</span>
|
|
38
38
|
</button>
|
|
39
39
|
<div class="nav-section">主插件</div>
|
|
40
|
-
<
|
|
40
|
+
<button class="nav-sub" data-page="main-schema">主插件配置</button>
|
|
41
41
|
<button class="nav-item" data-page="config">
|
|
42
42
|
<svg viewBox="0 0 24 24"><path d="M12 15.5A3.5 3.5 0 1 0 12 8.5a3.5 3.5 0 0 0 0 7Zm8-3.5c0-.6-.06-1.16-.18-1.7l2.02-1.58-2-3.46-2.38.96a8.2 8.2 0 0 0-2.94-1.7L14.2 2h-4.4l-.32 2.52a8.2 8.2 0 0 0-2.94 1.7L4.16 5.26l-2 3.46 2.02 1.58A8.6 8.6 0 0 0 4 12c0 .6.06 1.16.18 1.7l-2.02 1.58 2 3.46 2.38-.96a8.2 8.2 0 0 0 2.94 1.7L9.8 22h4.4l.32-2.52a8.2 8.2 0 0 0 2.94-1.7l2.38.96 2-3.46-2.02-1.58c.12-.54.18-1.1.18-1.7Z"/></svg>
|
|
43
43
|
<span>附属配置</span>
|
|
@@ -350,8 +350,11 @@
|
|
|
350
350
|
</section>
|
|
351
351
|
|
|
352
352
|
<section class="page" id="page-main-schema">
|
|
353
|
-
<div class="page-head"><div><h1
|
|
354
|
-
<div class="
|
|
353
|
+
<div class="page-head"><div><h1>主插件配置</h1><p>按主插件 Schema 分组,左侧选组、右侧配置;和附属配置同一套布局</p></div><button class="btn primary" id="saveMainSchemaGroup">保存本组</button></div>
|
|
354
|
+
<div class="config-layout">
|
|
355
|
+
<aside class="card config-nav" id="mainSchemaNav"><div class="schema-loading">读取 Schema…</div></aside>
|
|
356
|
+
<div class="card config-form" id="mainSchemaForm"><div class="schema-loading">读取配置…</div></div>
|
|
357
|
+
</div>
|
|
355
358
|
</section>
|
|
356
359
|
|
|
357
360
|
<section class="page" id="page-config">
|