diff --git a/locales/en.yml b/locales/en.yml index 500a80fd..1825d5dc 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -595,6 +595,9 @@ tools: placeholder-your-string: Your string... label-cleaning-regex: 'Cleaning regex:' placeholder-your-cleaning-regex: Your cleaning regex... + label-titlecase: 'Titlecase:' + label-spongecase: 'Spongecase:' + label-swapcase: 'Swapcase:' html-entities: title: Escape HTML entities description: >- diff --git a/package.json b/package.json index 9c11737a..bff42011 100644 --- a/package.json +++ b/package.json @@ -304,6 +304,7 @@ "smol-toml": "^1.4.2", "sms-segments-calculator": "^1.2.0", "spdx-satisfies": "^6.0.0", + "sponge-case": "^2.0.3", "sql-formatter": "^15.6.6", "sshpk": "^1.18.0", "staveless-futhark": "^0.6.1", @@ -311,10 +312,12 @@ "svg2png-wasm": "^1.4.1", "svgo": "^3.3.2", "swagger-ui-dist": "^5.27.0", + "swap-case": "^3.0.3", "tesseract.js": "^5.1.1", "text-encoding-utf-8": "^1.0.2", "tick-time": "^1.0.1", "tidy-url": "^1.18.3", + "title-case": "^4.3.2", "to-double-quotes": "^4.0.0", "to-single-quotes": "^4.0.0", "turndown": "^7.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a9ce8283..8fb3bbdd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -801,6 +801,9 @@ importers: spdx-satisfies: specifier: ^6.0.0 version: 6.0.0 + sponge-case: + specifier: ^2.0.3 + version: 2.0.3 sql-formatter: specifier: ^15.6.6 version: 15.6.6 @@ -822,6 +825,9 @@ importers: swagger-ui-dist: specifier: ^5.27.0 version: 5.27.0 + swap-case: + specifier: ^3.0.3 + version: 3.0.3 tesseract.js: specifier: ^5.1.1 version: 5.1.1 @@ -834,6 +840,9 @@ importers: tidy-url: specifier: ^1.18.3 version: 1.18.3 + title-case: + specifier: ^4.3.2 + version: 4.3.2 to-double-quotes: specifier: ^4.0.0 version: 4.0.0 @@ -9967,6 +9976,9 @@ packages: split@0.3.3: resolution: {integrity: sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==} + sponge-case@2.0.3: + resolution: {integrity: sha512-i4h9ZGRfxV6Xw3mpZSFOfbXjf0cQcYmssGWutgNIfFZ2VM+YIWfD71N/kjjwK6X/AAHzBr+rciEcn/L34S8TGw==} + sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} @@ -10182,6 +10194,9 @@ packages: swap-case@1.1.2: resolution: {integrity: sha512-BAmWG6/bx8syfc6qXPprof3Mn5vQgf5dwdUNJhsNqU9WdPt5P+ES/wQ5bxfijy8zwZgZZHslC3iAsxsuQMCzJQ==} + swap-case@3.0.3: + resolution: {integrity: sha512-6p4op8wE9CQv7uDFzulI6YXUw4lD9n4oQierdbFThEKVWVQcbQcUjdP27W8XE7V4QnWmnq9jueSHceyyQnqQVA==} + symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} @@ -10325,6 +10340,9 @@ packages: title-case@2.1.1: resolution: {integrity: sha512-EkJoZ2O3zdCz3zJsYCsxyq2OC5hrxR9mfdd5I+w8h/tmFfeOxJ+vvkxsKxdmN0WtS9zLdHEgfgVOiMVgv+Po4Q==} + title-case@4.3.2: + resolution: {integrity: sha512-I/nkcBo73mO42Idfv08jhInV61IMb61OdIFxk+B4Gu1oBjWBPOLmhZdsli+oJCVaD+86pYQA93cJfFt224ZFAA==} + tlds@1.255.0: resolution: {integrity: sha512-tcwMRIioTcF/FcxLev8MJWxCp+GUALRhFEqbDoZrnowmKSGqPrl5pqS+Sut2m8BgJ6S4FExCSSpGffZ0Tks6Aw==} hasBin: true @@ -21729,6 +21747,8 @@ snapshots: dependencies: through: 2.3.8 + sponge-case@2.0.3: {} + sprintf-js@1.0.3: {} sprintf-js@1.1.3: {} @@ -22014,6 +22034,8 @@ snapshots: lower-case: 1.1.4 upper-case: 1.1.3 + swap-case@3.0.3: {} + symbol-tree@3.2.4: {} synckit@0.8.5: @@ -22195,6 +22217,8 @@ snapshots: no-case: 2.3.2 upper-case: 1.1.3 + title-case@4.3.2: {} + tlds@1.255.0: {} to-double-quotes@4.0.0: diff --git a/src/tools/case-converter/case-converter.vue b/src/tools/case-converter/case-converter.vue index a13612e3..c87ff2ce 100644 --- a/src/tools/case-converter/case-converter.vue +++ b/src/tools/case-converter/case-converter.vue @@ -13,6 +13,10 @@ import { snakeCase, trainCase, } from 'change-case'; +import { spongeCase } from 'sponge-case'; +import { swapCase } from 'swap-case'; +import { titleCase } from 'title-case'; + import InputCopyable from '../../components/InputCopyable.vue'; import { useQueryParam, useQueryParamOrStorage } from '@/composable/queryParams'; import { useValidation } from '@/composable/validation'; @@ -55,6 +59,10 @@ const formats = computed(() => [ label: t('tools.case-converter.texts.label-camelcase'), value: camelCase(inputCleaned.value), }, + { + label: t('tools.case-converter.texts.label-titlecase'), + value: titleCase(inputCleaned.value), + }, { label: t('tools.case-converter.texts.label-capitalcase'), value: capitalCase(inputCleaned.value), @@ -102,6 +110,14 @@ const formats = computed(() => [ .map((char, index) => (index % 2 === 0 ? char.toUpperCase() : char.toLowerCase())) .join(''), }, + { + label: t('tools.case-converter.texts.label-spongecase'), + value: spongeCase(inputCleaned.value), + }, + { + label: t('tools.case-converter.texts.label-swapcase'), + value: swapCase(inputCleaned.value), + }, ]); const inputLabelAlignmentConfig = { diff --git a/src/tools/case-converter/index.ts b/src/tools/case-converter/index.ts index d0b53917..9facd742 100644 --- a/src/tools/case-converter/index.ts +++ b/src/tools/case-converter/index.ts @@ -20,6 +20,9 @@ export const tool = defineTool({ 'pathCase', 'sentenceCase', 'snakeCase', + 'titleCase', + 'spongeCase', + 'swapCase', ], component: () => import('./case-converter.vue'), icon: LetterCaseToggle,