mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 16:56:14 -04:00
chore: first commit
This commit is contained in:
commit
64c92a661c
37 changed files with 13458 additions and 0 deletions
39
src/App.vue
Normal file
39
src/App.vue
Normal file
|
@ -0,0 +1,39 @@
|
|||
<script setup lang="ts">
|
||||
import { RouterView } from 'vue-router'
|
||||
import { layouts } from './layouts';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
import {
|
||||
NConfigProvider,
|
||||
NGlobalStyle,
|
||||
} from 'naive-ui'
|
||||
|
||||
const route = useRoute();
|
||||
const layout = computed(() => route?.meta?.layout ?? layouts.base)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-config-provider>
|
||||
<n-global-style />
|
||||
<component :is="layout">
|
||||
<router-view />
|
||||
</component>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
body {
|
||||
min-height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
html {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
74
src/assets/base.css
Normal file
74
src/assets/base.css
Normal file
|
@ -0,0 +1,74 @@
|
|||
/* color palette from <https://github.com/vuejs/theme> */
|
||||
:root {
|
||||
--vt-c-white: #ffffff;
|
||||
--vt-c-white-soft: #f8f8f8;
|
||||
--vt-c-white-mute: #f2f2f2;
|
||||
|
||||
--vt-c-black: #181818;
|
||||
--vt-c-black-soft: #222222;
|
||||
--vt-c-black-mute: #282828;
|
||||
|
||||
--vt-c-indigo: #2c3e50;
|
||||
|
||||
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
|
||||
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
|
||||
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
|
||||
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
|
||||
|
||||
--vt-c-text-light-1: var(--vt-c-indigo);
|
||||
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
|
||||
--vt-c-text-dark-1: var(--vt-c-white);
|
||||
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
|
||||
}
|
||||
|
||||
/* semantic color variables for this project */
|
||||
:root {
|
||||
--color-background: var(--vt-c-white);
|
||||
--color-background-soft: var(--vt-c-white-soft);
|
||||
--color-background-mute: var(--vt-c-white-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-light-2);
|
||||
--color-border-hover: var(--vt-c-divider-light-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-light-1);
|
||||
--color-text: var(--vt-c-text-light-1);
|
||||
|
||||
--section-gap: 160px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--color-background: var(--vt-c-black);
|
||||
--color-background-soft: var(--vt-c-black-soft);
|
||||
--color-background-mute: var(--vt-c-black-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-dark-2);
|
||||
--color-border-hover: var(--vt-c-divider-dark-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-dark-1);
|
||||
--color-text: var(--vt-c-text-dark-2);
|
||||
}
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
color: var(--color-text);
|
||||
background: var(--color-background);
|
||||
transition: color 0.5s, background-color 0.5s;
|
||||
line-height: 1.6;
|
||||
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
||||
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
||||
font-size: 15px;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
1
src/assets/logo.svg
Normal file
1
src/assets/logo.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69" xmlns:v="https://vecta.io/nano"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
|
After Width: | Height: | Size: 308 B |
19
src/layouts/base.layout.vue
Normal file
19
src/layouts/base.layout.vue
Normal file
|
@ -0,0 +1,19 @@
|
|||
<script lang="ts">
|
||||
export default {
|
||||
name: 'base-layout'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="base-layout">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.base-layout {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
background-color: #f4f6fa;
|
||||
}
|
||||
</style>
|
5
src/layouts/index.ts
Normal file
5
src/layouts/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
import BaseLayout from './base.layout.vue';
|
||||
|
||||
export const layouts = {
|
||||
base: BaseLayout,
|
||||
};
|
15
src/main.ts
Normal file
15
src/main.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { createApp } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
|
||||
import { naive } from './plugins/naive.plugin';
|
||||
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(createPinia());
|
||||
app.use(router);
|
||||
app.use(naive);
|
||||
|
||||
app.mount('#app');
|
11
src/pages/Home.page.vue
Normal file
11
src/pages/Home.page.vue
Normal file
|
@ -0,0 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Minima velit nesciunt esse iusto explicabo? Corporis, optio inventore doloremque sed maxime repellendus debitis recusandae atque nulla corrupti cum sit molestiae ad.</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped>
|
||||
</style>
|
74
src/plugins/naive.plugin.ts
Normal file
74
src/plugins/naive.plugin.ts
Normal file
|
@ -0,0 +1,74 @@
|
|||
import {
|
||||
create,
|
||||
NButton,
|
||||
NConfigProvider,
|
||||
NGlobalStyle,
|
||||
NCard,
|
||||
NInput,
|
||||
NColorPicker,
|
||||
NInputNumber,
|
||||
NSpace,
|
||||
NH1,
|
||||
NForm,
|
||||
NFormItem,
|
||||
NTimePicker,
|
||||
NText,
|
||||
NIcon,
|
||||
NSwitch,
|
||||
NCollapseTransition,
|
||||
NGrid,
|
||||
NGridItem,
|
||||
NPopconfirm,
|
||||
NSlider,
|
||||
NCollapse,
|
||||
NCollapseItem,
|
||||
NProgress,
|
||||
NAutoComplete,
|
||||
NSelect,
|
||||
NUpload,
|
||||
NEmpty,
|
||||
NModal,
|
||||
NTooltip,
|
||||
NAlert,
|
||||
NP,
|
||||
NH2,
|
||||
NDropdown,
|
||||
} from 'naive-ui';
|
||||
|
||||
const components = [
|
||||
NDropdown,
|
||||
NH2,
|
||||
NP,
|
||||
NAlert,
|
||||
NTooltip,
|
||||
NModal,
|
||||
NEmpty,
|
||||
NUpload,
|
||||
NSelect,
|
||||
NAutoComplete,
|
||||
NProgress,
|
||||
NCollapse,
|
||||
NCollapseItem,
|
||||
NSlider,
|
||||
NPopconfirm,
|
||||
NGrid,
|
||||
NGridItem,
|
||||
NButton,
|
||||
NConfigProvider,
|
||||
NGlobalStyle,
|
||||
NCard,
|
||||
NInput,
|
||||
NColorPicker,
|
||||
NInputNumber,
|
||||
NSpace,
|
||||
NH1,
|
||||
NForm,
|
||||
NFormItem,
|
||||
NTimePicker,
|
||||
NText,
|
||||
NIcon,
|
||||
NSwitch,
|
||||
NCollapseTransition,
|
||||
];
|
||||
|
||||
export const naive = create({ components });
|
17
src/router.ts
Normal file
17
src/router.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import HomePage from './pages/Home.page.vue';
|
||||
import { tools } from './tools';
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: HomePage,
|
||||
},
|
||||
...Object.values(tools).flat(),
|
||||
],
|
||||
});
|
||||
|
||||
export default router;
|
9
src/tools/Tool.ts
Normal file
9
src/tools/Tool.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import type { Component } from 'vue';
|
||||
|
||||
export interface ITool {
|
||||
name: string;
|
||||
path: string;
|
||||
description: string;
|
||||
keywords: string[];
|
||||
component: () => Promise<Component>;
|
||||
}
|
5
src/tools/index.ts
Normal file
5
src/tools/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
import { tool as tokenGenerator } from './token-generator';
|
||||
|
||||
export const tools = {
|
||||
crypto: [tokenGenerator],
|
||||
};
|
9
src/tools/token-generator/index.ts
Normal file
9
src/tools/token-generator/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import type { ITool } from './../Tool';
|
||||
|
||||
export const tool: ITool = {
|
||||
name: 'Token generator',
|
||||
path: '/token-generator',
|
||||
description: 'Generate random string with the chars you want: uppercase or lowercase letters, numbers and/or symbols.',
|
||||
keywords: ['token', 'random', 'string', 'alphanumeric', 'symbols', 'number', 'letters', 'lowercase', 'uppercase'],
|
||||
component: () => import('./token-generator.tool.vue'),
|
||||
};
|
75
src/tools/token-generator/token-generator.tool.vue
Normal file
75
src/tools/token-generator/token-generator.tool.vue
Normal file
|
@ -0,0 +1,75 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>Token generator</h1>
|
||||
|
||||
<n-form label-placement="left" label-width="140">
|
||||
<n-space justify="center" item-style="padding: 0" :size="0">
|
||||
<div>
|
||||
<n-form-item label="Uppercase (ABC...)">
|
||||
<n-switch v-model:value="withUppercase" />
|
||||
</n-form-item>
|
||||
|
||||
<n-form-item label="Lowercase (abc...)">
|
||||
<n-switch v-model:value="withLowercase" />
|
||||
</n-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<n-form-item label="Numbers (012...)">
|
||||
<n-switch v-model:value="withNumbers" />
|
||||
</n-form-item>
|
||||
|
||||
<n-form-item label="Symbols (;-!...)">
|
||||
<n-switch v-model:value="withSymbols" />
|
||||
</n-form-item>
|
||||
</div>
|
||||
</n-space>
|
||||
</n-form>
|
||||
|
||||
<!-- <n-form-item label="Custom alphabet" label-placement="left">
|
||||
<n-switch v-model:value="withAlphabet" />
|
||||
<n-input v-model:value="customAlphabet" placeholder="Custom alphabet" />
|
||||
</n-form-item>-->
|
||||
|
||||
<n-form-item :label="`Length (${length})`" label-placement="left">
|
||||
<n-slider v-model:value="length" :step="1" :min="1" :max="512" />
|
||||
</n-form-item>
|
||||
|
||||
<n-input v-model:value="token" type="textarea" placeholder="The token..." />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { shuffleString } from '@/utils/random';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const token = ref('')
|
||||
const length = ref(64)
|
||||
const customAlphabet = ref('it-tools <3')
|
||||
|
||||
const withUppercase = ref(true)
|
||||
const withLowercase = ref(true)
|
||||
const withNumbers = ref(true)
|
||||
const withSymbols = ref(false)
|
||||
const withAlphabet = ref(false)
|
||||
|
||||
watch([withUppercase, withLowercase, withNumbers, withSymbols, length, customAlphabet, withAlphabet], refreshToken)
|
||||
|
||||
function refreshToken() {
|
||||
const alphabet = withAlphabet.value
|
||||
? customAlphabet.value
|
||||
: [
|
||||
...(withUppercase.value ? 'ABCDEFGHIJKLMOPQRSTUVWXYZ' : ''),
|
||||
...(withLowercase.value ? 'abcdefghijklmopqrstuvwxyz' : ''),
|
||||
...(withNumbers.value ? '0123456789' : ''),
|
||||
...(withSymbols.value ? '.,;:!?./-"\'#{([-|\\@)]=}*+' : '')
|
||||
].join('')
|
||||
|
||||
token.value = shuffleString(alphabet.repeat(length.value)).substring(0, length.value)
|
||||
}
|
||||
|
||||
refreshToken()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
21
src/utils/random.ts
Normal file
21
src/utils/random.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
const random = () => Math.random();
|
||||
|
||||
const randFromArray = (array: unknown[]) => array[Math.floor(random() * array.length)];
|
||||
|
||||
const randIntFromInterval = (min: number, max: number) => Math.floor(random() * (max - min) + min);
|
||||
|
||||
// Durstenfeld shuffle
|
||||
const shuffleArrayMutate = <T>(array: T[]): T[] => {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
const shuffleArray = <T>(array: T[]): T[] => shuffleArrayMutate([...array]);
|
||||
|
||||
const shuffleString = (str: string, delimiter = ''): string => shuffleArrayMutate(str.split(delimiter)).join(delimiter);
|
||||
|
||||
export { randFromArray, randIntFromInterval, random, shuffleArray, shuffleArrayMutate, shuffleString };
|
Loading…
Add table
Add a link
Reference in a new issue