@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.18 → 2.2.0-next.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +141 -145
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +593 -2034
  4. package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.d.ts +20 -0
  5. package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.d.ts.map +1 -1
  6. package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.js +1 -0
  7. package/dist/automation/automation-button/abstract-automation-button-storybook-helpers.js.map +1 -1
  8. package/dist/automation/automation-button/abstract-automation-button.d.ts +5 -5
  9. package/dist/automation/automation-button/abstract-automation-button.d.ts.map +1 -1
  10. package/dist/automation/automation-button/abstract-automation-button.js +21 -47
  11. package/dist/automation/automation-button/abstract-automation-button.js.map +1 -1
  12. package/dist/automation/automation-button/badge-layout.d.ts +5 -7
  13. package/dist/automation/automation-button/badge-layout.d.ts.map +1 -1
  14. package/dist/automation/automation-button/badge-layout.js +32 -14
  15. package/dist/automation/automation-button/badge-layout.js.map +1 -1
  16. package/dist/automation/automation-button/badge-settings-controller.d.ts +11 -0
  17. package/dist/automation/automation-button/badge-settings-controller.d.ts.map +1 -0
  18. package/dist/automation/automation-button/badge-settings-controller.js +13 -0
  19. package/dist/automation/automation-button/badge-settings-controller.js.map +1 -0
  20. package/dist/automation/automation-button/badge-symbols.d.ts +37 -0
  21. package/dist/automation/automation-button/badge-symbols.d.ts.map +1 -0
  22. package/dist/automation/automation-button/badge-symbols.js +84 -0
  23. package/dist/automation/automation-button/badge-symbols.js.map +1 -0
  24. package/dist/automation/automation-tank/automation-tank.d.ts +5 -4
  25. package/dist/automation/automation-tank/automation-tank.d.ts.map +1 -1
  26. package/dist/automation/automation-tank/automation-tank.js +13 -47
  27. package/dist/automation/automation-tank/automation-tank.js.map +1 -1
  28. package/dist/automation/specialty-tank/abstract-specialty-tank.d.ts +5 -4
  29. package/dist/automation/specialty-tank/abstract-specialty-tank.d.ts.map +1 -1
  30. package/dist/automation/specialty-tank/abstract-specialty-tank.js +14 -47
  31. package/dist/automation/specialty-tank/abstract-specialty-tank.js.map +1 -1
  32. package/dist/automation/specialty-tank/specialty-tank-story-meta.d.ts +6 -1
  33. package/dist/automation/specialty-tank/specialty-tank-story-meta.d.ts.map +1 -1
  34. package/dist/automation/specialty-tank/specialty-tank-story-meta.js +10 -0
  35. package/dist/automation/specialty-tank/specialty-tank-story-meta.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/automation/automation-button/abstract-automation-button-storybook-helpers.ts +3 -0
  38. package/src/automation/automation-button/abstract-automation-button.ts +39 -81
  39. package/src/automation/automation-button/badge-layout.ts +13 -21
  40. package/src/automation/automation-button/badge-settings-controller.ts +33 -0
  41. package/src/automation/automation-button/badge-symbols.spec.ts +203 -0
  42. package/src/automation/automation-button/badge-symbols.ts +178 -0
  43. package/src/automation/automation-tank/automation-tank.stories.ts +15 -0
  44. package/src/automation/automation-tank/automation-tank.ts +36 -73
  45. package/src/automation/heat-exchanger/heat-exchanger.stories.ts +2 -0
  46. package/src/automation/heat-pump/heat-pump.stories.ts +2 -0
  47. package/src/automation/hydraulic-separator/hydraulic-separator.stories.ts +2 -0
  48. package/src/automation/pump/pump.stories.ts +44 -0
  49. package/src/automation/specialty-tank/abstract-specialty-tank.ts +36 -73
  50. package/src/automation/specialty-tank/specialty-tank-story-meta.ts +19 -1
@@ -1,5 +1,7 @@
1
1
  import specialty_tank_default from "./specialty-tank.css_inline.js";
2
- import { ObcAutomationBadgeType } from "../automation-badge/automation-badge.js";
2
+ import "../automation-badge/automation-badge.js";
3
+ import { automationBadgeType, currentBadgeSymbolOverride } from "../automation-button/badge-symbols.js";
4
+ import { BadgeSettingsController } from "../automation-button/badge-settings-controller.js";
3
5
  import { AutomationButtonBadgeAlert, AutomationButtonBadgeCommandLocked, AutomationButtonBadgeControl, AutomationButtonBadgeInterlock } from "../automation-button/abstract-automation-button.js";
4
6
  import { ObcAlertFrameMode, ObcAlertFrameThickness, ObcAlertFrameType } from "../../components/alert-frame/alert-frame.js";
5
7
  import { AlertType } from "../../types.js";
