import { Association, AssociationEnd, AssociationLayout, Attribute, Entity, EntityIndex, EntityLayout, Geo, GroupLayout, LogicalGroup, ModelId, Note, Operation, Point } from '../core/types'; import { Command } from './types'; /** * geo 외 EntityLayout 부가 필드(collapsed·displayMode·style·attributeStyles 등). * import 등 레이아웃 스타일까지 복제하는 경로에서 전달. entityRef·geo는 별도 인자라 제외. * locked는 뷰 어포던스라 호출자가 필요 시만 포함(import는 드롭). */ export type EntityLayoutExtras = Partial>; export declare function addEntity(entity: Entity, geo: Geo, extras?: EntityLayoutExtras): Command; /** 엔티티 삭제 — 참조 관계·레이아웃·그룹 멤버십까지 cascade. memento로 위치 보존 복원. */ export declare function removeEntity(entityId: ModelId): Command; /** 엔티티 필드 부분 수정 (name·stereotype·package·table·jpaAttrs·description 등). 얕은 patch. */ export declare function updateEntity(entityId: ModelId, patch: Partial): Command; export declare function renameEntity(entityId: ModelId, newName: string): Command; /** 엔티티 위치 이동 — 레이아웃만 변경 */ export declare function moveEntity(entityId: ModelId, location: Point): Command; /** * 엔티티 크기 변경 — 레이아웃만 변경 (그룹/노트 동형). * 저장값은 수동 지정 크기 그대로. 콘텐츠 실측 최소 이하로의 클램프는 렌더(CSS min-content)가 * 담당하므로(레거시 evaluateWidth/Height = max(geo, contentMin) 동형) 여기선 raw size를 보관한다. */ export declare function resizeEntity(entityId: ModelId, size: { width: number; height: number; }): Command; /** 엔티티 헤더 바 색상 변경 (레이아웃만 변경) */ export declare function setEntitySwatch(entityId: ModelId, token: string | null): Command; /** 엔티티 접기/펼치기 (레이아웃만 변경 — 속성/메서드 칸 렌더 게이트) */ export declare function setEntityCollapsed(entityId: ModelId, collapsed: boolean): Command; /** 엔티티 편집 잠금 토글 (레이아웃만 변경 — setEntityCollapsed 동형, LWW) */ export declare function setEntityLocked(entityId: ModelId, locked: boolean): Command; /** * 활성 다이어그램 전체 엔티티 접기/펼치기 (D2) — 사전 per-entity collapsed를 캡처한 단일 커맨드. * N개 개별 커맨드가 아니라 한 번의 undo로 각 엔티티의 직전 상태를 그대로 복원한다(혼재 상태 보존). */ export declare function setAllEntitiesCollapsed(collapsed: boolean): Command; /** 속성 강조 색상 변경 (레이아웃 attributeStyles[attrId]) */ export declare function setAttributeSwatch(entityId: ModelId, attributeId: ModelId, token: string | null): Command; /** geo 외 GroupLayout 부가 필드(style 등). entityLayout의 EntityLayoutExtras 거울. */ export type GroupLayoutExtras = Partial>; export declare function addGroup(group: LogicalGroup, geo: Geo, extras?: GroupLayoutExtras): Command; /** 그룹 필드 부분 수정 (name·description·packageName·excludeDDLGeneration). 얕은 patch. */ export declare function updateGroup(groupId: ModelId, patch: Partial): Command; /** 그룹 해제(삭제) — 멤버 엔티티는 남고 그룹/박스만 제거 */ export declare function removeGroup(groupId: ModelId): Command; export declare function addEntityToGroup(groupId: ModelId, entityId: ModelId): Command; export declare function removeEntityFromGroup(groupId: ModelId, entityId: ModelId): Command; export declare function moveGroup(groupId: ModelId, location: Point): Command; export declare function resizeGroup(groupId: ModelId, size: { width: number; height: number; }): Command; /** 그룹 색상 변경 (레이아웃만 변경 — setEntitySwatch와 동형) */ export declare function setGroupSwatch(groupId: ModelId, token: string | null): Command; /** 그룹 편집 잠금 토글 (레이아웃만 변경 — setEntityLocked 거울, LWW) */ export declare function setGroupLocked(groupId: ModelId, locked: boolean): Command; export declare function addAttribute(entityId: ModelId, attribute: Attribute): Command; /** 속성 필드 부분 수정 (name·type·dataType·dbAttrs·identifier·notNull 등). 얕은 patch. */ export declare function updateAttribute(entityId: ModelId, attributeId: ModelId, patch: Partial): Command; export declare function removeAttribute(entityId: ModelId, attributeId: ModelId): Command; /** * 속성 재정렬 — 대상(attrIds)을 현재 표시 순서를 유지한 채 toIndex로 이동. * 표시 순서 SoT는 `order` 필드다(S1 이후 전 뷰가 order sort). 배열도 splice로 함께 맞춰 두 표현을 * 일관 유지하고(캔버스 노드가 배열도 참조하는 전환기 안전), order 필드를 0..n-1로 전체 재인덱싱한다 * (중간 삭제로 생긴 기존 갭도 함께 치유). toIndex = 대상을 모두 제거한 뒤의 배열(rest) 기준 삽입 위치. * invert는 변경 전 배열 스냅샷(order 포함 얕은 복사)으로 통째 복원 → 재인덱싱 손실 없이 원자 원복. * emit은 order 패치(S3, orderPatchEmission) — 배열 $set 아님. */ export declare function reorderAttributes(entityId: ModelId, attrIds: ModelId[], toIndex: number): Command; export declare function addOperation(entityId: ModelId, operation: Operation): Command; /** 메서드 필드 부분 수정 (name·visibility·sourceCode·description 등). 얕은 patch. */ export declare function updateOperation(entityId: ModelId, operationId: ModelId, patch: Partial): Command; export declare function removeOperation(entityId: ModelId, operationId: ModelId): Command; /** * 메서드 재정렬 — reorderAttributes 동형. order 필드를 0..n-1 로 재인덱싱, invert는 스냅샷 통째 복원. */ export declare function reorderOperations(entityId: ModelId, operationIds: ModelId[], toIndex: number): Command; /** * 메서드 강조 색상 변경 (레이아웃 operationStyles[operationId]) — setAttributeSwatch 동형. * 고아 operationStyles 항목은 operationTo가 현존 operation에 한해서만 emit하므로 round-trip 무해(별도 정리 불요). */ export declare function setOperationSwatch(entityId: ModelId, operationId: ModelId, token: string | null): Command; export declare function addAssociation(association: Association, layout: AssociationLayout): Command; export declare function removeAssociation(assocId: ModelId): Command; /** 관계(end 제외) 필드 부분 수정 — identifying·description 등. 얕은 patch. */ export declare function updateAssociation(assocId: ModelId, patch: Partial): Command; /** 관계 한쪽 끝 부분 수정 (multiplicity·navigable·composition·jpa). 얕은 patch. */ export declare function updateAssociationEnd(assocId: ModelId, which: 'end1' | 'end2', patch: Partial): Command; export declare function addIndex(entityId: ModelId, index: EntityIndex): Command; export declare function updateIndex(entityId: ModelId, indexId: ModelId, patch: Partial): Command; export declare function removeIndex(entityId: ModelId, indexId: ModelId): Command; export declare function moveWaypoint(assocId: ModelId, index: number, point: Point): Command; export declare function removeWaypoint(assocId: ModelId, index: number): Command; /** 관계선의 모든 waypoint를 (dx,dy)만큼 평행이동 (그룹 이동 시 내부 관계 꺾은점 동반) */ export declare function translateWaypoints(assocId: ModelId, dx: number, dy: number): Command; /** 관계선의 모든 꺾은점(waypoint) 제거 → 직선화 */ export declare function clearWaypoints(assocId: ModelId): Command; export declare function addWaypoint(assocId: ModelId, index: number, point: Point): Command; export declare function addNote(note: Note): Command; /** * 노트 삭제. * * ★**노트 축의 필드는 «둘»이다** — `layout.notes` 와 그 노트를 든 `GroupLayout.memberNoteRefs`. * 종전엔 앞엣것만 지워 그룹에 **죽은 노트 ref** 가 남았다(2026-09-10 프로덕션 실측: 전수 81 중 고아 1 — * 사용자가 방금 지운 그 노트였다). 설계 불변식 *「축이 사라지면 그 축의 «모든» 필드를 함께 정리한다」* 의 * 위반이고, 반대 방향(`removeGroup`)은 groupLayout 을 통째로 지워 고아가 안 생겨 **한쪽만 비대칭**이었다. * ⚠️무신호였다 — `validation.ts` 에 `memberNoteRefs` 를 보는 규칙이 없고, 유일한 소비처 * (`resolve.ts` 의 groupOfNote 맵)는 죽은 키를 조용히 무시해 렌더에도 안 나타난다. * * cascade 는 `removeEntity` 와 같은 관용구다 — apply 가 계산한 memento 를 emitOps 가 그대로 op 으로 낸다. */ export declare function removeNote(noteId: ModelId): Command; export declare function moveNote(noteId: ModelId, location: Point): Command; export declare function resizeNote(noteId: ModelId, size: { width: number; height: number; }): Command; export declare function setNoteMemo(noteId: ModelId, memo: string): Command; /** 노트 색상 변경 (레이아웃만 변경 — setEntitySwatch와 동형) */ export declare function setNoteSwatch(noteId: ModelId, token: string | null): Command; /** * 노트를 그룹 박스 멤버로 편입(레이아웃 GroupLayout.memberNoteRefs). 이미 멤버면 no-op. * addEntityToGroup과 거울이나 대상이 논리(memberEntityRefs)가 아닌 레이아웃이다 — 노트가 순수 * 레이아웃 객체라 멤버십도 레이아웃에 둔다. 빈 슬롯을 새로 만들었으면 invert가 undefined로 환원 * (addNoteConnection의 createdArray 패턴 동형). */ export declare function addNoteToGroup(groupId: ModelId, noteId: ModelId): Command; /** 노트를 그룹 멤버에서 제외(레이아웃). removeEntityFromGroup과 거울. */ export declare function removeNoteFromGroup(groupId: ModelId, noteId: ModelId): Command; /** 노트 → 대상(엔티티 등) 연결 추가. 같은 targetRef가 이미 있으면 no-op. */ export declare function addNoteConnection(noteId: ModelId, targetRef: ModelId): Command; export declare function removeNoteConnection(noteId: ModelId, targetRef: ModelId): Command; export declare function moveNoteConnectionWaypoint(noteId: ModelId, targetRef: ModelId, index: number, point: Point): Command; export declare function addNoteConnectionWaypoint(noteId: ModelId, targetRef: ModelId, index: number, point: Point): Command; export declare function removeNoteConnectionWaypoint(noteId: ModelId, targetRef: ModelId, index: number): Command; export declare function clearNoteConnectionWaypoints(noteId: ModelId, targetRef: ModelId): Command; export declare function composite(label: string, commands: Command[], coalesceKey?: string): Command;