myio-js-library 0.1.152 → 0.1.154

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.
@@ -3848,14 +3848,30 @@
3848
3848
  --myio-card-bg: #fff;
3849
3849
  --myio-card-border: #e9eef5;
3850
3850
 
3851
- --myio-chip-ok-bg: #e8f7ff;
3852
- --myio-chip-ok-fg: #007ecc;
3853
- --myio-chip-alert-bg: #fff4e5;
3854
- --myio-chip-alert-fg: #b96b00;
3855
- --myio-chip-failure-bg: #ffeaea;
3856
- --myio-chip-failure-fg: #b71c1c;
3851
+ /* Status colors - Normal/Power On (blue) */
3852
+ --myio-chip-ok-bg: #dbeafe;
3853
+ --myio-chip-ok-fg: #1d4ed8;
3854
+ --myio-border-ok: rgba(59, 130, 246, 0.4);
3855
+
3856
+ /* Status colors - Standby (green) */
3857
+ --myio-chip-standby-bg: #dcfce7;
3858
+ --myio-chip-standby-fg: #15803d;
3859
+ --myio-border-standby: rgba(34, 197, 94, 0.4);
3860
+
3861
+ /* Status colors - Alert/Warning (yellow) */
3862
+ --myio-chip-alert-bg: #fef3c7;
3863
+ --myio-chip-alert-fg: #b45309;
3864
+ --myio-border-alert: rgba(245, 158, 11, 0.5);
3865
+
3866
+ /* Status colors - Failure (red) */
3867
+ --myio-chip-failure-bg: #fee2e2;
3868
+ --myio-chip-failure-fg: #b91c1c;
3869
+ --myio-border-failure: rgba(239, 68, 68, 0.5);
3870
+
3871
+ /* Status colors - Offline (gray) */
3857
3872
  --myio-chip-offline-bg: #f1f5f9;
3858
3873
  --myio-chip-offline-fg: #64748b;
3874
+ --myio-border-offline: rgba(100, 116, 139, 0.4);
3859
3875
 
3860
3876
  --myio-text-1: #0f172a;
3861
3877
  --myio-text-2: #4b5563;
@@ -3910,15 +3926,25 @@
3910
3926
  box-shadow: 0 16px 48px rgba(0, 224, 158, 0.3), 0 8px 16px rgba(0, 224, 158, 0.2);
3911
3927
  }
3912
3928
 
3913
- /* Alert and failure states */
3929
+ /* Card border states based on device status */
3930
+ .myio-ho-card.is-ok {
3931
+ border-color: var(--myio-border-ok);
3932
+ box-shadow: 0 0 0 2px var(--myio-border-ok), var(--myio-card-shadow);
3933
+ }
3934
+
3935
+ .myio-ho-card.is-standby {
3936
+ border-color: var(--myio-border-standby);
3937
+ box-shadow: 0 0 0 2px var(--myio-border-standby), var(--myio-card-shadow);
3938
+ }
3939
+
3914
3940
  .myio-ho-card.is-alert {
3915
- border-color: var(--myio-badge-border);
3916
- box-shadow: 0 0 0 1px var(--myio-badge-border), var(--myio-card-shadow);
3941
+ border-color: var(--myio-border-alert);
3942
+ box-shadow: 0 0 0 2px var(--myio-border-alert), var(--myio-card-shadow);
3917
3943
  }
3918
3944
 
3919
3945
  .myio-ho-card.is-failure {
3920
- border-color: var(--myio-badge-border-failure);
3921
- box-shadow: 0 0 0 1px var(--myio-badge-border-failure), var(--myio-card-shadow);
3946
+ border-color: var(--myio-border-failure);
3947
+ box-shadow: 0 0 0 2px var(--myio-border-failure), var(--myio-card-shadow);
3922
3948
  }
3923
3949
 
3924
3950
  /* Header section */
@@ -3953,21 +3979,10 @@
3953
3979
 
3954
3980
  /* Adicione estas duas novas regras ao seu CSS_STRING */
3955
3981
 
