mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
- Created dedicated layoutOperations.ts with production-grade CRDT interfaces - Integrated existing QuadTree spatial index instead of simple cache - Split composables into separate files (useLayout, useNodeLayout, useLayoutSync) - Cleaned up operation handlers using specific types instead of Extract - Added proper operation interfaces with type guards and extensibility - Updated all type references to use new operation structure The layout store now properly uses the existing QuadTree infrastructure for efficient spatial queries and follows CRDT best practices with well-defined operation interfaces. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
958 B
TypeScript
32 lines
958 B
TypeScript
/**
|
|
* Main composable for accessing the layout system
|
|
*
|
|
* Provides unified access to the layout store and mutation API.
|
|
*/
|
|
import { layoutMutations } from '@/services/layoutMutations'
|
|
import { layoutStore } from '@/stores/layoutStore'
|
|
import type { Bounds, NodeId, Point } from '@/types/layoutTypes'
|
|
|
|
/**
|
|
* Main composable for accessing the layout system
|
|
*/
|
|
export function useLayout() {
|
|
return {
|
|
// Store access
|
|
store: layoutStore,
|
|
|
|
// Mutation API
|
|
mutations: layoutMutations,
|
|
|
|
// Reactive accessors
|
|
getNodeLayoutRef: (nodeId: NodeId) => layoutStore.getNodeLayoutRef(nodeId),
|
|
getAllNodes: () => layoutStore.getAllNodes(),
|
|
getNodesInBounds: (bounds: Bounds) => layoutStore.getNodesInBounds(bounds),
|
|
|
|
// Non-reactive queries (for performance)
|
|
queryNodeAtPoint: (point: Point) => layoutStore.queryNodeAtPoint(point),
|
|
queryNodesInBounds: (bounds: Bounds) =>
|
|
layoutStore.queryNodesInBounds(bounds)
|
|
}
|
|
}
|