export type ElementKind = "ring" | "arc"; export type TattingElement = { id: string; kind: ElementKind; picots: number; radius: number; x: number; y: number; rotation: number; color: string; mirrored: boolean; }; export const GRID = 10; export const snap = (v: number) => Math.round(v / GRID) * GRID; export const PALETTE: { name: string; value: string }[] = [ { name: "Gold", value: "#c9962b" }, { name: "Silver", value: "#9aa3ad" }, { name: "Purple", value: "#6b4a8f" }, { name: "Rose", value: "#c26a76" }, { name: "Sage", value: "#6f8f6a" }, { name: "Indigo", value: "#3f5288" }, { name: "Copper", value: "#b06a3b" }, { name: "Ink", value: "#2b2b2f" }, { name: "Ivory", value: "#e8dfcd" }, { name: "Teal", value: "#2f7d7a" }, ]; export const LIBRARY: { label: string; kind: ElementKind; picots: number; radius: number; }[] = [ { label: "Ring 4", kind: "ring", picots: 4, radius: 30 }, { label: "Ring 6", kind: "ring", picots: 6, radius: 34 }, { label: "Ring 8", kind: "ring", picots: 8, radius: 38 }, { label: "Ring 12", kind: "ring", picots: 12, radius: 44 }, { label: "Arc 3", kind: "arc", picots: 3, radius: 40 }, { label: "Arc 5", kind: "arc", picots: 5, radius: 50 }, { label: "Arc 7", kind: "arc", picots: 7, radius: 60 }, ]; export const uid = () => Math.random().toString(36).slice(2, 10);