@procaaso/alphinity-ui-components 1.0.5 → 1.0.7

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.
package/dist/index.d.ts CHANGED
@@ -189,6 +189,290 @@ interface LegacyValueEntryProps extends Omit<react__default.InputHTMLAttributes<
189
189
  }
190
190
  declare const LegacyValueEntry: react__default.FC<LegacyValueEntryProps>;
191
191
 
192
+ interface NodeControlConfig {
193
+ /** Node ID */
194
+ nodeId: string;
195
+ /** Display title for the control panel */
196
+ title: string;
197
+ /** Available mode options */
198
+ modes: SelectorOption[];
199
+ /** Current selected mode */
200
+ currentMode: string;
201
+ /** Callback when mode changes */
202
+ onModeChange: (mode: string) => void;
203
+ /** Current setpoint value */
204
+ setpoint: number | string;
205
+ /** Callback when setpoint changes */
206
+ onSetpointChange: (value: number | string) => void;
207
+ /** Optional second setpoint value */
208
+ secondSetpoint?: number | string;
209
+ /** Callback for second setpoint */
210
+ onSecondSetpointChange?: (value: number | string) => void;
211
+ /** Configuration for each mode */
212
+ modeConfigs?: Record<string, ModeConfig>;
213
+ /** Whether device is currently running */
214
+ isRunning?: boolean;
215
+ /** Start command handler */
216
+ onStart?: () => void;
217
+ /** Stop command handler */
218
+ onStop?: () => void;
219
+ /** Custom start button text */
220
+ startButtonText?: string;
221
+ /** Custom stop button text */
222
+ stopButtonText?: string;
223
+ /** Current status */
224
+ status?: 'normal' | 'alarm' | 'warning' | 'disabled';
225
+ /** Whether setpoint is read-only */
226
+ readOnly?: boolean;
227
+ }
228
+ interface NodeControlsPanelProps extends react__default.HTMLAttributes<HTMLDivElement> {
229
+ /** Control configuration for the selected node */
230
+ config: NodeControlConfig | null;
231
+ /** Callback to close the panel */
232
+ onClose: () => void;
233
+ /** Panel position - bottom (mobile) or side (desktop/large touch screens) */
234
+ position?: 'bottom' | 'side';
235
+ /** Whether to show in touch-optimized mode (larger targets) */
236
+ touchOptimized?: boolean;
237
+ }
238
+ /**
239
+ * NodeControlsPanel - Touch-friendly slide-out panel for device manual controls
240
+ *
241
+ * Optimized for industrial touch screens with:
242
+ * - Large touch targets (minimum 44px)
243
+ * - Single-tap interactions
244
+ * - Clear visual feedback
245
+ * - Bottom or side slide-in animation
246
+ */
247
+ declare const NodeControlsPanel: react__default.FC<NodeControlsPanelProps>;
248
+
249
+ /**
250
+ * Device control mode option
251
+ */
252
+ interface ControlMode {
253
+ /** Mode value/ID */
254
+ value: string;
255
+ /** Display label */
256
+ label: string;
257
+ /** Whether this mode is currently available */
258
+ enabled?: boolean;
259
+ /** Icon or emoji to display (optional) */
260
+ icon?: string;
261
+ }
262
+ /**
263
+ * Control parameter definition (setpoint, adjustment, etc.)
264
+ */
265
+ interface ControlParameter {
266
+ /** Parameter ID */
267
+ id: string;
268
+ /** Display label */
269
+ label: string;
270
+ /** Unit of measurement */
271
+ unit?: string;
272
+ /** Minimum allowed value */
273
+ min?: number;
274
+ /** Maximum allowed value */
275
+ max?: number;
276
+ /** Step increment */
277
+ step?: number;
278
+ /** Decimal precision for display */
279
+ precision?: number;
280
+ /** Current value */
281
+ value: number | string | boolean;
282
+ /** Whether parameter is read-only */
283
+ readOnly?: boolean;
284
+ /** Parameter type */
285
+ type?: 'number' | 'string' | 'boolean' | 'select';
286
+ /** Options for select type */
287
+ options?: Array<{
288
+ value: string | number;
289
+ label: string;
290
+ }>;
291
+ /** Custom validation function */
292
+ validate?: (value: any) => boolean | string;
293
+ }
294
+ /**
295
+ * Device control capabilities and commands
296
+ */
297
+ interface ControlCapabilities {
298
+ /** Can the device be started? */
299
+ canStart?: boolean;
300
+ /** Can the device be stopped? */
301
+ canStop?: boolean;
302
+ /** Can the device be paused? */
303
+ canPause?: boolean;
304
+ /** Can the device be reset? */
305
+ canReset?: boolean;
306
+ /** Custom actions available */
307
+ customActions?: Array<{
308
+ id: string;
309
+ label: string;
310
+ icon?: string;
311
+ variant?: 'primary' | 'secondary' | 'alarm' | 'warning';
312
+ }>;
313
+ }
314
+ /**
315
+ * Device control state
316
+ */
317
+ interface ControlState {
318
+ /** Current operational mode */
319
+ currentMode: string;
320
+ /** Is device currently running? */
321
+ isRunning?: boolean;
322
+ /** Is device in alarm state? */
323
+ hasAlarm?: boolean;
324
+ /** Current status */
325
+ status?: 'normal' | 'warning' | 'alarm' | 'fault' | 'off' | 'starting' | 'stopping';
326
+ /** Status message */
327
+ statusMessage?: string;
328
+ /** Last command timestamp */
329
+ lastCommandTime?: number;
330
+ /** Last command result */
331
+ lastCommandResult?: {
332
+ success: boolean;
333
+ message?: string;
334
+ };
335
+ }
336
+ /**
337
+ * Device control binding - maps a node to device control capabilities
338
+ *
339
+ * Similar to TelemetryBinding but for device commands and setpoints
340
+ */
341
+ interface DeviceControlBinding {
342
+ /** Node ID this control is bound to */
343
+ nodeId: string;
344
+ /** Device tag/ID for backend communication */
345
+ tag: string;
346
+ /** Human-readable device name */
347
+ deviceName?: string;
348
+ /** Device type (pump, valve, mixer, etc.) */
349
+ deviceType?: string;
350
+ /** Available control modes */
351
+ modes: ControlMode[];
352
+ /** Current device state */
353
+ state: ControlState;
354
+ /** Control parameters (setpoints, adjustments) organized by mode */
355
+ parameters: Record<string, ControlParameter[]>;
356
+ /** Device capabilities (what commands are available) */
357
+ capabilities?: ControlCapabilities;
358
+ /** Callbacks for control actions */
359
+ actions: {
360
+ /** Called when mode changes */
361
+ onModeChange?: (mode: string) => void | Promise<void>;
362
+ /** Called when parameter value changes */
363
+ onParameterChange?: (parameterId: string, value: any) => void | Promise<void>;
364
+ /** Called when start button clicked */
365
+ onStart?: () => void | Promise<void>;
366
+ /** Called when stop button clicked */
367
+ onStop?: () => void | Promise<void>;
368
+ /** Called when pause button clicked */
369
+ onPause?: () => void | Promise<void>;
370
+ /** Called when reset button clicked */
371
+ onReset?: () => void | Promise<void>;
372
+ /** Called for custom actions */
373
+ onCustomAction?: (actionId: string) => void | Promise<void>;
374
+ };
375
+ /** Display customization */
376
+ display?: {
377
+ /** Panel title (defaults to deviceName or nodeId) */
378
+ title?: string;
379
+ /** Show mode selector */
380
+ showModeSelector?: boolean;
381
+ /** Show start/stop buttons */
382
+ showStartStop?: boolean;
383
+ /** Panel size */
384
+ size?: 'small' | 'medium' | 'large';
385
+ /** Custom CSS class name */
386
+ className?: string;
387
+ /** Custom inline styles */
388
+ style?: React.CSSProperties;
389
+ /** Group parameters by category */
390
+ groupParameters?: boolean;
391
+ };
392
+ /** Styling overrides */
393
+ theme?: {
394
+ /** Primary color */
395
+ primaryColor?: string;
396
+ /** Secondary color */
397
+ secondaryColor?: string;
398
+ /** Accent color */
399
+ accentColor?: string;
400
+ /** Background color */
401
+ backgroundColor?: string;
402
+ /** Text color */
403
+ textColor?: string;
404
+ /** Status colors */
405
+ statusColors?: {
406
+ normal?: string;
407
+ warning?: string;
408
+ alarm?: string;
409
+ fault?: string;
410
+ off?: string;
411
+ starting?: string;
412
+ stopping?: string;
413
+ };
414
+ };
415
+ }
416
+ /**
417
+ * Map of device control bindings by node ID
418
+ */
419
+ type DeviceControlMap = Map<string, DeviceControlBinding>;
420
+ /**
421
+ * Helper to create a control binding from backend device configuration
422
+ */
423
+ declare function createControlBinding(nodeId: string, deviceConfig: {
424
+ tag: string;
425
+ name?: string;
426
+ type?: string;
427
+ modes: Array<{
428
+ value: string;
429
+ label: string;
430
+ enabled?: boolean;
431
+ }>;
432
+ currentMode: string;
433
+ parameters: Array<{
434
+ id: string;
435
+ label: string;
436
+ unit?: string;
437
+ min?: number;
438
+ max?: number;
439
+ value: any;
440
+ modes?: string[];
441
+ }>;
442
+ capabilities?: {
443
+ canStart?: boolean;
444
+ canStop?: boolean;
445
+ customActions?: Array<{
446
+ id: string;
447
+ label: string;
448
+ }>;
449
+ };
450
+ status?: string;
451
+ isRunning?: boolean;
452
+ }, actions: DeviceControlBinding['actions']): DeviceControlBinding;
453
+
454
+ interface DeviceControlPanelProps {
455
+ /** Control binding to display */
456
+ binding: DeviceControlBinding | null;
457
+ /** Called when panel should close */
458
+ onClose: () => void;
459
+ /** Panel position */
460
+ position?: 'bottom' | 'side';
461
+ /** Optimize for touch (larger targets) */
462
+ touchOptimized?: boolean;
463
+ /** Called when mode changes */
464
+ onModeChange?: (mode: string) => void;
465
+ /** Called when parameter changes */
466
+ onParameterChange?: (parameterId: string, value: any) => void;
467
+ /** Called when start button clicked */
468
+ onStart?: () => void;
469
+ /** Called when stop button clicked */
470
+ onStop?: () => void;
471
+ /** Called when custom action clicked */
472
+ onCustomAction?: (actionId: string) => void;
473
+ }
474
+ declare function DeviceControlPanel({ binding, onClose, position, touchOptimized, onModeChange, onParameterChange, onStart, onStop, onCustomAction, }: DeviceControlPanelProps): react_jsx_runtime.JSX.Element | null;
475
+
192
476
  type DisplayMode = 'standard' | 'dashboard';
