fix(ui): add missing types
Some checks failed
🚀 Lint & Test & Deploy / release (pull_request) Failing after 2m45s

This commit is contained in:
2026-02-09 15:37:37 +01:00
parent b1cbd23542
commit 18802fdc10
5 changed files with 26 additions and 11 deletions

View File

@@ -32,6 +32,12 @@ export const NodeInputFloatSchema = z.object({
step: z.number().optional()
});
export const NodeInputColorSchema = z.object({
...DefaultOptionsSchema.shape,
type: z.literal('color'),
value: z.array(z.number()).optional()
});
export const NodeInputIntegerSchema = z.object({
...DefaultOptionsSchema.shape,
type: z.literal('integer'),
@@ -87,6 +93,7 @@ export const NodeInputSchema = z.union([
NodeInputSeedSchema,
NodeInputBooleanSchema,
NodeInputFloatSchema,
NodeInputColorSchema,
NodeInputIntegerSchema,
NodeInputShapeSchema,
NodeInputSelectSchema,

View File

@@ -29,7 +29,7 @@
{:else if input.type === 'shape'}
<InputShape bind:value={value as number[]} />
{:else if input.type === 'color'}
<InputColor bind:value={value as number[]} />
<InputColor bind:value={value as [number, number, number]} />
{:else if input.type === 'integer'}
<InputNumber
bind:value={value as number}

View File

@@ -51,7 +51,7 @@
if (mirror) {
const _points: [number, number, number][] = [];
for (let i = 0; i < points.length / 2; i++) {
const pt = [...getPt(i), i];
const pt = [...getPt(i), i] as [number, number, number];
if (pt[0] > 50) {
pt[0] = 100 - pt[0];
}

View File

@@ -37,7 +37,7 @@
</div>
<Section title="InputNumber">
<Theme theme />
<Theme />
</Section>
<Section title="InputNumber">

View File

@@ -1,12 +1,6 @@
<script lang="ts">
import { InputColor } from '$lib';
interface Props {
theme?: string;
}
let { theme }: Props = $props();
const colors = [
'layer-0',
'layer-1',
@@ -19,6 +13,20 @@
'text'
];
type CustomColors = {
text: [number, number, number];
outline: [number, number, number];
'layer-0': [number, number, number];
'layer-1': [number, number, number];
'layer-2': [number, number, number];
'layer-3': [number, number, number];
active: [number, number, number];
selected: [number, number, number];
connection: [number, number, number];
};
type CustomColorKey = keyof CustomColors;
let customColors = $state<CustomColors>({
text: [205, 214, 244],
outline: [62, 62, 79],
@@ -36,7 +44,7 @@
${
Object.keys(customColors)
.map((v) => {
return `--color-${v}: rgb(${customColors[v].join(',')});`;
return `--color-${v}: rgb(${customColors[v as CustomColorKey].join(',')});`;
})
.join('\n')
}
@@ -63,7 +71,7 @@
<div class="w-6 h-6 mr-2 my-1 rounded-sm outline-1 bg-{color}"></div>
</td>
<td>{color}</td>
<td>
<td>
<InputColor bind:value={customColors[color as CustomColorKey]} />
</td>
</tr>