import {LitElement, css, html} from 'lit'; import {customElement, property} from 'lit/decorators.js'; import {LineMedium, LineType, lineColor, lineWidth} from '..'; @customElement('obc-line-cross') export class ObcLineCross extends LitElement { @property({type: String}) medium: LineMedium = LineMedium.normal; @property({type: String}) lineType: LineType = LineType.fluid; override render() { if (this.lineType === LineType.connector) { return html` `; } const color = lineColor(this.medium); const width = lineWidth(this.lineType) + 1; const h = width / 2; let r: number; if (this.lineType === LineType.electric) { r = 4.5; } else if (this.lineType === LineType.air) { r = 10; } else if (this.lineType === LineType.fluid) { r = 6; } else { throw new Error('Invalid line type'); } return html` `; } static override styles = css` :host { display: block; line-height: 0; } svg { position: relative; top: -12px; left: -12px; } `; } declare global { interface HTMLElementTagNameMap { 'obc-line-cross': ObcLineCross; } }