3956
- /* Estado Offline - Apenas borda do card */
3982
+ /* Estado Offline - borda cinza */
3957
3983
  .myio-ho-card.is-offline {
3958
- border-color: rgba(100, 116, 139, 0.4);
3959
- box-shadow: 0 0 0 1px rgba(100, 116, 139, 0.4), var(--myio-card-shadow);
3960
- }
3961
-
3962
- /* Regras que j\xE1 existem (mantenha-as) */
3963
- .myio-ho-card.is-alert {
3964
- border-color: var(--myio-badge-border);
3965
- box-shadow: 0 0 0 1px var(--myio-badge-border), var(--myio-card-shadow);
3966
- }
3967
-
3968
- .myio-ho-card.is-failure {
3969
- border-color: var(--myio-badge-border-failure);
3970
- box-shadow: 0 0 0 1px var(--myio-badge-border-failure), var(--myio-card-shadow);
3984
+ border-color: var(--myio-border-offline);
3985
+ box-shadow: 0 0 0 2px var(--myio-border-offline), var(--myio-card-shadow);
3971
3986
  }
3972
3987
 
3973
3988
  .myio-ho-card__name {
@@ -4339,6 +4354,11 @@
4339
4354
  color: var(--myio-chip-ok-fg);
4340
4355
  }
4341
4356
 
4357
+ .chip--standby {
4358
+ background: var(--myio-chip-standby-bg);
4359
+ color: var(--myio-chip-standby-fg);
4360
+ }
4361
+
4342
4362
  .chip--alert {
4343
4363
  background: var(--myio-chip-alert-bg);
4344
4364
  color: var(--myio-chip-alert-fg);
@@ -4350,8 +4370,41 @@
4350
4370
  }
4351
4371
 
4352
4372
  .chip--offline {
4353
- background: #e37171 !important;
4354
- color: #ffffff !important;
4373
+ background: var(--myio-chip-offline-bg);
4374
+ color: var(--myio-chip-offline-fg);
4375
+ }
4376
+
4377
+ /* Status indicator dot for power metric */
4378
+ .status-dot {
4379
+ width: 8px;
4380
+ height: 8px;
4381
+ border-radius: 50%;
4382
+ flex-shrink: 0;
4383
+ background: var(--myio-chip-offline-fg);
4384
+ }
4385
+
4386
+ .status-dot.dot--ok {
4387
+ background: var(--myio-chip-ok-fg);
4388
+ }
4389
+
4390
+ .status-dot.dot--standby {
4391
+ background: var(--myio-chip-standby-fg);
4392
+ }
4393
+
4394
+ .status-dot.dot--alert {
4395
+ background: var(--myio-chip-alert-fg);
4396
+ }
4397
+
4398
+ .status-dot.dot--failure {
4399
+ background: var(--myio-chip-failure-fg);
4400
+ }
4401
+
4402
+ .status-dot.dot--offline {
4403
+ background: var(--myio-chip-offline-fg);
4404
+ }
4405
+
4406
+ .status-dot.dot--neutral {
4407
+ background: var(--myio-muted);
4355
4408
  }
4356
4409
 
4357
4410
  /* Primary metric */
@@ -4452,7 +4505,11 @@
4452
4505
  flex-direction: column;
4453
4506
  align-items: center;
4454
4507
  text-align: center;
4455
- gap: 4px;
4508
+ gap: 2px;
4509
+ }
4510
+
4511
+ .myio-ho-card__footer .metric .status-dot {
4512
+ margin-bottom: 2px;
4456
4513
  }
4457
4514
 
