@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.128 → 2.0.0-next.129
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.
- package/bundle/openbridge-webcomponents.bundle.js +12321 -11895
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +227 -3
- package/dist/building-blocks/readout-block/readout-block.css.js +53 -19
- package/dist/building-blocks/readout-block/readout-block.css.js.map +1 -1
- package/dist/building-blocks/readout-block/readout-block.d.ts +55 -0
- package/dist/building-blocks/readout-block/readout-block.d.ts.map +1 -1
- package/dist/building-blocks/readout-block/readout-block.js +57 -2
- package/dist/building-blocks/readout-block/readout-block.js.map +1 -1
- package/dist/navigation-instruments/readout/readout-shared.d.ts +23 -0
- package/dist/navigation-instruments/readout/readout-shared.d.ts.map +1 -1
- package/dist/navigation-instruments/readout/readout-shared.js +8 -0
- package/dist/navigation-instruments/readout/readout-shared.js.map +1 -1
- package/dist/navigation-instruments/readout/readout.css.js +138 -31
- package/dist/navigation-instruments/readout/readout.css.js.map +1 -1
- package/dist/navigation-instruments/readout/readout.d.ts +63 -3
- package/dist/navigation-instruments/readout/readout.d.ts.map +1 -1
- package/dist/navigation-instruments/readout/readout.js +127 -27
- package/dist/navigation-instruments/readout/readout.js.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +64 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts +77 -2
- package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.js +100 -23
- package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
- package/package.json +1 -1
- package/src/building-blocks/readout-block/readout-block.css +49 -20
- package/src/building-blocks/readout-block/readout-block.stories.ts +54 -0
- package/src/building-blocks/readout-block/readout-block.ts +101 -2
- package/src/navigation-instruments/instrument-field/instrument-field.stories.ts +1150 -180
- package/src/navigation-instruments/readout/readout-shared.spec.ts +50 -0
- package/src/navigation-instruments/readout/readout-shared.ts +33 -0
- package/src/navigation-instruments/readout/readout.css +124 -32
- package/src/navigation-instruments/readout/readout.stories.ts +536 -19
- package/src/navigation-instruments/readout/readout.ts +184 -31
- package/src/navigation-instruments/readout-list-item/readout-list-item.css +55 -1
- package/src/navigation-instruments/readout-list-item/readout-list-item.stories.ts +341 -0
- package/src/navigation-instruments/readout-list-item/readout-list-item.ts +169 -25
|
@@ -9,11 +9,13 @@ import {
|
|
|
9
9
|
ObcTextboxFontWeight,
|
|
10
10
|
} from '../../components/textbox/textbox.js';
|
|
11
11
|
import '../../building-blocks/readout-block/readout-block.js';
|
|
12
|
+
import '../../icons/icon-delta.js';
|
|
12
13
|
import {
|
|
13
14
|
ReadoutBlockVariant,
|
|
14
15
|
ReadoutBlockSize,
|
|
15
16
|
ReadoutBlockDataQuality,
|
|
16
17
|
ReadoutBlockHidePhase,
|
|
18
|
+
ReadoutAdviceCategory,
|
|
17
19
|
} from '../../building-blocks/readout-block/readout-block.js';
|
|
18
20
|
import {
|
|
19
21
|
assertReadoutValueType,
|
|
@@ -29,6 +31,8 @@ import {
|
|
|
29
31
|
readoutNumericFormatOptions,
|
|
30
32
|
readoutPrimarySize,
|
|
31
33
|
readoutSecondarySize,
|
|
34
|
+
readoutSetpointSize,
|
|
35
|
+
readoutValueSize,
|
|
32
36
|
readoutSetpointWeight,
|
|
33
37
|
readoutDataQualityClasses,
|
|
34
38
|
resolveSetpointHidePhase,
|
|
@@ -50,6 +54,10 @@ export {ObcTextboxFontWeight} from '../../components/textbox/textbox.js';
|
|
|
50
54
|
// Re-exported so consumers can type `valueType` without a second import path.
|
|
51
55
|
export {ReadoutValueType} from '../readout/readout-formatters.js';
|
|
52
56
|
|
|
57
|
+
// Re-exported so consumers can set `adviceOptions.category` without a second
|
|
58
|
+
// import path.
|
|
59
|
+
export {ReadoutAdviceCategory} from '../../building-blocks/readout-block/readout-block.js';
|
|
60
|
+
|
|
53
61
|
/**
|
|
54
62
|
* Density/size scale of the readout row (an alias of `ReadoutBlockSize`).
|
|
55
63
|
* - `small`: regular value typography (smallest, densest).
|
|
@@ -151,11 +159,22 @@ export interface ReadoutValueOptions extends ReadoutBlockState {
|
|
|
151
159
|
* - `always-visible` (default): the setpoint is always shown.
|
|
152
160
|
* - `flip-flop`: value and setpoint swap emphasis (size) as the value reaches
|
|
153
161
|
* the setpoint.
|
|
162
|
+
* - `equal-size`: value and setpoint are always shown at the same (primary)
|
|
163
|
+
* size (Figma 6.1 "Equal size") — the value does not demote while
|
|
164
|
+
* `touching`, unlike the other modes.
|
|
154
165
|
* - `pop-up`: the setpoint is shown only while the value has not reached it,
|
|
155
166
|
* then fades out (100ms) once value === setpoint.
|
|
167
|
+
*
|
|
168
|
+
* TODO(designer): in pop-up mode the designer is considering keeping the
|
|
169
|
+
* setpoint arrow visible while the setpoint itself is hidden, so an
|
|
170
|
+
* at-setpoint reading still reads as "a value you are in control of". Until
|
|
171
|
+
* that is decided, the `value-icon` slot already covers it — slot an
|
|
172
|
+
* `<obi-input-right>` into the value block (see the
|
|
173
|
+
* `SetpointPopUpWithValueArrow` story).
|
|
156
174
|
*/
|
|
157
175
|
export enum ReadoutListItemSetpointInteraction {
|
|
158
176
|
alwaysVisible = 'always-visible',
|
|
177
|
+
equalSize = 'equal-size',
|
|
159
178
|
flipFlop = 'flip-flop',
|
|
160
179
|
popUp = 'pop-up',
|
|
161
180
|
}
|
|
@@ -177,6 +196,13 @@ export interface ReadoutSetpointOptions extends ReadoutBlockState {
|
|
|
177
196
|
|
|
178
197
|
export interface ReadoutAdviceOptions extends ReadoutBlockState {
|
|
179
198
|
hintedZeros?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Semantic category (Figma 6.1) — picks the default marker icon and the
|
|
201
|
+
* `active` styling; `regular` when unset.
|
|
202
|
+
*/
|
|
203
|
+
category?: ReadoutAdviceCategory;
|
|
204
|
+
/** The advice is triggered — filled/status icon + triggered text styling. */
|
|
205
|
+
active?: boolean;
|
|
180
206
|
/** Longest value string to reserve width for; see {@link ReadoutValueOptions.spaceReserver}. */
|
|
181
207
|
spaceReserver?: string;
|
|
182
208
|
}
|
|
@@ -186,9 +212,49 @@ export interface ReadoutReserverOptions {
|
|
|
186
212
|
spaceReserver?: string;
|
|
187
213
|
}
|
|
188
214
|
|
|
215
|
+
/**
|
|
216
|
+
* Per-label ("readout-block-title") options.
|
|
217
|
+
*
|
|
218
|
+
* The label size follows the designer's Figma 6.1 title block, which carries an
|
|
219
|
+
* `xs`/`s` primary-size axis: `s` is the default for stand-alone readouts (a
|
|
220
|
+
* scannable label should not sit at the smallest permitted size), `xs` the
|
|
221
|
+
* default for dense list rows. Values outside `xs`/`s` are not part of the
|
|
222
|
+
* design and are not rejected, but their metrics are unspecified.
|
|
223
|
+
*/
|
|
224
|
+
export interface ReadoutLabelOptions {
|
|
225
|
+
/** Label typography size — `xs` (dense rows) or `s` (stand-alone readouts). */
|
|
226
|
+
size?: ObcTextboxSize;
|
|
227
|
+
/** Longest expected label to reserve width for (aligns stacked readouts). */
|
|
228
|
+
spaceReserver?: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Emphasis / alert state of the source chip (Figma 6.1 "Readout-block-source"
|
|
233
|
+
* State axis; `static`/`enabled` map to `regular`).
|
|
234
|
+
* TODO(designer): the sheet also carries a `Tag` type (xs chip) and an alarm
|
|
235
|
+
* state is absent by design; both left out here.
|
|
236
|
+
*/
|
|
237
|
+
export enum ReadoutSourceState {
|
|
238
|
+
regular = 'regular',
|
|
239
|
+
enhanced = 'enhanced',
|
|
240
|
+
caution = 'caution',
|
|
241
|
+
warning = 'warning',
|
|
242
|
+
}
|
|
243
|
+
|
|
189
244
|
export interface ReadoutSrcOptions extends ReadoutBlockState {
|
|
190
245
|
/** Longest expected source string to reserve width for; see {@link ReadoutReserverOptions.spaceReserver}. */
|
|
191
246
|
spaceReserver?: string;
|
|
247
|
+
/**
|
|
248
|
+
* Emphasis / alert state of the source: `enhanced` renders the amplified
|
|
249
|
+
* chip, `caution` / `warning` the matching alert chip. Like the
|
|
250
|
+
* data-quality chip it uses `outline`, so toggling it never shifts the row.
|
|
251
|
+
*/
|
|
252
|
+
state?: ReadoutSourceState;
|
|
253
|
+
/**
|
|
254
|
+
* Source deviation (Figma "Source-deviation"): renders a Δ + value line
|
|
255
|
+
* under the source name. A non-finite value renders no line.
|
|
256
|
+
*/
|
|
257
|
+
deviation?: number;
|
|
192
258
|
}
|
|
193
259
|
|
|
194
260
|
/**
|
|
@@ -322,6 +388,7 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
322
388
|
@property({type: Object}) valueOptions?: ReadoutValueOptions;
|
|
323
389
|
@property({type: Object}) setpointOptions?: ReadoutSetpointOptions;
|
|
324
390
|
@property({type: Object}) adviceOptions?: ReadoutAdviceOptions;
|
|
391
|
+
@property({type: Object}) labelOptions?: ReadoutLabelOptions;
|
|
325
392
|
@property({type: Object}) unitOptions?: ReadoutReserverOptions;
|
|
326
393
|
@property({type: Object}) srcOptions?: ReadoutSrcOptions;
|
|
327
394
|
|
|
@@ -416,6 +483,13 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
416
483
|
);
|
|
417
484
|
}
|
|
418
485
|
|
|
486
|
+
private get isEqualSize(): boolean {
|
|
487
|
+
return (
|
|
488
|
+
this.resolvedSetpointInteraction ===
|
|
489
|
+
ReadoutListItemSetpointInteraction.equalSize
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
|
|
419
493
|
private get isPopUp(): boolean {
|
|
420
494
|
return (
|
|
421
495
|
this.resolvedSetpointInteraction ===
|
|
@@ -468,15 +542,23 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
468
542
|
// focus — while actively adjusting (`touching`) or while a flip-flop holds
|
|
469
543
|
// the value away from the setpoint. So "grab the setpoint" shrinks the value for
|
|
470
544
|
// the whole adjustment (initiate + move read the same: setpoint big, value
|
|
471
|
-
// small), mirroring the flip-flop convention.
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
545
|
+
// small), mirroring the flip-flop convention. `equal-size` opts out: both
|
|
546
|
+
// blocks always hold the primary size, even while touching.
|
|
547
|
+
return readoutValueSize({
|
|
548
|
+
primary: this.primarySize,
|
|
549
|
+
secondary: this.secondarySize,
|
|
550
|
+
setpointEmphasized: this.isSetpointEmphasized,
|
|
551
|
+
equalSize: this.isEqualSize,
|
|
552
|
+
});
|
|
476
553
|
}
|
|
477
554
|
|
|
478
555
|
private get setpointSize(): ObcTextboxSize {
|
|
479
|
-
return
|
|
556
|
+
return readoutSetpointSize({
|
|
557
|
+
primary: this.primarySize,
|
|
558
|
+
secondary: this.secondarySize,
|
|
559
|
+
emphasized: this.isSetpointEmphasized,
|
|
560
|
+
equalSize: this.isEqualSize,
|
|
561
|
+
});
|
|
480
562
|
}
|
|
481
563
|
|
|
482
564
|
/** Value font weight passes straight to obc-textbox; regular when unset. Colour is separate. */
|
|
@@ -484,6 +566,22 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
484
566
|
return this.valueOptions?.weight ?? ObcTextboxFontWeight.regular;
|
|
485
567
|
}
|
|
486
568
|
|
|
569
|
+
/** Label size: `xs` for dense list rows unless overridden (see {@link ReadoutLabelOptions}). */
|
|
570
|
+
private get labelSize(): ObcTextboxSize {
|
|
571
|
+
return this.labelOptions?.size ?? ObcTextboxSize.xs;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Label weight: SemiBold only for enhanced (in-command) rows, regular
|
|
576
|
+
* otherwise — the designer reduced the amount of semibold in the interface
|
|
577
|
+
* (Figma 6.1 review).
|
|
578
|
+
*/
|
|
579
|
+
private get labelWeight(): ObcTextboxFontWeight {
|
|
580
|
+
return this.rowEnhanced
|
|
581
|
+
? ObcTextboxFontWeight.semibold
|
|
582
|
+
: ObcTextboxFontWeight.regular;
|
|
583
|
+
}
|
|
584
|
+
|
|
487
585
|
/** Setpoint is SemiBold only while emphasised, otherwise regular weight. */
|
|
488
586
|
private get setpointWeight(): ObcTextboxFontWeight {
|
|
489
587
|
return readoutSetpointWeight(this.isSetpointEmphasized);
|
|
@@ -532,6 +630,9 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
532
630
|
hidePhase?: ReadoutBlockHidePhase;
|
|
533
631
|
dataQuality?: ReadoutBlockDataQuality;
|
|
534
632
|
alert?: false | AlertFrameConfig;
|
|
633
|
+
/** Advice-only: semantic category + triggered state. */
|
|
634
|
+
category?: ReadoutAdviceCategory;
|
|
635
|
+
active?: boolean;
|
|
535
636
|
}): TemplateResult {
|
|
536
637
|
// The block owns the formatting, hinted zeros, reserver, degree and icon; the
|
|
537
638
|
// row keeps the density tier (`size`) and the resolved per-block number size
|
|
@@ -558,6 +659,8 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
558
659
|
.hidePhase=${config.hidePhase ?? ReadoutBlockHidePhase.none}
|
|
559
660
|
.dataQuality=${config.dataQuality}
|
|
560
661
|
.alert=${config.alert ?? false}
|
|
662
|
+
.category=${config.category ?? ReadoutAdviceCategory.regular}
|
|
663
|
+
.active=${config.active ?? false}
|
|
561
664
|
>
|
|
562
665
|
${this.renderForwardedIcon(config.variant)}
|
|
563
666
|
</obc-readout-block>
|
|
@@ -658,10 +761,11 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
658
761
|
reserver?: string,
|
|
659
762
|
state?: ReadoutBlockState
|
|
660
763
|
): TemplateResult {
|
|
764
|
+
// The label carries its own size (labelOptions) and priority-driven weight;
|
|
765
|
+
// unit and source stay xs / regular.
|
|
661
766
|
const weight =
|
|
662
|
-
role === 'label'
|
|
663
|
-
|
|
664
|
-
: ObcTextboxFontWeight.regular;
|
|
767
|
+
role === 'label' ? this.labelWeight : ObcTextboxFontWeight.regular;
|
|
768
|
+
const size = role === 'label' ? this.labelSize : ObcTextboxSize.xs;
|
|
665
769
|
const box = html`
|
|
666
770
|
<obc-textbox
|
|
667
771
|
class=${classMap({
|
|
@@ -669,7 +773,7 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
669
773
|
...this.dataQualityClasses(state?.dataQuality),
|
|
670
774
|
})}
|
|
671
775
|
part=${role}
|
|
672
|
-
.size=${
|
|
776
|
+
.size=${size}
|
|
673
777
|
.fontWeight=${weight}
|
|
674
778
|
alignment="left"
|
|
675
779
|
>
|
|
@@ -701,6 +805,8 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
701
805
|
hasDegree: this.hasDegree ?? false,
|
|
702
806
|
dataQuality: this.adviceOptions?.dataQuality,
|
|
703
807
|
alert: this.adviceOptions?.alert,
|
|
808
|
+
category: this.adviceOptions?.category,
|
|
809
|
+
active: this.adviceOptions?.active,
|
|
704
810
|
})
|
|
705
811
|
: nothing}
|
|
706
812
|
${this.hasSetpoint
|
|
@@ -826,7 +932,13 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
826
932
|
></span>`
|
|
827
933
|
: nothing}
|
|
828
934
|
<div class="label-stack" part="label-stack">
|
|
829
|
-
${this.label
|
|
935
|
+
${this.label
|
|
936
|
+
? this.renderTextbox(
|
|
937
|
+
'label',
|
|
938
|
+
this.label,
|
|
939
|
+
this.labelOptions?.spaceReserver
|
|
940
|
+
)
|
|
941
|
+
: nothing}
|
|
830
942
|
${showLeadingUnit
|
|
831
943
|
? this.renderTextbox(
|
|
832
944
|
'unit',
|
|
@@ -834,14 +946,7 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
834
946
|
this.unitOptions?.spaceReserver
|
|
835
947
|
)
|
|
836
948
|
: nothing}
|
|
837
|
-
${showLeadingSrc
|
|
838
|
-
? this.renderTextbox(
|
|
839
|
-
'source',
|
|
840
|
-
this.src ?? '',
|
|
841
|
-
this.srcOptions?.spaceReserver,
|
|
842
|
-
this.srcOptions
|
|
843
|
-
)
|
|
844
|
-
: nothing}
|
|
949
|
+
${showLeadingSrc ? this.renderSourceBlock() : nothing}
|
|
845
950
|
</div>
|
|
846
951
|
</div>
|
|
847
952
|
`;
|
|
@@ -861,6 +966,50 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
861
966
|
);
|
|
862
967
|
}
|
|
863
968
|
|
|
969
|
+
/**
|
|
970
|
+
* The source text plus its optional state chip and deviation line. The
|
|
971
|
+
* plain (regular, no-deviation) case renders the bare textbox — byte-for-
|
|
972
|
+
* byte the pre-6.1 output; a state or a deviation wraps it in the
|
|
973
|
+
* `.source-block` stack.
|
|
974
|
+
*/
|
|
975
|
+
private renderSourceBlock(): TemplateResult {
|
|
976
|
+
const state = this.srcOptions?.state ?? ReadoutSourceState.regular;
|
|
977
|
+
const deviation = this.srcOptions?.deviation;
|
|
978
|
+
const hasDeviation = deviation !== undefined && Number.isFinite(deviation);
|
|
979
|
+
const box = this.renderTextbox(
|
|
980
|
+
'source',
|
|
981
|
+
this.src ?? '',
|
|
982
|
+
this.srcOptions?.spaceReserver,
|
|
983
|
+
this.srcOptions
|
|
984
|
+
);
|
|
985
|
+
if (state === ReadoutSourceState.regular && !hasDeviation) {
|
|
986
|
+
return box;
|
|
987
|
+
}
|
|
988
|
+
return html`
|
|
989
|
+
<div
|
|
990
|
+
class=${classMap({
|
|
991
|
+
'source-block': true,
|
|
992
|
+
[`source-state-${state}`]: state !== ReadoutSourceState.regular,
|
|
993
|
+
})}
|
|
994
|
+
part="source-block"
|
|
995
|
+
>
|
|
996
|
+
${box}
|
|
997
|
+
${hasDeviation
|
|
998
|
+
? html`<span class="source-deviation">
|
|
999
|
+
<obi-delta aria-hidden="true"></obi-delta>
|
|
1000
|
+
<obc-textbox
|
|
1001
|
+
class="source-deviation-value"
|
|
1002
|
+
.size=${ObcTextboxSize.xs}
|
|
1003
|
+
.tabularNums=${true}
|
|
1004
|
+
alignment="left"
|
|
1005
|
+
>${deviation}</obc-textbox
|
|
1006
|
+
>
|
|
1007
|
+
</span>`
|
|
1008
|
+
: nothing}
|
|
1009
|
+
</div>
|
|
1010
|
+
`;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
864
1013
|
private renderTrailingSource(): TemplateResult | typeof nothing {
|
|
865
1014
|
if (
|
|
866
1015
|
this.resolvedStacking === ReadoutListItemStacking.leadingSrc ||
|
|
@@ -870,12 +1019,7 @@ export class ObcReadoutListItem extends LitElement {
|
|
|
870
1019
|
}
|
|
871
1020
|
return html`
|
|
872
1021
|
<div class="divider" part="divider" aria-hidden="true"></div>
|
|
873
|
-
${this.
|
|
874
|
-
'source',
|
|
875
|
-
this.src,
|
|
876
|
-
this.srcOptions?.spaceReserver,
|
|
877
|
-
this.srcOptions
|
|
878
|
-
)}
|
|
1022
|
+
${this.renderSourceBlock()}
|
|
879
1023
|
`;
|
|
880
1024
|
}
|
|
881
1025
|
|