@oicl/openbridge-webcomponents 2.0.0-next.112 → 2.0.0-next.113
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 +112 -13
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +101 -14
- package/dist/building-blocks/readout-block/readout-block.d.ts +29 -5
- package/dist/building-blocks/readout-block/readout-block.d.ts.map +1 -1
- package/dist/building-blocks/readout-block/readout-block.js +21 -7
- package/dist/building-blocks/readout-block/readout-block.js.map +1 -1
- package/dist/navigation-instruments/readout/readout-formatters.d.ts +31 -0
- package/dist/navigation-instruments/readout/readout-formatters.d.ts.map +1 -1
- package/dist/navigation-instruments/readout/readout-formatters.js +55 -1
- package/dist/navigation-instruments/readout/readout-formatters.js.map +1 -1
- package/dist/navigation-instruments/readout/readout.d.ts +26 -1
- package/dist/navigation-instruments/readout/readout.d.ts.map +1 -1
- package/dist/navigation-instruments/readout/readout.js +16 -3
- package/dist/navigation-instruments/readout/readout.js.map +1 -1
- package/dist/navigation-instruments/readout-list/readout-list.d.ts +6 -1
- package/dist/navigation-instruments/readout-list/readout-list.d.ts.map +1 -1
- package/dist/navigation-instruments/readout-list/readout-list.js +21 -4
- package/dist/navigation-instruments/readout-list/readout-list.js.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts +26 -1
- 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 +15 -3
- package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
- package/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -40052,7 +40052,7 @@
|
|
|
40052
40052
|
"declarations": [
|
|
40053
40053
|
{
|
|
40054
40054
|
"kind": "class",
|
|
40055
|
-
"description": "`<obc-readout-block>` – the most atomic readout primitive: a single\ncap-height-aligned, width-reservable numeric segment (value / setpoint /\nadvice).\n\nIt renders one `obc-textbox` number with optional hinted leading zeros, a\nreservable width, an optional leading marker icon (via the `icon` slot or the\nrole default), an optional trailing degree glyph, an `off`/unavailable text\nstate, per-block data-quality and an optional per-block alert frame.\n\nThis is a building block used inside `obc-readout-list-item` (and, in a future\nrefactor, inside `obc-readout`); it is not normally used on its own. Colour is\ninherited from the host context (the parent sets the role colour), so the\nblock stays neutral until placed.",
|
|
40055
|
+
"description": "`<obc-readout-block>` – the most atomic readout primitive: a single\ncap-height-aligned, width-reservable numeric segment (value / setpoint /\nadvice).\n\nIt renders one `obc-textbox` number with optional hinted leading zeros, a\nreservable width, an optional leading marker icon (via the `icon` slot or the\nrole default), an optional trailing degree glyph, an `off`/unavailable text\nstate, per-block data-quality and an optional per-block alert frame.\n\nSetting `valueType` to `text` renders `value` verbatim (e.g.\n`\"Auto\"`) instead of a formatted number.\n\nThis is a building block used inside `obc-readout-list-item` (and, in a future\nrefactor, inside `obc-readout`); it is not normally used on its own. Colour is\ninherited from the host context (the parent sets the role colour), so the\nblock stays neutral until placed.",
|
|
40056
40056
|
"name": "ObcReadoutBlock",
|
|
40057
40057
|
"cssParts": [
|
|
40058
40058
|
{
|
|
@@ -40096,12 +40096,21 @@
|
|
|
40096
40096
|
"kind": "field",
|
|
40097
40097
|
"name": "value",
|
|
40098
40098
|
"type": {
|
|
40099
|
-
"text": "number | null"
|
|
40099
|
+
"text": "number | string | null"
|
|
40100
40100
|
},
|
|
40101
40101
|
"default": "null",
|
|
40102
|
-
"description": "The
|
|
40102
|
+
"description": "The value; `null`/`undefined` renders a dash. A number by default, or text\nwhen valueType is `text`.",
|
|
40103
40103
|
"attribute": "value"
|
|
40104
40104
|
},
|
|
40105
|
+
{
|
|
40106
|
+
"kind": "field",
|
|
40107
|
+
"name": "valueType",
|
|
40108
|
+
"type": {
|
|
40109
|
+
"text": "ReadoutValueType"
|
|
40110
|
+
},
|
|
40111
|
+
"description": "How value is interpreted. `number` (default) formats it via\n`fractionDigits`; `text` renders it verbatim and ignores the numeric\nformat options. Passing text while this is `number` throws.",
|
|
40112
|
+
"attribute": "valueType"
|
|
40113
|
+
},
|
|
40105
40114
|
{
|
|
40106
40115
|
"kind": "field",
|
|
40107
40116
|
"name": "size",
|
|
@@ -40384,12 +40393,20 @@
|
|
|
40384
40393
|
{
|
|
40385
40394
|
"name": "value",
|
|
40386
40395
|
"type": {
|
|
40387
|
-
"text": "number | null"
|
|
40396
|
+
"text": "number | string | null"
|
|
40388
40397
|
},
|
|
40389
40398
|
"default": "null",
|
|
40390
|
-
"description": "The
|
|
40399
|
+
"description": "The value; `null`/`undefined` renders a dash. A number by default, or text\nwhen valueType is `text`.",
|
|
40391
40400
|
"fieldName": "value"
|
|
40392
40401
|
},
|
|
40402
|
+
{
|
|
40403
|
+
"name": "valueType",
|
|
40404
|
+
"type": {
|
|
40405
|
+
"text": "ReadoutValueType"
|
|
40406
|
+
},
|
|
40407
|
+
"description": "How value is interpreted. `number` (default) formats it via\n`fractionDigits`; `text` renders it verbatim and ignores the numeric\nformat options. Passing text while this is `number` throws.",
|
|
40408
|
+
"fieldName": "valueType"
|
|
40409
|
+
},
|
|
40393
40410
|
{
|
|
40394
40411
|
"name": "size",
|
|
40395
40412
|
"type": {
|
|
@@ -40570,6 +40587,14 @@
|
|
|
40570
40587
|
"module": "../../components/textbox/textbox.js"
|
|
40571
40588
|
}
|
|
40572
40589
|
},
|
|
40590
|
+
{
|
|
40591
|
+
"kind": "js",
|
|
40592
|
+
"name": "ReadoutValueType",
|
|
40593
|
+
"declaration": {
|
|
40594
|
+
"name": "ReadoutValueType",
|
|
40595
|
+
"module": "../../navigation-instruments/readout/readout-formatters.js"
|
|
40596
|
+
}
|
|
40597
|
+
},
|
|
40573
40598
|
{
|
|
40574
40599
|
"kind": "js",
|
|
40575
40600
|
"name": "ObcReadoutBlock",
|
|
@@ -91134,7 +91159,7 @@
|
|
|
91134
91159
|
"declarations": [
|
|
91135
91160
|
{
|
|
91136
91161
|
"kind": "class",
|
|
91137
|
-
"description": "`<obc-readout-list-item>` – A compact, dense readout row for lists and tables.\n\nRenders a label, an optional source, an optional unit, and up to three\ncap-height \"readout building blocks\" – advice, setpoint, and value – each a\nfixed-width-reservable numeric segment. Dynamic data is passed as top-level\nprimitives (`value`, `setpoint`, `advice`, `label`, `unit`, `src`). Global\nlayout/format is configured via top-level props (`size`, `priority`,\n`stacking`, `hasDegree`, `dataQuality`, `alert`, …) and per-block tweaks via one\nobject per block (`valueOptions`, `setpointOptions`, `adviceOptions`,\n`unitOptions`, `srcOptions`).\n\n### Features\n- **Building blocks:** value, optional setpoint, and optional advice segments,\n each cap-height-aligned and able to reserve a stable width.\n- **Sizes:** `small`, `medium`, `large` density scales.\n- **Stacking:** `trailing-unit`, `leading-unit`, `leading-src` placement.\n- **Priority:** `regular`/`enhanced` colour emphasis; per-value `weight`\n (`regular`/`semibold`/`bold`) is independent of colour.\n- **Setpoint flip-flop:** swaps emphasis between value and setpoint as the\n value reaches the setpoint.\n- **Data quality:** `low-integrity`/`invalid` styling, combinable with `alert`.\n- **Alert frame:** optional `alert` wrapper (caution/warning/alarm/level).\n- **Clickable:** optionally rendered as a focusable button with `squared`,\n `round-corners`, or `round` corners.\n- **Formatting:** shared `fractionDigits`, width reservation via `maxDigits`\n and per-segment `hintedZeros`; a `null` value renders a dash (`-`).\n\n### Usage Guidelines\nUse for dense readout rows in lists/tables. Prefer `<obc-readout>` for rich\nmulti-segment instrument layouts, source pickers, or flyout behaviour.",
|
|
91162
|
+
"description": "`<obc-readout-list-item>` – A compact, dense readout row for lists and tables.\n\nRenders a label, an optional source, an optional unit, and up to three\ncap-height \"readout building blocks\" – advice, setpoint, and value – each a\nfixed-width-reservable numeric segment. Dynamic data is passed as top-level\nprimitives (`value`, `setpoint`, `advice`, `label`, `unit`, `src`). Global\nlayout/format is configured via top-level props (`size`, `priority`,\n`stacking`, `hasDegree`, `dataQuality`, `alert`, …) and per-block tweaks via one\nobject per block (`valueOptions`, `setpointOptions`, `adviceOptions`,\n`unitOptions`, `srcOptions`).\n\n### Features\n- **Building blocks:** value, optional setpoint, and optional advice segments,\n each cap-height-aligned and able to reserve a stable width.\n- **Sizes:** `small`, `medium`, `large` density scales.\n- **Stacking:** `trailing-unit`, `leading-unit`, `leading-src` placement.\n- **Priority:** `regular`/`enhanced` colour emphasis; per-value `weight`\n (`regular`/`semibold`/`bold`) is independent of colour.\n- **Setpoint flip-flop:** swaps emphasis between value and setpoint as the\n value reaches the setpoint.\n- **Data quality:** `low-integrity`/`invalid` styling, combinable with `alert`.\n- **Alert frame:** optional `alert` wrapper (caution/warning/alarm/level).\n- **Clickable:** optionally rendered as a focusable button with `squared`,\n `round-corners`, or `round` corners.\n- **Formatting:** shared `fractionDigits`, width reservation via `maxDigits`\n and per-segment `hintedZeros`; a `null` value renders a dash (`-`).\n- **Text values:** `valueType=\"text\"` renders `value` verbatim (e.g.\n `\"Thermo On\"`) instead of formatting it as a number.\n\n### Usage Guidelines\nUse for dense readout rows in lists/tables. Prefer `<obc-readout>` for rich\nmulti-segment instrument layouts, source pickers, or flyout behaviour.",
|
|
91138
91163
|
"name": "ObcReadoutListItem",
|
|
91139
91164
|
"slots": [
|
|
91140
91165
|
{
|
|
@@ -91192,11 +91217,21 @@
|
|
|
91192
91217
|
"kind": "field",
|
|
91193
91218
|
"name": "value",
|
|
91194
91219
|
"type": {
|
|
91195
|
-
"text": "number | null"
|
|
91220
|
+
"text": "number | string | null"
|
|
91196
91221
|
},
|
|
91197
91222
|
"default": "null",
|
|
91223
|
+
"description": "The value; `null` renders a dash. A number by default, or text when\nvalueType is `text`.",
|
|
91198
91224
|
"attribute": "value"
|
|
91199
91225
|
},
|
|
91226
|
+
{
|
|
91227
|
+
"kind": "field",
|
|
91228
|
+
"name": "valueType",
|
|
91229
|
+
"type": {
|
|
91230
|
+
"text": "ReadoutValueType"
|
|
91231
|
+
},
|
|
91232
|
+
"description": "How value is interpreted. `number` (default) formats it via\n`fractionDigits`; `text` renders it verbatim and ignores the numeric\nformat options. Passing text while this is `number` throws.",
|
|
91233
|
+
"attribute": "valueType"
|
|
91234
|
+
},
|
|
91200
91235
|
{
|
|
91201
91236
|
"kind": "field",
|
|
91202
91237
|
"name": "off",
|
|
@@ -91318,6 +91353,7 @@
|
|
|
91318
91353
|
"text": "number"
|
|
91319
91354
|
},
|
|
91320
91355
|
"default": "0",
|
|
91356
|
+
"description": "Also formats the numeric setpoint / advice blocks, which stay numeric\neven when the value is text.",
|
|
91321
91357
|
"attribute": "fractionDigits"
|
|
91322
91358
|
},
|
|
91323
91359
|
{
|
|
@@ -91327,6 +91363,7 @@
|
|
|
91327
91363
|
"text": "number"
|
|
91328
91364
|
},
|
|
91329
91365
|
"default": "0",
|
|
91366
|
+
"description": "Also formats the numeric setpoint / advice blocks, which stay numeric\neven when the value is text.",
|
|
91330
91367
|
"attribute": "maxDigits"
|
|
91331
91368
|
},
|
|
91332
91369
|
{
|
|
@@ -91669,7 +91706,7 @@
|
|
|
91669
91706
|
{
|
|
91670
91707
|
"name": "config",
|
|
91671
91708
|
"type": {
|
|
91672
|
-
"text": "{\n variant: ReadoutBlockVariant;\n value: number | null | undefined;\n valueSize: ObcTextboxSize;\n enhanced: boolean;\n weight: ObcTextboxFontWeight;\n hintedZeros: boolean;\n spaceReserver?: string;\n off?: boolean;\n hasDegree?: boolean;\n hasIcon?: boolean;\n touching?: boolean;\n hidePhase?: ReadoutBlockHidePhase;\n dataQuality?: ReadoutBlockDataQuality;\n alert?: false | AlertFrameConfig;\n }"
|
|
91709
|
+
"text": "{\n variant: ReadoutBlockVariant;\n value: number | string | null | undefined;\n /** Only the value block is ever text; setpoint / advice stay numeric. */\n valueType?: ReadoutValueType;\n valueSize: ObcTextboxSize;\n enhanced: boolean;\n weight: ObcTextboxFontWeight;\n hintedZeros: boolean;\n spaceReserver?: string;\n off?: boolean;\n hasDegree?: boolean;\n hasIcon?: boolean;\n touching?: boolean;\n hidePhase?: ReadoutBlockHidePhase;\n dataQuality?: ReadoutBlockDataQuality;\n alert?: false | AlertFrameConfig;\n }"
|
|
91673
91710
|
}
|
|
91674
91711
|
}
|
|
91675
91712
|
]
|
|
@@ -91868,11 +91905,20 @@
|
|
|
91868
91905
|
{
|
|
91869
91906
|
"name": "value",
|
|
91870
91907
|
"type": {
|
|
91871
|
-
"text": "number | null"
|
|
91908
|
+
"text": "number | string | null"
|
|
91872
91909
|
},
|
|
91873
91910
|
"default": "null",
|
|
91911
|
+
"description": "The value; `null` renders a dash. A number by default, or text when\nvalueType is `text`.",
|
|
91874
91912
|
"fieldName": "value"
|
|
91875
91913
|
},
|
|
91914
|
+
{
|
|
91915
|
+
"name": "valueType",
|
|
91916
|
+
"type": {
|
|
91917
|
+
"text": "ReadoutValueType"
|
|
91918
|
+
},
|
|
91919
|
+
"description": "How value is interpreted. `number` (default) formats it via\n`fractionDigits`; `text` renders it verbatim and ignores the numeric\nformat options. Passing text while this is `number` throws.",
|
|
91920
|
+
"fieldName": "valueType"
|
|
91921
|
+
},
|
|
91876
91922
|
{
|
|
91877
91923
|
"name": "off",
|
|
91878
91924
|
"type": {
|
|
@@ -91980,6 +92026,7 @@
|
|
|
91980
92026
|
"text": "number"
|
|
91981
92027
|
},
|
|
91982
92028
|
"default": "0",
|
|
92029
|
+
"description": "Also formats the numeric setpoint / advice blocks, which stay numeric\neven when the value is text.",
|
|
91983
92030
|
"fieldName": "fractionDigits"
|
|
91984
92031
|
},
|
|
91985
92032
|
{
|
|
@@ -91988,6 +92035,7 @@
|
|
|
91988
92035
|
"text": "number"
|
|
91989
92036
|
},
|
|
91990
92037
|
"default": "0",
|
|
92038
|
+
"description": "Also formats the numeric setpoint / advice blocks, which stay numeric\neven when the value is text.",
|
|
91991
92039
|
"fieldName": "maxDigits"
|
|
91992
92040
|
},
|
|
91993
92041
|
{
|
|
@@ -92067,6 +92115,14 @@
|
|
|
92067
92115
|
"module": "../../components/textbox/textbox.js"
|
|
92068
92116
|
}
|
|
92069
92117
|
},
|
|
92118
|
+
{
|
|
92119
|
+
"kind": "js",
|
|
92120
|
+
"name": "ReadoutValueType",
|
|
92121
|
+
"declaration": {
|
|
92122
|
+
"name": "ReadoutValueType",
|
|
92123
|
+
"module": "../readout/readout-formatters.js"
|
|
92124
|
+
}
|
|
92125
|
+
},
|
|
92070
92126
|
{
|
|
92071
92127
|
"kind": "js",
|
|
92072
92128
|
"name": "ReadoutListItemSize",
|
|
@@ -92107,7 +92163,7 @@
|
|
|
92107
92163
|
"declarations": [
|
|
92108
92164
|
{
|
|
92109
92165
|
"kind": "class",
|
|
92110
|
-
"description": "`<obc-readout-list>` – A container that groups `<obc-readout-list-item>` rows\nand **auto-aligns their columns**.\n\nBecause each row is its own custom element, cross-row column alignment is not\nautomatic. This container inspects its rows and pushes shared width reservers\ndown so the unit column, the value / setpoint / advice columns and the source\ncolumn all line up — the same effect the `Readout List Item → ColumnAlignment`\nstory achieves by hand, done for you. Alignment is always on.\n\nWhat it equalizes — derived from each row's data and broadcast to every row, so\nthe widest value / unit / source is never clipped:\n- **Unit:** the longest `unit` becomes every row's unit space-reserver.\n- **Value / setpoint / advice:** the widest numeric width (max integer digits +\n max fraction digits across rows, derived from each row's `maxDigits` /\n `fractionDigits` / current values) is reserved on every row's numeric blocks.\n Reserving off digit counts keeps it stable as live values update.\n- **Source:** the longest `src` becomes every row's source space-reserver.\n- **Degree:** if any row has a degree, non-degree rows reserve the degree column\n (`hasDegreeSpacer`) so their digits line up with the degree rows; the spacer is\n cleared once no degree rows remain.\n\nThe list **owns** these reservers: it recomputes them from the rows' data on\nevery pass (and clears stale reservers / spacers when rows change), so a\n`spaceReserver` set directly on a row inside the list is overwritten. Drive the\ndata (`maxDigits` / `fractionDigits` / `unit` / `src`) rather than setting a\nmanual reserver when a row lives in a list.\n\nAlignment runs on `slotchange` and on child mutations (added/removed rows and\nHTML-attribute changes). When rows are updated via JS **properties** only (no\nattribute/DOM mutation), call align to recompute.",
|
|
92166
|
+
"description": "`<obc-readout-list>` – A container that groups `<obc-readout-list-item>` rows\nand **auto-aligns their columns**.\n\nBecause each row is its own custom element, cross-row column alignment is not\nautomatic. This container inspects its rows and pushes shared width reservers\ndown so the unit column, the value / setpoint / advice columns and the source\ncolumn all line up — the same effect the `Readout List Item → ColumnAlignment`\nstory achieves by hand, done for you. Alignment is always on.\n\nWhat it equalizes — derived from each row's data and broadcast to every row, so\nthe widest value / unit / source is never clipped:\n- **Unit:** the longest `unit` becomes every row's unit space-reserver.\n- **Value / setpoint / advice:** the widest numeric width (max integer digits +\n max fraction digits across rows, derived from each row's `maxDigits` /\n `fractionDigits` / current values) is reserved on every row's numeric blocks.\n Reserving off digit counts keeps it stable as live values update. A row with\n `valueType=\"text\"` is excluded in both directions — it neither contributes\n to the reserve (so a long text value cannot inflate the numeric column) nor\n receives it (so short text is not padded to a digit width); its value block\n sizes to its own content. Its setpoint / advice blocks stay numeric and are\n reserved normally.\n- **Source:** the longest `src` becomes every row's source space-reserver.\n- **Degree:** if any row has a degree, non-degree rows reserve the degree column\n (`hasDegreeSpacer`) so their digits line up with the degree rows; the spacer is\n cleared once no degree rows remain.\n\nThe list **owns** these reservers: it recomputes them from the rows' data on\nevery pass (and clears stale reservers / spacers when rows change), so a\n`spaceReserver` set directly on a row inside the list is overwritten. Drive the\ndata (`maxDigits` / `fractionDigits` / `unit` / `src`) rather than setting a\nmanual reserver when a row lives in a list.\n\nAlignment runs on `slotchange` and on child mutations (added/removed rows and\nHTML-attribute changes). When rows are updated via JS **properties** only (no\nattribute/DOM mutation), call align to recompute.",
|
|
92111
92167
|
"name": "ObcReadoutList",
|
|
92112
92168
|
"cssParts": [
|
|
92113
92169
|
{
|
|
@@ -92221,7 +92277,7 @@
|
|
|
92221
92277
|
"declarations": [
|
|
92222
92278
|
{
|
|
92223
92279
|
"kind": "class",
|
|
92224
|
-
"description": "`<obc-readout>` – An instrument readout: a value with optional setpoint,\nadvice, label, unit, and source, arranged vertically or horizontally.\n\nA layout sibling of `<obc-readout-list-item>` built from the same\ncap-height \"readout building blocks\" (`obc-readout-block`): dynamic data is\npassed as top-level primitives (`value`, `setpoint`, `advice`, `label`,\n`unit`, `src`), global layout/format via top-level props (`size`,\n`priority`, `direction`, `stacking`, `alignment`, `hasDegree`,\n`dataQuality`, `alert`, …) and per-block tweaks via one object per block\n(`valueOptions`, `setpointOptions`, `adviceOptions`, `unitOptions`,\n`srcOptions`).\n\n### Features\n- **Building blocks:** value, optional setpoint, and optional advice\n segments, each cap-height-aligned and able to reserve a stable width.\n- **Sizes:** `small`, `medium`, `large` density scales.\n- **Direction:** `vertical` (blocks above a label+unit meta zone and source\n row) or `horizontal` (all segments on one row).\n- **Stacking & alignment:** vertical readouts arrange label/unit `inline`\n or `stacked`; stacked readouts align `vertical` (right), `left`, or\n `center`.\n- **Priority:** `regular`/`enhanced` colour emphasis; per-value `weight`\n is independent of colour.\n- **Setpoint interactions:** `always-visible`, `flip-flop` (emphasis swap),\n and `pop-up` (fade-out at setpoint), plus the `touching` focus state.\n- **Data quality:** `low-integrity`/`invalid` styling, per block or for the\n whole readout, combinable with `alert`.\n- **Alert frame:** optional `alert` wrapper (caution/warning/alarm/level).\n- **Source:** plain text by default; opt-in `picker` (context menu) or\n `flyout` interactivity via `srcOptions.interaction`.\n- **Formatting:** shared `fractionDigits`, width reservation via\n `maxDigits` and per-segment `hintedZeros`; a `null` value renders a dash.\n\n### Usage Guidelines\nUse for stand-alone instrument readouts and readouts embedded in\ninstruments. Prefer `<obc-readout-list-item>` for dense rows in\nlists/tables (label left, value right) and `<obc-readout-list>` for\nauto-aligned groups of rows.",
|
|
92280
|
+
"description": "`<obc-readout>` – An instrument readout: a value with optional setpoint,\nadvice, label, unit, and source, arranged vertically or horizontally.\n\nA layout sibling of `<obc-readout-list-item>` built from the same\ncap-height \"readout building blocks\" (`obc-readout-block`): dynamic data is\npassed as top-level primitives (`value`, `setpoint`, `advice`, `label`,\n`unit`, `src`), global layout/format via top-level props (`size`,\n`priority`, `direction`, `stacking`, `alignment`, `hasDegree`,\n`dataQuality`, `alert`, …) and per-block tweaks via one object per block\n(`valueOptions`, `setpointOptions`, `adviceOptions`, `unitOptions`,\n`srcOptions`).\n\n### Features\n- **Building blocks:** value, optional setpoint, and optional advice\n segments, each cap-height-aligned and able to reserve a stable width.\n- **Sizes:** `small`, `medium`, `large` density scales.\n- **Direction:** `vertical` (blocks above a label+unit meta zone and source\n row) or `horizontal` (all segments on one row).\n- **Stacking & alignment:** vertical readouts arrange label/unit `inline`\n or `stacked`; stacked readouts align `vertical` (right), `left`, or\n `center`.\n- **Priority:** `regular`/`enhanced` colour emphasis; per-value `weight`\n is independent of colour.\n- **Setpoint interactions:** `always-visible`, `flip-flop` (emphasis swap),\n and `pop-up` (fade-out at setpoint), plus the `touching` focus state.\n- **Data quality:** `low-integrity`/`invalid` styling, per block or for the\n whole readout, combinable with `alert`.\n- **Alert frame:** optional `alert` wrapper (caution/warning/alarm/level).\n- **Source:** plain text by default; opt-in `picker` (context menu) or\n `flyout` interactivity via `srcOptions.interaction`.\n- **Formatting:** shared `fractionDigits`, width reservation via\n `maxDigits` and per-segment `hintedZeros`; a `null` value renders a dash.\n- **Text values:** `valueType=\"text\"` renders `value` verbatim (e.g.\n `\"Auto\"`) instead of formatting it as a number.\n\n### Usage Guidelines\nUse for stand-alone instrument readouts and readouts embedded in\ninstruments. Prefer `<obc-readout-list-item>` for dense rows in\nlists/tables (label left, value right) and `<obc-readout-list>` for\nauto-aligned groups of rows.",
|
|
92225
92281
|
"name": "ObcReadout",
|
|
92226
92282
|
"slots": [
|
|
92227
92283
|
{
|
|
@@ -92279,11 +92335,21 @@
|
|
|
92279
92335
|
"kind": "field",
|
|
92280
92336
|
"name": "value",
|
|
92281
92337
|
"type": {
|
|
92282
|
-
"text": "number | null"
|
|
92338
|
+
"text": "number | string | null"
|
|
92283
92339
|
},
|
|
92284
92340
|
"default": "null",
|
|
92341
|
+
"description": "The value; `null` renders a dash. A number by default, or text when\nvalueType is `text`.",
|
|
92285
92342
|
"attribute": "value"
|
|
92286
92343
|
},
|
|
92344
|
+
{
|
|
92345
|
+
"kind": "field",
|
|
92346
|
+
"name": "valueType",
|
|
92347
|
+
"type": {
|
|
92348
|
+
"text": "ReadoutValueType"
|
|
92349
|
+
},
|
|
92350
|
+
"description": "How value is interpreted. `number` (default) formats it via\n`fractionDigits`; `text` renders it verbatim and ignores the numeric\nformat options. Passing text while this is `number` throws.",
|
|
92351
|
+
"attribute": "valueType"
|
|
92352
|
+
},
|
|
92287
92353
|
{
|
|
92288
92354
|
"kind": "field",
|
|
92289
92355
|
"name": "off",
|
|
@@ -92403,6 +92469,7 @@
|
|
|
92403
92469
|
"text": "number"
|
|
92404
92470
|
},
|
|
92405
92471
|
"default": "0",
|
|
92472
|
+
"description": "Also formats the numeric setpoint / advice blocks, which stay numeric\neven when the value is text.",
|
|
92406
92473
|
"attribute": "fractionDigits"
|
|
92407
92474
|
},
|
|
92408
92475
|
{
|
|
@@ -92412,6 +92479,7 @@
|
|
|
92412
92479
|
"text": "number"
|
|
92413
92480
|
},
|
|
92414
92481
|
"default": "0",
|
|
92482
|
+
"description": "Also formats the numeric setpoint / advice blocks, which stay numeric\neven when the value is text.",
|
|
92415
92483
|
"attribute": "maxDigits"
|
|
92416
92484
|
},
|
|
92417
92485
|
{
|
|
@@ -92832,7 +92900,7 @@
|
|
|
92832
92900
|
{
|
|
92833
92901
|
"name": "config",
|
|
92834
92902
|
"type": {
|
|
92835
|
-
"text": "{\n variant: ReadoutBlockVariant;\n value: number | null | undefined;\n valueSize: ObcTextboxSize;\n enhanced: boolean;\n weight: ObcTextboxFontWeight;\n hintedZeros: boolean;\n spaceReserver?: string;\n off?: boolean;\n hasDegree?: boolean;\n hasIcon?: boolean;\n touching?: boolean;\n hidePhase?: ReadoutBlockHidePhase;\n dataQuality?: ReadoutBlockDataQuality;\n alert?: false | AlertFrameConfig;\n /**\n * Invisible width-reserving duplicate (see\n * {@link renderSetpointWidthReserve}): skips the forwarded icon slot so\n * the visible block keeps the slotted content — the block's default\n * marker has the same fixed tier width.\n */\n ghost?: boolean;\n }"
|
|
92903
|
+
"text": "{\n variant: ReadoutBlockVariant;\n value: number | string | null | undefined;\n /** Only the value block is ever text; setpoint / advice stay numeric. */\n valueType?: ReadoutValueType;\n valueSize: ObcTextboxSize;\n enhanced: boolean;\n weight: ObcTextboxFontWeight;\n hintedZeros: boolean;\n spaceReserver?: string;\n off?: boolean;\n hasDegree?: boolean;\n hasIcon?: boolean;\n touching?: boolean;\n hidePhase?: ReadoutBlockHidePhase;\n dataQuality?: ReadoutBlockDataQuality;\n alert?: false | AlertFrameConfig;\n /**\n * Invisible width-reserving duplicate (see\n * {@link renderSetpointWidthReserve}): skips the forwarded icon slot so\n * the visible block keeps the slotted content — the block's default\n * marker has the same fixed tier width.\n */\n ghost?: boolean;\n }"
|
|
92836
92904
|
}
|
|
92837
92905
|
}
|
|
92838
92906
|
]
|
|
@@ -93193,11 +93261,20 @@
|
|
|
93193
93261
|
{
|
|
93194
93262
|
"name": "value",
|
|
93195
93263
|
"type": {
|
|
93196
|
-
"text": "number | null"
|
|
93264
|
+
"text": "number | string | null"
|
|
93197
93265
|
},
|
|
93198
93266
|
"default": "null",
|
|
93267
|
+
"description": "The value; `null` renders a dash. A number by default, or text when\nvalueType is `text`.",
|
|
93199
93268
|
"fieldName": "value"
|
|
93200
93269
|
},
|
|
93270
|
+
{
|
|
93271
|
+
"name": "valueType",
|
|
93272
|
+
"type": {
|
|
93273
|
+
"text": "ReadoutValueType"
|
|
93274
|
+
},
|
|
93275
|
+
"description": "How value is interpreted. `number` (default) formats it via\n`fractionDigits`; `text` renders it verbatim and ignores the numeric\nformat options. Passing text while this is `number` throws.",
|
|
93276
|
+
"fieldName": "valueType"
|
|
93277
|
+
},
|
|
93201
93278
|
{
|
|
93202
93279
|
"name": "off",
|
|
93203
93280
|
"type": {
|
|
@@ -93303,6 +93380,7 @@
|
|
|
93303
93380
|
"text": "number"
|
|
93304
93381
|
},
|
|
93305
93382
|
"default": "0",
|
|
93383
|
+
"description": "Also formats the numeric setpoint / advice blocks, which stay numeric\neven when the value is text.",
|
|
93306
93384
|
"fieldName": "fractionDigits"
|
|
93307
93385
|
},
|
|
93308
93386
|
{
|
|
@@ -93311,6 +93389,7 @@
|
|
|
93311
93389
|
"text": "number"
|
|
93312
93390
|
},
|
|
93313
93391
|
"default": "0",
|
|
93392
|
+
"description": "Also formats the numeric setpoint / advice blocks, which stay numeric\neven when the value is text.",
|
|
93314
93393
|
"fieldName": "maxDigits"
|
|
93315
93394
|
},
|
|
93316
93395
|
{
|
|
@@ -93390,6 +93469,14 @@
|
|
|
93390
93469
|
"module": "../../components/textbox/textbox.js"
|
|
93391
93470
|
}
|
|
93392
93471
|
},
|
|
93472
|
+
{
|
|
93473
|
+
"kind": "js",
|
|
93474
|
+
"name": "ReadoutValueType",
|
|
93475
|
+
"declaration": {
|
|
93476
|
+
"name": "ReadoutValueType",
|
|
93477
|
+
"module": "./readout-formatters.js"
|
|
93478
|
+
}
|
|
93479
|
+
},
|
|
93393
93480
|
{
|
|
93394
93481
|
"kind": "js",
|
|
93395
93482
|
"name": "ReadoutBlockState",
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { ObcTextboxSize, ObcTextboxFontWeight, ObcTextboxAlignment } from '../../components/textbox/textbox.js';
|
|
3
|
+
import { ReadoutValueType } from '../../navigation-instruments/readout/readout-formatters.js';
|
|
3
4
|
import { AlertFrameConfig } from '../../components/alert-frame/alert-frame.js';
|
|
4
5
|
import '../../components/textbox/textbox.js';
|
|
5
6
|
import '../../icons/icon-input-right.js';
|
|
6
7
|
import '../../icons/icon-notification-advice.js';
|
|
7
8
|
export { ObcTextboxSize, ObcTextboxFontWeight, ObcTextboxAlignment, } from '../../components/textbox/textbox.js';
|
|
9
|
+
export { ReadoutValueType } from '../../navigation-instruments/readout/readout-formatters.js';
|
|
8
10
|
/**
|
|
9
11
|
* Semantic variant of the block. Drives the default marker icon and the
|
|
10
12
|
* colour token; the layout is identical across variants.
|
|
@@ -56,6 +58,9 @@ export declare enum ReadoutBlockHidePhase {
|
|
|
56
58
|
* role default), an optional trailing degree glyph, an `off`/unavailable text
|
|
57
59
|
* state, per-block data-quality and an optional per-block alert frame.
|
|
58
60
|
*
|
|
61
|
+
* Setting `valueType` to `text` renders `value` verbatim (e.g.
|
|
62
|
+
* `"Auto"`) instead of a formatted number.
|
|
63
|
+
*
|
|
59
64
|
* This is a building block used inside `obc-readout-list-item` (and, in a future
|
|
60
65
|
* refactor, inside `obc-readout`); it is not normally used on its own. Colour is
|
|
61
66
|
* inherited from the host context (the parent sets the role colour), so the
|
|
@@ -75,8 +80,17 @@ export declare enum ReadoutBlockHidePhase {
|
|
|
75
80
|
export declare class ObcReadoutBlock extends LitElement {
|
|
76
81
|
/** Semantic variant (value / setpoint / advice). */
|
|
77
82
|
variant: ReadoutBlockVariant;
|
|
78
|
-
/**
|
|
79
|
-
|
|
83
|
+
/**
|
|
84
|
+
* The value; `null`/`undefined` renders a dash. A number by default, or text
|
|
85
|
+
* when {@link valueType} is `text`.
|
|
86
|
+
*/
|
|
87
|
+
value: number | string | null;
|
|
88
|
+
/**
|
|
89
|
+
* How {@link value} is interpreted. `number` (default) formats it via
|
|
90
|
+
* `fractionDigits`; `text` renders it verbatim and ignores the numeric
|
|
91
|
+
* format options. Passing text while this is `number` throws.
|
|
92
|
+
*/
|
|
93
|
+
valueType: ReadoutValueType;
|
|
80
94
|
/** Density tier — icon size, gap, degree tier. */
|
|
81
95
|
size: ReadoutBlockSize;
|
|
82
96
|
/**
|
|
@@ -93,11 +107,20 @@ export declare class ObcReadoutBlock extends LitElement {
|
|
|
93
107
|
hasDegree: boolean;
|
|
94
108
|
/** Show the leading marker-icon container (always on for setpoint/advice). */
|
|
95
109
|
hasIcon: boolean;
|
|
96
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* Number of fraction digits.
|
|
112
|
+
* @availableWhen valueType==number
|
|
113
|
+
*/
|
|
97
114
|
fractionDigits: number;
|
|
98
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Integer digits to reserve / hint (independent of `fractionDigits`).
|
|
117
|
+
* @availableWhen valueType==number
|
|
118
|
+
*/
|
|
99
119
|
maxDigits: number;
|
|
100
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Render muted leading zeros filling the integer part to `maxDigits`.
|
|
122
|
+
* @availableWhen valueType==number
|
|
123
|
+
*/
|
|
101
124
|
hintedZeros: boolean;
|
|
102
125
|
/** Explicit longest string to reserve width for (e.g. `"0000.0"`). */
|
|
103
126
|
spaceReserver?: string;
|
|
@@ -135,6 +158,7 @@ export declare class ObcReadoutBlock extends LitElement {
|
|
|
135
158
|
* block's colour.
|
|
136
159
|
*/
|
|
137
160
|
private renderDegreeGlyph;
|
|
161
|
+
protected willUpdate(changed: Map<string, unknown>): void;
|
|
138
162
|
render(): import('lit-html').HTMLTemplateResult;
|
|
139
163
|
static styles: import('lit').CSSResult;
|
|
140
164
|
}
|
|
@@ -1 +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;
|
|
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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;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;cAiBN,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAYzD,MAAM;IA+Ef,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
|
|
@@ -6,7 +6,7 @@ import { customElement } from "../../decorator.js";
|
|
|
6
6
|
import { ObcTextboxFontWeight, ObcTextboxAlignment, ObcTextboxSize } from "../../components/textbox/textbox.js";
|
|
7
7
|
import "../../icons/icon-input-right.js";
|
|
8
8
|
import "../../icons/icon-notification-advice.js";
|
|
9
|
-
import { formatNumericValue, readoutFormattedInteger } from "../../navigation-instruments/readout/readout-formatters.js";
|
|
9
|
+
import { ReadoutValueType, assertReadoutValueType, resolveReadoutNumericValue, resolveReadoutTextValue, formatNumericValue, readoutFormattedInteger } from "../../navigation-instruments/readout/readout-formatters.js";
|
|
10
10
|
import { wrapWithAlertFrame } from "../../components/alert-frame/alert-frame.js";
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
12
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -46,6 +46,7 @@ let ObcReadoutBlock = class extends LitElement {
|
|
|
46
46
|
super(...arguments);
|
|
47
47
|
this.variant = "value";
|
|
48
48
|
this.value = null;
|
|
49
|
+
this.valueType = ReadoutValueType.number;
|
|
49
50
|
this.size = "small";
|
|
50
51
|
this.enhanced = false;
|
|
51
52
|
this.weight = ObcTextboxFontWeight.regular;
|
|
@@ -152,14 +153,23 @@ let ObcReadoutBlock = class extends LitElement {
|
|
|
152
153
|
</span>
|
|
153
154
|
`;
|
|
154
155
|
}
|
|
156
|
+
willUpdate(changed) {
|
|
157
|
+
super.willUpdate(changed);
|
|
158
|
+
assertReadoutValueType("obc-readout-block", this.value, this.valueType);
|
|
159
|
+
}
|
|
155
160
|
render() {
|
|
156
161
|
const valueSize = this.resolvedValueSize;
|
|
157
162
|
const formatOptions = this.numericFormatOptions;
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
|
|
163
|
+
const isTextMode = this.valueType === ReadoutValueType.text;
|
|
164
|
+
const valueForFormat = resolveReadoutNumericValue(
|
|
165
|
+
this.value,
|
|
166
|
+
this.valueType
|
|
167
|
+
);
|
|
168
|
+
const textValue = resolveReadoutTextValue(this.value, this.valueType);
|
|
169
|
+
const text = this.off ? this.offText : isTextMode ? textValue ?? "-" : formatNumericValue(valueForFormat, formatOptions);
|
|
170
|
+
const hintCount = this.off || isTextMode || !this.hintedZeros || valueForFormat === void 0 || valueForFormat < 0 ? 0 : Math.max(this.maxDigits - readoutFormattedInteger(text), 0);
|
|
161
171
|
const hinted = hintCount > 0 ? "0".repeat(hintCount) : "";
|
|
162
|
-
const reserver = this.hintedZeros ? this.reserverText : this.widerReserver(this.spaceReserver, this.reserverText);
|
|
172
|
+
const reserver = isTextMode ? this.spaceReserver ?? "" : this.hintedZeros ? this.reserverText : this.widerReserver(this.spaceReserver, this.reserverText);
|
|
163
173
|
const block = html`
|
|
164
174
|
<div
|
|
165
175
|
class=${classMap({
|
|
@@ -201,8 +211,11 @@ __decorateClass([
|
|
|
201
211
|
property({ type: String })
|
|
202
212
|
], ObcReadoutBlock.prototype, "variant", 2);
|
|
203
213
|
__decorateClass([
|
|
204
|
-
property({ type:
|
|
214
|
+
property({ type: String })
|
|
205
215
|
], ObcReadoutBlock.prototype, "value", 2);
|
|
216
|
+
__decorateClass([
|
|
217
|
+
property({ type: String })
|
|
218
|
+
], ObcReadoutBlock.prototype, "valueType", 2);
|
|
206
219
|
__decorateClass([
|
|
207
220
|
property({ type: String })
|
|
208
221
|
], ObcReadoutBlock.prototype, "size", 2);
|
|
@@ -268,6 +281,7 @@ export {
|
|
|
268
281
|
ReadoutBlockDataQuality,
|
|
269
282
|
ReadoutBlockHidePhase,
|
|
270
283
|
ReadoutBlockSize,
|
|
271
|
-
ReadoutBlockVariant
|
|
284
|
+
ReadoutBlockVariant,
|
|
285
|
+
ReadoutValueType
|
|
272
286
|
};
|
|
273
287
|
//# sourceMappingURL=readout-block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readout-block.js","sources":["../../../src/building-blocks/readout-block/readout-block.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS, type TemplateResult} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './readout-block.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../../components/textbox/textbox.js';\nimport {\n ObcTextboxSize,\n ObcTextboxFontWeight,\n ObcTextboxAlignment,\n} from '../../components/textbox/textbox.js';\nimport '../../icons/icon-input-right.js';\nimport '../../icons/icon-notification-advice.js';\nimport {\n formatNumericValue,\n readoutFormattedInteger,\n type ReadoutNumericFormatOptions,\n} from '../../navigation-instruments/readout/readout-formatters.js';\nimport {\n type AlertFrameConfig,\n wrapWithAlertFrame,\n} from '../../components/alert-frame/alert-frame.js';\n\n// Re-exported so consumers can configure typography without a second import path.\nexport {\n ObcTextboxSize,\n ObcTextboxFontWeight,\n ObcTextboxAlignment,\n} from '../../components/textbox/textbox.js';\n\n/**\n * Semantic variant of the block. Drives the default marker icon and the\n * colour token; the layout is identical across variants.\n * - `value`: the primary reading (no default marker icon).\n * - `setpoint`: a setpoint reference (default `input-right` marker).\n * - `advice`: an advisory reference (default `notification-advice` marker).\n */\nexport enum ReadoutBlockVariant {\n value = 'value',\n setpoint = 'setpoint',\n advice = 'advice',\n}\n\n/**\n * Density tier of the block — drives icon size, the icon↔number gap, and the\n * degree-column width tier. The number typography size is controlled\n * independently via {@link ObcReadoutBlock.valueSize} so a parent can de-emphasise\n * one block relative to another within the same tier.\n */\nexport enum ReadoutBlockSize {\n small = 'small',\n medium = 'medium',\n large = 'large',\n}\n\n/**\n * Per-block measurement quality, rendered as a non-shifting outline chip.\n * - `low-integrity`: the value is suspect.\n * - `invalid`: the value is invalid.\n */\nexport enum ReadoutBlockDataQuality {\n lowIntegrity = 'low-integrity',\n invalid = 'invalid',\n}\n\n/**\n * Pop-up fade phase for a setpoint block. Driven by the parent's setpoint\n * interaction state machine; only meaningful for `role=\"setpoint\"`.\n */\nexport enum ReadoutBlockHidePhase {\n none = 'none',\n hiding = 'hiding',\n hidden = 'hidden',\n}\n\n/**\n * `<obc-readout-block>` – the most atomic readout primitive: a single\n * cap-height-aligned, width-reservable numeric segment (value / setpoint /\n * advice).\n *\n * It renders one `obc-textbox` number with optional hinted leading zeros, a\n * reservable width, an optional leading marker icon (via the `icon` slot or the\n * role default), an optional trailing degree glyph, an `off`/unavailable text\n * state, per-block data-quality and an optional per-block alert frame.\n *\n * This is a building block used inside `obc-readout-list-item` (and, in a future\n * refactor, inside `obc-readout`); it is not normally used on its own. Colour is\n * inherited from the host context (the parent sets the role colour), so the\n * block stays neutral until placed.\n *\n * @experimental Pilot for the new primitives + per-block options Readout API; the\n * API may change in a future release.\n *\n * @slot icon - Replaces the role's default marker icon.\n *\n * @csspart block - The block container (carries role / tone / data-quality).\n * @csspart block-content - The number + degree group.\n * @csspart block-text - The `obc-textbox` rendering the number.\n * @csspart block-icon - The leading marker-icon container.\n * @csspart degree - The trailing degree-glyph column.\n */\n@customElement('obc-readout-block')\nexport class ObcReadoutBlock extends LitElement {\n /** Semantic variant (value / setpoint / advice). */\n @property({type: String}) variant: ReadoutBlockVariant =\n ReadoutBlockVariant.value;\n\n /** The numeric value; `null`/`undefined` renders a dash. */\n @property({type: Number}) value: number | null = null;\n\n /** Density tier — icon size, gap, degree tier. */\n @property({type: String}) size: ReadoutBlockSize = ReadoutBlockSize.small;\n\n /**\n * Resolved number-typography size. When unset it is derived from `size`\n * (small→s, medium→m, large→l), so a parent that de-emphasises a block (e.g.\n * a secondary setpoint) can pass a smaller size without changing the tier.\n */\n @property({type: String}) valueSize?: ObcTextboxSize;\n\n /** Accent (in-command) colour tone. */\n @property({type: Boolean}) enhanced = false;\n\n /** Number font weight (regular / semibold / bold); colour is independent. */\n @property({type: String}) weight: ObcTextboxFontWeight =\n ObcTextboxFontWeight.regular;\n\n /** Render the trailing cap-height degree glyph (`°`). */\n @property({type: Boolean}) hasDegree = false;\n\n /** Show the leading marker-icon container (always on for setpoint/advice). */\n @property({type: Boolean}) hasIcon = false;\n\n /** Number of fraction digits. */\n @property({type: Number}) fractionDigits = 0;\n\n /** Integer digits to reserve / hint (independent of `fractionDigits`). */\n @property({type: Number}) maxDigits = 0;\n\n /** Render muted leading zeros filling the integer part to `maxDigits`. */\n @property({type: Boolean}) hintedZeros = false;\n\n /** Explicit longest string to reserve width for (e.g. `\"0000.0\"`). */\n @property({type: String}) spaceReserver?: string;\n\n /** Render `offText` instead of a number (e.g. equipment powered down). */\n @property({type: Boolean}) off = false;\n\n /** Text shown when `off` is true. */\n @property({type: String}) offText = 'OFF';\n\n /** Text alignment of the number within its reserved width. */\n @property({type: String}) alignment: ObcTextboxAlignment =\n ObcTextboxAlignment.Right;\n\n /** Per-block measurement quality (outline chip). */\n @property({type: String}) dataQuality?: ReadoutBlockDataQuality;\n\n // `boolean | …` (not `false | …`): the generated Angular wrapper widens a\n // literal-`false` union to `boolean`. `wrapWithAlertFrame` treats any\n // non-object as \"no frame\", so accepting `boolean` is harmless.\n /** Per-block alert frame; nests inside any parent alert frame. */\n @property({type: Object}) alert: boolean | AlertFrameConfig = false;\n\n /** Setpoint focus (touch) state — only meaningful for `role=\"setpoint\"`. */\n @property({type: Boolean}) touching = false;\n\n /** Setpoint pop-up fade phase — only meaningful for `role=\"setpoint\"`. */\n @property({type: String}) hidePhase: ReadoutBlockHidePhase =\n ReadoutBlockHidePhase.none;\n\n @state() private hasAssignedIcon = false;\n\n private get resolvedValueSize(): ObcTextboxSize {\n if (this.valueSize) {\n return this.valueSize;\n }\n switch (this.size) {\n case ReadoutBlockSize.large:\n return ObcTextboxSize.l;\n case ReadoutBlockSize.medium:\n return ObcTextboxSize.m;\n default:\n return ObcTextboxSize.s;\n }\n }\n\n private get numericFormatOptions(): ReadoutNumericFormatOptions {\n return {\n showZeroPadding: false,\n minValueLength: this.maxDigits,\n fractionDigits: this.fractionDigits,\n };\n }\n\n /** Widest possible value string for width reservation (e.g. `\"000.0\"`). */\n private get reserverText(): string {\n const maxDigits = this.maxDigits;\n if (maxDigits <= 0) {\n return '';\n }\n const integer = '0'.repeat(Math.max(maxDigits, 1));\n return this.fractionDigits > 0\n ? `${integer}.${'0'.repeat(this.fractionDigits)}`\n : integer;\n }\n\n /**\n * Effective width reserver: the wider of the explicit `spaceReserver` and the\n * `maxDigits`/`fractionDigits`-derived reserve, so an explicit reserver can\n * never reserve *less* than the formatted value needs. Under tabular-nums the\n * rendered width is proportional to character count, so \"wider\" compares length.\n */\n private widerReserver(explicit: string | undefined, derived: string): string {\n if (!explicit) {\n return derived;\n }\n if (!derived) {\n return explicit;\n }\n return explicit.length >= derived.length ? explicit : derived;\n }\n\n private dataQualityClasses(): Record<string, boolean> {\n return {\n 'data-low-integrity':\n this.dataQuality === ReadoutBlockDataQuality.lowIntegrity,\n 'data-invalid': this.dataQuality === ReadoutBlockDataQuality.invalid,\n };\n }\n\n private onIconSlotChange = (event: Event): void => {\n // `slotchange` fires after the first render once content is (re)assigned,\n // so it covers the initial state without a firstUpdated re-render.\n this.hasAssignedIcon =\n (event.target as HTMLSlotElement).assignedElements({flatten: true})\n .length > 0;\n };\n\n private renderIcon(): TemplateResult | typeof nothing {\n // Value blocks only show an icon when asked; setpoint/advice always reserve\n // their marker. The role default is rendered as a direct child (so it sizes\n // via `.block-icon obi-*`) and hidden once an icon is assigned to the slot —\n // `{flatten: true}` sees through a forwarded-but-empty parent slot, so the\n // default still shows when the consumer overrides nothing.\n const showIcon = this.variant !== ReadoutBlockVariant.value || this.hasIcon;\n if (!showIcon) {\n return nothing;\n }\n let fallback: TemplateResult | typeof nothing = nothing;\n if (this.variant === ReadoutBlockVariant.setpoint) {\n fallback = html`<obi-input-right></obi-input-right>`;\n } else if (this.variant === ReadoutBlockVariant.advice) {\n fallback = html`<obi-notification-advice></obi-notification-advice>`;\n }\n return html`<span class=\"block-icon\" part=\"block-icon\" aria-hidden=\"true\">\n <slot name=\"icon\" @slotchange=${this.onIconSlotChange}></slot>\n ${this.hasAssignedIcon ? nothing : fallback}\n </span>`;\n }\n\n /**\n * A cap-height `°` column whose width scales with the number size. Inherits the\n * block's colour.\n */\n private renderDegreeGlyph(size: ObcTextboxSize): TemplateResult {\n return html`\n <span\n class=${classMap({\n 'degree-column': true,\n [`degree-${size}`]: true,\n 'degree-inherit': true,\n })}\n part=\"degree\"\n >\n <obc-textbox class=\"degree-glyph\" .size=${size} alignment=\"center\"\n >°</obc-textbox\n >\n </span>\n `;\n }\n\n override render() {\n const valueSize = this.resolvedValueSize;\n const formatOptions = this.numericFormatOptions;\n const valueForFormat = this.value ?? undefined;\n const text = this.off\n ? this.offText\n : formatNumericValue(valueForFormat, formatOptions);\n // Hinted zeros pad the INTEGER part up to `maxDigits`, independent of\n // `fractionDigits` (the decimal point and fraction digits never count toward\n // `maxDigits`). Negative / dashed values are not padded. Example: value 1.2,\n // maxDigits 3, fractionDigits 1 → \"001.2\".\n const hintCount =\n this.off ||\n !this.hintedZeros ||\n valueForFormat === undefined ||\n valueForFormat < 0\n ? 0\n : Math.max(this.maxDigits - readoutFormattedInteger(text), 0);\n const hinted = hintCount > 0 ? '0'.repeat(hintCount) : '';\n // Hinted zeros own the width — they already fill to `maxDigits` — so when\n // `hintedZeros` is enabled an explicit `spaceReserver` is ignored (it has\n // higher priority). Otherwise the wider of the explicit reserver and the\n // `maxDigits`-derived reserve wins.\n const reserver = this.hintedZeros\n ? this.reserverText\n : this.widerReserver(this.spaceReserver, this.reserverText);\n\n const block = html`\n <div\n class=${classMap({\n block: true,\n [`block-${this.variant}`]: true,\n [`size-${this.size}`]: true,\n 'tone-enhanced': this.enhanced,\n touching: this.touching,\n 'is-hiding': this.hidePhase === ReadoutBlockHidePhase.hiding,\n 'is-hidden': this.hidePhase === ReadoutBlockHidePhase.hidden,\n ...this.dataQualityClasses(),\n })}\n part=\"block block-${this.variant}\"\n >\n ${this.renderIcon()}\n <span class=\"block-content\" part=\"block-content\">\n <obc-textbox\n class=\"block-text\"\n part=\"block-text\"\n .size=${valueSize}\n .fontWeight=${this.weight}\n .alignment=${this.alignment}\n .tabularNums=${true}\n >\n ${hinted\n ? html`<span class=\"hinted-zero\" aria-hidden=\"true\"\n >${hinted}</span\n >`\n : nothing}${text}\n ${reserver ? html`<span slot=\"length\">${reserver}</span>` : nothing}\n </obc-textbox>\n ${this.hasDegree ? this.renderDegreeGlyph(valueSize) : nothing}\n </span>\n </div>\n `;\n return wrapWithAlertFrame(this.alert ?? false, block);\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-readout-block': ObcReadoutBlock;\n }\n}\n"],"names":["ReadoutBlockVariant","Re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,GAnCb,gBAmCe,WAAA,aAAA,CAAA;AAGC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAtCd,gBAsCgB,WAAA,eAAA,CAAA;AAGD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAzCb,gBAyCe,WAAA,iBAAA,CAAA;AAGC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA5Cd,gBA4CgB,WAAA,OAAA,CAAA;AAGD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA/Cb,gBA+Ce,WAAA,WAAA,CAAA;AAGA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAlDb,gBAkDe,WAAA,aAAA,CAAA;AAIA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAtDb,gBAsDe,WAAA,eAAA,CAAA;AAMA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GA5Db,gBA4De,WAAA,SAAA,CAAA;AAGC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GA/Dd,gBA+DgB,WAAA,YAAA,CAAA;AAGD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAlEb,gBAkEe,WAAA,aAAA,CAAA;AAGT,gBAAA;AAAA,EAAhB,MAAA;AAAM,GArEI,gBAqEM,WAAA,mBAAA,CAAA;AArEN,kBAAN,gBAAA;AAAA,EADN,cAAc,mBAAmB;AAAA,GACrB,eAAA;"}
|
|
1
|
+
{"version":3,"file":"readout-block.js","sources":["../../../src/building-blocks/readout-block/readout-block.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS, type TemplateResult} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './readout-block.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../../components/textbox/textbox.js';\nimport {\n ObcTextboxSize,\n ObcTextboxFontWeight,\n ObcTextboxAlignment,\n} from '../../components/textbox/textbox.js';\nimport '../../icons/icon-input-right.js';\nimport '../../icons/icon-notification-advice.js';\nimport {\n formatNumericValue,\n readoutFormattedInteger,\n assertReadoutValueType,\n resolveReadoutNumericValue,\n resolveReadoutTextValue,\n ReadoutValueType,\n type ReadoutNumericFormatOptions,\n} from '../../navigation-instruments/readout/readout-formatters.js';\nimport {\n type AlertFrameConfig,\n wrapWithAlertFrame,\n} from '../../components/alert-frame/alert-frame.js';\n\n// Re-exported so consumers can configure typography without a second import path.\nexport {\n ObcTextboxSize,\n ObcTextboxFontWeight,\n ObcTextboxAlignment,\n} from '../../components/textbox/textbox.js';\nexport {ReadoutValueType} from '../../navigation-instruments/readout/readout-formatters.js';\n\n/**\n * Semantic variant of the block. Drives the default marker icon and the\n * colour token; the layout is identical across variants.\n * - `value`: the primary reading (no default marker icon).\n * - `setpoint`: a setpoint reference (default `input-right` marker).\n * - `advice`: an advisory reference (default `notification-advice` marker).\n */\nexport enum ReadoutBlockVariant {\n value = 'value',\n setpoint = 'setpoint',\n advice = 'advice',\n}\n\n/**\n * Density tier of the block — drives icon size, the icon↔number gap, and the\n * degree-column width tier. The number typography size is controlled\n * independently via {@link ObcReadoutBlock.valueSize} so a parent can de-emphasise\n * one block relative to another within the same tier.\n */\nexport enum ReadoutBlockSize {\n small = 'small',\n medium = 'medium',\n large = 'large',\n}\n\n/**\n * Per-block measurement quality, rendered as a non-shifting outline chip.\n * - `low-integrity`: the value is suspect.\n * - `invalid`: the value is invalid.\n */\nexport enum ReadoutBlockDataQuality {\n lowIntegrity = 'low-integrity',\n invalid = 'invalid',\n}\n\n/**\n * Pop-up fade phase for a setpoint block. Driven by the parent's setpoint\n * interaction state machine; only meaningful for `role=\"setpoint\"`.\n */\nexport enum ReadoutBlockHidePhase {\n none = 'none',\n hiding = 'hiding',\n hidden = 'hidden',\n}\n\n/**\n * `<obc-readout-block>` – the most atomic readout primitive: a single\n * cap-height-aligned, width-reservable numeric segment (value / setpoint /\n * advice).\n *\n * It renders one `obc-textbox` number with optional hinted leading zeros, a\n * reservable width, an optional leading marker icon (via the `icon` slot or the\n * role default), an optional trailing degree glyph, an `off`/unavailable text\n * state, per-block data-quality and an optional per-block alert frame.\n *\n * Setting `valueType` to `text` renders `value` verbatim (e.g.\n * `\"Auto\"`) instead of a formatted number.\n *\n * This is a building block used inside `obc-readout-list-item` (and, in a future\n * refactor, inside `obc-readout`); it is not normally used on its own. Colour is\n * inherited from the host context (the parent sets the role colour), so the\n * block stays neutral until placed.\n *\n * @experimental Pilot for the new primitives + per-block options Readout API; the\n * API may change in a future release.\n *\n * @slot icon - Replaces the role's default marker icon.\n *\n * @csspart block - The block container (carries role / tone / data-quality).\n * @csspart block-content - The number + degree group.\n * @csspart block-text - The `obc-textbox` rendering the number.\n * @csspart block-icon - The leading marker-icon container.\n * @csspart degree - The trailing degree-glyph column.\n */\n@customElement('obc-readout-block')\nexport class ObcReadoutBlock extends LitElement {\n /** Semantic variant (value / setpoint / advice). */\n @property({type: String}) variant: ReadoutBlockVariant =\n ReadoutBlockVariant.value;\n\n /**\n * The value; `null`/`undefined` renders a dash. A number by default, or text\n * when {@link valueType} is `text`.\n */\n @property({type: String}) value: number | string | null = null;\n\n /**\n * How {@link value} is interpreted. `number` (default) formats it via\n * `fractionDigits`; `text` renders it verbatim and ignores the numeric\n * format options. Passing text while this is `number` throws.\n */\n @property({type: String}) valueType: ReadoutValueType =\n ReadoutValueType.number;\n\n /** Density tier — icon size, gap, degree tier. */\n @property({type: String}) size: ReadoutBlockSize = ReadoutBlockSize.small;\n\n /**\n * Resolved number-typography size. When unset it is derived from `size`\n * (small→s, medium→m, large→l), so a parent that de-emphasises a block (e.g.\n * a secondary setpoint) can pass a smaller size without changing the tier.\n */\n @property({type: String}) valueSize?: ObcTextboxSize;\n\n /** Accent (in-command) colour tone. */\n @property({type: Boolean}) enhanced = false;\n\n /** Number font weight (regular / semibold / bold); colour is independent. */\n @property({type: String}) weight: ObcTextboxFontWeight =\n ObcTextboxFontWeight.regular;\n\n /** Render the trailing cap-height degree glyph (`°`). */\n @property({type: Boolean}) hasDegree = false;\n\n /** Show the leading marker-icon container (always on for setpoint/advice). */\n @property({type: Boolean}) hasIcon = false;\n\n /**\n * Number of fraction digits.\n * @availableWhen valueType==number\n */\n @property({type: Number}) fractionDigits = 0;\n\n /**\n * Integer digits to reserve / hint (independent of `fractionDigits`).\n * @availableWhen valueType==number\n */\n @property({type: Number}) maxDigits = 0;\n\n /**\n * Render muted leading zeros filling the integer part to `maxDigits`.\n * @availableWhen valueType==number\n */\n @property({type: Boolean}) hintedZeros = false;\n\n /** Explicit longest string to reserve width for (e.g. `\"0000.0\"`). */\n @property({type: String}) spaceReserver?: string;\n\n /** Render `offText` instead of a number (e.g. equipment powered down). */\n @property({type: Boolean}) off = false;\n\n /** Text shown when `off` is true. */\n @property({type: String}) offText = 'OFF';\n\n /** Text alignment of the number within its reserved width. */\n @property({type: String}) alignment: ObcTextboxAlignment =\n ObcTextboxAlignment.Right;\n\n /** Per-block measurement quality (outline chip). */\n @property({type: String}) dataQuality?: ReadoutBlockDataQuality;\n\n // `boolean | …` (not `false | …`): the generated Angular wrapper widens a\n // literal-`false` union to `boolean`. `wrapWithAlertFrame` treats any\n // non-object as \"no frame\", so accepting `boolean` is harmless.\n /** Per-block alert frame; nests inside any parent alert frame. */\n @property({type: Object}) alert: boolean | AlertFrameConfig = false;\n\n /** Setpoint focus (touch) state — only meaningful for `role=\"setpoint\"`. */\n @property({type: Boolean}) touching = false;\n\n /** Setpoint pop-up fade phase — only meaningful for `role=\"setpoint\"`. */\n @property({type: String}) hidePhase: ReadoutBlockHidePhase =\n ReadoutBlockHidePhase.none;\n\n @state() private hasAssignedIcon = false;\n\n private get resolvedValueSize(): ObcTextboxSize {\n if (this.valueSize) {\n return this.valueSize;\n }\n switch (this.size) {\n case ReadoutBlockSize.large:\n return ObcTextboxSize.l;\n case ReadoutBlockSize.medium:\n return ObcTextboxSize.m;\n default:\n return ObcTextboxSize.s;\n }\n }\n\n private get numericFormatOptions(): ReadoutNumericFormatOptions {\n return {\n showZeroPadding: false,\n minValueLength: this.maxDigits,\n fractionDigits: this.fractionDigits,\n };\n }\n\n /** Widest possible value string for width reservation (e.g. `\"000.0\"`). */\n private get reserverText(): string {\n const maxDigits = this.maxDigits;\n if (maxDigits <= 0) {\n return '';\n }\n const integer = '0'.repeat(Math.max(maxDigits, 1));\n return this.fractionDigits > 0\n ? `${integer}.${'0'.repeat(this.fractionDigits)}`\n : integer;\n }\n\n /**\n * Effective width reserver: the wider of the explicit `spaceReserver` and the\n * `maxDigits`/`fractionDigits`-derived reserve, so an explicit reserver can\n * never reserve *less* than the formatted value needs. Under tabular-nums the\n * rendered width is proportional to character count, so \"wider\" compares length.\n */\n private widerReserver(explicit: string | undefined, derived: string): string {\n if (!explicit) {\n return derived;\n }\n if (!derived) {\n return explicit;\n }\n return explicit.length >= derived.length ? explicit : derived;\n }\n\n private dataQualityClasses(): Record<string, boolean> {\n return {\n 'data-low-integrity':\n this.dataQuality === ReadoutBlockDataQuality.lowIntegrity,\n 'data-invalid': this.dataQuality === ReadoutBlockDataQuality.invalid,\n };\n }\n\n private onIconSlotChange = (event: Event): void => {\n // `slotchange` fires after the first render once content is (re)assigned,\n // so it covers the initial state without a firstUpdated re-render.\n this.hasAssignedIcon =\n (event.target as HTMLSlotElement).assignedElements({flatten: true})\n .length > 0;\n };\n\n private renderIcon(): TemplateResult | typeof nothing {\n // Value blocks only show an icon when asked; setpoint/advice always reserve\n // their marker. The role default is rendered as a direct child (so it sizes\n // via `.block-icon obi-*`) and hidden once an icon is assigned to the slot —\n // `{flatten: true}` sees through a forwarded-but-empty parent slot, so the\n // default still shows when the consumer overrides nothing.\n const showIcon = this.variant !== ReadoutBlockVariant.value || this.hasIcon;\n if (!showIcon) {\n return nothing;\n }\n let fallback: TemplateResult | typeof nothing = nothing;\n if (this.variant === ReadoutBlockVariant.setpoint) {\n fallback = html`<obi-input-right></obi-input-right>`;\n } else if (this.variant === ReadoutBlockVariant.advice) {\n fallback = html`<obi-notification-advice></obi-notification-advice>`;\n }\n return html`<span class=\"block-icon\" part=\"block-icon\" aria-hidden=\"true\">\n <slot name=\"icon\" @slotchange=${this.onIconSlotChange}></slot>\n ${this.hasAssignedIcon ? nothing : fallback}\n </span>`;\n }\n\n /**\n * A cap-height `°` column whose width scales with the number size. Inherits the\n * block's colour.\n */\n private renderDegreeGlyph(size: ObcTextboxSize): TemplateResult {\n return html`\n <span\n class=${classMap({\n 'degree-column': true,\n [`degree-${size}`]: true,\n 'degree-inherit': true,\n })}\n part=\"degree\"\n >\n <obc-textbox class=\"degree-glyph\" .size=${size} alignment=\"center\"\n >°</obc-textbox\n >\n </span>\n `;\n }\n\n protected override willUpdate(changed: Map<string, unknown>): void {\n super.willUpdate(changed);\n // Validated on EVERY update, deliberately NOT gated on `value`/`valueType`\n // appearing in `changed`. When this assertion throws, Lit's `performUpdate`\n // catch calls `__markUpdated()`, which clears the changed-properties map. A\n // later update driven by any OTHER property — inside `obc-readout-list`,\n // `align()` writing the shared reservers — would then see no `value` in\n // `changed`, skip the check, and render the invalid value as a plain dash:\n // exactly the silent failure this assertion exists to prevent.\n assertReadoutValueType('obc-readout-block', this.value, this.valueType);\n }\n\n override render() {\n const valueSize = this.resolvedValueSize;\n const formatOptions = this.numericFormatOptions;\n const isTextMode = this.valueType === ReadoutValueType.text;\n const valueForFormat = resolveReadoutNumericValue(\n this.value,\n this.valueType\n );\n const textValue = resolveReadoutTextValue(this.value, this.valueType);\n // Text mode renders verbatim and ignores the numeric format options; a\n // blank / missing text value still falls back to the unavailable dash.\n const text = this.off\n ? this.offText\n : isTextMode\n ? (textValue ?? '-')\n : formatNumericValue(valueForFormat, formatOptions);\n // Hinted zeros pad the INTEGER part up to `maxDigits`, independent of\n // `fractionDigits` (the decimal point and fraction digits never count toward\n // `maxDigits`). Negative / dashed values are not padded. Example: value 1.2,\n // maxDigits 3, fractionDigits 1 → \"001.2\".\n const hintCount =\n this.off ||\n isTextMode ||\n !this.hintedZeros ||\n valueForFormat === undefined ||\n valueForFormat < 0\n ? 0\n : Math.max(this.maxDigits - readoutFormattedInteger(text), 0);\n const hinted = hintCount > 0 ? '0'.repeat(hintCount) : '';\n // Hinted zeros own the width — they already fill to `maxDigits` — so when\n // `hintedZeros` is enabled an explicit `spaceReserver` is ignored (it has\n // higher priority). Otherwise the wider of the explicit reserver and the\n // `maxDigits`-derived reserve wins.\n // Text mode ignores the `maxDigits`-derived numeric reserve — only an\n // explicit `spaceReserver` still applies.\n const reserver = isTextMode\n ? (this.spaceReserver ?? '')\n : this.hintedZeros\n ? this.reserverText\n : this.widerReserver(this.spaceReserver, this.reserverText);\n\n const block = html`\n <div\n class=${classMap({\n block: true,\n [`block-${this.variant}`]: true,\n [`size-${this.size}`]: true,\n 'tone-enhanced': this.enhanced,\n touching: this.touching,\n 'is-hiding': this.hidePhase === ReadoutBlockHidePhase.hiding,\n 'is-hidden': this.hidePhase === ReadoutBlockHidePhase.hidden,\n ...this.dataQualityClasses(),\n })}\n part=\"block block-${this.variant}\"\n >\n ${this.renderIcon()}\n <span class=\"block-content\" part=\"block-content\">\n <obc-textbox\n class=\"block-text\"\n part=\"block-text\"\n .size=${valueSize}\n .fontWeight=${this.weight}\n .alignment=${this.alignment}\n .tabularNums=${true}\n >\n ${hinted\n ? html`<span class=\"hinted-zero\" aria-hidden=\"true\"\n >${hinted}</span\n >`\n : nothing}${text}\n ${reserver ? html`<span slot=\"length\">${reserver}</span>` : nothing}\n </obc-textbox>\n ${this.hasDegree ? this.renderDegreeGlyph(valueSize) : nothing}\n </span>\n </div>\n `;\n return wrapWithAlertFrame(this.alert ?? false, block);\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-readout-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AA,GAnFd,gBAmFgB,WAAA,YAAA,CAAA;AAGD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAtFb,gBAsFe,WAAA,aAAA,CAAA;AAGT,gBAAA;AAAA,EAAhB,MAAA;AAAM,GAzFI,gBAyFM,WAAA,mBAAA,CAAA;AAzFN,kBAAN,gBAAA;AAAA,EADN,cAAc,mBAAmB;AAAA,GACrB,eAAA;"}
|
|
@@ -3,6 +3,37 @@ export type ReadoutNumericFormatOptions = {
|
|
|
3
3
|
minValueLength: number;
|
|
4
4
|
fractionDigits: number;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* How a readout's `value` is interpreted.
|
|
8
|
+
* - `number`: formatted via `fractionDigits` / `maxDigits`.
|
|
9
|
+
* - `text`: rendered verbatim, with the numeric format options ignored.
|
|
10
|
+
*/
|
|
11
|
+
export declare enum ReadoutValueType {
|
|
12
|
+
number = "number",
|
|
13
|
+
text = "text"
|
|
14
|
+
}
|
|
15
|
+
/** Whether `value` is one of the supported {@link ReadoutValueType} values. */
|
|
16
|
+
export declare function isReadoutValueType(value: unknown): value is ReadoutValueType;
|
|
17
|
+
/**
|
|
18
|
+
* Throws when `valueType` is not a supported value, or when `value` is text but
|
|
19
|
+
* `valueType` is `number`.
|
|
20
|
+
*
|
|
21
|
+
* `valueType` is validated first because an attribute carries an unchecked
|
|
22
|
+
* string: a typo such as `valuetype="strng"` matches neither mode, so every
|
|
23
|
+
* mode check falls through and the readout silently renders the unavailable
|
|
24
|
+
* dash — the opposite of the loud failure this contract exists to give.
|
|
25
|
+
* `undefined`/`null` are allowed and mean "use the default".
|
|
26
|
+
*
|
|
27
|
+
* Attributes are always strings, so a numeric-looking string (`value="10.12"`)
|
|
28
|
+
* is accepted and parsed. Blank strings resolve to the unavailable dash rather
|
|
29
|
+
* than throwing — `value="${maybeUndefined}"` is a common template shape, and
|
|
30
|
+
* `Number('')` is `0`, a silently wrong reading.
|
|
31
|
+
*/
|
|
32
|
+
export declare function assertReadoutValueType(tagName: string, value: number | string | null | undefined, valueType: ReadoutValueType): void;
|
|
33
|
+
/** The value as a number, or `undefined` when it is text / unavailable. */
|
|
34
|
+
export declare function resolveReadoutNumericValue(value: number | string | null | undefined, valueType: ReadoutValueType): number | undefined;
|
|
35
|
+
/** The value as display text, or `undefined` when not in text mode / blank. */
|
|
36
|
+
export declare function resolveReadoutTextValue(value: number | string | null | undefined, valueType: ReadoutValueType): string | undefined;
|
|
6
37
|
export declare function formatNumericValue(value: number | undefined, options: ReadoutNumericFormatOptions): string;
|
|
7
38
|
export declare function readoutFormattedInteger(valueText: string): number;
|
|
8
39
|
export declare function getHintZeros(value: number | undefined, { showZeroPadding, minValueLength, fractionDigits }: ReadoutNumericFormatOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readout-formatters.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/readout/readout-formatters.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;IACxC,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"readout-formatters.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/readout/readout-formatters.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;IACxC,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAID,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,SAAS,EAAE,gBAAgB,GAC1B,IAAI,CAyBN;AAED,2EAA2E;AAC3E,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,SAAS,EAAE,gBAAgB,GAC1B,MAAM,GAAG,SAAS,CAgBpB;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,SAAS,EAAE,gBAAgB,GAC1B,MAAM,GAAG,SAAS,CAUpB;AAoBD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,OAAO,EAAE,2BAA2B,GACnC,MAAM,CAMR;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CASjE;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,EAAC,eAAe,EAAE,cAAc,EAAE,cAAc,EAAC,EAAE,2BAA2B,GAC7E,MAAM,CAeR"}
|