@procaaso/alphinity-ui-components 1.0.11 → 1.1.0
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.cjs +1316 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +297 -3
- package/dist/index.d.ts +297 -3
- package/dist/index.js +1324 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -274,6 +274,8 @@ interface ControlMode {
|
|
|
274
274
|
value: string;
|
|
275
275
|
/** Display label */
|
|
276
276
|
label: string;
|
|
277
|
+
/** Description or context about this mode */
|
|
278
|
+
description?: string;
|
|
277
279
|
/** Whether this mode is currently available */
|
|
278
280
|
enabled?: boolean;
|
|
279
281
|
/** Icon or emoji to display (optional) */
|
|
@@ -486,8 +488,20 @@ interface DeviceControlPanelProps {
|
|
|
486
488
|
onStop?: () => void;
|
|
487
489
|
/** Called when custom action clicked */
|
|
488
490
|
onCustomAction?: (actionId: string) => void;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
+
/** Called when config button clicked (opens config panel for this device) */
|
|
492
|
+
onOpenConfig?: () => void;
|
|
493
|
+
/** Show configuration button in header */
|
|
494
|
+
showConfigButton?: boolean;
|
|
495
|
+
/** Called when undock button clicked (optional, shows undock button if provided) */
|
|
496
|
+
onUndock?: () => void;
|
|
497
|
+
/** Icon to display in undock button (default: '⇱') */
|
|
498
|
+
undockIcon?: string;
|
|
499
|
+
/** Style for mode selector: 'buttons' (horizontal scroll), 'dropdown' (select), or 'modal' (click to open modal) */
|
|
500
|
+
modeSelectionStyle?: 'buttons' | 'dropdown' | 'modal';
|
|
501
|
+
/** Embedded mode - uses static positioning for rendering in containers (default: false) */
|
|
502
|
+
embedded?: boolean;
|
|
503
|
+
}
|
|
504
|
+
declare function DeviceControlPanel({ binding, onClose, position, align, touchOptimized, compact, fontScale, maxHeight, maxWidth, toastDuration, onModeChange, onParameterChange, onStart, onStop, onCustomAction, onOpenConfig, showConfigButton, onUndock, undockIcon, modeSelectionStyle, embedded, }: DeviceControlPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
491
505
|
|
|
492
506
|
type DisplayMode = 'standard' | 'dashboard';
|
|
493
507
|
interface FullscreenContainerProps {
|
|
@@ -1478,6 +1492,286 @@ declare function useDeviceControls(initialBindings?: DeviceControlBinding[]): {
|
|
|
1478
1492
|
sendCustomAction: (nodeId: string, actionId: string) => Promise<void>;
|
|
1479
1493
|
};
|
|
1480
1494
|
|
|
1495
|
+
/**
|
|
1496
|
+
* Configuration parameter definition
|
|
1497
|
+
*/
|
|
1498
|
+
interface ConfigParameter {
|
|
1499
|
+
/** Parameter ID */
|
|
1500
|
+
id: string;
|
|
1501
|
+
/** Display label */
|
|
1502
|
+
label: string;
|
|
1503
|
+
/** Parameter description/help text */
|
|
1504
|
+
description?: string;
|
|
1505
|
+
/** Unit of measurement */
|
|
1506
|
+
unit?: string;
|
|
1507
|
+
/** Parameter type */
|
|
1508
|
+
type: 'number' | 'string' | 'boolean' | 'select' | 'multiselect';
|
|
1509
|
+
/** Current value */
|
|
1510
|
+
value: any;
|
|
1511
|
+
/** Default value */
|
|
1512
|
+
defaultValue?: any;
|
|
1513
|
+
/** Whether parameter is read-only */
|
|
1514
|
+
readOnly?: boolean;
|
|
1515
|
+
/** Whether parameter is enabled/editable */
|
|
1516
|
+
enabled?: boolean;
|
|
1517
|
+
/** Minimum allowed value (for number type) */
|
|
1518
|
+
min?: number;
|
|
1519
|
+
/** Maximum allowed value (for number type) */
|
|
1520
|
+
max?: number;
|
|
1521
|
+
/** Step increment (for number type) */
|
|
1522
|
+
step?: number;
|
|
1523
|
+
/** Decimal precision for display (for number type) */
|
|
1524
|
+
precision?: number;
|
|
1525
|
+
/** Options for select/multiselect type */
|
|
1526
|
+
options?: Array<{
|
|
1527
|
+
value: any;
|
|
1528
|
+
label: string;
|
|
1529
|
+
description?: string;
|
|
1530
|
+
}>;
|
|
1531
|
+
/** Custom validation function - returns true or error message */
|
|
1532
|
+
validate?: (value: any) => boolean | string;
|
|
1533
|
+
/** Required field */
|
|
1534
|
+
required?: boolean;
|
|
1535
|
+
/** Section this parameter belongs to */
|
|
1536
|
+
section?: string;
|
|
1537
|
+
/** Display order within section */
|
|
1538
|
+
order?: number;
|
|
1539
|
+
/** Parameter IDs this depends on - if any are disabled, this is disabled */
|
|
1540
|
+
dependsOn?: string[];
|
|
1541
|
+
/** Conditional visibility - function that determines if parameter should be shown */
|
|
1542
|
+
visibleWhen?: (allValues: Record<string, any>) => boolean;
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Configuration section for grouping parameters
|
|
1546
|
+
*/
|
|
1547
|
+
interface ConfigSection {
|
|
1548
|
+
/** Section ID */
|
|
1549
|
+
id: string;
|
|
1550
|
+
/** Display title */
|
|
1551
|
+
title: string;
|
|
1552
|
+
/** Section description */
|
|
1553
|
+
description?: string;
|
|
1554
|
+
/** Display order */
|
|
1555
|
+
order?: number;
|
|
1556
|
+
/** Whether section is collapsible */
|
|
1557
|
+
collapsible?: boolean;
|
|
1558
|
+
/** Default collapsed state */
|
|
1559
|
+
defaultCollapsed?: boolean;
|
|
1560
|
+
/** Icon to display */
|
|
1561
|
+
icon?: string;
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Configuration state tracking
|
|
1565
|
+
*/
|
|
1566
|
+
interface ConfigState {
|
|
1567
|
+
/** Has unsaved changes */
|
|
1568
|
+
isDirty?: boolean;
|
|
1569
|
+
/** Currently saving */
|
|
1570
|
+
isSaving?: boolean;
|
|
1571
|
+
/** Last save timestamp */
|
|
1572
|
+
lastSaved?: number;
|
|
1573
|
+
/** Last save result */
|
|
1574
|
+
lastSaveResult?: {
|
|
1575
|
+
success: boolean;
|
|
1576
|
+
message?: string;
|
|
1577
|
+
};
|
|
1578
|
+
/** Validation errors */
|
|
1579
|
+
errors?: Record<string, string>;
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Configuration actions/handlers
|
|
1583
|
+
*/
|
|
1584
|
+
interface ConfigActions {
|
|
1585
|
+
/** Handler for applying changes (temporary, may be reverted) */
|
|
1586
|
+
onApply?: (values: Record<string, any>) => Promise<{
|
|
1587
|
+
success: boolean;
|
|
1588
|
+
message?: string;
|
|
1589
|
+
}>;
|
|
1590
|
+
/** Handler for saving changes (permanent) */
|
|
1591
|
+
onSave?: (values: Record<string, any>) => Promise<{
|
|
1592
|
+
success: boolean;
|
|
1593
|
+
message?: string;
|
|
1594
|
+
}>;
|
|
1595
|
+
/** Handler for resetting to defaults */
|
|
1596
|
+
onReset?: () => Promise<{
|
|
1597
|
+
success: boolean;
|
|
1598
|
+
message?: string;
|
|
1599
|
+
}>;
|
|
1600
|
+
/** Handler for canceling changes */
|
|
1601
|
+
onCancel?: () => void;
|
|
1602
|
+
/** Handler for exporting configuration */
|
|
1603
|
+
onExport?: () => Promise<{
|
|
1604
|
+
success: boolean;
|
|
1605
|
+
data?: any;
|
|
1606
|
+
message?: string;
|
|
1607
|
+
}>;
|
|
1608
|
+
/** Handler for importing configuration */
|
|
1609
|
+
onImport?: (data: any) => Promise<{
|
|
1610
|
+
success: boolean;
|
|
1611
|
+
message?: string;
|
|
1612
|
+
}>;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Display configuration
|
|
1616
|
+
*/
|
|
1617
|
+
interface ConfigDisplay {
|
|
1618
|
+
/** Panel title */
|
|
1619
|
+
title?: string;
|
|
1620
|
+
/** Panel subtitle */
|
|
1621
|
+
subtitle?: string;
|
|
1622
|
+
/** Custom CSS class */
|
|
1623
|
+
className?: string;
|
|
1624
|
+
/** Custom inline styles */
|
|
1625
|
+
style?: React.CSSProperties;
|
|
1626
|
+
/** Show apply button */
|
|
1627
|
+
showApply?: boolean;
|
|
1628
|
+
/** Show save button */
|
|
1629
|
+
showSave?: boolean;
|
|
1630
|
+
/** Show reset button */
|
|
1631
|
+
showReset?: boolean;
|
|
1632
|
+
/** Show cancel button */
|
|
1633
|
+
showCancel?: boolean;
|
|
1634
|
+
/** Show export button */
|
|
1635
|
+
showExport?: boolean;
|
|
1636
|
+
/** Show import button */
|
|
1637
|
+
showImport?: boolean;
|
|
1638
|
+
/** Confirmation message for reset action */
|
|
1639
|
+
resetConfirmMessage?: string;
|
|
1640
|
+
/** Confirmation message for critical saves */
|
|
1641
|
+
saveConfirmMessage?: string;
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Theme customization for config panel
|
|
1645
|
+
*/
|
|
1646
|
+
interface ConfigTheme {
|
|
1647
|
+
/** Background color */
|
|
1648
|
+
backgroundColor?: string;
|
|
1649
|
+
/** Surface/card color */
|
|
1650
|
+
surfaceColor?: string;
|
|
1651
|
+
/** Border color */
|
|
1652
|
+
borderColor?: string;
|
|
1653
|
+
/** Text color */
|
|
1654
|
+
textColor?: string;
|
|
1655
|
+
/** Muted text color */
|
|
1656
|
+
mutedTextColor?: string;
|
|
1657
|
+
/** Accent color */
|
|
1658
|
+
accentColor?: string;
|
|
1659
|
+
/** Error color */
|
|
1660
|
+
errorColor?: string;
|
|
1661
|
+
/** Success color */
|
|
1662
|
+
successColor?: string;
|
|
1663
|
+
/** Warning color */
|
|
1664
|
+
warningColor?: string;
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Device configuration binding - maps a node to device configuration parameters
|
|
1668
|
+
*/
|
|
1669
|
+
interface DeviceConfigBinding {
|
|
1670
|
+
/** Node ID this configuration is bound to */
|
|
1671
|
+
nodeId: string;
|
|
1672
|
+
/** Device tag/identifier */
|
|
1673
|
+
tag: string;
|
|
1674
|
+
/** Device name */
|
|
1675
|
+
deviceName?: string;
|
|
1676
|
+
/** Device type */
|
|
1677
|
+
deviceType?: string;
|
|
1678
|
+
/** Configuration sections */
|
|
1679
|
+
sections?: ConfigSection[];
|
|
1680
|
+
/** Configuration parameters (flat list, optionally grouped by section) */
|
|
1681
|
+
parameters: ConfigParameter[];
|
|
1682
|
+
/** Current state */
|
|
1683
|
+
state: ConfigState;
|
|
1684
|
+
/** Available actions */
|
|
1685
|
+
actions: ConfigActions;
|
|
1686
|
+
/** Display configuration */
|
|
1687
|
+
display?: ConfigDisplay;
|
|
1688
|
+
/** Theme customization */
|
|
1689
|
+
theme?: ConfigTheme;
|
|
1690
|
+
/** Additional metadata */
|
|
1691
|
+
metadata?: Record<string, any>;
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* Map of device configurations by node ID
|
|
1695
|
+
*/
|
|
1696
|
+
type DeviceConfigMap = Map<string, DeviceConfigBinding>;
|
|
1697
|
+
/**
|
|
1698
|
+
* Helper to create a config binding with defaults
|
|
1699
|
+
*/
|
|
1700
|
+
declare function createConfigBinding(nodeId: string, tag: string, parameters: ConfigParameter[], actions: ConfigActions, options?: {
|
|
1701
|
+
deviceName?: string;
|
|
1702
|
+
deviceType?: string;
|
|
1703
|
+
sections?: ConfigSection[];
|
|
1704
|
+
display?: ConfigDisplay;
|
|
1705
|
+
theme?: ConfigTheme;
|
|
1706
|
+
metadata?: Record<string, any>;
|
|
1707
|
+
}): DeviceConfigBinding;
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* Hook for managing device configuration bindings
|
|
1711
|
+
*/
|
|
1712
|
+
declare function useDeviceConfigs(initialConfigs?: DeviceConfigBinding[]): {
|
|
1713
|
+
configs: DeviceConfigMap;
|
|
1714
|
+
getConfig: (nodeId: string) => DeviceConfigBinding | undefined;
|
|
1715
|
+
setConfig: (config: DeviceConfigBinding) => void;
|
|
1716
|
+
removeConfig: (nodeId: string) => void;
|
|
1717
|
+
clearConfigs: () => void;
|
|
1718
|
+
updateConfig: (nodeId: string, updates: Partial<DeviceConfigBinding>) => void;
|
|
1719
|
+
updateConfigState: (nodeId: string, stateUpdates: Partial<DeviceConfigBinding["state"]>) => void;
|
|
1720
|
+
updateConfigBatch: (updates: Record<string, Partial<DeviceConfigBinding>>) => void;
|
|
1721
|
+
updateParameterValue: (nodeId: string, parameterId: string, value: any) => void;
|
|
1722
|
+
applyConfig: (nodeId: string) => Promise<{
|
|
1723
|
+
success: boolean;
|
|
1724
|
+
message?: string;
|
|
1725
|
+
}>;
|
|
1726
|
+
saveConfig: (nodeId: string) => Promise<{
|
|
1727
|
+
success: boolean;
|
|
1728
|
+
message?: string;
|
|
1729
|
+
}>;
|
|
1730
|
+
resetConfig: (nodeId: string) => Promise<{
|
|
1731
|
+
success: boolean;
|
|
1732
|
+
message?: string;
|
|
1733
|
+
}>;
|
|
1734
|
+
cancelConfig: (nodeId: string) => void;
|
|
1735
|
+
validateConfig: (nodeId: string) => {
|
|
1736
|
+
valid: boolean;
|
|
1737
|
+
errors: Record<string, string>;
|
|
1738
|
+
};
|
|
1739
|
+
};
|
|
1740
|
+
|
|
1741
|
+
interface DeviceConfigPanelProps {
|
|
1742
|
+
/** Configuration binding to display */
|
|
1743
|
+
binding: DeviceConfigBinding | null;
|
|
1744
|
+
/** Called when panel should close */
|
|
1745
|
+
onClose: () => void;
|
|
1746
|
+
/** Called when undock button clicked (optional, shows undock button if provided) */
|
|
1747
|
+
onUndock?: () => void;
|
|
1748
|
+
/** Icon to display in undock button (default: '⇱') */
|
|
1749
|
+
undockIcon?: string;
|
|
1750
|
+
/** Panel position */
|
|
1751
|
+
position?: 'bottom' | 'side';
|
|
1752
|
+
/** Horizontal alignment for bottom position (default: center) */
|
|
1753
|
+
align?: 'left' | 'center' | 'right';
|
|
1754
|
+
/** Optimize for touch (larger targets) */
|
|
1755
|
+
touchOptimized?: boolean;
|
|
1756
|
+
/** Compact mode - reduces padding and spacing */
|
|
1757
|
+
compact?: boolean;
|
|
1758
|
+
/** Font size scale (default: 1.0) */
|
|
1759
|
+
fontScale?: number;
|
|
1760
|
+
/** Maximum height for bottom position (default: 70vh) */
|
|
1761
|
+
maxHeight?: string;
|
|
1762
|
+
/** Maximum width for bottom position (default: none) */
|
|
1763
|
+
maxWidth?: string;
|
|
1764
|
+
/** Toast notification duration in milliseconds (default: 3000) */
|
|
1765
|
+
toastDuration?: number;
|
|
1766
|
+
/** Called when controls button clicked (opens control panel for this device) */
|
|
1767
|
+
onOpenControls?: () => void;
|
|
1768
|
+
/** Show controls button in header */
|
|
1769
|
+
showControlsButton?: boolean;
|
|
1770
|
+
/** Embedded mode - uses static positioning for rendering in containers (default: false) */
|
|
1771
|
+
embedded?: boolean;
|
|
1772
|
+
}
|
|
1773
|
+
declare function DeviceConfigPanel({ binding, onClose, onUndock, undockIcon, position, align, touchOptimized, compact, fontScale, maxHeight, maxWidth, toastDuration, onOpenControls, showControlsButton, embedded, }: DeviceConfigPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
1774
|
+
|
|
1481
1775
|
/**
|
|
1482
1776
|
* Options for simulation behavior
|
|
1483
1777
|
*/
|
|
@@ -1516,4 +1810,4 @@ interface SimulationOptions {
|
|
|
1516
1810
|
*/
|
|
1517
1811
|
declare function useSimulation(telemetry: TelemetryMap, updateTelemetryBatch: (updates: Array<any>) => void, options?: SimulationOptions): void;
|
|
1518
1812
|
|
|
1519
|
-
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 };
|
|
1813
|
+
export { type AnchorType, Button, type ButtonProps, CardHeader, CardUnit, CardValue, CircularGauge, type CircularGaugeProps, type ConfigActions, type ConfigDisplay, type ConfigParameter, type ConfigSection, type ConfigState, type ConfigTheme, type ControlCapabilities, type ControlMode, ControlPanel, type ControlPanelProps, type ControlParameter, type ControlState, DEFAULT_THRESHOLDS, DashboardCard, type DataBinding, type DeviceConfigBinding, type DeviceConfigMap, DeviceConfigPanel, type DeviceConfigPanelProps, 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, createConfigBinding, createControlBinding, exampleDiagram, exportDiagram, generateRoutePoints, getAvailableSymbols, getPortWorldPosition, getSymbolDefinition, importDiagram, mockSymbolLibrary, nodeHasPort, overlayStyles, registerSymbol, registerSymbols, useDeviceConfigs, useDeviceControls, useDrag, useKeyboardShortcuts, useSelection, useSimulation, useTelemetry, useTelemetryStatus, useTheme, useViewBox, validateDiagram };
|
package/dist/index.d.ts
CHANGED
|
@@ -274,6 +274,8 @@ interface ControlMode {
|
|
|
274
274
|
value: string;
|
|
275
275
|
/** Display label */
|
|
276
276
|
label: string;
|
|
277
|
+
/** Description or context about this mode */
|
|
278
|
+
description?: string;
|
|
277
279
|
/** Whether this mode is currently available */
|
|
278
280
|
enabled?: boolean;
|
|
279
281
|
/** Icon or emoji to display (optional) */
|
|
@@ -486,8 +488,20 @@ interface DeviceControlPanelProps {
|
|
|
486
488
|
onStop?: () => void;
|
|
487
489
|
/** Called when custom action clicked */
|
|
488
490
|
onCustomAction?: (actionId: string) => void;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
+
/** Called when config button clicked (opens config panel for this device) */
|
|
492
|
+
onOpenConfig?: () => void;
|
|
493
|
+
/** Show configuration button in header */
|
|
494
|
+
showConfigButton?: boolean;
|
|
495
|
+
/** Called when undock button clicked (optional, shows undock button if provided) */
|
|
496
|
+
onUndock?: () => void;
|
|
497
|
+
/** Icon to display in undock button (default: '⇱') */
|
|
498
|
+
undockIcon?: string;
|
|
499
|
+
/** Style for mode selector: 'buttons' (horizontal scroll), 'dropdown' (select), or 'modal' (click to open modal) */
|
|
500
|
+
modeSelectionStyle?: 'buttons' | 'dropdown' | 'modal';
|
|
501
|
+
/** Embedded mode - uses static positioning for rendering in containers (default: false) */
|
|
502
|
+
embedded?: boolean;
|
|
503
|
+
}
|
|
504
|
+
declare function DeviceControlPanel({ binding, onClose, position, align, touchOptimized, compact, fontScale, maxHeight, maxWidth, toastDuration, onModeChange, onParameterChange, onStart, onStop, onCustomAction, onOpenConfig, showConfigButton, onUndock, undockIcon, modeSelectionStyle, embedded, }: DeviceControlPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
491
505
|
|
|
492
506
|
type DisplayMode = 'standard' | 'dashboard';
|
|
493
507
|
interface FullscreenContainerProps {
|
|
@@ -1478,6 +1492,286 @@ declare function useDeviceControls(initialBindings?: DeviceControlBinding[]): {
|
|
|
1478
1492
|
sendCustomAction: (nodeId: string, actionId: string) => Promise<void>;
|
|
1479
1493
|
};
|
|
1480
1494
|
|
|
1495
|
+
/**
|
|
1496
|
+
* Configuration parameter definition
|
|
1497
|
+
*/
|
|
1498
|
+
interface ConfigParameter {
|
|
1499
|
+
/** Parameter ID */
|
|
1500
|
+
id: string;
|
|
1501
|
+
/** Display label */
|
|
1502
|
+
label: string;
|
|
1503
|
+
/** Parameter description/help text */
|
|
1504
|
+
description?: string;
|
|
1505
|
+
/** Unit of measurement */
|
|
1506
|
+
unit?: string;
|
|
1507
|
+
/** Parameter type */
|
|
1508
|
+
type: 'number' | 'string' | 'boolean' | 'select' | 'multiselect';
|
|
1509
|
+
/** Current value */
|
|
1510
|
+
value: any;
|
|
1511
|
+
/** Default value */
|
|
1512
|
+
defaultValue?: any;
|
|
1513
|
+
/** Whether parameter is read-only */
|
|
1514
|
+
readOnly?: boolean;
|
|
1515
|
+
/** Whether parameter is enabled/editable */
|
|
1516
|
+
enabled?: boolean;
|
|
1517
|
+
/** Minimum allowed value (for number type) */
|
|
1518
|
+
min?: number;
|
|
1519
|
+
/** Maximum allowed value (for number type) */
|
|
1520
|
+
max?: number;
|
|
1521
|
+
/** Step increment (for number type) */
|
|
1522
|
+
step?: number;
|
|
1523
|
+
/** Decimal precision for display (for number type) */
|
|
1524
|
+
precision?: number;
|
|
1525
|
+
/** Options for select/multiselect type */
|
|
1526
|
+
options?: Array<{
|
|
1527
|
+
value: any;
|
|
1528
|
+
label: string;
|
|
1529
|
+
description?: string;
|
|
1530
|
+
}>;
|
|
1531
|
+
/** Custom validation function - returns true or error message */
|
|
1532
|
+
validate?: (value: any) => boolean | string;
|
|
1533
|
+
/** Required field */
|
|
1534
|
+
required?: boolean;
|
|
1535
|
+
/** Section this parameter belongs to */
|
|
1536
|
+
section?: string;
|
|
1537
|
+
/** Display order within section */
|
|
1538
|
+
order?: number;
|
|
1539
|
+
/** Parameter IDs this depends on - if any are disabled, this is disabled */
|
|
1540
|
+
dependsOn?: string[];
|
|
1541
|
+
/** Conditional visibility - function that determines if parameter should be shown */
|
|
1542
|
+
visibleWhen?: (allValues: Record<string, any>) => boolean;
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Configuration section for grouping parameters
|
|
1546
|
+
*/
|
|
1547
|
+
interface ConfigSection {
|
|
1548
|
+
/** Section ID */
|
|
1549
|
+
id: string;
|
|
1550
|
+
/** Display title */
|
|
1551
|
+
title: string;
|
|
1552
|
+
/** Section description */
|
|
1553
|
+
description?: string;
|
|
1554
|
+
/** Display order */
|
|
1555
|
+
order?: number;
|
|
1556
|
+
/** Whether section is collapsible */
|
|
1557
|
+
collapsible?: boolean;
|
|
1558
|
+
/** Default collapsed state */
|
|
1559
|
+
defaultCollapsed?: boolean;
|
|
1560
|
+
/** Icon to display */
|
|
1561
|
+
icon?: string;
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Configuration state tracking
|
|
1565
|
+
*/
|
|
1566
|
+
interface ConfigState {
|
|
1567
|
+
/** Has unsaved changes */
|
|
1568
|
+
isDirty?: boolean;
|
|
1569
|
+
/** Currently saving */
|
|
1570
|
+
isSaving?: boolean;
|
|
1571
|
+
/** Last save timestamp */
|
|
1572
|
+
lastSaved?: number;
|
|
1573
|
+
/** Last save result */
|
|
1574
|
+
lastSaveResult?: {
|
|
1575
|
+
success: boolean;
|
|
1576
|
+
message?: string;
|
|
1577
|
+
};
|
|
1578
|
+
/** Validation errors */
|
|
1579
|
+
errors?: Record<string, string>;
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Configuration actions/handlers
|
|
1583
|
+
*/
|
|
1584
|
+
interface ConfigActions {
|
|
1585
|
+
/** Handler for applying changes (temporary, may be reverted) */
|
|
1586
|
+
onApply?: (values: Record<string, any>) => Promise<{
|
|
1587
|
+
success: boolean;
|
|
1588
|
+
message?: string;
|
|
1589
|
+
}>;
|
|
1590
|
+
/** Handler for saving changes (permanent) */
|
|
1591
|
+
onSave?: (values: Record<string, any>) => Promise<{
|
|
1592
|
+
success: boolean;
|
|
1593
|
+
message?: string;
|
|
1594
|
+
}>;
|
|
1595
|
+
/** Handler for resetting to defaults */
|
|
1596
|
+
onReset?: () => Promise<{
|
|
1597
|
+
success: boolean;
|
|
1598
|
+
message?: string;
|
|
1599
|
+
}>;
|
|
1600
|
+
/** Handler for canceling changes */
|
|
1601
|
+
onCancel?: () => void;
|
|
1602
|
+
/** Handler for exporting configuration */
|
|
1603
|
+
onExport?: () => Promise<{
|
|
1604
|
+
success: boolean;
|
|
1605
|
+
data?: any;
|
|
1606
|
+
message?: string;
|
|
1607
|
+
}>;
|
|
1608
|
+
/** Handler for importing configuration */
|
|
1609
|
+
onImport?: (data: any) => Promise<{
|
|
1610
|
+
success: boolean;
|
|
1611
|
+
message?: string;
|
|
1612
|
+
}>;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Display configuration
|
|
1616
|
+
*/
|
|
1617
|
+
interface ConfigDisplay {
|
|
1618
|
+
/** Panel title */
|
|
1619
|
+
title?: string;
|
|
1620
|
+
/** Panel subtitle */
|
|
1621
|
+
subtitle?: string;
|
|
1622
|
+
/** Custom CSS class */
|
|
1623
|
+
className?: string;
|
|
1624
|
+
/** Custom inline styles */
|
|
1625
|
+
style?: React.CSSProperties;
|
|
1626
|
+
/** Show apply button */
|
|
1627
|
+
showApply?: boolean;
|
|
1628
|
+
/** Show save button */
|
|
1629
|
+
showSave?: boolean;
|
|
1630
|
+
/** Show reset button */
|
|
1631
|
+
showReset?: boolean;
|
|
1632
|
+
/** Show cancel button */
|
|
1633
|
+
showCancel?: boolean;
|
|
1634
|
+
/** Show export button */
|
|
1635
|
+
showExport?: boolean;
|
|
1636
|
+
/** Show import button */
|
|
1637
|
+
showImport?: boolean;
|
|
1638
|
+
/** Confirmation message for reset action */
|
|
1639
|
+
resetConfirmMessage?: string;
|
|
1640
|
+
/** Confirmation message for critical saves */
|
|
1641
|
+
saveConfirmMessage?: string;
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Theme customization for config panel
|
|
1645
|
+
*/
|
|
1646
|
+
interface ConfigTheme {
|
|
1647
|
+
/** Background color */
|
|
1648
|
+
backgroundColor?: string;
|
|
1649
|
+
/** Surface/card color */
|
|
1650
|
+
surfaceColor?: string;
|
|
1651
|
+
/** Border color */
|
|
1652
|
+
borderColor?: string;
|
|
1653
|
+
/** Text color */
|
|
1654
|
+
textColor?: string;
|
|
1655
|
+
/** Muted text color */
|
|
1656
|
+
mutedTextColor?: string;
|
|
1657
|
+
/** Accent color */
|
|
1658
|
+
accentColor?: string;
|
|
1659
|
+
/** Error color */
|
|
1660
|
+
errorColor?: string;
|
|
1661
|
+
/** Success color */
|
|
1662
|
+
successColor?: string;
|
|
1663
|
+
/** Warning color */
|
|
1664
|
+
warningColor?: string;
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Device configuration binding - maps a node to device configuration parameters
|
|
1668
|
+
*/
|
|
1669
|
+
interface DeviceConfigBinding {
|
|
1670
|
+
/** Node ID this configuration is bound to */
|
|
1671
|
+
nodeId: string;
|
|
1672
|
+
/** Device tag/identifier */
|
|
1673
|
+
tag: string;
|
|
1674
|
+
/** Device name */
|
|
1675
|
+
deviceName?: string;
|
|
1676
|
+
/** Device type */
|
|
1677
|
+
deviceType?: string;
|
|
1678
|
+
/** Configuration sections */
|
|
1679
|
+
sections?: ConfigSection[];
|
|
1680
|
+
/** Configuration parameters (flat list, optionally grouped by section) */
|
|
1681
|
+
parameters: ConfigParameter[];
|
|
1682
|
+
/** Current state */
|
|
1683
|
+
state: ConfigState;
|
|
1684
|
+
/** Available actions */
|
|
1685
|
+
actions: ConfigActions;
|
|
1686
|
+
/** Display configuration */
|
|
1687
|
+
display?: ConfigDisplay;
|
|
1688
|
+
/** Theme customization */
|
|
1689
|
+
theme?: ConfigTheme;
|
|
1690
|
+
/** Additional metadata */
|
|
1691
|
+
metadata?: Record<string, any>;
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* Map of device configurations by node ID
|
|
1695
|
+
*/
|
|
1696
|
+
type DeviceConfigMap = Map<string, DeviceConfigBinding>;
|
|
1697
|
+
/**
|
|
1698
|
+
* Helper to create a config binding with defaults
|
|
1699
|
+
*/
|
|
1700
|
+
declare function createConfigBinding(nodeId: string, tag: string, parameters: ConfigParameter[], actions: ConfigActions, options?: {
|
|
1701
|
+
deviceName?: string;
|
|
1702
|
+
deviceType?: string;
|
|
1703
|
+
sections?: ConfigSection[];
|
|
1704
|
+
display?: ConfigDisplay;
|
|
1705
|
+
theme?: ConfigTheme;
|
|
1706
|
+
metadata?: Record<string, any>;
|
|
1707
|
+
}): DeviceConfigBinding;
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* Hook for managing device configuration bindings
|
|
1711
|
+
*/
|
|
1712
|
+
declare function useDeviceConfigs(initialConfigs?: DeviceConfigBinding[]): {
|
|
1713
|
+
configs: DeviceConfigMap;
|
|
1714
|
+
getConfig: (nodeId: string) => DeviceConfigBinding | undefined;
|
|
1715
|
+
setConfig: (config: DeviceConfigBinding) => void;
|
|
1716
|
+
removeConfig: (nodeId: string) => void;
|
|
1717
|
+
clearConfigs: () => void;
|
|
1718
|
+
updateConfig: (nodeId: string, updates: Partial<DeviceConfigBinding>) => void;
|
|
1719
|
+
updateConfigState: (nodeId: string, stateUpdates: Partial<DeviceConfigBinding["state"]>) => void;
|
|
1720
|
+
updateConfigBatch: (updates: Record<string, Partial<DeviceConfigBinding>>) => void;
|
|
1721
|
+
updateParameterValue: (nodeId: string, parameterId: string, value: any) => void;
|
|
1722
|
+
applyConfig: (nodeId: string) => Promise<{
|
|
1723
|
+
success: boolean;
|
|
1724
|
+
message?: string;
|
|
1725
|
+
}>;
|
|
1726
|
+
saveConfig: (nodeId: string) => Promise<{
|
|
1727
|
+
success: boolean;
|
|
1728
|
+
message?: string;
|
|
1729
|
+
}>;
|
|
1730
|
+
resetConfig: (nodeId: string) => Promise<{
|
|
1731
|
+
success: boolean;
|
|
1732
|
+
message?: string;
|
|
1733
|
+
}>;
|
|
1734
|
+
cancelConfig: (nodeId: string) => void;
|
|
1735
|
+
validateConfig: (nodeId: string) => {
|
|
1736
|
+
valid: boolean;
|
|
1737
|
+
errors: Record<string, string>;
|
|
1738
|
+
};
|
|
1739
|
+
};
|
|
1740
|
+
|
|
1741
|
+
interface DeviceConfigPanelProps {
|
|
1742
|
+
/** Configuration binding to display */
|
|
1743
|
+
binding: DeviceConfigBinding | null;
|
|
1744
|
+
/** Called when panel should close */
|
|
1745
|
+
onClose: () => void;
|
|
1746
|
+
/** Called when undock button clicked (optional, shows undock button if provided) */
|
|
1747
|
+
onUndock?: () => void;
|
|
1748
|
+
/** Icon to display in undock button (default: '⇱') */
|
|
1749
|
+
undockIcon?: string;
|
|
1750
|
+
/** Panel position */
|
|
1751
|
+
position?: 'bottom' | 'side';
|
|
1752
|
+
/** Horizontal alignment for bottom position (default: center) */
|
|
1753
|
+
align?: 'left' | 'center' | 'right';
|
|
1754
|
+
/** Optimize for touch (larger targets) */
|
|
1755
|
+
touchOptimized?: boolean;
|
|
1756
|
+
/** Compact mode - reduces padding and spacing */
|
|
1757
|
+
compact?: boolean;
|
|
1758
|
+
/** Font size scale (default: 1.0) */
|
|
1759
|
+
fontScale?: number;
|
|
1760
|
+
/** Maximum height for bottom position (default: 70vh) */
|
|
1761
|
+
maxHeight?: string;
|
|
1762
|
+
/** Maximum width for bottom position (default: none) */
|
|
1763
|
+
maxWidth?: string;
|
|
1764
|
+
/** Toast notification duration in milliseconds (default: 3000) */
|
|
1765
|
+
toastDuration?: number;
|
|
1766
|
+
/** Called when controls button clicked (opens control panel for this device) */
|
|
1767
|
+
onOpenControls?: () => void;
|
|
1768
|
+
/** Show controls button in header */
|
|
1769
|
+
showControlsButton?: boolean;
|
|
1770
|
+
/** Embedded mode - uses static positioning for rendering in containers (default: false) */
|
|
1771
|
+
embedded?: boolean;
|
|
1772
|
+
}
|
|
1773
|
+
declare function DeviceConfigPanel({ binding, onClose, onUndock, undockIcon, position, align, touchOptimized, compact, fontScale, maxHeight, maxWidth, toastDuration, onOpenControls, showControlsButton, embedded, }: DeviceConfigPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
1774
|
+
|
|
1481
1775
|
/**
|
|
1482
1776
|
* Options for simulation behavior
|
|
1483
1777
|
*/
|
|
@@ -1516,4 +1810,4 @@ interface SimulationOptions {
|
|
|
1516
1810
|
*/
|
|
1517
1811
|
declare function useSimulation(telemetry: TelemetryMap, updateTelemetryBatch: (updates: Array<any>) => void, options?: SimulationOptions): void;
|
|
1518
1812
|
|
|
1519
|
-
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 };
|
|
1813
|
+
export { type AnchorType, Button, type ButtonProps, CardHeader, CardUnit, CardValue, CircularGauge, type CircularGaugeProps, type ConfigActions, type ConfigDisplay, type ConfigParameter, type ConfigSection, type ConfigState, type ConfigTheme, type ControlCapabilities, type ControlMode, ControlPanel, type ControlPanelProps, type ControlParameter, type ControlState, DEFAULT_THRESHOLDS, DashboardCard, type DataBinding, type DeviceConfigBinding, type DeviceConfigMap, DeviceConfigPanel, type DeviceConfigPanelProps, 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, createConfigBinding, createControlBinding, exampleDiagram, exportDiagram, generateRoutePoints, getAvailableSymbols, getPortWorldPosition, getSymbolDefinition, importDiagram, mockSymbolLibrary, nodeHasPort, overlayStyles, registerSymbol, registerSymbols, useDeviceConfigs, useDeviceControls, useDrag, useKeyboardShortcuts, useSelection, useSimulation, useTelemetry, useTelemetryStatus, useTheme, useViewBox, validateDiagram };
|