feat: upgrade app to svelte-5

This commit is contained in:
max_richter 2024-11-02 17:21:04 +01:00
parent a87add30ff
commit fa659ab74e
12 changed files with 1754 additions and 7340 deletions

View File

@ -14,35 +14,34 @@
"@nodes/runtime": "link:../packages/runtime", "@nodes/runtime": "link:../packages/runtime",
"@nodes/ui": "link:../packages/ui", "@nodes/ui": "link:../packages/ui",
"@nodes/utils": "link:../packages/utils", "@nodes/utils": "link:../packages/utils",
"@sveltejs/kit": "^2.5.7", "@sveltejs/kit": "^2.7.4",
"@threlte/core": "^7.3.0", "@threlte/core": "8.0.0-next.23",
"@threlte/extras": "^8.11.2", "@threlte/extras": "9.0.0-next.33",
"@types/three": "^0.164.0", "@types/three": "^0.169.0",
"@unocss/reset": "^0.59.4", "@unocss/reset": "^0.63.6",
"comlink": "^4.4.1", "comlink": "^4.4.1",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"idb": "^8.0.0", "idb": "^8.0.0",
"jsondiffpatch": "^0.6.0", "jsondiffpatch": "^0.6.0",
"three": "^0.164.1" "three": "^0.170.0"
}, },
"devDependencies": { "devDependencies": {
"@iconify-json/tabler": "^1.1.110", "@iconify-json/tabler": "^1.2.7",
"@nodes/types": "link:../packages/types", "@nodes/types": "link:../packages/types",
"@sveltejs/adapter-static": "^3.0.1", "@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/vite-plugin-svelte": "^3.1.0", "@sveltejs/vite-plugin-svelte": "^4.0.0",
"@tsconfig/svelte": "^5.0.4", "@tsconfig/svelte": "^5.0.4",
"@types/file-saver": "^2.0.7", "@types/file-saver": "^2.0.7",
"@unocss/preset-icons": "^0.59.4", "@unocss/preset-icons": "^0.63.6",
"svelte": "^4.2.15", "svelte": "^5.1.9",
"svelte-check": "^3.7.0", "svelte-check": "^4.0.5",
"three-inspect": "^0.4.5", "tslib": "^2.8.1",
"tslib": "^2.6.2", "typescript": "^5.6.3",
"typescript": "^5.4.5", "unocss": "^0.63.6",
"unocss": "^0.59.4", "vite": "^5.4.10",
"vite": "^5.2.10", "vite-plugin-comlink": "^5.1.0",
"vite-plugin-comlink": "^4.0.3",
"vite-plugin-glsl": "^1.3.0", "vite-plugin-glsl": "^1.3.0",
"vite-plugin-wasm": "^3.3.0", "vite-plugin-wasm": "^3.3.0",
"vitest": "^1.5.3" "vitest": "^2.1.4"
} }
} }

View File

