feat: add icons
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m55s

This commit is contained in:
max_richter 2024-04-26 01:13:08 +02:00
parent bd359fbaf7
commit d06b33f508
9 changed files with 31 additions and 8 deletions

View File

@ -109,7 +109,7 @@
activeNodeId = node.id;
}}
>
{node.id}
{node.id.split("/").at(-1)}
</div>
{/each}
</div>

View File

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="17" y="8" width="5" height="7" rx="1" stroke="currentColor" stroke-width="2"/>
<rect x="2" y="3" width="5" height="7" rx="1" stroke="currentColor" stroke-width="2"/>
<rect x="2" y="14" width="5" height="7" rx="1" stroke="currentColor" stroke-width="2"/>
<path d="M16 10.5C9.33333 10.5 14.8889 6 8.22222 6H6M16 12.5C8.77778 12.5 14.8889 17 8.22222 17H6" stroke="currentColor" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 519 B

View File

@ -6,7 +6,7 @@
export let icon: string = "";
export let title = "";
export let classes = "";
export let hidden: boolean;
export let hidden: boolean | undefined = undefined;
const setVisibility =
getContext<(id: string, visible: boolean) => void>("setVisibility");
@ -21,7 +21,6 @@
>("registerPanel");
let visible = registerPanel(id, icon, classes);
console.log(id, $visible, hidden);
</script>
{#if $visible}

View File

@ -183,7 +183,7 @@
id="graph-settings"
title="Graph Settings"
classes="text-blue-400"
icon="i-tabler-brand-git"
icon="i-custom-graph"
>
{#if Object.keys(graphSettingTypes).length > 0}
<GraphSettings type={graphSettingTypes} store={graphSettings} />

View File

@ -2,10 +2,19 @@
import { defineConfig } from 'unocss'
import presetIcons from '@unocss/preset-icons'
import { presetUno } from 'unocss'
import fs from 'fs'
const icons = Object.fromEntries(fs.readdirSync('./src/lib/icons')
.map(name => [name.replace(".svg", ""), fs.readFileSync(`./src/lib/icons/${name}`, 'utf-8')]))
export default defineConfig({
presets: [
presetUno(),
presetIcons(),
presetIcons({
collections: {
custom: icons
}
}),
]
})

View File

@ -64,6 +64,14 @@
inputEl.focus();
}
if (value > max) {
max = value;
}
if (value < min) {
min = value;
}
// setTimeout(() => {
// if (value >= 0) {
// max = getBoundingValue(value);

View File

@ -7,6 +7,8 @@ import Select from "./elements/Select.svelte";
import Checkbox from "./elements/Checkbox.svelte";
import Details from "./Details.svelte";
export const icons = import.meta.glob('./icons/*.svg?raw', { eager: true })
export { Float, Integer, Select, Checkbox, Input, Details };
export default Input;

View File

@ -54,9 +54,7 @@ export function encodeNestedArray(array: SparseArray): number[] {
encoded.push(0, 1, 1, 1);
} else {
// Recursively encode non-empty arrays
console.log("recursing", item);
const child = encodeNestedArray(item);
console.log("recursed", child);
encoded.push(...child);
}
// Update missingBracketIndex to the position of the newly added bracket
@ -67,7 +65,6 @@ export function encodeNestedArray(array: SparseArray): number[] {
// Update the distance for the last opened bracket
if (missingBracketIndex) encoded[missingBracketIndex] = index + 2;
}
console.log(encoded, item);
}
return [...encoded, 1, 1];

View File

@ -108,6 +108,8 @@ importers:
nodes/max/plantarium/float: {}
nodes/max/plantarium/gravity: {}
nodes/max/plantarium/math: {}
nodes/max/plantarium/noise: {}