myio-js-library 0.1.554 → 0.1.555
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/dist/index.cjs +20 -14
- package/dist/index.js +20 -14
- package/dist/myio-js-library.umd.js +20 -14
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -899,7 +899,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
899
899
|
// package.json
|
|
900
900
|
var package_default = {
|
|
901
901
|
name: "myio-js-library",
|
|
902
|
-
version: "0.1.
|
|
902
|
+
version: "0.1.555",
|
|
903
903
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
904
904
|
license: "MIT",
|
|
905
905
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -19190,19 +19190,25 @@ function renderCardComponentV5({
|
|
|
19190
19190
|
isOffline
|
|
19191
19191
|
});
|
|
19192
19192
|
const calculateTempDeviationPercent = () => {
|
|
19193
|
-
const currentTemp = Number(val)
|
|
19194
|
-
if (
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
const deviation = (currentTemp - avgTemp) / avgTemp * 100;
|
|
19198
|
-
return {
|
|
19199
|
-
value: Math.abs(deviation),
|
|
19200
|
-
sign: deviation >= 0 ? "+" : "-",
|
|
19201
|
-
isAbove: deviation > 0,
|
|
19202
|
-
isBelow: deviation < 0
|
|
19203
|
-
};
|
|
19193
|
+
const currentTemp = Number(val);
|
|
19194
|
+
if (!Number.isFinite(currentTemp)) return null;
|
|
19195
|
+
if (temperatureMin === void 0 || temperatureMin === null || temperatureMax === void 0 || temperatureMax === null) {
|
|
19196
|
+
return null;
|
|
19204
19197
|
}
|
|
19205
|
-
|
|
19198
|
+
const min = Number(temperatureMin);
|
|
19199
|
+
const max = Number(temperatureMax);
|
|
19200
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return null;
|
|
19201
|
+
const fmt1 = (n) => n.toLocaleString("pt-BR", { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
19202
|
+
const range = `Faixa ideal ${fmt1(min)}\u2013${fmt1(max)} \xB0C`;
|
|
19203
|
+
if (currentTemp > max) {
|
|
19204
|
+
const d = currentTemp - max;
|
|
19205
|
+
return { isAbove: true, isBelow: false, value: d, text: `+${fmt1(d)} \xB0C`, title: `${range} \xB7 ${fmt1(d)} \xB0C acima do limite` };
|
|
19206
|
+
}
|
|
19207
|
+
if (currentTemp < min) {
|
|
19208
|
+
const d = min - currentTemp;
|
|
19209
|
+
return { isAbove: false, isBelow: true, value: d, text: `\u2212${fmt1(d)} \xB0C`, title: `${range} \xB7 ${fmt1(d)} \xB0C abaixo do limite` };
|
|
19210
|
+
}
|
|
19211
|
+
return { isAbove: false, isBelow: false, value: 0, text: "na faixa", title: `${range} \xB7 dentro da faixa` };
|
|
19206
19212
|
};
|
|
19207
19213
|
const tempDeviationPercent = isTermostatoDevice && !showNoTempReading ? calculateTempDeviationPercent() : null;
|
|
19208
19214
|
const cardHTML = `
|
|
@@ -19252,7 +19258,7 @@ function renderCardComponentV5({
|
|
|
19252
19258
|
<span class="consumption-value"${showNoTempReading ? ' style="color:#9ca3af;font-weight:500;font-size:0.85em;"' : ""}${tempValueTitle ? ` title="${tempValueTitle}"` : ""}>${formatCardValue(cardEntity.lastValue, deviceType)}</span>${showTempWarning ? `<span class="myio-temp-warn-icon" title="${tempValueTitle}" aria-label="Leitura atrasada">\u26A0\uFE0F</span>` : ""}
|
|
19253
19259
|
</div>
|
|
19254
19260
|
</div>
|
|
19255
|
-
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#
|
|
19261
|
+
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#16a34a"}; font-weight: 600; cursor: help;" title="${tempDeviationPercent.title}">${tempDeviationPercent.text}</span>` : ""}
|
|
19256
19262
|
</div>
|
|
19257
19263
|
</div>
|
|
19258
19264
|
</div>
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
// package.json
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "myio-js-library",
|
|
13
|
-
version: "0.1.
|
|
13
|
+
version: "0.1.555",
|
|
14
14
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
15
15
|
license: "MIT",
|
|
16
16
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -17576,19 +17576,25 @@ function renderCardComponentV5({
|
|
|
17576
17576
|
isOffline
|
|
17577
17577
|
});
|
|
17578
17578
|
const calculateTempDeviationPercent = () => {
|
|
17579
|
-
const currentTemp = Number(val)
|
|
17580
|
-
if (
|
|
17581
|
-
|
|
17582
|
-
|
|
17583
|
-
const deviation = (currentTemp - avgTemp) / avgTemp * 100;
|
|
17584
|
-
return {
|
|
17585
|
-
value: Math.abs(deviation),
|
|
17586
|
-
sign: deviation >= 0 ? "+" : "-",
|
|
17587
|
-
isAbove: deviation > 0,
|
|
17588
|
-
isBelow: deviation < 0
|
|
17589
|
-
};
|
|
17579
|
+
const currentTemp = Number(val);
|
|
17580
|
+
if (!Number.isFinite(currentTemp)) return null;
|
|
17581
|
+
if (temperatureMin === void 0 || temperatureMin === null || temperatureMax === void 0 || temperatureMax === null) {
|
|
17582
|
+
return null;
|
|
17590
17583
|
}
|
|
17591
|
-
|
|
17584
|
+
const min = Number(temperatureMin);
|
|
17585
|
+
const max = Number(temperatureMax);
|
|
17586
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return null;
|
|
17587
|
+
const fmt1 = (n) => n.toLocaleString("pt-BR", { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
17588
|
+
const range = `Faixa ideal ${fmt1(min)}\u2013${fmt1(max)} \xB0C`;
|
|
17589
|
+
if (currentTemp > max) {
|
|
17590
|
+
const d = currentTemp - max;
|
|
17591
|
+
return { isAbove: true, isBelow: false, value: d, text: `+${fmt1(d)} \xB0C`, title: `${range} \xB7 ${fmt1(d)} \xB0C acima do limite` };
|
|
17592
|
+
}
|
|
17593
|
+
if (currentTemp < min) {
|
|
17594
|
+
const d = min - currentTemp;
|
|
17595
|
+
return { isAbove: false, isBelow: true, value: d, text: `\u2212${fmt1(d)} \xB0C`, title: `${range} \xB7 ${fmt1(d)} \xB0C abaixo do limite` };
|
|
17596
|
+
}
|
|
17597
|
+
return { isAbove: false, isBelow: false, value: 0, text: "na faixa", title: `${range} \xB7 dentro da faixa` };
|
|
17592
17598
|
};
|
|
17593
17599
|
const tempDeviationPercent = isTermostatoDevice && !showNoTempReading ? calculateTempDeviationPercent() : null;
|
|
17594
17600
|
const cardHTML = `
|
|
@@ -17638,7 +17644,7 @@ function renderCardComponentV5({
|
|
|
17638
17644
|
<span class="consumption-value"${showNoTempReading ? ' style="color:#9ca3af;font-weight:500;font-size:0.85em;"' : ""}${tempValueTitle ? ` title="${tempValueTitle}"` : ""}>${formatCardValue(cardEntity.lastValue, deviceType)}</span>${showTempWarning ? `<span class="myio-temp-warn-icon" title="${tempValueTitle}" aria-label="Leitura atrasada">\u26A0\uFE0F</span>` : ""}
|
|
17639
17645
|
</div>
|
|
17640
17646
|
</div>
|
|
17641
|
-
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#
|
|
17647
|
+
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#16a34a"}; font-weight: 600; cursor: help;" title="${tempDeviationPercent.title}">${tempDeviationPercent.text}</span>` : ""}
|
|
17642
17648
|
</div>
|
|
17643
17649
|
</div>
|
|
17644
17650
|
</div>
|
|
@@ -5524,7 +5524,7 @@
|
|
|
5524
5524
|
|
|
5525
5525
|
// package.json
|
|
5526
5526
|
var package_default = {
|
|
5527
|
-
version: "0.1.
|
|
5527
|
+
version: "0.1.555"};
|
|
5528
5528
|
|
|
5529
5529
|
// src/utils/format/energy.ts
|
|
5530
5530
|
function formatPower(value, decimals = 2) {
|
|
@@ -22982,19 +22982,25 @@
|
|
|
22982
22982
|
isOffline
|
|
22983
22983
|
});
|
|
22984
22984
|
const calculateTempDeviationPercent = () => {
|
|
22985
|
-
const currentTemp = Number(val)
|
|
22986
|
-
if (
|
|
22987
|
-
|
|
22988
|
-
|
|
22989
|
-
const deviation = (currentTemp - avgTemp) / avgTemp * 100;
|
|
22990
|
-
return {
|
|
22991
|
-
value: Math.abs(deviation),
|
|
22992
|
-
sign: deviation >= 0 ? "+" : "-",
|
|
22993
|
-
isAbove: deviation > 0,
|
|
22994
|
-
isBelow: deviation < 0
|
|
22995
|
-
};
|
|
22985
|
+
const currentTemp = Number(val);
|
|
22986
|
+
if (!Number.isFinite(currentTemp)) return null;
|
|
22987
|
+
if (temperatureMin === void 0 || temperatureMin === null || temperatureMax === void 0 || temperatureMax === null) {
|
|
22988
|
+
return null;
|
|
22996
22989
|
}
|
|
22997
|
-
|
|
22990
|
+
const min = Number(temperatureMin);
|
|
22991
|
+
const max = Number(temperatureMax);
|
|
22992
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return null;
|
|
22993
|
+
const fmt1 = (n) => n.toLocaleString("pt-BR", { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
22994
|
+
const range = `Faixa ideal ${fmt1(min)}\u2013${fmt1(max)} \xB0C`;
|
|
22995
|
+
if (currentTemp > max) {
|
|
22996
|
+
const d = currentTemp - max;
|
|
22997
|
+
return { isAbove: true, isBelow: false, value: d, text: `+${fmt1(d)} \xB0C`, title: `${range} \xB7 ${fmt1(d)} \xB0C acima do limite` };
|
|
22998
|
+
}
|
|
22999
|
+
if (currentTemp < min) {
|
|
23000
|
+
const d = min - currentTemp;
|
|
23001
|
+
return { isAbove: false, isBelow: true, value: d, text: `\u2212${fmt1(d)} \xB0C`, title: `${range} \xB7 ${fmt1(d)} \xB0C abaixo do limite` };
|
|
23002
|
+
}
|
|
23003
|
+
return { isAbove: false, isBelow: false, value: 0, text: "na faixa", title: `${range} \xB7 dentro da faixa` };
|
|
22998
23004
|
};
|
|
22999
23005
|
const tempDeviationPercent = isTermostatoDevice && !showNoTempReading ? calculateTempDeviationPercent() : null;
|
|
23000
23006
|
const cardHTML = `
|
|
@@ -23044,7 +23050,7 @@
|
|
|
23044
23050
|
<span class="consumption-value"${showNoTempReading ? ' style="color:#9ca3af;font-weight:500;font-size:0.85em;"' : ""}${tempValueTitle ? ` title="${tempValueTitle}"` : ""}>${formatCardValue(cardEntity.lastValue, deviceType)}</span>${showTempWarning ? `<span class="myio-temp-warn-icon" title="${tempValueTitle}" aria-label="Leitura atrasada">\u26A0\uFE0F</span>` : ""}
|
|
23045
23051
|
</div>
|
|
23046
23052
|
</div>
|
|
23047
|
-
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#
|
|
23053
|
+
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#16a34a"}; font-weight: 600; cursor: help;" title="${tempDeviationPercent.title}">${tempDeviationPercent.text}</span>` : ""}
|
|
23048
23054
|
</div>
|
|
23049
23055
|
</div>
|
|
23050
23056
|
</div>
|