import { MetricField } from "./propertyPanelPrimitives"; import { PERCENT_PROPS, PROP_CONSTRAINTS, PROP_LABELS, PROP_TOOLTIPS, PROP_UNITS, clampPropertyValue, } from "./gsapAnimationConstants"; import { P } from "./panelTokens"; export const BOOLEAN_PROPS = new Set(["visibility"]); const STRING_PROPS = new Set(["filter", "clipPath"]); const FILTER_PRESETS = [ { label: "Blur", value: "blur(4px)" }, { label: "Bright", value: "brightness(1.5)" }, { label: "Gray", value: "grayscale(1)" }, { label: "None", value: "none" }, ]; const CLIP_PATH_PRESETS = [ { label: "Circle", value: "circle(50% at 50% 50%)" }, { label: "Inset", value: "inset(10%)" }, { label: "None", value: "none" }, ]; function isPercentProp(prop: string): boolean { return PERCENT_PROPS.has(prop); } function displayValue(prop: string, val: number | string): string { if (isPercentProp(prop)) return String(Math.round(Math.max(0, Math.min(1, Number(val))) * 100)); return String(val); } function adjustedValue(prop: string, raw: string): string { if (isPercentProp(prop)) return String(clampPropertyValue(prop, Number(raw) / 100)); const num = Number(raw); if (!Number.isNaN(num) && PROP_CONSTRAINTS[prop]) { return String(clampPropertyValue(prop, num)); } return raw; } function RemoveButton({ onClick, title }: { onClick: () => void; title: string }) { return ( ); } // fallow-ignore-next-line complexity export function PropertyRow({ prop, val, onCommit, onRemove, removeTitle, }: { prop: string; val: number | string; onCommit: (adjusted: string) => void; onRemove: () => void; removeTitle: string; }) { if (BOOLEAN_PROPS.has(prop)) { const isVisible = val === "visible" || val === 1; return (