import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from "react" import { swFooterAuxIcons, swFooterToolIcons, type SWFooterAuxItem, type SWFooterCategory, type SWFooterLayout, type SWFooterTool, } from "@hm-design/sw" import { PenLine, SquareDashed } from "lucide-react" import guideSheet from "./assets/figma-reference/footer/26-9096.png" // SW/Footer fixture: the Figma 26:10097 footer content as public-API data, like a consuming program builds it. /** Figma 도형 commands (26:10111): Line … Hatch, 9 slots. */ export const DRAW_TOOLS: SWFooterTool[] = [ { id: "line", label: "Line", ...swFooterToolIcons.line }, { id: "pline", label: "PLine", ariaLabel: "Polyline", ...swFooterToolIcons.pline }, { id: "arc", label: "Arc", ...swFooterToolIcons.arc }, { id: "circle", label: "Circle", ...swFooterToolIcons.circle }, { id: "ellipse", label: "Ellipse", ...swFooterToolIcons.ellipse }, { id: "rect", label: "Rect...", ariaLabel: "Rectangle", ...swFooterToolIcons.rect }, { id: "poly", label: "Poly", ariaLabel: "Polygon", ...swFooterToolIcons.poly }, { id: "point", label: "Point", ...swFooterToolIcons.point }, { id: "hatch", label: "Hatch", ...swFooterToolIcons.hatch }, ] /** Figma category row (text_도형 … text_구조배근). Only 도형 has Figma commands; 수정 shows the NCopy component (26:9739). */ export const CATEGORIES: SWFooterCategory[] = [ { id: "shape", label: "도형", tools: DRAW_TOOLS }, { id: "modify", label: "수정", tools: [{ id: "ncopy", label: "NCopy", ariaLabel: "Multiple copy", ...swFooterToolIcons.ncopy }] }, { id: "edit", label: "편집", tools: [] }, { id: "text", label: "문자", tools: [] }, { id: "layer", label: "레이어", tools: [] }, { id: "block", label: "블록", tools: [] }, { id: "view", label: "뷰", tools: [] }, { id: "select", label: "선택/조회", tools: [] }, { id: "road", label: "도로/횡단", tools: [] }, { id: "structure", label: "구조/배근", tools: [] }, ] /** Figma 26:10104 (3 × 2). */ export const AUX_ITEMS: SWFooterAuxItem[] = [ { id: "objectSnap", label: "객체스냅", icon: swFooterAuxIcons.objectSnap, pressed: false }, { id: "selectionEffect", label: "선택효과", icon: swFooterAuxIcons.selectionEffect, pressed: false }, { id: "orthogonal", label: "직각교차", icon: swFooterAuxIcons.orthogonal, pressed: false }, { id: "gridSnap", label: "격자스냅", icon: swFooterAuxIcons.gridSnap, pressed: false }, { id: "gridBackground", label: "격자배경", icon: swFooterAuxIcons.gridBackground, pressed: false }, { id: "lineWeight", label: "선가중치", icon: swFooterAuxIcons.lineWeight, pressed: false }, ] /** * Reference screen (2026-10-20, src/sw/assets/footer-reference): the program's own content in the same footer. * Labels, categories and the extra command are program data; WIPEOUT and 객체스냅추적 have no Figma icon, so the * Story passes its own (lucide) icons the way a program would. */ const lucide = (node: ReactNode) => {node} export const REFERENCE_TOOLS: SWFooterTool[] = [ { id: "line", label: "LINE", ...swFooterToolIcons.line }, { id: "pline", label: "PLINE", ariaLabel: "Polyline", ...swFooterToolIcons.pline }, { id: "arc", label: "ARC", ...swFooterToolIcons.arc }, { id: "circle", label: "CIRCLE", ...swFooterToolIcons.circle }, { id: "ellipse", label: "ELLIPSE", ...swFooterToolIcons.ellipse }, { id: "rect", label: "RECTA...", ariaLabel: "Rectangle", ...swFooterToolIcons.rect }, { id: "poly", label: "POLYGON", ...swFooterToolIcons.poly }, { id: "point", label: "POINT", ...swFooterToolIcons.point }, { id: "hatch", label: "HATCH", ...swFooterToolIcons.hatch }, { id: "wipeout", label: "WIPEOUT", icon: lucide() }, ] export const REFERENCE_CATEGORIES: SWFooterCategory[] = [ { id: "shape", label: "도형", tools: REFERENCE_TOOLS }, ...["수정", "편집", "문자", "치수/연산", "블록", "레이어", "뷰", "선택/조회", "모델링", "선형/횡단", "구조/배근"] .map((label, index) => ({ id: `c${index}`, label, tools: index === 0 ? CATEGORIES[1].tools : [] })), ] export const REFERENCE_AUX: SWFooterAuxItem[] = [ { id: "objectSnap", label: "객체스냅", icon: swFooterAuxIcons.objectSnap, pressed: false }, { id: "orthogonal", label: "직각교차", icon: swFooterAuxIcons.orthogonal, pressed: false }, { id: "lineWeight", label: "선가중치", icon: swFooterAuxIcons.lineWeight, pressed: false }, { id: "gridBackground", label: "격자배경", icon: swFooterAuxIcons.gridBackground, pressed: true }, { id: "gridSnap", label: "격자스냅", icon: swFooterAuxIcons.gridSnap, pressed: false }, { id: "objectTrack", label: "객체스냅추적", icon: lucide(), pressed: true }, ] export const REFERENCE_HISTORY = [ "Raster image support loaded.", "Command: PSLTSCALE", "Enter new value for PSLTSCALE : _ON", "Command: VSBACKGROUNDS", "Enter new value for VSBACKGROUNDS <1>: 1", ] export const LAYOUTS: SWFooterLayout[] = [ { id: "layout3", label: "Layout 03" }, { id: "layout2", label: "Layout 02" }, { id: "layout1", label: "Layout 01" }, ] export const HISTORY = [ "Fillet: [Polyline/Radius/Trim/Settings/Multiple]/