@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.
@@ -1769,6 +1769,10 @@ export {
1769
1769
  color: var(--color-gray-600);
1770
1770
  }
1771
1771
 
1772
+ .accent-electric-blue {
1773
+ accent-color: var(--color-electric-blue);
1774
+ }
1775
+
1772
1776
  .accent-primary {
1773
1777
  accent-color: var(--color-primary);
1774
1778
  }
@@ -1578,6 +1578,10 @@ export {
1578
1578
  color: var(--color-gray-600);
1579
1579
  }
1580
1580
 
1581
+ .accent-electric-blue {
1582
+ accent-color: var(--color-electric-blue);
1583
+ }
1584
+
1581
1585
  .accent-primary {
1582
1586
  accent-color: var(--color-primary);
1583
1587
  }
@@ -1722,6 +1722,10 @@ export {
1722
1722
  color: var(--color-gray-600);
1723
1723
  }
1724
1724
 
1725
+ .accent-electric-blue {
1726
+ accent-color: var(--color-electric-blue);
1727
+ }
1728
+
1725
1729
  .accent-primary {
1726
1730
  accent-color: var(--color-primary);
1727
1731
  }
@@ -1647,6 +1647,10 @@ export {
1647
1647
  color: var(--color-gray-600);
1648
1648
  }
1649
1649
 
1650
+ .accent-electric-blue {
1651
+ accent-color: var(--color-electric-blue);
1652
+ }
1653
+
1650
1654
  .accent-primary {
1651
1655
  accent-color: var(--color-primary);
1652
1656
  }
@@ -1923,6 +1923,10 @@ export {
1923
1923
  color: var(--color-gray-600);
1924
1924
  }
1925
1925
 
1926
+ .accent-electric-blue {
1927
+ accent-color: var(--color-electric-blue);
1928
+ }
1929
+
1926
1930
  .accent-primary {
1927
1931
  accent-color: var(--color-primary);
1928
1932
  }
@@ -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
  }
@@ -2613,6 +2613,10 @@ export {
2613
2613
  color: var(--color-gray-600);
2614
2614
  }
2615
2615
 
2616
+ .accent-electric-blue {
2617
+ accent-color: var(--color-electric-blue);
2618
+ }
2619
+
2616
2620
  .accent-primary {
2617
2621
  accent-color: var(--color-primary);
2618
2622
  }
@@ -1675,6 +1675,10 @@ export {
1675
1675
  color: var(--color-gray-600);
1676
1676
  }
1677
1677
 
1678
+ .accent-electric-blue {
1679
+ accent-color: var(--color-electric-blue);
1680
+ }
1681
+
1678
1682
  .accent-primary {
1679
1683
  accent-color: var(--color-primary);
1680
1684
  }
@@ -1623,6 +1623,10 @@ export {
1623
1623
  color: var(--color-gray-600);
1624
1624
  }
1625
1625
 
1626
+ .accent-electric-blue {
1627
+ accent-color: var(--color-electric-blue);
1628
+ }
1629
+
1626
1630
  .accent-primary {
1627
1631
  accent-color: var(--color-primary);
1628
1632
  }
@@ -1773,6 +1773,10 @@ export {
1773
1773
  color: var(--color-gray-600);
1774
1774
  }
1775
1775
 
1776
+ .accent-electric-blue {
1777
+ accent-color: var(--color-electric-blue);
1778
+ }
1779
+
1776
1780
  .accent-primary {
1777
1781
  accent-color: var(--color-primary);
1778
1782
  }
@@ -1658,6 +1658,10 @@ export {
1658
1658
  color: var(--color-gray-600);
1659
1659
  }
1660
1660
 
1661
+ .accent-electric-blue {
1662
+ accent-color: var(--color-electric-blue);
1663
+ }
1664
+
1661
1665
  .accent-primary {
1662
1666
  accent-color: var(--color-primary);
1663
1667
  }
@@ -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
  }
@@ -2143,6 +2143,10 @@ export {
2143
2143
  color: var(--color-gray-600);
2144
2144
  }
