@cnc_cbz/usefultools-plugin-official 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-converter.mjs +4 -0
- package/dist/case-converter.mjs +4 -0
- package/dist/chmod-calculator.mjs +4 -0
- package/dist/color-converter.mjs +4 -0
- package/dist/cron-expression.mjs +4 -0
- package/dist/cyber-chef.mjs +4 -0
- package/dist/docker-parser.mjs +4 -0
- package/dist/hash-generator.mjs +4 -0
- package/dist/html-entity.mjs +4 -0
- package/dist/image-compressor.mjs +4 -0
- package/dist/ip-subnet.mjs +4 -0
- package/dist/js-runner.mjs +4 -0
- package/dist/json-diff.mjs +4 -0
- package/dist/json-formatter.mjs +4 -0
- package/dist/json-yaml.mjs +4 -0
- package/dist/jwt-parser.mjs +4 -0
- package/dist/lorem-ipsum.mjs +4 -0
- package/dist/markdown-preview.mjs +4 -0
- package/dist/password-generator.mjs +4 -0
- package/dist/qr-generator.mjs +4 -0
- package/dist/regex-tester.mjs +4 -0
- package/dist/sql-formatter.mjs +4 -0
- package/dist/text-diff.mjs +4 -0
- package/dist/text-stats.mjs +4 -0
- package/dist/timestamp-converter.mjs +4 -0
- package/dist/translator.mjs +168 -85
- package/dist/url-codec.mjs +4 -0
- package/dist/uuid-generator.mjs +4 -0
- package/package.json +1 -1
package/dist/base-converter.mjs
CHANGED
package/dist/case-converter.mjs
CHANGED
package/dist/color-converter.mjs
CHANGED
package/dist/cron-expression.mjs
CHANGED
package/dist/cyber-chef.mjs
CHANGED
|
@@ -25706,6 +25706,10 @@ export {
|
|
|
25706
25706
|
color: var(--color-gray-600);
|
|
25707
25707
|
}
|
|
25708
25708
|
|
|
25709
|
+
.accent-electric-blue {
|
|
25710
|
+
accent-color: var(--color-electric-blue);
|
|
25711
|
+
}
|
|
25712
|
+
|
|
25709
25713
|
.accent-primary {
|
|
25710
25714
|
accent-color: var(--color-primary);
|
|
25711
25715
|
}
|
package/dist/docker-parser.mjs
CHANGED
package/dist/hash-generator.mjs
CHANGED
package/dist/html-entity.mjs
CHANGED
package/dist/ip-subnet.mjs
CHANGED
package/dist/js-runner.mjs
CHANGED
|
@@ -41383,6 +41383,10 @@ export {
|
|
|
41383
41383
|
color: var(--color-gray-600);
|
|
41384
41384
|
}
|
|
41385
41385
|
|
|
41386
|
+
.accent-electric-blue {
|
|
41387
|
+
accent-color: var(--color-electric-blue);
|
|
41388
|
+
}
|
|
41389
|
+
|
|
41386
41390
|
.accent-primary {
|
|
41387
41391
|
accent-color: var(--color-primary);
|
|
41388
41392
|
}
|
package/dist/json-diff.mjs
CHANGED
package/dist/json-formatter.mjs
CHANGED
package/dist/json-yaml.mjs
CHANGED
package/dist/jwt-parser.mjs
CHANGED
package/dist/lorem-ipsum.mjs
CHANGED
package/dist/qr-generator.mjs
CHANGED
package/dist/regex-tester.mjs
CHANGED
package/dist/sql-formatter.mjs
CHANGED
package/dist/text-diff.mjs
CHANGED
package/dist/text-stats.mjs
CHANGED
package/dist/translator.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, computed, openBlock, createElementBlock, createCommentVNode, createElementVNode, normalizeClass, toDisplayString, createTextVNode, Fragment, withDirectives, renderList, vModelSelect, unref, vModelText, createBlock, Teleport, vModelDynamic } from "vue";
|
|
1
|
+
import { defineComponent, ref, watch, computed, openBlock, createElementBlock, createCommentVNode, createElementVNode, normalizeClass, toDisplayString, createTextVNode, Fragment, withDirectives, renderList, vModelSelect, vModelCheckbox, createStaticVNode, unref, vModelText, createBlock, Teleport, vModelDynamic } from "vue";
|
|
2
2
|
import { fetch } from "@tauri-apps/plugin-http";
|
|
3
3
|
const _hoisted_1 = { class: "flex flex-col h-full gap-4" };
|
|
4
4
|
const _hoisted_2 = { class: "flex flex-wrap items-center gap-3" };
|
|
@@ -19,58 +19,62 @@ const _hoisted_10 = {
|
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "text-coral-red text-xs font-bold"
|
|
21
21
|
};
|
|
22
|
-
const _hoisted_11 = { class: "flex items-center gap-
|
|
23
|
-
const _hoisted_12 =
|
|
24
|
-
const _hoisted_13 =
|
|
25
|
-
const _hoisted_14 =
|
|
22
|
+
const _hoisted_11 = { class: "flex items-center gap-2 ml-auto" };
|
|
23
|
+
const _hoisted_12 = { class: "flex items-center gap-1.5 cursor-pointer" };
|
|
24
|
+
const _hoisted_13 = { class: "flex items-center gap-3" };
|
|
25
|
+
const _hoisted_14 = ["value"];
|
|
26
|
+
const _hoisted_15 = ["value"];
|
|
27
|
+
const _hoisted_16 = {
|
|
26
28
|
key: 0,
|
|
27
29
|
class: "px-4 py-2 bg-coral-red/20 border-2 border-coral-red rounded flex items-center gap-2 text-coral-red font-bold text-sm"
|
|
28
30
|
};
|
|
29
|
-
const
|
|
30
|
-
const _hoisted_16 = { class: "flex flex-col min-h-0" };
|
|
31
|
-
const _hoisted_17 = ["placeholder"];
|
|
31
|
+
const _hoisted_17 = { class: "flex-1 grid grid-cols-1 lg:grid-cols-2 gap-4 min-h-0" };
|
|
32
32
|
const _hoisted_18 = { class: "flex flex-col min-h-0" };
|
|
33
|
-
const _hoisted_19 =
|
|
34
|
-
const _hoisted_20 = { class: "
|
|
35
|
-
const _hoisted_21 = { class: "flex
|
|
36
|
-
const _hoisted_22 = {
|
|
33
|
+
const _hoisted_19 = ["placeholder"];
|
|
34
|
+
const _hoisted_20 = { class: "flex flex-col min-h-0" };
|
|
35
|
+
const _hoisted_21 = { class: "flex items-center gap-2 mb-2" };
|
|
36
|
+
const _hoisted_22 = { class: "material-icons text-sm" };
|
|
37
|
+
const _hoisted_23 = { class: "flex-1 w-full bg-deep-charcoal border-4 border-black rounded-xl p-4 overflow-auto shadow-hard min-h-[200px] text-sm leading-relaxed flex flex-col" };
|
|
38
|
+
const _hoisted_24 = {
|
|
37
39
|
key: 0,
|
|
38
40
|
class: "text-gray-400 flex items-center gap-2"
|
|
39
41
|
};
|
|
40
|
-
const
|
|
42
|
+
const _hoisted_25 = {
|
|
41
43
|
key: 1,
|
|
42
44
|
class: "text-gray-600"
|
|
43
45
|
};
|
|
44
|
-
const
|
|
46
|
+
const _hoisted_26 = {
|
|
45
47
|
key: 2,
|
|
46
48
|
class: "text-gray-100 whitespace-pre-wrap"
|
|
47
49
|
};
|
|
48
|
-
const
|
|
50
|
+
const _hoisted_27 = {
|
|
49
51
|
key: 0,
|
|
50
52
|
class: "fixed inset-0 z-50 flex items-center justify-center"
|
|
51
53
|
};
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
54
|
+
const _hoisted_28 = { class: "relative w-full max-w-lg bg-deep-charcoal border-4 border-black rounded-xl shadow-hard-xl p-6 flex flex-col gap-4" };
|
|
55
|
+
const _hoisted_29 = { class: "flex items-center gap-2" };
|
|
56
|
+
const _hoisted_30 = {
|
|
55
57
|
key: 0,
|
|
56
58
|
class: "flex flex-col gap-1.5"
|
|
57
59
|
};
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
60
|
+
const _hoisted_31 = { class: "relative" };
|
|
61
|
+
const _hoisted_32 = ["type"];
|
|
62
|
+
const _hoisted_33 = { class: "material-icons text-base" };
|
|
63
|
+
const _hoisted_34 = {
|
|
62
64
|
key: 1,
|
|
63
65
|
class: "flex flex-col gap-1.5"
|
|
64
66
|
};
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
67
|
+
const _hoisted_35 = { class: "relative" };
|
|
68
|
+
const _hoisted_36 = ["type"];
|
|
69
|
+
const _hoisted_37 = { class: "material-icons text-base" };
|
|
70
|
+
const _hoisted_38 = { class: "flex justify-end gap-3 mt-1" };
|
|
69
71
|
const GOOGLE_KEY = "translator-google-api-key";
|
|
70
72
|
const AI_KEY = "translator-ai-api-key";
|
|
71
73
|
const AI_MODEL_KEY = "translator-ai-model";
|
|
72
74
|
const ENGINE_KEY = "translator-engine";
|
|
73
75
|
const DEFAULT_MODEL = "Qwen/Qwen2.5-72B-Instruct";
|
|
76
|
+
const VAR_MODE_KEY = "translator-var-mode";
|
|
77
|
+
const VAR_CASE_KEY = "translator-var-case";
|
|
74
78
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
75
79
|
__name: "index",
|
|
76
80
|
setup(__props) {
|
|
@@ -124,6 +128,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
124
128
|
const loading = ref(false);
|
|
125
129
|
const errorMsg = ref("");
|
|
126
130
|
const copySuccess = ref(false);
|
|
131
|
+
const varMode = ref(localStorage.getItem(VAR_MODE_KEY) === "true");
|
|
132
|
+
const varCase = ref(
|
|
133
|
+
localStorage.getItem(VAR_CASE_KEY) || "camel"
|
|
134
|
+
);
|
|
135
|
+
watch(varMode, (v) => localStorage.setItem(VAR_MODE_KEY, String(v)));
|
|
136
|
+
watch(varCase, (v) => localStorage.setItem(VAR_CASE_KEY, v));
|
|
127
137
|
const languages = [
|
|
128
138
|
{ code: "auto", name: "自动检测" },
|
|
129
139
|
{ code: "zh-CN", name: "中文(简体)" },
|
|
@@ -180,6 +190,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
180
190
|
sourceText.value = translatedText.value;
|
|
181
191
|
translatedText.value = tmpText;
|
|
182
192
|
}
|
|
193
|
+
function cleanText(text) {
|
|
194
|
+
return text.replace(/\n{3,}/g, "\n\n").replace(/[ \t]+/g, " ").trim();
|
|
195
|
+
}
|
|
183
196
|
async function translateGoogle() {
|
|
184
197
|
var _a, _b;
|
|
185
198
|
if (!googleApiKey.value) {
|
|
@@ -187,8 +200,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
187
200
|
showSettings.value = true;
|
|
188
201
|
return;
|
|
189
202
|
}
|
|
203
|
+
const cleanedText = cleanText(sourceText.value);
|
|
190
204
|
const body = {
|
|
191
|
-
q:
|
|
205
|
+
q: cleanedText,
|
|
192
206
|
target: targetLang.value,
|
|
193
207
|
format: "text"
|
|
194
208
|
};
|
|
@@ -209,11 +223,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
209
223
|
showSettings.value = true;
|
|
210
224
|
return;
|
|
211
225
|
}
|
|
226
|
+
const cleanedText = cleanText(sourceText.value);
|
|
212
227
|
const targetName = getLangName(targetLang.value);
|
|
213
228
|
const sourceName = sourceLang.value === "auto" ? "" : `源语言是${getLangName(sourceLang.value)},`;
|
|
214
229
|
const prompt = `你是一个专业翻译。${sourceName}请将以下文本翻译为${targetName}。只输出翻译结果,不要解释。
|
|
215
230
|
|
|
216
|
-
${
|
|
231
|
+
${cleanedText}`;
|
|
217
232
|
const res = await fetch("https://api.siliconflow.cn/v1/chat/completions", {
|
|
218
233
|
method: "POST",
|
|
219
234
|
headers: {
|
|
@@ -254,6 +269,24 @@ ${sourceText.value}`;
|
|
|
254
269
|
}
|
|
255
270
|
}
|
|
256
271
|
}
|
|
272
|
+
function toVarName(text, caseType) {
|
|
273
|
+
const words = text.trim().toLowerCase().replace(/[^\w\s]/g, " ").split(/\s+/).filter((w) => w);
|
|
274
|
+
if (!words.length) return "";
|
|
275
|
+
switch (caseType) {
|
|
276
|
+
case "camel":
|
|
277
|
+
return words[0] + words.slice(1).map((w) => w[0].toUpperCase() + w.slice(1)).join("");
|
|
278
|
+
case "pascal":
|
|
279
|
+
return words.map((w) => w[0].toUpperCase() + w.slice(1)).join("");
|
|
280
|
+
case "snake":
|
|
281
|
+
return words.join("_");
|
|
282
|
+
case "screaming":
|
|
283
|
+
return words.join("_").toUpperCase();
|
|
284
|
+
case "kebab":
|
|
285
|
+
return words.join("-");
|
|
286
|
+
default:
|
|
287
|
+
return text;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
257
290
|
async function translate() {
|
|
258
291
|
if (!sourceText.value.trim()) return;
|
|
259
292
|
loading.value = true;
|
|
@@ -262,6 +295,9 @@ ${sourceText.value}`;
|
|
|
262
295
|
try {
|
|
263
296
|
if (engine.value === "google") await translateGoogle();
|
|
264
297
|
else await translateAI();
|
|
298
|
+
if (varMode.value && translatedText.value) {
|
|
299
|
+
translatedText.value = toVarName(translatedText.value, varCase.value);
|
|
300
|
+
}
|
|
265
301
|
} catch (e) {
|
|
266
302
|
errorMsg.value = e.message || "翻译失败";
|
|
267
303
|
} finally {
|
|
@@ -301,6 +337,9 @@ ${sourceText.value}`;
|
|
|
301
337
|
googleDebounceTimer = setTimeout(async () => {
|
|
302
338
|
try {
|
|
303
339
|
await translateGoogle();
|
|
340
|
+
if (varMode.value && translatedText.value) {
|
|
341
|
+
translatedText.value = toVarName(translatedText.value, varCase.value);
|
|
342
|
+
}
|
|
304
343
|
} catch (e) {
|
|
305
344
|
errorMsg.value = e.message || "翻译失败";
|
|
306
345
|
} finally {
|
|
@@ -374,14 +413,14 @@ ${sourceText.value}`;
|
|
|
374
413
|
class: "h-9 px-3 bg-deep-charcoal text-gray-300 font-bold border-2 border-white/20 rounded hover:border-primary hover:text-primary transition-all text-sm flex items-center gap-1.5",
|
|
375
414
|
onClick: openSettings
|
|
376
415
|
}, [
|
|
377
|
-
_cache[
|
|
416
|
+
_cache[15] || (_cache[15] = createElementVNode(
|
|
378
417
|
"span",
|
|
379
418
|
{ class: "material-icons text-lg" },
|
|
380
419
|
"key",
|
|
381
420
|
-1
|
|
382
421
|
/* CACHED */
|
|
383
422
|
)),
|
|
384
|
-
_cache[
|
|
423
|
+
_cache[16] || (_cache[16] = createTextVNode(
|
|
385
424
|
" API Key ",
|
|
386
425
|
-1
|
|
387
426
|
/* CACHED */
|
|
@@ -394,7 +433,7 @@ ${sourceText.value}`;
|
|
|
394
433
|
{ key: 0 },
|
|
395
434
|
[
|
|
396
435
|
createElementVNode("div", _hoisted_7, [
|
|
397
|
-
_cache[
|
|
436
|
+
_cache[18] || (_cache[18] = createElementVNode(
|
|
398
437
|
"span",
|
|
399
438
|
{ class: "material-icons text-vibrant-purple text-base" },
|
|
400
439
|
"smart_toy",
|
|
@@ -437,7 +476,7 @@ ${sourceText.value}`;
|
|
|
437
476
|
title: "刷新模型列表",
|
|
438
477
|
onClick: fetchModels
|
|
439
478
|
},
|
|
440
|
-
[..._cache[
|
|
479
|
+
[..._cache[17] || (_cache[17] = [
|
|
441
480
|
createElementVNode(
|
|
442
481
|
"span",
|
|
443
482
|
{ class: "material-icons text-sm" },
|
|
@@ -460,14 +499,54 @@ ${sourceText.value}`;
|
|
|
460
499
|
],
|
|
461
500
|
64
|
|
462
501
|
/* STABLE_FRAGMENT */
|
|
463
|
-
)) : createCommentVNode("v-if", true)
|
|
502
|
+
)) : createCommentVNode("v-if", true),
|
|
503
|
+
createCommentVNode(" 变量名模式 "),
|
|
504
|
+
createElementVNode("div", _hoisted_11, [
|
|
505
|
+
createElementVNode("label", _hoisted_12, [
|
|
506
|
+
withDirectives(createElementVNode(
|
|
507
|
+
"input",
|
|
508
|
+
{
|
|
509
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => varMode.value = $event),
|
|
510
|
+
type: "checkbox",
|
|
511
|
+
class: "accent-electric-blue w-4 h-4"
|
|
512
|
+
},
|
|
513
|
+
null,
|
|
514
|
+
512
|
|
515
|
+
/* NEED_PATCH */
|
|
516
|
+
), [
|
|
517
|
+
[vModelCheckbox, varMode.value]
|
|
518
|
+
]),
|
|
519
|
+
_cache[19] || (_cache[19] = createElementVNode(
|
|
520
|
+
"span",
|
|
521
|
+
{ class: "text-xs text-gray-400 font-bold" },
|
|
522
|
+
"变量名模式",
|
|
523
|
+
-1
|
|
524
|
+
/* CACHED */
|
|
525
|
+
))
|
|
526
|
+
]),
|
|
527
|
+
varMode.value ? withDirectives((openBlock(), createElementBlock(
|
|
528
|
+
"select",
|
|
529
|
+
{
|
|
530
|
+
key: 0,
|
|
531
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => varCase.value = $event),
|
|
532
|
+
class: "h-9 bg-deep-charcoal text-white border-2 border-black rounded px-3 text-sm font-bold outline-none focus:border-electric-blue transition-colors"
|
|
533
|
+
},
|
|
534
|
+
[..._cache[20] || (_cache[20] = [
|
|
535
|
+
createStaticVNode('<option value="camel" data-v-f1bace68>驼峰 camelCase</option><option value="pascal" data-v-f1bace68>帕斯卡 PascalCase</option><option value="snake" data-v-f1bace68>蛇形 snake_case</option><option value="screaming" data-v-f1bace68>常量 SCREAMING_CASE</option><option value="kebab" data-v-f1bace68>短横 kebab-case</option>', 5)
|
|
536
|
+
])],
|
|
537
|
+
512
|
|
538
|
+
/* NEED_PATCH */
|
|
539
|
+
)), [
|
|
540
|
+
[vModelSelect, varCase.value]
|
|
541
|
+
]) : createCommentVNode("v-if", true)
|
|
542
|
+
])
|
|
464
543
|
]),
|
|
465
544
|
createCommentVNode(" 语言选择栏 "),
|
|
466
|
-
createElementVNode("div",
|
|
545
|
+
createElementVNode("div", _hoisted_13, [
|
|
467
546
|
withDirectives(createElementVNode(
|
|
468
547
|
"select",
|
|
469
548
|
{
|
|
470
|
-
"onUpdate:modelValue": _cache[
|
|
549
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => sourceLang.value = $event),
|
|
471
550
|
class: "bg-deep-charcoal text-white border-2 border-black rounded px-3 py-1.5 text-sm font-bold outline-none focus:border-primary transition-colors"
|
|
472
551
|
},
|
|
473
552
|
[
|
|
@@ -478,7 +557,7 @@ ${sourceText.value}`;
|
|
|
478
557
|
return createElementVNode("option", {
|
|
479
558
|
key: l.code,
|
|
480
559
|
value: l.code
|
|
481
|
-
}, toDisplayString(l.name), 9,
|
|
560
|
+
}, toDisplayString(l.name), 9, _hoisted_14);
|
|
482
561
|
}),
|
|
483
562
|
64
|
|
484
563
|
/* STABLE_FRAGMENT */
|
|
@@ -492,7 +571,7 @@ ${sourceText.value}`;
|
|
|
492
571
|
createElementVNode("button", {
|
|
493
572
|
class: "w-8 h-8 flex items-center justify-center bg-deep-charcoal border-2 border-white/20 rounded-full hover:border-primary hover:text-primary transition-all",
|
|
494
573
|
onClick: swapLangs
|
|
495
|
-
}, [..._cache[
|
|
574
|
+
}, [..._cache[21] || (_cache[21] = [
|
|
496
575
|
createElementVNode(
|
|
497
576
|
"span",
|
|
498
577
|
{ class: "material-icons text-base" },
|
|
@@ -504,7 +583,7 @@ ${sourceText.value}`;
|
|
|
504
583
|
withDirectives(createElementVNode(
|
|
505
584
|
"select",
|
|
506
585
|
{
|
|
507
|
-
"onUpdate:modelValue": _cache[
|
|
586
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => targetLang.value = $event),
|
|
508
587
|
class: "bg-deep-charcoal text-white border-2 border-black rounded px-3 py-1.5 text-sm font-bold outline-none focus:border-primary transition-colors"
|
|
509
588
|
},
|
|
510
589
|
[
|
|
@@ -515,7 +594,7 @@ ${sourceText.value}`;
|
|
|
515
594
|
return openBlock(), createElementBlock("option", {
|
|
516
595
|
key: l.code,
|
|
517
596
|
value: l.code
|
|
518
|
-
}, toDisplayString(l.name), 9,
|
|
597
|
+
}, toDisplayString(l.name), 9, _hoisted_15);
|
|
519
598
|
}),
|
|
520
599
|
128
|
|
521
600
|
/* KEYED_FRAGMENT */
|
|
@@ -528,8 +607,8 @@ ${sourceText.value}`;
|
|
|
528
607
|
])
|
|
529
608
|
]),
|
|
530
609
|
createCommentVNode(" Error bar "),
|
|
531
|
-
errorMsg.value ? (openBlock(), createElementBlock("div",
|
|
532
|
-
_cache[
|
|
610
|
+
errorMsg.value ? (openBlock(), createElementBlock("div", _hoisted_16, [
|
|
611
|
+
_cache[22] || (_cache[22] = createElementVNode(
|
|
533
612
|
"span",
|
|
534
613
|
{ class: "material-icons text-lg" },
|
|
535
614
|
"error_outline",
|
|
@@ -543,10 +622,10 @@ ${sourceText.value}`;
|
|
|
543
622
|
)
|
|
544
623
|
])) : createCommentVNode("v-if", true),
|
|
545
624
|
createCommentVNode(" 翻译面板 "),
|
|
546
|
-
createElementVNode("div",
|
|
625
|
+
createElementVNode("div", _hoisted_17, [
|
|
547
626
|
createCommentVNode(" 源文本 "),
|
|
548
|
-
createElementVNode("div",
|
|
549
|
-
_cache[
|
|
627
|
+
createElementVNode("div", _hoisted_18, [
|
|
628
|
+
_cache[23] || (_cache[23] = createElementVNode(
|
|
550
629
|
"div",
|
|
551
630
|
{ class: "flex items-center gap-2 mb-2" },
|
|
552
631
|
[
|
|
@@ -557,26 +636,26 @@ ${sourceText.value}`;
|
|
|
557
636
|
/* CACHED */
|
|
558
637
|
)),
|
|
559
638
|
withDirectives(createElementVNode("textarea", {
|
|
560
|
-
"onUpdate:modelValue": _cache[
|
|
639
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => sourceText.value = $event),
|
|
561
640
|
spellcheck: "false",
|
|
562
641
|
placeholder: engine.value === "google" ? "输入文本自动翻译..." : "在此输入要翻译的文本...\nEnter 翻译 / Shift+Enter 换行",
|
|
563
642
|
class: "flex-1 w-full bg-deep-charcoal text-gray-100 border-4 border-black rounded-xl p-4 font-mono text-sm leading-relaxed resize-none shadow-hard focus:border-primary focus:shadow-none focus:translate-x-[4px] focus:translate-y-[4px] transition-all outline-none placeholder-gray-600 min-h-[200px]",
|
|
564
643
|
onKeydown: onTextareaKeydown
|
|
565
|
-
}, null, 40,
|
|
644
|
+
}, null, 40, _hoisted_19), [
|
|
566
645
|
[vModelText, sourceText.value]
|
|
567
646
|
])
|
|
568
647
|
]),
|
|
569
648
|
createCommentVNode(" 翻译结果 "),
|
|
570
|
-
createElementVNode("div",
|
|
571
|
-
createElementVNode("div",
|
|
572
|
-
_cache[
|
|
649
|
+
createElementVNode("div", _hoisted_20, [
|
|
650
|
+
createElementVNode("div", _hoisted_21, [
|
|
651
|
+
_cache[24] || (_cache[24] = createElementVNode(
|
|
573
652
|
"span",
|
|
574
653
|
{ class: "material-icons text-neon-green text-lg" },
|
|
575
654
|
"g_translate",
|
|
576
655
|
-1
|
|
577
656
|
/* CACHED */
|
|
578
657
|
)),
|
|
579
|
-
_cache[
|
|
658
|
+
_cache[25] || (_cache[25] = createElementVNode(
|
|
580
659
|
"span",
|
|
581
660
|
{ class: "text-sm font-bold text-gray-400 uppercase tracking-wider" },
|
|
582
661
|
"译文",
|
|
@@ -593,7 +672,7 @@ ${sourceText.value}`;
|
|
|
593
672
|
[
|
|
594
673
|
createElementVNode(
|
|
595
674
|
"span",
|
|
596
|
-
|
|
675
|
+
_hoisted_22,
|
|
597
676
|
toDisplayString(copySuccess.value ? "check_circle" : "content_copy"),
|
|
598
677
|
1
|
|
599
678
|
/* TEXT */
|
|
@@ -608,8 +687,8 @@ ${sourceText.value}`;
|
|
|
608
687
|
/* CLASS */
|
|
609
688
|
)) : createCommentVNode("v-if", true)
|
|
610
689
|
]),
|
|
611
|
-
createElementVNode("div",
|
|
612
|
-
loading.value && engine.value === "google" ? (openBlock(), createElementBlock("div",
|
|
690
|
+
createElementVNode("div", _hoisted_23, [
|
|
691
|
+
loading.value && engine.value === "google" ? (openBlock(), createElementBlock("div", _hoisted_24, [..._cache[26] || (_cache[26] = [
|
|
613
692
|
createElementVNode(
|
|
614
693
|
"span",
|
|
615
694
|
{ class: "material-icons text-primary text-base animate-spin" },
|
|
@@ -622,9 +701,9 @@ ${sourceText.value}`;
|
|
|
622
701
|
-1
|
|
623
702
|
/* CACHED */
|
|
624
703
|
)
|
|
625
|
-
])])) : !translatedText.value ? (openBlock(), createElementBlock("div",
|
|
704
|
+
])])) : !translatedText.value ? (openBlock(), createElementBlock("div", _hoisted_25, " 翻译结果将显示在这里... ")) : (openBlock(), createElementBlock(
|
|
626
705
|
"div",
|
|
627
|
-
|
|
706
|
+
_hoisted_26,
|
|
628
707
|
toDisplayString(translatedText.value),
|
|
629
708
|
1
|
|
630
709
|
/* TEXT */
|
|
@@ -634,21 +713,21 @@ ${sourceText.value}`;
|
|
|
634
713
|
]),
|
|
635
714
|
createCommentVNode(" API Key 设置弹窗 "),
|
|
636
715
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
637
|
-
showSettings.value ? (openBlock(), createElementBlock("div",
|
|
716
|
+
showSettings.value ? (openBlock(), createElementBlock("div", _hoisted_27, [
|
|
638
717
|
createElementVNode("div", {
|
|
639
718
|
class: "absolute inset-0 bg-black/60",
|
|
640
|
-
onClick: _cache[
|
|
719
|
+
onClick: _cache[8] || (_cache[8] = ($event) => showSettings.value = false)
|
|
641
720
|
}),
|
|
642
|
-
createElementVNode("div",
|
|
643
|
-
createElementVNode("div",
|
|
644
|
-
_cache[
|
|
721
|
+
createElementVNode("div", _hoisted_28, [
|
|
722
|
+
createElementVNode("div", _hoisted_29, [
|
|
723
|
+
_cache[28] || (_cache[28] = createElementVNode(
|
|
645
724
|
"span",
|
|
646
725
|
{ class: "material-icons text-primary text-xl" },
|
|
647
726
|
"key",
|
|
648
727
|
-1
|
|
649
728
|
/* CACHED */
|
|
650
729
|
)),
|
|
651
|
-
_cache[
|
|
730
|
+
_cache[29] || (_cache[29] = createElementVNode(
|
|
652
731
|
"span",
|
|
653
732
|
{ class: "text-lg font-bold text-white" },
|
|
654
733
|
"配置 API Key",
|
|
@@ -657,8 +736,8 @@ ${sourceText.value}`;
|
|
|
657
736
|
)),
|
|
658
737
|
createElementVNode("button", {
|
|
659
738
|
class: "ml-auto w-8 h-8 flex items-center justify-center text-gray-400 hover:text-white transition-colors",
|
|
660
|
-
onClick: _cache[
|
|
661
|
-
}, [..._cache[
|
|
739
|
+
onClick: _cache[9] || (_cache[9] = ($event) => showSettings.value = false)
|
|
740
|
+
}, [..._cache[27] || (_cache[27] = [
|
|
662
741
|
createElementVNode(
|
|
663
742
|
"span",
|
|
664
743
|
{ class: "material-icons" },
|
|
@@ -669,69 +748,69 @@ ${sourceText.value}`;
|
|
|
669
748
|
])])
|
|
670
749
|
]),
|
|
671
750
|
createCommentVNode(" 当前引擎 API Key "),
|
|
672
|
-
engine.value === "google" ? (openBlock(), createElementBlock("div",
|
|
673
|
-
_cache[
|
|
751
|
+
engine.value === "google" ? (openBlock(), createElementBlock("div", _hoisted_30, [
|
|
752
|
+
_cache[30] || (_cache[30] = createElementVNode(
|
|
674
753
|
"label",
|
|
675
754
|
{ class: "text-xs font-bold text-gray-400 uppercase tracking-wider" },
|
|
676
755
|
"Google Translation API Key",
|
|
677
756
|
-1
|
|
678
757
|
/* CACHED */
|
|
679
758
|
)),
|
|
680
|
-
createElementVNode("div",
|
|
759
|
+
createElementVNode("div", _hoisted_31, [
|
|
681
760
|
withDirectives(createElementVNode("input", {
|
|
682
|
-
"onUpdate:modelValue": _cache[
|
|
761
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => googleKeyInput.value = $event),
|
|
683
762
|
type: showGoogleKey.value ? "text" : "password",
|
|
684
763
|
placeholder: "AIzaSy...",
|
|
685
764
|
class: "api-key-input w-full bg-bg-dark text-gray-100 border-2 border-black rounded-lg px-4 py-2.5 pr-11 font-mono text-sm outline-none focus:border-primary transition-colors placeholder-gray-600"
|
|
686
|
-
}, null, 8,
|
|
765
|
+
}, null, 8, _hoisted_32), [
|
|
687
766
|
[vModelDynamic, googleKeyInput.value]
|
|
688
767
|
]),
|
|
689
768
|
canToggleGoogleKey.value ? (openBlock(), createElementBlock("button", {
|
|
690
769
|
key: 0,
|
|
691
770
|
class: "absolute right-2 top-1/2 -translate-y-1/2 w-7 h-7 flex items-center justify-center text-gray-400 hover:text-primary transition-colors",
|
|
692
|
-
onClick: _cache[
|
|
771
|
+
onClick: _cache[11] || (_cache[11] = ($event) => showGoogleKey.value = !showGoogleKey.value)
|
|
693
772
|
}, [
|
|
694
773
|
createElementVNode(
|
|
695
774
|
"span",
|
|
696
|
-
|
|
775
|
+
_hoisted_33,
|
|
697
776
|
toDisplayString(showGoogleKey.value ? "visibility_off" : "visibility"),
|
|
698
777
|
1
|
|
699
778
|
/* TEXT */
|
|
700
779
|
)
|
|
701
780
|
])) : createCommentVNode("v-if", true)
|
|
702
781
|
])
|
|
703
|
-
])) : (openBlock(), createElementBlock("div",
|
|
704
|
-
_cache[
|
|
782
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_34, [
|
|
783
|
+
_cache[31] || (_cache[31] = createElementVNode(
|
|
705
784
|
"label",
|
|
706
785
|
{ class: "text-xs font-bold text-gray-400 uppercase tracking-wider" },
|
|
707
786
|
"SiliconFlow API Key(AI 翻译)",
|
|
708
787
|
-1
|
|
709
788
|
/* CACHED */
|
|
710
789
|
)),
|
|
711
|
-
createElementVNode("div",
|
|
790
|
+
createElementVNode("div", _hoisted_35, [
|
|
712
791
|
withDirectives(createElementVNode("input", {
|
|
713
|
-
"onUpdate:modelValue": _cache[
|
|
792
|
+
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => aiKeyInput.value = $event),
|
|
714
793
|
type: showAiKey.value ? "text" : "password",
|
|
715
794
|
placeholder: "sk-...",
|
|
716
795
|
class: "api-key-input w-full bg-bg-dark text-gray-100 border-2 border-black rounded-lg px-4 py-2.5 pr-11 font-mono text-sm outline-none focus:border-primary transition-colors placeholder-gray-600"
|
|
717
|
-
}, null, 8,
|
|
796
|
+
}, null, 8, _hoisted_36), [
|
|
718
797
|
[vModelDynamic, aiKeyInput.value]
|
|
719
798
|
]),
|
|
720
799
|
canToggleAiKey.value ? (openBlock(), createElementBlock("button", {
|
|
721
800
|
key: 0,
|
|
722
801
|
class: "absolute right-2 top-1/2 -translate-y-1/2 w-7 h-7 flex items-center justify-center text-gray-400 hover:text-primary transition-colors",
|
|
723
|
-
onClick: _cache[
|
|
802
|
+
onClick: _cache[13] || (_cache[13] = ($event) => showAiKey.value = !showAiKey.value)
|
|
724
803
|
}, [
|
|
725
804
|
createElementVNode(
|
|
726
805
|
"span",
|
|
727
|
-
|
|
806
|
+
_hoisted_37,
|
|
728
807
|
toDisplayString(showAiKey.value ? "visibility_off" : "visibility"),
|
|
729
808
|
1
|
|
730
809
|
/* TEXT */
|
|
731
810
|
)
|
|
732
811
|
])) : createCommentVNode("v-if", true)
|
|
733
812
|
]),
|
|
734
|
-
_cache[
|
|
813
|
+
_cache[32] || (_cache[32] = createElementVNode(
|
|
735
814
|
"p",
|
|
736
815
|
{ class: "text-[11px] text-gray-600" },
|
|
737
816
|
"密钥从 cloud.siliconflow.cn 获取,保存后可在工具栏选择模型",
|
|
@@ -739,10 +818,10 @@ ${sourceText.value}`;
|
|
|
739
818
|
/* CACHED */
|
|
740
819
|
))
|
|
741
820
|
])),
|
|
742
|
-
createElementVNode("div",
|
|
821
|
+
createElementVNode("div", _hoisted_38, [
|
|
743
822
|
createElementVNode("button", {
|
|
744
823
|
class: "px-4 py-2 bg-white/10 text-gray-300 font-bold border-2 border-white/20 rounded hover:border-white hover:text-white transition-all text-sm",
|
|
745
|
-
onClick: _cache[
|
|
824
|
+
onClick: _cache[14] || (_cache[14] = ($event) => showSettings.value = false)
|
|
746
825
|
}, " 取消 "),
|
|
747
826
|
createElementVNode("button", {
|
|
748
827
|
class: "px-4 py-2 bg-primary text-black font-bold border-2 border-black rounded shadow-hard-sm hover:shadow-none hover:translate-x-[2px] hover:translate-y-[2px] transition-all text-sm",
|
|
@@ -763,7 +842,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
763
842
|
}
|
|
764
843
|
return target;
|
|
765
844
|
};
|
|
766
|
-
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
845
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f1bace68"]]);
|
|
767
846
|
export {
|
|
768
847
|
index as default
|
|
769
848
|
};
|
|
@@ -2205,6 +2284,10 @@ export {
|
|
|
2205
2284
|
color: var(--color-gray-600);
|
|
2206
2285
|
}
|
|
2207
2286
|
|
|
2287
|
+
.accent-electric-blue {
|
|
2288
|
+
accent-color: var(--color-electric-blue);
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2208
2291
|
.accent-primary {
|
|
2209
2292
|
accent-color: var(--color-primary);
|
|
2210
2293
|
}
|
|
@@ -2813,10 +2896,10 @@ export {
|
|
|
2813
2896
|
}
|
|
2814
2897
|
}
|
|
2815
2898
|
|
|
2816
|
-
.api-key-input[data-v-
|
|
2817
|
-
.api-key-input[data-v-
|
|
2818
|
-
.api-key-input[data-v-
|
|
2819
|
-
.api-key-input[data-v-
|
|
2899
|
+
.api-key-input[data-v-f1bace68]::-ms-reveal,
|
|
2900
|
+
.api-key-input[data-v-f1bace68]::-ms-clear,
|
|
2901
|
+
.api-key-input[data-v-f1bace68]::-webkit-credentials-auto-fill-button,
|
|
2902
|
+
.api-key-input[data-v-f1bace68]::-webkit-contacts-auto-fill-button {
|
|
2820
2903
|
display: none !important;
|
|
2821
2904
|
visibility: hidden;
|
|
2822
2905
|
pointer-events: none;
|
package/dist/url-codec.mjs
CHANGED
package/dist/uuid-generator.mjs
CHANGED