Skip to content

Commit df7fa89

Browse files
authored
Merge branch 'main' into feat/csr-generator
2 parents 0f01b86 + fe349ad commit df7fa89

File tree

6 files changed

+139
-1
lines changed

6 files changed

+139
-1
lines changed

components.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ declare module '@vue/runtime-core' {
1212
'404.page': typeof import('./src/pages/404.page.vue')['default']
1313
About: typeof import('./src/pages/About.vue')['default']
1414
App: typeof import('./src/App.vue')['default']
15+
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
1516
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
1617
Base64FileConverter: typeof import('./src/tools/base64-file-converter/base64-file-converter.vue')['default']
1718
Base64StringConverter: typeof import('./src/tools/base64-string-converter/base64-string-converter.vue')['default']
@@ -137,10 +138,13 @@ declare module '@vue/runtime-core' {
137138
NH3: typeof import('naive-ui')['NH3']
138139
NIcon: typeof import('naive-ui')['NIcon']
139140
NInput: typeof import('naive-ui')['NInput']
141+
NInputNumber: typeof import('naive-ui')['NInputNumber']
142+
NLabel: typeof import('naive-ui')['NLabel']
140143
NLayout: typeof import('naive-ui')['NLayout']
141144
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
142145
NMenu: typeof import('naive-ui')['NMenu']
143146
NScrollbar: typeof import('naive-ui')['NScrollbar']
147+
NSpin: typeof import('naive-ui')['NSpin']
144148
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
145149
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
146150
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@tiptap/pm": "2.1.6",
4242
"@tiptap/starter-kit": "2.1.6",
4343
"@tiptap/vue-3": "2.0.3",
44+
"@types/figlet": "^1.5.8",
4445
"@vicons/material": "^0.12.0",
4546
"@vicons/tabler": "^0.12.0",
4647
"@vueuse/core": "^10.3.0",
@@ -57,6 +58,7 @@
5758
"date-fns": "^2.29.3",
5859
"dompurify": "^3.0.6",
5960
"emojilib": "^3.0.10",
61+
"figlet": "^1.7.0",
6062
"figue": "^1.2.0",
6163
"fuse.js": "^6.6.2",
6264
"highlight.js": "^11.7.0",

pnpm-lock.yaml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<script setup lang="ts">
2+
import figlet from 'figlet';
3+
import TextareaCopyable from '@/components/TextareaCopyable.vue';
4+
5+
const input = ref('Ascii ART');
6+
const font = useStorage('ascii-text-drawer:font', 'Standard');
7+
const width = useStorage('ascii-text-drawer:width', 80);
8+
const output = ref('');
9+
const errored = ref(false);
10+
const processing = ref(false);
11+
12+
figlet.defaults({ fontPath: '//unpkg.com/[email protected]/fonts/' });
13+
14+
watchEffect(async () => {
15+
processing.value = true;
16+
try {
17+
const options: figlet.Options = {
18+
font: font.value as figlet.Fonts,
19+
width: width.value,
20+
whitespaceBreak: true,
21+
};
22+
output.value = await (new Promise<string>((resolve, reject) =>
23+
figlet.text(input.value, options,
24+
(err, text) => {
25+
if (err) {
26+
reject(err);
27+
return;
28+
}
29+
30+
resolve(text ?? '');
31+
})));
32+
errored.value = false;
33+
}
34+
catch (e: any) {
35+
errored.value = true;
36+
}
37+
processing.value = false;
38+
});
39+
40+
const fonts = ['1Row', '3-D', '3D Diagonal', '3D-ASCII', '3x5', '4Max', '5 Line Oblique', 'AMC 3 Line', 'AMC 3 Liv1', 'AMC AAA01', 'AMC Neko', 'AMC Razor', 'AMC Razor2', 'AMC Slash', 'AMC Slider', 'AMC Thin', 'AMC Tubes', 'AMC Untitled', 'ANSI Shadow', 'ASCII New Roman', 'Acrobatic', 'Alligator', 'Alligator2', 'Alpha', 'Alphabet', 'Arrows', 'Avatar', 'B1FF', 'B1FF', 'Banner', 'Banner3-D', 'Banner3', 'Banner4', 'Barbwire', 'Basic', 'Bear', 'Bell', 'Benjamin', 'Big Chief', 'Big Money-ne', 'Big Money-nw', 'Big Money-se', 'Big Money-sw', 'Big', 'Bigfig', 'Binary', 'Block', 'Blocks', 'Bloody', 'Bolger', 'Braced', 'Bright', 'Broadway KB', 'Broadway', 'Bubble', 'Bulbhead', 'Caligraphy', 'Caligraphy2', 'Calvin S', 'Cards', 'Catwalk', 'Chiseled', 'Chunky', 'Coinstak', 'Cola', 'Colossal', 'Computer', 'Contessa', 'Contrast', 'Cosmike', 'Crawford', 'Crawford2', 'Crazy', 'Cricket', 'Cursive', 'Cyberlarge', 'Cybermedium', 'Cybersmall', 'Cygnet', 'DANC4', 'DOS Rebel', 'DWhistled', 'Dancing Font', 'Decimal', 'Def Leppard', 'Delta Corps Priest 1', 'Diamond', 'Diet Cola', 'Digital', 'Doh', 'Doom', 'Dot Matrix', 'Double Shorts', 'Double', 'Dr Pepper', 'Efti Chess', 'Efti Font', 'Efti Italic', 'Efti Piti', 'Efti Robot', 'Efti Wall', 'Efti Water', 'Electronic', 'Elite', 'Epic', 'Fender', 'Filter', 'Fire Font-k', 'Fire Font-s', 'Flipped', 'Flower Power', 'Four Tops', 'Fraktur', 'Fun Face', 'Fun Faces', 'Fuzzy', 'Georgi16', 'Georgia11', 'Ghost', 'Ghoulish', 'Glenyn', 'Goofy', 'Gothic', 'Graceful', 'Gradient', 'Graffiti', 'Greek', 'Heart Left', 'Heart Right', 'Henry 3D', 'Hex', 'Hieroglyphs', 'Hollywood', 'Horizontal Left', 'Horizontal Right', 'ICL-1900', 'Impossible', 'Invita', 'Isometric1', 'Isometric2', 'Isometric3', 'Isometric4', 'Italic', 'Ivrit', 'JS Block Letters', 'JS Bracket Letters', 'JS Capital Curves', 'JS Cursive', 'JS Stick Letters', 'Jacky', 'Jazmine', 'Jerusalem', 'Katakana', 'Kban', 'Keyboard', 'Knob', 'Konto Slant', 'Konto', 'LCD', 'Larry 3D 2', 'Larry 3D', 'Lean', 'Letters', 'Lil Devil', 'Line Blocks', 'Linux', 'Lockergnome', 'Madrid', 'Marquee', 'Maxfour', 'Merlin1', 'Merlin2', 'Mike', 'Mini', 'Mirror', 'Mnemonic', 'Modular', 'Morse', 'Morse2', 'Moscow', 'Mshebrew210', 'Muzzle', 'NScript', 'NT Greek', 'NV Script', 'Nancyj-Fancy', 'Nancyj-Improved', 'Nancyj-Underlined', 'Nancyj', 'Nipples', 'O8', 'OS2', 'Octal', 'Ogre', 'Old Banner', 'Patorjk\'s Cheese', 'Patorjk-HeX', 'Pawp', 'Peaks Slant', 'Peaks', 'Pebbles', 'Pepper', 'Poison', 'Puffy', 'Puzzle', 'Pyramid', 'Rammstein', 'Rectangles', 'Red Phoenix', 'Relief', 'Relief2', 'Reverse', 'Roman', 'Rot13', 'Rot13', 'Rotated', 'Rounded', 'Rowan Cap', 'Rozzo', 'Runic', 'Runyc', 'S Blood', 'SL Script', 'Santa Clara', 'Script', 'Serifcap', 'Shadow', 'Shimrod', 'Short', 'Slant Relief', 'Slant', 'Slide', 'Small Caps', 'Small Isometric1', 'Small Keyboard', 'Small Poison', 'Small Script', 'Small Shadow', 'Small Slant', 'Small Tengwar', 'Small', 'Soft', 'Speed', 'Spliff', 'Stacey', 'Stampate', 'Stampatello', 'Standard', 'Star Strips', 'Star Wars', 'Stellar', 'Stforek', 'Stick Letters', 'Stop', 'Straight', 'Stronger Than All', 'Sub-Zero', 'Swamp Land', 'Swan', 'Sweet', 'THIS', 'Tanja', 'Tengwar', 'Term', 'Test1', 'The Edge', 'Thick', 'Thin', 'Thorned', 'Three Point', 'Ticks Slant', 'Ticks', 'Tiles', 'Tinker-Toy', 'Tombstone', 'Train', 'Trek', 'Tsalagi', 'Tubular', 'Twisted', 'Two Point', 'USA Flag', 'Univers', 'Varsity', 'Wavy', 'Weird', 'Wet Letter', 'Whimsy', 'Wow'];
41+
</script>
42+
43+
<template>
44+
<c-card style="max-width: 600px;">
45+
<c-input-text
46+
v-model:value="input"
47+
label="Your text:"
48+
placeholder="Your text to draw"
49+
raw-text
50+
multiline
51+
rows="4"
52+
/>
53+
54+
<n-divider />
55+
56+
<n-grid cols="4" x-gap="12" w-full>
57+
<n-gi span="2">
58+
<c-select
59+
v-model:value="font"
60+
label-position="top"
61+
label="Font:"
62+
:options="fonts"
63+
searchable="true"
64+
placeholder="Select font to use"
65+
/>
66+
</n-gi>
67+
<n-gi span="2">
68+
<n-form-item label="Width:" label-placement="top" label-width="100" :show-feedback="false">
69+
<n-input-number v-model:value="width" min="0" max="10000" w-full placeholder="Width of the text" />
70+
</n-form-item>
71+
</n-gi>
72+
</n-grid>
73+
74+
<n-divider />
75+
76+
<div v-if="processing" flex items-center justify-center>
77+
<n-spin size="medium" />
78+
<span class="ml-2">Loading font...</span>
79+
</div>
80+
81+
<c-alert v-if="errored" mt-1 text-center type="error">
82+
Current settings resulted in error.
83+
</c-alert>
84+
85+
<n-form-item v-if="!processing && !errored" label="Ascii Art text:">
86+
<TextareaCopyable
87+
:value="output"
88+
mb-1 mt-1
89+
copy-placement="outside"
90+
/>
91+
</n-form-item>
92+
</c-card>
93+
</template>

src/tools/ascii-text-drawer/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Artboard } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'ASCII Art Text Generator',
6+
path: '/ascii-text-drawer',
7+
description: 'Create ASCII art text with many fonts and styles.',
8+
keywords: ['ascii', 'asciiart', 'text', 'drawer'],
9+
component: () => import('./ascii-text-drawer.vue'),
10+
icon: Artboard,
11+
createdAt: new Date('2024-03-03'),
12+
});

src/tools/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { tool as base64FileConverter } from './base64-file-converter';
22
import { tool as base64StringConverter } from './base64-string-converter';
33
import { tool as basicAuthGenerator } from './basic-auth-generator';
4+
5+
import { tool as asciiTextDrawer } from './ascii-text-drawer';
6+
47
import { tool as textToUnicode } from './text-to-unicode';
58
import { tool as csrGenerator } from './csr-generator';
69
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
@@ -173,7 +176,15 @@ export const toolsByCategory: ToolCategory[] = [
173176
},
174177
{
175178
name: 'Text',
176-
components: [loremIpsumGenerator, textStatistics, emojiPicker, stringObfuscator, textDiff, numeronymGenerator],
179+
components: [
180+
loremIpsumGenerator,
181+
textStatistics,
182+
emojiPicker,
183+
stringObfuscator,
184+
textDiff,
185+
numeronymGenerator,
186+
asciiTextDrawer,
187+
],
177188
},
178189
{
179190
name: 'Data',

0 commit comments

Comments
 (0)