Compare commits
6 Commits
v0.0.1
...
ab2da36aa1
| Author | SHA1 | Date | |
|---|---|---|---|
|
ab2da36aa1
|
|||
|
8691106d2f
|
|||
|
5480b57615
|
|||
|
f0dffa6cad
|
|||
|
ace98a0fbc
|
|||
|
b2ddd95ff5
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "tools-app",
|
||||
"version": "0.0.1",
|
||||
"version": "0.1.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tools-app",
|
||||
"version": "0.0.1",
|
||||
"version": "0.1.1",
|
||||
"dependencies": {
|
||||
"lucide-vue-next": "^0.575.0",
|
||||
"vue": "^3.5.25",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tools-app",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"version": "0.1.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
67
src/App.vue
67
src/App.vue
@@ -1,15 +1,50 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import Header from './components/Header.vue'
|
||||
import Footer from './components/Footer.vue'
|
||||
import Sidebar from './components/Sidebar.vue'
|
||||
|
||||
const isSidebarOpen = ref(true)
|
||||
const isSidebarOpen = ref(window.innerWidth >= 768)
|
||||
const router = useRouter()
|
||||
|
||||
// Close sidebar on route change for mobile
|
||||
router.afterEach(() => {
|
||||
if (window.innerWidth < 768) {
|
||||
isSidebarOpen.value = false
|
||||
}
|
||||
})
|
||||
|
||||
let lastWidth = window.innerWidth
|
||||
|
||||
const handleResize = () => {
|
||||
const width = window.innerWidth
|
||||
// Only change state when crossing the breakpoint
|
||||
if (width >= 768 && lastWidth < 768) {
|
||||
isSidebarOpen.value = true
|
||||
} else if (width < 768 && lastWidth >= 768) {
|
||||
isSidebarOpen.value = false
|
||||
}
|
||||
lastWidth = width
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('resize', handleResize)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', handleResize)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Header @toggle-sidebar="isSidebarOpen = !isSidebarOpen" />
|
||||
<div class="app-body">
|
||||
<div
|
||||
class="sidebar-overlay"
|
||||
:class="{ 'is-visible': isSidebarOpen }"
|
||||
@click="isSidebarOpen = false"
|
||||
></div>
|
||||
<Sidebar :is-open="isSidebarOpen" />
|
||||
<main class="main-content">
|
||||
<router-view />
|
||||
@@ -24,6 +59,7 @@ const isSidebarOpen = ref(true)
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
overflow: hidden; /* Ensure body doesn't scroll */
|
||||
}
|
||||
|
||||
.main-content {
|
||||
@@ -31,5 +67,32 @@ const isSidebarOpen = ref(true)
|
||||
padding: 2rem;
|
||||
width: 100%;
|
||||
max-width: 100%; /* Ensure it doesn't overflow */
|
||||
overflow-y: auto; /* Allow content to scroll independently */
|
||||
height: 100%; /* Take full height of app-body */
|
||||
}
|
||||
|
||||
.sidebar-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 900; /* Below sidebar (1000), above content */
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s ease;
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
|
||||
.sidebar-overlay.is-visible {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.sidebar-overlay {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,7 +4,7 @@ const version = __APP_VERSION__;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<footer class="app-footer unselectable">
|
||||
<footer class="app-footer glass-panel unselectable">
|
||||
<div class="footer-content">
|
||||
<p>© {{ currentYear }} Tools App. v{{ version }}</p>
|
||||
</div>
|
||||
@@ -14,13 +14,18 @@ const version = __APP_VERSION__;
|
||||
<style scoped>
|
||||
.app-footer {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
background-color: #242424;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
||||
padding: 0.5rem;
|
||||
/* Background handled by glass-panel */
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
border-bottom: none;
|
||||
border-radius: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: auto; /* Push to bottom in flex container */
|
||||
z-index: 10;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.footer-content {
|
||||
@@ -31,7 +36,7 @@ const version = __APP_VERSION__;
|
||||
|
||||
p {
|
||||
font-size: 0.9rem;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
@@ -17,20 +17,42 @@ defineProps({
|
||||
|
||||
<style scoped>
|
||||
.sidebar {
|
||||
width: 0;
|
||||
/* Mobile First Styles */
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 250px;
|
||||
background-color: var(--panel-bg);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
overflow-x: hidden;
|
||||
transition: width 0.3s ease;
|
||||
transition: transform 0.3s ease;
|
||||
border-right: 1px solid var(--panel-border);
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
z-index: 1000;
|
||||
box-shadow: var(--panel-shadow);
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
.sidebar.is-open {
|
||||
width: 250px;
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.sidebar {
|
||||
position: static;
|
||||
transform: none;
|
||||
width: 0;
|
||||
height: auto;
|
||||
transition: width 0.3s ease;
|
||||
z-index: auto;
|
||||
box-shadow: none; /* Shadow handled by panel logic or not needed inline */
|
||||
}
|
||||
|
||||
.sidebar.is-open {
|
||||
width: 250px;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
@@ -38,11 +60,19 @@ defineProps({
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 250px; /* Fixed width for content */
|
||||
min-width: 250px;
|
||||
padding-top: 1rem; /* Add some top padding for mobile aesthetic */
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.sidebar-nav {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
display: block;
|
||||
padding: 0.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
transition: background-color 0.2s, color 0.2s;
|
||||
|
||||
@@ -1,15 +1,311 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
// Options
|
||||
const useLower = ref(true);
|
||||
const useUpper = ref(true);
|
||||
const useDigits = ref(true);
|
||||
const useSpecial = ref(false);
|
||||
const skipSimilar = ref(true);
|
||||
const length = ref(16);
|
||||
const count = ref(20);
|
||||
|
||||
// Result
|
||||
const result = ref('');
|
||||
|
||||
// Character Sets
|
||||
const CHARS_LOWER = 'abcdefghijklmnopqrstuvwxyz';
|
||||
const CHARS_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const CHARS_DIGITS = '0123456789';
|
||||
const CHARS_SPECIAL = '!@#$%^&*()_+~`|}{[]:;?><,./-=';
|
||||
const CHARS_SIMILAR = /[Il1O0o]/g;
|
||||
|
||||
const generatePasswords = () => {
|
||||
let charset = '';
|
||||
if (useLower.value) charset += CHARS_LOWER;
|
||||
if (useUpper.value) charset += CHARS_UPPER;
|
||||
if (useDigits.value) charset += CHARS_DIGITS;
|
||||
if (useSpecial.value) charset += CHARS_SPECIAL;
|
||||
|
||||
if (skipSimilar.value) {
|
||||
charset = charset.replace(CHARS_SIMILAR, '');
|
||||
}
|
||||
|
||||
if (!charset) {
|
||||
result.value = 'Please select at least one character set.';
|
||||
return;
|
||||
}
|
||||
|
||||
const passwords = [];
|
||||
const charsetLength = charset.length;
|
||||
|
||||
// We need (count * length) random values.
|
||||
// However, crypto.getRandomValues has a limit on array size (65536 bytes).
|
||||
// So we'll generate one random value per character needed in a loop or batch.
|
||||
// For simplicity and safety, let's generate per password or per character if needed.
|
||||
// The most robust way for "bulk" is to just loop.
|
||||
|
||||
for (let i = 0; i < count.value; i++) {
|
||||
let password = '';
|
||||
// Create a typed array for the random values for this password
|
||||
const randomValues = new Uint32Array(length.value);
|
||||
crypto.getRandomValues(randomValues);
|
||||
|
||||
for (let j = 0; j < length.value; j++) {
|
||||
// Use modulo to map the random 32-bit integer to a charset index
|
||||
// Note: This introduces a tiny bias if charsetLength is not a power of 2,
|
||||
// but for typical password generation it is negligible compared to Math.random().
|
||||
// For cryptographic perfection, rejection sampling would be needed,
|
||||
// but this is standard practice for password managers.
|
||||
const randomIndex = randomValues[j] % charsetLength;
|
||||
password += charset[randomIndex];
|
||||
}
|
||||
passwords.push(password);
|
||||
}
|
||||
|
||||
result.value = passwords.join('\n');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="passwords-tool">
|
||||
<h2>Passwords Generator</h2>
|
||||
<p>This is the passwords generator tool (work in progress).</p>
|
||||
<div class="glass-panel tool-panel">
|
||||
<h2 class="tool-title">Bulk Passwords Generator</h2>
|
||||
|
||||
<div class="options-grid">
|
||||
<div class="checkbox-group">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" v-model="useLower">
|
||||
<span class="checkmark"></span>
|
||||
Lower Case (a-z)
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" v-model="useUpper">
|
||||
<span class="checkmark"></span>
|
||||
Upper Case (A-Z)
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" v-model="useDigits">
|
||||
<span class="checkmark"></span>
|
||||
Digits (0-9)
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" v-model="useSpecial">
|
||||
<span class="checkmark"></span>
|
||||
Special Chars
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" v-model="skipSimilar">
|
||||
<span class="checkmark"></span>
|
||||
Skip Similar Chars (I, l, 1, O, 0, o)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="inputs-group">
|
||||
<div class="input-wrapper">
|
||||
<label>Password Length</label>
|
||||
<input type="number" v-model="length" min="4" max="128" class="number-input">
|
||||
</div>
|
||||
<div class="input-wrapper">
|
||||
<label>Passwords Number</label>
|
||||
<input type="number" v-model="count" min="1" max="1000" class="number-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action-area">
|
||||
<button class="btn-neon generate-btn" @click="generatePasswords" v-ripple>
|
||||
Generate
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="result-area">
|
||||
<label>Passwords</label>
|
||||
<textarea
|
||||
class="result-textarea glass-panel"
|
||||
v-model="result"
|
||||
placeholder="Generated passwords will appear here..."
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.passwords-tool {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.tool-panel {
|
||||
width: 100%;
|
||||
padding: 2rem;
|
||||
border-radius: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.tool-title {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
background: var(--title-gradient);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
filter: drop-shadow(0 0 10px var(--title-glow));
|
||||
}
|
||||
|
||||
.options-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.checkbox-label input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
height: 0;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.checkmark {
|
||||
position: relative;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
background-color: var(--toggle-bg);
|
||||
border: 1px solid var(--toggle-border);
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.checkbox-label:hover input ~ .checkmark {
|
||||
border-color: var(--accent-cyan);
|
||||
}
|
||||
|
||||
.checkbox-label input:checked ~ .checkmark {
|
||||
background-color: var(--accent-cyan);
|
||||
border-color: var(--accent-cyan);
|
||||
}
|
||||
|
||||
.checkmark:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.checkbox-label input:checked ~ .checkmark:after {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.checkbox-label .checkmark:after {
|
||||
left: 6px;
|
||||
top: 2px;
|
||||
width: 5px;
|
||||
height: 10px;
|
||||
border: solid white;
|
||||
border-width: 0 2px 2px 0;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.inputs-group {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.input-wrapper label {
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.number-input {
|
||||
background: var(--toggle-bg);
|
||||
border: 1px solid var(--toggle-border);
|
||||
color: var(--text-color);
|
||||
padding: 10px 15px;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.number-input:focus {
|
||||
border-color: var(--accent-cyan);
|
||||
}
|
||||
|
||||
.action-area {
|
||||
display: flex;
|
||||
justify-content: flex-end; /* Align button to right */
|
||||
}
|
||||
|
||||
.generate-btn {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
font-size: 1.1rem;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.result-area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.result-area label {
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
border-left: 3px solid var(--accent-purple);
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.result-textarea {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
background: rgba(0, 0, 0, 0.2); /* Slightly darker for contrast */
|
||||
color: var(--text-color);
|
||||
border: 1px solid var(--accent-purple);
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
font-family: monospace;
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
resize: vertical;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:root[data-theme="light"] .result-textarea {
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -84,7 +84,8 @@ body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
overflow: hidden; /* Prevent body scroll */
|
||||
}
|
||||
|
||||
#app {
|
||||
@@ -92,6 +93,7 @@ body {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden; /* Prevent app scroll */
|
||||
}
|
||||
|
||||
/* Common UI Element Styles */
|
||||
|
||||
Reference in New Issue
Block a user