Compare commits

..
Author SHA1 Message Date
sharevb d087bd988a feat(new tool): Punycode Converter
Fix #1235
2024-08-25 10:18:12 +02:00
17 changed files with 110 additions and 926 deletions

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

+1 -5
View File
@@ -1,8 +1,4 @@
<picture>
<source srcset="./.github/logo-dark.png" media="(prefers-color-scheme: light)">
<source srcset="./.github/logo-white.png" media="(prefers-color-scheme: dark)">
<img src="./.github/logo-dark.png" alt="logo">
</picture>
![logo](.github/logo.png)
Useful tools for developer and people working in IT. [Have a look !](https://it-tools.tech).
+2 -7
View File
@@ -121,7 +121,6 @@ declare module '@vue/runtime-core' {
LoremIpsumGenerator: typeof import('./src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue')['default']
MacAddressGenerator: typeof import('./src/tools/mac-address-generator/mac-address-generator.vue')['default']
MacAddressLookup: typeof import('./src/tools/mac-address-lookup/mac-address-lookup.vue')['default']
MarkdownToHtml: typeof import('./src/tools/markdown-to-html/markdown-to-html.vue')['default']
MathEvaluator: typeof import('./src/tools/math-evaluator/math-evaluator.vue')['default']
MenuBar: typeof import('./src/tools/html-wysiwyg-editor/editor/menu-bar.vue')['default']
MenuBarItem: typeof import('./src/tools/html-wysiwyg-editor/editor/menu-bar-item.vue')['default']
@@ -130,23 +129,18 @@ declare module '@vue/runtime-core' {
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
NButton: typeof import('naive-ui')['NButton']
NCode: typeof import('naive-ui')['NCode']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDivider: typeof import('naive-ui')['NDivider']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NH1: typeof import('naive-ui')['NH1']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSlider: typeof import('naive-ui')['NSlider']
NSwitch: typeof import('naive-ui')['NSwitch']
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
@@ -154,6 +148,7 @@ declare module '@vue/runtime-core' {
PdfSignatureDetails: typeof import('./src/tools/pdf-signature-checker/components/pdf-signature-details.vue')['default']
PercentageCalculator: typeof import('./src/tools/percentage-calculator/percentage-calculator.vue')['default']
PhoneParserAndFormatter: typeof import('./src/tools/phone-parser-and-formatter/phone-parser-and-formatter.vue')['default']
PunycodeConverter: typeof import('./src/tools/punycode-converter/punycode-converter.vue')['default']
QrCodeGenerator: typeof import('./src/tools/qr-code-generator/qr-code-generator.vue')['default']
RandomPortGenerator: typeof import('./src/tools/random-port-generator/random-port-generator.vue')['default']
ResultRow: typeof import('./src/tools/ipv4-range-expander/result-row.vue')['default']
+2 -6
View File
@@ -42,9 +42,7 @@
"@tiptap/starter-kit": "2.1.6",
"@tiptap/vue-3": "2.0.3",
"@types/figlet": "^1.5.8",
"@types/markdown-it": "^13.0.7",
"@types/utf8": "^3.0.3",
"@unicode/unicode-15.1.0": "^1.6.0",
"@types/punycode": "^2.1.4",
"@vicons/material": "^0.12.0",
"@vicons/tabler": "^0.12.0",
"@vueuse/core": "^10.3.0",
@@ -73,7 +71,6 @@
"jwt-decode": "^3.1.2",
"libphonenumber-js": "^1.10.28",
"lodash": "^4.17.21",
"markdown-it": "^14.0.0",
"marked": "^10.0.0",
"mathjs": "^11.9.1",
"mime-types": "^2.1.35",
@@ -85,13 +82,13 @@
"pdf-signature-reader": "^1.4.2",
"pinia": "^2.0.34",
"plausible-tracker": "^0.3.8",
"punycode": "^2.3.1",
"qrcode": "^1.5.1",
"sql-formatter": "^13.0.0",
"ua-parser-js": "^1.0.35",
"ulid": "^2.3.0",
"unicode-emoji-json": "^0.4.0",
"unplugin-auto-import": "^0.16.4",
"utf8": "^3.0.0",
"uuid": "^9.0.0",
"vue": "^3.3.4",
"vue-i18n": "^9.9.1",
@@ -139,7 +136,6 @@
"unplugin-icons": "^0.17.0",
"unplugin-vue-components": "^0.25.0",
"vite": "^4.4.9",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-pwa": "^0.16.0",
"vite-plugin-vue-markdown": "^0.23.5",
"vite-svg-loader": "^4.0.0",
+16 -700
View File
File diff suppressed because it is too large. Load diff
-2
View File
@@ -7,7 +7,6 @@ import sqlHljs from 'highlight.js/lib/languages/sql';
import xmlHljs from 'highlight.js/lib/languages/xml';
import yamlHljs from 'highlight.js/lib/languages/yaml';
import iniHljs from 'highlight.js/lib/languages/ini';
import markdownHljs from 'highlight.js/lib/languages/markdown';
import { useCopy } from '@/composable/copy';
const props = withDefaults(
@@ -31,7 +30,6 @@ hljs.registerLanguage('html', xmlHljs);
hljs.registerLanguage('xml', xmlHljs);
hljs.registerLanguage('yaml', yamlHljs);
hljs.registerLanguage('toml', iniHljs);
hljs.registerLanguage('markdown', markdownHljs);
const { value, language, followHeightOf, copyPlacement, copyMessage } = toRefs(props);
const { height } = followHeightOf.value ? useElementSize(followHeightOf) : { height: ref(null) };
+11 -5
View File
@@ -2,7 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter';
import { tool as base64StringConverter } from './base64-string-converter';
import { tool as basicAuthGenerator } from './basic-auth-generator';
import { tool as emailNormalizer } from './email-normalizer';
import { tool as unicodeSearch } from './unicode-search';
import { tool as punycodeConverter } from './punycode-converter';
import { tool as asciiTextDrawer } from './ascii-text-drawer';
@@ -10,7 +10,6 @@ import { tool as textToUnicode } from './text-to-unicode';
import { tool as safelinkDecoder } from './safelink-decoder';
import { tool as xmlToJson } from './xml-to-json';
import { tool as jsonToXml } from './json-to-xml';
import { tool as markdownToHtml } from './markdown-to-html';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -114,7 +113,6 @@ export const toolsByCategory: ToolCategory[] = [
tomlToYaml,
xmlToJson,
jsonToXml,
markdownToHtml,
],
},
{
@@ -136,7 +134,6 @@ export const toolsByCategory: ToolCategory[] = [
httpStatusCodes,
jsonDiff,
safelinkDecoder,
unicodeSearch,
],
},
{
@@ -162,7 +159,16 @@ export const toolsByCategory: ToolCategory[] = [
},
{
name: 'Network',
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
components: [
ipv4SubnetCalculator,
ipv4AddressConverter,
// ipv6AddressConverter,
ipv4RangeExpander,
macAddressLookup,
macAddressGenerator,
ipv6UlaGenerator,
punycodeConverter,
],
},
{
name: 'Math',
-12
View File
@@ -1,12 +0,0 @@
import { Markdown } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Markdown to HTML',
path: '/markdown-to-html',
description: 'Convert Markdown to Html and allow to print (as PDF)',
keywords: ['markdown', 'html', 'converter', 'pdf'],
component: () => import('./markdown-to-html.vue'),
icon: Markdown,
createdAt: new Date('2024-08-25'),
});
@@ -1,44 +0,0 @@
<script setup lang="ts">
import markdownit from 'markdown-it';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const inputMarkdown = ref('');
const outputHtml = computed(() => {
const md = markdownit();
return md.render(inputMarkdown.value);
});
function printHtml() {
const w = window.open();
if (w === null) {
return;
}
w.document.body.innerHTML = outputHtml.value;
w.print();
}
</script>
<template>
<div>
<c-input-text
v-model:value="inputMarkdown"
multiline raw-text
placeholder="Your Markdown content..."
rows="8"
autofocus
label="Your Markdown to convert:"
/>
<n-divider />
<n-form-item label="Output HTML:">
<TextareaCopyable :value="outputHtml" :word-wrap="true" language="html" />
</n-form-item>
<div flex justify-center>
<n-button @click="printHtml">
Print as PDF
</n-button>
</div>
</div>
</template>
+12
View File
@@ -0,0 +1,12 @@
import { World } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Punycode Converter',
path: '/punycode-converter',
description: 'Convert international unicode domain names or emails from/to ASCII Punycode version',
keywords: ['punycode', 'converter', 'rfc3492', 'bootstring', 'domain', 'dns'],
component: () => import('./punycode-converter.vue'),
icon: World,
createdAt: new Date('2024-08-15'),
});
@@ -0,0 +1,66 @@
<script setup lang="ts">
import { toASCII, toUnicode } from 'punycode/';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const punycodeInput = ref('');
const intlOutput = computed(
() => {
try {
return toUnicode(punycodeInput.value?.trim());
}
catch (e: any) {
return e.toString();
}
},
);
const intlInput = ref('');
const punycodeOutput = computed(
() => {
try {
return toASCII(intlInput.value?.trim());
}
catch (e: any) {
return e.toString();
}
},
);
</script>
<template>
<div max-w-600>
<c-card title="Punycode to International">
<c-input-text
v-model:value="punycodeInput"
placeholder="Put your punycode domain name or email to decode..."
label="Punycode Domain name/Email"
raw-text
/>
<n-divider />
<TextareaCopyable
label="Decoded Domain name/Email"
:value="intlOutput"
readonly
/>
</c-card>
<c-card title="International to Punycode" mt-5>
<c-input-text
v-model:value="intlInput"
placeholder="Put your international domain or email name here..."
label="Domain name or email to encode"
raw-text
/>
<n-divider />
<TextareaCopyable
label="Punycode Domain name/Email"
:value="punycodeOutput"
readonly
/>
</c-card>
</div>
</template>
-12
View File
@@ -1,12 +0,0 @@
import { FileText } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Unicode Search',
path: '/unicode-search',
description: 'Search in Unicode Characters',
keywords: ['unicode', 'search'],
component: () => import('./unicode-search.vue'),
icon: FileText,
createdAt: new Date('2024-08-15'),
});
-122
View File
@@ -1,122 +0,0 @@
<script setup lang="ts">
import unicodeNames from '@unicode/unicode-15.1.0/Names/index.js';
import unicodeCategories from '@unicode/unicode-15.1.0/General_Category';
import utf8 from 'utf8';
import { useFuzzySearch } from '@/composable/fuzzySearch';
import useDebouncedRef from '@/composable/debouncedref';
function toPaddedHex(num: number) {
return num.toString(16).padStart(4, '0').toUpperCase();
}
function toUTF8(codePoint: number) {
const utf8String = utf8.encode(String.fromCodePoint(codePoint));
return [...utf8String].map(c => `\\x${c.codePointAt(0)?.toString(16).toUpperCase()}`);
}
const searchQuery = useDebouncedRef('', 500);
const parsedSearchQuery = computed(() => {
const parsedRegex = /^\s*(?:\&#x(?<hex1>[\da-f]+);|\&#(?<dec>\d+);|(?:U\+|\\u)?\s*(?<hex2>[\da-f]+))\s*$/gi; // NOSONAR
const parsedQuery = parsedRegex.exec(searchQuery.value);
if (parsedQuery) {
if (parsedQuery.groups?.hex1 || parsedQuery.groups?.hex2) {
return `=${toPaddedHex(Number.parseInt(parsedQuery.groups.hex1 || parsedQuery.groups.hex2, 16))}`;
}
if (parsedQuery.groups?.dec) {
return `=${toPaddedHex(Number.parseInt(parsedQuery.groups.dec, 10))}`;
}
}
return searchQuery.value;
});
const unicodeSearchData = [...unicodeNames].map(([codePoint, characterName]) => {
const hex = toPaddedHex(codePoint);
return {
codePoint,
characterName: `${characterName} (U+${hex})`,
hex,
};
});
const { searchResult } = useFuzzySearch({
search: parsedSearchQuery,
data: unicodeSearchData,
options: {
keys: ['characterName', 'hex'],
threshold: 0.2,
isCaseSensitive: false,
minMatchCharLength: 3,
useExtendedSearch: true,
},
});
</script>
<template>
<div mx-auto max-w-2400px important:flex-1>
<div flex items-center gap-3>
<c-input-text
v-model:value="searchQuery"
placeholder="Search Unicode by name (e.g. 'zero width') or code point..."
mx-auto max-w-600px
>
<template #prefix>
<icon-mdi-search mr-6px color-black op-70 dark:color-white />
</template>
</c-input-text>
</div>
<div v-if="searchQuery.trim().length > 0">
<div
v-if="searchResult.length === 0"
mt-4
text-20px
font-bold
>
No results
</div>
<div v-else>
<div mt-4 text-20px font-bold>
Search result
</div>
<n-table>
<thead>
<th>UCOD</th>
<th>Display/UTF8</th>
<th style="width:30%">
Category
</th>
<th>Html</th>
<th style="width:30%">
Name
</th>
</thead>
<tbody>
<tr v-for="(result, ix) in searchResult" :key="ix">
<td>
<input-copyable :value="`U+${toPaddedHex(result.codePoint)}`" mb-1 />
<!-- //NOSONAR --><n-a :href="`https://unicodeplus.com/U+${toPaddedHex(result.codePoint)}`" target="_blank">
&gt; More info
</n-a>
</td>
<td>
<input-copyable :value="String.fromCodePoint(result.codePoint)" mb-1 />
<input-copyable :value="toUTF8(result.codePoint)" />
</td>
<td>
<input-copyable :value="unicodeCategories.get(result.codePoint)" />
</td>
<td>
<input-copyable :value="`\&\#x${toPaddedHex(result.codePoint)};`" mb-1 />
<input-copyable :value="`\&\#${result.codePoint};`" />
</td>
<td><input-copyable :value="result.characterName" /></td>
</tr>
</tbody>
</n-table>
</div>
</div>
</div>
</template>
-9
View File
@@ -1,9 +0,0 @@
declare module '@unicode/unicode-15.1.0/Names/index.js'{
const unicode: HashSet<number, string>;
export default unicode;
}
declare module '@unicode/unicode-15.1.0/General_Category'{
const unicode: HashSet<number, string>;
export default unicode;
}
-2
View File
@@ -15,7 +15,6 @@ import { VitePWA } from 'vite-plugin-pwa';
import markdown from 'vite-plugin-vue-markdown';
import svgLoader from 'vite-svg-loader';
import { configDefaults } from 'vitest/config';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
const baseUrl = process.env.BASE_URL ?? '/';
@@ -98,7 +97,6 @@ export default defineConfig({
resolvers: [NaiveUiResolver(), IconsResolver({ prefix: 'icon' })],
}),
Unocss(),
nodePolyfills(),
],
base: baseUrl,
resolve: {