fix(ui): add missing types
Some checks failed
🚀 Lint & Test & Deploy / release (pull_request) Failing after 2m45s
Some checks failed
🚀 Lint & Test & Deploy / release (pull_request) Failing after 2m45s
This commit is contained in:
@@ -32,6 +32,12 @@ export const NodeInputFloatSchema = z.object({
|
|||||||
step: z.number().optional()
|
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({
|
export const NodeInputIntegerSchema = z.object({
|
||||||
...DefaultOptionsSchema.shape,
|
...DefaultOptionsSchema.shape,
|
||||||
type: z.literal('integer'),
|
type: z.literal('integer'),
|
||||||
@@ -87,6 +93,7 @@ export const NodeInputSchema = z.union([
|
|||||||
NodeInputSeedSchema,
|
NodeInputSeedSchema,
|
||||||
NodeInputBooleanSchema,
|
NodeInputBooleanSchema,
|
||||||
NodeInputFloatSchema,
|
NodeInputFloatSchema,
|
||||||
|
NodeInputColorSchema,
|
||||||
NodeInputIntegerSchema,
|
NodeInputIntegerSchema,
|
||||||
NodeInputShapeSchema,
|
NodeInputShapeSchema,
|
||||||
NodeInputSelectSchema,
|
NodeInputSelectSchema,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
{:else if input.type === 'shape'}
|
{:else if input.type === 'shape'}
|
||||||
<InputShape bind:value={value as number[]} />
|
<InputShape bind:value={value as number[]} />
|
||||||
{:else if input.type === 'color'}
|
{:else if input.type === 'color'}
|
||||||
<InputColor bind:value={value as number[]} />
|
<InputColor bind:value={value as [number, number, number]} />
|
||||||
{:else if input.type === 'integer'}
|
{:else if input.type === 'integer'}
|
||||||
<InputNumber
|
<InputNumber
|
||||||
bind:value={value as number}
|
bind:value={value as number}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
if (mirror) {
|
if (mirror) {
|
||||||
const _points: [number, number, number][] = [];
|
const _points: [number, number, number][] = [];
|
||||||
for (let i = 0; i < points.length / 2; i++) {
|
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) {
|
if (pt[0] > 50) {
|
||||||
pt[0] = 100 - pt[0];
|
pt[0] = 100 - pt[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Section title="InputNumber">
|
<Section title="InputNumber">
|
||||||
<Theme theme />
|
<Theme />
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section title="InputNumber">
|
<Section title="InputNumber">
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { InputColor } from '$lib';
|
import { InputColor } from '$lib';
|
||||||
|
|
||||||
interface Props {
|
|
||||||
theme?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
let { theme }: Props = $props();
|
|
||||||
|
|
||||||
const colors = [
|
const colors = [
|
||||||
'layer-0',
|
'layer-0',
|
||||||
'layer-1',
|
'layer-1',
|
||||||
@@ -19,6 +13,20 @@
|
|||||||
'text'
|
'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>({
|
let customColors = $state<CustomColors>({
|
||||||
text: [205, 214, 244],
|
text: [205, 214, 244],
|
||||||
outline: [62, 62, 79],
|
outline: [62, 62, 79],
|
||||||
@@ -36,7 +44,7 @@
|
|||||||
${
|
${
|
||||||
Object.keys(customColors)
|
Object.keys(customColors)
|
||||||
.map((v) => {
|
.map((v) => {
|
||||||
return `--color-${v}: rgb(${customColors[v].join(',')});`;
|
return `--color-${v}: rgb(${customColors[v as CustomColorKey].join(',')});`;
|
||||||
})
|
})
|
||||||
.join('\n')
|
.join('\n')
|
||||||
}
|
}
|
||||||
@@ -63,7 +71,7 @@
|
|||||||
<div class="w-6 h-6 mr-2 my-1 rounded-sm outline-1 bg-{color}"></div>
|
<div class="w-6 h-6 mr-2 my-1 rounded-sm outline-1 bg-{color}"></div>
|
||||||
</td>
|
</td>
|
||||||
<td>{color}</td>
|
<td>{color}</td>
|
||||||
<td>
|
<td>
|
||||||
<InputColor bind:value={customColors[color as CustomColorKey]} />
|
<InputColor bind:value={customColors[color as CustomColorKey]} />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user