@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
|
@@ -57248,6 +57248,55 @@ __decorateClass$v_([
|
|
|
57248
57248
|
ObiNotificationAdvice = __decorateClass$v_([
|
|
57249
57249
|
customElement("obi-notification-advice")
|
|
57250
57250
|
], ObiNotificationAdvice);
|
|
57251
|
+
var ReadoutValueType = /* @__PURE__ */ ((ReadoutValueType2) => {
|
|
57252
|
+
ReadoutValueType2["number"] = "number";
|
|
57253
|
+
ReadoutValueType2["text"] = "text";
|
|
57254
|
+
return ReadoutValueType2;
|
|
57255
|
+
})(ReadoutValueType || {});
|
|
57256
|
+
const READOUT_VALUE_TYPES = Object.values(ReadoutValueType);
|
|
57257
|
+
function isReadoutValueType(value) {
|
|
57258
|
+
return typeof value === "string" && READOUT_VALUE_TYPES.includes(value);
|
|
57259
|
+
}
|
|
57260
|
+
function isBlank(value) {
|
|
57261
|
+
return value.trim() === "";
|
|
57262
|
+
}
|
|
57263
|
+
function assertReadoutValueType(tagName, value, valueType) {
|
|
57264
|
+
const resolved = valueType ?? "number";
|
|
57265
|
+
if (!isReadoutValueType(resolved)) {
|
|
57266
|
+
throw new TypeError(
|
|
57267
|
+
`<${tagName}>: valueType must be ${READOUT_VALUE_TYPES.map((t2) => `"${t2}"`).join(" or ")} (got ${JSON.stringify(valueType)}).`
|
|
57268
|
+
);
|
|
57269
|
+
}
|
|
57270
|
+
if (resolved !== "number" || typeof value !== "string" || isBlank(value)) {
|
|
57271
|
+
return;
|
|
57272
|
+
}
|
|
57273
|
+
if (Number.isFinite(Number(value))) {
|
|
57274
|
+
return;
|
|
57275
|
+
}
|
|
57276
|
+
throw new TypeError(
|
|
57277
|
+
`<${tagName}>: value must be a number when valueType is "number" (got ${JSON.stringify(value)}). Set valueType="text" to render text.`
|
|
57278
|
+
);
|
|
57279
|
+
}
|
|
57280
|
+
function resolveReadoutNumericValue(value, valueType) {
|
|
57281
|
+
if (valueType === "text" || value === null || value === void 0) {
|
|
57282
|
+
return void 0;
|
|
57283
|
+
}
|
|
57284
|
+
if (typeof value === "number") {
|
|
57285
|
+
return value;
|
|
57286
|
+
}
|
|
57287
|
+
if (isBlank(value)) {
|
|
57288
|
+
return void 0;
|
|
57289
|
+
}
|
|
57290
|
+
const parsed = Number(value);
|
|
57291
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
57292
|
+
}
|
|
57293
|
+
function resolveReadoutTextValue(value, valueType) {
|
|
57294
|
+
if (valueType !== "text" || value === null || value === void 0) {
|
|
57295
|
+
return void 0;
|
|
57296
|
+
}
|
|
57297
|
+
const text = typeof value === "number" ? String(value) : value;
|
|
57298
|
+
return isBlank(text) ? void 0 : text;
|
|
57299
|
+
}
|
|
57251
57300
|
function dashedGenerator({
|
|
57252
57301
|
showZeroPadding,
|
|
57253
57302
|
minValueLength,
|
|
@@ -57313,6 +57362,7 @@ let ObcReadoutBlock = class extends i$4 {
|
|
|
57313
57362
|
super(...arguments);
|
|
57314
57363
|
this.variant = "value";
|
|
57315
57364
|
this.value = null;
|
|
57365
|
+
this.valueType = ReadoutValueType.number;
|
|
57316
57366
|
this.size = "small";
|
|
57317
57367
|
this.enhanced = false;
|
|
57318
57368
|
this.weight = ObcTextboxFontWeight.regular;
|
|
@@ -57419,14 +57469,23 @@ let ObcReadoutBlock = class extends i$4 {
|
|
|
57419
57469
|
</span>
|
|
57420
57470
|
`;
|
|
57421
57471
|
}
|
|
57472
|
+
willUpdate(changed) {
|
|
57473
|
+
super.willUpdate(changed);
|
|
57474
|
+
assertReadoutValueType("obc-readout-block", this.value, this.valueType);
|
|
57475
|
+
}
|
|
57422
57476
|
render() {
|
|
57423
57477
|
const valueSize = this.resolvedValueSize;
|
|
57424
57478
|
const formatOptions = this.numericFormatOptions;
|
|
57425
|
-
const
|
|
57426
|
-
const
|
|
57427
|
-
|
|
57479
|
+
const isTextMode = this.valueType === ReadoutValueType.text;
|
|
57480
|
+
const valueForFormat = resolveReadoutNumericValue(
|
|
57481
|
+
this.value,
|
|
57482
|
+
this.valueType
|
|
57483
|
+
);
|
|
57484
|
+
const textValue = resolveReadoutTextValue(this.value, this.valueType);
|
|
57485
|
+
const text = this.off ? this.offText : isTextMode ? textValue ?? "-" : formatNumericValue(valueForFormat, formatOptions);
|
|
57486
|
+
const hintCount = this.off || isTextMode || !this.hintedZeros || valueForFormat === void 0 || valueForFormat < 0 ? 0 : Math.max(this.maxDigits - readoutFormattedInteger(text), 0);
|
|
57428
57487
|
const hinted = hintCount > 0 ? "0".repeat(hintCount) : "";
|
|
57429
|
-
const reserver = this.hintedZeros ? this.reserverText : this.widerReserver(this.spaceReserver, this.reserverText);
|
|
57488
|
+
const reserver = isTextMode ? this.spaceReserver ?? "" : this.hintedZeros ? this.reserverText : this.widerReserver(this.spaceReserver, this.reserverText);
|
|
57430
57489
|
const block = b`
|
|
57431
57490
|
<div
|
|
57432
57491
|
class=${e$1({
|
|
@@ -57468,8 +57527,11 @@ __decorateClass$vZ([
|
|
|
57468
57527
|
n$3({ type: String })
|
|
57469
57528
|
], ObcReadoutBlock.prototype, "variant", 2);
|
|
57470
57529
|
__decorateClass$vZ([
|
|
57471
|
-
n$3({ type:
|
|
57530
|
+
n$3({ type: String })
|
|
57472
57531
|
], ObcReadoutBlock.prototype, "value", 2);
|
|
57532
|
+
__decorateClass$vZ([
|
|
57533
|
+
n$3({ type: String })
|
|
57534
|
+
], ObcReadoutBlock.prototype, "valueType", 2);
|
|
57473
57535
|
__decorateClass$vZ([
|
|
57474
57536
|
n$3({ type: String })
|
|
57475
57537
|
], ObcReadoutBlock.prototype, "size", 2);
|
|
@@ -59003,6 +59065,7 @@ let ObcReadoutListItem = class extends i$4 {
|
|
|
59003
59065
|
super(...arguments);
|
|
59004
59066
|
this.hasValue = true;
|
|
59005
59067
|
this.value = null;
|
|
59068
|
+
this.valueType = ReadoutValueType.number;
|
|
59006
59069
|
this.off = false;
|
|
59007
59070
|
this.offText = "OFF";
|
|
59008
59071
|
this.hasSetpoint = false;
|
|
@@ -59054,7 +59117,7 @@ let ObcReadoutListItem = class extends i$4 {
|
|
|
59054
59117
|
return false;
|
|
59055
59118
|
}
|
|
59056
59119
|
return isDisplayedAtSetpoint(
|
|
59057
|
-
this.value,
|
|
59120
|
+
resolveReadoutNumericValue(this.value, this.valueType) ?? null,
|
|
59058
59121
|
this.setpoint,
|
|
59059
59122
|
this.numericFormatOptions(this.resolvedMaxDigits)
|
|
59060
59123
|
);
|
|
@@ -59147,6 +59210,7 @@ let ObcReadoutListItem = class extends i$4 {
|
|
|
59147
59210
|
exportparts="block, block-content, block-text, block-icon, degree"
|
|
59148
59211
|
.variant=${config.variant}
|
|
59149
59212
|
.value=${config.value ?? null}
|
|
59213
|
+
.valueType=${config.valueType ?? ReadoutValueType.number}
|
|
59150
59214
|
.size=${this.resolvedSize}
|
|
59151
59215
|
.valueSize=${config.valueSize}
|
|
59152
59216
|
.enhanced=${config.enhanced}
|
|
@@ -59332,6 +59396,7 @@ let ObcReadoutListItem = class extends i$4 {
|
|
|
59332
59396
|
${this.hasValue ? this.renderBlock({
|
|
59333
59397
|
variant: ReadoutBlockVariant.value,
|
|
59334
59398
|
value: this.value,
|
|
59399
|
+
valueType: this.valueType,
|
|
59335
59400
|
valueSize: this.valueSize,
|
|
59336
59401
|
enhanced: this.rowEnhanced,
|
|
59337
59402
|
weight: this.valueWeight,
|
|
@@ -59447,6 +59512,10 @@ let ObcReadoutListItem = class extends i$4 {
|
|
|
59447
59512
|
</div>
|
|
59448
59513
|
`;
|
|
59449
59514
|
}
|
|
59515
|
+
willUpdate(changed) {
|
|
59516
|
+
super.willUpdate(changed);
|
|
59517
|
+
assertReadoutValueType("obc-readout-list-item", this.value, this.valueType);
|
|
59518
|
+
}
|
|
59450
59519
|
updated(changed) {
|
|
59451
59520
|
super.updated(changed);
|
|
59452
59521
|
const firstUpdate = !this.hasCompletedFirstUpdate;
|
|
@@ -59527,8 +59596,11 @@ __decorateClass$vY([
|
|
|
59527
59596
|
n$3({ type: Boolean, attribute: false })
|
|
59528
59597
|
], ObcReadoutListItem.prototype, "hasValue", 2);
|
|
59529
59598
|
__decorateClass$vY([
|
|
59530
|
-
n$3({ type:
|
|
59599
|
+
n$3({ type: String })
|
|
59531
59600
|
], ObcReadoutListItem.prototype, "value", 2);
|
|
59601
|
+
__decorateClass$vY([
|
|
59602
|
+
n$3({ type: String })
|
|
59603
|
+
], ObcReadoutListItem.prototype, "valueType", 2);
|
|
59532
59604
|
__decorateClass$vY([
|
|
59533
59605
|
n$3({ type: Boolean })
|
|
59534
59606
|
], ObcReadoutListItem.prototype, "off", 2);
|
|
@@ -64177,6 +64249,7 @@ let ObcReadout = class extends i$4 {
|
|
|
64177
64249
|
super(...arguments);
|
|
64178
64250
|
this.hasValue = true;
|
|
64179
64251
|
this.value = null;
|
|
64252
|
+
this.valueType = ReadoutValueType.number;
|
|
64180
64253
|
this.off = false;
|
|
64181
64254
|
this.offText = "OFF";
|
|
64182
64255
|
this.hasSetpoint = false;
|
|
@@ -64251,7 +64324,7 @@ let ObcReadout = class extends i$4 {
|
|
|
64251
64324
|
return false;
|
|
64252
64325
|
}
|
|
64253
64326
|
return isDisplayedAtSetpoint(
|
|
64254
|
-
this.value,
|
|
64327
|
+
resolveReadoutNumericValue(this.value, this.valueType) ?? null,
|
|
64255
64328
|
this.setpoint,
|
|
64256
64329
|
this.numericFormatOptions(this.resolvedMaxDigits)
|
|
64257
64330
|
);
|
|
@@ -64353,6 +64426,7 @@ let ObcReadout = class extends i$4 {
|
|
|
64353
64426
|
exportparts="block, block-content, block-text, block-icon, degree"
|
|
64354
64427
|
.variant=${config.variant}
|
|
64355
64428
|
.value=${config.value ?? null}
|
|
64429
|
+
.valueType=${config.valueType ?? ReadoutValueType.number}
|
|
64356
64430
|
.size=${this.resolvedSize}
|
|
64357
64431
|
.valueSize=${config.valueSize}
|
|
64358
64432
|
.enhanced=${config.enhanced}
|
|
@@ -64493,6 +64567,7 @@ let ObcReadout = class extends i$4 {
|
|
|
64493
64567
|
${this.renderBlock({
|
|
64494
64568
|
variant: ReadoutBlockVariant.value,
|
|
64495
64569
|
value: this.value,
|
|
64570
|
+
valueType: this.valueType,
|
|
64496
64571
|
valueSize: this.valueSize,
|
|
64497
64572
|
enhanced: this.rowEnhanced,
|
|
64498
64573
|
weight: this.valueWeight,
|
|
@@ -64771,6 +64846,7 @@ let ObcReadout = class extends i$4 {
|
|
|
64771
64846
|
}) : b`${this.renderBlock({
|
|
64772
64847
|
variant: ReadoutBlockVariant.value,
|
|
64773
64848
|
value: this.value,
|
|
64849
|
+
valueType: this.valueType,
|
|
64774
64850
|
valueSize: this.primarySize,
|
|
64775
64851
|
enhanced: false,
|
|
64776
64852
|
weight: this.valueWeight,
|
|
@@ -64828,6 +64904,10 @@ let ObcReadout = class extends i$4 {
|
|
|
64828
64904
|
</div>
|
|
64829
64905
|
`;
|
|
64830
64906
|
}
|
|
64907
|
+
willUpdate(changed) {
|
|
64908
|
+
super.willUpdate(changed);
|
|
64909
|
+
assertReadoutValueType("obc-readout", this.value, this.valueType);
|
|
64910
|
+
}
|
|
64831
64911
|
updated(changed) {
|
|
64832
64912
|
super.updated(changed);
|
|
64833
64913
|
if (changed.has("sourcePickerContentVisible")) {
|
|
@@ -64921,8 +65001,11 @@ __decorateClass$vH([
|
|
|
64921
65001
|
n$3({ type: Boolean, attribute: false })
|
|
64922
65002
|
], ObcReadout.prototype, "hasValue", 2);
|
|
64923
65003
|
__decorateClass$vH([
|
|
64924
|
-
n$3({ type:
|
|
65004
|
+
n$3({ type: String })
|
|
64925
65005
|
], ObcReadout.prototype, "value", 2);
|
|
65006
|
+
__decorateClass$vH([
|
|
65007
|
+
n$3({ type: String })
|
|
65008
|
+
], ObcReadout.prototype, "valueType", 2);
|
|
64926
65009
|
__decorateClass$vH([
|
|
64927
65010
|
n$3({ type: Boolean })
|
|
64928
65011
|
], ObcReadout.prototype, "off", 2);
|
|
@@ -227455,14 +227538,19 @@ const OBSERVED_ATTRIBUTES = [
|
|
|
227455
227538
|
"unit",
|
|
227456
227539
|
"src",
|
|
227457
227540
|
"value",
|
|
227541
|
+
"valuetype",
|
|
227458
227542
|
"setpoint",
|
|
227459
227543
|
"advice",
|
|
227544
|
+
// ⚠ inert — see the note above; the real names have no hyphens.
|
|
227460
227545
|
"max-digits",
|
|
227461
227546
|
"fraction-digits",
|
|
227462
227547
|
"has-degree",
|
|
227463
227548
|
"has-setpoint",
|
|
227464
227549
|
"has-advice"
|
|
227465
227550
|
];
|
|
227551
|
+
function isTextValueRow(item) {
|
|
227552
|
+
return item.valueType === ReadoutValueType.text;
|
|
227553
|
+
}
|
|
227466
227554
|
function integerDigitCount(value) {
|
|
227467
227555
|
if (value === null || value === void 0 || Number.isNaN(value)) {
|
|
227468
227556
|
return 0;
|
|
@@ -227513,11 +227601,22 @@ let ObcReadoutList = class extends i$4 {
|
|
|
227513
227601
|
let longestSrc = "";
|
|
227514
227602
|
let anyDegree = false;
|
|
227515
227603
|
for (const item of items) {
|
|
227516
|
-
|
|
227604
|
+
const hasNumericBlock = !isTextValueRow(item) || item.hasSetpoint || item.hasAdvice;
|
|
227605
|
+
if (hasNumericBlock) {
|
|
227606
|
+
maxFractionDigits = Math.max(
|
|
227607
|
+
maxFractionDigits,
|
|
227608
|
+
item.fractionDigits ?? 0
|
|
227609
|
+
);
|
|
227610
|
+
maxIntegerDigits = Math.max(maxIntegerDigits, item.maxDigits ?? 0);
|
|
227611
|
+
}
|
|
227517
227612
|
maxIntegerDigits = Math.max(
|
|
227518
227613
|
maxIntegerDigits,
|
|
227519
|
-
|
|
227520
|
-
|
|
227614
|
+
integerDigitCount(
|
|
227615
|
+
resolveReadoutNumericValue(
|
|
227616
|
+
item.value,
|
|
227617
|
+
item.valueType ?? ReadoutValueType.number
|
|
227618
|
+
)
|
|
227619
|
+
),
|
|
227521
227620
|
item.hasSetpoint ? integerDigitCount(item.setpoint) : 0,
|
|
227522
227621
|
item.hasAdvice ? integerDigitCount(item.advice) : 0
|
|
227523
227622
|
);
|
|
@@ -227536,7 +227635,7 @@ let ObcReadoutList = class extends i$4 {
|
|
|
227536
227635
|
for (const item of items) {
|
|
227537
227636
|
item.valueOptions = {
|
|
227538
227637
|
...item.valueOptions,
|
|
227539
|
-
spaceReserver: numericReserver
|
|
227638
|
+
spaceReserver: isTextValueRow(item) ? void 0 : numericReserver
|
|
227540
227639
|
};
|
|
227541
227640
|
item.setpointOptions = {
|
|
227542
227641
|
...item.setpointOptions,
|