feat: initialize Svelte frontend with Vite and TypeScript

- Added package.json for project configuration and dependencies.
- Included images for the application (teh-jokur.png and vite.svg).
- Created main application structure with App.svelte, CounterCard.svelte, and AddCounterCard.svelte components.
- Implemented functionality for adding, editing, incrementing, and decrementing counters.
- Added clickOutside utility for handling outside clicks in editing mode.
- Configured TypeScript with appropriate tsconfig files for app and node.
- Set up Vite configuration for building the application.
- Added global styles in app.css for consistent UI design.
This commit is contained in:
2025-11-10 23:52:12 +01:00
commit 3d9f7d2052
23 changed files with 4658 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
export function clickOutside(node: HTMLElement, callback: () => void) {
const handleClick = (event: MouseEvent) => {
if (!node.contains(event.target as Node)) {
callback();
}
};
document.addEventListener('mousedown', handleClick, true);
return {
destroy() {
document.removeEventListener('mousedown', handleClick, true);
}
};
}