feat: add info\warning badge, update size range workflow

This commit is contained in:
2026-10-06 15:30:24 +05:00
parent ba533e67fd
commit 92cc590959
19 changed files with 402 additions and 194 deletions
@@ -13,11 +13,25 @@
label: string;
value: unknown;
spec: FieldSpec;
/** Размеры входа шага: потолок осей для maxFromSource-полей. */
sourceDims?: Dimension;
onchange?: (value: Dimension, axis?: "width" | "height" | "both") => void;
}
let { label, value, spec, onchange }: Props = $props();
let {
label,
value,
spec,
sourceDims = undefined,
onchange,
}: Props = $props();
const sp = $derived(spec as DimensionSpec);
const maxW = $derived(
sp.maxFromSource && sourceDims ? sourceDims.width : sp.max,
);
const maxH = $derived(
sp.maxFromSource && sourceDims ? sourceDims.height : sp.max,
);
const current = $derived.by(() => {
const v = value as Partial<Dimension> | undefined;
return {
@@ -49,7 +63,7 @@
<input
type="number"
min={sp.min}
max={sp.max}
max={maxW}
value={current.width}
oninput={(e) =>
setAxis("width", Number((e.target as HTMLInputElement).value))}
@@ -60,7 +74,7 @@
<input
type="number"
min={sp.min}
max={sp.max}
max={maxH}
value={current.height}
oninput={(e) =>
setAxis("height", Number((e.target as HTMLInputElement).value))}