Migrate to svelte 5

This commit is contained in:
kwaroran
2024-10-23 02:31:37 +09:00
parent e434c7ab96
commit c7330719ad
120 changed files with 2398 additions and 2033 deletions

View File

@@ -4,8 +4,9 @@
import { DataBase } from "../../ts/storage/database";
import { EditIcon, PlusIcon, TrashIcon, XIcon } from "lucide-svelte";
import TextInput from "../UI/GUI/TextInput.svelte";
let editMode = false
export let close = () => {}
let editMode = $state(false)
/** @type {{close?: any}} */
let { close = () => {} } = $props();
</script>
<div class="absolute w-full h-full z-40 bg-black bg-opacity-50 flex justify-center items-center">
@@ -13,13 +14,13 @@
<div class="flex items-center text-textcolor mb-4">
<h2 class="mt-0 mb-0">{language.loreBook}</h2>
<div class="flex-grow flex justify-end">
<button class="text-textcolor2 hover:text-green-500 mr-2 cursor-pointer items-center" on:click={close}>
<button class="text-textcolor2 hover:text-green-500 mr-2 cursor-pointer items-center" onclick={close}>
<XIcon size={24}/>
</button>
</div>
</div>
{#each $DataBase.loreBook as lore, ind}
<button on:click={() => {
<button onclick={() => {
if(!editMode){
$DataBase.loreBookPage = ind
}
@@ -30,7 +31,7 @@
<span>{lore.name}</span>
{/if}
<div class="flex-grow flex justify-end">
<div class="text-textcolor2 hover:text-green-500 cursor-pointer" on:click={async (e) => {
<div class="text-textcolor2 hover:text-green-500 cursor-pointer" onclick={async (e) => {
e.stopPropagation()
if($DataBase.loreBook.length === 1){
return
@@ -49,7 +50,7 @@
</button>
{/each}
<div class="flex mt-2 items-center">
<button class="text-textcolor2 hover:text-green-500 cursor-pointer mr-1" on:click={() => {
<button class="text-textcolor2 hover:text-green-500 cursor-pointer mr-1" onclick={() => {
let loreBooks = $DataBase.loreBook
let newLoreBook = {
name: `New LoreBook`,
@@ -61,7 +62,7 @@
}}>
<PlusIcon/>
</button>
<button class="text-textcolor2 hover:text-green-500 cursor-pointer" on:click={() => {
<button class="text-textcolor2 hover:text-green-500 cursor-pointer" onclick={() => {
editMode = !editMode
}}>
<EditIcon size={18}/>