@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.
- package/dist/translator.mjs +16 -10
- package/package.json +1 -1
package/dist/translator.mjs
CHANGED
|
@@ -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
|
|
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(
|
|
283
|
+
return words[0] + words.slice(1).map(upperFirst).join("");
|
|
278
284
|
case "pascal":
|
|
279
|
-
return words.map(
|
|
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-
|
|
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-
|
|
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-
|
|
3190
|
-
.api-key-input[data-v-
|
|
3191
|
-
.api-key-input[data-v-
|
|
3192
|
-
.api-key-input[data-v-
|
|
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;
|