@oicl/openbridge-webcomponents 2.0.0-next.88 → 2.0.0-next.89
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 +17344 -16794
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +720 -43
- package/dist/building-blocks/readout-block/readout-block.css.js +229 -0
- package/dist/building-blocks/readout-block/readout-block.css.js.map +1 -0
- package/dist/building-blocks/readout-block/readout-block.d.ts +146 -0
- package/dist/building-blocks/readout-block/readout-block.d.ts.map +1 -0
- package/dist/building-blocks/readout-block/readout-block.js +273 -0
- package/dist/building-blocks/readout-block/readout-block.js.map +1 -0
- package/dist/navigation-instruments/readout-list/readout-list.css.js +24 -0
- package/dist/navigation-instruments/readout-list/readout-list.css.js.map +1 -0
- package/dist/navigation-instruments/readout-list/readout-list.d.ts +70 -0
- package/dist/navigation-instruments/readout-list/readout-list.d.ts.map +1 -0
- package/dist/navigation-instruments/readout-list/readout-list.js +154 -0
- package/dist/navigation-instruments/readout-list/readout-list.js.map +1 -0
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +80 -145
- 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 +25 -26
- 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 +66 -118
- package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
const componentStyle = css`* {
|
|
3
|
+
-webkit-tap-highlight-color: transparent;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
* {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: flex-end;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* ---------- Readout building block (advice / setpoint / value) ---------- */
|
|
16
|
+
|
|
17
|
+
.block {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: flex-end;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Number + its (setpoint/advice) degree glyph, hugging with no gap — the
|
|
23
|
+
\`.block\` gap only separates the icon from this group. */
|
|
24
|
+
|
|
25
|
+
.block-content {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: flex-end;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.block-icon {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
flex: none;
|
|
35
|
+
color: inherit;
|
|
36
|
+
/* Centre the icon against the block's text rather than bottom-aligning it (the
|
|
37
|
+
block is flex-end). Matters for the value block, whose text is taller than
|
|
38
|
+
the icon, so the value icon lines up with the number like the smaller
|
|
39
|
+
setpoint/advice icons do. */
|
|
40
|
+
align-self: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.block-icon obi-input-right,
|
|
44
|
+
.block-icon obi-notification-advice,
|
|
45
|
+
.block-icon ::slotted(*) {
|
|
46
|
+
display: block;
|
|
47
|
+
inline-size: 100%;
|
|
48
|
+
block-size: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.hinted-zero {
|
|
52
|
+
color: var(--obc-readout-block-hinted-color, var(--element-inactive-color));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* ---------- Text colours (overridable via custom properties) ----------
|
|
56
|
+
* obc-textbox does not set its own colour, so it inherits these. */
|
|
57
|
+
|
|
58
|
+
.block-value {
|
|
59
|
+
color: var(--obc-readout-block-value-color, var(--element-neutral-color));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.block-value.tone-enhanced {
|
|
63
|
+
color: var(
|
|
64
|
+
--obc-readout-block-value-enhanced-color,
|
|
65
|
+
var(--element-neutral-enhanced-color)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* The setpoint shares the value's colour state: neutral by default, enhanced
|
|
70
|
+
(blue) only when the row is enhanced — never a blue setpoint next to a grey
|
|
71
|
+
value. \`--instrument-enhanced-secondary-color\` is the same #2d548b as the
|
|
72
|
+
value's \`--element-neutral-enhanced-color\`. */
|
|
73
|
+
|
|
74
|
+
.block-setpoint {
|
|
75
|
+
color: var(--obc-readout-block-setpoint-color, var(--element-neutral-color));
|
|
76
|
+
/* Flip-flop emphasis + pop-up fade animate at 100ms. */
|
|
77
|
+
transition:
|
|
78
|
+
opacity 100ms ease,
|
|
79
|
+
color 100ms ease;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.block-setpoint.tone-enhanced {
|
|
83
|
+
color: var(
|
|
84
|
+
--obc-readout-block-setpoint-enhanced-color,
|
|
85
|
+
var(--instrument-enhanced-secondary-color)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Pop-up: fade the setpoint out once value === setpoint, keeping its space so
|
|
90
|
+
the value stays column-aligned. */
|
|
91
|
+
|
|
92
|
+
.block-setpoint.is-hiding {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.block-setpoint.is-hidden {
|
|
97
|
+
opacity: 0;
|
|
98
|
+
visibility: hidden;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Touching / focus state: the setpoint triangle takes the marker's focus look — a
|
|
102
|
+
pale fill (--base-blue-100) with a dark 1px edge (--element-neutral-enhanced),
|
|
103
|
+
mirroring \`svghelpers/setpoint.ts\` focus (fill base-blue-100 + 2px stroke).
|
|
104
|
+
The glyph icon is \`fill: currentColor\` and can't take a CSS \`stroke\`, so the
|
|
105
|
+
edge is layered drop-shadows. The setpoint number keeps its normal, readable
|
|
106
|
+
colour. */
|
|
107
|
+
|
|
108
|
+
.block-setpoint.touching {
|
|
109
|
+
--_touching-outline: var(
|
|
110
|
+
--obc-readout-block-setpoint-touching-outline-color,
|
|
111
|
+
var(--element-neutral-enhanced-color)
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.block-setpoint.touching .block-icon {
|
|
116
|
+
color: var(--obc-readout-block-setpoint-touching-color, var(--base-blue-100));
|
|
117
|
+
filter: drop-shadow(1px 0 0 var(--_touching-outline))
|
|
118
|
+
drop-shadow(-1px 0 0 var(--_touching-outline))
|
|
119
|
+
drop-shadow(0 1px 0 var(--_touching-outline))
|
|
120
|
+
drop-shadow(0 -1px 0 var(--_touching-outline));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.block-advice {
|
|
124
|
+
color: var(--obc-readout-block-advice-color, var(--element-neutral-color));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* ---------- Per-block data quality ----------
|
|
128
|
+
* Uses \`outline\` (not \`border\`) so the chip never shifts the block's width — the
|
|
129
|
+
* value stays column-aligned across rows. */
|
|
130
|
+
|
|
131
|
+
.block.data-low-integrity,
|
|
132
|
+
.block.data-invalid {
|
|
133
|
+
outline: 1px solid;
|
|
134
|
+
border-radius: var(--global-border-radius-border-radius-check);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.block.data-low-integrity {
|
|
138
|
+
background: var(--alert-low-integrity-background-color);
|
|
139
|
+
outline-color: var(--alert-low-integrity-border-color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.block.data-invalid {
|
|
143
|
+
background: var(--alert-invalid-background-color);
|
|
144
|
+
outline-color: var(--alert-invalid-border-color);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* ---------- Degree column ----------
|
|
148
|
+
* A cap-height \`°\` column whose width scales with the number size; it inherits
|
|
149
|
+
* the block's colour. */
|
|
150
|
+
|
|
151
|
+
.degree-column {
|
|
152
|
+
flex: none;
|
|
153
|
+
display: inline-flex;
|
|
154
|
+
align-items: flex-end;
|
|
155
|
+
justify-content: center;
|
|
156
|
+
inline-size: var(--_obc-readout-block-degree-width, 0);
|
|
157
|
+
overflow: clip;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.degree-column.degree-inherit {
|
|
161
|
+
color: inherit;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.degree-column.degree-xs {
|
|
165
|
+
--_obc-readout-block-degree-width: var(
|
|
166
|
+
--global-typography-instrument-value-small-degree-unit-width
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.degree-column.degree-s {
|
|
171
|
+
--_obc-readout-block-degree-width: var(
|
|
172
|
+
--global-typography-instrument-value-regular-degree-unit-width
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.degree-column.degree-m {
|
|
177
|
+
--_obc-readout-block-degree-width: var(
|
|
178
|
+
--global-typography-instrument-value-medium-degree-unit-width
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.degree-column.degree-l,
|
|
183
|
+
.degree-column.degree-xl {
|
|
184
|
+
--_obc-readout-block-degree-width: var(
|
|
185
|
+
--global-typography-instrument-value-large-degree-unit-width
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* ---------- Size tiers ----------
|
|
190
|
+
* Public small/medium/large map to the design token regular/medium/large
|
|
191
|
+
* tiers. */
|
|
192
|
+
|
|
193
|
+
.block.size-small {
|
|
194
|
+
gap: var(--instrument-components-readout-new-general-regular-icon-gap);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.size-small .block-icon {
|
|
198
|
+
inline-size: var(
|
|
199
|
+
--instrument-components-readout-new-general-regular-icon-size
|
|
200
|
+
);
|
|
201
|
+
block-size: var(
|
|
202
|
+
--instrument-components-readout-new-general-regular-icon-size
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.block.size-medium {
|
|
207
|
+
gap: var(--instrument-components-readout-new-general-medium-icon-gap);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.size-medium .block-icon {
|
|
211
|
+
inline-size: var(
|
|
212
|
+
--instrument-components-readout-new-general-medium-icon-size
|
|
213
|
+
);
|
|
214
|
+
block-size: var(--instrument-components-readout-new-general-medium-icon-size);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.block.size-large {
|
|
218
|
+
gap: var(--instrument-components-readout-new-general-large-icon-gap);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.size-large .block-icon {
|
|
222
|
+
inline-size: var(--instrument-components-readout-new-general-large-icon-size);
|
|
223
|
+
block-size: var(--instrument-components-readout-new-general-large-icon-size);
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
export {
|
|
227
|
+
componentStyle as default
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=readout-block.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readout-block.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { ObcTextboxSize, ObcTextboxFontWeight, ObcTextboxAlignment } from '../../components/textbox/textbox.js';
|
|
3
|
+
import { AlertFrameConfig } from '../../components/alert-frame/alert-frame.js';
|
|
4
|
+
import '../../components/textbox/textbox.js';
|
|
5
|
+
import '../../icons/icon-input-right.js';
|
|
6
|
+
import '../../icons/icon-notification-advice.js';
|
|
7
|
+
export { ObcTextboxSize, ObcTextboxFontWeight, ObcTextboxAlignment, } from '../../components/textbox/textbox.js';
|
|
8
|
+
/**
|
|
9
|
+
* Semantic variant of the block. Drives the default marker icon and the
|
|
10
|
+
* colour token; the layout is identical across variants.
|
|
11
|
+
* - `value`: the primary reading (no default marker icon).
|
|
12
|
+
* - `setpoint`: a setpoint reference (default `input-right` marker).
|
|
13
|
+
* - `advice`: an advisory reference (default `notification-advice` marker).
|
|
14
|
+
*/
|
|
15
|
+
export declare enum ReadoutBlockVariant {
|
|
16
|
+
value = "value",
|
|
17
|
+
setpoint = "setpoint",
|
|
18
|
+
advice = "advice"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Density tier of the block — drives icon size, the icon↔number gap, and the
|
|
22
|
+
* degree-column width tier. The number typography size is controlled
|
|
23
|
+
* independently via {@link ObcReadoutBlock.valueSize} so a parent can de-emphasise
|
|
24
|
+
* one block relative to another within the same tier.
|
|
25
|
+
*/
|
|
26
|
+
export declare enum ReadoutBlockSize {
|
|
27
|
+
small = "small",
|
|
28
|
+
medium = "medium",
|
|
29
|
+
large = "large"
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Per-block measurement quality, rendered as a non-shifting outline chip.
|
|
33
|
+
* - `low-integrity`: the value is suspect.
|
|
34
|
+
* - `invalid`: the value is invalid.
|
|
35
|
+
*/
|
|
36
|
+
export declare enum ReadoutBlockDataQuality {
|
|
37
|
+
lowIntegrity = "low-integrity",
|
|
38
|
+
invalid = "invalid"
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Pop-up fade phase for a setpoint block. Driven by the parent's setpoint
|
|
42
|
+
* interaction state machine; only meaningful for `role="setpoint"`.
|
|
43
|
+
*/
|
|
44
|
+
export declare enum ReadoutBlockHidePhase {
|
|
45
|
+
none = "none",
|
|
46
|
+
hiding = "hiding",
|
|
47
|
+
hidden = "hidden"
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* `<obc-readout-block>` – the most atomic readout primitive: a single
|
|
51
|
+
* cap-height-aligned, width-reservable numeric segment (value / setpoint /
|
|
52
|
+
* advice).
|
|
53
|
+
*
|
|
54
|
+
* It renders one `obc-textbox` number with optional hinted leading zeros, a
|
|
55
|
+
* reservable width, an optional leading marker icon (via the `icon` slot or the
|
|
56
|
+
* role default), an optional trailing degree glyph, an `off`/unavailable text
|
|
57
|
+
* state, per-block data-quality and an optional per-block alert frame.
|
|
58
|
+
*
|
|
59
|
+
* This is a building block used inside `obc-readout-list-item` (and, in a future
|
|
60
|
+
* refactor, inside `obc-readout`); it is not normally used on its own. Colour is
|
|
61
|
+
* inherited from the host context (the parent sets the role colour), so the
|
|
62
|
+
* block stays neutral until placed.
|
|
63
|
+
*
|
|
64
|
+
* @experimental Pilot for the new primitives + per-block options Readout API; the
|
|
65
|
+
* API may change in a future release.
|
|
66
|
+
*
|
|
67
|
+
* @slot icon - Replaces the role's default marker icon.
|
|
68
|
+
*
|
|
69
|
+
* @csspart block - The block container (carries role / tone / data-quality).
|
|
70
|
+
* @csspart block-content - The number + degree group.
|
|
71
|
+
* @csspart block-text - The `obc-textbox` rendering the number.
|
|
72
|
+
* @csspart block-icon - The leading marker-icon container.
|
|
73
|
+
* @csspart degree - The trailing degree-glyph column.
|
|
74
|
+
*/
|
|
75
|
+
export declare class ObcReadoutBlock extends LitElement {
|
|
76
|
+
/** Semantic variant (value / setpoint / advice). */
|
|
77
|
+
variant: ReadoutBlockVariant;
|
|
78
|
+
/** The numeric value; `null`/`undefined` renders a dash. */
|
|
79
|
+
value: number | null;
|
|
80
|
+
/** Density tier — icon size, gap, degree tier. */
|
|
81
|
+
size: ReadoutBlockSize;
|
|
82
|
+
/**
|
|
83
|
+
* Resolved number-typography size. When unset it is derived from `size`
|
|
84
|
+
* (small→s, medium→m, large→l), so a parent that de-emphasises a block (e.g.
|
|
85
|
+
* a secondary setpoint) can pass a smaller size without changing the tier.
|
|
86
|
+
*/
|
|
87
|
+
valueSize?: ObcTextboxSize;
|
|
88
|
+
/** Accent (in-command) colour tone. */
|
|
89
|
+
enhanced: boolean;
|
|
90
|
+
/** Number font weight (regular / semibold / bold); colour is independent. */
|
|
91
|
+
weight: ObcTextboxFontWeight;
|
|
92
|
+
/** Render the trailing cap-height degree glyph (`°`). */
|
|
93
|
+
hasDegree: boolean;
|
|
94
|
+
/** Show the leading marker-icon container (always on for setpoint/advice). */
|
|
95
|
+
hasIcon: boolean;
|
|
96
|
+
/** Number of fraction digits. */
|
|
97
|
+
fractionDigits: number;
|
|
98
|
+
/** Integer digits to reserve / hint (independent of `fractionDigits`). */
|
|
99
|
+
maxDigits: number;
|
|
100
|
+
/** Render muted leading zeros filling the integer part to `maxDigits`. */
|
|
101
|
+
hintedZeros: boolean;
|
|
102
|
+
/** Explicit longest string to reserve width for (e.g. `"0000.0"`). */
|
|
103
|
+
spaceReserver?: string;
|
|
104
|
+
/** Render `offText` instead of a number (e.g. equipment powered down). */
|
|
105
|
+
off: boolean;
|
|
106
|
+
/** Text shown when `off` is true. */
|
|
107
|
+
offText: string;
|
|
108
|
+
/** Text alignment of the number within its reserved width. */
|
|
109
|
+
alignment: ObcTextboxAlignment;
|
|
110
|
+
/** Per-block measurement quality (outline chip). */
|
|
111
|
+
dataQuality?: ReadoutBlockDataQuality;
|
|
112
|
+
/** Per-block alert frame; nests inside any parent alert frame. */
|
|
113
|
+
alert: boolean | AlertFrameConfig;
|
|
114
|
+
/** Setpoint focus (touch) state — only meaningful for `role="setpoint"`. */
|
|
115
|
+
touching: boolean;
|
|
116
|
+
/** Setpoint pop-up fade phase — only meaningful for `role="setpoint"`. */
|
|
117
|
+
hidePhase: ReadoutBlockHidePhase;
|
|
118
|
+
private hasAssignedIcon;
|
|
119
|
+
private get resolvedValueSize();
|
|
120
|
+
private get numericFormatOptions();
|
|
121
|
+
/** Widest possible value string for width reservation (e.g. `"000.0"`). */
|
|
122
|
+
private get reserverText();
|
|
123
|
+
/**
|
|
124
|
+
* Effective width reserver: the wider of the explicit `spaceReserver` and the
|
|
125
|
+
* `maxDigits`/`fractionDigits`-derived reserve, so an explicit reserver can
|
|
126
|
+
* never reserve *less* than the formatted value needs. Under tabular-nums the
|
|
127
|
+
* rendered width is proportional to character count, so "wider" compares length.
|
|
128
|
+
*/
|
|
129
|
+
private widerReserver;
|
|
130
|
+
private dataQualityClasses;
|
|
131
|
+
private onIconSlotChange;
|
|
132
|
+
private renderIcon;
|
|
133
|
+
/**
|
|
134
|
+
* A cap-height `°` column whose width scales with the number size. Inherits the
|
|
135
|
+
* block's colour.
|
|
136
|
+
*/
|
|
137
|
+
private renderDegreeGlyph;
|
|
138
|
+
render(): import('lit-html').HTMLTemplateResult;
|
|
139
|
+
static styles: import('lit').CSSResult;
|
|
140
|
+
}
|
|
141
|
+
declare global {
|
|
142
|
+
interface HTMLElementTagNameMap {
|
|
143
|
+
'obc-readout-block': ObcReadoutBlock;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=readout-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readout-block.d.ts","sourceRoot":"","sources":["../../../src/building-blocks/readout-block/readout-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAgD,MAAM,KAAK,CAAC;AAK9E,OAAO,qCAAqC,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,iCAAiC,CAAC;AACzC,OAAO,yCAAyC,CAAC;AAMjD,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAE7C;;;;;;GAMG;AACH,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;;;;GAKG;AACH,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED;;;;GAIG;AACH,oBAAY,uBAAuB;IACjC,YAAY,kBAAkB;IAC9B,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,oDAAoD;IAC1B,OAAO,EAAE,mBAAmB,CAC1B;IAE5B,4DAA4D;IAClC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEtD,kDAAkD;IACxB,IAAI,EAAE,gBAAgB,CAA0B;IAE1E;;;;OAIG;IACuB,SAAS,CAAC,EAAE,cAAc,CAAC;IAErD,uCAAuC;IACZ,QAAQ,UAAS;IAE5C,6EAA6E;IACnD,MAAM,EAAE,oBAAoB,CACvB;IAE/B,yDAAyD;IAC9B,SAAS,UAAS;IAE7C,8EAA8E;IACnD,OAAO,UAAS;IAE3C,iCAAiC;IACP,cAAc,SAAK;IAE7C,0EAA0E;IAChD,SAAS,SAAK;IAExC,0EAA0E;IAC/C,WAAW,UAAS;IAE/C,sEAAsE;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IAEjD,0EAA0E;IAC/C,GAAG,UAAS;IAEvC,qCAAqC;IACX,OAAO,SAAS;IAE1C,8DAA8D;IACpC,SAAS,EAAE,mBAAmB,CAC5B;IAE5B,oDAAoD;IAC1B,WAAW,CAAC,EAAE,uBAAuB,CAAC;IAKhE,kEAAkE;IACxC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAS;IAEpE,4EAA4E;IACjD,QAAQ,UAAS;IAE5C,0EAA0E;IAChD,SAAS,EAAE,qBAAqB,CAC7B;IAEpB,OAAO,CAAC,eAAe,CAAS;IAEzC,OAAO,KAAK,iBAAiB,GAY5B;IAED,OAAO,KAAK,oBAAoB,GAM/B;IAED,2EAA2E;IAC3E,OAAO,KAAK,YAAY,GASvB;IAED;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,gBAAgB,CAMtB;IAEF,OAAO,CAAC,UAAU;IAsBlB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAiBhB,MAAM;IAiEf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { unsafeCSS, LitElement, nothing, html } from "lit";
|
|
2
|
+
import { property, state } from "lit/decorators.js";
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
4
|
+
import componentStyle from "./readout-block.css.js";
|
|
5
|
+
import { customElement } from "../../decorator.js";
|
|
6
|
+
import { ObcTextboxFontWeight, ObcTextboxAlignment, ObcTextboxSize } from "../../components/textbox/textbox.js";
|
|
7
|
+
import "../../icons/icon-input-right.js";
|
|
8
|
+
import "../../icons/icon-notification-advice.js";
|
|
9
|
+
import { formatNumericValue, readoutFormattedInteger } from "../../navigation-instruments/readout/readout-formatters.js";
|
|
10
|
+
import { wrapWithAlertFrame } from "../../components/alert-frame/alert-frame.js";
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
14
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
15
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
+
if (decorator = decorators[i])
|
|
17
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
18
|
+
if (kind && result) __defProp(target, key, result);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var ReadoutBlockVariant = /* @__PURE__ */ ((ReadoutBlockVariant2) => {
|
|
22
|
+
ReadoutBlockVariant2["value"] = "value";
|
|
23
|
+
ReadoutBlockVariant2["setpoint"] = "setpoint";
|
|
24
|
+
ReadoutBlockVariant2["advice"] = "advice";
|
|
25
|
+
return ReadoutBlockVariant2;
|
|
26
|
+
})(ReadoutBlockVariant || {});
|
|
27
|
+
var ReadoutBlockSize = /* @__PURE__ */ ((ReadoutBlockSize2) => {
|
|
28
|
+
ReadoutBlockSize2["small"] = "small";
|
|
29
|
+
ReadoutBlockSize2["medium"] = "medium";
|
|
30
|
+
ReadoutBlockSize2["large"] = "large";
|
|
31
|
+
return ReadoutBlockSize2;
|
|
32
|
+
})(ReadoutBlockSize || {});
|
|
33
|
+
var ReadoutBlockDataQuality = /* @__PURE__ */ ((ReadoutBlockDataQuality2) => {
|
|
34
|
+
ReadoutBlockDataQuality2["lowIntegrity"] = "low-integrity";
|
|
35
|
+
ReadoutBlockDataQuality2["invalid"] = "invalid";
|
|
36
|
+
return ReadoutBlockDataQuality2;
|
|
37
|
+
})(ReadoutBlockDataQuality || {});
|
|
38
|
+
var ReadoutBlockHidePhase = /* @__PURE__ */ ((ReadoutBlockHidePhase2) => {
|
|
39
|
+
ReadoutBlockHidePhase2["none"] = "none";
|
|
40
|
+
ReadoutBlockHidePhase2["hiding"] = "hiding";
|
|
41
|
+
ReadoutBlockHidePhase2["hidden"] = "hidden";
|
|
42
|
+
return ReadoutBlockHidePhase2;
|
|
43
|
+
})(ReadoutBlockHidePhase || {});
|
|
44
|
+
let ObcReadoutBlock = class extends LitElement {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this.variant = "value";
|
|
48
|
+
this.value = null;
|
|
49
|
+
this.size = "small";
|
|
50
|
+
this.enhanced = false;
|
|
51
|
+
this.weight = ObcTextboxFontWeight.regular;
|
|
52
|
+
this.hasDegree = false;
|
|
53
|
+
this.hasIcon = false;
|
|
54
|
+
this.fractionDigits = 0;
|
|
55
|
+
this.maxDigits = 0;
|
|
56
|
+
this.hintedZeros = false;
|
|
57
|
+
this.off = false;
|
|
58
|
+
this.offText = "OFF";
|
|
59
|
+
this.alignment = ObcTextboxAlignment.Right;
|
|
60
|
+
this.alert = false;
|
|
61
|
+
this.touching = false;
|
|
62
|
+
this.hidePhase = "none";
|
|
63
|
+
this.hasAssignedIcon = false;
|
|
64
|
+
this.onIconSlotChange = (event) => {
|
|
65
|
+
this.hasAssignedIcon = event.target.assignedElements({ flatten: true }).length > 0;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
get resolvedValueSize() {
|
|
69
|
+
if (this.valueSize) {
|
|
70
|
+
return this.valueSize;
|
|
71
|
+
}
|
|
72
|
+
switch (this.size) {
|
|
73
|
+
case "large":
|
|
74
|
+
return ObcTextboxSize.l;
|
|
75
|
+
case "medium":
|
|
76
|
+
return ObcTextboxSize.m;
|
|
77
|
+
default:
|
|
78
|
+
return ObcTextboxSize.s;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
get numericFormatOptions() {
|
|
82
|
+
return {
|
|
83
|
+
showZeroPadding: false,
|
|
84
|
+
minValueLength: this.maxDigits,
|
|
85
|
+
fractionDigits: this.fractionDigits
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** Widest possible value string for width reservation (e.g. `"000.0"`). */
|
|
89
|
+
get reserverText() {
|
|
90
|
+
const maxDigits = this.maxDigits;
|
|
91
|
+
if (maxDigits <= 0) {
|
|
92
|
+
return "";
|
|
93
|
+
}
|
|
94
|
+
const integer = "0".repeat(Math.max(maxDigits, 1));
|
|
95
|
+
return this.fractionDigits > 0 ? `${integer}.${"0".repeat(this.fractionDigits)}` : integer;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Effective width reserver: the wider of the explicit `spaceReserver` and the
|
|
99
|
+
* `maxDigits`/`fractionDigits`-derived reserve, so an explicit reserver can
|
|
100
|
+
* never reserve *less* than the formatted value needs. Under tabular-nums the
|
|
101
|
+
* rendered width is proportional to character count, so "wider" compares length.
|
|
102
|
+
*/
|
|
103
|
+
widerReserver(explicit, derived) {
|
|
104
|
+
if (!explicit) {
|
|
105
|
+
return derived;
|
|
106
|
+
}
|
|
107
|
+
if (!derived) {
|
|
108
|
+
return explicit;
|
|
109
|
+
}
|
|
110
|
+
return explicit.length >= derived.length ? explicit : derived;
|
|
111
|
+
}
|
|
112
|
+
dataQualityClasses() {
|
|
113
|
+
return {
|
|
114
|
+
"data-low-integrity": this.dataQuality === "low-integrity",
|
|
115
|
+
"data-invalid": this.dataQuality === "invalid"
|
|
116
|
+
/* invalid */
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
renderIcon() {
|
|
120
|
+
const showIcon = this.variant !== "value" || this.hasIcon;
|
|
121
|
+
if (!showIcon) {
|
|
122
|
+
return nothing;
|
|
123
|
+
}
|
|
124
|
+
let fallback = nothing;
|
|
125
|
+
if (this.variant === "setpoint") {
|
|
126
|
+
fallback = html`<obi-input-right></obi-input-right>`;
|
|
127
|
+
} else if (this.variant === "advice") {
|
|
128
|
+
fallback = html`<obi-notification-advice></obi-notification-advice>`;
|
|
129
|
+
}
|
|
130
|
+
return html`<span class="block-icon" part="block-icon" aria-hidden="true">
|
|
131
|
+
<slot name="icon" @slotchange=${this.onIconSlotChange}></slot>
|
|
132
|
+
${this.hasAssignedIcon ? nothing : fallback}
|
|
133
|
+
</span>`;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A cap-height `°` column whose width scales with the number size. Inherits the
|
|
137
|
+
* block's colour.
|
|
138
|
+
*/
|
|
139
|
+
renderDegreeGlyph(size) {
|
|
140
|
+
return html`
|
|
141
|
+
<span
|
|
142
|
+
class=${classMap({
|
|
143
|
+
"degree-column": true,
|
|
144
|
+
[`degree-${size}`]: true,
|
|
145
|
+
"degree-inherit": true
|
|
146
|
+
})}
|
|
147
|
+
part="degree"
|
|
148
|
+
>
|
|
149
|
+
<obc-textbox class="degree-glyph" .size=${size} alignment="center"
|
|
150
|
+
>°</obc-textbox
|
|
151
|
+
>
|
|
152
|
+
</span>
|
|
153
|
+
`;
|
|
154
|
+
}
|
|
155
|
+
render() {
|
|
156
|
+
const valueSize = this.resolvedValueSize;
|
|
157
|
+
const formatOptions = this.numericFormatOptions;
|
|
158
|
+
const valueForFormat = this.value ?? void 0;
|
|
159
|
+
const text = this.off ? this.offText : formatNumericValue(valueForFormat, formatOptions);
|
|
160
|
+
const hintCount = this.off || !this.hintedZeros || valueForFormat === void 0 || valueForFormat < 0 ? 0 : Math.max(this.maxDigits - readoutFormattedInteger(text), 0);
|
|
161
|
+
const hinted = hintCount > 0 ? "0".repeat(hintCount) : "";
|
|
162
|
+
const reserver = this.hintedZeros ? this.reserverText : this.widerReserver(this.spaceReserver, this.reserverText);
|
|
163
|
+
const block = html`
|
|
164
|
+
<div
|
|
165
|
+
class=${classMap({
|
|
166
|
+
block: true,
|
|
167
|
+
[`block-${this.variant}`]: true,
|
|
168
|
+
[`size-${this.size}`]: true,
|
|
169
|
+
"tone-enhanced": this.enhanced,
|
|
170
|
+
touching: this.touching,
|
|
171
|
+
"is-hiding": this.hidePhase === "hiding",
|
|
172
|
+
"is-hidden": this.hidePhase === "hidden",
|
|
173
|
+
...this.dataQualityClasses()
|
|
174
|
+
})}
|
|
175
|
+
part="block block-${this.variant}"
|
|
176
|
+
>
|
|
177
|
+
${this.renderIcon()}
|
|
178
|
+
<span class="block-content" part="block-content">
|
|
179
|
+
<obc-textbox
|
|
180
|
+
class="block-text"
|
|
181
|
+
part="block-text"
|
|
182
|
+
.size=${valueSize}
|
|
183
|
+
.fontWeight=${this.weight}
|
|
184
|
+
.alignment=${this.alignment}
|
|
185
|
+
.tabularNums=${true}
|
|
186
|
+
>
|
|
187
|
+
${hinted ? html`<span class="hinted-zero" aria-hidden="true"
|
|
188
|
+
>${hinted}</span
|
|
189
|
+
>` : nothing}${text}
|
|
190
|
+
${reserver ? html`<span slot="length">${reserver}</span>` : nothing}
|
|
191
|
+
</obc-textbox>
|
|
192
|
+
${this.hasDegree ? this.renderDegreeGlyph(valueSize) : nothing}
|
|
193
|
+
</span>
|
|
194
|
+
</div>
|
|
195
|
+
`;
|
|
196
|
+
return wrapWithAlertFrame(this.alert ?? false, block);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
ObcReadoutBlock.styles = unsafeCSS(componentStyle);
|
|
200
|
+
__decorateClass([
|
|
201
|
+
property({ type: String })
|
|
202
|
+
], ObcReadoutBlock.prototype, "variant", 2);
|
|
203
|
+
__decorateClass([
|
|
204
|
+
property({ type: Number })
|
|
205
|
+
], ObcReadoutBlock.prototype, "value", 2);
|
|
206
|
+
__decorateClass([
|
|
207
|
+
property({ type: String })
|
|
208
|
+
], ObcReadoutBlock.prototype, "size", 2);
|
|
209
|
+
__decorateClass([
|
|
210
|
+
property({ type: String })
|
|
211
|
+
], ObcReadoutBlock.prototype, "valueSize", 2);
|
|
212
|
+
__decorateClass([
|
|
213
|
+
property({ type: Boolean })
|
|
214
|
+
], ObcReadoutBlock.prototype, "enhanced", 2);
|
|
215
|
+
__decorateClass([
|
|
216
|
+
property({ type: String })
|
|
217
|
+
], ObcReadoutBlock.prototype, "weight", 2);
|
|
218
|
+
__decorateClass([
|
|
219
|
+
property({ type: Boolean })
|
|
220
|
+
], ObcReadoutBlock.prototype, "hasDegree", 2);
|
|
221
|
+
__decorateClass([
|
|
222
|
+
property({ type: Boolean })
|
|
223
|
+
], ObcReadoutBlock.prototype, "hasIcon", 2);
|
|
224
|
+
__decorateClass([
|
|
225
|
+
property({ type: Number })
|
|
226
|
+
], ObcReadoutBlock.prototype, "fractionDigits", 2);
|
|
227
|
+
__decorateClass([
|
|
228
|
+
property({ type: Number })
|
|
229
|
+
], ObcReadoutBlock.prototype, "maxDigits", 2);
|
|
230
|
+
__decorateClass([
|
|
231
|
+
property({ type: Boolean })
|
|
232
|
+
], ObcReadoutBlock.prototype, "hintedZeros", 2);
|
|
233
|
+
__decorateClass([
|
|
234
|
+
property({ type: String })
|
|
235
|
+
], ObcReadoutBlock.prototype, "spaceReserver", 2);
|
|
236
|
+
__decorateClass([
|
|
237
|
+
property({ type: Boolean })
|
|
238
|
+
], ObcReadoutBlock.prototype, "off", 2);
|
|
239
|
+
__decorateClass([
|
|
240
|
+
property({ type: String })
|
|
241
|
+
], ObcReadoutBlock.prototype, "offText", 2);
|
|
242
|
+
__decorateClass([
|
|
243
|
+
property({ type: String })
|
|
244
|
+
], ObcReadoutBlock.prototype, "alignment", 2);
|
|
245
|
+
__decorateClass([
|
|
246
|
+
property({ type: String })
|
|
247
|
+
], ObcReadoutBlock.prototype, "dataQuality", 2);
|
|
248
|
+
__decorateClass([
|
|
249
|
+
property({ type: Object })
|
|
250
|
+
], ObcReadoutBlock.prototype, "alert", 2);
|
|
251
|
+
__decorateClass([
|
|
252
|
+
property({ type: Boolean })
|
|
253
|
+
], ObcReadoutBlock.prototype, "touching", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
property({ type: String })
|
|
256
|
+
], ObcReadoutBlock.prototype, "hidePhase", 2);
|
|
257
|
+
__decorateClass([
|
|
258
|
+
state()
|
|
259
|
+
], ObcReadoutBlock.prototype, "hasAssignedIcon", 2);
|
|
260
|
+
ObcReadoutBlock = __decorateClass([
|
|
261
|
+
customElement("obc-readout-block")
|
|
262
|
+
], ObcReadoutBlock);
|
|
263
|
+
export {
|
|
264
|
+
ObcReadoutBlock,
|
|
265
|
+
ObcTextboxAlignment,
|
|
266
|
+
ObcTextboxFontWeight,
|
|
267
|
+
ObcTextboxSize,
|
|
268
|
+
ReadoutBlockDataQuality,
|
|
269
|
+
ReadoutBlockHidePhase,
|
|
270
|
+
ReadoutBlockSize,
|
|
271
|
+
ReadoutBlockVariant
|
|
272
|
+
};
|
|
273
|
+
//# sourceMappingURL=readout-block.js.map
|