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

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
  `;
@@ -93,14 +93,17 @@ obc-readout-block {
93
93
  .readout.direction-vertical.alignment-left {
94
94
  align-items: flex-start;
95
95
  }
96
+
96
97
  .readout.direction-vertical.alignment-center {
97
98
  align-items: center;
98
99
  }
100
+
99
101
  .readout.direction-vertical.alignment-left
100
102
  :is(.value-cluster, .advice-row, .setpoint-row, .value-row) {
101
103
  align-items: flex-start;
102
104
  justify-content: flex-start;
103
105
  }
106
+
104
107
  .readout.direction-vertical.alignment-center
105
108
  :is(.value-cluster, .advice-row, .setpoint-row, .value-row) {
106
109
  align-items: center;
@@ -146,19 +149,23 @@ obc-readout-block {
146
149
  align-items: end;
147
150
  justify-items: end;
148
151
  }
152
+
149
153
  .readout.direction-vertical.setpoint-dynamic
150
154
  :is(.setpoint-row, .value-row)
151
155
  > * {
152
156
  grid-area: 1 / 1;
153
157
  }
158
+
154
159
  .readout.direction-vertical.alignment-left.setpoint-dynamic
155
160
  :is(.setpoint-row, .value-row) {
156
161
  justify-items: start;
157
162
  }
163
+
158
164
  .readout.direction-vertical.alignment-center.setpoint-dynamic
159
165
  :is(.setpoint-row, .value-row) {
160
166
  justify-items: center;
161
167
  }
168
+
162
169
  .setpoint-width-reserve {
163
170
  visibility: hidden;
164
171
  display: inline-flex;
@@ -197,10 +204,12 @@ obc-readout-block {
197
204
  outline: 1px solid;
198
205
  border-radius: var(--global-border-radius-border-radius-check);
199
206
  }
207
+
200
208
  .value-reading.data-low-integrity {
201
209
  background: var(--alert-low-integrity-background-color);
202
210
  outline-color: var(--alert-low-integrity-border-color);
203
211
  }
212
+
204
213
  .value-reading.data-invalid {
205
214
  background: var(--alert-invalid-background-color);
206
215
  outline-color: var(--alert-invalid-border-color);
@@ -248,18 +257,22 @@ obc-readout-block {
248
257
  display: inline-flex;
249
258
  padding-inline: var(--_readout-trim);
250
259
  }
260
+
251
261
  .meta.meta-inline {
252
262
  flex-direction: row;
253
263
  align-items: flex-start;
254
264
  gap: var(--global-size-spacing-target-padding);
255
265
  }
266
+
256
267
  .meta.meta-stacked {
257
268
  flex-direction: column;
258
269
  align-items: flex-end;
259
270
  }
271
+
260
272
  .readout.direction-vertical.alignment-left .meta.meta-stacked {
261
273
  align-items: flex-start;
262
274
  }
275
+
263
276
  .readout.direction-vertical.alignment-center .meta.meta-stacked {
264
277
  align-items: center;
265
278
  }
@@ -269,14 +282,24 @@ obc-readout-block {
269
282
  .readout.direction-horizontal .meta.meta-stacked {
270
283
  align-items: flex-start;
271
284
  align-self: center;
285
+
286
+ &.label-only {
287
+ align-self: flex-start;
288
+ }
289
+
290
+ &.unit-only {
291
+ align-self: flex-end;
292
+ }
272
293
  }
273
294
 
274
295
  .label {
275
296
  color: var(--obc-readout-label-color, var(--element-neutral-color));
276
297
  }
298
+
277
299
  .unit {
278
300
  color: var(--obc-readout-unit-color, var(--element-neutral-color));
279
301
  }
302
+
280
303
  .source {
281
304
  color: var(--obc-readout-source-color, var(--element-neutral-color));
282
305
  }
@@ -292,11 +315,13 @@ obc-readout-block {
292
315
  outline: 1px solid;
293
316
  border-radius: var(--global-border-radius-border-radius-check);
294
317
  }
318
+
295
319
  .source.data-low-integrity,
296
320
  .source-button.data-low-integrity {
297
321
  background: var(--alert-low-integrity-background-color);
298
322
  outline-color: var(--alert-low-integrity-border-color);
299
323
  }
324
+
300
325
  .source.data-invalid,
301
326
  .source-button.data-invalid {
302
327
  background: var(--alert-invalid-background-color);
@@ -314,11 +339,13 @@ obc-readout-block {
314
339
  flex: none;
315
340
  background-color: var(--border-divider-color);
316
341
  }
342
+
317
343
  .divider.divider-horizontal {
318
344
  inline-size: 100%;
319
345
  block-size: 1px;
320
346
  margin-block: var(--_readout-divider-pad);
321
347
  }
348
+
322
349
  .divider.divider-vertical {
323
350
  inline-size: 1px;
324
351
  align-self: stretch;
@@ -350,27 +377,32 @@ obc-readout-block {
350
377
  overflow: clip;
351
378
  color: var(--obc-readout-value-color, var(--element-neutral-color));
352
379
  }
380
+
353
381
  .degree-column.tone-enhanced {
354
382
  color: var(
355
383
  --obc-readout-value-enhanced-color,
356
384
  var(--element-neutral-enhanced-color)
357
385
  );
358
386
  }
387
+
359
388
  .degree-column.degree-xs {
360
389
  --_readout-degree-width: var(
361
390
  --global-typography-instrument-value-small-degree-unit-width
362
391
  );
363
392
  }
393
+
364
394
  .degree-column.degree-s {
365
395
  --_readout-degree-width: var(
366
396
  --global-typography-instrument-value-regular-degree-unit-width
367
397
  );
368
398
  }
399
+
369
400
  .degree-column.degree-m {
370
401
  --_readout-degree-width: var(
371
402
  --global-typography-instrument-value-medium-degree-unit-width
372
403
  );
373
404
  }
405
+
374
406
  .degree-column.degree-l,
375
407
  .degree-column.degree-xl {
376
408
  --_readout-degree-width: var(
@@ -383,16 +415,19 @@ obc-readout-block {
383
415
  align-self: stretch;
384
416
  inline-size: var(--_readout-degree-spacer-width, 0);
385
417
  }
418
+
386
419
  .size-small .degree-spacer {
387
420
  --_readout-degree-spacer-width: var(
388
421
  --instrument-components-readout-new-general-regular-degree-compensation-padding
389
422
  );
390
423
  }
424
+
391
425
  .size-medium .degree-spacer {
392
426
  --_readout-degree-spacer-width: var(
393
427
  --instrument-components-readout-new-general-medium-degree-compensation-padding
394
428
  );
395
429
  }
430
+
396
431
  .size-large .degree-spacer {
397
432
  --_readout-degree-spacer-width: var(
398
433
  --instrument-components-readout-new-general-large-degree-compensation-padding
@@ -408,10 +443,12 @@ obc-readout-block {
408
443
  background: var(--_readout-data-background);
409
444
  border-radius: var(--global-border-radius-border-radius-check);
410
445
  }
446
+
411
447
  .readout.data-low-integrity {
412
448
  --_readout-data-background: var(--alert-low-integrity-background-color);
413
449
  --_readout-data-border: var(--alert-low-integrity-border-color);
414
450
  }
451
+
415
452
  .readout.data-invalid {
416
453
  --_readout-data-background: var(--alert-invalid-background-color);
417
454
  --_readout-data-border: var(--alert-invalid-border-color);
@@ -430,11 +467,13 @@ obc-readout-block {
430
467
  --global-typography-instrument-value-regular-container-height
431
468
  );
432
469
  }
470
+
433
471
  .readout.size-medium {
434
472
  --_readout-primary-height: var(
435
473
  --global-typography-instrument-value-medium-container-height
436
474
  );
437
475
  }
476
+
438
477
  .readout.size-large {
439
478
  --_readout-primary-height: var(
440
479
  --global-typography-instrument-value-large-container-height
@@ -465,6 +504,7 @@ obc-readout-block {
465
504
  --instrument-components-readout-new-group-vertical-regular-container-min-height
466
505
  );
467
506
  }
507
+
468
508
  /* The medium tiers set no `--_readout-min-height`: Figma defines the
469
509
  * container-min-height token only for the regular and enhanced tiers, so
470
510
  * medium readouts intentionally fall back to `min-block-size: auto`. */
@@ -488,6 +528,7 @@ obc-readout-block {
488
528
  --instrument-components-readout-new-group-vertical-medium-divider-padding
489
529
  );
490
530
  }
531
+
491
532
  .readout.direction-vertical.stacking-inline.size-large {
492
533
  --_readout-pad-h: var(
493
534
  --instrument-components-readout-new-group-vertical-enhanced-container-padding-horizontal
@@ -536,6 +577,7 @@ obc-readout-block {
536
577
  --instrument-components-readout-new-stack-regular-container-min-height
537
578
  );
538
579
  }
580
+
539
581
  .readout.direction-vertical.stacking-stacked.size-medium {
540
582
  --_readout-pad-h: var(
541
583
  --instrument-components-readout-new-stack-medium-container-padding-horizontal
@@ -556,6 +598,7 @@ obc-readout-block {
556
598
  --instrument-components-readout-new-stack-medium-divider-padding
557
599
  );
558
600
  }
601
+
559
602
  .readout.direction-vertical.stacking-stacked.size-large {
560
603
  --_readout-pad-h: var(
561
604
  --instrument-components-readout-new-stack-enhanced-container-padding-horizontal
@@ -591,9 +634,7 @@ obc-readout-block {
591
634
  --_readout-trim: var(
592
635
  --instrument-components-readout-new-group-horizontal-regular-horizontal-trim-padding
593
636
  );
594
- --_readout-value-gap: var(
595
- --instrument-components-readout-new-group-horizontal-regular-horizontal-value-container-gap
596
- );
637
+ --_readout-value-gap: 0;
597
638
  --_readout-value-pad-v: var(
598
639
  --instrument-components-readout-new-group-horizontal-regular-value-container-padding-vertical
599
640
  );
@@ -604,6 +645,7 @@ obc-readout-block {
604
645
  --instrument-components-readout-new-group-horizontal-regular-container-min-height
605
646
  );
606
647
  }
648
+
607
649
  .readout.direction-horizontal.size-medium {
608
650
  --_readout-pad-h: var(
609
651
  --instrument-components-readout-new-group-horizontal-medium-container-padding-horizontal
@@ -614,9 +656,7 @@ obc-readout-block {
614
656
  --_readout-trim: var(
615
657
  --instrument-components-readout-new-group-horizontal-medium-horizontal-trim-padding
616
658
  );
617
- --_readout-value-gap: var(
618
- --instrument-components-readout-new-group-horizontal-medium-horizontal-value-container-gap
619
- );
659
+ --_readout-value-gap: 0;
620
660
  --_readout-value-pad-v: var(
621
661
  --instrument-components-readout-new-group-horizontal-medium-value-container-padding-vertical
622
662
  );
@@ -624,6 +664,7 @@ obc-readout-block {
624
664
  --instrument-components-readout-new-group-horizontal-medium-divider-padding
625
665
  );
626
666
  }
667
+
627
668
  .readout.direction-horizontal.size-large {
628
669
  --_readout-pad-h: var(
629
670
  --instrument-components-readout-new-group-horizontal-enhanced-container-padding-horizontal
@@ -634,9 +675,7 @@ obc-readout-block {
634
675
  --_readout-trim: var(
635
676
  --instrument-components-readout-new-group-horizontal-enhanced-horizontal-trim-padding
636
677
  );
637
- --_readout-value-gap: var(
638
- --instrument-components-readout-new-group-horizontal-enhanced-value-container-gap
639
- );
678
+ --_readout-value-gap: 4px;
640
679
  --_readout-value-pad-v: var(
641
680
  --instrument-components-readout-new-group-horizontal-enhanced-value-container-padding
642
681
  );
@@ -656,11 +695,13 @@ obc-readout-block {
656
695
  outline: 1px solid rgba(220, 0, 0, 0.7);
657
696
  outline-offset: -1px;
658
697
  }
698
+
659
699
  :host([showDebugOverlay]) obc-readout-block::part(degree),
660
700
  :host([showDebugOverlay]) .degree-column {
661
701
  outline: 1px solid rgba(0, 0, 220, 0.7);
662
702
  outline-offset: -1px;
663
703
  }
704
+
664
705
  :host([showDebugOverlay]) .degree-spacer {
665
706
  outline: 1px solid rgba(0, 160, 0, 0.8);
666
707
  outline-offset: -1px;
@@ -742,6 +742,8 @@ export class ObcReadout extends LitElement {
742
742
  meta: true,
743
743
  'meta-inline': !stacked,
744
744
  'meta-stacked': stacked,
745
+ 'label-only': !!this.label && !this.unit,
746
+ 'unit-only': !!this.unit && !this.label,
745
747
  })}
746
748
  part="meta-wrapper"
747
749
  >