koishi-plugin-adapter-onebot-multi 1.0.6 → 2.0.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.
@@ -0,0 +1,260 @@
1
+ <template>
2
+ <div class="editor-overlay" @click.self="$emit('close')">
3
+ <section class="editor-card" aria-label="Bot 编辑弹窗">
4
+ <header class="editor-header">
5
+ <div>
6
+ <h3>{{ mode === 'create' ? (kind === 'client' ? '新增 ws 客户端' : '新增 ws 服务器') : '编辑 Bot' }}</h3>
7
+ <p>{{ mode === 'create' ? '填写必要信息后即可创建。' : '修改后会保存到本地配置文件。' }}</p>
8
+ </div>
9
+ <button type="button" class="close-button" aria-label="关闭编辑弹窗" @click="$emit('close')">×</button>
10
+ </header>
11
+
12
+ <div class="editor-grid">
13
+ <label class="field-label">
14
+ 名称
15
+ <input v-model="localValue.name" name="name" autocomplete="off" type="text" placeholder="例如:主客户端…" class="field-input">
16
+ </label>
17
+
18
+ <label class="field-label hidden-field">
19
+ 自身 ID
20
+ <input v-model="localValue.selfId" name="selfId" autocomplete="off" type="text" class="field-input">
21
+ </label>
22
+
23
+ <label class="field-label">
24
+ 访问密钥
25
+ <input v-model="localValue.token" name="token" autocomplete="off" type="text" placeholder="留空表示不校验…" class="field-input">
26
+ </label>
27
+
28
+ <label v-if="localValue.protocol === 'ws'" class="field-label">
29
+ 连接地址
30
+ <input v-model="localValue.endpoint" name="endpoint" autocomplete="off" type="url" inputmode="url" placeholder="ws://127.0.0.1:6700…" class="field-input">
31
+ </label>
32
+
33
+ <label v-else class="field-label">
34
+ 接入路径
35
+ <input v-model="localValue.path" name="path" autocomplete="off" type="text" placeholder="/onebot…" class="field-input">
36
+ </label>
37
+
38
+ <label class="field-checkbox">
39
+ <input v-model="localValue.enabled" name="enabled" type="checkbox">
40
+ <span>创建后立即启用</span>
41
+ </label>
42
+ </div>
43
+
44
+ <footer class="editor-actions">
45
+ <button type="button" class="action-button primary" @click="$emit('save', { ...localValue })">保存</button>
46
+ <button type="button" class="action-button" @click="$emit('close')">取消</button>
47
+ </footer>
48
+ </section>
49
+ </div>
50
+ </template>
51
+
52
+ <script setup lang="ts">
53
+ import { reactive, watch } from 'vue'
54
+
55
+ interface ManagedBot {
56
+ selfId?: string
57
+ token?: string
58
+ protocol?: 'ws' | 'ws-reverse'
59
+ endpoint?: string
60
+ path?: string
61
+ name?: string
62
+ enabled?: boolean
63
+ }
64
+
65
+ const props = defineProps<{
66
+ modelValue: ManagedBot
67
+ mode: 'create' | 'edit'
68
+ kind: 'client' | 'server'
69
+ }>()
70
+
71
+ defineEmits<{
72
+ (e: 'close'): void
73
+ (e: 'save', value: ManagedBot): void
74
+ }>()
75
+
76
+ const localValue = reactive<ManagedBot>({ ...props.modelValue })
77
+
78
+ watch(() => props.modelValue, (value) => {
79
+ Object.assign(localValue, value)
80
+ }, { deep: true, immediate: true })
81
+ </script>
82
+
83
+ <style scoped>
84
+ .editor-overlay {
85
+ position: fixed;
86
+ inset: 0;
87
+ z-index: 1000;
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: center;
91
+ padding: 20px;
92
+ background: rgba(87, 64, 46, 0.35);
93
+ backdrop-filter: blur(4px);
94
+ overscroll-behavior: contain;
95
+ }
96
+
97
+ .editor-card {
98
+ box-sizing: border-box;
99
+ width: min(640px, 100%);
100
+ max-width: 100%;
101
+ max-height: 88vh;
102
+ overflow-x: hidden;
103
+ overflow-y: auto;
104
+ background: #fffdf7;
105
+ border: 3px solid #6b5243;
106
+ border-radius: 20px;
107
+ padding: 24px;
108
+ }
109
+
110
+ .editor-header {
111
+ display: flex;
112
+ align-items: flex-start;
113
+ justify-content: space-between;
114
+ gap: 12px;
115
+ margin-bottom: 18px;
116
+ }
117
+
118
+ .editor-header h3 {
119
+ margin: 0;
120
+ font-size: 28px;
121
+ color: #6b5243;
122
+ }
123
+
124
+ .editor-header p {
125
+ margin: 6px 0 0;
126
+ color: #8b6b57;
127
+ font-size: 14px;
128
+ }
129
+
130
+ .close-button {
131
+ width: 40px;
132
+ height: 40px;
133
+ border: 3px solid #6b5243;
134
+ border-radius: 12px;
135
+ background: #ffffff;
136
+ color: #6b5243;
137
+ font-size: 24px;
138
+ font-weight: 900;
139
+ line-height: 1;
140
+ cursor: pointer;
141
+ transition: transform 0.12s ease;
142
+ }
143
+
144
+ .close-button:hover,
145
+ .close-button:focus-visible {
146
+ transform: translate(-1px, -1px);
147
+ }
148
+
149
+ .close-button:active {
150
+ transform: translate(2px, 2px);
151
+ }
152
+
153
+ .editor-grid {
154
+ display: grid;
155
+ gap: 14px;
156
+ min-width: 0;
157
+ }
158
+
159
+ .field-label {
160
+ display: grid;
161
+ gap: 8px;
162
+ min-width: 0;
163
+ font-weight: 700;
164
+ color: #6b5243;
165
+ }
166
+
167
+ .hidden-field {
168
+ display: none;
169
+ }
170
+
171
+ .field-input {
172
+ box-sizing: border-box;
173
+ width: 100%;
174
+ min-width: 0;
175
+ max-width: 100%;
176
+ border: 3px solid #6b5243;
177
+ border-radius: 16px;
178
+ padding: 12px 14px;
179
+ background: #ffffff;
180
+ color: #6b5243;
181
+ font: inherit;
182
+ transition: transform 0.12s ease;
183
+ }
184
+
185
+ .field-input:focus-visible {
186
+ outline: none;
187
+ transform: translate(-1px, -1px);
188
+ }
189
+
190
+ .field-checkbox {
191
+ display: flex;
192
+ box-sizing: border-box;
193
+ align-items: center;
194
+ gap: 10px;
195
+ width: 100%;
196
+ min-width: 0;
197
+ max-width: 100%;
198
+ border: 3px solid #6b5243;
199
+ border-radius: 16px;
200
+ padding: 10px 12px;
201
+ background: #fff7df;
202
+ color: #6b5243;
203
+ font-weight: 700;
204
+ overflow: hidden;
205
+ }
206
+
207
+ .editor-actions {
208
+ display: flex;
209
+ justify-content: flex-end;
210
+ gap: 12px;
211
+ margin-top: 20px;
212
+ }
213
+
214
+ .action-button {
215
+ border: 3px solid #6b5243;
216
+ border-radius: 16px;
217
+ padding: 10px 18px;
218
+ background: #ffffff;
219
+ color: #6b5243;
220
+ font: inherit;
221
+ font-weight: 800;
222
+ cursor: pointer;
223
+ transition: transform 0.12s ease;
224
+ }
225
+
226
+ .action-button.primary {
227
+ background: #ffb870;
228
+ }
229
+
230
+ .action-button:hover,
231
+ .action-button:focus-visible {
232
+ transform: translate(-1px, -1px);
233
+ }
234
+
235
+ .action-button:active {
236
+ transform: translate(2px, 2px);
237
+ }
238
+
239
+ @media (max-width: 640px) {
240
+ .editor-card {
241
+ padding: 18px;
242
+ }
243
+
244
+ .editor-header {
245
+ align-items: center;
246
+ }
247
+
248
+ .editor-header h3 {
249
+ font-size: 22px;
250
+ }
251
+
252
+ .editor-actions {
253
+ flex-direction: column-reverse;
254
+ }
255
+
256
+ .action-button {
257
+ width: 100%;
258
+ }
259
+ }
260
+ </style>
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <div class="pop-modal-overlay" @click.self="$emit('close')">
3
+ <div class="pop-modal comic-panel">
4
+ <div class="comic-burst" aria-hidden="true">?</div>
5
+ <div class="modal-top">
6
+ <h3>{{ mode === 'create' ? (kind === 'client' ? '新增 ws 客户端' : '新增 ws 服务器') : '编辑 Bot' }}</h3>
7
+ <button class="modal-close" aria-label="关闭编辑弹窗" @click="$emit('close')">?</button>
8
+ </div>
9
+ <div class="form-grid modal-grid">
10
+ <label class="pop-label">名称<input v-model="localValue.name" type="text" class="pop-input" placeholder="选填"></label>
11
+ <label class="pop-label hidden">自身 ID<input v-model="localValue.selfId" type="text" class="pop-input"></label>
12
+ <label class="pop-label">访问密钥<input v-model="localValue.token" type="text" class="pop-input"></label>
13
+ <label v-if="localValue.protocol === 'ws'" class="pop-label">连接地址<input v-model="localValue.endpoint" type="text" class="pop-input" placeholder="ws://127.0.0.1:6700"></label>
14
+ <label v-else class="pop-label">接入路径<input v-model="localValue.path" type="text" class="pop-input" placeholder="/onebot"></label>
15
+ <label class="pop-label pop-checkbox"><input v-model="localValue.enabled" type="checkbox" class="pop-check"><span>已启用</span></label>
16
+ </div>
17
+ <div class="modal-actions">
18
+ <button class="pop-btn primary-btn" @click="$emit('save', { ...localValue })">保存</button>
19
+ <button class="pop-btn" @click="$emit('close')">取消</button>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </template>
24
+
25
+ <script setup lang="ts">
26
+ import { reactive, watch } from 'vue'
27
+
28
+ interface ManagedBot {
29
+ selfId?: string
30
+ token?: string
31
+ protocol?: 'ws' | 'ws-reverse'
32
+ endpoint?: string
33
+ path?: string
34
+ name?: string
35
+ enabled?: boolean
36
+ }
37
+
38
+ const props = defineProps<{
39
+ modelValue: ManagedBot
40
+ mode: 'create' | 'edit'
41
+ kind: 'client' | 'server'
42
+ }>()
43
+
44
+ defineEmits<{
45
+ (e: 'close'): void
46
+ (e: 'save', value: ManagedBot): void
47
+ }>()
48
+
49
+ const localValue = reactive<ManagedBot>({ ...props.modelValue })
50
+
51
+ watch(() => props.modelValue, (value) => {
52
+ Object.assign(localValue, value)
53
+ }, { deep: true, immediate: true })
54
+ </script>