4458
4515
  .myio-ho-card__footer .metric .ico {
@@ -4617,12 +4674,6 @@
4617
4674
  viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
4618
4675
  <rect x="5" y="4" width="14" height="16" rx="2"/>
4619
4676
  <path d="M7 12c1.5 1 3 .9 5-.3s3.5-1.3 5 .3v4H7v-4Z" fill="#fff" fill-opacity=".25"/>
4620
- </svg>`,
4621
- // 🟦 Online chip (dot)
4622
- dot: `
4623
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
4624
- viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
4625
- <circle cx="12" cy="12" r="5"/>
4626
4677
  </svg>`,
4627
4678
  // ⋮ Kebab (for actions menu)
4628
4679
  kebab: `
@@ -4759,22 +4810,43 @@
4759
4810
  function getCardStateClass(deviceStatus) {
4760
4811
  switch (deviceStatus) {
4761
4812
  case DeviceStatusType.POWER_ON:
4762
- return "";
4763
- case DeviceStatusType.NO_INFO:
4764
- return "is-offline";
4765
- case DeviceStatusType.WARNING:
4813
+ return "is-ok";
4814
+ // Blue border
4766
4815
  case DeviceStatusType.STANDBY:
4816
+ return "is-standby";
4817
+ // Green border
4818
+ case DeviceStatusType.WARNING:
4767
4819
  case DeviceStatusType.MAINTENANCE:
4768
4820
  return "is-alert";
4821
+ // Yellow border
4769
4822
  case DeviceStatusType.FAILURE:
4770
4823
  case DeviceStatusType.POWER_OFF:
4771
4824
  return "is-failure";
4825
+ // Red border
4826
+ case DeviceStatusType.NO_INFO:
4772
4827
  case DeviceStatusType.NOT_INSTALLED:
4773
4828
  return "is-offline";
4829
+ // Gray border
4774
4830
  default:
4775
4831
  return "";
4776
4832
  }
4777
4833
  }
4834
+ function getStatusDotClass(deviceStatus) {
4835
+ switch (deviceStatus) {
4836
+ case DeviceStatusType.POWER_ON:
4837
+ return "dot--ok";
4838
+ case DeviceStatusType.STANDBY:
4839
+ return "dot--standby";
4840
+ case DeviceStatusType.WARNING:
4841
+ case DeviceStatusType.MAINTENANCE:
4842
+ return "dot--alert";
4843
+ case DeviceStatusType.FAILURE:
4844
+ case DeviceStatusType.POWER_OFF:
4845
+ return "dot--failure";
4846
+ default:
4847
+ return "dot--offline";
4848
+ }
4849
+ }
4778
4850
  function buildDOM(state) {
4779
4851
  const { entityObject, i18n, enableSelection, enableDragDrop } = state;
4780
4852
  const root = document.createElement("div");
@@ -4892,10 +4964,9 @@
4892
4964
  footer.className = "myio-ho-card__footer";
4893
4965
  const opTimeMetric = document.createElement("div");
4894
4966
  opTimeMetric.className = "metric";
4895
- const opTimeIcon = document.createElement("i");
4896
- opTimeIcon.className = "ico ico-clock";
4897
- opTimeIcon.innerHTML = Icons.dot;
4898
- opTimeMetric.appendChild(opTimeIcon);
4967
+ const opTimeDot = document.createElement("span");
4968
+ opTimeDot.className = "status-dot dot--neutral";
4969
+ opTimeMetric.appendChild(opTimeDot);
4899
4970
  const opTimeLabel = document.createElement("div");
4900
4971
  opTimeLabel.className = "label";
4901
4972
  opTimeLabel.textContent = i18n.operation_time;
@@ -4906,10 +4977,9 @@
4906
4977
  footer.appendChild(opTimeMetric);
4907
4978
  const powerMetric = document.createElement("div");
4908
4979
  powerMetric.className = "metric";
4909
- const powerIcon = document.createElement("i");
4910
- powerIcon.className = "ico ico-power";
4911
- powerIcon.innerHTML = Icons.dot;
4912
- powerMetric.appendChild(powerIcon);
4980
+ const statusDot = document.createElement("span");
4981
+ statusDot.className = "status-dot";
4982
+ powerMetric.appendChild(statusDot);
4913
4983
  const powerLabel = document.createElement("div");
4914
4984
  powerLabel.className = "label";
4915
4985
  powerLabel.textContent = i18n.instantaneous_power || "Pot\xEAncia";
@@ -4977,6 +5047,11 @@
4977
5047
  const powerFormatted = formatPower(instantPower);
4978
5048
  powerVal.textContent = instantPower !== null ? `${powerFormatted.num} ${powerFormatted.unit}` : "-";
4979
5049
  }
5050
+ const statusDot = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .status-dot");
5051
+ if (statusDot) {
5052
+ const dotClass = getStatusDotClass(entityObject.deviceStatus);
5053
+ statusDot.className = `status-dot ${dotClass}`;
5054
+ }
4980
5055
  }
4981
5056
  function bindEvents(root, state, callbacks) {
4982
5057
  const { entityObject } = state;