@ -38,9 +38,9 @@
updateSettings($settings); updateSettings($settings);
} }
manager.on("settings", (settings) => { manager.on("settings", (_settings) => {
settingTypes = settings.types; settingTypes = _settings.types;
$settings = settings.values; settings.set(_settings.values);
}); });
manager.on("result", (result) => { manager.on("result", (result) => {

View File

@ -24,6 +24,7 @@
<div class="wrapper"> <div class="wrapper">
<table> <table>
<tbody>
<tr on:click={() => ($open.runtime = !$open.runtime)}> <tr on:click={() => ($open.runtime = !$open.runtime)}>
<td>{$open.runtime ? "-" : "+"} runtime </td> <td>{$open.runtime ? "-" : "+"} runtime </td>
<td>{humanizeDuration(runtime || 1000)}</td> <td>{humanizeDuration(runtime || 1000)}</td>
@ -61,6 +62,7 @@
<td>faces </td> <td>faces </td>
<td>{humanizeNumber(faces || 0)}</td> <td>{humanizeNumber(faces || 0)}</td>
</tr> </tr>
</tbody>
</table> </table>
</div> </div>

View File

@ -6,10 +6,10 @@
type Button = { type: "button"; label?: string; callback: () => void }; type Button = { type: "button"; label?: string; callback: () => void };
type Input = NodeInput | Button; type InputType = NodeInput | Button;
interface Nested { interface Nested {
[key: string]: (Nested & { __title?: string }) | Input; [key: string]: (Nested & { __title?: string }) | InputType;
} }
export let id: string; export let id: string;
@ -24,7 +24,7 @@
export let depth = 0; export let depth = 0;
const keys = Object.keys(settings).filter((key) => key !== "__title"); const keys = Object.keys(settings).filter((key) => key !== "__title");
function isNodeInput(v: Input | Nested): v is Input { function isNodeInput(v: InputType | Nested): v is InputType {
return v && "type" in v; return v && "type" in v;
} }
</script> </script>

View File

@ -1,9 +1,9 @@
import { sveltekit } from '@sveltejs/kit/vite' import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite' import UnoCSS from 'unocss/vite';
import { defineConfig } from 'vite';
import comlink from 'vite-plugin-comlink';
import glsl from "vite-plugin-glsl"; import glsl from "vite-plugin-glsl";
import wasm from "vite-plugin-wasm"; import wasm from "vite-plugin-wasm";
import comlink from 'vite-plugin-comlink';
import UnoCSS from 'unocss/vite'
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [

View File

@ -16,6 +16,6 @@
}, },
"devDependencies": { "devDependencies": {
"comlink": "^4.4.1", "comlink": "^4.4.1",
"vite-plugin-comlink": "^4.0.3" "vite-plugin-comlink": "^5.1.0"
} }
} }

View File

@ -3,7 +3,7 @@
import type { Graph, RuntimeExecutor } from "@nodes/types"; import type { Graph, RuntimeExecutor } from "@nodes/types";
export class WorkerRuntimeExecutor implements RuntimeExecutor { export class WorkerRuntimeExecutor implements RuntimeExecutor {
private worker = new ComlinkWorker<typeof import('./worker-runtime-executor-backend.ts')>(new URL("./worker-runtime-executor-backend.ts", import.meta.url)); private worker = new ComlinkWorker<typeof import('./worker-runtime-executor-backend.ts')>(new URL("worker-runtime-executor-backend.ts", import.meta.url));
constructor() { constructor() {
} }
async execute(graph: Graph, settings: Record<string, unknown>) { async execute(graph: Graph, settings: Record<string, unknown>) {

View File

@ -13,6 +13,6 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"zod": "^3.23.5" "zod": "^3.23.8"
} }
} }

View File

@ -31,35 +31,35 @@
}, },
"devDependencies": { "devDependencies": {
"@storybook/addon-essentials": "^8.4.1", "@storybook/addon-essentials": "^8.4.1",
"@storybook/addon-svelte-csf": "^5.0.0-next.10", "@storybook/addon-svelte-csf": "5.0.0-next.10",
"@storybook/addon-themes": "^8.4.1", "@storybook/addon-themes": "^8.4.1",
"@storybook/svelte": "^8.4.1", "@storybook/svelte": "^8.4.1",
"@storybook/sveltekit": "^8.4.1", "@storybook/sveltekit": "^8.4.1",
"@sveltejs/adapter-static": "^3.0.1", "@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/kit": "^2.5.27", "@sveltejs/kit": "^2.7.4",
"@sveltejs/package": "^2.3.1", "@sveltejs/package": "^2.3.7",
"@sveltejs/vite-plugin-svelte": "^4.0.0", "@sveltejs/vite-plugin-svelte": "^4.0.0",
"@types/eslint": "^8.56.10", "@types/eslint": "^9.6.1",
"@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^7.7.1", "@typescript-eslint/parser": "^8.12.2",
"eslint": "^9.1.1", "eslint": "^9.14.0",
"eslint-plugin-storybook": "^0.10.1", "eslint-plugin-storybook": "^0.10.2",
"eslint-plugin-svelte": "^2.45.1", "eslint-plugin-svelte": "^2.46.0",
"publint": "^0.2.7", "publint": "^0.2.12",
"storybook": "^8.4.1", "storybook": "^8.4.1",
"svelte": "^5.0.0", "svelte": "^5.1.9",
"svelte-check": "^4.0.0", "svelte-check": "^4.0.5",
"tslib": "^2.6.2", "tslib": "^2.8.1",
"typescript": "^5.5.0", "typescript": "^5.6.3",
"vite": "^5.4.4", "vite": "^5.4.10",
"vitest": "^1.5.2" "vitest": "^2.1.4"
}, },
"svelte": "./dist/index.js", "svelte": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@nodes/types": "link:../types", "@nodes/types": "link:../types",
"@threlte/core": "^7.3.0", "@threlte/core": "^7.3.1",
"@threlte/extras": "^8.11.2" "@threlte/extras": "^8.12.0"
} }
} }

View File

@ -1,15 +1,11 @@
<script lang="ts"> <script lang="ts">
import { run } from 'svelte/legacy';
interface Props { interface Props {
value: boolean; value: boolean;
id?: string; id?: string;
} }
let { value = $bindable(), id = '' }: Props = $props(); let { value = $bindable(), id = '' }: Props = $props();
run(() => { $effect(() => {
if (typeof value === 'string') { if (typeof value === 'string') {
value = value === 'true'; value = value === 'true';
} else if (typeof value === 'number') { } else if (typeof value === 'number') {

View File

@ -13,7 +13,7 @@
"@nodes/types": "link:../types" "@nodes/types": "link:../types"
}, },
"devDependencies": { "devDependencies": {
"vite": "^5.2.10", "vite": "^5.4.10",
"vitest": "^1.5.3" "vitest": "^2.1.4"
} }
} }

File diff suppressed because it is too large Load Diff