UNPKG

@wavequery/conductor

Version:
41 lines 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NodeComponent = void 0; class NodeComponent { constructor(options = {}) { this.options = { radius: 20, fill: '#fff', stroke: '#333', strokeWidth: 2, labelOffset: 30, ...options }; } render(context, node) { // Draw circle context.beginPath(); context.arc(node.position.x, node.position.y, this.options.radius, 0, Math.PI * 2); context.fillStyle = this.getNodeColor(node.status); context.fill(); context.strokeStyle = this.options.stroke; context.lineWidth = this.options.strokeWidth; context.stroke(); // Draw label context.fillStyle = this.options.stroke; context.font = '12px Arial'; context.textAlign = 'center'; context.fillText(node.label, node.position.x, node.position.y + this.options.labelOffset); } getNodeColor(status) { switch (status) { case 'running': return '#3498db'; case 'completed': return '#2ecc71'; case 'error': return '#e74c3c'; case 'pending': return '#95a5a6'; default: return this.options.fill; } } } exports.NodeComponent = NodeComponent; //# sourceMappingURL=node.js.map