-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
475 changed files
with
5,686 additions
and
5,870 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bunx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock | ||
bun.lockb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"singleQuote": false, | ||
"trailingComma": "all", | ||
"semi": false, | ||
"printWidth": 120, | ||
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss", "prettier-plugin-tailwindcss"], | ||
"overrides": [ | ||
{ | ||
"files": "*.svelte", | ||
"options": { | ||
"parser": "svelte" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
# Elysia with Bun runtime | ||
|
||
## Getting Started | ||
|
||
To get started with this template, simply paste this command into your terminal: | ||
|
||
```bash | ||
bun create elysia ./elysia-example | ||
``` | ||
|
||
## Development | ||
|
||
To start the development server run: | ||
|
||
```bash | ||
bun run dev | ||
``` | ||
|
||
Open http://localhost:3000/ with your browser to see the result. | ||
Open http://localhost:3000/ with your browser to see the result. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { createLogger } from '@undb/logger' | ||
import Elysia from 'elysia' | ||
import pkg from '../../package.json' | ||
import { createLogger } from "@undb/logger" | ||
import Elysia from "elysia" | ||
import pkg from "../../package.json" | ||
|
||
export const loggerPlugin = () => new Elysia().decorate('logger', createLogger(pkg.name)) | ||
export const loggerPlugin = () => new Elysia().decorate("logger", createLogger(pkg.name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import { invoke } from "@tauri-apps/api/tauri"; | ||
import { invoke } from "@tauri-apps/api/tauri" | ||
|
||
let greetInputEl: HTMLInputElement | null; | ||
let greetMsgEl: HTMLElement | null; | ||
let greetInputEl: HTMLInputElement | null | ||
let greetMsgEl: HTMLElement | null | ||
|
||
async function greet() { | ||
if (greetMsgEl && greetInputEl) { | ||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command | ||
greetMsgEl.textContent = await invoke("greet", { | ||
name: greetInputEl.value, | ||
}); | ||
}) | ||
} | ||
} | ||
|
||
window.addEventListener("DOMContentLoaded", () => { | ||
greetInputEl = document.querySelector("#greet-input"); | ||
greetMsgEl = document.querySelector("#greet-msg"); | ||
greetInputEl = document.querySelector("#greet-input") | ||
greetMsgEl = document.querySelector("#greet-msg") | ||
document.querySelector("#greet-form")?.addEventListener("submit", (e) => { | ||
e.preventDefault(); | ||
greet(); | ||
}); | ||
}); | ||
e.preventDefault() | ||
greet() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
// See https://kit.svelte.dev/docs/types#app | ||
// for information about these interfaces | ||
declare global { | ||
namespace App { | ||
// interface Error {} | ||
// interface Locals {} | ||
// interface PageData {} | ||
// interface PageState {} | ||
// interface Platform {} | ||
} | ||
namespace App { | ||
// interface Error {} | ||
// interface Locals {} | ||
// interface PageData {} | ||
// interface PageState {} | ||
// interface Platform {} | ||
} | ||
} | ||
|
||
export {}; | ||
export {} |
10 changes: 5 additions & 5 deletions
10
apps/frontend/src/lib/components/blocks/create-record/create-record-button.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<script lang="ts"> | ||
import { Button } from '$lib/components/ui/button'; | ||
import { BetweenHorizonalEnd } from 'lucide-svelte'; | ||
import { createRecordSheetOpen } from './create-record.store'; | ||
import { Button } from "$lib/components/ui/button" | ||
import { BetweenHorizonalEnd } from "lucide-svelte" | ||
import { createRecordSheetOpen } from "./create-record.store" | ||
</script> | ||
|
||
<Button size="sm" on:click={() => ($createRecordSheetOpen = true)}> | ||
<BetweenHorizonalEnd class="mr-1 h-4 w-4" /> | ||
Create Record | ||
<BetweenHorizonalEnd class="mr-1 h-4 w-4" /> | ||
Create Record | ||
</Button> |
36 changes: 18 additions & 18 deletions
36
apps/frontend/src/lib/components/blocks/create-record/create-record-sheet.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<script lang="ts"> | ||
import * as Sheet from '$lib/components/ui/sheet'; | ||
import type { SuperValidated } from 'sveltekit-superforms'; | ||
import CreateRecord from './create-record.svelte'; | ||
import Button from '$lib/components/ui/button/button.svelte'; | ||
import { createRecordSheetOpen } from './create-record.store'; | ||
import * as Sheet from "$lib/components/ui/sheet" | ||
import type { SuperValidated } from "sveltekit-superforms" | ||
import CreateRecord from "./create-record.svelte" | ||
import Button from "$lib/components/ui/button/button.svelte" | ||
import { createRecordSheetOpen } from "./create-record.store" | ||
export let data: SuperValidated<any>; | ||
export let data: SuperValidated<any> | ||
</script> | ||
|
||
<Sheet.Root bind:open={$createRecordSheetOpen}> | ||
<Sheet.Content class="flex flex-col sm:max-w-lg" transitionConfig={{ duration: 50 }}> | ||
<Sheet.Header> | ||
<Sheet.Title>Create Record</Sheet.Title> | ||
</Sheet.Header> | ||
<Sheet.Content class="flex flex-col sm:max-w-lg" transitionConfig={{ duration: 50 }}> | ||
<Sheet.Header> | ||
<Sheet.Title>Create Record</Sheet.Title> | ||
</Sheet.Header> | ||
|
||
<div class="flex-1"> | ||
<CreateRecord {data} /> | ||
</div> | ||
<div class="flex-1"> | ||
<CreateRecord {data} /> | ||
</div> | ||
|
||
<Sheet.Footer> | ||
<Button variant="outline" type="button" on:click={() => ($createRecordSheetOpen = false)}>Cancel</Button> | ||
<Button type="submit" form="createRecord">Create</Button> | ||
</Sheet.Footer> | ||
</Sheet.Content> | ||
<Sheet.Footer> | ||
<Button variant="outline" type="button" on:click={() => ($createRecordSheetOpen = false)}>Cancel</Button> | ||
<Button type="submit" form="createRecord">Create</Button> | ||
</Sheet.Footer> | ||
</Sheet.Content> | ||
</Sheet.Root> |
4 changes: 2 additions & 2 deletions
4
apps/frontend/src/lib/components/blocks/create-record/create-record.store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { writable } from 'svelte/store'; | ||
import { writable } from "svelte/store" | ||
|
||
export const createRecordSheetOpen = writable(false); | ||
export const createRecordSheetOpen = writable(false) |
104 changes: 52 additions & 52 deletions
104
apps/frontend/src/lib/components/blocks/create-record/create-record.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
<script lang="ts"> | ||
import * as Form from '$lib/components/ui/form'; | ||
import FieldIcon from '$lib/components/blocks/field-icon/field-icon.svelte'; | ||
import { getTable } from '$lib/store/table.store'; | ||
import { trpc } from '$lib/trpc/client'; | ||
import { createMutation, useQueryClient } from '@tanstack/svelte-query'; | ||
import FieldControl from '../field-control/field-control.svelte'; | ||
import type { SuperValidated } from 'sveltekit-superforms'; | ||
import { superForm } from 'sveltekit-superforms'; | ||
import { zodClient } from 'sveltekit-superforms/adapters'; | ||
import { createRecordSheetOpen } from './create-record.store'; | ||
import * as Form from "$lib/components/ui/form" | ||
import FieldIcon from "$lib/components/blocks/field-icon/field-icon.svelte" | ||
import { getTable } from "$lib/store/table.store" | ||
import { trpc } from "$lib/trpc/client" | ||
import { createMutation, useQueryClient } from "@tanstack/svelte-query" | ||
import FieldControl from "../field-control/field-control.svelte" | ||
import type { SuperValidated } from "sveltekit-superforms" | ||
import { superForm } from "sveltekit-superforms" | ||
import { zodClient } from "sveltekit-superforms/adapters" | ||
import { createRecordSheetOpen } from "./create-record.store" | ||
const table = getTable(); | ||
const schema = $table.schema.valuesSchema; | ||
const table = getTable() | ||
const schema = $table.schema.valuesSchema | ||
export let data: SuperValidated<any>; | ||
export let data: SuperValidated<any> | ||
const client = useQueryClient(); | ||
const client = useQueryClient() | ||
const createRecordMutation = createMutation({ | ||
mutationFn: trpc.record.create.mutate, | ||
onSettled: () => { | ||
$createRecordSheetOpen = false; | ||
client.invalidateQueries({ queryKey: ['records', $table.id.value] }); | ||
} | ||
}); | ||
const createRecordMutation = createMutation({ | ||
mutationFn: trpc.record.create.mutate, | ||
onSettled: () => { | ||
$createRecordSheetOpen = false | ||
client.invalidateQueries({ queryKey: ["records", $table.id.value] }) | ||
}, | ||
}) | ||
const createRecord = (values: any) => { | ||
$createRecordMutation.mutate({ | ||
tableId: $table.id.value, | ||
values | ||
}); | ||
}; | ||
const createRecord = (values: any) => { | ||
$createRecordMutation.mutate({ | ||
tableId: $table.id.value, | ||
values, | ||
}) | ||
} | ||
const form = superForm(data, { | ||
SPA: true, | ||
dataType: 'json', | ||
// @ts-ignore | ||
validators: zodClient(schema), | ||
resetForm: false, | ||
invalidateAll: false, | ||
onSubmit() { | ||
createRecord($formData); | ||
} | ||
}); | ||
const form = superForm(data, { | ||
SPA: true, | ||
dataType: "json", | ||
// @ts-ignore | ||
validators: zodClient(schema), | ||
resetForm: false, | ||
invalidateAll: false, | ||
onSubmit() { | ||
createRecord($formData) | ||
}, | ||
}) | ||
const { form: formData, enhance } = form; | ||
const { form: formData, enhance } = form | ||
</script> | ||
|
||
<form method="POST" use:enhance id="createRecord"> | ||
{#each $table.schema.fields as field} | ||
<Form.Field {form} name={field.id.value}> | ||
<Form.Control let:attrs> | ||
<Form.Label class="flex items-center gap-2"> | ||
<FieldIcon type={field.type} class="w-4 h-4" /> | ||
<span>{field.name.value}</span> | ||
{#each $table.schema.fields as field} | ||
<Form.Field {form} name={field.id.value}> | ||
<Form.Control let:attrs> | ||
<Form.Label class="flex items-center gap-2"> | ||
<FieldIcon type={field.type} class="h-4 w-4" /> | ||
<span>{field.name.value}</span> | ||
{#if field.required} | ||
<span class="text-red-500">*</span> | ||
<span class="text-red-500">*</span> | ||
{/if} | ||
</Form.Label> | ||
<FieldControl {...attrs} bind:value={$formData[field.id.value]} {field} /> | ||
</Form.Control> | ||
<Form.FieldErrors /> | ||
</Form.Field> | ||
{/each} | ||
</Form.Label> | ||
<FieldControl {...attrs} bind:value={$formData[field.id.value]} {field} /> | ||
</Form.Control> | ||
<Form.FieldErrors /> | ||
</Form.Field> | ||
{/each} | ||
</form> | ||
|
||
<!-- <SuperDebug data={$formData} /> --> |
Oops, something went wrong.