feat(new tool): Runes converter

Fix #1379
This commit is contained in:
ShareVB committed 2025-04-21 23:16:23 +02:00
1 parent 60475933b4
commit 50581c2a36
5 files changed
+112 -1

No files matched your search

+2
View File
@@ -26,6 +26,7 @@ declare module '@vue/runtime-core' {
BarcodeReader: typeof import('./src/tools/barcode-reader/barcode-reader.vue')['default']
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
Base64FileConverter: typeof import('./src/tools/base64-file-converter/base64-file-converter.vue')['default']
Base64HexConverter: typeof import('./src/tools/base64-hex-converter/base64-hex-converter.vue')['default']
Base64StringConverter: typeof import('./src/tools/base64-string-converter/base64-string-converter.vue')['default']
BasicAuthGenerator: typeof import('./src/tools/basic-auth-generator/basic-auth-generator.vue')['default']
Bcrypt: typeof import('./src/tools/bcrypt/bcrypt.vue')['default']
@@ -342,6 +343,7 @@ declare module '@vue/runtime-core' {
RsaEcdsaSigning: typeof import('./src/tools/rsa-ecdsa-signing/rsa-ecdsa-signing.vue')['default']
RsaEncryption: typeof import('./src/tools/rsa-encryption/rsa-encryption.vue')['default']
RsaKeyPairGenerator: typeof import('./src/tools/rsa-key-pair-generator/rsa-key-pair-generator.vue')['default']
RuneConverter: typeof import('./src/tools/rune-converter/rune-converter.vue')['default']
SafelinkDecoder: typeof import('./src/tools/safelink-decoder/safelink-decoder.vue')['default']
SensitiveDataMasker: typeof import('./src/tools/sensitive-data-masker/sensitive-data-masker.vue')['default']
Settings: typeof import('./src/tools/pomodoro-timer/app/views/Settings.vue')['default']
+2 -1
View File
@@ -174,10 +174,10 @@
"json-editor-vue": "^0.16.0",
"json-to-ts": "^1.7.0",
"json5": "^2.2.3",
"jsonrepair": "^3.12.0",
"jsonar-mod": "^1.9.0",
"jsonlint-mod": "^1.7.6",
"jsonpath": "^1.1.1",
"jsonrepair": "^3.12.0",
"jsstack.js": "^2.0.0",
"jsvat-next": "^3.0.4",
"jszip": "^3.10.1",
@@ -237,6 +237,7 @@
"qrcode-terminal-nooctal": "^0.12.1",
"randexp": "^0.5.3",
"regex": "^4.4.0",
"riimut": "^0.9.1",
"roboto-base64": "^0.1.2",
"rtf-stream-parser": "^3.8.0",
"safe-license-list": "^0.1.2",
+8
View File
@@ -608,6 +608,9 @@ dependencies:
regex:
specifier: ^4.4.0
version: 4.4.0
riimut:
specifier: ^0.9.1
version: 0.9.1
roboto-base64:
specifier: ^0.1.2
version: 0.1.2
@@ -15602,6 +15605,11 @@ packages:
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
/riimut@0.9.1:
resolution: {integrity: sha512-ifqTWJLoAjneRuhP7k54Nn2pHv7SbcaggXJjj0zaHHSWdxO5Yqs6w5xCKKVG7Ie2Uca7nlXqulxXzf+EH6tIYQ==}
engines: {node: '>=12.0.0'}
dev: false
/rimraf@3.0.2:
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
dependencies:
+13
View File
@@ -0,0 +1,13 @@
import { FileText } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Rune converter',
path: '/rune-converter',
description: 'Convert Text to Runes and vice-versa',
keywords: ['rune', 'converter', 'ElderFuthark', 'Futhorc', 'MedievalFuthork', 'YoungerFuthark'],
component: () => import('./rune-converter.vue'),
icon: FileText,
createdAt: new Date('2024-11-13'),
category: 'Text',
});
@@ -0,0 +1,87 @@
<script setup lang="ts">
import { elderFuthark, futhorc, medievalFuthork, youngerFuthark } from 'riimut';
import { useCopy } from '@/composable/copy';
type RuneType = 'YoungerFutharkLong' | 'YoungerFutharkShort' | 'ElderFuthark' | 'MedievalFuthork' | 'Futhorc';
function convertTextToRunes(text: string, type: RuneType) {
if (type === 'YoungerFutharkLong') {
return youngerFuthark.lettersToLongBranchRunes(text);
}
if (type === 'YoungerFutharkShort') {
return youngerFuthark.lettersToShortTwigRunes(text);
}
if (type === 'ElderFuthark') {
return elderFuthark.lettersToRunes(text);
}
if (type === 'MedievalFuthork') {
return medievalFuthork.lettersToRunes(text);
}
if (type === 'Futhorc') {
return futhorc.lettersToRunes(text);
}
return text;
}
function convertRunesToText(runes: string, type: RuneType) {
if (type === 'YoungerFutharkLong') {
return youngerFuthark.runesToLetters(runes);
}
if (type === 'YoungerFutharkShort') {
return youngerFuthark.runesToLetters(runes);
}
if (type === 'ElderFuthark') {
return elderFuthark.runesToLetters(runes);
}
if (type === 'MedievalFuthork') {
return medievalFuthork.runesToLetters(runes);
}
if (type === 'Futhorc') {
return futhorc.runesToLetters(runes);
}
return runes;
}
const runeType = ref('YoungerFutharkLong');
const inputText = ref('');
const runesFromText = computed(() => inputText.value.trim() === '' ? '' : convertTextToRunes(inputText.value, runeType.value as RuneType));
const { copy: copyRunes } = useCopy({ source: runesFromText });
const inputRunes = ref('');
const textFromRunes = computed(() => inputRunes.value.trim() === '' ? '' : convertRunesToText(inputRunes.value, runeType.value as RuneType));
const { copy: copyText } = useCopy({ source: textFromRunes });
</script>
<template>
<div max-w-600px>
<c-select
v-model:value="runeType"
label="Rune Type:"
label-position="left"
:options="['YoungerFutharkLong', 'YoungerFutharkShort', 'ElderFuthark', 'MedievalFuthork', 'Futhorc']"
placeholder="Rune Type:"
mb-2
/>
<c-card title="Text to Runes" mb-2>
<c-input-text v-model:value="inputText" multiline placeholder="e.g. 'Hello Avengers'" label="Enter text to convert to runes" autosize autofocus raw-text test-id="text-to-runes-input" />
<c-input-text v-model:value="runesFromText" label="Runes from your text" multiline raw-text readonly mt-2 placeholder="The runes representation of your text will be here" test-id="text-to-runes-output" />
<div mt-2 flex justify-center>
<c-button :disabled="!runesFromText" @click="copyRunes()">
Copy runes to clipboard
</c-button>
</div>
</c-card>
<c-card title="Runes to Text">
<c-input-text v-model:value="inputRunes" multiline placeholder="Input Runes" label="Enter runes to convert to text" autosize raw-text test-id="runes-to-text-input" />
<c-input-text v-model:value="textFromRunes" label="Text from your Runes" multiline raw-text readonly mt-2 placeholder="The text representation of your runes will be here" test-id="runes-to-text-output" />
<div mt-2 flex justify-center>
<c-button :disabled="!textFromRunes" @click="copyText()">
Copy text to clipboard
</c-button>
</div>
</c-card>
</div>
</template>