koishi-plugin-chatluna-toolbox 0.0.20 → 0.0.21
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/dist/index.js +101 -97
- package/lib/index.js +4 -11
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { openBlock as y, createElementBlock as
|
|
2
|
-
const
|
|
3
|
-
const r =
|
|
4
|
-
for (const [c, t] of
|
|
1
|
+
import { openBlock as y, createElementBlock as k, createElementVNode as _, defineComponent as b, Fragment as E, renderList as N, normalizeClass as v, toDisplayString as z, reactive as I, computed as f, onUnmounted as L, ref as T, onMounted as B, normalizeStyle as A, createVNode as x, withModifiers as D, unref as $, inject as K, createBlock as X, createCommentVNode as O } from "vue";
|
|
2
|
+
const S = (n, e) => {
|
|
3
|
+
const r = n.__vccOpts || n;
|
|
4
|
+
for (const [c, t] of e)
|
|
5
5
|
r[c] = t;
|
|
6
6
|
return r;
|
|
7
7
|
}, V = {}, Y = {
|
|
@@ -10,40 +10,40 @@ const M = (s, o) => {
|
|
|
10
10
|
width: "20",
|
|
11
11
|
height: "20"
|
|
12
12
|
};
|
|
13
|
-
function q(
|
|
14
|
-
return y(),
|
|
15
|
-
|
|
13
|
+
function q(n, e) {
|
|
14
|
+
return y(), k("svg", Y, [...e[0] || (e[0] = [
|
|
15
|
+
_("path", {
|
|
16
16
|
d: "M288 224c0-35.3 28.7-64 64-64s64 28.7 64 64-28.7 64-64 64-64-28.7-64-64zm320 0c0-35.3 28.7-64 64-64s64 28.7 64 64-28.7 64-64 64-64-28.7-64-64zM288 512c0-35.3 28.7-64 64-64s64 28.7 64 64-28.7 64-64 64-64-28.7-64-64zm320 0c0-35.3 28.7-64 64-64s64 28.7 64 64-28.7 64-64 64-64-28.7-64-64zM352 864c-35.3 0-64-28.7-64-64s28.7-64 64-64 64 28.7 64 64-28.7 64-64 64zm320 0c-35.3 0-64-28.7-64-64s28.7-64 64-64 64 28.7 64 64-28.7 64-64 64z",
|
|
17
17
|
fill: "currentColor"
|
|
18
18
|
}, null, -1)
|
|
19
19
|
])]);
|
|
20
20
|
}
|
|
21
|
-
const P = /* @__PURE__ */
|
|
21
|
+
const P = /* @__PURE__ */ S(V, [["render", q]]), W = {}, j = {
|
|
22
22
|
viewBox: "0 0 1024 1024",
|
|
23
23
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24
24
|
width: "20",
|
|
25
25
|
height: "20"
|
|
26
26
|
};
|
|
27
|
-
function U(
|
|
28
|
-
return y(),
|
|
29
|
-
|
|
27
|
+
function U(n, e) {
|
|
28
|
+
return y(), k("svg", j, [...e[0] || (e[0] = [
|
|
29
|
+
_("path", {
|
|
30
30
|
d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z",
|
|
31
31
|
fill: "currentColor"
|
|
32
32
|
}, null, -1)
|
|
33
33
|
])]);
|
|
34
34
|
}
|
|
35
|
-
const F = /* @__PURE__ */
|
|
35
|
+
const F = /* @__PURE__ */ S(W, [["render", U]]), G = ["onClick"], H = /* @__PURE__ */ b({
|
|
36
36
|
__name: "NavSection",
|
|
37
37
|
props: {
|
|
38
38
|
sections: {},
|
|
39
39
|
activeKey: {}
|
|
40
40
|
},
|
|
41
41
|
emits: ["select"],
|
|
42
|
-
setup(
|
|
43
|
-
return (
|
|
42
|
+
setup(n) {
|
|
43
|
+
return (e, r) => (y(!0), k(E, null, N(n.sections, (c) => (y(), k("div", {
|
|
44
44
|
key: c.key,
|
|
45
|
-
class:
|
|
46
|
-
onClick: (t) =>
|
|
45
|
+
class: v([e.$style.item, n.activeKey === c.key ? e.$style.active : ""]),
|
|
46
|
+
onClick: (t) => e.$emit("select", c)
|
|
47
47
|
}, z(c.title), 11, G))), 128));
|
|
48
48
|
}
|
|
49
49
|
}), J = "_item_1m2kp_1", Q = "_active_1m2kp_16", Z = {
|
|
@@ -51,24 +51,24 @@ const F = /* @__PURE__ */ M(W, [["render", U]]), G = ["onClick"], H = /* @__PURE
|
|
|
51
51
|
active: Q
|
|
52
52
|
}, tt = {
|
|
53
53
|
$style: Z
|
|
54
|
-
}, et = /* @__PURE__ */
|
|
55
|
-
function R(
|
|
56
|
-
return
|
|
57
|
-
x:
|
|
58
|
-
y:
|
|
54
|
+
}, et = /* @__PURE__ */ S(H, [["__cssModules", tt]]);
|
|
55
|
+
function R(n) {
|
|
56
|
+
return n instanceof TouchEvent ? {
|
|
57
|
+
x: n.touches[0].clientX,
|
|
58
|
+
y: n.touches[0].clientY
|
|
59
59
|
} : {
|
|
60
|
-
x:
|
|
61
|
-
y:
|
|
60
|
+
x: n.clientX,
|
|
61
|
+
y: n.clientY
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function ot(
|
|
64
|
+
function ot(n = {}) {
|
|
65
65
|
const {
|
|
66
|
-
initialTop:
|
|
66
|
+
initialTop: e = 100,
|
|
67
67
|
initialRight: r = 20,
|
|
68
68
|
boundarySelector: c = ".plugin-view"
|
|
69
|
-
} =
|
|
69
|
+
} = n, t = I({
|
|
70
70
|
isDragging: !1,
|
|
71
|
-
top:
|
|
71
|
+
top: e,
|
|
72
72
|
right: r,
|
|
73
73
|
startTop: 0,
|
|
74
74
|
startRight: 0,
|
|
@@ -79,16 +79,16 @@ function ot(s = {}) {
|
|
|
79
79
|
}), g = f(() => ({
|
|
80
80
|
top: `${t.top}px`,
|
|
81
81
|
right: `${t.right}px`
|
|
82
|
-
})), i = (
|
|
82
|
+
})), i = (h) => {
|
|
83
83
|
var C;
|
|
84
84
|
if (!t.isDragging)
|
|
85
85
|
return;
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
}, p = (
|
|
90
|
-
const l = R(
|
|
91
|
-
|
|
86
|
+
const d = R(h), l = t.startTop + (d.y - t.startY), a = t.startRight - (d.x - t.startX), o = (C = document.querySelector(c)) == null ? void 0 : C.getBoundingClientRect();
|
|
87
|
+
let s = 0, m = window.innerHeight - t.height, w = 0, M = window.innerWidth - t.width;
|
|
88
|
+
o && (s = o.top, m = o.bottom - t.height, w = window.innerWidth - o.right, M = window.innerWidth - o.left - t.width), t.top = Math.max(s, Math.min(m, l)), t.right = Math.max(w, Math.min(M, a));
|
|
89
|
+
}, p = (h, d) => {
|
|
90
|
+
const l = R(h), a = d == null ? void 0 : d.getBoundingClientRect();
|
|
91
|
+
a && (t.width = a.width, t.height = a.height), t.startTop = t.top, t.startRight = t.right, t.startX = l.x, t.startY = l.y, t.isDragging = !0;
|
|
92
92
|
}, u = () => {
|
|
93
93
|
t.isDragging = !1;
|
|
94
94
|
};
|
|
@@ -99,22 +99,22 @@ function ot(s = {}) {
|
|
|
99
99
|
startDrag: p
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function nt(
|
|
102
|
+
function nt(n) {
|
|
103
103
|
const {
|
|
104
|
-
titleToKeyMap:
|
|
104
|
+
titleToKeyMap: e,
|
|
105
105
|
headerSelector: r = ".k-schema-header",
|
|
106
106
|
rootMargin: c = "-20% 0px -60% 0px",
|
|
107
107
|
threshold: t = 0
|
|
108
|
-
} =
|
|
108
|
+
} = n, g = T("");
|
|
109
109
|
let i = null;
|
|
110
110
|
const p = /* @__PURE__ */ new Map(), u = () => {
|
|
111
111
|
i == null || i.disconnect(), p.clear(), i = new IntersectionObserver(
|
|
112
112
|
(l) => {
|
|
113
|
-
for (const
|
|
114
|
-
if (!
|
|
113
|
+
for (const a of l) {
|
|
114
|
+
if (!a.isIntersecting)
|
|
115
115
|
continue;
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
const o = p.get(a.target);
|
|
117
|
+
o && (g.value = o);
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
{
|
|
@@ -123,21 +123,21 @@ function nt(s) {
|
|
|
123
123
|
threshold: t
|
|
124
124
|
}
|
|
125
125
|
), document.querySelectorAll(r).forEach((l) => {
|
|
126
|
-
const
|
|
127
|
-
for (const [
|
|
128
|
-
if (
|
|
129
|
-
i == null || i.observe(l), p.set(l,
|
|
126
|
+
const a = l.textContent || "";
|
|
127
|
+
for (const [o, s] of Object.entries(e))
|
|
128
|
+
if (a.includes(o)) {
|
|
129
|
+
i == null || i.observe(l), p.set(l, s);
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
-
},
|
|
133
|
+
}, h = () => {
|
|
134
134
|
setTimeout(u, 500);
|
|
135
135
|
};
|
|
136
|
-
return B(
|
|
136
|
+
return B(h), L(() => {
|
|
137
137
|
i == null || i.disconnect();
|
|
138
138
|
}), {
|
|
139
139
|
activeSection: g,
|
|
140
|
-
refresh:
|
|
140
|
+
refresh: h
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
const st = /* @__PURE__ */ b({
|
|
@@ -148,76 +148,80 @@ const st = /* @__PURE__ */ b({
|
|
|
148
148
|
boundarySelector: { default: ".plugin-view" },
|
|
149
149
|
initialTop: { default: 100 },
|
|
150
150
|
initialRight: { default: 20 },
|
|
151
|
+
width: {},
|
|
151
152
|
rootMargin: { default: "-20% 0px -60% 0px" },
|
|
152
153
|
threshold: { default: 0 }
|
|
153
154
|
},
|
|
154
|
-
setup(
|
|
155
|
-
const
|
|
156
|
-
() =>
|
|
157
|
-
(
|
|
155
|
+
setup(n) {
|
|
156
|
+
const e = n, r = T(!1), c = T(null), t = f(
|
|
157
|
+
() => e.sections.reduce(
|
|
158
|
+
(o, s) => (o[s.matchText ?? s.title] = s.key, o),
|
|
158
159
|
{}
|
|
159
160
|
)
|
|
160
161
|
), g = f(
|
|
161
|
-
() =>
|
|
162
|
-
(
|
|
162
|
+
() => e.sections.reduce(
|
|
163
|
+
(o, s) => (o[s.key] = s.matchText ?? s.title, o),
|
|
163
164
|
{}
|
|
164
165
|
)
|
|
165
|
-
), i = (
|
|
166
|
-
|
|
166
|
+
), i = (o) => {
|
|
167
|
+
o.stopPropagation(), r.value = !r.value;
|
|
167
168
|
}, { position: p, startDrag: u } = ot({
|
|
168
|
-
initialTop:
|
|
169
|
-
initialRight:
|
|
170
|
-
boundarySelector:
|
|
171
|
-
}),
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
initialTop: e.initialTop,
|
|
170
|
+
initialRight: e.initialRight,
|
|
171
|
+
boundarySelector: e.boundarySelector
|
|
172
|
+
}), h = f(() => ({
|
|
173
|
+
...p.value,
|
|
174
|
+
...e.width ? { width: `${e.width}px` } : {}
|
|
175
|
+
})), d = (o) => {
|
|
176
|
+
u(o, c.value);
|
|
177
|
+
}, { activeSection: l } = nt({
|
|
174
178
|
titleToKeyMap: t.value,
|
|
175
|
-
headerSelector:
|
|
176
|
-
rootMargin:
|
|
177
|
-
threshold:
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
for (let
|
|
182
|
-
const
|
|
183
|
-
if ((
|
|
184
|
-
|
|
179
|
+
headerSelector: e.headerSelector,
|
|
180
|
+
rootMargin: e.rootMargin,
|
|
181
|
+
threshold: e.threshold
|
|
182
|
+
}), a = (o) => {
|
|
183
|
+
l.value = o.key;
|
|
184
|
+
const s = document.querySelectorAll(e.headerSelector);
|
|
185
|
+
for (let m = 0; m < s.length; m += 1) {
|
|
186
|
+
const w = s[m];
|
|
187
|
+
if ((w.textContent || "").includes(g.value[o.key])) {
|
|
188
|
+
w.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
185
189
|
return;
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
192
|
};
|
|
189
|
-
return (
|
|
193
|
+
return (o, s) => (y(), k("div", {
|
|
190
194
|
ref_key: "containerRef",
|
|
191
195
|
ref: c,
|
|
192
|
-
class:
|
|
193
|
-
style: A(
|
|
196
|
+
class: v([o.$style.container, r.value ? o.$style.collapsed : ""]),
|
|
197
|
+
style: A(h.value)
|
|
194
198
|
}, [
|
|
195
|
-
|
|
196
|
-
class:
|
|
199
|
+
_("div", {
|
|
200
|
+
class: v(o.$style.header),
|
|
197
201
|
onMousedown: d,
|
|
198
202
|
onTouchstart: d
|
|
199
203
|
}, [
|
|
200
204
|
x(P, {
|
|
201
|
-
class:
|
|
205
|
+
class: v(o.$style.move)
|
|
202
206
|
}, null, 8, ["class"]),
|
|
203
|
-
|
|
204
|
-
class:
|
|
207
|
+
_("div", {
|
|
208
|
+
class: v(o.$style.toggle),
|
|
205
209
|
onClick: i,
|
|
206
|
-
onMousedown:
|
|
210
|
+
onMousedown: s[0] || (s[0] = D(() => {
|
|
207
211
|
}, ["stop"])),
|
|
208
|
-
onTouchstart:
|
|
212
|
+
onTouchstart: s[1] || (s[1] = D(() => {
|
|
209
213
|
}, ["stop"]))
|
|
210
214
|
}, [
|
|
211
215
|
x(F)
|
|
212
216
|
], 34)
|
|
213
217
|
], 34),
|
|
214
|
-
|
|
215
|
-
class:
|
|
218
|
+
_("div", {
|
|
219
|
+
class: v(o.$style.body)
|
|
216
220
|
}, [
|
|
217
221
|
x(et, {
|
|
218
|
-
sections:
|
|
219
|
-
"active-key":
|
|
220
|
-
onSelect:
|
|
222
|
+
sections: n.sections,
|
|
223
|
+
"active-key": $(l),
|
|
224
|
+
onSelect: a
|
|
221
225
|
}, null, 8, ["sections", "active-key"])
|
|
222
226
|
], 2)
|
|
223
227
|
], 6));
|
|
@@ -231,7 +235,7 @@ const st = /* @__PURE__ */ b({
|
|
|
231
235
|
collapsed: dt
|
|
232
236
|
}, ht = {
|
|
233
237
|
$style: ut
|
|
234
|
-
}, gt = /* @__PURE__ */
|
|
238
|
+
}, gt = /* @__PURE__ */ S(st, [["__cssModules", ht]]), pt = [
|
|
235
239
|
{ title: "基础设置", key: "basic" },
|
|
236
240
|
{ title: "原生工具", key: "nativeTools" },
|
|
237
241
|
{ title: "Character XML 工具", key: "xmlTools" },
|
|
@@ -240,22 +244,22 @@ const st = /* @__PURE__ */ b({
|
|
|
240
244
|
], mt = [
|
|
241
245
|
"chatluna-toolbox",
|
|
242
246
|
"koishi-plugin-chatluna-toolbox"
|
|
243
|
-
],
|
|
247
|
+
], vt = /* @__PURE__ */ b({
|
|
244
248
|
__name: "ToolboxDetailsLoader",
|
|
245
|
-
setup(
|
|
246
|
-
const
|
|
247
|
-
const t = (
|
|
249
|
+
setup(n) {
|
|
250
|
+
const e = K("plugin:name"), r = pt, c = f(() => {
|
|
251
|
+
const t = (e == null ? void 0 : e.value) || "";
|
|
248
252
|
return mt.includes(t);
|
|
249
253
|
});
|
|
250
|
-
return (t, g) => c.value ? (y(), X(
|
|
254
|
+
return (t, g) => c.value ? (y(), X($(gt), {
|
|
251
255
|
key: 0,
|
|
252
|
-
sections:
|
|
256
|
+
sections: $(r)
|
|
253
257
|
}, null, 8, ["sections"])) : O("", !0);
|
|
254
258
|
}
|
|
255
|
-
}), wt = (
|
|
256
|
-
|
|
259
|
+
}), wt = (n) => {
|
|
260
|
+
n.slot({
|
|
257
261
|
type: "plugin-details",
|
|
258
|
-
component:
|
|
262
|
+
component: vt,
|
|
259
263
|
order: -999
|
|
260
264
|
});
|
|
261
265
|
};
|
package/lib/index.js
CHANGED
|
@@ -501,10 +501,9 @@ var EnabledNativeToolsSchema = import_koishi2.Schema.array(
|
|
|
501
501
|
import_koishi2.Schema.const("setMsgEmoji").description("\u6D88\u606F\u8868\u60C5"),
|
|
502
502
|
import_koishi2.Schema.const("deleteMessage").description("\u64A4\u56DE\u6D88\u606F")
|
|
503
503
|
])
|
|
504
|
-
).role("checkbox").extra("default", void 0).description(
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
var NativeToolAdvancedSettingsSchema = import_koishi2.Schema.object({
|
|
504
|
+
).role("checkbox").extra("default", void 0).description("\u9009\u62E9\u8981\u6CE8\u518C\u5230 ChatLuna \u7684\u539F\u751F\u5DE5\u5177");
|
|
505
|
+
var NativeToolsSchema = import_koishi2.Schema.object({
|
|
506
|
+
enabledNativeTools: EnabledNativeToolsSchema,
|
|
508
507
|
poke: import_koishi2.Schema.object({
|
|
509
508
|
enabled: import_koishi2.Schema.boolean().default(false).hidden(),
|
|
510
509
|
toolName: import_koishi2.Schema.string().default("poke_user").description("\u5DE5\u5177\u540D\u79F0"),
|
|
@@ -560,13 +559,7 @@ var NativeToolAdvancedSettingsSchema = import_koishi2.Schema.object({
|
|
|
560
559
|
toolName: import_koishi2.Schema.string().default("delete_msg").description("\u5DE5\u5177\u540D\u79F0"),
|
|
561
560
|
description: import_koishi2.Schema.string().default(DEFAULT_DELETE_MESSAGE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
562
561
|
}).description("\u64A4\u56DE\u6D88\u606F\u5DE5\u5177").collapse()
|
|
563
|
-
}).description("\
|
|
564
|
-
var NativeToolsSchema = import_koishi2.Schema.intersect([
|
|
565
|
-
import_koishi2.Schema.object({
|
|
566
|
-
enabledNativeTools: EnabledNativeToolsSchema
|
|
567
|
-
}).description(""),
|
|
568
|
-
NativeToolAdvancedSettingsSchema
|
|
569
|
-
]).description("\u539F\u751F\u5DE5\u5177");
|
|
562
|
+
}).description("\u539F\u751F\u5DE5\u5177");
|
|
570
563
|
|
|
571
564
|
// src/schema/xml-tools.ts
|
|
572
565
|
var import_koishi3 = require("koishi");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-chatluna-toolbox",
|
|
3
3
|
"description": "为 ChatLuna 提供更多原生工具、Character XML 工具与变量,仅支持 onebot 平台。",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.21",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"@types/node": "^22.10.1",
|
|
50
50
|
"@vitejs/plugin-vue": "^6.0.2",
|
|
51
51
|
"sass": "^1.77.0",
|
|
52
|
-
"shared-chatluna-xmltools": "
|
|
53
|
-
"shared-nav": "
|
|
52
|
+
"shared-chatluna-xmltools": "workspace:*",
|
|
53
|
+
"shared-nav": "workspace:*",
|
|
54
54
|
"tsup": "^8.0.0",
|
|
55
55
|
"typescript": "^5.7.2",
|
|
56
56
|
"vite": "^6.0.0",
|
|
57
57
|
"vitest": "^3.2.4",
|
|
58
58
|
"vue": "^3.5.21"
|
|
59
59
|
}
|
|
60
|
-
}
|
|
60
|
+
}
|