2145
2145
 
2146
+ .accent-electric-blue {
2147
+ accent-color: var(--color-electric-blue);
2148
+ }
2149
+
2146
2150
  .accent-primary {
2147
2151
  accent-color: var(--color-primary);
2148
2152
  }
@@ -2499,6 +2499,10 @@ export {
2499
2499
  color: var(--color-gray-600);
2500
2500
  }
2501
2501
 
2502
+ .accent-electric-blue {
2503
+ accent-color: var(--color-electric-blue);
2504
+ }
2505
+
2502
2506
  .accent-primary {
2503
2507
  accent-color: var(--color-primary);
2504
2508
  }
@@ -1692,6 +1692,10 @@ export {
1692
1692
  color: var(--color-gray-600);
1693
1693
  }
1694
1694
 
1695
+ .accent-electric-blue {
1696
+ accent-color: var(--color-electric-blue);
1697
+ }
1698
+
1695
1699
  .accent-primary {
1696
1700
  accent-color: var(--color-primary);
1697
1701
  }
@@ -1841,6 +1841,10 @@ export {
1841
1841
  color: var(--color-gray-600);
1842
1842
  }
1843
1843
 
1844
+ .accent-electric-blue {
1845
+ accent-color: var(--color-electric-blue);
1846
+ }
1847
+
1844
1848
  .accent-primary {
1845
1849
  accent-color: var(--color-primary);
1846
1850
  }
@@ -1682,6 +1682,10 @@ export {
1682
1682
  color: var(--color-gray-600);
1683
1683
  }
1684
1684
 
1685
+ .accent-electric-blue {
1686
+ accent-color: var(--color-electric-blue);
1687
+ }
1688
+
1685
1689
  .accent-primary {
1686
1690
  accent-color: var(--color-primary);
1687
1691
  }
@@ -1583,6 +1583,10 @@ export {
1583
1583
  color: var(--color-gray-600);
1584
1584
  }
1585
1585
 
1586
+ .accent-electric-blue {
1587
+ accent-color: var(--color-electric-blue);
1588
+ }
1589
+
1586
1590
  .accent-primary {
1587
1591
  accent-color: var(--color-primary);
1588
1592
  }
@@ -1690,6 +1690,10 @@ export {
1690
1690
  color: var(--color-gray-600);
1691
1691
  }
1692
1692
 
1693
+ .accent-electric-blue {
1694
+ accent-color: var(--color-electric-blue);
1695
+ }
1696
+
1693
1697
  .accent-primary {
1694
1698
  accent-color: var(--color-primary);
1695
1699
  }
@@ -1674,6 +1674,10 @@ export {
1674
1674
  color: var(--color-gray-600);
1675
1675
  }
1676
1676
 
1677
+ .accent-electric-blue {
1678
+ accent-color: var(--color-electric-blue);
1679
+ }
1680
+
1677
1681
  .accent-primary {
1678
1682
  accent-color: var(--color-primary);
1679
1683
  }
@@ -1860,6 +1860,10 @@ export {
1860
1860
  color: var(--color-gray-600);
1861
1861
  }
1862
1862
 
1863
+ .accent-electric-blue {
1864
+ accent-color: var(--color-electric-blue);
1865
+ }
1866
+
1863
1867
  .accent-primary {
1864
1868
  accent-color: var(--color-primary);
1865
1869
  }
@@ -1678,6 +1678,10 @@ export {
1678
1678
  color: var(--color-gray-600);
1679
1679
  }
1680
1680
 
1681
+ .accent-electric-blue {
1682
+ accent-color: var(--color-electric-blue);
1683
+ }
1684
+
1681
1685
  .accent-primary {
1682
1686
  accent-color: var(--color-primary);
1683
1687
  }
@@ -2367,6 +2367,10 @@ export {
2367
2367
  color: var(--color-gray-600);
2368
2368
  }
2369
2369
 
