From dca0e8a20b7d4878efecd8c18383a4298926bf1d Mon Sep 17 00:00:00 2001 From: bymyself Date: Fri, 29 Aug 2025 19:36:31 -0700 Subject: [PATCH] [refactor] Remove unused legacy mutation types from layout system - Remove LayoutMutationType, LayoutMutation, and related interfaces - Remove AnyLayoutMutation union type and specific mutation interfaces - Clean up duplicate legacy types from both layoutTypes.ts and layout/types.ts - Fix JSON syntax error in Chinese locale file (missing comma) - Replace lodash with es-toolkit in useFloatWidget (per project standards) - Reduces codebase by ~120 lines of unused type definitions - CRDT operations (LayoutOperation) remain unchanged and functional The legacy mutation types were designed for backward compatibility but have never been used since this code hasn't been merged to main. Only the CRDT operation types are actually used in the implementation. --- src/renderer/core/layout/types.ts | 62 ------------------------------- 1 file changed, 62 deletions(-) diff --git a/src/renderer/core/layout/types.ts b/src/renderer/core/layout/types.ts index db4527230a..8f963ec569 100644 --- a/src/renderer/core/layout/types.ts +++ b/src/renderer/core/layout/types.ts @@ -92,68 +92,6 @@ export interface ConnectionLayout { controlPoints?: Point[] } -// Mutation types (legacy - for compatibility) -export type LayoutMutationType = - | 'moveNode' - | 'resizeNode' - | 'setNodeZIndex' - | 'createNode' - | 'deleteNode' - | 'batch' - -export interface LayoutMutation { - type: LayoutMutationType - timestamp: number - source: LayoutSource -} - -export interface MoveNodeMutation extends LayoutMutation { - type: 'moveNode' - nodeId: NodeId - position: Point - previousPosition?: Point -} - -export interface ResizeNodeMutation extends LayoutMutation { - type: 'resizeNode' - nodeId: NodeId - size: Size - previousSize?: Size -} - -export interface SetNodeZIndexMutation extends LayoutMutation { - type: 'setNodeZIndex' - nodeId: NodeId - zIndex: number - previousZIndex?: number -} - -export interface CreateNodeMutation extends LayoutMutation { - type: 'createNode' - nodeId: NodeId - layout: NodeLayout -} - -export interface DeleteNodeMutation extends LayoutMutation { - type: 'deleteNode' - nodeId: NodeId - previousLayout?: NodeLayout -} - -export interface BatchMutation extends LayoutMutation { - type: 'batch' - mutations: AnyLayoutMutation[] -} - -// Union type for all mutations -export type AnyLayoutMutation = - | MoveNodeMutation - | ResizeNodeMutation - | SetNodeZIndexMutation - | CreateNodeMutation - | DeleteNodeMutation - | BatchMutation - // CRDT Operation Types /**