@@ -77,6 +79,7 @@ var SpecialtyTankFrame = /* @__PURE__ */ function(SpecialtyTankFrame) {
77
79
  * @property badgeAlert - Alert badge, second in the badge row.
78
80
  * @property badgeInterlock - Interlock badge, third in the badge row.
79
81
  * @property badgeCommandLocked - Command-locked badge, last in the badge row.
82
+ * @property badgeSymbolOverride - Letters that replace badge symbols on this device, per badge property and value, on top of the app-wide ones set with `setAutomationBadgeSymbolOverride()`; for example `{commandLocked: {simulation: 's'}}`. `null` brings the symbol back.
80
83
  * @property alert - Show an alert-frame overlay around the halo, mirroring `obc-automation-tank`.
81
84
  * @property alertFrameType - Shape of the alert frame.
82
85
  * @availableWhen alertFrameType alert==true
@@ -93,8 +96,8 @@ var SpecialtyTankFrame = /* @__PURE__ */ function(SpecialtyTankFrame) {
93
96
  * @availableWhen showAlertIcon alert==true && alertFrameType in [LargeSideFlip, BottomFlip, TopFlip]
94
97
  */
95
98
  var ObcAbstractSpecialtyTank = class extends LitElement {
96
- constructor(..._args) {
97
- super(..._args);
99
+ constructor() {
100
+ super();
98
101
  this.medium = "regular";
99
102
  this.static = false;
100
103
  this.showIcon = true;
@@ -106,6 +109,7 @@ var ObcAbstractSpecialtyTank = class extends LitElement {
106
109
  this.badgeAlert = AutomationButtonBadgeAlert.None;
107
110
  this.badgeInterlock = AutomationButtonBadgeInterlock.None;
108
111
  this.badgeCommandLocked = AutomationButtonBadgeCommandLocked.None;
112
+ this.badgeSymbolOverride = void 0;
109
113
  this.alert = false;
110
114
  this.alertFrameType = ObcAlertFrameType.SmallSideFlip;
111
115
  this.alertFrameThickness = ObcAlertFrameThickness.Small;
@@ -115,6 +119,7 @@ var ObcAbstractSpecialtyTank = class extends LitElement {
115
119
  this.showAlertIcon = false;
116
120
  this._hasBadges = false;
117
121
  this._hasTagSlot = false;
122
+ new BadgeSettingsController(this);
118
123
  }
119
124
  get equipmentIcon() {
120
125
  throw new Error("\"equipmentIcon\" must be implemented in the subclass");
@@ -129,46 +134,6 @@ var ObcAbstractSpecialtyTank = class extends LitElement {
129
134
  get splitMode() {
130
135
  throw new Error("\"splitMode\" must be implemented in the subclass");
131
136
  }
132
- _badgeControlType() {
133
- switch (this.badgeControl) {
134
- case AutomationButtonBadgeControl.Local: return ObcAutomationBadgeType.Local;
135
- case AutomationButtonBadgeControl.LocalOnly: return ObcAutomationBadgeType.LocalOnly;
136
- case AutomationButtonBadgeControl.Manual: return ObcAutomationBadgeType.Manual;
137
- case AutomationButtonBadgeControl.ManualOnly: return ObcAutomationBadgeType.ManualOnly;
138
- case AutomationButtonBadgeControl.Auto: return ObcAutomationBadgeType.Auto;
139
- default: return null;
140
- }
141
- }
142
- _badgeAlertType() {
143
- switch (this.badgeAlert) {
144
- case AutomationButtonBadgeAlert.Silence: return ObcAutomationBadgeType.AlertSilenced;
145
- case AutomationButtonBadgeAlert.Shelved: return ObcAutomationBadgeType.AlertShelved;
146
- case AutomationButtonBadgeAlert.Caution: return ObcAutomationBadgeType.Caution;
147
- case AutomationButtonBadgeAlert.Warning: return ObcAutomationBadgeType.Warning;
148
- case AutomationButtonBadgeAlert.Alarm: return ObcAutomationBadgeType.Alarm;
149
- case AutomationButtonBadgeAlert.LevelCritical: return ObcAutomationBadgeType.LevelCritical;
150
- case AutomationButtonBadgeAlert.LevelHigh: return ObcAutomationBadgeType.LevelHigh;
151
- case AutomationButtonBadgeAlert.LevelMedium: return ObcAutomationBadgeType.LevelMedium;
152
- case AutomationButtonBadgeAlert.LevelLow: return ObcAutomationBadgeType.LevelLow;
153
- case AutomationButtonBadgeAlert.LevelDiagnostic: return ObcAutomationBadgeType.LevelDiagnostic;
154
- default: return null;
155
- }
156
- }
157
- _badgeInterlockType() {
158
- switch (this.badgeInterlock) {
159
- case AutomationButtonBadgeInterlock.Interlock: return ObcAutomationBadgeType.Interlock;
160
- case AutomationButtonBadgeInterlock.InterlockInhibit: return ObcAutomationBadgeType.InterlockInhibit;
161
- case AutomationButtonBadgeInterlock.Simulation: return ObcAutomationBadgeType.Simulation;
162
- default: return null;
163
- }
164
- }
165
- _badgeCommandLockedType() {
166
- switch (this.badgeCommandLocked) {
167
- case AutomationButtonBadgeCommandLocked.CommandLocked: return ObcAutomationBadgeType.CommandLocked;
168
- case AutomationButtonBadgeCommandLocked.Simulation: return ObcAutomationBadgeType.Simulation;
169
- default: return null;
170
- }
171
- }
172
137
  _slotHasContent(e) {
173
138
  return e.target.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || n.nodeType === Node.TEXT_NODE && !!n.textContent?.trim());
174
139
  }
@@ -219,10 +184,11 @@ var ObcAbstractSpecialtyTank = class extends LitElement {
219
184
  `;
220
185
  }
221
186
  render() {
222
- const controlBadge = this._badgeControlType();
223
- const alertBadge = this._badgeAlertType();
224
- const interlockBadge = this._badgeInterlockType();
225
- const commandLockedBadge = this._badgeCommandLockedType();
187
+ const symbolOverride = currentBadgeSymbolOverride(this.badgeSymbolOverride);
188
+ const controlBadge = automationBadgeType("control", this.badgeControl, symbolOverride);
189
+ const alertBadge = automationBadgeType("alert", this.badgeAlert, symbolOverride);
190
+ const interlockBadge = automationBadgeType("interlock", this.badgeInterlock, symbolOverride);
191
+ const commandLockedBadge = automationBadgeType("commandLocked", this.badgeCommandLocked, symbolOverride);
226
192
  const hasEnumBadges = controlBadge !== null || alertBadge !== null || interlockBadge !== null || commandLockedBadge !== null;
227
193
  const badgesHidden = !this._hasBadges && !hasEnumBadges;
228
194
  const tagHidden = !this._hasTagSlot && !this.tag;
@@ -348,6 +314,7 @@ __decorate([property({ type: String })], ObcAbstractSpecialtyTank.prototype, "ba
348
314
  __decorate([property({ type: String })], ObcAbstractSpecialtyTank.prototype, "badgeAlert", void 0);
349
315
  __decorate([property({ type: String })], ObcAbstractSpecialtyTank.prototype, "badgeInterlock", void 0);
350
316
  __decorate([property({ type: String })], ObcAbstractSpecialtyTank.prototype, "badgeCommandLocked", void 0);
317
+ __decorate([property({ attribute: false })], ObcAbstractSpecialtyTank.prototype, "badgeSymbolOverride", void 0);
351
318
  __decorate([property({ type: Boolean })], ObcAbstractSpecialtyTank.prototype, "alert", void 0);
352
319
  __decorate([property({ type: String })], ObcAbstractSpecialtyTank.prototype, "alertFrameType", void 0);
353
320
  __decorate([property({ type: String })], ObcAbstractSpecialtyTank.prototype, "alertFrameThickness", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-specialty-tank.js","names":["componentStyle","_decorate"],"sources":["../../../src/automation/specialty-tank/abstract-specialty-tank.ts"],"sourcesContent":["import {LitElement, html, nothing, svg, unsafeCSS} from 'lit';\nimport type {CSSResultGroup, TemplateResult} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './specialty-tank.css?inline';\nimport '../automation-badge/automation-badge.js';\nimport {ObcAutomationBadgeType} from '../automation-badge/automation-badge.js';\nimport {\n AutomationButtonBadgeAlert,\n AutomationButtonBadgeCommandLocked,\n AutomationButtonBadgeControl,\n AutomationButtonBadgeInterlock,\n} from '../automation-button/abstract-automation-button.js';\nimport '../../components/alert-frame/alert-frame.js';\nimport {\n ObcAlertFrameMode,\n ObcAlertFrameThickness,\n ObcAlertFrameType,\n} from '../../components/alert-frame/alert-frame.js';\nimport {AlertType} from '../../types.js';\nimport {TankPositioning} from '../automation-tank/tank-positioning.js';\n\n/**\n * What the graphic area of a specialty tank shows. Mirrors the Figma\n * `has Medium` property; its fourth value, Static, is the `static` property.\n */\nexport enum SpecialtyTankMedium {\n /** One grey area, no split. */\n regular = 'regular',\n /** Two grey halves separated by a gap. */\n graphic = 'graphic',\n /** Hot (red) and cold (blue) halves separated by a gap. */\n medium = 'medium',\n}\n\n/**\n * Hot/cold split geometry of a specialty tank. Drives the halves and the\n * gap between them through the `split-<mode>` class on the tank frame.\n */\nexport enum SpecialtyTankSplitMode {\n /** Left half hot, right half cold. */\n vertical = 'vertical',\n /** Top half hot, bottom half cold. */\n horizontal = 'horizontal',\n /** Two corner-to-corner triangles, top-left hot and bottom-right cold. */\n diagonal = 'diagonal',\n}\n\n/**\n * Frame silhouette of a specialty tank.\n */\nexport enum SpecialtyTankFrame {\n /** One rounded border box. */\n rounded = 'rounded',\n /** Pressurized-tank silhouette: domed caps on a side-bordered body. */\n pressurized = 'pressurized',\n}\n\n/**\n * Base class for the specialty-tank tiles `obc-heat-pump`,\n * `obc-hydraulic-separator` and `obc-heat-exchanger`. Owns the halo, badge\n * row, tank frame with its hot/cold graphic area and equipment icon, tag\n * readout and alert-frame overlay. Subclasses supply `equipmentIcon`,\n * `equipmentName`, `frame` and `splitMode`, plus their own host footprint.\n *\n * ## Layout\n * The same shell as a compact `obc-automation-tank`: a fixed host (or\n * `positioning=\"button\"` to fill the parent), a 4px-padded halo holding\n * badges, the tank frame and the tag, the frame absorbing the space of\n * empty badge and tag cells. Hover, pressed, focus-visible and `activated`\n * are painted on the halo by the flat style mixin; `clickable` and `static`\n * switch the root between a `<button>`, a plain `<div>` and a\n * `<div role=\"img\">` exactly as the tank does.\n *\n * Not declared `abstract`: the wrapper generators wrap every `LitElement`\n * subclass and pass its constructor as a concrete `Constructor<T>`, so the\n * override points throw instead (same as `ObcAbstractAutomationButton`).\n *\n * @property medium - What the graphic area shows: `regular` (one grey area), `graphic` (two grey halves) or `medium` (hot/cold halves).\n * @property static - Display-only tile with a flat grey frame and a bare icon, rendered as a non-interactive `<div role=\"img\">`. Hides the graphic area.\n * @property showIcon - Show the equipment icon centered on the graphic area.\n * @property tag - Identifier rendered in the tag readout below the frame (for example `#0000`); also the accessible name. The cell collapses when empty.\n * @property positioning - Host positioning model — see `TankPositioning`. `button` (default) fills the parent, `point` uses the fixed design footprint with the P&ID anchor.\n * @property clickable - Whether the tile is interactive. `false` keeps the resting appearance but drops hover, pressed and focus states and leaves the tab order; property-only because the default is `true`.\n * @property activated - Paints the activated background on the halo. Needs an interactive tile.\n * @availableWhen activated clickable==true\n * @property badgeControl - Mode badge (auto / manual / local variants), first in the badge row.\n * @property badgeAlert - Alert badge, second in the badge row.\n * @property badgeInterlock - Interlock badge, third in the badge row.\n * @property badgeCommandLocked - Command-locked badge, last in the badge row.\n * @property alert - Show an alert-frame overlay around the halo, mirroring `obc-automation-tank`.\n * @property alertFrameType - Shape of the alert frame.\n * @availableWhen alertFrameType alert==true\n * @property alertFrameThickness - Thickness of the alert frame.\n * @availableWhen alertFrameThickness alert==true\n * @property alertFrameStatus - Alert status the frame is coloured for.\n * @availableWhen alertFrameStatus alert==true\n * @property alertFrameMode - Acknowledgement state of the alert: `acked-active` (default) is steady,\n * `unacked-active` flashes, `unacked-rectified` flashes a dashed frame.\n * @availableWhen alertFrameMode alert==true\n * @property showAlertCategoryIcon - Shows the alert category icon inside the frame.\n * @availableWhen showAlertCategoryIcon alert==true && alertFrameType in [SmallSideFlip, LargeSideFlip, BottomFlip, TopFlip]\n * @property showAlertIcon - Shows the slotted alert icon inside the frame.\n * @availableWhen showAlertIcon alert==true && alertFrameType in [LargeSideFlip, BottomFlip, TopFlip]\n */\nexport class ObcAbstractSpecialtyTank extends LitElement {\n @property({type: String}) medium: SpecialtyTankMedium =\n SpecialtyTankMedium.regular;\n @property({type: Boolean, reflect: true}) static: boolean = false;\n @property({type: Boolean, attribute: false}) showIcon: boolean = true;\n @property({type: String}) tag: string = '';\n @property({type: String, reflect: true}) positioning: TankPositioning =\n TankPositioning.button;\n @property({type: Boolean, attribute: false}) clickable: boolean = true;\n @property({type: Boolean}) activated: boolean = false;\n\n @property({type: String}) badgeControl: AutomationButtonBadgeControl =\n AutomationButtonBadgeControl.None;\n @property({type: String}) badgeAlert: AutomationButtonBadgeAlert =\n AutomationButtonBadgeAlert.None;\n @property({type: String}) badgeInterlock: AutomationButtonBadgeInterlock =\n AutomationButtonBadgeInterlock.None;\n @property({type: String})\n badgeCommandLocked: AutomationButtonBadgeCommandLocked =\n AutomationButtonBadgeCommandLocked.None;\n\n @property({type: Boolean}) alert: boolean = false;\n @property({type: String}) alertFrameType: ObcAlertFrameType =\n ObcAlertFrameType.SmallSideFlip;\n @property({type: String}) alertFrameThickness: ObcAlertFrameThickness =\n ObcAlertFrameThickness.Small;\n @property({type: String}) alertFrameStatus: AlertType = AlertType.Alarm;\n @property({type: String}) alertFrameMode: ObcAlertFrameMode =\n ObcAlertFrameMode.ackedActive;\n @property({type: Boolean, attribute: false}) showAlertCategoryIcon: boolean =\n true;\n @property({type: Boolean}) showAlertIcon: boolean = false;\n\n @state() private _hasBadges = false;\n @state() private _hasTagSlot = false;\n\n protected get equipmentIcon(): TemplateResult {\n throw new Error('\"equipmentIcon\" must be implemented in the subclass');\n }\n\n /** Accessible-name fallback used when `tag` is empty. */\n protected get equipmentName(): string {\n throw new Error('\"equipmentName\" must be implemented in the subclass');\n }\n\n protected get frame(): SpecialtyTankFrame {\n throw new Error('\"frame\" must be implemented in the subclass');\n }\n\n protected get splitMode(): SpecialtyTankSplitMode {\n throw new Error('\"splitMode\" must be implemented in the subclass');\n }\n\n private _badgeControlType(): ObcAutomationBadgeType | null {\n switch (this.badgeControl) {\n case AutomationButtonBadgeControl.Local:\n return ObcAutomationBadgeType.Local;\n case AutomationButtonBadgeControl.LocalOnly:\n return ObcAutomationBadgeType.LocalOnly;\n case AutomationButtonBadgeControl.Manual:\n return ObcAutomationBadgeType.Manual;\n case AutomationButtonBadgeControl.ManualOnly:\n return ObcAutomationBadgeType.ManualOnly;\n case AutomationButtonBadgeControl.Auto:\n return ObcAutomationBadgeType.Auto;\n default:\n return null;\n }\n }\n\n private _badgeAlertType(): ObcAutomationBadgeType | null {\n switch (this.badgeAlert) {\n case AutomationButtonBadgeAlert.Silence:\n return ObcAutomationBadgeType.AlertSilenced;\n case AutomationButtonBadgeAlert.Shelved:\n return ObcAutomationBadgeType.AlertShelved;\n case AutomationButtonBadgeAlert.Caution:\n return ObcAutomationBadgeType.Caution;\n case AutomationButtonBadgeAlert.Warning:\n return ObcAutomationBadgeType.Warning;\n case AutomationButtonBadgeAlert.Alarm:\n return ObcAutomationBadgeType.Alarm;\n case AutomationButtonBadgeAlert.LevelCritical:\n return ObcAutomationBadgeType.LevelCritical;\n case AutomationButtonBadgeAlert.LevelHigh:\n return ObcAutomationBadgeType.LevelHigh;\n case AutomationButtonBadgeAlert.LevelMedium:\n return ObcAutomationBadgeType.LevelMedium;\n case AutomationButtonBadgeAlert.LevelLow:\n return ObcAutomationBadgeType.LevelLow;\n case AutomationButtonBadgeAlert.LevelDiagnostic:\n return ObcAutomationBadgeType.LevelDiagnostic;\n default:\n return null;\n }\n }\n\n private _badgeInterlockType(): ObcAutomationBadgeType | null {\n switch (this.badgeInterlock) {\n case AutomationButtonBadgeInterlock.Interlock:\n return ObcAutomationBadgeType.Interlock;\n case AutomationButtonBadgeInterlock.InterlockInhibit:\n return ObcAutomationBadgeType.InterlockInhibit;\n case AutomationButtonBadgeInterlock.Simulation:\n return ObcAutomationBadgeType.Simulation;\n default:\n return null;\n }\n }\n\n private _badgeCommandLockedType(): ObcAutomationBadgeType | null {\n switch (this.badgeCommandLocked) {\n case AutomationButtonBadgeCommandLocked.CommandLocked:\n return ObcAutomationBadgeType.CommandLocked;\n case AutomationButtonBadgeCommandLocked.Simulation:\n return ObcAutomationBadgeType.Simulation;\n default:\n return null;\n }\n }\n\n private _slotHasContent(e: Event): boolean {\n const slot = e.target as HTMLSlotElement;\n return slot\n .assignedNodes({flatten: true})\n .some(\n (n) =>\n n.nodeType === Node.ELEMENT_NODE ||\n (n.nodeType === Node.TEXT_NODE && !!n.textContent?.trim())\n );\n }\n\n private _onBadgesSlotChange(e: Event): void {\n this._hasBadges = this._slotHasContent(e);\n }\n\n private _onTagSlotChange(e: Event): void {\n this._hasTagSlot = this._slotHasContent(e);\n }\n\n private renderGraphic(): TemplateResult {\n if (this.medium === SpecialtyTankMedium.regular) {\n return html`<div class=\"area area-single\"></div>`;\n }\n if (this.splitMode === SpecialtyTankSplitMode.diagonal) {\n return this.renderDiagonalSplit();\n }\n return html`\n <div class=\"halves\">\n <div class=\"area area-hot\"></div>\n <div class=\"area area-cold\"></div>\n </div>\n `;\n }\n\n /**\n * Diagonal split in a unit viewBox stretched over the area\n * (`preserveAspectRatio=\"none\"`); every stroke is `non-scaling` so the\n * borders and the gap keep their pixel widths at any aspect ratio. The\n * gap edges are drawn as one wide line per half, clipped to that half,\n * under the narrower frame-coloured gap line.\n */\n private renderDiagonalSplit(): TemplateResult {\n const hot = '0,0 1,0 0,1';\n const cold = '1,0 1,1 0,1';\n return html`\n <div class=\"diagonal\">\n <svg viewBox=\"0 0 1 1\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n ${svg`\n <defs>\n <clipPath id=\"clip-hot\"><polygon points=${hot} /></clipPath>\n <clipPath id=\"clip-cold\"><polygon points=${cold} /></clipPath>\n </defs>\n <polygon class=\"area-fill area-hot\" points=${hot} />\n <polygon class=\"area-fill area-cold\" points=${cold} />\n <polygon class=\"area-stroke area-hot\" points=${hot} clip-path=\"url(#clip-hot)\" vector-effect=\"non-scaling-stroke\" />\n <polygon class=\"area-stroke area-cold\" points=${cold} clip-path=\"url(#clip-cold)\" vector-effect=\"non-scaling-stroke\" />\n <line class=\"gap-edge area-hot\" x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\" clip-path=\"url(#clip-hot)\" vector-effect=\"non-scaling-stroke\" />\n <line class=\"gap-edge area-cold\" x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\" clip-path=\"url(#clip-cold)\" vector-effect=\"non-scaling-stroke\" />\n <line class=\"gap\" x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\" vector-effect=\"non-scaling-stroke\" />\n `}\n </svg>\n </div>\n `;\n }\n\n override render() {\n const controlBadge = this._badgeControlType();\n const alertBadge = this._badgeAlertType();\n const interlockBadge = this._badgeInterlockType();\n const commandLockedBadge = this._badgeCommandLockedType();\n const hasEnumBadges =\n controlBadge !== null ||\n alertBadge !== null ||\n interlockBadge !== null ||\n commandLockedBadge !== null;\n\n const badgesHidden = !this._hasBadges && !hasEnumBadges;\n const tagHidden = !this._hasTagSlot && !this.tag;\n\n const badgesCell = html`\n <div class=\"badges\" ?hidden=${badgesHidden}>\n <slot name=\"badges\" @slotchange=${this._onBadgesSlotChange}>\n ${\n controlBadge\n ? html`<obc-automation-badge\n .type=${controlBadge}\n ></obc-automation-badge>`\n : nothing\n }\n ${\n alertBadge\n ? html`<obc-automation-badge\n .type=${alertBadge}\n ></obc-automation-badge>`\n : nothing\n }\n ${\n interlockBadge\n ? html`<obc-automation-badge\n .type=${interlockBadge}\n ></obc-automation-badge>`\n : nothing\n }\n ${\n commandLockedBadge\n ? html`<obc-automation-badge\n .type=${commandLockedBadge}\n ></obc-automation-badge>`\n : nothing\n }\n </slot>\n </div>\n `;\n\n const tagCell = html`\n <div class=\"tag\" ?hidden=${tagHidden}>\n <slot name=\"tag\" @slotchange=${this._onTagSlotChange}>${this.tag}</slot>\n </div>\n `;\n\n const pressurized = this.frame === SpecialtyTankFrame.pressurized;\n const cap = (side: 'start' | 'end') =>\n pressurized\n ? html`<div class=\"cap cap-${side}\"><div class=\"cap-dome\"></div></div>`\n : nothing;\n const frameClasses = classMap({\n 'tank-frame': true,\n [`frame-${this.frame}`]: true,\n [`split-${this.splitMode}`]: true,\n [`medium-${this.medium}`]: true,\n static: this.static,\n });\n const tankFrame = html`\n <div class=${frameClasses}>\n ${cap('start')}\n <div class=\"middle\">\n <div class=\"content\">\n ${this.static ? nothing : this.renderGraphic()}\n ${\n this.showIcon\n ? html`<div class=\"icon-frame\">${this.equipmentIcon}</div>`\n : nothing\n }\n </div>\n </div>\n ${cap('end')}\n </div>\n `;\n\n const alertFrameOverlay = this.alert\n ? html`<obc-alert-frame\n class=\"alert-frame\"\n .type=${this.alertFrameType}\n .thickness=${this.alertFrameThickness}\n .status=${this.alertFrameStatus}\n .mode=${this.alertFrameMode}\n .showAlertCategoryIcon=${this.showAlertCategoryIcon}\n .showIcon=${this.showAlertIcon}\n >\n <span slot=\"icon\"><slot name=\"alert-icon\"></slot></span>\n <span slot=\"label\"><slot name=\"alert-label\"></slot></span>\n <span slot=\"timer\"><slot name=\"alert-timer\"></slot></span>\n </obc-alert-frame>`\n : nothing;\n\n const halo = html`\n <div class=\"halo\">\n ${badgesCell}${tankFrame}${tagCell}${alertFrameOverlay}\n </div>\n `;\n\n const isClickable = this.clickable && !this.static;\n const rootClasses = classMap({\n root: true,\n activated: this.activated,\n clickable: isClickable,\n });\n const name = this.tag || this.equipmentName;\n\n // Same three root shapes as obc-automation-tank; the live region stays on\n // all of them so a slotted alert label is announced regardless.\n if (this.static) {\n return html`<div\n class=${rootClasses}\n role=\"img\"\n aria-label=${name}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n ${halo}\n </div>`;\n }\n if (!isClickable) {\n return html`<div\n class=${rootClasses}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n ${halo}\n </div>`;\n }\n return html`<button\n class=${rootClasses}\n type=\"button\"\n aria-label=${name}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n ${halo}\n </button>`;\n }\n\n static override styles: CSSResultGroup = unsafeCSS(componentStyle);\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,IAAY,sBAAL,yBAAA,qBAAA;;CAEL,oBAAA,aAAA;;CAEA,oBAAA,aAAA;;CAEA,oBAAA,YAAA;;AACF,EAAA,CAAA,CAAA;;;;;AAMA,IAAY,yBAAL,yBAAA,wBAAA;;CAEL,uBAAA,cAAA;;CAEA,uBAAA,gBAAA;;CAEA,uBAAA,cAAA;;AACF,EAAA,CAAA,CAAA;;;;AAKA,IAAY,qBAAL,yBAAA,oBAAA;;CAEL,mBAAA,aAAA;;CAEA,mBAAA,iBAAA;;AACF,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA,WAAA,gBAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,yBAAA,WAAA,cAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,yBAAA,WAAA,kBAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,yBAAA,WAAA,sBAAA,KAAA,CAAA;AAIvBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,yBAAA,WAAA,SAAA,KAAA,CAAA;AACxBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,yBAAA,WAAA,kBAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,yBAAA,WAAA,uBAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,yBAAA,WAAA,oBAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,yBAAA,WAAA,kBAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS;CAAC,MAAM;CAAS,WAAW;AAAK,CAAC,CAAA,GAAA,yBAAA,WAAA,yBAAA,KAAA,CAAA;AAE1CA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,yBAAA,WAAA,iBAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,MAAM,CAAA,GAAA,yBAAA,WAAA,cAAA,KAAA,CAAA;AACNA,WAAA,CAAA,MAAM,CAAA,GAAA,yBAAA,WAAA,eAAA,KAAA,CAAA"}
1
+ {"version":3,"file":"abstract-specialty-tank.js","names":["componentStyle","_decorate"],"sources":["../../../src/automation/specialty-tank/abstract-specialty-tank.ts"],"sourcesContent":["import {LitElement, html, nothing, svg, unsafeCSS} from 'lit';\nimport type {CSSResultGroup, TemplateResult} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './specialty-tank.css?inline';\nimport '../automation-badge/automation-badge.js';\nimport {\n AutomationBadgeSymbolOverride,\n automationBadgeType,\n currentBadgeSymbolOverride,\n} from '../automation-button/badge-symbols.js';\nimport {BadgeSettingsController} from '../automation-button/badge-settings-controller.js';\nimport {\n AutomationButtonBadgeAlert,\n AutomationButtonBadgeCommandLocked,\n AutomationButtonBadgeControl,\n AutomationButtonBadgeInterlock,\n} from '../automation-button/abstract-automation-button.js';\nimport '../../components/alert-frame/alert-frame.js';\nimport {\n ObcAlertFrameMode,\n ObcAlertFrameThickness,\n ObcAlertFrameType,\n} from '../../components/alert-frame/alert-frame.js';\nimport {AlertType} from '../../types.js';\nimport {TankPositioning} from '../automation-tank/tank-positioning.js';\n\n/**\n * What the graphic area of a specialty tank shows. Mirrors the Figma\n * `has Medium` property; its fourth value, Static, is the `static` property.\n */\nexport enum SpecialtyTankMedium {\n /** One grey area, no split. */\n regular = 'regular',\n /** Two grey halves separated by a gap. */\n graphic = 'graphic',\n /** Hot (red) and cold (blue) halves separated by a gap. */\n medium = 'medium',\n}\n\n/**\n * Hot/cold split geometry of a specialty tank. Drives the halves and the\n * gap between them through the `split-<mode>` class on the tank frame.\n */\nexport enum SpecialtyTankSplitMode {\n /** Left half hot, right half cold. */\n vertical = 'vertical',\n /** Top half hot, bottom half cold. */\n horizontal = 'horizontal',\n /** Two corner-to-corner triangles, top-left hot and bottom-right cold. */\n diagonal = 'diagonal',\n}\n\n/**\n * Frame silhouette of a specialty tank.\n */\nexport enum SpecialtyTankFrame {\n /** One rounded border box. */\n rounded = 'rounded',\n /** Pressurized-tank silhouette: domed caps on a side-bordered body. */\n pressurized = 'pressurized',\n}\n\n/**\n * Base class for the specialty-tank tiles `obc-heat-pump`,\n * `obc-hydraulic-separator` and `obc-heat-exchanger`. Owns the halo, badge\n * row, tank frame with its hot/cold graphic area and equipment icon, tag\n * readout and alert-frame overlay. Subclasses supply `equipmentIcon`,\n * `equipmentName`, `frame` and `splitMode`, plus their own host footprint.\n *\n * ## Layout\n * The same shell as a compact `obc-automation-tank`: a fixed host (or\n * `positioning=\"button\"` to fill the parent), a 4px-padded halo holding\n * badges, the tank frame and the tag, the frame absorbing the space of\n * empty badge and tag cells. Hover, pressed, focus-visible and `activated`\n * are painted on the halo by the flat style mixin; `clickable` and `static`\n * switch the root between a `<button>`, a plain `<div>` and a\n * `<div role=\"img\">` exactly as the tank does.\n *\n * Not declared `abstract`: the wrapper generators wrap every `LitElement`\n * subclass and pass its constructor as a concrete `Constructor<T>`, so the\n * override points throw instead (same as `ObcAbstractAutomationButton`).\n *\n * @property medium - What the graphic area shows: `regular` (one grey area), `graphic` (two grey halves) or `medium` (hot/cold halves).\n * @property static - Display-only tile with a flat grey frame and a bare icon, rendered as a non-interactive `<div role=\"img\">`. Hides the graphic area.\n * @property showIcon - Show the equipment icon centered on the graphic area.\n * @property tag - Identifier rendered in the tag readout below the frame (for example `#0000`); also the accessible name. The cell collapses when empty.\n * @property positioning - Host positioning model — see `TankPositioning`. `button` (default) fills the parent, `point` uses the fixed design footprint with the P&ID anchor.\n * @property clickable - Whether the tile is interactive. `false` keeps the resting appearance but drops hover, pressed and focus states and leaves the tab order; property-only because the default is `true`.\n * @property activated - Paints the activated background on the halo. Needs an interactive tile.\n * @availableWhen activated clickable==true\n * @property badgeControl - Mode badge (auto / manual / local variants), first in the badge row.\n * @property badgeAlert - Alert badge, second in the badge row.\n * @property badgeInterlock - Interlock badge, third in the badge row.\n * @property badgeCommandLocked - Command-locked badge, last in the badge row.\n * @property badgeSymbolOverride - Letters that replace badge symbols on this device, per badge property and value, on top of the app-wide ones set with `setAutomationBadgeSymbolOverride()`; for example `{commandLocked: {simulation: 's'}}`. `null` brings the symbol back.\n * @property alert - Show an alert-frame overlay around the halo, mirroring `obc-automation-tank`.\n * @property alertFrameType - Shape of the alert frame.\n * @availableWhen alertFrameType alert==true\n * @property alertFrameThickness - Thickness of the alert frame.\n * @availableWhen alertFrameThickness alert==true\n * @property alertFrameStatus - Alert status the frame is coloured for.\n * @availableWhen alertFrameStatus alert==true\n * @property alertFrameMode - Acknowledgement state of the alert: `acked-active` (default) is steady,\n * `unacked-active` flashes, `unacked-rectified` flashes a dashed frame.\n * @availableWhen alertFrameMode alert==true\n * @property showAlertCategoryIcon - Shows the alert category icon inside the frame.\n * @availableWhen showAlertCategoryIcon alert==true && alertFrameType in [SmallSideFlip, LargeSideFlip, BottomFlip, TopFlip]\n * @property showAlertIcon - Shows the slotted alert icon inside the frame.\n * @availableWhen showAlertIcon alert==true && alertFrameType in [LargeSideFlip, BottomFlip, TopFlip]\n */\nexport class ObcAbstractSpecialtyTank extends LitElement {\n @property({type: String}) medium: SpecialtyTankMedium =\n SpecialtyTankMedium.regular;\n @property({type: Boolean, reflect: true}) static: boolean = false;\n @property({type: Boolean, attribute: false}) showIcon: boolean = true;\n @property({type: String}) tag: string = '';\n @property({type: String, reflect: true}) positioning: TankPositioning =\n TankPositioning.button;\n @property({type: Boolean, attribute: false}) clickable: boolean = true;\n @property({type: Boolean}) activated: boolean = false;\n\n @property({type: String}) badgeControl: AutomationButtonBadgeControl =\n AutomationButtonBadgeControl.None;\n @property({type: String}) badgeAlert: AutomationButtonBadgeAlert =\n AutomationButtonBadgeAlert.None;\n @property({type: String}) badgeInterlock: AutomationButtonBadgeInterlock =\n AutomationButtonBadgeInterlock.None;\n @property({type: String})\n badgeCommandLocked: AutomationButtonBadgeCommandLocked =\n AutomationButtonBadgeCommandLocked.None;\n @property({attribute: false}) badgeSymbolOverride:\n AutomationBadgeSymbolOverride | undefined = undefined;\n\n constructor() {\n super();\n // Registers itself on the host; nothing else holds it.\n new BadgeSettingsController(this);\n }\n\n @property({type: Boolean}) alert: boolean = false;\n @property({type: String}) alertFrameType: ObcAlertFrameType =\n ObcAlertFrameType.SmallSideFlip;\n @property({type: String}) alertFrameThickness: ObcAlertFrameThickness =\n ObcAlertFrameThickness.Small;\n @property({type: String}) alertFrameStatus: AlertType = AlertType.Alarm;\n @property({type: String}) alertFrameMode: ObcAlertFrameMode =\n ObcAlertFrameMode.ackedActive;\n @property({type: Boolean, attribute: false}) showAlertCategoryIcon: boolean =\n true;\n @property({type: Boolean}) showAlertIcon: boolean = false;\n\n @state() private _hasBadges = false;\n @state() private _hasTagSlot = false;\n\n protected get equipmentIcon(): TemplateResult {\n throw new Error('\"equipmentIcon\" must be implemented in the subclass');\n }\n\n /** Accessible-name fallback used when `tag` is empty. */\n protected get equipmentName(): string {\n throw new Error('\"equipmentName\" must be implemented in the subclass');\n }\n\n protected get frame(): SpecialtyTankFrame {\n throw new Error('\"frame\" must be implemented in the subclass');\n }\n\n protected get splitMode(): SpecialtyTankSplitMode {\n throw new Error('\"splitMode\" must be implemented in the subclass');\n }\n\n private _slotHasContent(e: Event): boolean {\n const slot = e.target as HTMLSlotElement;\n return slot\n .assignedNodes({flatten: true})\n .some(\n (n) =>\n n.nodeType === Node.ELEMENT_NODE ||\n (n.nodeType === Node.TEXT_NODE && !!n.textContent?.trim())\n );\n }\n\n private _onBadgesSlotChange(e: Event): void {\n this._hasBadges = this._slotHasContent(e);\n }\n\n private _onTagSlotChange(e: Event): void {\n this._hasTagSlot = this._slotHasContent(e);\n }\n\n private renderGraphic(): TemplateResult {\n if (this.medium === SpecialtyTankMedium.regular) {\n return html`<div class=\"area area-single\"></div>`;\n }\n if (this.splitMode === SpecialtyTankSplitMode.diagonal) {\n return this.renderDiagonalSplit();\n }\n return html`\n <div class=\"halves\">\n <div class=\"area area-hot\"></div>\n <div class=\"area area-cold\"></div>\n </div>\n `;\n }\n\n /**\n * Diagonal split in a unit viewBox stretched over the area\n * (`preserveAspectRatio=\"none\"`); every stroke is `non-scaling` so the\n * borders and the gap keep their pixel widths at any aspect ratio. The\n * gap edges are drawn as one wide line per half, clipped to that half,\n * under the narrower frame-coloured gap line.\n */\n private renderDiagonalSplit(): TemplateResult {\n const hot = '0,0 1,0 0,1';\n const cold = '1,0 1,1 0,1';\n return html`\n <div class=\"diagonal\">\n <svg viewBox=\"0 0 1 1\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n ${svg`\n <defs>\n <clipPath id=\"clip-hot\"><polygon points=${hot} /></clipPath>\n <clipPath id=\"clip-cold\"><polygon points=${cold} /></clipPath>\n </defs>\n <polygon class=\"area-fill area-hot\" points=${hot} />\n <polygon class=\"area-fill area-cold\" points=${cold} />\n <polygon class=\"area-stroke area-hot\" points=${hot} clip-path=\"url(#clip-hot)\" vector-effect=\"non-scaling-stroke\" />\n <polygon class=\"area-stroke area-cold\" points=${cold} clip-path=\"url(#clip-cold)\" vector-effect=\"non-scaling-stroke\" />\n <line class=\"gap-edge area-hot\" x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\" clip-path=\"url(#clip-hot)\" vector-effect=\"non-scaling-stroke\" />\n <line class=\"gap-edge area-cold\" x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\" clip-path=\"url(#clip-cold)\" vector-effect=\"non-scaling-stroke\" />\n <line class=\"gap\" x1=\"1\" y1=\"0\" x2=\"0\" y2=\"1\" vector-effect=\"non-scaling-stroke\" />\n `}\n </svg>\n </div>\n `;\n }\n\n override render() {\n const symbolOverride = currentBadgeSymbolOverride(this.badgeSymbolOverride);\n const controlBadge = automationBadgeType(\n 'control',\n this.badgeControl,\n symbolOverride\n );\n const alertBadge = automationBadgeType(\n 'alert',\n this.badgeAlert,\n symbolOverride\n );\n const interlockBadge = automationBadgeType(\n 'interlock',\n this.badgeInterlock,\n symbolOverride\n );\n const commandLockedBadge = automationBadgeType(\n 'commandLocked',\n this.badgeCommandLocked,\n symbolOverride\n );\n const hasEnumBadges =\n controlBadge !== null ||\n alertBadge !== null ||\n interlockBadge !== null ||\n commandLockedBadge !== null;\n\n const badgesHidden = !this._hasBadges && !hasEnumBadges;\n const tagHidden = !this._hasTagSlot && !this.tag;\n\n const badgesCell = html`\n <div class=\"badges\" ?hidden=${badgesHidden}>\n <slot name=\"badges\" @slotchange=${this._onBadgesSlotChange}>\n ${\n controlBadge\n ? html`<obc-automation-badge\n .type=${controlBadge}\n ></obc-automation-badge>`\n : nothing\n }\n ${\n alertBadge\n ? html`<obc-automation-badge\n .type=${alertBadge}\n ></obc-automation-badge>`\n : nothing\n }\n ${\n interlockBadge\n ? html`<obc-automation-badge\n .type=${interlockBadge}\n ></obc-automation-badge>`\n : nothing\n }\n ${\n commandLockedBadge\n ? html`<obc-automation-badge\n .type=${commandLockedBadge}\n ></obc-automation-badge>`\n : nothing\n }\n </slot>\n </div>\n `;\n\n const tagCell = html`\n <div class=\"tag\" ?hidden=${tagHidden}>\n <slot name=\"tag\" @slotchange=${this._onTagSlotChange}>${this.tag}</slot>\n </div>\n `;\n\n const pressurized = this.frame === SpecialtyTankFrame.pressurized;\n const cap = (side: 'start' | 'end') =>\n pressurized\n ? html`<div class=\"cap cap-${side}\"><div class=\"cap-dome\"></div></div>`\n : nothing;\n const frameClasses = classMap({\n 'tank-frame': true,\n [`frame-${this.frame}`]: true,\n [`split-${this.splitMode}`]: true,\n [`medium-${this.medium}`]: true,\n static: this.static,\n });\n const tankFrame = html`\n <div class=${frameClasses}>\n ${cap('start')}\n <div class=\"middle\">\n <div class=\"content\">\n ${this.static ? nothing : this.renderGraphic()}\n ${\n this.showIcon\n ? html`<div class=\"icon-frame\">${this.equipmentIcon}</div>`\n : nothing\n }\n </div>\n </div>\n ${cap('end')}\n </div>\n `;\n\n const alertFrameOverlay = this.alert\n ? html`<obc-alert-frame\n class=\"alert-frame\"\n .type=${this.alertFrameType}\n .thickness=${this.alertFrameThickness}\n .status=${this.alertFrameStatus}\n .mode=${this.alertFrameMode}\n .showAlertCategoryIcon=${this.showAlertCategoryIcon}\n .showIcon=${this.showAlertIcon}\n >\n <span slot=\"icon\"><slot name=\"alert-icon\"></slot></span>\n <span slot=\"label\"><slot name=\"alert-label\"></slot></span>\n <span slot=\"timer\"><slot name=\"alert-timer\"></slot></span>\n </obc-alert-frame>`\n : nothing;\n\n const halo = html`\n <div class=\"halo\">\n ${badgesCell}${tankFrame}${tagCell}${alertFrameOverlay}\n </div>\n `;\n\n const isClickable = this.clickable && !this.static;\n const rootClasses = classMap({\n root: true,\n activated: this.activated,\n clickable: isClickable,\n });\n const name = this.tag || this.equipmentName;\n\n // Same three root shapes as obc-automation-tank; the live region stays on\n // all of them so a slotted alert label is announced regardless.\n if (this.static) {\n return html`<div\n class=${rootClasses}\n role=\"img\"\n aria-label=${name}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n ${halo}\n </div>`;\n }\n if (!isClickable) {\n return html`<div\n class=${rootClasses}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n ${halo}\n </div>`;\n }\n return html`<button\n class=${rootClasses}\n type=\"button\"\n aria-label=${name}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n ${halo}\n </button>`;\n }\n\n static override styles: CSSResultGroup = unsafeCSS(componentStyle);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA+BA,IAAY,sBAAL,yBAAA,qBAAA;;CAEL,oBAAA,aAAA;;CAEA,oBAAA,aAAA;;CAEA,oBAAA,YAAA;;AACF,EAAA,CAAA,CAAA;;;;;AAMA,IAAY,yBAAL,yBAAA,wBAAA;;CAEL,uBAAA,cAAA;;CAEA,uBAAA,gBAAA;;CAEA,uBAAA,cAAA;;AACF,EAAA,CAAA,CAAA;;;;AAKA,IAAY,qBAAL,yBAAA,oBAAA;;CAEL,mBAAA,aAAA;;CAEA,mBAAA,iBAAA;;AACF,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,IAAa,2BAAb,cAA8C,WAAW;CAuBvD,cAAc;EACZ,MAAM;;EArBoD,KAAA,SAAA;EACK,KAAA,WAAA;EACzB,KAAA,MAAA;EAEtC,KAAA,cA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iBAAA,KAAA,CAAA;AAExBA,WAAA,CAAA,MAAM,CAAA,GAAA,yBAAA,WAAA,cAAA,KAAA,CAAA;AACNA,WAAA,CAAA,MAAM,CAAA,GAAA,yBAAA,WAAA,eAAA,KAAA,CAAA"}
@@ -13,6 +13,11 @@ interface SelectArgType {
13
13
  type: 'radio' | 'select';
14
14
  };
15
15
  }
16
+ interface ObjectArgType {
17
+ control: {
18
+ type: 'object';
19
+ };
20
+ }
16
21
  /**
17
22
  * Shared story meta for the three specialty-tank tiles. Every public property
18
23
  * is bound in `render`, so a story can set any of them as an arg; the tag
@@ -20,7 +25,7 @@ interface SelectArgType {
20
25
  */
21
26
  export declare function specialtyTankMeta(tag: StaticValue): {
22
27
  args: Partial<SpecialtyTankStoryArgs>;
23
- argTypes: Record<string, SelectArgType>;
28
+ argTypes: Record<string, SelectArgType | ObjectArgType>;
24
29
  decorators: (typeof crossDecorator)[];
25
30
  render: (args: SpecialtyTankStoryArgs) => TemplateResult;
26
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"specialty-tank-story-meta.d.ts","sourceRoot":"","sources":["../../../src/automation/specialty-tank/specialty-tank-story-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AACxC,OAAO,EAAO,OAAO,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAevD,OAAO,EACL,wBAAwB,EAEzB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAE9D,+EAA+E;AAC/E,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACxC;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE;QAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;KAAC,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,GAAG;IACnD,IAAI,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxC,UAAU,EAAE,CAAC,OAAO,cAAc,CAAC,EAAE,CAAC;IACtC,MAAM,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,cAAc,CAAC;CAC1D,CAyEA;AAED,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAgBnE,CAAC;AAEF,OAAO,EAAC,OAAO,EAAC,CAAC"}
1
+ {"version":3,"file":"specialty-tank-story-meta.d.ts","sourceRoot":"","sources":["../../../src/automation/specialty-tank/specialty-tank-story-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AACxC,OAAO,EAAO,OAAO,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAevD,OAAO,EACL,wBAAwB,EAEzB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAE9D,+EAA+E;AAC/E,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACxC;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE;QAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;KAAC,CAAC;CACrC;AAED,UAAU,aAAa;IACrB,OAAO,EAAE;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAC,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,GAAG;IACnD,IAAI,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAAC,CAAC;IACxD,UAAU,EAAE,CAAC,OAAO,cAAc,CAAC,EAAE,CAAC;IACtC,MAAM,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,cAAc,CAAC;CAC1D,CA6EA;AAED,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CA0BnE,CAAC;AAEF,OAAO,EAAC,OAAO,EAAC,CAAC"}
@@ -59,6 +59,7 @@ function specialtyTankMeta(tag) {
59
59
  options: Object.values(AutomationButtonBadgeCommandLocked),
60
60
  control: { type: "select" }
61
61
  },
62
+ badgeSymbolOverride: { control: { type: "object" } },
62
63
  ...argTypesAlertFrame
63
64
  },
64
65
  decorators: [crossDecorator],
@@ -75,6 +76,7 @@ function specialtyTankMeta(tag) {
75
76
  .badgeAlert=${args.badgeAlert}
76
77
  .badgeInterlock=${args.badgeInterlock}
77
78
  .badgeCommandLocked=${args.badgeCommandLocked}
79
+ .badgeSymbolOverride=${args.badgeSymbolOverride}
78
80
  ?alert=${args.alert}
79
81
  .alertFrameType=${args.alertFrameType}
80
82
  .alertFrameThickness=${args.alertFrameThickness}
@@ -103,6 +105,14 @@ var specialtyTankStories = {
103
105
  badgeInterlock: AutomationButtonBadgeInterlock.Interlock,
104
106
  badgeCommandLocked: AutomationButtonBadgeCommandLocked.CommandLocked
105
107
  } },
108
+ WithBadgeLetters: { args: {
109
+ medium: SpecialtyTankMedium.medium,
110
+ badgeControl: AutomationButtonBadgeControl.Auto,
111
+ badgeAlert: AutomationButtonBadgeAlert.Silence,
112
+ badgeInterlock: AutomationButtonBadgeInterlock.Simulation,
113
+ badgeCommandLocked: AutomationButtonBadgeCommandLocked.Simulation,
114
+ badgeSymbolOverride: { commandLocked: { simulation: "s" } }
115
+ } },
106
116
  WithAlert: { args: {
107
117
  medium: SpecialtyTankMedium.medium,
108
118
  alert: true
@@ -1 +1 @@
1
- {"version":3,"file":"specialty-tank-story-meta.js","names":["ObcAlertFrameStatus"],"sources":["../../../src/automation/specialty-tank/specialty-tank-story-meta.ts"],"sourcesContent":["import type {TemplateResult} from 'lit';\nimport {html, literal} from 'lit/static-html.js';\nimport type {StaticValue} from 'lit/static-html.js';\nimport {crossDecorator} from '../../storybook-util.js';\nimport {\n ObcAlertFrameMode,\n ObcAlertFrameStatus,\n ObcAlertFrameThickness,\n ObcAlertFrameType,\n} from '../../components/alert-frame/alert-frame.js';\nimport {argTypesAlertFrame} from '../../components/alert-frame/alert-frame-storybook-helpers.js';\nimport {\n AutomationButtonBadgeAlert,\n AutomationButtonBadgeCommandLocked,\n AutomationButtonBadgeControl,\n AutomationButtonBadgeInterlock,\n} from '../automation-button/abstract-automation-button.js';\nimport {TankPositioning} from '../automation-tank/tank-positioning.js';\nimport {\n ObcAbstractSpecialtyTank,\n SpecialtyTankMedium,\n} from './abstract-specialty-tank.js';\n\nexport type SpecialtyTankStoryArgs = ObcAbstractSpecialtyTank;\n\n/** A story of the shared set: only `args`, everything else comes from meta. */\nexport interface SpecialtyTankStory {\n args?: Partial<SpecialtyTankStoryArgs>;\n}\n\ninterface SelectArgType {\n options: string[];\n control: {type: 'radio' | 'select'};\n}\n\n/**\n * Shared story meta for the three specialty-tank tiles. Every public property\n * is bound in `render`, so a story can set any of them as an arg; the tag\n * name is a static literal because the tiles share one template.\n */\nexport function specialtyTankMeta(tag: StaticValue): {\n args: Partial<SpecialtyTankStoryArgs>;\n argTypes: Record<string, SelectArgType>;\n decorators: (typeof crossDecorator)[];\n render: (args: SpecialtyTankStoryArgs) => TemplateResult;\n} {\n return {\n args: {\n medium: SpecialtyTankMedium.regular,\n static: false,\n showIcon: true,\n tag: '#0000',\n positioning: TankPositioning.point,\n clickable: true,\n activated: false,\n badgeControl: AutomationButtonBadgeControl.None,\n badgeAlert: AutomationButtonBadgeAlert.None,\n badgeInterlock: AutomationButtonBadgeInterlock.None,\n badgeCommandLocked: AutomationButtonBadgeCommandLocked.None,\n alert: false,\n alertFrameType: ObcAlertFrameType.SmallSideFlip,\n alertFrameThickness: ObcAlertFrameThickness.Small,\n alertFrameStatus: ObcAlertFrameStatus.Alarm,\n alertFrameMode: ObcAlertFrameMode.ackedActive,\n showAlertCategoryIcon: true,\n showAlertIcon: false,\n },\n argTypes: {\n medium: {\n options: Object.values(SpecialtyTankMedium),\n control: {type: 'radio'},\n },\n positioning: {\n options: Object.values(TankPositioning),\n control: {type: 'radio'},\n },\n badgeControl: {\n options: Object.values(AutomationButtonBadgeControl),\n control: {type: 'select'},\n },\n badgeAlert: {\n options: Object.values(AutomationButtonBadgeAlert),\n control: {type: 'select'},\n },\n badgeInterlock: {\n options: Object.values(AutomationButtonBadgeInterlock),\n control: {type: 'select'},\n },\n badgeCommandLocked: {\n options: Object.values(AutomationButtonBadgeCommandLocked),\n control: {type: 'select'},\n },\n ...argTypesAlertFrame,\n },\n decorators: [crossDecorator],\n render: (args) => html`\n <${tag}\n .medium=${args.medium}\n .static=${args.static}\n .showIcon=${args.showIcon}\n .tag=${args.tag}\n .positioning=${args.positioning}\n .clickable=${args.clickable}\n ?activated=${args.activated}\n .badgeControl=${args.badgeControl}\n .badgeAlert=${args.badgeAlert}\n .badgeInterlock=${args.badgeInterlock}\n .badgeCommandLocked=${args.badgeCommandLocked}\n ?alert=${args.alert}\n .alertFrameType=${args.alertFrameType}\n .alertFrameThickness=${args.alertFrameThickness}\n .alertFrameStatus=${args.alertFrameStatus}\n .alertFrameMode=${args.alertFrameMode}\n .showAlertCategoryIcon=${args.showAlertCategoryIcon}\n .showAlertIcon=${args.showAlertIcon}\n ></${tag}>\n `,\n };\n}\n\n/** The story set every tile exports, keyed by export name. */\nexport const specialtyTankStories: Record<string, SpecialtyTankStory> = {\n Default: {},\n Graphic: {args: {medium: SpecialtyTankMedium.graphic}},\n Medium: {args: {medium: SpecialtyTankMedium.medium}},\n Static: {args: {static: true}},\n WithoutIcon: {args: {medium: SpecialtyTankMedium.medium, showIcon: false}},\n WithBadges: {\n args: {\n medium: SpecialtyTankMedium.medium,\n badgeControl: AutomationButtonBadgeControl.Auto,\n badgeAlert: AutomationButtonBadgeAlert.Silence,\n badgeInterlock: AutomationButtonBadgeInterlock.Interlock,\n badgeCommandLocked: AutomationButtonBadgeCommandLocked.CommandLocked,\n },\n },\n WithAlert: {args: {medium: SpecialtyTankMedium.medium, alert: true}},\n};\n\nexport {literal};\n"],"mappings":";;;;;;;;;;;;;;AAwCA,SAAgB,kBAAkB,KAKhC;CACA,OAAO;EACL,MAAM;GACJ,QAAQ,oBAAoB;GAC5B,QAAQ;GACR,UAAU;GACV,KAAK;GACL,aAAa,gBAAgB;GAC7B,WAAW;GACX,WAAW;GACX,cAAc,6BAA6B;GAC3C,YAAY,2BAA2B;GACvC,gBAAgB,+BAA+B;GAC/C,oBAAoB,mCAAmC;GACvD,OAAO;GACP,gBAAgB,kBAAkB;GAClC,qBAAqB,uBAAuB;GAC5C,kBAAkBA,UAAoB;GACtC,gBAAgB,kBAAkB;GAClC,uBAAuB;GACvB,eAAe;EACjB;EACA,UAAU;GACR,QAAQ;IACN,SAAS,OAAO,OAAO,mBAAmB;IAC1C,SAAS,EAAC,MAAM,QAAO;GACzB;GACA,aAAa;IACX,SAAS,OAAO,OAAO,eAAe;IACtC,SAAS,EAAC,MAAM,QAAO;GACzB;GACA,cAAc;IACZ,SAAS,OAAO,OAAO,4BAA4B;IACnD,SAAS,EAAC,MAAM,SAAQ;GAC1B;GACA,YAAY;IACV,SAAS,OAAO,OAAO,0BAA0B;IACjD,SAAS,EAAC,MAAM,SAAQ;GAC1B;GACA,gBAAgB;IACd,SAAS,OAAO,OAAO,8BAA8B;IACrD,SAAS,EAAC,MAAM,SAAQ;GAC1B;GACA,oBAAoB;IAClB,SAAS,OAAO,OAAO,kCAAkC;IACzD,SAAS,EAAC,MAAM,SAAQ;GAC1B;GACA,GAAG;EACL;EACA,YAAY,CAAC,cAAc;EAC3B,SAAS,SAAS,IAAI;SACjB,IAAI;kBACK,KAAK,OAAO;kBACZ,KAAK,OAAO;oBACV,KAAK,SAAS;eACnB,KAAK,IAAI;uBACD,KAAK,YAAY;qBACnB,KAAK,UAAU;qBACf,KAAK,UAAU;wBACZ,KAAK,aAAa;sBACpB,KAAK,WAAW;0BACZ,KAAK,eAAe;8BAChB,KAAK,mBAAmB;iBACrC,KAAK,MAAM;0BACF,KAAK,eAAe;+BACf,KAAK,oBAAoB;4BAC5B,KAAK,iBAAiB;0BACxB,KAAK,eAAe;iCACb,KAAK,sBAAsB;yBACnC,KAAK,cAAc;WACjC,IAAI;;CAEb;AACF;;AAGA,IAAa,uBAA2D;CACtE,SAAS,CAAC;CACV,SAAS,EAAC,MAAM,EAAC,QAAQ,oBAAoB,QAAO,EAAC;CACrD,QAAQ,EAAC,MAAM,EAAC,QAAQ,oBAAoB,OAAM,EAAC;CACnD,QAAQ,EAAC,MAAM,EAAC,QAAQ,KAAI,EAAC;CAC7B,aAAa,EAAC,MAAM;EAAC,QAAQ,oBAAoB;EAAQ,UAAU;CAAK,EAAC;CACzE,YAAY,EACV,MAAM;EACJ,QAAQ,oBAAoB;EAC5B,cAAc,6BAA6B;EAC3C,YAAY,2BAA2B;EACvC,gBAAgB,+BAA+B;EAC/C,oBAAoB,mCAAmC;CACzD,EACF;CACA,WAAW,EAAC,MAAM;EAAC,QAAQ,oBAAoB;EAAQ,OAAO;CAAI,EAAC;AACrE"}
1
+ {"version":3,"file":"specialty-tank-story-meta.js","names":["ObcAlertFrameStatus"],"sources":["../../../src/automation/specialty-tank/specialty-tank-story-meta.ts"],"sourcesContent":["import type {TemplateResult} from 'lit';\nimport {html, literal} from 'lit/static-html.js';\nimport type {StaticValue} from 'lit/static-html.js';\nimport {crossDecorator} from '../../storybook-util.js';\nimport {\n ObcAlertFrameMode,\n ObcAlertFrameStatus,\n ObcAlertFrameThickness,\n ObcAlertFrameType,\n} from '../../components/alert-frame/alert-frame.js';\nimport {argTypesAlertFrame} from '../../components/alert-frame/alert-frame-storybook-helpers.js';\nimport {\n AutomationButtonBadgeAlert,\n AutomationButtonBadgeCommandLocked,\n AutomationButtonBadgeControl,\n AutomationButtonBadgeInterlock,\n} from '../automation-button/abstract-automation-button.js';\nimport {TankPositioning} from '../automation-tank/tank-positioning.js';\nimport {\n ObcAbstractSpecialtyTank,\n SpecialtyTankMedium,\n} from './abstract-specialty-tank.js';\n\nexport type SpecialtyTankStoryArgs = ObcAbstractSpecialtyTank;\n\n/** A story of the shared set: only `args`, everything else comes from meta. */\nexport interface SpecialtyTankStory {\n args?: Partial<SpecialtyTankStoryArgs>;\n}\n\ninterface SelectArgType {\n options: string[];\n control: {type: 'radio' | 'select'};\n}\n\ninterface ObjectArgType {\n control: {type: 'object'};\n}\n\n/**\n * Shared story meta for the three specialty-tank tiles. Every public property\n * is bound in `render`, so a story can set any of them as an arg; the tag\n * name is a static literal because the tiles share one template.\n */\nexport function specialtyTankMeta(tag: StaticValue): {\n args: Partial<SpecialtyTankStoryArgs>;\n argTypes: Record<string, SelectArgType | ObjectArgType>;\n decorators: (typeof crossDecorator)[];\n render: (args: SpecialtyTankStoryArgs) => TemplateResult;\n} {\n return {\n args: {\n medium: SpecialtyTankMedium.regular,\n static: false,\n showIcon: true,\n tag: '#0000',\n positioning: TankPositioning.point,\n clickable: true,\n activated: false,\n badgeControl: AutomationButtonBadgeControl.None,\n badgeAlert: AutomationButtonBadgeAlert.None,\n badgeInterlock: AutomationButtonBadgeInterlock.None,\n badgeCommandLocked: AutomationButtonBadgeCommandLocked.None,\n alert: false,\n alertFrameType: ObcAlertFrameType.SmallSideFlip,\n alertFrameThickness: ObcAlertFrameThickness.Small,\n alertFrameStatus: ObcAlertFrameStatus.Alarm,\n alertFrameMode: ObcAlertFrameMode.ackedActive,\n showAlertCategoryIcon: true,\n showAlertIcon: false,\n },\n argTypes: {\n medium: {\n options: Object.values(SpecialtyTankMedium),\n control: {type: 'radio'},\n },\n positioning: {\n options: Object.values(TankPositioning),\n control: {type: 'radio'},\n },\n badgeControl: {\n options: Object.values(AutomationButtonBadgeControl),\n control: {type: 'select'},\n },\n badgeAlert: {\n options: Object.values(AutomationButtonBadgeAlert),\n control: {type: 'select'},\n },\n badgeInterlock: {\n options: Object.values(AutomationButtonBadgeInterlock),\n control: {type: 'select'},\n },\n badgeCommandLocked: {\n options: Object.values(AutomationButtonBadgeCommandLocked),\n control: {type: 'select'},\n },\n badgeSymbolOverride: {\n control: {type: 'object'},\n },\n ...argTypesAlertFrame,\n },\n decorators: [crossDecorator],\n render: (args) => html`\n <${tag}\n .medium=${args.medium}\n .static=${args.static}\n .showIcon=${args.showIcon}\n .tag=${args.tag}\n .positioning=${args.positioning}\n .clickable=${args.clickable}\n ?activated=${args.activated}\n .badgeControl=${args.badgeControl}\n .badgeAlert=${args.badgeAlert}\n .badgeInterlock=${args.badgeInterlock}\n .badgeCommandLocked=${args.badgeCommandLocked}\n .badgeSymbolOverride=${args.badgeSymbolOverride}\n ?alert=${args.alert}\n .alertFrameType=${args.alertFrameType}\n .alertFrameThickness=${args.alertFrameThickness}\n .alertFrameStatus=${args.alertFrameStatus}\n .alertFrameMode=${args.alertFrameMode}\n .showAlertCategoryIcon=${args.showAlertCategoryIcon}\n .showAlertIcon=${args.showAlertIcon}\n ></${tag}>\n `,\n };\n}\n\n/** The story set every tile exports, keyed by export name. */\nexport const specialtyTankStories: Record<string, SpecialtyTankStory> = {\n Default: {},\n Graphic: {args: {medium: SpecialtyTankMedium.graphic}},\n Medium: {args: {medium: SpecialtyTankMedium.medium}},\n Static: {args: {static: true}},\n WithoutIcon: {args: {medium: SpecialtyTankMedium.medium, showIcon: false}},\n WithBadges: {\n args: {\n medium: SpecialtyTankMedium.medium,\n badgeControl: AutomationButtonBadgeControl.Auto,\n badgeAlert: AutomationButtonBadgeAlert.Silence,\n badgeInterlock: AutomationButtonBadgeInterlock.Interlock,\n badgeCommandLocked: AutomationButtonBadgeCommandLocked.CommandLocked,\n },\n },\n WithBadgeLetters: {\n args: {\n medium: SpecialtyTankMedium.medium,\n badgeControl: AutomationButtonBadgeControl.Auto,\n badgeAlert: AutomationButtonBadgeAlert.Silence,\n badgeInterlock: AutomationButtonBadgeInterlock.Simulation,\n badgeCommandLocked: AutomationButtonBadgeCommandLocked.Simulation,\n badgeSymbolOverride: {commandLocked: {simulation: 's'}},\n },\n },\n WithAlert: {args: {medium: SpecialtyTankMedium.medium, alert: true}},\n};\n\nexport {literal};\n"],"mappings":";;;;;;;;;;;;;;AA4CA,SAAgB,kBAAkB,KAKhC;CACA,OAAO;EACL,MAAM;GACJ,QAAQ,oBAAoB;GAC5B,QAAQ;GACR,UAAU;GACV,KAAK;GACL,aAAa,gBAAgB;GAC7B,WAAW;GACX,WAAW;GACX,cAAc,6BAA6B;GAC3C,YAAY,2BAA2B;GACvC,gBAAgB,+BAA+B;GAC/C,oBAAoB,mCAAmC;GACvD,OAAO;GACP,gBAAgB,kBAAkB;GAClC,qBAAqB,uBAAuB;GAC5C,kBAAkBA,UAAoB;GACtC,gBAAgB,kBAAkB;GAClC,uBAAuB;GACvB,eAAe;EACjB;EACA,UAAU;GACR,QAAQ;IACN,SAAS,OAAO,OAAO,mBAAmB;IAC1C,SAAS,EAAC,MAAM,QAAO;GACzB;GACA,aAAa;IACX,SAAS,OAAO,OAAO,eAAe;IACtC,SAAS,EAAC,MAAM,QAAO;GACzB;GACA,cAAc;IACZ,SAAS,OAAO,OAAO,4BAA4B;IACnD,SAAS,EAAC,MAAM,SAAQ;GAC1B;GACA,YAAY;IACV,SAAS,OAAO,OAAO,0BAA0B;IACjD,SAAS,EAAC,MAAM,SAAQ;GAC1B;GACA,gBAAgB;IACd,SAAS,OAAO,OAAO,8BAA8B;IACrD,SAAS,EAAC,MAAM,SAAQ;GAC1B;GACA,oBAAoB;IAClB,SAA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,QAAQ,oBAAoB;EAAQ,OAAO;CAAI,EAAC;AACrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents-full-bundle",
3
- "version": "2.2.0-next.18",
3
+ "version": "2.2.0-next.19",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,6 +50,9 @@ export const argTypesAbstractAutomationButton = {
50
50
  badgeLayout: {
51
51
  control: {type: 'object'},
52
52
  },
53
+ badgeSymbolOverride: {
54
+ control: {type: 'object'},
55
+ },
53
56
  progressMode: {
54
57
  options: Object.values(CircularProgressMode),
55
58
  control: {type: 'select'},
@@ -39,8 +39,14 @@ import {CircularProgressMode} from '../../building-blocks/circular-progress/circ
39
39
  import {
40
40
  AutomationButtonBadgeKind,
41
41
  AutomationButtonBadgeLayout,
42
- BadgeLayoutController,
42
+ currentBadgeLayout,
43
43
  } from './badge-layout.js';
44
+ import {
45
+ AutomationBadgeSymbolOverride,
46
+ automationBadgeType,
47
+ currentBadgeSymbolOverride,
48
+ } from './badge-symbols.js';
49
+ import {BadgeSettingsController} from './badge-settings-controller.js';
44
50
 
45
51
  export enum AutomationButtonBadgeAlert {
46
52
  None = 'none',
@@ -112,6 +118,7 @@ type BadgeCorner = keyof AutomationButtonBadgeLayout;
112
118
  * @availableWhen showAlertCategoryIcon alert==true && alertFrameType in [SmallSideFlip, LargeSideFlip, BottomFlip, TopFlip]
113
119
  * @availableWhen showAlertIcon alert==true && alertFrameType in [LargeSideFlip, BottomFlip, TopFlip]
114
120
  * @property badgeLayout - Which badge kind each corner shows, on top of the app-wide layout set with `setAutomationBadgeLayout()`. A corner left out keeps the app-wide badge, `null` leaves it empty, and a badge moved here leaves the corner it came from.
121
+ * @property badgeSymbolOverride - Letters that replace badge symbols on this device, per badge property and value, on top of the app-wide ones set with `setAutomationBadgeSymbolOverride()`; for example `{commandLocked: {simulation: 's'}}`. `null` brings the symbol back.
115
122
  * @property progress - Shows a progress indicator, used to indicate that an user action is in progress
116
123
  * @availableWhen progressMode progress==true
117
124
  * @availableWhen progressValue progress==true && progressMode in [determinate, progressiveIndeterminate]
@@ -157,8 +164,14 @@ export class ObcAbstractAutomationButton extends LitElement {
157
164
  AutomationButtonBadgeAlert.None;
158
165
  @property({attribute: false}) badgeLayout:
159
166
  AutomationButtonBadgeLayout | undefined = undefined;
167
+ @property({attribute: false}) badgeSymbolOverride:
168
+ AutomationBadgeSymbolOverride | undefined = undefined;
160
169
 
161
- private readonly _badgeLayout = new BadgeLayoutController(this);
170
+ constructor() {
171
+ super();
172
+ // Registers itself on the host; nothing else holds it.
173
+ new BadgeSettingsController(this);
174
+ }
162
175
 
163
176
  get icon(): TemplateResult {
164
177
  throw new Error('Method "icon" must be implemented in subclass');
@@ -285,99 +298,44 @@ export class ObcAbstractAutomationButton extends LitElement {
285
298
  }
286
299
 
287
300
  private getBadgeType(
288
- kind: AutomationButtonBadgeKind | null
301
+ kind: AutomationButtonBadgeKind | null,
302
+ symbolOverride: AutomationBadgeSymbolOverride
289
303
  ): ObcAutomationBadgeType | null {
290
304
  switch (kind) {
291
305
  case AutomationButtonBadgeKind.Control:
292
- return this.getBadgeControlType();
306
+ return automationBadgeType(
307
+ 'control',
308
+ this.badgeControl,
309
+ symbolOverride
310
+ );
293
311
  case AutomationButtonBadgeKind.Alert:
294
- return this.getBadgeAlertType();
312
+ return automationBadgeType('alert', this.badgeAlert, symbolOverride);
295
313
  case AutomationButtonBadgeKind.Interlock:
296
- return this.getBadgeInterlockType();
314
+ return automationBadgeType(
315
+ 'interlock',
316
+ this.badgeInterlock,
317
+ symbolOverride
318
+ );
297
319
  case AutomationButtonBadgeKind.CommandLocked:
298
- return this.getBadgeCommandLockedType();
320
+ return automationBadgeType(
321
+ 'commandLocked',
322
+ this.badgeCommandLocked,
323
+ symbolOverride
324
+ );
299
325
  default:
300
326
  return null;
301
327
  }
302
328
  }
303
329
 
304
- private getBadgeAlertType(): ObcAutomationBadgeType | null {
305
- if (this.badgeAlert === AutomationButtonBadgeAlert.Silence) {
306
- return ObcAutomationBadgeType.AlertSilenced;
307
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.Shelved) {
308
- return ObcAutomationBadgeType.AlertShelved;
309
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.Caution) {
310
- return ObcAutomationBadgeType.Caution;
311
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.Warning) {
312
- return ObcAutomationBadgeType.Warning;
313
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.Alarm) {
314
- return ObcAutomationBadgeType.Alarm;
315
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.LevelCritical) {
316
- return ObcAutomationBadgeType.LevelCritical;
317
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.LevelHigh) {
318
- return ObcAutomationBadgeType.LevelHigh;
319
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.LevelMedium) {
320
- return ObcAutomationBadgeType.LevelMedium;
321
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.LevelLow) {
322
- return ObcAutomationBadgeType.LevelLow;
323
- } else if (this.badgeAlert === AutomationButtonBadgeAlert.LevelDiagnostic) {
324
- return ObcAutomationBadgeType.LevelDiagnostic;
325
- }
326
- return null;
327
- }
328
-
329
- private getBadgeControlType(): ObcAutomationBadgeType | null {
330
- if (this.badgeControl === AutomationButtonBadgeControl.Local) {
331
- return ObcAutomationBadgeType.Local;
332
- } else if (this.badgeControl === AutomationButtonBadgeControl.LocalOnly) {
333
- return ObcAutomationBadgeType.LocalOnly;
334
- } else if (this.badgeControl === AutomationButtonBadgeControl.Manual) {
335
- return ObcAutomationBadgeType.Manual;
336
- } else if (this.badgeControl === AutomationButtonBadgeControl.ManualOnly) {
337
- return ObcAutomationBadgeType.ManualOnly;
338
- } else if (this.badgeControl === AutomationButtonBadgeControl.Auto) {
339
- return ObcAutomationBadgeType.Auto;
340
- }
341
- return null;
342
- }
343
-
344
- private getBadgeInterlockType(): ObcAutomationBadgeType | null {
345
- if (this.badgeInterlock === AutomationButtonBadgeInterlock.Interlock) {
346
- return ObcAutomationBadgeType.Interlock;
347
- } else if (
348
- this.badgeInterlock === AutomationButtonBadgeInterlock.InterlockInhibit
349
- ) {
350
- return ObcAutomationBadgeType.InterlockInhibit;
351
- } else if (
352
- this.badgeInterlock === AutomationButtonBadgeInterlock.Simulation
353
- ) {
354
- return ObcAutomationBadgeType.Simulation;
355
- }
356
- return null;
357
- }
358
-
359
- private getBadgeCommandLockedType(): ObcAutomationBadgeType | null {
360
- if (
361
- this.badgeCommandLocked ===
362
- AutomationButtonBadgeCommandLocked.CommandLocked
363
- ) {
364
- return ObcAutomationBadgeType.CommandLocked;
365
- } else if (
366
- this.badgeCommandLocked === AutomationButtonBadgeCommandLocked.Simulation
367
- ) {
368
- return ObcAutomationBadgeType.Simulation;
369
- }
370
- return null;
371
- }
372
-
373
330
  override render() {
374
331
  const readouts: AutomationButtonReadoutStack[] = [...this.extraReadouts];
375
- const layout = this._badgeLayout.resolve(this.badgeLayout);
332
+ const layout = currentBadgeLayout(this.badgeLayout);
333
+ const symbolOverride = currentBadgeSymbolOverride(this.badgeSymbolOverride);
376
334
  const badges = {
377
- topLeft: this.getBadgeType(layout.topLeft),
378
- topRight: this.getBadgeType(layout.topRight),
379
- bottomLeft: this.getBadgeType(layout.bottomLeft),
380
- bottomRight: this.getBadgeType(layout.bottomRight),
335
+ topLeft: this.getBadgeType(layout.topLeft, symbolOverride),
336
+ topRight: this.getBadgeType(layout.topRight, symbolOverride),
337
+ bottomLeft: this.getBadgeType(layout.bottomLeft, symbolOverride),
338
+ bottomRight: this.getBadgeType(layout.bottomRight, symbolOverride),
381
339
  };
382
340
 
383
341
  return html`<obc-automation-button
@@ -20,11 +20,7 @@
20
20
  *
21
21
  * @module
22
22
  */
23
- import type {ReactiveControllerHost} from 'lit';
24
- import {
25
- GlobalSetting,
26
- GlobalSettingController,
27
- } from '../../internal/global-setting.js';
23
+ import {GlobalSetting} from '../../internal/global-setting.js';
28
24
 
29
25
  export enum AutomationButtonBadgeKind {
30
26
  Control = 'control',
@@ -86,9 +82,11 @@ export function resolveBadgeLayout(
86
82
  return result;
87
83
  }
88
84
 
89
- const globalLayout = new GlobalSetting<ResolvedAutomationButtonBadgeLayout>({
90
- ...defaultAutomationButtonBadgeLayout,
91
- });
85
+ /** The app-wide layout; a device re-renders on a change through `BadgeSettingsController`. */
86
+ export const badgeLayoutSetting =
87
+ new GlobalSetting<ResolvedAutomationButtonBadgeLayout>({
88
+ ...defaultAutomationButtonBadgeLayout,
89
+ });
92
90
 
93
91
  /**
94
92
  * Sets the badge layout of every automation button on the page, and
@@ -97,24 +95,18 @@ const globalLayout = new GlobalSetting<ResolvedAutomationButtonBadgeLayout>({
97
95
  export function setAutomationBadgeLayout(
98
96
  layout: AutomationButtonBadgeLayout | undefined
99
97
  ): void {
100
- globalLayout.set(
98
+ badgeLayoutSetting.set(
101
99
  resolveBadgeLayout(defaultAutomationButtonBadgeLayout, layout)
102
100
  );
103
101
  }
104
102
 
105
103
  export function getAutomationBadgeLayout(): ResolvedAutomationButtonBadgeLayout {
106
- return {...globalLayout.get()};
104
+ return {...badgeLayoutSetting.get()};
107
105
  }
108
106
 
109
- /** Re-renders its host when the global badge layout changes, and puts the host's own corners on top of it. */
110
- export class BadgeLayoutController extends GlobalSettingController<ResolvedAutomationButtonBadgeLayout> {
111
- constructor(host: ReactiveControllerHost) {
112
- super(host, globalLayout);
113
- }
114
-
115
- resolve(
116
- local: AutomationButtonBadgeLayout | undefined
117
- ): ResolvedAutomationButtonBadgeLayout {
118
- return resolveBadgeLayout(this.value, local);
119
- }
107
+ /** The app-wide layout with a device's own corners on top. */
108
+ export function currentBadgeLayout(
109
+ local: AutomationButtonBadgeLayout | undefined
110
+ ): ResolvedAutomationButtonBadgeLayout {
111
+ return resolveBadgeLayout(badgeLayoutSetting.get(), local);
120
112
  }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Re-rendering for the app-wide badge settings.
3
+ *
4
+ * The badge layout (`setAutomationBadgeLayout()`) and the badge symbol
5
+ * override (`setAutomationBadgeSymbolOverride()`) are `GlobalSetting`s
6
+ * (`internal/global-setting.ts`). A device holds one
7
+ * `BadgeSettingsController`, which holds a controller for each, so it
8
+ * re-renders when either changes and comes back current after a change made
9
+ * while it was detached.
10
+ *
11
+ * @module
12
+ */
13
+ import type {ReactiveControllerHost} from 'lit';
14
+ import type {GlobalSettingController} from '../../internal/global-setting.js';
15
+ import {
16
+ badgeLayoutSetting,
17
+ type ResolvedAutomationButtonBadgeLayout,
18
+ } from './badge-layout.js';
19
+ import {
20
+ badgeSymbolOverrideSetting,
21
+ type AutomationBadgeSymbolOverride,
22
+ } from './badge-symbols.js';
23
+
24
+ /** Re-renders its host when an app-wide badge setting changes. */
25
+ export class BadgeSettingsController {
26
+ readonly layout: GlobalSettingController<ResolvedAutomationButtonBadgeLayout>;
27
+ readonly symbols: GlobalSettingController<AutomationBadgeSymbolOverride>;
28
+
29
+ constructor(host: ReactiveControllerHost) {
30
+ this.layout = badgeLayoutSetting.controller(host);
31
+ this.symbols = badgeSymbolOverrideSetting.controller(host);
32
+ }
33
+ }