1 Commits
Author SHA1 Message Date
libretechandClaude Opus 4.7 648b25de7f Add Vue + Vite port of the logo generator
Single-file component (App.vue) over the shared src/logo.js core.
Reactive state via reactive(); v-model drives controls, computed
properties produce the live logo style and generated CSS. Keeps the
accessibility markup (labels, aria, <details>/<summary>, focus
rings); reset restores defaults through the form's @reset handler.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 12:22:28 +02:00
10 changed files with 444 additions and 4686 deletions
-1
View File
@@ -1,5 +1,4 @@
node_modules
dist
.astro
*.log
.DS_Store
-5
View File
@@ -1,5 +0,0 @@
import { defineConfig } from 'astro/config';
// Astro builds with Vite under the hood. The page ships as static HTML;
// the interactive logic lives in a bundled client <script> in index.astro.
export default defineConfig({});
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Logo-Generator</title>
<link href="https://fonts.googleapis.com/css2?family=Anton&family=Bowlby+One&family=Bebas+Neue&family=Bungee&family=Passion+One:wght@900&family=Ultra&display=swap" rel="stylesheet">
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
+288 -4473
View File
File diff suppressed because it is too large Load Diff
+10 -7
View File
@@ -1,7 +1,7 @@
{
"name": "demo-ecmascript-astro",
"name": "demo-ecmascript-vue",
"version": "1.0.0",
"description": "LIBRETECH logo generator — Astro (Vite)",
"description": "LIBRETECH logo generator — Vue + Vite",
"repository": {
"type": "git",
"url": "ssh://tengo@git.librete.ch:41240/public/demo-ecmascript.git"
@@ -9,12 +9,15 @@
"license": "WTFPL",
"type": "module",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"astro": "^5.1.1"
"vue": "^3.5.13"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",
"vite": "^6.0.0"
}
}
+121
View File
@@ -0,0 +1,121 @@
<script setup>
import { reactive, computed, ref, watchEffect } from 'vue';
import { defaults, fonts, logoStyle, cssOutput } from './logo.js';
const FONT_LABELS = { Impact: 'Impact (System)' };
const s = reactive({ ...defaults });
const css = computed(() => cssOutput(s));
const logoCss = computed(() => logoStyle(s));
const copied = ref(false);
watchEffect(() => {
document.body.style.background = s.bg;
});
async function copy() {
try {
await navigator.clipboard.writeText(css.value);
copied.value = true;
setTimeout(() => (copied.value = false), 1500);
} catch {
alert('Kopieren fehlgeschlagen — bitte manuell aus dem Code-Feld kopieren.');
}
}
// v-model bindings own the values, so restore defaults explicitly on reset.
function reset() {
Object.assign(s, defaults);
}
</script>
<template>
<div class="logo" :style="logoCss">{{ s.text || ' ' }}</div>
<details class="disclosure" id="panel" open>
<summary class="toggle-panel">Panel ein/aus</summary>
<div class="panel">
<h1>Logo-Generator</h1>
<form id="logoForm" @submit.prevent @reset.prevent="reset">
<h2>Inhalt</h2>
<p class="hint" id="hint-text">Mehrere Zeilen mit Enter trennen.</p>
<textarea id="text" rows="2" aria-label="Logo-Text" aria-describedby="hint-text" v-model="s.text"></textarea>
<h2>Schrift</h2>
<select id="font" aria-label="Schriftart" v-model="s.font">
<option v-for="f in fonts" :key="f" :value="f">{{ FONT_LABELS[f] || f }}</option>
</select>
<div class="row-2col">
<div>
<label for="fs">Größe: <span class="val">{{ s.fs }}</span>vw</label>
<input type="range" id="fs" min="6" max="30" step="0.5" v-model.number="s.fs" />
</div>
<div>
<label for="lh">Zeilenabstand: <span class="val">{{ s.lh.toFixed(2) }}</span></label>
<input type="range" id="lh" min="0.5" max="2" step="0.05" v-model.number="s.lh" />
</div>
</div>
<label for="ls">Buchstabenabstand: <span class="val">{{ s.ls.toFixed(3) }}</span>em</label>
<input type="range" id="ls" min="-0.15" max="0.3" step="0.005" v-model.number="s.ls" />
<h2>Farben</h2>
<div class="color-row">
<input type="color" id="c-bg" v-model="s.bg" aria-labelledby="lbl-bg" />
<span class="swatch-label" id="lbl-bg">Hintergrund</span>
<span class="hex">{{ s.bg }}</span>
</div>
<div class="color-row">
<input type="color" id="c-face" v-model="s.face" aria-labelledby="lbl-face" />
<span class="swatch-label" id="lbl-face">Face</span>
<span class="hex">{{ s.face }}</span>
</div>
<div class="color-row">
<input type="color" id="c-depth" v-model="s.depth" aria-labelledby="lbl-depth" />
<span class="swatch-label" id="lbl-depth">Tiefe</span>
<span class="hex">{{ s.depth }}</span>
</div>
<div class="color-row">
<input type="color" id="c-shadow" v-model="s.shadow" aria-labelledby="lbl-shadow" />
<span class="swatch-label" id="lbl-shadow">Schatten &amp; Kontur</span>
<span class="hex">{{ s.shadow }}</span>
</div>
<h2>Lichtrichtung</h2>
<p class="hint">Steuert alle Versätze gleichzeitig — Schatten geht in Lichtrichtung, Tiefe entgegen.</p>
<label for="angle">Winkel: <span class="val">{{ s.angle }}</span>° (0=oben, 90=rechts, 180=unten)</label>
<input type="range" id="angle" min="0" max="359" v-model.number="s.angle" />
<h2>Schichten</h2>
<p class="hint">Hinten nach vorn: Schatten · Tiefe · Kontur · Face</p>
<label for="shadow-len">Schatten-Länge: <span class="val">{{ s.shadowLen }}</span>px</label>
<input type="range" id="shadow-len" min="0" max="80" v-model.number="s.shadowLen" />
<label for="depth-len">Tiefe (in Gegenrichtung): <span class="val">{{ s.depthLen }}</span>px</label>
<input type="range" id="depth-len" min="0" max="30" v-model.number="s.depthLen" />
<label for="contour-len">Kontur (vor der Tiefe): <span class="val">{{ s.contourLen }}</span>px</label>
<input type="range" id="contour-len" min="0" max="20" v-model.number="s.contourLen" />
<h2>Komposition</h2>
<div class="row-2col">
<div>
<label for="rot">Drehung: <span class="val">{{ s.rot }}</span>°</label>
<input type="range" id="rot" min="-25" max="25" v-model.number="s.rot" />
</div>
<div>
<label for="skew">Schräge: <span class="val">{{ s.skew }}</span>°</label>
<input type="range" id="skew" min="-20" max="20" v-model.number="s.skew" />
</div>
</div>
<h2>Generiertes CSS</h2>
<code id="cssout">{{ css }}</code>
<button type="button" class="copy-btn" :class="{ copied }" @click="copy">
{{ copied ? 'Kopiert!' : 'CSS kopieren' }}
</button>
<button type="reset" class="reset-btn">Zurücksetzen</button>
</form>
</div>
</details>
</template>
+5
View File
@@ -0,0 +1,5 @@
import { createApp } from 'vue';
import App from './App.vue';
import './style.css';
createApp(App).mount('#app');
-200
View File
@@ -1,200 +0,0 @@
---
import { defaults, fonts } from '../logo.js';
import '../styles/style.css';
const FONT_LABELS = { Impact: 'Impact (System)' };
---
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Logo-Generator</title>
<link href="https://fonts.googleapis.com/css2?family=Anton&family=Bowlby+One&family=Bebas+Neue&family=Bungee&family=Passion+One:wght@900&family=Ultra&display=swap" rel="stylesheet" />
</head>
<body>
<div class="logo" id="logo">{defaults.text}</div>
<details class="disclosure" id="panel" open>
<summary class="toggle-panel">Panel ein/aus</summary>
<div class="panel">
<h1>Logo-Generator</h1>
<form id="logoForm">
<h2>Inhalt</h2>
<p class="hint" id="hint-text">Mehrere Zeilen mit Enter trennen.</p>
<textarea id="text" rows="2" aria-label="Logo-Text" aria-describedby="hint-text">{defaults.text}</textarea>
<h2>Schrift</h2>
<select id="font" aria-label="Schriftart">
{fonts.map((f) => <option value={f}>{FONT_LABELS[f] ?? f}</option>)}
</select>
<div class="row-2col">
<div>
<label for="fs">Größe: <span class="val" id="v-fs">{defaults.fs}</span>vw</label>
<input type="range" id="fs" min="6" max="30" step="0.5" value={defaults.fs} />
</div>
<div>
<label for="lh">Zeilenabstand: <span class="val" id="v-lh">{defaults.lh.toFixed(2)}</span></label>
<input type="range" id="lh" min="0.5" max="2" step="0.05" value={defaults.lh} />
</div>
</div>
<label for="ls">Buchstabenabstand: <span class="val" id="v-ls">{defaults.ls.toFixed(3)}</span>em</label>
<input type="range" id="ls" min="-0.15" max="0.3" step="0.005" value={defaults.ls} />
<h2>Farben</h2>
<div class="color-row">
<input type="color" id="c-bg" value={defaults.bg} aria-labelledby="lbl-bg" />
<span class="swatch-label" id="lbl-bg">Hintergrund</span>
<span class="hex" id="hex-bg">{defaults.bg}</span>
</div>
<div class="color-row">
<input type="color" id="c-face" value={defaults.face} aria-labelledby="lbl-face" />
<span class="swatch-label" id="lbl-face">Face</span>
<span class="hex" id="hex-face">{defaults.face}</span>
</div>
<div class="color-row">
<input type="color" id="c-depth" value={defaults.depth} aria-labelledby="lbl-depth" />
<span class="swatch-label" id="lbl-depth">Tiefe</span>
<span class="hex" id="hex-depth">{defaults.depth}</span>
</div>
<div class="color-row">
<input type="color" id="c-shadow" value={defaults.shadow} aria-labelledby="lbl-shadow" />
<span class="swatch-label" id="lbl-shadow">Schatten &amp; Kontur</span>
<span class="hex" id="hex-shadow">{defaults.shadow}</span>
</div>
<h2>Lichtrichtung</h2>
<p class="hint">Steuert alle Versätze gleichzeitig — Schatten geht in Lichtrichtung, Tiefe entgegen.</p>
<label for="angle">Winkel: <span class="val" id="v-angle">{defaults.angle}</span>° (0=oben, 90=rechts, 180=unten)</label>
<input type="range" id="angle" min="0" max="359" value={defaults.angle} />
<h2>Schichten</h2>
<p class="hint">Hinten nach vorn: Schatten · Tiefe · Kontur · Face</p>
<label for="shadow-len">Schatten-Länge: <span class="val" id="v-shadow">{defaults.shadowLen}</span>px</label>
<input type="range" id="shadow-len" min="0" max="80" value={defaults.shadowLen} />
<label for="depth-len">Tiefe (in Gegenrichtung): <span class="val" id="v-depth">{defaults.depthLen}</span>px</label>
<input type="range" id="depth-len" min="0" max="30" value={defaults.depthLen} />
<label for="contour-len">Kontur (vor der Tiefe): <span class="val" id="v-contour">{defaults.contourLen}</span>px</label>
<input type="range" id="contour-len" min="0" max="20" value={defaults.contourLen} />
<h2>Komposition</h2>
<div class="row-2col">
<div>
<label for="rot">Drehung: <span class="val" id="v-rot">{defaults.rot}</span>°</label>
<input type="range" id="rot" min="-25" max="25" value={defaults.rot} />
</div>
<div>
<label for="skew">Schräge: <span class="val" id="v-skew">{defaults.skew}</span>°</label>
<input type="range" id="skew" min="-20" max="20" value={defaults.skew} />
</div>
</div>
<h2>Generiertes CSS</h2>
<code id="cssout"></code>
<button type="button" class="copy-btn" id="copyBtn">CSS kopieren</button>
<button type="reset" class="reset-btn" id="resetBtn">Zurücksetzen</button>
</form>
</div>
</details>
<script>
import { inlineTextShadow, cssOutput } from '../logo.js';
const $ = (id) => document.getElementById(id);
const logo = $('logo');
const cssout = $('cssout');
const NUM = {
fs: 'fs',
lh: 'lh',
ls: 'ls',
angle: 'angle',
shadowLen: 'shadow-len',
depthLen: 'depth-len',
contourLen: 'contour-len',
rot: 'rot',
skew: 'skew',
};
function readState() {
return {
text: $('text').value || ' ',
font: $('font').value,
fs: +$('fs').value,
lh: +$('lh').value,
ls: +$('ls').value,
bg: $('c-bg').value,
face: $('c-face').value,
depth: $('c-depth').value,
shadow: $('c-shadow').value,
angle: +$('angle').value,
shadowLen: +$('shadow-len').value,
depthLen: +$('depth-len').value,
contourLen: +$('contour-len').value,
rot: +$('rot').value,
skew: +$('skew').value,
};
}
function render() {
const s = readState();
$('v-fs').textContent = s.fs;
$('v-lh').textContent = s.lh.toFixed(2);
$('v-ls').textContent = s.ls.toFixed(3);
$('v-angle').textContent = s.angle;
$('v-shadow').textContent = s.shadowLen;
$('v-depth').textContent = s.depthLen;
$('v-contour').textContent = s.contourLen;
$('v-rot').textContent = s.rot;
$('v-skew').textContent = s.skew;
$('hex-bg').textContent = s.bg;
$('hex-face').textContent = s.face;
$('hex-depth').textContent = s.depth;
$('hex-shadow').textContent = s.shadow;
logo.textContent = s.text;
logo.style.textShadow = inlineTextShadow(s);
logo.style.transform = `rotate(${s.rot}deg) skewX(${s.skew}deg)`;
logo.style.fontFamily = `'${s.font}', 'Bebas Neue', Impact, sans-serif`;
logo.style.color = s.face;
logo.style.fontSize = s.fs + 'vw';
logo.style.lineHeight = s.lh;
logo.style.letterSpacing = s.ls + 'em';
document.body.style.background = s.bg;
cssout.textContent = cssOutput(s);
}
document
.querySelectorAll('#logoForm input, #logoForm select, #logoForm textarea')
.forEach((el) => el.addEventListener('input', render));
$('copyBtn').addEventListener('click', async () => {
try {
await navigator.clipboard.writeText(cssout.textContent);
const btn = $('copyBtn');
btn.textContent = 'Kopiert!';
btn.classList.add('copied');
setTimeout(() => {
btn.textContent = 'CSS kopieren';
btn.classList.remove('copied');
}, 1500);
} catch {
alert('Kopieren fehlgeschlagen — bitte manuell aus dem Code-Feld kopieren.');
}
});
// Native reset restores each field to its value= attribute; re-render next tick.
const form = $('logoForm');
form.addEventListener('reset', () => setTimeout(render, 0));
form.addEventListener('submit', (e) => e.preventDefault());
render();
</script>
</body>
</html>
+1
View File
@@ -9,6 +9,7 @@ body {
overflow: hidden;
transition: background 0.15s;
}
#app { display: contents; }
.logo {
font-size: 18vw;
font-weight: 400;
+6
View File
@@ -0,0 +1,6 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
plugins: [vue()],
});