@cnc_cbz/usefultools-plugin-official 1.1.2 → 1.1.3

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.
Files changed (2) hide show
  1. package/dist/translator.mjs +16 -10
  2. package/package.json +1 -1
@@ -269,14 +269,20 @@ ${cleanedText}`;
269
269
  }
270
270
  }
271
271
  }
272
+ function splitVarWords(text) {
273
+ return text.trim().normalize("NFKC").replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[-_./\\]+/g, " ").replace(/[^\p{L}\p{N}\s]+/gu, " ").split(/\s+/).filter(Boolean);
274
+ }
275
+ function upperFirst(word) {
276
+ return word ? word[0].toUpperCase() + word.slice(1) : word;
277
+ }
272
278
  function toVarName(text, caseType) {
273
- const words = text.trim().toLowerCase().replace(/[^\w\s]/g, " ").split(/\s+/).filter((w) => w);
274
- if (!words.length) return "";
279
+ const words = splitVarWords(text).map((w) => w.toLowerCase());
280
+ if (!words.length) return text.trim();
275
281
  switch (caseType) {
276
282
  case "camel":
277
- return words[0] + words.slice(1).map((w) => w[0].toUpperCase() + w.slice(1)).join("");
283
+ return words[0] + words.slice(1).map(upperFirst).join("");
278
284
  case "pascal":
279
- return words.map((w) => w[0].toUpperCase() + w.slice(1)).join("");
285
+ return words.map(upperFirst).join("");
280
286
  case "snake":
281
287
  return words.join("_");
282
288
  case "screaming":
@@ -532,7 +538,7 @@ ${cleanedText}`;
532
538
  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
539
  },
534
540
  [..._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)
541
+ createStaticVNode('<option value="camel" data-v-9db7edfe>驼峰 camelCase</option><option value="pascal" data-v-9db7edfe>帕斯卡 PascalCase</option><option value="snake" data-v-9db7edfe>蛇形 snake_case</option><option value="screaming" data-v-9db7edfe>常量 SCREAMING_CASE</option><option value="kebab" data-v-9db7edfe>短横 kebab-case</option>', 5)
536
542
  ])],
537
543
  512
538
544
  /* NEED_PATCH */
@@ -842,7 +848,7 @@ const _export_sfc = (sfc, props) => {
842
848
  }
843
849
  return target;
844
850
  };
845
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f1bace68"]]);
851
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9db7edfe"]]);
846
852
  export {
847
853
  index as default
848
854
  };
@@ -3186,10 +3192,10 @@ export {
3186
3192
  }
3187
3193
  }
3188
3194
 
3189
- .api-key-input[data-v-f1bace68]::-ms-reveal,
3190
- .api-key-input[data-v-f1bace68]::-ms-clear,
3191
- .api-key-input[data-v-f1bace68]::-webkit-credentials-auto-fill-button,
3192
- .api-key-input[data-v-f1bace68]::-webkit-contacts-auto-fill-button {
3195
+ .api-key-input[data-v-9db7edfe]::-ms-reveal,
3196
+ .api-key-input[data-v-9db7edfe]::-ms-clear,
3197
+ .api-key-input[data-v-9db7edfe]::-webkit-credentials-auto-fill-button,
3198
+ .api-key-input[data-v-9db7edfe]::-webkit-contacts-auto-fill-button {
3193
3199
  display: none !important;
3194
3200
  visibility: hidden;
3195
3201
  pointer-events: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnc_cbz/usefultools-plugin-official",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "description": "UsefulTools 官方工具插件包",
6
6
  "keywords": [