Initial commit
This commit is contained in:
commit
05892fc3be
16 changed files with 1974 additions and 0 deletions
38
README.md
Normal file
38
README.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# sv
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npx sv create
|
||||
|
||||
# create a new project in my-app
|
||||
npx sv create my-app
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
To create a production version of your app:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
You can preview the production build with `npm run preview`.
|
||||
|
||||
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
15
eslint.config.js
Normal file
15
eslint.config.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import js from '@eslint/js';
|
||||
import svelte from 'eslint-plugin-svelte';
|
||||
import globals from 'globals';
|
||||
|
||||
/** @type {import('eslint').Linter.Config[]} */
|
||||
export default [js.configs.recommended, ...svelte.configs["flat/recommended"], {
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node
|
||||
}
|
||||
}
|
||||
}, {
|
||||
ignores: ["build/", ".svelte-kit/", "dist/"]
|
||||
}];
|
19
jsconfig.json
Normal file
19
jsconfig.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"moduleResolution": "bundler"
|
||||
}
|
||||
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
||||
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
||||
//
|
||||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||
}
|
28
package.json
Normal file
28
package.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "bingo",
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/kit": "^2.0.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
||||
"eslint": "^9.7.0",
|
||||
"eslint-plugin-svelte": "^2.36.0",
|
||||
"globals": "^15.0.0",
|
||||
"svelte": "^5.0.0",
|
||||
"svelte-check": "^4.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"vite": "^5.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sveltejs/adapter-static": "^3.0.6",
|
||||
"pako": "^2.1.0"
|
||||
}
|
||||
}
|
1711
pnpm-lock.yaml
Normal file
1711
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load diff
13
src/app.d.ts
vendored
Normal file
13
src/app.d.ts
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
12
src/app.html
Normal file
12
src/app.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
20
src/lib/AIForm.svelte
Normal file
20
src/lib/AIForm.svelte
Normal file
|
@ -0,0 +1,20 @@
|
|||
<script>
|
||||
const { onGenerate = null } = $props();
|
||||
let query = $state('');
|
||||
|
||||
function onSubmit(e) {
|
||||
onGenerate?.(query);
|
||||
}
|
||||
</script>
|
||||
|
||||
<form onsubmit={onSubmit}>
|
||||
<label>AI: <input type="text" bind:value={query} /></label>
|
||||
<button type="submit">Generate</button>
|
||||
</form>
|
||||
|
||||
<style>
|
||||
form {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
</style>
|
30
src/lib/BingoCard.svelte
Normal file
30
src/lib/BingoCard.svelte
Normal file
|
@ -0,0 +1,30 @@
|
|||
<script>
|
||||
import BingoCardValue from '$lib/BingoCardValue.svelte';
|
||||
|
||||
const {spaces = []} = $props();
|
||||
</script>
|
||||
|
||||
<section class="bingo-card">
|
||||
{#each spaces as space, i}
|
||||
<BingoCardValue value={space}></BingoCardValue>
|
||||
{/each}
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.bingo-card {
|
||||
padding: 3px;
|
||||
aspect-ratio: 1 / 1;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
grid-template-rows: repeat(5, 1fr);
|
||||
grid-gap: 2px;
|
||||
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
@media (min-width: 960px) {
|
||||
.bingo-card {
|
||||
max-height: 80vh;
|
||||
}
|
||||
}
|
||||
</style>
|
26
src/lib/BingoCardValue.svelte
Normal file
26
src/lib/BingoCardValue.svelte
Normal file
|
@ -0,0 +1,26 @@
|
|||
<script>
|
||||
let {value = $bindable(''), editable = true} = $props();
|
||||
</script>
|
||||
|
||||
<div class='bingo-value'>
|
||||
{#if editable}
|
||||
<p contenteditable bind:innerHTML={value}></p>
|
||||
{:else }
|
||||
<p>{value}</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.bingo-value {
|
||||
display: flex;
|
||||
place-items: center;
|
||||
place-content: center;
|
||||
aspect-ratio: 1 / 1;
|
||||
|
||||
background-color: white;
|
||||
|
||||
p {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
1
src/lib/index.js
Normal file
1
src/lib/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
// place files you want to import through the `$lib` alias in this folder.
|
14
src/routes/+layout.svelte
Normal file
14
src/routes/+layout.svelte
Normal file
|
@ -0,0 +1,14 @@
|
|||
<script>
|
||||
const { children } = $props();
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
{@render children()}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
26
src/routes/+page.svelte
Normal file
26
src/routes/+page.svelte
Normal file
|
@ -0,0 +1,26 @@
|
|||
<script>
|
||||
import BingoCard from '$lib/BingoCard.svelte';
|
||||
import {browser} from '$app/environment';
|
||||
import pako from 'pako';
|
||||
|
||||
let spaces = $state([...Array(25).keys()].fill('Free Space', 12, 13));
|
||||
|
||||
$effect(() => {
|
||||
if (!browser) return;
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has('data')) {
|
||||
const textDecoder = new TextDecoder();
|
||||
const compressedData = Uint8Array.from(urlParams.get('data').split(',').map(Number))
|
||||
const jsonData = textDecoder.decode(pako.inflate(compressedData))
|
||||
spaces = JSON.parse(jsonData);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<h1>Bingo</h1>
|
||||
<BingoCard spaces={spaces} />
|
||||
</main>
|
||||
|
||||
<style>
|
||||
</style>
|
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
15
svelte.config.js
Normal file
15
svelte.config.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import adapter from '@sveltejs/adapter-static';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
kit: {
|
||||
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
||||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
||||
adapter: adapter({
|
||||
fallback: 'index.html'
|
||||
}),
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
6
vite.config.js
Normal file
6
vite.config.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [sveltekit()]
|
||||
});
|
Loading…
Reference in a new issue