import {LitElement, css, html} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {LineMedium, LineType, lineColor, lineWidth} from '..';
export enum ThreeWayLineDirection {
top = 'top',
right = 'right',
bottom = 'bottom',
left = 'left',
}
@customElement('obc-three-way-line')
export class ObcThreeWayLine extends LitElement {
@property({type: String}) medium: LineMedium = LineMedium.normal;
@property({type: String}) direction: ThreeWayLineDirection =
ThreeWayLineDirection.top;
@property({type: String}) lineType: LineType = LineType.fluid;
override render() {
let rotation = 0;
if (this.direction === ThreeWayLineDirection.top) {
rotation = 180;
} else if (this.direction === ThreeWayLineDirection.right) {
rotation = 270;
} else if (this.direction === ThreeWayLineDirection.bottom) {
rotation = 0;
} else if (this.direction === ThreeWayLineDirection.left) {
rotation = 90;
}
if (this.lineType === LineType.connector) {
return html`
`;
}
const color = lineColor(this.medium);
const width = lineWidth(this.lineType) + 1;
const h = width / 2;
const c = 13 - h; // inner corner lenght
return html`
`;
}
static override styles = css`
:host {
display: block;
line-height: 0;
}
svg {
position: relative;
top: -12px;
left: -12px;
}
`;
}
declare global {
interface HTMLElementTagNameMap {
'obc-three-way-line': ObcThreeWayLine;
}
}