193
477
  interface FullscreenContainerProps {
194
478
  leftCollapsed: boolean;
@@ -1106,11 +1390,30 @@ declare const exampleDiagram: Diagram;
1106
1390
  */
1107
1391
  declare const mockSymbolLibrary: Record<string, SymbolDefinition>;
1108
1392
  /**
1109
- * Get symbol definition by ID
1393
+ * Register a custom symbol definition
1394
+ * @param symbol - The symbol definition to register
1395
+ * @example
1396
+ * registerSymbol({
1397
+ * id: 'my-custom-valve',
1398
+ * name: 'My Custom Valve',
1399
+ * category: 'valve',
1400
+ * viewBox: { x: 0, y: 0, width: 100, height: 100 },
1401
+ * ports: [...],
1402
+ * svgContent: '...',
1403
+ * });
1404
+ */
1405
+ declare function registerSymbol(symbol: SymbolDefinition): void;
1406
+ /**
1407
+ * Register multiple custom symbols at once
1408
+ * @param symbols - Array of symbol definitions or a record of symbols
1409
+ */
1410
+ declare function registerSymbols(symbols: SymbolDefinition[] | Record<string, SymbolDefinition>): void;
1411
+ /**
1412
+ * Get symbol definition by ID (checks both mock library and custom symbols)
1110
1413
  */
1111
1414
  declare function getSymbolDefinition(symbolId: string): SymbolDefinition | undefined;
1112
1415
  /**
1113
- * Get all available symbol IDs
1416
+ * Get all available symbol IDs (includes both mock library and custom symbols)
1114
1417
  */
1115
1418
  declare function getAvailableSymbols(): string[];
1116
1419
 
@@ -1139,6 +1442,26 @@ declare function calculateThresholdStatus(value: number, thresholds?: Thresholds
1139
1442
  */
1140
1443
  declare const DEFAULT_THRESHOLDS: Thresholds;
1141
1444
 
1445
+ /**
1446
+ * Hook for managing device control bindings
1447
+ * Similar pattern to useTelemetry
1448
+ */
1449
+ declare function useDeviceControls(initialBindings?: DeviceControlBinding[]): {
1450
+ controls: DeviceControlMap;
1451
+ updateControl: (nodeId: string, updates: Partial<DeviceControlBinding>) => void;
1452
+ updateControlBatch: (updates: Record<string, Partial<DeviceControlBinding>>) => void;
1453
+ updateDeviceState: (nodeId: string, stateUpdates: Partial<DeviceControlBinding["state"]>) => void;
1454
+ updateParameter: (nodeId: string, parameterId: string, value: any) => void;
1455
+ setControlBinding: (binding: DeviceControlBinding) => void;
1456
+ removeControlBinding: (nodeId: string) => void;
1457
+ getControlBinding: (nodeId: string) => DeviceControlBinding | undefined;
1458
+ sendModeChange: (nodeId: string, mode: string) => Promise<void>;
1459
+ sendParameterChange: (nodeId: string, parameterId: string, value: any) => Promise<void>;
1460
+ sendStartCommand: (nodeId: string) => Promise<void>;
1461
+ sendStopCommand: (nodeId: string) => Promise<void>;
1462
+ sendCustomAction: (nodeId: string, actionId: string) => Promise<void>;
1463
+ };
1464
+
1142
1465
  /**
1143
1466
  * Options for simulation behavior
1144
1467
  */
@@ -1177,4 +1500,4 @@ interface SimulationOptions {
1177
1500
  */
1178
1501
  declare function useSimulation(telemetry: TelemetryMap, updateTelemetryBatch: (updates: Array<any>) => void, options?: SimulationOptions): void;
1179
1502
 
1180
- export { type AnchorType, Button, type ButtonProps, CardHeader, CardUnit, CardValue, CircularGauge, type CircularGaugeProps, ControlPanel, type ControlPanelProps, DEFAULT_THRESHOLDS, DashboardCard, type DataBinding, type Diagram, type DiagramMetadata, type DisplayMode, DisplayModeToggle, type DragPoint, type DragState, EquipmentIndicator, type EquipmentIndicatorProps, EquipmentIndicatorWithSparkline, type EquipmentIndicatorWithSparklineProps, FixedSVGContainer, FooterPanel, FullscreenContainer, FullscreenWorkspace, type FullscreenWorkspaceProps, type FullscreenWorkspaceTab, type KeyboardShortcutsOptions, LeftPanel, LeftToggleButton, LegacyValueEntry, type LegacyValueEntryProps, type ModeConfig, NodeConfigPanel, type NodeConfigPanelProps, type NodeInstance, type Overlay, type OverlayContent, type OverlayTheme, type OverlayType, PIDCanvas, type PIDCanvasControls, type PIDCanvasFeatures, type PIDCanvasProps, PanelContent, PanelTabs, type PipeEdge, type PipeStyle, type Point, type PortDefinition, type PortInstance, type PortType, RightPanel, RightToggleButton, SVGArea, SVGLockedOverlay, type SVGLockedOverlayProps, ScrollableSVGWrapper, type SelectionState, Selector, type SelectorOption, type SelectorProps, type SimulationOptions, Sparkline, type SparklineProps, StatusIndicator, type StatusIndicatorProps, type SymbolCategory, type SymbolDefinition, SymbolLibrary, type SymbolLibraryProps, type SymbolMetadata, type TelemetryBinding, type TelemetryMap, type TelemetryStatus$1 as TelemetryStatus, type TelemetryValue, ThemeProvider, ThemeToggle, type ThemeToggleProps, type Thresholds, type Transform, TrendLine, type TrendLineProps, type UseDragOptions, type UseDragResult, type UseSelectionOptions, type UseSelectionResult, type UseTelemetryOptions, type UseTelemetryResult, type UseTelemetryStatusOptions, type UseViewBoxOptions, type UseViewBoxResult, ValueEntry, type ValueEntryProps, type ViewBox, ZoomButton, ZoomControls, calculateThresholdStatus, exampleDiagram, exportDiagram, generateRoutePoints, getAvailableSymbols, getPortWorldPosition, getSymbolDefinition, importDiagram, mockSymbolLibrary, nodeHasPort, overlayStyles, useDrag, useKeyboardShortcuts, useSelection, useSimulation, useTelemetry, useTelemetryStatus, useTheme, useViewBox, validateDiagram };
1503
+ export { type AnchorType, Button, type ButtonProps, CardHeader, CardUnit, CardValue, CircularGauge, type CircularGaugeProps, type ControlCapabilities, type ControlMode, ControlPanel, type ControlPanelProps, type ControlParameter, type ControlState, DEFAULT_THRESHOLDS, DashboardCard, type DataBinding, type DeviceControlBinding, type DeviceControlMap, DeviceControlPanel, type DeviceControlPanelProps, type Diagram, type DiagramMetadata, type DisplayMode, DisplayModeToggle, type DragPoint, type DragState, EquipmentIndicator, type EquipmentIndicatorProps, EquipmentIndicatorWithSparkline, type EquipmentIndicatorWithSparklineProps, FixedSVGContainer, FooterPanel, FullscreenContainer, FullscreenWorkspace, type FullscreenWorkspaceProps, type FullscreenWorkspaceTab, type KeyboardShortcutsOptions, LeftPanel, LeftToggleButton, LegacyValueEntry, type LegacyValueEntryProps, type ModeConfig, NodeConfigPanel, type NodeConfigPanelProps, type NodeControlConfig, NodeControlsPanel, type NodeControlsPanelProps, type NodeInstance, type Overlay, type OverlayContent, type OverlayTheme, type OverlayType, PIDCanvas, type PIDCanvasControls, type PIDCanvasFeatures, type PIDCanvasProps, PanelContent, PanelTabs, type PipeEdge, type PipeStyle, type Point, type PortDefinition, type PortInstance, type PortType, RightPanel, RightToggleButton, SVGArea, SVGLockedOverlay, type SVGLockedOverlayProps, ScrollableSVGWrapper, type SelectionState, Selector, type SelectorOption, type SelectorProps, type SimulationOptions, Sparkline, type SparklineProps, StatusIndicator, type StatusIndicatorProps, type SymbolCategory, type SymbolDefinition, SymbolLibrary, type SymbolLibraryProps, type SymbolMetadata, type TelemetryBinding, type TelemetryMap, type TelemetryStatus$1 as TelemetryStatus, type TelemetryValue, ThemeProvider, ThemeToggle, type ThemeToggleProps, type Thresholds, type Transform, TrendLine, type TrendLineProps, type UseDragOptions, type UseDragResult, type UseSelectionOptions, type UseSelectionResult, type UseTelemetryOptions, type UseTelemetryResult, type UseTelemetryStatusOptions, type UseViewBoxOptions, type UseViewBoxResult, ValueEntry, type ValueEntryProps, type ViewBox, ZoomButton, ZoomControls, calculateThresholdStatus, createControlBinding, exampleDiagram, exportDiagram, generateRoutePoints, getAvailableSymbols, getPortWorldPosition, getSymbolDefinition, importDiagram, mockSymbolLibrary, nodeHasPort, overlayStyles, registerSymbol, registerSymbols, useDeviceControls, useDrag, useKeyboardShortcuts, useSelection, useSimulation, useTelemetry, useTelemetryStatus, useTheme, useViewBox, validateDiagram };