@procaaso/alphinity-ui-components 1.0.1 → 1.0.2
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/README.md +4 -4
- package/dist/index.cjs +3117 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +676 -2
- package/dist/index.d.ts +676 -2
- package/dist/index.js +3095 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
4
5
|
import * as _emotion_styled from '@emotion/styled';
|
|
5
6
|
import * as _emotion_react from '@emotion/react';
|
|
6
7
|
import * as _mui_system from '@mui/system';
|
|
7
8
|
import * as _mui_material from '@mui/material';
|
|
8
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
interface ButtonProps extends react__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
11
|
variant?: 'primary' | 'secondary';
|
|
@@ -436,4 +436,678 @@ interface ThemeToggleProps extends react__default.HTMLAttributes<HTMLDivElement>
|
|
|
436
436
|
}
|
|
437
437
|
declare const ThemeToggle: react__default.FC<ThemeToggleProps>;
|
|
438
438
|
|
|
439
|
-
|
|
439
|
+
interface NodeInstance {
|
|
440
|
+
id: string;
|
|
441
|
+
symbolId: string;
|
|
442
|
+
transform: Transform;
|
|
443
|
+
ports?: PortInstance[];
|
|
444
|
+
visible?: boolean;
|
|
445
|
+
label?: string;
|
|
446
|
+
labelOffset?: {
|
|
447
|
+
x: number;
|
|
448
|
+
y: number;
|
|
449
|
+
};
|
|
450
|
+
metadata?: Record<string, unknown>;
|
|
451
|
+
}
|
|
452
|
+
interface Transform {
|
|
453
|
+
x: number;
|
|
454
|
+
y: number;
|
|
455
|
+
rotation: number;
|
|
456
|
+
scale?: number;
|
|
457
|
+
flipX?: boolean;
|
|
458
|
+
flipY?: boolean;
|
|
459
|
+
}
|
|
460
|
+
interface PortInstance {
|
|
461
|
+
id: string;
|
|
462
|
+
x: number;
|
|
463
|
+
y: number;
|
|
464
|
+
type: PortType;
|
|
465
|
+
label?: string;
|
|
466
|
+
}
|
|
467
|
+
type PortType = 'inlet' | 'outlet' | 'control' | 'signal';
|
|
468
|
+
|
|
469
|
+
interface PipeEdge {
|
|
470
|
+
id: string;
|
|
471
|
+
fromNodeId: string;
|
|
472
|
+
fromPortId?: string;
|
|
473
|
+
toNodeId: string;
|
|
474
|
+
toPortId?: string;
|
|
475
|
+
routePoints: Point[];
|
|
476
|
+
visible?: boolean;
|
|
477
|
+
style?: PipeStyle;
|
|
478
|
+
label?: string;
|
|
479
|
+
showLabel?: boolean;
|
|
480
|
+
labelOffset?: {
|
|
481
|
+
x: number;
|
|
482
|
+
y: number;
|
|
483
|
+
};
|
|
484
|
+
metadata?: Record<string, unknown>;
|
|
485
|
+
}
|
|
486
|
+
interface Point {
|
|
487
|
+
x: number;
|
|
488
|
+
y: number;
|
|
489
|
+
}
|
|
490
|
+
interface PipeStyle {
|
|
491
|
+
stroke: string;
|
|
492
|
+
strokeWidth: number;
|
|
493
|
+
strokeDasharray?: string;
|
|
494
|
+
opacity?: number;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
interface Overlay {
|
|
498
|
+
id: string;
|
|
499
|
+
type: OverlayType;
|
|
500
|
+
anchorType: AnchorType;
|
|
501
|
+
anchorId?: string;
|
|
502
|
+
offset: Point;
|
|
503
|
+
binding?: DataBinding;
|
|
504
|
+
content?: OverlayContent;
|
|
505
|
+
style?: React.CSSProperties;
|
|
506
|
+
}
|
|
507
|
+
type OverlayType = 'value' | 'label' | 'gauge' | 'trend' | 'custom';
|
|
508
|
+
type AnchorType = 'node' | 'pipe' | 'absolute';
|
|
509
|
+
interface DataBinding {
|
|
510
|
+
sourceType: 'tag' | 'expression' | 'static';
|
|
511
|
+
source: string;
|
|
512
|
+
format?: string;
|
|
513
|
+
updateInterval?: number;
|
|
514
|
+
transform?: string;
|
|
515
|
+
}
|
|
516
|
+
interface OverlayContent {
|
|
517
|
+
text?: string;
|
|
518
|
+
component?: string;
|
|
519
|
+
props?: Record<string, unknown>;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
interface Diagram {
|
|
523
|
+
id: string;
|
|
524
|
+
name: string;
|
|
525
|
+
version: string;
|
|
526
|
+
viewBox: ViewBox;
|
|
527
|
+
nodes: NodeInstance[];
|
|
528
|
+
pipes: PipeEdge[];
|
|
529
|
+
overlays: Overlay[];
|
|
530
|
+
metadata?: DiagramMetadata;
|
|
531
|
+
}
|
|
532
|
+
interface ViewBox {
|
|
533
|
+
x: number;
|
|
534
|
+
y: number;
|
|
535
|
+
width: number;
|
|
536
|
+
height: number;
|
|
537
|
+
}
|
|
538
|
+
interface DiagramMetadata {
|
|
539
|
+
author?: string;
|
|
540
|
+
created?: string;
|
|
541
|
+
modified?: string;
|
|
542
|
+
tags?: string[];
|
|
543
|
+
description?: string;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
interface SymbolDefinition {
|
|
547
|
+
id: string;
|
|
548
|
+
name: string;
|
|
549
|
+
category: SymbolCategory;
|
|
550
|
+
svgContent: string;
|
|
551
|
+
viewBox: ViewBox;
|
|
552
|
+
ports: PortDefinition[];
|
|
553
|
+
thumbnail?: string;
|
|
554
|
+
metadata?: SymbolMetadata;
|
|
555
|
+
}
|
|
556
|
+
type SymbolCategory = 'valve' | 'pump' | 'vessel' | 'heat-exchanger' | 'instrument' | 'actuator' | 'sensor' | 'other';
|
|
557
|
+
interface PortDefinition {
|
|
558
|
+
id: string;
|
|
559
|
+
x: number;
|
|
560
|
+
y: number;
|
|
561
|
+
type: PortType;
|
|
562
|
+
label?: string;
|
|
563
|
+
direction?: 'in' | 'out' | 'bi';
|
|
564
|
+
}
|
|
565
|
+
interface SymbolMetadata {
|
|
566
|
+
description?: string;
|
|
567
|
+
manufacturer?: string;
|
|
568
|
+
modelNumber?: string;
|
|
569
|
+
tags?: string[];
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Status levels for telemetry values
|
|
574
|
+
*/
|
|
575
|
+
type TelemetryStatus$1 = 'normal' | 'warning' | 'alarm' | 'fault' | 'off';
|
|
576
|
+
/**
|
|
577
|
+
* Live telemetry value with status
|
|
578
|
+
*/
|
|
579
|
+
interface TelemetryValue {
|
|
580
|
+
/** Current value */
|
|
581
|
+
value: number | string | boolean;
|
|
582
|
+
/** Status/severity level */
|
|
583
|
+
status: TelemetryStatus$1;
|
|
584
|
+
/** Unit of measurement (optional) */
|
|
585
|
+
unit?: string;
|
|
586
|
+
/** Timestamp of last update */
|
|
587
|
+
timestamp?: number;
|
|
588
|
+
/** Quality indicator (0-100, where 100 is good) */
|
|
589
|
+
quality?: number;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Telemetry data binding for a node
|
|
593
|
+
*/
|
|
594
|
+
interface TelemetryBinding {
|
|
595
|
+
/** Node ID this telemetry is bound to */
|
|
596
|
+
nodeId: string;
|
|
597
|
+
/** Tag/variable name for the telemetry source */
|
|
598
|
+
tag: string;
|
|
599
|
+
/** Current telemetry value */
|
|
600
|
+
value: TelemetryValue;
|
|
601
|
+
/** Historical values for sparkline/trend (optional) */
|
|
602
|
+
history?: number[];
|
|
603
|
+
/** Thresholds for status determination */
|
|
604
|
+
thresholds?: {
|
|
605
|
+
/** High-High threshold (value >= this triggers alarm) */
|
|
606
|
+
highHigh?: number;
|
|
607
|
+
/** High threshold (value >= this triggers warning) */
|
|
608
|
+
high?: number;
|
|
609
|
+
/** Low threshold (value <= this triggers warning) */
|
|
610
|
+
low?: number;
|
|
611
|
+
/** Low-Low threshold (value <= this triggers alarm/fault) */
|
|
612
|
+
lowLow?: number;
|
|
613
|
+
/** Custom label for high-high threshold */
|
|
614
|
+
highHighLabel?: string;
|
|
615
|
+
/** Custom label for high threshold */
|
|
616
|
+
highLabel?: string;
|
|
617
|
+
/** Custom label for low threshold */
|
|
618
|
+
lowLabel?: string;
|
|
619
|
+
/** Custom label for low-low threshold */
|
|
620
|
+
lowLowLabel?: string;
|
|
621
|
+
};
|
|
622
|
+
/** Custom colors for status levels */
|
|
623
|
+
statusColors?: {
|
|
624
|
+
normal?: string;
|
|
625
|
+
warning?: string;
|
|
626
|
+
alarm?: string;
|
|
627
|
+
fault?: string;
|
|
628
|
+
off?: string;
|
|
629
|
+
};
|
|
630
|
+
/** Display configuration */
|
|
631
|
+
display?: {
|
|
632
|
+
/** Show value overlay above node */
|
|
633
|
+
showValue?: boolean;
|
|
634
|
+
/** Show status indicator */
|
|
635
|
+
showStatus?: boolean;
|
|
636
|
+
/** Custom label for the value */
|
|
637
|
+
label?: string;
|
|
638
|
+
/** Number of decimal places for numeric values */
|
|
639
|
+
precision?: number;
|
|
640
|
+
/** Show sparkline trend (requires history) */
|
|
641
|
+
showSparkline?: boolean;
|
|
642
|
+
/** Sparkline color (defaults to status color) */
|
|
643
|
+
sparklineColor?: string;
|
|
644
|
+
/** Custom background color (hex code or 'status' for status-based color) */
|
|
645
|
+
backgroundColor?: string;
|
|
646
|
+
/** Custom text color for value display (hex code) */
|
|
647
|
+
textColor?: string;
|
|
648
|
+
/** Horizontal offset from node center */
|
|
649
|
+
offsetX?: number;
|
|
650
|
+
/** Vertical offset from node center */
|
|
651
|
+
offsetY?: number;
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Map of telemetry bindings by node ID
|
|
656
|
+
*/
|
|
657
|
+
type TelemetryMap = Map<string, TelemetryBinding>;
|
|
658
|
+
|
|
659
|
+
interface UseViewBoxOptions {
|
|
660
|
+
/** Initial viewBox configuration */
|
|
661
|
+
initialViewBox: ViewBox;
|
|
662
|
+
/** Enable pan interaction (default: true) */
|
|
663
|
+
enablePan?: boolean;
|
|
664
|
+
/** Enable zoom interaction (default: true) */
|
|
665
|
+
enableZoom?: boolean;
|
|
666
|
+
/** Minimum zoom level (smaller = more zoomed in, default: 0.1) */
|
|
667
|
+
minZoom?: number;
|
|
668
|
+
/** Maximum zoom level (larger = more zoomed out, default: 10) */
|
|
669
|
+
maxZoom?: number;
|
|
670
|
+
/** Zoom sensitivity (default: 0.001) */
|
|
671
|
+
zoomSensitivity?: number;
|
|
672
|
+
/** Allow left-click drag for panning (default: true for touch-friendly) */
|
|
673
|
+
allowLeftClickPan?: boolean;
|
|
674
|
+
}
|
|
675
|
+
interface UseViewBoxResult {
|
|
676
|
+
/** Current viewBox state */
|
|
677
|
+
viewBox: ViewBox;
|
|
678
|
+
/** Reset viewBox to initial state */
|
|
679
|
+
resetViewBox: () => void;
|
|
680
|
+
/** Zoom in (decrease viewBox size) */
|
|
681
|
+
zoomIn: () => void;
|
|
682
|
+
/** Zoom out (increase viewBox size) */
|
|
683
|
+
zoomOut: () => void;
|
|
684
|
+
/** Convert screen coordinates to world (SVG) coordinates */
|
|
685
|
+
screenToWorld: (screenX: number, screenY: number) => {
|
|
686
|
+
x: number;
|
|
687
|
+
y: number;
|
|
688
|
+
};
|
|
689
|
+
/** SVG element ref to attach event listeners */
|
|
690
|
+
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Custom hook for managing ViewBox state with pan and zoom interactions
|
|
694
|
+
*
|
|
695
|
+
* Pan controls:
|
|
696
|
+
* - Left mouse button + drag (if allowLeftClickPan=true, default)
|
|
697
|
+
* - Middle mouse button + drag (always)
|
|
698
|
+
* - Space + left mouse button + drag (always)
|
|
699
|
+
* - Touch drag (single finger)
|
|
700
|
+
*
|
|
701
|
+
* Zoom controls:
|
|
702
|
+
* - Mouse wheel (zoom to cursor position)
|
|
703
|
+
* - Pinch gesture (touch devices)
|
|
704
|
+
* - Programmatic zoomIn/zoomOut functions
|
|
705
|
+
*/
|
|
706
|
+
declare function useViewBox(options: UseViewBoxOptions): UseViewBoxResult;
|
|
707
|
+
|
|
708
|
+
interface SelectionState {
|
|
709
|
+
/** IDs of selected nodes */
|
|
710
|
+
selectedNodeIds: Set<string>;
|
|
711
|
+
/** IDs of selected pipes */
|
|
712
|
+
selectedPipeIds: Set<string>;
|
|
713
|
+
}
|
|
714
|
+
interface UseSelectionOptions {
|
|
715
|
+
/** Allow multiple selection with Ctrl/Cmd key (default: true) */
|
|
716
|
+
multiSelect?: boolean;
|
|
717
|
+
/** Initial selection state */
|
|
718
|
+
initialSelection?: SelectionState;
|
|
719
|
+
/** Callback when selection changes */
|
|
720
|
+
onSelectionChange?: (selection: SelectionState) => void;
|
|
721
|
+
}
|
|
722
|
+
interface UseSelectionResult {
|
|
723
|
+
/** Current selection state */
|
|
724
|
+
selection: SelectionState;
|
|
725
|
+
/** Check if a node is selected */
|
|
726
|
+
isNodeSelected: (nodeId: string) => boolean;
|
|
727
|
+
/** Check if a pipe is selected */
|
|
728
|
+
isPipeSelected: (pipeId: string) => boolean;
|
|
729
|
+
/** Select a node */
|
|
730
|
+
selectNode: (nodeId: string, multiSelect?: boolean) => void;
|
|
731
|
+
/** Select a pipe */
|
|
732
|
+
selectPipe: (pipeId: string, multiSelect?: boolean) => void;
|
|
733
|
+
/** Clear all selections */
|
|
734
|
+
clearSelection: () => void;
|
|
735
|
+
/** Select multiple nodes */
|
|
736
|
+
selectNodes: (nodeIds: string[]) => void;
|
|
737
|
+
/** Select multiple pipes */
|
|
738
|
+
selectPipes: (pipeIds: string[]) => void;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Custom hook for managing selection state in P&ID diagrams
|
|
742
|
+
*
|
|
743
|
+
* Supports:
|
|
744
|
+
* - Single selection (click)
|
|
745
|
+
* - Multi-selection (Ctrl+click)
|
|
746
|
+
* - Programmatic selection
|
|
747
|
+
* - Selection callbacks
|
|
748
|
+
*/
|
|
749
|
+
declare function useSelection(options?: UseSelectionOptions): UseSelectionResult;
|
|
750
|
+
|
|
751
|
+
interface UseTelemetryOptions {
|
|
752
|
+
/** Initial telemetry bindings */
|
|
753
|
+
initialBindings?: TelemetryBinding[];
|
|
754
|
+
/** Callback when telemetry values change */
|
|
755
|
+
onTelemetryChange?: (bindings: TelemetryMap) => void;
|
|
756
|
+
/** Auto-refresh interval in milliseconds (0 = disabled) */
|
|
757
|
+
refreshInterval?: number;
|
|
758
|
+
}
|
|
759
|
+
interface UseTelemetryResult {
|
|
760
|
+
/** Current telemetry bindings map */
|
|
761
|
+
telemetry: TelemetryMap;
|
|
762
|
+
/** Update a single telemetry value */
|
|
763
|
+
updateTelemetry: (nodeId: string, value: TelemetryValue) => void;
|
|
764
|
+
/** Update multiple telemetry values at once */
|
|
765
|
+
updateTelemetryBatch: (updates: Array<{
|
|
766
|
+
nodeId: string;
|
|
767
|
+
value: TelemetryValue;
|
|
768
|
+
history?: number[];
|
|
769
|
+
}>) => void;
|
|
770
|
+
/** Get telemetry for a specific node */
|
|
771
|
+
getTelemetry: (nodeId: string) => TelemetryBinding | undefined;
|
|
772
|
+
/** Clear all telemetry data */
|
|
773
|
+
clearTelemetry: () => void;
|
|
774
|
+
/** Set telemetry bindings */
|
|
775
|
+
setBindings: (bindings: TelemetryBinding[]) => void;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Custom hook for managing telemetry data bindings
|
|
779
|
+
*
|
|
780
|
+
* Supports:
|
|
781
|
+
* - Real-time value updates
|
|
782
|
+
* - Status monitoring (normal, warning, alarm, fault, off)
|
|
783
|
+
* - Batch updates for performance
|
|
784
|
+
* - Auto-refresh capability
|
|
785
|
+
* - Quality indicators
|
|
786
|
+
*/
|
|
787
|
+
declare function useTelemetry(options?: UseTelemetryOptions): UseTelemetryResult;
|
|
788
|
+
|
|
789
|
+
interface DragPoint {
|
|
790
|
+
x: number;
|
|
791
|
+
y: number;
|
|
792
|
+
}
|
|
793
|
+
interface DragState {
|
|
794
|
+
/** Whether drag is currently active */
|
|
795
|
+
isDragging: boolean;
|
|
796
|
+
/** Initial position when drag started */
|
|
797
|
+
startPosition: DragPoint | null;
|
|
798
|
+
/** Current drag offset from start */
|
|
799
|
+
offset: DragPoint;
|
|
800
|
+
/** ID of the item being dragged */
|
|
801
|
+
draggedId: string | null;
|
|
802
|
+
}
|
|
803
|
+
interface UseDragOptions {
|
|
804
|
+
/** Callback when drag starts */
|
|
805
|
+
onDragStart?: (id: string, position: DragPoint) => void;
|
|
806
|
+
/** Callback during drag movement */
|
|
807
|
+
onDragMove?: (id: string, offset: DragPoint, position: DragPoint) => void;
|
|
808
|
+
/** Callback when drag ends */
|
|
809
|
+
onDragEnd?: (id: string, offset: DragPoint, finalPosition: DragPoint) => void;
|
|
810
|
+
/** Snap to grid size (0 = no snap) */
|
|
811
|
+
snapToGrid?: number;
|
|
812
|
+
/** Minimum drag distance before triggering (prevents accidental drags) */
|
|
813
|
+
dragThreshold?: number;
|
|
814
|
+
/** Convert screen coordinates to world coordinates */
|
|
815
|
+
screenToWorld?: (screenX: number, screenY: number) => DragPoint;
|
|
816
|
+
}
|
|
817
|
+
interface UseDragResult {
|
|
818
|
+
/** Current drag state */
|
|
819
|
+
dragState: DragState;
|
|
820
|
+
/** Start dragging an item */
|
|
821
|
+
startDrag: (id: string, event: React.MouseEvent | React.TouchEvent, itemPosition: DragPoint) => void;
|
|
822
|
+
/** Cancel current drag */
|
|
823
|
+
cancelDrag: () => void;
|
|
824
|
+
/** Check if a specific item is being dragged */
|
|
825
|
+
isDraggingItem: (id: string) => boolean;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Custom hook for drag-and-drop functionality in P&ID diagrams
|
|
829
|
+
*
|
|
830
|
+
* Supports:
|
|
831
|
+
* - Mouse drag
|
|
832
|
+
* - Touch drag
|
|
833
|
+
* - Snap-to-grid
|
|
834
|
+
* - World coordinate conversion (for SVG viewBox)
|
|
835
|
+
* - Drag threshold to prevent accidental drags
|
|
836
|
+
*/
|
|
837
|
+
declare function useDrag(options?: UseDragOptions): UseDragResult;
|
|
838
|
+
|
|
839
|
+
interface KeyboardShortcutsOptions {
|
|
840
|
+
/** Callback when Delete or Backspace is pressed */
|
|
841
|
+
onDelete?: () => void;
|
|
842
|
+
/** Callback when Ctrl+C is pressed */
|
|
843
|
+
onCopy?: () => void;
|
|
844
|
+
/** Callback when Ctrl+V is pressed */
|
|
845
|
+
onPaste?: () => void;
|
|
846
|
+
/** Callback when Ctrl+Z is pressed (undo) */
|
|
847
|
+
onUndo?: () => void;
|
|
848
|
+
/** Callback when Ctrl+Y or Ctrl+Shift+Z is pressed (redo) */
|
|
849
|
+
onRedo?: () => void;
|
|
850
|
+
/** Callback when Ctrl+A is pressed (select all) */
|
|
851
|
+
onSelectAll?: () => void;
|
|
852
|
+
/** Enable keyboard shortcuts (default: true) */
|
|
853
|
+
enabled?: boolean;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Custom hook for handling keyboard shortcuts in P&ID diagrams
|
|
857
|
+
*
|
|
858
|
+
* Supported shortcuts:
|
|
859
|
+
* - Delete/Backspace: Delete selected items
|
|
860
|
+
* - Ctrl+C: Copy selected items
|
|
861
|
+
* - Ctrl+V: Paste copied items
|
|
862
|
+
* - Ctrl+Z: Undo last action
|
|
863
|
+
* - Ctrl+Y / Ctrl+Shift+Z: Redo
|
|
864
|
+
* - Ctrl+A: Select all
|
|
865
|
+
*/
|
|
866
|
+
declare function useKeyboardShortcuts(options: KeyboardShortcutsOptions): void;
|
|
867
|
+
|
|
868
|
+
interface PIDCanvasFeatures {
|
|
869
|
+
/** Enable pan interaction (default: true) */
|
|
870
|
+
pan?: boolean;
|
|
871
|
+
/** Enable zoom interaction (default: true) */
|
|
872
|
+
zoom?: boolean;
|
|
873
|
+
/** Enable selection interaction (default: false) */
|
|
874
|
+
selection?: boolean;
|
|
875
|
+
/** Allow multi-selection with Ctrl/Cmd key (default: true) */
|
|
876
|
+
multiSelect?: boolean;
|
|
877
|
+
/** Enable telemetry data overlays (default: false) */
|
|
878
|
+
telemetry?: boolean;
|
|
879
|
+
/** Enable drag-and-drop for nodes (default: false) */
|
|
880
|
+
dragNodes?: boolean;
|
|
881
|
+
/** Snap dragged nodes to grid (0 = no snap) */
|
|
882
|
+
snapToGrid?: number;
|
|
883
|
+
/** Enable keyboard shortcuts for delete/copy/paste (default: false) */
|
|
884
|
+
keyboardShortcuts?: boolean;
|
|
885
|
+
/** Enable pipe waypoint editing (drag waypoints, add/remove) (default: false) */
|
|
886
|
+
editPipeRoutes?: boolean;
|
|
887
|
+
/** Enable dropping symbols from library to add nodes (default: false) */
|
|
888
|
+
allowSymbolDrop?: boolean;
|
|
889
|
+
/** Enable connection drawing mode to create pipes between nodes (default: false) */
|
|
890
|
+
connectionMode?: boolean;
|
|
891
|
+
}
|
|
892
|
+
interface PIDCanvasProps extends react__default.HTMLAttributes<HTMLDivElement> {
|
|
893
|
+
/** The diagram to render */
|
|
894
|
+
diagram: Diagram;
|
|
895
|
+
/** Optional className for the container */
|
|
896
|
+
className?: string;
|
|
897
|
+
/** Optional inline styles for the container */
|
|
898
|
+
style?: react__default.CSSProperties;
|
|
899
|
+
/** Enable interactive features (pan, zoom, selection, telemetry, dragNodes) */
|
|
900
|
+
features?: PIDCanvasFeatures;
|
|
901
|
+
/** Callback when selection changes */
|
|
902
|
+
onSelectionChange?: (selection: SelectionState) => void;
|
|
903
|
+
/** Callback when a node is clicked */
|
|
904
|
+
onNodeClick?: (nodeId: string) => void;
|
|
905
|
+
/** Callback when a pipe is clicked */
|
|
906
|
+
onPipeClick?: (pipeId: string) => void;
|
|
907
|
+
/** Callback when a node is moved (drag-and-drop) */
|
|
908
|
+
onNodeMove?: (nodeId: string, newX: number, newY: number) => void;
|
|
909
|
+
/** Callback when diagram changes (for internal state updates) */
|
|
910
|
+
onDiagramChange?: (diagram: Diagram) => void;
|
|
911
|
+
/** Callback when items are deleted */
|
|
912
|
+
onDelete?: (nodeIds: string[], pipeIds: string[]) => void;
|
|
913
|
+
/** Callback when items are copied (returns copied data for external storage) */
|
|
914
|
+
onItemsCopied?: (nodeIds: string[], pipeIds: string[]) => void;
|
|
915
|
+
/** Callback when paste is requested (external code should handle the paste logic) */
|
|
916
|
+
onPaste?: () => void;
|
|
917
|
+
/** Callback when a symbol is dropped onto canvas (returns symbol ID and position) */
|
|
918
|
+
onSymbolDrop?: (symbolId: string, position: {
|
|
919
|
+
x: number;
|
|
920
|
+
y: number;
|
|
921
|
+
}) => void;
|
|
922
|
+
/** Callback when a pipe is created via connection mode */
|
|
923
|
+
onPipeCreated?: (sourceNodeId: string, targetNodeId: string, sourcePortId?: string, targetPortId?: string) => void;
|
|
924
|
+
/** Telemetry data bindings for live values */
|
|
925
|
+
telemetry?: TelemetryMap;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* PIDCanvas - Interactive canvas for rendering P&ID diagrams
|
|
929
|
+
*
|
|
930
|
+
* Features:
|
|
931
|
+
* - Renders nodes (PR #3) and pipes (PR #4) with static layout
|
|
932
|
+
* - Drag-and-drop: Drag nodes to reposition (PR #8)
|
|
933
|
+
*
|
|
934
|
+
* Future: Editing tools, symbol library UI
|
|
935
|
+
*/
|
|
936
|
+
declare function PIDCanvas({ diagram, className, style, features, onSelectionChange, onNodeClick, onPipeClick, onNodeMove, onDiagramChange, onDelete, onItemsCopied, onPaste, onSymbolDrop, onPipeCreated, telemetry, ...props }: PIDCanvasProps): react__default.ReactElement;
|
|
937
|
+
|
|
938
|
+
interface SymbolLibraryProps {
|
|
939
|
+
/** Optional className for styling */
|
|
940
|
+
className?: string;
|
|
941
|
+
/** Callback when a symbol drag starts */
|
|
942
|
+
onSymbolDragStart?: (symbolId: string, event: react__default.DragEvent) => void;
|
|
943
|
+
/** Show category filter */
|
|
944
|
+
showCategories?: boolean;
|
|
945
|
+
/** Custom symbol categories */
|
|
946
|
+
categories?: string[];
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* SymbolLibrary - Browse and drag symbols onto the canvas
|
|
950
|
+
*
|
|
951
|
+
* Displays available symbols organized by category
|
|
952
|
+
* Supports drag-and-drop to add new nodes to diagrams
|
|
953
|
+
*/
|
|
954
|
+
declare function SymbolLibrary({ className, onSymbolDragStart, showCategories, categories, }: SymbolLibraryProps): react__default.ReactElement;
|
|
955
|
+
|
|
956
|
+
interface NodeConfigPanelProps {
|
|
957
|
+
/** Selected node to configure */
|
|
958
|
+
node: NodeInstance;
|
|
959
|
+
/** Telemetry binding for the node (if any) */
|
|
960
|
+
binding: TelemetryBinding | null;
|
|
961
|
+
/** Callback when node properties are updated */
|
|
962
|
+
onUpdateNode: (updates: Partial<NodeInstance>) => void;
|
|
963
|
+
/** Callback when telemetry is added/updated */
|
|
964
|
+
onUpdateTelemetry: (updates: any) => void;
|
|
965
|
+
/** Callback when telemetry binding is added for the first time */
|
|
966
|
+
onAddTelemetry?: () => void;
|
|
967
|
+
/** Callback when node is removed */
|
|
968
|
+
onRemove: () => void;
|
|
969
|
+
/** Additional CSS class name */
|
|
970
|
+
className?: string;
|
|
971
|
+
/** Custom styles */
|
|
972
|
+
style?: react__default.CSSProperties;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* NodeConfigPanel - Reusable configuration panel for editing node properties and telemetry
|
|
976
|
+
*
|
|
977
|
+
* @example
|
|
978
|
+
* ```tsx
|
|
979
|
+
* <NodeConfigPanel
|
|
980
|
+
* node={selectedNode}
|
|
981
|
+
* binding={telemetry.get(selectedNode.id)}
|
|
982
|
+
* onUpdateNode={(updates) => updateNode(selectedNode.id, updates)}
|
|
983
|
+
* onUpdateTelemetry={(updates) => updateTelemetryBatch([updates])}
|
|
984
|
+
* onRemove={() => removeNode(selectedNode.id)}
|
|
985
|
+
* />
|
|
986
|
+
* ```
|
|
987
|
+
*/
|
|
988
|
+
declare function NodeConfigPanel({ node, binding, onUpdateNode, onUpdateTelemetry, onAddTelemetry, onRemove, className, style, }: NodeConfigPanelProps): react_jsx_runtime.JSX.Element;
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Validates a diagram object structure
|
|
992
|
+
*/
|
|
993
|
+
declare function validateDiagram(diagram: unknown): {
|
|
994
|
+
valid: boolean;
|
|
995
|
+
errors: string[];
|
|
996
|
+
};
|
|
997
|
+
/**
|
|
998
|
+
* Serializes a diagram to JSON string
|
|
999
|
+
*/
|
|
1000
|
+
declare function exportDiagram(diagram: Diagram): string;
|
|
1001
|
+
/**
|
|
1002
|
+
* Parses a diagram from JSON string
|
|
1003
|
+
*/
|
|
1004
|
+
declare function importDiagram(json: string): Diagram;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Calculate the world position of a port on a node instance
|
|
1008
|
+
*
|
|
1009
|
+
* Takes into account the node's transform (position, rotation, scale, flip)
|
|
1010
|
+
* and the port's position within the symbol's viewBox
|
|
1011
|
+
*/
|
|
1012
|
+
declare function getPortWorldPosition(node: NodeInstance, portId: string): Point | null;
|
|
1013
|
+
/**
|
|
1014
|
+
* Generate route points for a pipe from source port to destination port
|
|
1015
|
+
*
|
|
1016
|
+
* Options:
|
|
1017
|
+
* - direct: Straight line from source to destination
|
|
1018
|
+
* - orthogonal: Right-angle routing (future enhancement)
|
|
1019
|
+
* - custom: Provide your own waypoints
|
|
1020
|
+
*/
|
|
1021
|
+
declare function generateRoutePoints(fromNode: NodeInstance, fromPortId: string, toNode: NodeInstance, toPortId: string, options?: {
|
|
1022
|
+
style?: 'direct' | 'orthogonal';
|
|
1023
|
+
waypoints?: Point[];
|
|
1024
|
+
}): Point[];
|
|
1025
|
+
/**
|
|
1026
|
+
* Validate that a node has a specific port
|
|
1027
|
+
*/
|
|
1028
|
+
declare function nodeHasPort(node: NodeInstance, portId: string): boolean;
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Example P&ID diagram with a simple valve-pump-tank flow
|
|
1032
|
+
* Uses automatic port-to-port connection routing
|
|
1033
|
+
*/
|
|
1034
|
+
declare const exampleDiagram: Diagram;
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Mock symbol library with basic P&ID shapes
|
|
1038
|
+
* Phase 4 will add proper symbol library management
|
|
1039
|
+
*/
|
|
1040
|
+
declare const mockSymbolLibrary: Record<string, SymbolDefinition>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Get symbol definition by ID
|
|
1043
|
+
*/
|
|
1044
|
+
declare function getSymbolDefinition(symbolId: string): SymbolDefinition | undefined;
|
|
1045
|
+
/**
|
|
1046
|
+
* Get all available symbol IDs
|
|
1047
|
+
*/
|
|
1048
|
+
declare function getAvailableSymbols(): string[];
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Telemetry status type
|
|
1052
|
+
*/
|
|
1053
|
+
type TelemetryStatus = 'normal' | 'warning' | 'alarm' | 'fault' | 'off';
|
|
1054
|
+
/**
|
|
1055
|
+
* Threshold configuration
|
|
1056
|
+
*/
|
|
1057
|
+
interface Thresholds {
|
|
1058
|
+
highHigh?: number;
|
|
1059
|
+
high?: number;
|
|
1060
|
+
low?: number;
|
|
1061
|
+
lowLow?: number;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Calculate status based on value and thresholds
|
|
1065
|
+
* @param value - Current numeric value
|
|
1066
|
+
* @param thresholds - Threshold configuration
|
|
1067
|
+
* @returns Status string
|
|
1068
|
+
*/
|
|
1069
|
+
declare function calculateThresholdStatus(value: number, thresholds?: Thresholds): TelemetryStatus;
|
|
1070
|
+
/**
|
|
1071
|
+
* Default thresholds for typical industrial processes (percentage-based)
|
|
1072
|
+
*/
|
|
1073
|
+
declare const DEFAULT_THRESHOLDS: Thresholds;
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Options for simulation behavior
|
|
1077
|
+
*/
|
|
1078
|
+
interface SimulationOptions {
|
|
1079
|
+
/** Update interval in milliseconds (default: 2000) */
|
|
1080
|
+
interval?: number;
|
|
1081
|
+
/** Whether simulation is enabled (default: true) */
|
|
1082
|
+
enabled?: boolean;
|
|
1083
|
+
/** Maximum change per update (default: 10) */
|
|
1084
|
+
maxChange?: number;
|
|
1085
|
+
/** Minimum value clamp (default: 0) */
|
|
1086
|
+
minValue?: number;
|
|
1087
|
+
/** Maximum value clamp (default: 100) */
|
|
1088
|
+
maxValue?: number;
|
|
1089
|
+
/** Maximum history length (default: 10) */
|
|
1090
|
+
historyLength?: number;
|
|
1091
|
+
/** Custom value generator function */
|
|
1092
|
+
generateValue?: (currentValue: number, nodeId: string) => number;
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Hook to automatically simulate telemetry data updates
|
|
1096
|
+
* Randomly updates numeric telemetry values and calculates status based on thresholds
|
|
1097
|
+
*
|
|
1098
|
+
* @param telemetry - Telemetry map from useTelemetry
|
|
1099
|
+
* @param updateTelemetryBatch - Batch update function from useTelemetry
|
|
1100
|
+
* @param options - Simulation configuration options
|
|
1101
|
+
*
|
|
1102
|
+
* @example
|
|
1103
|
+
* ```tsx
|
|
1104
|
+
* const { telemetry, updateTelemetryBatch } = useTelemetry();
|
|
1105
|
+
* useSimulation(telemetry, updateTelemetryBatch, {
|
|
1106
|
+
* interval: 2000,
|
|
1107
|
+
* enabled: mode === 'runtime'
|
|
1108
|
+
* });
|
|
1109
|
+
* ```
|
|
1110
|
+
*/
|
|
1111
|
+
declare function useSimulation(telemetry: TelemetryMap, updateTelemetryBatch: (updates: Array<any>) => void, options?: SimulationOptions): void;
|
|
1112
|
+
|
|
1113
|
+
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 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 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, useTheme, useViewBox, validateDiagram };
|