@skalar-os/canvas 0.0.0-stage → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import type { GridPosition, WidgetSize } from '../types';
3
+ type HighlightType = 'hover' | 'selected' | 'preview';
4
+ interface CellHighlightProps {
5
+ /** Grid position to highlight */
6
+ position: GridPosition;
7
+ /** Type of highlight (affects styling) */
8
+ type?: HighlightType;
9
+ /** Size in grid units (default: 1x1) */
10
+ size?: WidgetSize;
11
+ }
12
+ /**
13
+ * CellHighlight Layer (z-index: 3)
14
+ *
15
+ * Renders a highlight overlay on a cell when hovering or selecting
16
+ */
17
+ export declare const CellHighlight: React.FC<CellHighlightProps>;
18
+ export {};
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import type { GridConfig } from '../types';
3
+ interface CellNumbersProps {
4
+ /** Grid configuration */
5
+ config: GridConfig;
6
+ /** Custom number color */
7
+ color?: string;
8
+ /** Font size in pixels */
9
+ fontSize?: number;
10
+ /** Opacity (0-1) */
11
+ opacity?: number;
12
+ }
13
+ /**
14
+ * CellNumbers Layer (z-index: 2)
15
+ *
16
+ * Renders cell identification numbers (1, 2, 3...) in the top-left corner of each cell
17
+ */
18
+ export declare const CellNumbers: React.FC<CellNumbersProps>;
19
+ export {};
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import type { Widget } from '../types';
3
+ import type { ReactNode } from 'react';
4
+ interface DragOverlayLayerProps {
5
+ /** Widget currently being dragged (null if not dragging) */
6
+ draggedWidget: Widget | null;
7
+ /** Current zoom level */
8
+ zoomLevel: number;
9
+ /** Custom renderer for the dragged widget */
10
+ renderDraggedWidget?: (widget: Widget) => ReactNode;
11
+ }
12
+ /**
13
+ * DragOverlayLayer (z-index: 6 - rendered outside canvas via portal)
14
+ *
15
+ * Renders the widget that follows the cursor during drag
16
+ * - Uses @dnd-kit DragOverlay for proper positioning
17
+ * - Scales with zoom level
18
+ * - No drop animation for instant feedback
19
+ */
20
+ export declare const DragOverlayLayer: React.FC<DragOverlayLayerProps>;
21
+ export {};
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import type { GridConfig } from '../types';
3
+ interface GridLinesProps {
4
+ /** Grid configuration */
5
+ config: GridConfig;
6
+ /** Custom border line color */
7
+ lineColor?: string;
8
+ /** Custom center line color */
9
+ centerLineColor?: string;
10
+ }
11
+ /**
12
+ * GridLines Layer (z-index: 1)
13
+ *
14
+ * Renders:
15
+ * - Double border lines around each cell (the gap between cells)
16
+ * - Center lines crossing through each cell
17
+ */
18
+ export declare const GridLines: React.FC<GridLinesProps>;
19
+ export {};
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import type { Widget, ToolType } from '../types';
3
+ import type { ReactNode } from 'react';
4
+ interface WidgetLayerProps {
5
+ /** Array of widgets to render */
6
+ widgets: Widget[];
7
+ /** Currently selected widget ID */
8
+ selectedWidgetId?: string;
9
+ /** ID of widget being dragged (will be hidden) */
10
+ draggingWidgetId?: string;
11
+ /** Current tool (affects draggability) */
12
+ currentTool: ToolType;
13
+ /** Whether widgets can be moved/selected. False in live mode. @default true */
14
+ editable?: boolean;
15
+ /** Callback when widget is clicked */
16
+ onWidgetClick?: (widgetId: string, event: React.MouseEvent) => void;
17
+ /** Custom widget renderer */
18
+ renderWidget?: (widget: Widget, isSelected: boolean) => ReactNode;
19
+ }
20
+ /**
21
+ * WidgetLayer (z-index: 5)
22
+ *
23
+ * Renders all existing widgets on the canvas
24
+ * - Handles drag-and-drop interactions via @dnd-kit
25
+ * - Supports custom widget rendering
26
+ * - Hides widget being dragged (replaced by DragOverlayLayer)
27
+ */
28
+ export declare const WidgetLayer: React.FC<WidgetLayerProps>;
29
+ export {};
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import type { GridPosition, WidgetSize } from '../types';
3
+ type PlaceholderMode = 'placement' | 'drag';
4
+ interface WidgetPlaceholderProps {
5
+ /** Grid position where placeholder appears */
6
+ position: GridPosition;
7
+ /** Size of the placeholder in grid units */
8
+ size: WidgetSize;
9
+ /** Mode: placement (new widget) or drag (moving existing) */
10
+ mode: PlaceholderMode;
11
+ /** Whether the position is valid for dropping */
12
+ isValidPosition: boolean;
13
+ /** IDs of widgets that would conflict */
14
+ conflictingWidgets?: string[];
15
+ /** Label to display (widget name) */
16
+ label?: string;
17
+ }
18
+ /**
19
+ * WidgetPlaceholder Layer (z-index: 4)
20
+ *
21
+ * Shows preview of where a widget will be placed/dropped
22
+ * - Blue dashed border for valid positions
23
+ * - Red dashed border for invalid positions (conflicts)
24
+ */
25
+ export declare const WidgetPlaceholder: React.FC<WidgetPlaceholderProps>;
26
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Canvas Layer Z-Index System
3
+ *
4
+ * Z-INDEX HIERARCHY:
5
+ * ├── z-0: Background (Grid container)
6
+ * ├── z-1: GridLines (double borders + center lines)
7
+ * ├── z-2: CellNumbers (cell identifiers)
8
+ * ├── z-3: CellHighlight (hover state)
9
+ * ├── z-4: WidgetPlaceholder (drop preview)
10
+ * ├── z-5: WidgetLayer (existing widgets)
11
+ * └── z-6: DragOverlayLayer (widget being dragged - rendered via portal)
12
+ */
13
+ export declare const LAYER_Z_INDEX: {
14
+ readonly BACKGROUND: 0;
15
+ readonly GRID_LINES: 1;
16
+ readonly CELL_NUMBERS: 2;
17
+ readonly CELL_HIGHLIGHT: 3;
18
+ readonly WIDGET_PLACEHOLDER: 4;
19
+ readonly WIDGETS: 5;
20
+ readonly DRAG_OVERLAY: 6;
21
+ };
22
+ export type LayerZIndex = (typeof LAYER_Z_INDEX)[keyof typeof LAYER_Z_INDEX];
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Canvas Layers
3
+ *
4
+ * Z-INDEX SYSTEM:
5
+ * ├── z-0: Background (Grid container)
6
+ * ├── z-1: GridLines (double borders + center lines)
7
+ * ├── z-2: CellNumbers (cell identifiers)
8
+ * ├── z-3: CellHighlight (hover state)
9
+ * ├── z-4: WidgetPlaceholder (drop preview)
10
+ * ├── z-5: WidgetLayer (existing widgets)
11
+ * └── z-6: DragOverlayLayer (widget being dragged)
12
+ */
13
+ export { LAYER_Z_INDEX } from './constants';
14
+ export type { LayerZIndex } from './constants';
15
+ export { GridLines } from './GridLines';
16
+ export { CellNumbers } from './CellNumbers';
17
+ export { CellHighlight } from './CellHighlight';
18
+ export { WidgetPlaceholder } from './WidgetPlaceholder';
19
+ export { WidgetLayer } from './WidgetLayer';
20
+ export { DragOverlayLayer } from './DragOverlayLayer';
@@ -0,0 +1,272 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * Grid position in cell coordinates (0-based)
4
+ */
5
+ export interface GridPosition {
6
+ x: number;
7
+ y: number;
8
+ }
9
+ /**
10
+ * Size in grid units
11
+ */
12
+ export interface WidgetSize {
13
+ width: number;
14
+ height: number;
15
+ }
16
+ /**
17
+ * Base widget interface
18
+ */
19
+ export interface Widget {
20
+ id: string;
21
+ type: string;
22
+ position: GridPosition;
23
+ size: WidgetSize;
24
+ data?: Record<string, unknown>;
25
+ title?: string;
26
+ }
27
+ /**
28
+ * Canvas tool types
29
+ */
30
+ export type ToolType = 'select' | 'hand';
31
+ /**
32
+ * Canvas interaction mode.
33
+ * - `edit`: grid visible, widgets draggable/selectable, snap to grid.
34
+ * - `live`: clean view (no grid), widgets fixed (no move/resize/select) but their
35
+ * content is fully interactive. Navigation (pan/zoom) stays enabled.
36
+ * - `page`: like `live` but behaves as a document page instead of a board — no
37
+ * pan/zoom; the workspace fits the container width (scaled) and the canvas
38
+ * sizes itself to its content height (lowest occupied row). It does NOT scroll
39
+ * itself: the HOST wraps it in its own `overflow-y: auto` container, so the
40
+ * scrollbar sits wherever the app wants it (e.g. the window edge).
41
+ */
42
+ export type CanvasMode = 'edit' | 'live' | 'page';
43
+ /**
44
+ * Grid configuration
45
+ */
46
+ export interface GridConfig {
47
+ cellSize: number;
48
+ gap: number;
49
+ workspaceSize: {
50
+ width: number;
51
+ height: number;
52
+ };
53
+ padding: {
54
+ top: number;
55
+ right: number;
56
+ bottom: number;
57
+ left: number;
58
+ };
59
+ zoomLimits: {
60
+ min: number;
61
+ max: number;
62
+ step: number;
63
+ };
64
+ }
65
+ /**
66
+ * Default grid configuration
67
+ */
68
+ export declare const GRID_CONFIG: GridConfig;
69
+ /**
70
+ * Widget template for creating new widgets
71
+ */
72
+ export interface WidgetTemplate {
73
+ id: string;
74
+ type: string;
75
+ size: WidgetSize;
76
+ label: string;
77
+ description?: string;
78
+ }
79
+ /**
80
+ * Preview state for placement and drag modes
81
+ */
82
+ export interface PreviewState {
83
+ isActive: boolean;
84
+ mode: 'placement' | 'drag' | null;
85
+ position: GridPosition | null;
86
+ size: WidgetSize | null;
87
+ label: string;
88
+ isValidPosition: boolean;
89
+ conflictingWidgets: string[];
90
+ template?: WidgetTemplate | null;
91
+ }
92
+ /**
93
+ * Internal drag state with all tracking info
94
+ */
95
+ export interface InternalDragState {
96
+ isDragging: boolean;
97
+ draggedWidget: Widget | null;
98
+ initialOffset?: {
99
+ x: number;
100
+ y: number;
101
+ };
102
+ startZoomLevel?: number;
103
+ startPanPosition?: {
104
+ x: number;
105
+ y: number;
106
+ };
107
+ initialMousePosition?: {
108
+ x: number;
109
+ y: number;
110
+ };
111
+ initialWidgetPosition: {
112
+ x: number;
113
+ y: number;
114
+ };
115
+ }
116
+ /**
117
+ * Pan and zoom state
118
+ */
119
+ export interface PanZoomState {
120
+ x: number;
121
+ y: number;
122
+ zoom: number;
123
+ }
124
+ /**
125
+ * Canvas state
126
+ */
127
+ export interface CanvasState {
128
+ widgets: Widget[];
129
+ selectedTool: ToolType;
130
+ selectedWidget?: string;
131
+ }
132
+ /**
133
+ * Navigation options for navigateToWidget
134
+ */
135
+ export interface NavigateToWidgetOptions {
136
+ /** Whether to animate the transition (default: true) */
137
+ animate?: boolean;
138
+ /** Animation duration in ms (default: 300) */
139
+ duration?: number;
140
+ /** Whether to also select the widget (default: false) */
141
+ select?: boolean;
142
+ /** Zoom level to set (default: keeps current zoom) */
143
+ zoom?: number;
144
+ }
145
+ /**
146
+ * Viewport dimensions for visibility calculations
147
+ */
148
+ export interface ViewportDimensions {
149
+ width: number;
150
+ height: number;
151
+ }
152
+ /**
153
+ * Visibility state for a widget
154
+ */
155
+ export type WidgetVisibilityState = 'visible' | 'buffer' | 'hidden';
156
+ /**
157
+ * Widget visibility info returned by visibility calculations
158
+ */
159
+ export interface WidgetVisibilityInfo {
160
+ id: string;
161
+ state: WidgetVisibilityState;
162
+ }
163
+ /**
164
+ * Imperative handle for Canvas component
165
+ * Allows parent components to control canvas programmatically
166
+ */
167
+ export interface CanvasHandle {
168
+ /**
169
+ * Navigate to center a specific widget in the viewport
170
+ * @param widgetId - The ID of the widget to navigate to
171
+ * @param options - Navigation options
172
+ * @returns true if navigation was successful, false if widget not found
173
+ */
174
+ navigateToWidget: (widgetId: string, options?: NavigateToWidgetOptions) => boolean;
175
+ /**
176
+ * Get current pan and zoom state
177
+ */
178
+ getPanZoom: () => PanZoomState;
179
+ /**
180
+ * Set pan and zoom state programmatically
181
+ * @param state - Partial pan/zoom state to apply
182
+ * @param animate - Whether to animate the transition
183
+ */
184
+ setPanZoom: (state: Partial<PanZoomState>, animate?: boolean) => void;
185
+ /**
186
+ * Reset pan and zoom to initial state
187
+ * @param animate - Whether to animate the transition
188
+ */
189
+ resetView: (animate?: boolean) => void;
190
+ /**
191
+ * Fit all widgets in the viewport
192
+ * @param animate - Whether to animate the transition
193
+ */
194
+ fitToContent: (animate?: boolean) => void;
195
+ /**
196
+ * Get IDs of widgets currently visible in viewport (includes buffer zone)
197
+ */
198
+ getVisibleWidgets: () => string[];
199
+ /**
200
+ * Check if a specific widget is visible
201
+ * @param widgetId - The ID of the widget to check
202
+ */
203
+ isWidgetVisible: (widgetId: string) => boolean;
204
+ }
205
+ /**
206
+ * Canvas component props
207
+ */
208
+ export interface CanvasProps {
209
+ /** Array of widgets to render */
210
+ widgets: Widget[];
211
+ /** Grid configuration override */
212
+ config?: Partial<GridConfig>;
213
+ /** Currently selected widget ID */
214
+ selectedWidgetId?: string;
215
+ /** Current tool */
216
+ tool?: ToolType;
217
+ /**
218
+ * Interaction mode. In `live` the grid is hidden and widgets can't be
219
+ * moved/selected (their content stays interactive); navigation still works.
220
+ * @default 'edit'
221
+ */
222
+ mode?: CanvasMode;
223
+ /** Widget placement mode */
224
+ widgetPlacementMode?: {
225
+ isActive: boolean;
226
+ selectedTemplate: WidgetTemplate | null;
227
+ };
228
+ /** Callback when widget is selected */
229
+ onWidgetSelect?: (widgetId: string | null) => void;
230
+ /** Callback when widget position changes */
231
+ onWidgetMove?: (widgetId: string, position: GridPosition) => void;
232
+ /** Callback when new widget is placed */
233
+ onWidgetAdd?: (widget: Widget) => void;
234
+ /** Callback when placement mode ends */
235
+ onWidgetPlacementEnd?: () => void;
236
+ /** Callback when tool changes */
237
+ onToolChange?: (tool: ToolType) => void;
238
+ /** Callback for undo action (Ctrl/Cmd + Z) */
239
+ onUndo?: () => void;
240
+ /** Callback for redo action (Ctrl/Cmd + Shift + Z) */
241
+ onRedo?: () => void;
242
+ /** Custom widget renderer */
243
+ renderWidget?: (widget: Widget, isSelected: boolean) => ReactNode;
244
+ /** Class name for the canvas container */
245
+ className?: string;
246
+ /**
247
+ * Callback when visible widgets change
248
+ * Called with array of widget IDs that are visible or in buffer zone
249
+ * Use this to manage WebSocket subscriptions or data fetching
250
+ */
251
+ onVisibilityChange?: (visibleWidgetIds: string[]) => void;
252
+ /**
253
+ * Number of cells to add as buffer zone around viewport
254
+ * Widgets in buffer zone are considered "visible" for pre-loading
255
+ * @default 1
256
+ */
257
+ bufferZone?: number;
258
+ /**
259
+ * Whether to clamp pan position to workspace bounds.
260
+ * When true (default), prevents scrolling beyond workspace edges
261
+ * and pins the grid to top-left when smaller than viewport.
262
+ * When false, automatically centers the grid when it's smaller
263
+ * than the viewport, while still preventing scrolling beyond bounds.
264
+ * @default true
265
+ */
266
+ clampPan?: boolean;
267
+ /**
268
+ * Show the debug overlay (widget count, hovered grid cell, zoom level).
269
+ * @default false
270
+ */
271
+ debug?: boolean;
272
+ }
@@ -0,0 +1,47 @@
1
+ import type { GridPosition, WidgetSize, Widget } from '../types';
2
+ /**
3
+ * Tamaño en píxeles del área de trabajo.
4
+ *
5
+ * `(n + 1) * gap`: cada celda lleva su gap POR DELANTE (una celda arranca en
6
+ * `gap + x * (cellSize + gap)`), así que hace falta un gap más para cerrar por la derecha y por
7
+ * abajo. Sin él, el área mide justo hasta el borde de la última celda: el borde exterior se
8
+ * dibuja encima de esa celda y los widgets de la última columna/fila se salen visualmente,
9
+ * mientras que arriba y a la izquierda sí queda la banda del primer gap.
10
+ */
11
+ export declare const getWorkspacePixels: (config: {
12
+ cellSize: number;
13
+ gap: number;
14
+ workspaceSize: {
15
+ width: number;
16
+ height: number;
17
+ };
18
+ }) => {
19
+ width: number;
20
+ height: number;
21
+ };
22
+ /**
23
+ * Check if a grid position is valid (within bounds and not overlapping).
24
+ * `workspaceSize` defaults to the global GRID_CONFIG; pass the instance's
25
+ * effective size when the canvas overrides it (e.g. narrow page grids).
26
+ */
27
+ export declare const isValidGridPosition: (position: GridPosition, size: WidgetSize, existingWidgets: Widget[], workspaceSize?: {
28
+ width: number;
29
+ height: number;
30
+ }) => boolean;
31
+ /**
32
+ * Get widgets that would conflict with placing a widget at the given position
33
+ */
34
+ export declare const getConflictingWidgets: (position: GridPosition, size: WidgetSize, existingWidgets: Widget[]) => string[];
35
+ /**
36
+ * Check if two widgets overlap
37
+ */
38
+ export declare const doWidgetsOverlap: (pos1: GridPosition, size1: WidgetSize, pos2: GridPosition, size2: WidgetSize) => boolean;
39
+ /**
40
+ * Get pixel position for widget placement
41
+ */
42
+ export declare const getWidgetPlacementPosition: (gridPosition: GridPosition, size: WidgetSize) => {
43
+ left: number;
44
+ top: number;
45
+ width: number;
46
+ height: number;
47
+ };
@@ -0,0 +1,4 @@
1
+ export { isValidGridPosition, getConflictingWidgets, doWidgetsOverlap, getWidgetPlacementPosition, getWorkspacePixels, } from './gridUtils';
2
+ export { calculateCenteredPanPosition, clampPanPosition, calculateWidgetsBoundingBox, calculateFitToContent, interpolatePanZoom, } from './navigationUtils';
3
+ export { calculateViewportGridBounds, widgetIntersectsBounds, expandBoundsWithBuffer, calculateWidgetVisibility, calculateAllWidgetsVisibility, getVisibleWidgetIds, areVisibleIdsEqual, } from './visibilityUtils';
4
+ export type { ViewportGridBounds } from './visibilityUtils';
@@ -0,0 +1,45 @@
1
+ import type { Widget, PanZoomState } from '../types';
2
+ /**
3
+ * Viewport dimensions
4
+ */
5
+ interface ViewportDimensions {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ /**
10
+ * Calculate the pan position needed to center a widget in the viewport
11
+ */
12
+ export declare const calculateCenteredPanPosition: (widget: Widget, viewport: ViewportDimensions, zoom: number) => {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ /**
17
+ * Clamp pan position to valid bounds (prevent scrolling beyond workspace)
18
+ */
19
+ export declare const clampPanPosition: (pan: {
20
+ x: number;
21
+ y: number;
22
+ }, viewport: ViewportDimensions, zoom: number) => {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ /**
27
+ * Calculate bounding box of all widgets
28
+ */
29
+ export declare const calculateWidgetsBoundingBox: (widgets: Widget[]) => {
30
+ minX: number;
31
+ minY: number;
32
+ maxX: number;
33
+ maxY: number;
34
+ width: number;
35
+ height: number;
36
+ } | null;
37
+ /**
38
+ * Calculate zoom and pan to fit all widgets in viewport
39
+ */
40
+ export declare const calculateFitToContent: (widgets: Widget[], viewport: ViewportDimensions, padding?: number, shouldClamp?: boolean) => PanZoomState | null;
41
+ /**
42
+ * Interpolate between two pan/zoom states for animation
43
+ */
44
+ export declare const interpolatePanZoom: (from: PanZoomState, to: PanZoomState, progress: number) => PanZoomState;
45
+ export {};
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Visibility calculation utilities
3
+ *
4
+ * Pure functions for calculating widget visibility based on viewport and pan/zoom state.
5
+ * These functions have no side effects and are designed for optimal performance.
6
+ */
7
+ import type { Widget, PanZoomState, ViewportDimensions, WidgetVisibilityState, WidgetVisibilityInfo } from '../types';
8
+ /**
9
+ * Viewport bounds in grid cell coordinates
10
+ */
11
+ export interface ViewportGridBounds {
12
+ /** Starting grid X (may be negative if panned past origin) */
13
+ startX: number;
14
+ /** Starting grid Y */
15
+ startY: number;
16
+ /** Ending grid X */
17
+ endX: number;
18
+ /** Ending grid Y */
19
+ endY: number;
20
+ }
21
+ /**
22
+ * Convert viewport bounds from pixel coordinates to grid cell coordinates
23
+ *
24
+ * @param viewport - Viewport dimensions in pixels
25
+ * @param panZoom - Current pan and zoom state
26
+ * @returns Grid cell bounds of visible area
27
+ */
28
+ export declare const calculateViewportGridBounds: (viewport: ViewportDimensions, panZoom: PanZoomState) => ViewportGridBounds;
29
+ /**
30
+ * Check if a widget intersects with given grid bounds
31
+ * Uses AABB (Axis-Aligned Bounding Box) collision detection
32
+ *
33
+ * @param widget - Widget to check
34
+ * @param bounds - Grid bounds to check against
35
+ * @returns true if widget intersects with bounds
36
+ */
37
+ export declare const widgetIntersectsBounds: (widget: Widget, bounds: ViewportGridBounds) => boolean;
38
+ /**
39
+ * Expand grid bounds by buffer zone
40
+ *
41
+ * @param bounds - Original bounds
42
+ * @param buffer - Number of cells to add around bounds
43
+ * @returns Expanded bounds
44
+ */
45
+ export declare const expandBoundsWithBuffer: (bounds: ViewportGridBounds, buffer: number) => ViewportGridBounds;
46
+ /**
47
+ * Calculate visibility state for a single widget
48
+ *
49
+ * @param widget - Widget to check
50
+ * @param viewportBounds - Current viewport bounds in grid coordinates
51
+ * @param bufferZone - Number of buffer cells
52
+ * @returns Visibility state ('visible', 'buffer', or 'hidden')
53
+ */
54
+ export declare const calculateWidgetVisibility: (widget: Widget, viewportBounds: ViewportGridBounds, bufferZone?: number) => WidgetVisibilityState;
55
+ /**
56
+ * Calculate visibility for all widgets
57
+ *
58
+ * @param widgets - Array of widgets
59
+ * @param viewport - Viewport dimensions
60
+ * @param panZoom - Current pan/zoom state
61
+ * @param bufferZone - Number of buffer cells (default: 1)
62
+ * @returns Array of widget visibility info
63
+ */
64
+ export declare const calculateAllWidgetsVisibility: (widgets: Widget[], viewport: ViewportDimensions, panZoom: PanZoomState, bufferZone?: number) => WidgetVisibilityInfo[];
65
+ /**
66
+ * Get IDs of visible widgets (includes both 'visible' and 'buffer' states)
67
+ * This is the main function for determining which widgets need data subscriptions
68
+ *
69
+ * @param widgets - Array of widgets
70
+ * @param viewport - Viewport dimensions
71
+ * @param panZoom - Current pan/zoom state
72
+ * @param bufferZone - Number of buffer cells (default: 1)
73
+ * @returns Array of widget IDs that are visible or in buffer zone
74
+ */
75
+ export declare const getVisibleWidgetIds: (widgets: Widget[], viewport: ViewportDimensions, panZoom: PanZoomState, bufferZone?: number) => string[];
76
+ /**
77
+ * Check if two arrays of IDs are equal (order-independent)
78
+ * Used for avoiding unnecessary callbacks when visibility hasn't changed
79
+ *
80
+ * @param a - First array of IDs
81
+ * @param b - Second array of IDs
82
+ * @returns true if arrays contain same IDs
83
+ */
84
+ export declare const areVisibleIdsEqual: (a: string[], b: string[]) => boolean;