2370
+ .accent-electric-blue {
2371
+ accent-color: var(--color-electric-blue);
2372
+ }
2373
+
2370
2374
  .accent-primary {
2371
2375
  accent-color: var(--color-primary);
2372
2376
  }
@@ -1641,6 +1641,10 @@ export {
1641
1641
  color: var(--color-gray-600);
1642
1642
  }
1643
1643
 
1644
+ .accent-electric-blue {
1645
+ accent-color: var(--color-electric-blue);
1646
+ }
1647
+
1644
1648
  .accent-primary {
1645
1649
  accent-color: var(--color-primary);
1646
1650
  }
@@ -1775,6 +1775,10 @@ export {
1775
1775
  color: var(--color-gray-600);
1776
1776
  }
1777
1777
 
1778
+ .accent-electric-blue {
1779
+ accent-color: var(--color-electric-blue);
1780
+ }
1781
+
1778
1782
  .accent-primary {
1779
1783
  accent-color: var(--color-primary);
1780
1784
  }
@@ -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-3" };
23
- const _hoisted_12 = ["value"];
24
- const _hoisted_13 = ["value"];
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 _hoisted_15 = { class: "flex-1 grid grid-cols-1 lg:grid-cols-2 gap-4 min-h-0" };
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 = { class: "flex items-center gap-2 mb-2" };
34
- const _hoisted_20 = { class: "material-icons text-sm" };
35
- const _hoisted_21 = { 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" };
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 _hoisted_23 = {
42
+ const _hoisted_25 = {
41
43
  key: 1,
42
44
  class: "text-gray-600"
43
45
  };
44
- const _hoisted_24 = {
46
+ const _hoisted_26 = {
45
47
  key: 2,
46
48
  class: "text-gray-100 whitespace-pre-wrap"
47
49
  };
48
- const _hoisted_25 = {
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 _hoisted_26 = { 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" };
53
- const _hoisted_27 = { class: "flex items-center gap-2" };
54
- const _hoisted_28 = {
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 _hoisted_29 = { class: "relative" };
59
- const _hoisted_30 = ["type"];
60
- const _hoisted_31 = { class: "material-icons text-base" };
61
- const _hoisted_32 = {
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 _hoisted_33 = { class: "relative" };
66
- const _hoisted_34 = ["type"];
67
- const _hoisted_35 = { class: "material-icons text-base" };
68
- const _hoisted_36 = { class: "flex justify-end gap-3 mt-1" };
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: sourceText.value,
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
- ${sourceText.value}`;
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[13] || (_cache[13] = createElementVNode(
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[14] || (_cache[14] = createTextVNode(
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[16] || (_cache[16] = createElementVNode(
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[15] || (_cache[15] = [
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", _hoisted_11, [
545
+ createElementVNode("div", _hoisted_13, [
467
546
  withDirectives(createElementVNode(
468
547
  "select",
469
548
  {
470
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => sourceLang.value = $event),
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, _hoisted_12);
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[17] || (_cache[17] = [
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[4] || (_cache[4] = ($event) => targetLang.value = $event),
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, _hoisted_13);
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", _hoisted_14, [
532
- _cache[18] || (_cache[18] = createElementVNode(
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", _hoisted_15, [
625
+ createElementVNode("div", _hoisted_17, [
547
626
  createCommentVNode(" 源文本 "),
548
- createElementVNode("div", _hoisted_16, [
549
- _cache[19] || (_cache[19] = createElementVNode(
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[5] || (_cache[5] = ($event) => sourceText.value = $event),
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, _hoisted_17), [
644
+ }, null, 40, _hoisted_19), [
566
645
  [vModelText, sourceText.value]
567
646
  ])
568
647
  ]),
569
648
  createCommentVNode(" 翻译结果 "),
570
- createElementVNode("div", _hoisted_18, [
571
- createElementVNode("div", _hoisted_19, [
572
- _cache[20] || (_cache[20] = createElementVNode(
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[21] || (_cache[21] = createElementVNode(
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
- _hoisted_20,
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", _hoisted_21, [
612
- loading.value && engine.value === "google" ? (openBlock(), createElementBlock("div", _hoisted_22, [..._cache[22] || (_cache[22] = [
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", _hoisted_23, " 翻译结果将显示在这里... ")) : (openBlock(), createElementBlock(
704
+ ])])) : !translatedText.value ? (openBlock(), createElementBlock("div", _hoisted_25, " 翻译结果将显示在这里... ")) : (openBlock(), createElementBlock(
626
705
  "div",
627
- _hoisted_24,
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", _hoisted_25, [
716
+ showSettings.value ? (openBlock(), createElementBlock("div", _hoisted_27, [
638
717
  createElementVNode("div", {
639
718
  class: "absolute inset-0 bg-black/60",
640
- onClick: _cache[6] || (_cache[6] = ($event) => showSettings.value = false)
719
+ onClick: _cache[8] || (_cache[8] = ($event) => showSettings.value = false)
641
720
  }),
642
- createElementVNode("div", _hoisted_26, [
643
- createElementVNode("div", _hoisted_27, [
644
- _cache[24] || (_cache[24] = createElementVNode(
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[25] || (_cache[25] = createElementVNode(
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[7] || (_cache[7] = ($event) => showSettings.value = false)
661
- }, [..._cache[23] || (_cache[23] = [
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", _hoisted_28, [
673
- _cache[26] || (_cache[26] = createElementVNode(
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", _hoisted_29, [
759
+ createElementVNode("div", _hoisted_31, [
681
760
  withDirectives(createElementVNode("input", {
682
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => googleKeyInput.value = $event),
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, _hoisted_30), [
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[9] || (_cache[9] = ($event) => showGoogleKey.value = !showGoogleKey.value)
771
+ onClick: _cache[11] || (_cache[11] = ($event) => showGoogleKey.value = !showGoogleKey.value)
693
772
  }, [
694
773
  createElementVNode(
695
774
  "span",
696
- _hoisted_31,
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", _hoisted_32, [
704
- _cache[27] || (_cache[27] = createElementVNode(
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", _hoisted_33, [
790
+ createElementVNode("div", _hoisted_35, [
712
791
  withDirectives(createElementVNode("input", {
713
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => aiKeyInput.value = $event),
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, _hoisted_34), [
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[11] || (_cache[11] = ($event) => showAiKey.value = !showAiKey.value)
802
+ onClick: _cache[13] || (_cache[13] = ($event) => showAiKey.value = !showAiKey.value)
724
803
  }, [
725
804
  createElementVNode(
726
805
  "span",
727
- _hoisted_35,
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[28] || (_cache[28] = createElementVNode(
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", _hoisted_36, [
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[12] || (_cache[12] = ($event) => showSettings.value = false)
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-63055e53"]]);
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-63055e53]::-ms-reveal,
2817
- .api-key-input[data-v-63055e53]::-ms-clear,
2818
- .api-key-input[data-v-63055e53]::-webkit-credentials-auto-fill-button,
2819
- .api-key-input[data-v-63055e53]::-webkit-contacts-auto-fill-button {
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;
@@ -1615,6 +1615,10 @@ export {
1615
1615
  color: var(--color-gray-600);
1616
1616
  }
1617
1617
 
1618
+ .accent-electric-blue {
1619
+ accent-color: var(--color-electric-blue);
1620
+ }
1621
+
1618
1622
  .accent-primary {
1619
1623
  accent-color: var(--color-primary);
1620
1624
  }
@@ -1601,6 +1601,10 @@ export {
1601
1601
  color: var(--color-gray-600);
1602
1602
  }
1603
1603
 
1604
+ .accent-electric-blue {
1605
+ accent-color: var(--color-electric-blue);
1606
+ }
1607
+
1604
1608
  .accent-primary {
1605
1609
  accent-color: var(--color-primary);
1606
1610
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnc_cbz/usefultools-plugin-official",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "type": "module",
5
5
  "description": "UsefulTools 官方工具插件包",
6
6
  "keywords": [