import {LitElement, html, css} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {LineMedium, lineColor, LineType, lineWidth} from '../index';
export enum CornerLineDirection {
topRight = 'top-right',
topLeft = 'top-left',
bottomRight = 'bottom-right',
bottomLeft = 'bottom-left',
}
export type CornerLineDirectionType =
| 'top-right'
| 'top-left'
| 'bottom-right'
| 'bottom-left';
@customElement('obc-corner-line')
export class ObcCornerLine extends LitElement {
@property({type: String}) medium: LineMedium = LineMedium.normal;
@property({type: String}) direction: CornerLineDirectionType =
CornerLineDirection.topRight;
@property({type: String}) lineType: LineType = LineType.fluid;
override render() {
let rotation = 270;
if (this.direction === CornerLineDirection.topLeft) {
rotation = 180;
} else if (this.direction === CornerLineDirection.bottomLeft) {
rotation = 90;
} else if (this.direction === CornerLineDirection.bottomRight) {
rotation = 0;
}
if (this.lineType === LineType.connector) {
return html`
`;
}
const color = lineColor(this.medium);
const width = lineWidth(this.lineType);
const r1 = 6 - 0.5 - width / 2;
const r2 = 6 + 0.5 + width / 2;
if (this.lineType === LineType.air) {
const r1 = 2.5;
const r2 = 11.5;
return html`
`;
} else {
return html`
`;
}
}
static override styles = css`
:host {
display: block;
line-height: 0;
}
svg {
position: relative;
top: -12px;
left: -12px;
}
`;
}
declare global {
interface HTMLElementTagNameMap {
'obc-corner-line': ObcCornerLine;
}
}