@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.156 → 2.0.0-next.157
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 +2 -23
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/dist/navigation-instruments/readout/readout.css.js +2 -23
- package/dist/navigation-instruments/readout/readout.css.js.map +1 -1
- package/package.json +1 -1
- package/src/navigation-instruments/readout/readout.css +2 -22
- package/src/navigation-instruments/readout/readout.spec.ts +74 -1
|
@@ -58,14 +58,14 @@ obc-readout-block {
|
|
|
58
58
|
/* ---------- Root ----------
|
|
59
59
|
* The root is an inline flex column (vertical) or row (horizontal). Private
|
|
60
60
|
* \`--_readout-*\` variables are resolved per layout × size tier below; every
|
|
61
|
-
* layout rule reads only the private variables.
|
|
61
|
+
* layout rule reads only the private variables. A readout is as tall as its
|
|
62
|
+
* rows: the design's container-min-height tokens are not applied (#1252). */
|
|
62
63
|
|
|
63
64
|
.readout {
|
|
64
65
|
display: inline-flex;
|
|
65
66
|
position: relative;
|
|
66
67
|
padding-inline: var(--_readout-pad-h);
|
|
67
68
|
padding-block: var(--_readout-pad-v);
|
|
68
|
-
min-block-size: var(--_readout-min-height, auto);
|
|
69
69
|
border-radius: var(--global-border-radius-border-radius-base);
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -608,15 +608,8 @@ obc-readout-block {
|
|
|
608
608
|
--_readout-value-pad-v: var(
|
|
609
609
|
--instrument-components-readout-group-vertical-regular-value-container-padding-vertical
|
|
610
610
|
);
|
|
611
|
-
--_readout-min-height: var(
|
|
612
|
-
--instrument-components-readout-group-vertical-regular-container-min-height
|
|
613
|
-
);
|
|
614
611
|
}
|
|
615
612
|
|
|
616
|
-
/* The medium tiers set no \`--_readout-min-height\`: Figma defines the
|
|
617
|
-
* container-min-height token only for the regular and enhanced tiers, so
|
|
618
|
-
* medium readouts intentionally fall back to \`min-block-size: auto\`. */
|
|
619
|
-
|
|
620
613
|
.readout.direction-vertical.stacking-inline.size-medium {
|
|
621
614
|
--_readout-pad-h: var(
|
|
622
615
|
--instrument-components-readout-group-vertical-medium-container-padding-horizontal
|
|
@@ -651,9 +644,6 @@ obc-readout-block {
|
|
|
651
644
|
--_readout-value-pad-v: var(
|
|
652
645
|
--instrument-components-readout-group-vertical-enhanced-vertical-value-container-padding-vertical
|
|
653
646
|
);
|
|
654
|
-
--_readout-min-height: var(
|
|
655
|
-
--instrument-components-readout-group-vertical-enhanced-container-min-height
|
|
656
|
-
);
|
|
657
647
|
}
|
|
658
648
|
|
|
659
649
|
/* Stack (vertical, stacked meta) */
|
|
@@ -674,9 +664,6 @@ obc-readout-block {
|
|
|
674
664
|
--_readout-value-pad-v: var(
|
|
675
665
|
--instrument-components-readout-stack-regular-value-container-padding-vertical
|
|
676
666
|
);
|
|
677
|
-
--_readout-min-height: var(
|
|
678
|
-
--instrument-components-readout-stack-regular-container-min-height
|
|
679
|
-
);
|
|
680
667
|
}
|
|
681
668
|
|
|
682
669
|
.readout.direction-vertical.stacking-stacked.size-medium {
|
|
@@ -713,9 +700,6 @@ obc-readout-block {
|
|
|
713
700
|
--_readout-value-pad-v: var(
|
|
714
701
|
--instrument-components-readout-stack-enhanced-vertical-value-container-padding-vertical
|
|
715
702
|
);
|
|
716
|
-
--_readout-min-height: var(
|
|
717
|
-
--instrument-components-readout-stack-enhanced-container-min-height
|
|
718
|
-
);
|
|
719
703
|
}
|
|
720
704
|
|
|
721
705
|
/* Group horizontal */
|
|
@@ -738,8 +722,6 @@ obc-readout-block {
|
|
|
738
722
|
--_readout-divider-pad: var(
|
|
739
723
|
--instrument-components-readout-group-horizontal-regular-divider-padding
|
|
740
724
|
);
|
|
741
|
-
/* TODO(designer): verify; must also hold when only a unit is present */
|
|
742
|
-
--_readout-min-height: auto;
|
|
743
725
|
}
|
|
744
726
|
|
|
745
727
|
.readout.direction-horizontal.size-medium {
|
|
@@ -780,9 +762,6 @@ obc-readout-block {
|
|
|
780
762
|
--_readout-divider-pad: var(
|
|
781
763
|
--instrument-components-readout-group-horizontal-enhanced-divider-padding
|
|
782
764
|
);
|
|
783
|
-
--_readout-min-height: var(
|
|
784
|
-
--instrument-components-readout-group-horizontal-enhanced-container-min-height
|
|
785
|
-
);
|
|
786
765
|
}
|
|
787
766
|
|
|
788
767
|
/* ---------- Debug overlay ----------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readout.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readout.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -16,13 +16,13 @@ obc-readout-block {
|
|
|
16
16
|
/* ---------- Root ----------
|
|
17
17
|
* The root is an inline flex column (vertical) or row (horizontal). Private
|
|
18
18
|
* `--_readout-*` variables are resolved per layout × size tier below; every
|
|
19
|
-
* layout rule reads only the private variables.
|
|
19
|
+
* layout rule reads only the private variables. A readout is as tall as its
|
|
20
|
+
* rows: the design's container-min-height tokens are not applied (#1252). */
|
|
20
21
|
.readout {
|
|
21
22
|
display: inline-flex;
|
|
22
23
|
position: relative;
|
|
23
24
|
padding-inline: var(--_readout-pad-h);
|
|
24
25
|
padding-block: var(--_readout-pad-v);
|
|
25
|
-
min-block-size: var(--_readout-min-height, auto);
|
|
26
26
|
border-radius: var(--global-border-radius-border-radius-base);
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -532,14 +532,8 @@ obc-readout-block {
|
|
|
532
532
|
--_readout-value-pad-v: var(
|
|
533
533
|
--instrument-components-readout-group-vertical-regular-value-container-padding-vertical
|
|
534
534
|
);
|
|
535
|
-
--_readout-min-height: var(
|
|
536
|
-
--instrument-components-readout-group-vertical-regular-container-min-height
|
|
537
|
-
);
|
|
538
535
|
}
|
|
539
536
|
|
|
540
|
-
/* The medium tiers set no `--_readout-min-height`: Figma defines the
|
|
541
|
-
* container-min-height token only for the regular and enhanced tiers, so
|
|
542
|
-
* medium readouts intentionally fall back to `min-block-size: auto`. */
|
|
543
537
|
.readout.direction-vertical.stacking-inline.size-medium {
|
|
544
538
|
--_readout-pad-h: var(
|
|
545
539
|
--instrument-components-readout-group-vertical-medium-container-padding-horizontal
|
|
@@ -574,9 +568,6 @@ obc-readout-block {
|
|
|
574
568
|
--_readout-value-pad-v: var(
|
|
575
569
|
--instrument-components-readout-group-vertical-enhanced-vertical-value-container-padding-vertical
|
|
576
570
|
);
|
|
577
|
-
--_readout-min-height: var(
|
|
578
|
-
--instrument-components-readout-group-vertical-enhanced-container-min-height
|
|
579
|
-
);
|
|
580
571
|
}
|
|
581
572
|
|
|
582
573
|
/* Stack (vertical, stacked meta) */
|
|
@@ -596,9 +587,6 @@ obc-readout-block {
|
|
|
596
587
|
--_readout-value-pad-v: var(
|
|
597
588
|
--instrument-components-readout-stack-regular-value-container-padding-vertical
|
|
598
589
|
);
|
|
599
|
-
--_readout-min-height: var(
|
|
600
|
-
--instrument-components-readout-stack-regular-container-min-height
|
|
601
|
-
);
|
|
602
590
|
}
|
|
603
591
|
|
|
604
592
|
.readout.direction-vertical.stacking-stacked.size-medium {
|
|
@@ -635,9 +623,6 @@ obc-readout-block {
|
|
|
635
623
|
--_readout-value-pad-v: var(
|
|
636
624
|
--instrument-components-readout-stack-enhanced-vertical-value-container-padding-vertical
|
|
637
625
|
);
|
|
638
|
-
--_readout-min-height: var(
|
|
639
|
-
--instrument-components-readout-stack-enhanced-container-min-height
|
|
640
|
-
);
|
|
641
626
|
}
|
|
642
627
|
|
|
643
628
|
/* Group horizontal */
|
|
@@ -659,8 +644,6 @@ obc-readout-block {
|
|
|
659
644
|
--_readout-divider-pad: var(
|
|
660
645
|
--instrument-components-readout-group-horizontal-regular-divider-padding
|
|
661
646
|
);
|
|
662
|
-
/* TODO(designer): verify; must also hold when only a unit is present */
|
|
663
|
-
--_readout-min-height: auto;
|
|
664
647
|
}
|
|
665
648
|
|
|
666
649
|
.readout.direction-horizontal.size-medium {
|
|
@@ -701,9 +684,6 @@ obc-readout-block {
|
|
|
701
684
|
--_readout-divider-pad: var(
|
|
702
685
|
--instrument-components-readout-group-horizontal-enhanced-divider-padding
|
|
703
686
|
);
|
|
704
|
-
--_readout-min-height: var(
|
|
705
|
-
--instrument-components-readout-group-horizontal-enhanced-container-min-height
|
|
706
|
-
);
|
|
707
687
|
}
|
|
708
688
|
|
|
709
689
|
/* ---------- Debug overlay ----------
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import {afterEach, describe, expect, it, vi} from 'vitest';
|
|
2
|
+
import {render} from 'vitest-browser-lit';
|
|
3
|
+
import {html, type TemplateResult} from 'lit';
|
|
4
|
+
import '../../main.css';
|
|
2
5
|
import './readout.js';
|
|
3
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ReadoutDirection,
|
|
8
|
+
ReadoutSize,
|
|
9
|
+
ReadoutStacking,
|
|
10
|
+
type ObcReadout,
|
|
11
|
+
} from './readout.js';
|
|
4
12
|
|
|
5
13
|
/**
|
|
6
14
|
* A horizontal readout given a `size` other than `large` warns once per
|
|
@@ -60,3 +68,68 @@ describe('obc-readout horizontal size warning', () => {
|
|
|
60
68
|
expect(warn).toHaveBeenCalledTimes(2);
|
|
61
69
|
});
|
|
62
70
|
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A readout is exactly as tall as its rows — the padding plus the value
|
|
74
|
+
* cluster and the meta zone. No tier applies the design file's
|
|
75
|
+
* container-min-height token (#1252). Measured over every vertical tier and
|
|
76
|
+
* both stackings: in the large tiers the content already exceeds the token,
|
|
77
|
+
* so a reintroduced minimum would stay invisible there.
|
|
78
|
+
*/
|
|
79
|
+
describe('obc-readout height', () => {
|
|
80
|
+
const SIZES = [ReadoutSize.small, ReadoutSize.medium, ReadoutSize.large];
|
|
81
|
+
const STACKINGS = [ReadoutStacking.inline, ReadoutStacking.stacked];
|
|
82
|
+
|
|
83
|
+
async function mount(template: TemplateResult) {
|
|
84
|
+
const screen = render(template);
|
|
85
|
+
const el = screen.container.querySelector('obc-readout') as ObcReadout;
|
|
86
|
+
await el.updateComplete;
|
|
87
|
+
return el.shadowRoot!.querySelector('.readout') as HTMLElement;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The height a column flex root has when nothing but its rows sizes it. */
|
|
91
|
+
function contentHeight(root: HTMLElement): number {
|
|
92
|
+
const {paddingTop, paddingBottom} = getComputedStyle(root);
|
|
93
|
+
const rows = Array.from(root.children).reduce(
|
|
94
|
+
(sum, row) => sum + row.getBoundingClientRect().height,
|
|
95
|
+
0
|
|
96
|
+
);
|
|
97
|
+
return rows + parseFloat(paddingTop) + parseFloat(paddingBottom);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
for (const size of SIZES) {
|
|
101
|
+
for (const stacking of STACKINGS) {
|
|
102
|
+
it(`hugs its rows: ${size} / ${stacking}`, async () => {
|
|
103
|
+
const root = await mount(
|
|
104
|
+
html`<obc-readout
|
|
105
|
+
.size=${size}
|
|
106
|
+
.stacking=${stacking}
|
|
107
|
+
.value=${123}
|
|
108
|
+
label="SOG"
|
|
109
|
+
unit="kn"
|
|
110
|
+
></obc-readout>`
|
|
111
|
+
);
|
|
112
|
+
expect(root.getBoundingClientRect().height).toBeCloseTo(
|
|
113
|
+
contentHeight(root),
|
|
114
|
+
0
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
it('hugs its rows: small / stacked, meta zone only', async () => {
|
|
121
|
+
const root = await mount(
|
|
122
|
+
html`<obc-readout
|
|
123
|
+
.size=${ReadoutSize.small}
|
|
124
|
+
.stacking=${ReadoutStacking.stacked}
|
|
125
|
+
.hasValue=${false}
|
|
126
|
+
label="Angle"
|
|
127
|
+
unit="DEG"
|
|
128
|
+
></obc-readout>`
|
|
129
|
+
);
|
|
130
|
+
expect(root.getBoundingClientRect().height).toBeCloseTo(
|
|
131
|
+
contentHeight(root),
|
|
132
|
+
0
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
});
|