From 326aedb3fdde45a7e9fdde21a759f2a119c9fc37 Mon Sep 17 00:00:00 2001 From: Sam Lavigne Date: Tue, 22 Aug 2023 12:05:49 -0400 Subject: [PATCH] playing with graphs --- package-lock.json | 10 +++ package.json | 1 + src/App.svelte | 20 +++-- src/Filter.svelte | 6 +- src/FilterPicker.svelte | 14 +--- src/Graph.svelte | 164 ++++++++++++++++++++++++++++++++++++++++ src/Input.svelte | 7 +- src/stores.js | 52 ++++++++++++- 8 files changed, 247 insertions(+), 27 deletions(-) create mode 100644 src/Graph.svelte diff --git a/package-lock.json b/package-lock.json index 031025d..cf74935 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@sveltejs/vite-plugin-svelte": "^2.4.2", "svelte": "^4.0.5", "svelte-dnd-action": "^0.9.25", + "svelvet": "^8.1.0", "uuid": "^9.0.0", "vite": "^4.4.5" } @@ -842,6 +843,15 @@ "svelte": "^3.19.0 || ^4.0.0" } }, + "node_modules/svelvet": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/svelvet/-/svelvet-8.1.0.tgz", + "integrity": "sha512-rH67tgb7e2aTBQZBCW+V5hSvulLwvzBiOml9Dzdz2ATkgQr58mHi2WtlQFOOb+eZt6zH/J10a2MataC29Qdpuw==", + "dev": true, + "peerDependencies": { + "svelte": ">=3.59.2 || ^4.0.0" + } + }, "node_modules/uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", diff --git a/package.json b/package.json index 5e9ed9f..64166c0 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@sveltejs/vite-plugin-svelte": "^2.4.2", "svelte": "^4.0.5", "svelte-dnd-action": "^0.9.25", + "svelvet": "^8.1.0", "uuid": "^9.0.0", "vite": "^4.4.5" }, diff --git a/src/App.svelte b/src/App.svelte index cc0acf8..447d86a 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,10 +1,11 @@ + + + {#each $inputs as inp, index} + +
+
+ {inp} +
+ +
+
+ +
v
+
+ +
a
+
+
+
+ {/each} + + {#each $filters as f, index} + +
+
+ {f.name} +
+ +
+
+ {#each countCons(f).in as inp} + +
{inp}
+
+ {/each} +
+
+ {#each countCons(f).out as out} + +
{out}
+
+ {/each} +
+
+ {/each} + + +
+
+ {$output} +
+ +
+
+ +
v
+
+ +
a
+
+
+
+ +
+ + diff --git a/src/Input.svelte b/src/Input.svelte index 7d17220..cd3ca24 100644 --- a/src/Input.svelte +++ b/src/Input.svelte @@ -1,11 +1,12 @@ diff --git a/src/stores.js b/src/stores.js index c6e1556..f1538d1 100644 --- a/src/stores.js +++ b/src/stores.js @@ -1,5 +1,55 @@ +import { v4 as uuidv4 } from "uuid"; import { writable } from 'svelte/store'; -export const inputs = writable(["punch.mp4"]); +export const inputs = writable([{name: "punch.mp4", id: uuidv4()}]); export const output = writable("out.mp4"); export const filters = writable([]); + +export function addFilter(f) { + const newFilter = { ...f, filterId: f.id, id: uuidv4() }; + if (f.params) { + newFilter.params = f.params.map((p) => { + p.value = null; + if (p.default != null) p.value = p.default; + return p; + }); + } + filters.update((filts) => { + filts.push(newFilter) + return filts; + }) +} + +export function removeFilter(id) { + filters.update((filts) => { + const index = filts.findIndex((f) => f.id === id); + filts.splice(index, 1); + return filts; + }); +} + +export function addOutput(f) { + +} + +export function removeOutput(f) { + +} + +export function addInput(f) { + const newInput = {name: f, id: uuidv4()} + inputs.update((inps) => { + inps.push(newInput); + return inps; + }); + +} + +export function removeInput(id) { + inputs.update((inps) => { + const index = inps.findIndex((f) => f.id === id); + inps.splice(index, 1); + return inps; + }); + +}