@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.97 → 2.0.0-next.98

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.
@@ -94,25 +94,6 @@ export enum TankChartMode {
94
94
  graphAndBar = 'graph-and-bar',
95
95
  }
96
96
 
97
- /**
98
- * A single detail row rendered in the tank's `readout` rich list (below the
99
- * main percent / value block, separated by a divider). Each row is rendered
100
- * as `<label>` on the left and `<value><degree?><percent?><unit>` on the
101
- * right, all on a single line.
102
- */
103
- export interface TankReadoutItem {
104
- /** Left-aligned label text (e.g. `Temperature`). */
105
- label: string;
106
- /** Numeric value, formatted with the tank's `percentFractionDigits`. */
107
- value: number;
108
- /** Append a `°` glyph directly after the value with no gap. */
109
- hasDegree?: boolean;
110
- /** Append a `%` glyph directly after the value with no gap. */
111
- hasPercentage?: boolean;
112
- /** Unit text (e.g. `C`, `Pa`, `m/s`). Rendered after the value/glyph. */
113
- unit: string;
114
- }
115
-
116
97
  /**
117
98
  *
118
99
  *
@@ -122,7 +103,11 @@ export interface TankReadoutItem {
122
103
  * @slot max-value - Content for the capacity value.
123
104
  * @slot unit - Content for the unit of measurement.
124
105
  * @slot current-value - Content for the current level value.
125
- * @slot rich - Content for additional detail rows.
106
+ * @slot rich - Detail rows below the main readout, shown in the regular
107
+ * (non-compact, non-static) layout. Slot an `<obc-readout-list>` of
108
+ * `<obc-readout-list-item>` rows — it owns the row typography and cross-row
109
+ * column alignment; the tank renders a divider above it automatically when
110
+ * the slot is filled.
126
111
  * @slot alert-icon - Custom icon for the alert frame.
127
112
  * @slot alert-label - Label for the alert frame.
128
113
  * @slot alert-timer - Timer for the alert frame.
@@ -249,21 +234,6 @@ export class ObcAutomationTank extends LitElement {
249
234
  */
250
235
  @property({type: Number}) percentFractionDigits: number = 0;
251
236
 
252
- /**
253
- * Rich detail rows shown below the main percent/value block in the regular
254
- * (non-compact, non-static) layout, separated by a divider. When empty (the
255
- * default), nothing is rendered — neither the divider nor the list. In
256
- * vertical orientation the chart cell shrinks to make room; in horizontal
257
- * orientation the readout column already has reserved whitespace so the
258
- * chart is unaffected.
259
- *
260
- * Values are formatted using `percentFractionDigits`. Consumers that need
261
- * full control over the markup can replace the entire fallback by slotting
262
- * arbitrary content into `slot="rich"` (note: this is a different name from
263
- * the existing `slot="readout"` which replaces the whole readout block).
264
- */
265
- @property({type: Array, attribute: false}) readout: TankReadoutItem[] = [];
266
-
267
237
  /**
268
238
  * Enum-driven badges rendered inside the `badges` cell. Mirrors the API
269
239
  * introduced for `ObcAbstractAutomationButton` in PR #839 (#829). When set
@@ -297,6 +267,13 @@ export class ObcAutomationTank extends LitElement {
297
267
  */
298
268
  @state() private _hasBadges = false;
299
269
  @state() private _hasTagSlot = false;
270
+ /**
271
+ * Tracks whether the `rich` slot has assigned content, so the regular
272
+ * (non-compact) layout only draws the rich divider when a consumer has
273
+ * slotted detail rows (canonically an `<obc-readout-list>`). Mirrors
274
+ * `_hasBadges` / `_hasTagSlot`.
275
+ */
276
+ @state() private _hasRichSlot = false;
300
277
  private _chartResizeObserver?: ResizeObserver;
301
278
  private _observedCell?: Element;
302
279
 
@@ -396,6 +373,17 @@ export class ObcAutomationTank extends LitElement {
396
373
  );
397
374
  }
398
375
 
376
+ private _onRichSlotChange(e: Event): void {
377
+ const slot = e.target as HTMLSlotElement;
378
+ this._hasRichSlot = slot
379
+ .assignedNodes({flatten: true})
380
+ .some(
381
+ (n) =>
382
+ n.nodeType === Node.ELEMENT_NODE ||
383
+ (n.nodeType === Node.TEXT_NODE && !!n.textContent?.trim())
384
+ );
385
+ }
386
+
399
387
  override disconnectedCallback(): void {
400
388
  super.disconnectedCallback();
401
389
  this._chartResizeObserver?.disconnect();
@@ -756,36 +744,8 @@ export class ObcAutomationTank extends LitElement {
756
744
  <slot class="unit" name="unit">m<sup>3</sup></slot>
757
745
  </div>
758
746
  </div>
759
- <slot name="rich">
760
- ${this.readout.length > 0
761
- ? html`
762
- <div class="rich-divider"></div>
763
- <div class="rich">
764
- ${this.readout.map(
765
- (row) => html`
766
- <div class="rich-row">
767
- <span class="rich-label">${row.label}</span>
768
- <span class="rich-value"
769
- >${row.value.toFixed(
770
- this.percentFractionDigits
771
- )}</span
772
- >
773
- <span class="rich-suffix"
774
- >${row.hasDegree
775
- ? html`<span class="rich-glyph">°</span>`
776
- : nothing}${row.hasPercentage
777
- ? html`<span class="rich-glyph">%</span>`
778
- : nothing}<span class="rich-unit"
779
- >${row.unit}</span
780
- ></span
781
- >
782
- </div>
783
- `
784
- )}
785
- </div>
786
- `
787
- : nothing}
788
- </slot>
747
+ <div class="rich-divider" ?hidden=${!this._hasRichSlot}></div>
748
+ <slot name="rich" @slotchange=${this._onRichSlotChange}></slot>
789
749
  </slot>
790
750
  </div>
791
751
  `;