import {LitElement, html, unsafeCSS} from 'lit'; import {customElement, property} from 'lit/decorators.js'; import compentStyle from './azimuth-thruster-labeled.css?inline'; import {CommandStatus} from '../badge-command/badge-command'; import {classMap} from 'lit/directives/class-map.js'; import '../badge-command/badge-command'; import '../instrument-field/instrument-field'; import '../azimuth-thruster/azimuth-thruster'; import {InstrumentFieldSize} from '../instrument-field/instrument-field'; import {InstrumentState} from '../types'; import {ifDefined} from 'lit/directives/if-defined.js'; import {AngleAdvice} from '../watch/advice'; import {LinearAdvice} from '../thruster/advice'; import {PropellerType} from '../thruster/propeller'; export enum AzimuthThrusterLabeledSize { medium = 'medium', large = 'large', } @customElement('obc-azimuth-thruster-labeled') export class ObcAzimuthThrusterLabeled extends LitElement { @property({type: String}) label = ''; @property({type: String}) commandStatus: CommandStatus = CommandStatus.InCommand; @property({type: String}) size: AzimuthThrusterLabeledSize = AzimuthThrusterLabeledSize.medium; @property({type: Number}) angle = 0; @property({type: Number}) angleSetpoint: number | undefined; @property({type: Boolean}) atAngleSetpoint: boolean = false; @property({type: Boolean}) disableAutoAtAngleSetpoint: boolean = false; @property({type: Number}) autoAtAngleSetpointDeadband: number = 2; @property({type: Boolean}) touching: boolean = false; @property({type: Number}) thrust = 0; @property({type: Number}) thrustSetpoint: number | undefined; @property({type: Boolean}) atThrustSetpoint: boolean = false; @property({type: Boolean}) thrustSetpointAtZero: boolean = false; @property({type: Boolean}) disableAutoAtThrustSetpoint: boolean = false; @property({type: Number}) autoAtThrustSetpointDeadband: number = 1; @property({type: Number}) thrustSetpointAtZeroDeadband: number = 0.1; @property({type: Array, attribute: false}) angleAdvices: AngleAdvice[] = []; @property({type: Array, attribute: false}) thrustAdvices: LinearAdvice[] = []; @property({type: Boolean}) singleDirection: boolean = false; @property({type: String}) topPropeller: PropellerType = PropellerType.none; @property({type: String}) bottomPropeller: PropellerType = PropellerType.none; override render() { const fieldSize = this.size === AzimuthThrusterLabeledSize.large ? InstrumentFieldSize.large : InstrumentFieldSize.regular; let state: InstrumentState = InstrumentState.inCommand; if ( [ CommandStatus.NoCommand, CommandStatus.Blocked, CommandStatus.CommandAvailable, ].includes(this.commandStatus) ) { state = InstrumentState.active; } return html`
${this.label}
`; } static override styles = unsafeCSS(compentStyle); } declare global { interface HTMLElementTagNameMap { 'obc-azimuth-thruster-labeled': ObcAzimuthThrusterLabeled; } }