feat: Sammlung mit Favoriten, Verlauf, Schemata, Export und Import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ferdinand
2026-04-02 10:35:10 +02:00
parent 026e0c0e75
commit 3c9f5b183b
3 changed files with 256 additions and 5 deletions

View File

@@ -1,8 +1,8 @@
import { initEingabe } from './eingabe.js';
import { initPicker } from './picker.js';
import { initHarmonien } from './harmonien.js';
import { addFavorit, addColorToSchema, addToHistory, renderSammlung, exportCollection, importCollection } from './collection.js';
// Globaler State — aktive Farbe als { h, s, l } (HSL, 0-360, 0-100, 0-100)
// state.color is read-only from outside — always use setColor() to update,
// so that the colorChanged event is dispatched to all listening modules.
export const state = {
@@ -26,9 +26,14 @@ document.querySelectorAll('.tab-btn').forEach(btn => {
});
});
function addFavorit(hsl) { console.log('addFavorit', hsl); }
function addColorToSchema(hsl) { console.log('addColorToSchema', hsl); }
// Every color change goes into history
document.addEventListener('colorChanged', (e) => addToHistory(e.detail));
initEingabe(addFavorit, addColorToSchema);
initPicker(addFavorit, addColorToSchema);
initHarmonien(addFavorit, addColorToSchema);
document.getElementById('sammlung-export-btn').addEventListener('click', exportCollection);
document.getElementById('sammlung-import-btn').addEventListener('click', importCollection);
renderSammlung();