myio-js-library 0.1.560 → 0.1.561
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 +175 -71
- package/dist/index.js +175 -71
- package/dist/myio-js-library.umd.js +175 -71
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -908,7 +908,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
908
908
|
// package.json
|
|
909
909
|
var package_default = {
|
|
910
910
|
name: "myio-js-library",
|
|
911
|
-
version: "0.1.
|
|
911
|
+
version: "0.1.561",
|
|
912
912
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
913
913
|
license: "MIT",
|
|
914
914
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -68307,7 +68307,19 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
68307
68307
|
shoppingCardBg: themeConfig.shoppingCardBackgroundColor,
|
|
68308
68308
|
shoppingCardBorder: themeConfig.shoppingCardBorderColor
|
|
68309
68309
|
};
|
|
68310
|
-
return { ...DEFAULT_PALETTE, ...configPalette, ...this.params.palette };
|
|
68310
|
+
return { ...DEFAULT_PALETTE, ...configPalette, ...this.readDashboardBrand(), ...this.params.palette };
|
|
68311
|
+
}
|
|
68312
|
+
/**
|
|
68313
|
+
* Paleta do tema do dashboard (createMyIOTheme publica --myio-brand-700/600 no :root).
|
|
68314
|
+
* Quando presente, substitui o roxo padrão da modal; `params.palette` explícito ainda prevalece.
|
|
68315
|
+
*/
|
|
68316
|
+
readDashboardBrand() {
|
|
68317
|
+
if (typeof document === "undefined" || typeof getComputedStyle !== "function") return {};
|
|
68318
|
+
const cs = getComputedStyle(document.documentElement);
|
|
68319
|
+
const brand700 = cs.getPropertyValue("--myio-brand-700").trim();
|
|
68320
|
+
if (!brand700) return {};
|
|
68321
|
+
const brand600 = cs.getPropertyValue("--myio-brand-600").trim();
|
|
68322
|
+
return { primary: brand700, secondary: brand600 || brand700 };
|
|
68311
68323
|
}
|
|
68312
68324
|
/**
|
|
68313
68325
|
* Set theme mode and update UI
|
|
@@ -68684,9 +68696,9 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
68684
68696
|
background: linear-gradient(135deg, #0a0f1a 0%, #1a1f2e 50%, #0d1117 100%);
|
|
68685
68697
|
border-radius: 14px;
|
|
68686
68698
|
box-shadow:
|
|
68687
|
-
0 0 0 1px
|
|
68699
|
+
0 0 0 1px color-mix(in srgb, var(--wm-primary) 20%, transparent),
|
|
68688
68700
|
0 25px 80px rgba(0, 0, 0, 0.5),
|
|
68689
|
-
0 0 60px
|
|
68701
|
+
0 0 60px color-mix(in srgb, var(--wm-primary) 15%, transparent);
|
|
68690
68702
|
overflow: hidden;
|
|
68691
68703
|
/* Ensure flex children can handle their own overflow */
|
|
68692
68704
|
min-height: 0;
|
|
@@ -68703,7 +68715,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
68703
68715
|
padding: 16px 32px 8px 32px;
|
|
68704
68716
|
background:
|
|
68705
68717
|
linear-gradient(180deg,
|
|
68706
|
-
|
|
68718
|
+
color-mix(in srgb, var(--wm-primary) 25%, transparent) 0%,
|
|
68707
68719
|
var(--wm-gradient-start) 20%,
|
|
68708
68720
|
var(--wm-gradient-end) 80%,
|
|
68709
68721
|
rgba(13, 17, 23, 0.95) 100%
|
|
@@ -68712,7 +68724,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
68712
68724
|
background-size: cover;
|
|
68713
68725
|
background-position: center;
|
|
68714
68726
|
min-height: 22vh;
|
|
68715
|
-
border-bottom: 1px solid
|
|
68727
|
+
border-bottom: 1px solid color-mix(in srgb, var(--wm-primary) 20%, transparent);
|
|
68716
68728
|
}
|
|
68717
68729
|
|
|
68718
68730
|
/* Brand Logo - Large floating */
|
|
@@ -68906,15 +68918,15 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
68906
68918
|
cursor: pointer;
|
|
68907
68919
|
transition: all 0.3s ease;
|
|
68908
68920
|
box-shadow:
|
|
68909
|
-
0 4px 20px
|
|
68910
|
-
0 0 0 0
|
|
68921
|
+
0 4px 20px color-mix(in srgb, var(--wm-primary) 40%, transparent),
|
|
68922
|
+
0 0 0 0 color-mix(in srgb, var(--wm-primary) 0%, transparent);
|
|
68911
68923
|
}
|
|
68912
68924
|
|
|
68913
68925
|
.myio-welcome-cta-btn:hover {
|
|
68914
68926
|
transform: translateY(-3px);
|
|
68915
68927
|
box-shadow:
|
|
68916
|
-
0 8px 30px
|
|
68917
|
-
0 0 0 4px
|
|
68928
|
+
0 8px 30px color-mix(in srgb, var(--wm-primary) 50%, transparent),
|
|
68929
|
+
0 0 0 4px color-mix(in srgb, var(--wm-primary) 20%, transparent);
|
|
68918
68930
|
}
|
|
68919
68931
|
|
|
68920
68932
|
.myio-welcome-cta-btn:active {
|
|
@@ -68972,7 +68984,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
68972
68984
|
.myio-welcome-search:focus-within {
|
|
68973
68985
|
background: rgba(255,255,255,0.12);
|
|
68974
68986
|
border-color: var(--wm-primary);
|
|
68975
|
-
box-shadow: 0 0 0 2px
|
|
68987
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--wm-primary) 20%, transparent);
|
|
68976
68988
|
}
|
|
68977
68989
|
|
|
68978
68990
|
.myio-welcome-search-icon {
|
|
@@ -69193,17 +69205,17 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69193
69205
|
/* Hover effects only for clickable cards */
|
|
69194
69206
|
.myio-welcome-card--clickable:hover {
|
|
69195
69207
|
transform: scale(1.03);
|
|
69196
|
-
border-color:
|
|
69208
|
+
border-color: color-mix(in srgb, var(--wm-primary) 50%, transparent);
|
|
69197
69209
|
box-shadow:
|
|
69198
69210
|
0 12px 40px rgba(0,0,0,0.4),
|
|
69199
|
-
0 0 0 1px
|
|
69200
|
-
0 0 30px
|
|
69211
|
+
0 0 0 1px color-mix(in srgb, var(--wm-primary) 40%, transparent),
|
|
69212
|
+
0 0 30px color-mix(in srgb, var(--wm-primary) 15%, transparent);
|
|
69201
69213
|
}
|
|
69202
69214
|
|
|
69203
69215
|
.myio-welcome-card--clickable:focus {
|
|
69204
69216
|
outline: none;
|
|
69205
69217
|
box-shadow:
|
|
69206
|
-
0 0 0 3px
|
|
69218
|
+
0 0 0 3px color-mix(in srgb, var(--wm-primary) 50%, transparent),
|
|
69207
69219
|
0 12px 40px rgba(0,0,0,0.4);
|
|
69208
69220
|
}
|
|
69209
69221
|
|
|
@@ -69365,7 +69377,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69365
69377
|
.myio-welcome-card-device-count.energy .count-spinner { border-top-color: #22c55e; }
|
|
69366
69378
|
.myio-welcome-card-device-count.water .count-spinner { border-top-color: #3b82f6; }
|
|
69367
69379
|
.myio-welcome-card-device-count.temperature .count-spinner { border-top-color: #f97316; }
|
|
69368
|
-
.myio-welcome-card-device-count.users .count-spinner { border-top-color:
|
|
69380
|
+
.myio-welcome-card-device-count.users .count-spinner { border-top-color: color-mix(in srgb, var(--wm-primary) 55%, white); }
|
|
69369
69381
|
.myio-welcome-card-device-count.alarms .count-spinner { border-top-color: #ef4444; }
|
|
69370
69382
|
.myio-welcome-card-device-count.annotations .count-spinner { border-top-color: #6c5ce7; }
|
|
69371
69383
|
.myio-welcome-card-device-count.notifications .count-spinner { border-top-color: #f59e0b; }
|
|
@@ -69390,7 +69402,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69390
69402
|
height: 100%;
|
|
69391
69403
|
width: 0%;
|
|
69392
69404
|
border-radius: inherit;
|
|
69393
|
-
background: linear-gradient(90deg,
|
|
69405
|
+
background: linear-gradient(90deg, var(--wm-primary), #22c55e);
|
|
69394
69406
|
background-size: 200% 100%;
|
|
69395
69407
|
animation: welcome-progress-shimmer 1.6s ease infinite;
|
|
69396
69408
|
transition: width 0.4s ease;
|
|
@@ -69424,7 +69436,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69424
69436
|
height: 100%;
|
|
69425
69437
|
width: 0%;
|
|
69426
69438
|
border-radius: inherit;
|
|
69427
|
-
background: linear-gradient(90deg,
|
|
69439
|
+
background: linear-gradient(90deg, var(--wm-primary), color-mix(in srgb, var(--wm-primary) 55%, white), #22c55e);
|
|
69428
69440
|
background-size: 200% 100%;
|
|
69429
69441
|
animation: welcome-progress-shimmer 1.6s ease infinite;
|
|
69430
69442
|
transition: width 0.4s ease;
|
|
@@ -69761,13 +69773,13 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69761
69773
|
display: flex !important;
|
|
69762
69774
|
align-items: center !important;
|
|
69763
69775
|
justify-content: center !important;
|
|
69764
|
-
gap:
|
|
69776
|
+
gap: 8px !important;
|
|
69765
69777
|
}
|
|
69766
69778
|
|
|
69767
69779
|
/* Extend device-count styles for meta types */
|
|
69768
69780
|
.myio-welcome-card-device-count.users:hover {
|
|
69769
|
-
background:
|
|
69770
|
-
border-color:
|
|
69781
|
+
background: color-mix(in srgb, var(--wm-primary) 30%, transparent);
|
|
69782
|
+
border-color: color-mix(in srgb, var(--wm-primary) 50%, transparent);
|
|
69771
69783
|
}
|
|
69772
69784
|
|
|
69773
69785
|
.myio-welcome-card-device-count.alarms:hover {
|
|
@@ -69780,7 +69792,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69780
69792
|
border-color: rgba(234, 179, 8, 0.5);
|
|
69781
69793
|
}
|
|
69782
69794
|
|
|
69783
|
-
.myio-welcome-card-device-count.users .icon { color:
|
|
69795
|
+
.myio-welcome-card-device-count.users .icon { color: color-mix(in srgb, var(--wm-primary) 55%, white); }
|
|
69784
69796
|
.myio-welcome-card-device-count.alarms .icon { color: #f87171; }
|
|
69785
69797
|
.myio-welcome-card-device-count.notifications .icon { color: #fbbf24; }
|
|
69786
69798
|
|
|
@@ -69802,21 +69814,21 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69802
69814
|
.myio-welcome-modal--light .myio-welcome-modal-container {
|
|
69803
69815
|
background: linear-gradient(135deg, #f8f9fc 0%, #ffffff 50%, #f0f2f5 100%);
|
|
69804
69816
|
box-shadow:
|
|
69805
|
-
0 0 0 1px
|
|
69817
|
+
0 0 0 1px color-mix(in srgb, var(--wm-primary) 15%, transparent),
|
|
69806
69818
|
0 25px 80px rgba(0, 0, 0, 0.2),
|
|
69807
|
-
0 0 60px
|
|
69819
|
+
0 0 60px color-mix(in srgb, var(--wm-primary) 10%, transparent);
|
|
69808
69820
|
}
|
|
69809
69821
|
|
|
69810
69822
|
.myio-welcome-modal--light .myio-welcome-hero {
|
|
69811
69823
|
background:
|
|
69812
69824
|
linear-gradient(180deg,
|
|
69813
|
-
|
|
69825
|
+
color-mix(in srgb, var(--wm-primary) 12%, transparent) 0%,
|
|
69814
69826
|
rgba(255, 255, 255, 0.7) 20%,
|
|
69815
69827
|
rgba(255, 255, 255, 0.85) 80%,
|
|
69816
69828
|
rgba(248, 249, 252, 0.95) 100%
|
|
69817
69829
|
),
|
|
69818
69830
|
var(--wm-bg-image, none);
|
|
69819
|
-
border-bottom: 1px solid
|
|
69831
|
+
border-bottom: 1px solid color-mix(in srgb, var(--wm-primary) 15%, transparent);
|
|
69820
69832
|
}
|
|
69821
69833
|
|
|
69822
69834
|
.myio-welcome-modal--light .myio-welcome-hero-title {
|
|
@@ -69906,11 +69918,11 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69906
69918
|
}
|
|
69907
69919
|
|
|
69908
69920
|
.myio-welcome-modal--light .myio-welcome-card:hover {
|
|
69909
|
-
border-color:
|
|
69921
|
+
border-color: color-mix(in srgb, var(--wm-primary) 40%, transparent);
|
|
69910
69922
|
box-shadow:
|
|
69911
69923
|
0 12px 40px rgba(0, 0, 0, 0.12),
|
|
69912
|
-
0 0 0 1px
|
|
69913
|
-
0 0 30px
|
|
69924
|
+
0 0 0 1px color-mix(in srgb, var(--wm-primary) 30%, transparent),
|
|
69925
|
+
0 0 30px color-mix(in srgb, var(--wm-primary) 10%, transparent);
|
|
69914
69926
|
}
|
|
69915
69927
|
|
|
69916
69928
|
.myio-welcome-modal--light .myio-welcome-card::before {
|
|
@@ -69998,8 +70010,8 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
69998
70010
|
|
|
69999
70011
|
/* Light theme - meta counts use same device-count light styles */
|
|
70000
70012
|
.myio-welcome-modal--light .myio-welcome-card-device-count.users:hover {
|
|
70001
|
-
background:
|
|
70002
|
-
border-color:
|
|
70013
|
+
background: color-mix(in srgb, var(--wm-primary) 15%, transparent);
|
|
70014
|
+
border-color: color-mix(in srgb, var(--wm-primary) 40%, transparent);
|
|
70003
70015
|
}
|
|
70004
70016
|
|
|
70005
70017
|
.myio-welcome-modal--light .myio-welcome-card-device-count.alarms:hover {
|
|
@@ -70193,13 +70205,13 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
70193
70205
|
buildCardHTML(card, index) {
|
|
70194
70206
|
const bgImage = card.bgImageUrl ? `<div class="myio-welcome-card-bg" data-src="${card.bgImageUrl}"></div>` : "";
|
|
70195
70207
|
const meta = card.metaCounts || {};
|
|
70196
|
-
const renderMetaCount = (count) => count === null ? '<span class="count-spinner"></span>' :
|
|
70208
|
+
const renderMetaCount = (count) => count === null ? '<span class="count-spinner"></span>' : `<span class="count">${count ?? 0}</span>`;
|
|
70197
70209
|
const thirdBadgeHTML = meta.annotationsLocked ? `<span class="myio-welcome-card-device-count annotations locked"
|
|
70198
70210
|
data-tooltip-type="annotations-locked"
|
|
70199
70211
|
data-card-index="${index}"
|
|
70200
70212
|
title="Anota\xE7\xF5es \u2014 funcionalidade n\xE3o liberada ainda (em breve)"
|
|
70201
70213
|
style="opacity:.6;cursor:not-allowed;">
|
|
70202
|
-
<span class="icon">\u{1F4CB}</span> <span class="
|
|
70214
|
+
<span class="icon">\u{1F4CB}</span> <span class="count">\u{1F512}</span>
|
|
70203
70215
|
</span>` : "annotations" in meta ? `<span class="myio-welcome-card-device-count annotations"
|
|
70204
70216
|
data-tooltip-type="annotations"
|
|
70205
70217
|
data-card-index="${index}"
|
|
@@ -70487,47 +70499,107 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
70487
70499
|
);
|
|
70488
70500
|
}
|
|
70489
70501
|
static metaChip(text2) {
|
|
70490
|
-
return `<span
|
|
70491
|
-
}
|
|
70502
|
+
return `<span class="myio-welcome-meta-tip__chip">${_WelcomeModalView.escapeMetaHtml(text2)}</span>`;
|
|
70503
|
+
}
|
|
70504
|
+
// Mesmo padrão visual do EnergySummaryTooltip (card branco, header em degradê da cor do tipo,
|
|
70505
|
+
// banner de total, títulos de seção em caixa alta). Usuários segue a cor do tema do dashboard.
|
|
70506
|
+
static META_TIP_CSS = `
|
|
70507
|
+
.myio-welcome-meta-tip {
|
|
70508
|
+
position: fixed; z-index: 100000; width: 360px; max-width: calc(100vw - 16px);
|
|
70509
|
+
background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px;
|
|
70510
|
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.08);
|
|
70511
|
+
font: 12px 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
70512
|
+
color: #1e293b; overflow: hidden; display: none;
|
|
70513
|
+
}
|
|
70514
|
+
.myio-welcome-meta-tip__header {
|
|
70515
|
+
display: flex; align-items: center; gap: 8px; padding: 10px 14px;
|
|
70516
|
+
background: linear-gradient(90deg, var(--mt-bg1) 0%, var(--mt-bg2) 100%);
|
|
70517
|
+
border-bottom: 1px solid var(--mt-border);
|
|
70518
|
+
}
|
|
70519
|
+
.myio-welcome-meta-tip__icon { font-size: 18px; }
|
|
70520
|
+
.myio-welcome-meta-tip__title { flex: 1; font-weight: 700; font-size: 14px; color: var(--mt-accent); }
|
|
70521
|
+
.myio-welcome-meta-tip__timestamp { font-size: 10px; color: #6b7280; }
|
|
70522
|
+
.myio-welcome-meta-tip__close {
|
|
70523
|
+
width: 24px; height: 24px; border: none; border-radius: 4px; cursor: pointer;
|
|
70524
|
+
background: rgba(255, 255, 255, 0.6); color: #64748b;
|
|
70525
|
+
display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1;
|
|
70526
|
+
}
|
|
70527
|
+
.myio-welcome-meta-tip__close:hover { background: rgba(255, 255, 255, 0.9); color: #1e293b; }
|
|
70528
|
+
.myio-welcome-meta-tip__body { padding: 14px; max-height: 60vh; overflow-y: auto; }
|
|
70529
|
+
.myio-welcome-meta-tip__total {
|
|
70530
|
+
display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
|
|
70531
|
+
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
|
|
70532
|
+
border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 12px;
|
|
70533
|
+
}
|
|
70534
|
+
.myio-welcome-meta-tip__total-label { font-weight: 600; color: #475569; font-size: 12px; }
|
|
70535
|
+
.myio-welcome-meta-tip__total-value { font-weight: 700; font-size: 20px; color: #1e293b; }
|
|
70536
|
+
.myio-welcome-meta-tip__section-title {
|
|
70537
|
+
font-weight: 700; font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px;
|
|
70538
|
+
margin: 12px 0 6px; padding-bottom: 4px; border-bottom: 1px solid #e2e8f0;
|
|
70539
|
+
}
|
|
70540
|
+
.myio-welcome-meta-tip__chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
70541
|
+
.myio-welcome-meta-tip__chip {
|
|
70542
|
+
display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 11px;
|
|
70543
|
+
color: var(--mt-accent); background: var(--mt-bg1); border: 1px solid var(--mt-border);
|
|
70544
|
+
}
|
|
70545
|
+
.myio-welcome-meta-tip__row { padding: 7px 10px; border-radius: 6px; }
|
|
70546
|
+
.myio-welcome-meta-tip__row:nth-child(odd) { background: #f8fafc; }
|
|
70547
|
+
.myio-welcome-meta-tip__row-title { font-weight: 600; color: #1e293b; }
|
|
70548
|
+
.myio-welcome-meta-tip__row-sub { color: #64748b; font-size: 11px; margin-top: 1px; }
|
|
70549
|
+
.myio-welcome-meta-tip__empty { color: #64748b; padding: 6px 2px; }
|
|
70550
|
+
`;
|
|
70492
70551
|
ensureMetaTip() {
|
|
70493
70552
|
if (this.metaTipEl && document.body.contains(this.metaTipEl)) return this.metaTipEl;
|
|
70553
|
+
if (!document.getElementById("myio-welcome-meta-tip-styles")) {
|
|
70554
|
+
const style = document.createElement("style");
|
|
70555
|
+
style.id = "myio-welcome-meta-tip-styles";
|
|
70556
|
+
style.textContent = _WelcomeModalView.META_TIP_CSS;
|
|
70557
|
+
document.head.appendChild(style);
|
|
70558
|
+
}
|
|
70494
70559
|
const tip = document.createElement("div");
|
|
70495
70560
|
tip.className = "myio-welcome-meta-tip";
|
|
70496
|
-
Object.assign(tip.style, {
|
|
70497
|
-
position: "fixed",
|
|
70498
|
-
zIndex: "100000",
|
|
70499
|
-
minWidth: "260px",
|
|
70500
|
-
maxWidth: "360px",
|
|
70501
|
-
maxHeight: "60vh",
|
|
70502
|
-
overflow: "auto",
|
|
70503
|
-
background: "#1e293b",
|
|
70504
|
-
color: "#e2e8f0",
|
|
70505
|
-
border: "1px solid #334155",
|
|
70506
|
-
borderRadius: "10px",
|
|
70507
|
-
boxShadow: "0 12px 40px rgba(0,0,0,.45)",
|
|
70508
|
-
padding: "12px 14px",
|
|
70509
|
-
font: "12px 'Nunito', system-ui, -apple-system, sans-serif",
|
|
70510
|
-
display: "none"
|
|
70511
|
-
});
|
|
70512
70561
|
tip.addEventListener("mouseenter", () => {
|
|
70513
70562
|
if (this.metaTipHideTimer) clearTimeout(this.metaTipHideTimer);
|
|
70514
70563
|
});
|
|
70515
70564
|
tip.addEventListener("mouseleave", () => this.startMetaTipDelayedHide());
|
|
70565
|
+
tip.addEventListener("click", (e) => {
|
|
70566
|
+
if (e.target.closest(".myio-welcome-meta-tip__close")) this.hideMetaTip();
|
|
70567
|
+
});
|
|
70516
70568
|
document.body.appendChild(tip);
|
|
70517
70569
|
this.metaTipEl = tip;
|
|
70518
70570
|
return tip;
|
|
70519
70571
|
}
|
|
70572
|
+
/** Cores do tooltip por tipo de badge (usuários = cor do tema). */
|
|
70573
|
+
metaTipAccent(type) {
|
|
70574
|
+
if (type === "alarms") return { accent: "#b91c1c", bg1: "#fef2f2", bg2: "#fee2e2", border: "#fca5a5" };
|
|
70575
|
+
if (type.startsWith("annotations")) return { accent: "#5b21b6", bg1: "#f5f3ff", bg2: "#ede9fe", border: "#c4b5fd" };
|
|
70576
|
+
if (type === "notifications") return { accent: "#b45309", bg1: "#fffbeb", bg2: "#fef3c7", border: "#fcd34d" };
|
|
70577
|
+
const p = this.palette.primary || "#7A2FF7";
|
|
70578
|
+
return {
|
|
70579
|
+
accent: p,
|
|
70580
|
+
bg1: `color-mix(in srgb, ${p} 6%, white)`,
|
|
70581
|
+
bg2: `color-mix(in srgb, ${p} 16%, white)`,
|
|
70582
|
+
border: `color-mix(in srgb, ${p} 40%, white)`
|
|
70583
|
+
};
|
|
70584
|
+
}
|
|
70520
70585
|
showMetaTip(anchorEl, type, card) {
|
|
70521
70586
|
const tip = this.ensureMetaTip();
|
|
70522
70587
|
if (this.metaTipHideTimer) clearTimeout(this.metaTipHideTimer);
|
|
70588
|
+
const c = this.metaTipAccent(type);
|
|
70589
|
+
tip.style.setProperty("--mt-accent", c.accent);
|
|
70590
|
+
tip.style.setProperty("--mt-bg1", c.bg1);
|
|
70591
|
+
tip.style.setProperty("--mt-bg2", c.bg2);
|
|
70592
|
+
tip.style.setProperty("--mt-border", c.border);
|
|
70523
70593
|
tip.innerHTML = this.buildMetaTipHtml(type, card);
|
|
70524
70594
|
tip.style.display = "block";
|
|
70525
70595
|
const r = anchorEl.getBoundingClientRect();
|
|
70526
|
-
const tw = Math.min(360, window.innerWidth - 16);
|
|
70596
|
+
const tw = tip.offsetWidth || Math.min(360, window.innerWidth - 16);
|
|
70527
70597
|
let left = r.left;
|
|
70528
70598
|
if (left + tw > window.innerWidth - 8) left = window.innerWidth - tw - 8;
|
|
70529
70599
|
tip.style.left = Math.max(8, left) + "px";
|
|
70530
|
-
|
|
70600
|
+
const th = tip.offsetHeight;
|
|
70601
|
+
const below = r.bottom + 8;
|
|
70602
|
+
tip.style.top = (below + th > window.innerHeight - 8 ? Math.max(8, r.top - th - 8) : below) + "px";
|
|
70531
70603
|
}
|
|
70532
70604
|
startMetaTipDelayedHide() {
|
|
70533
70605
|
if (this.metaTipHideTimer) clearTimeout(this.metaTipHideTimer);
|
|
@@ -70545,56 +70617,88 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
70545
70617
|
const chip = _WelcomeModalView.metaChip;
|
|
70546
70618
|
const meta = card.metaCounts || {};
|
|
70547
70619
|
const details = card.metaDetails || {};
|
|
70548
|
-
const
|
|
70549
|
-
const
|
|
70550
|
-
|
|
70551
|
-
|
|
70552
|
-
|
|
70620
|
+
const now = /* @__PURE__ */ new Date();
|
|
70621
|
+
const stamp = `${String(now.getDate()).padStart(2, "0")}/${String(now.getMonth() + 1).padStart(2, "0")} ${String(
|
|
70622
|
+
now.getHours()
|
|
70623
|
+
).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
|
|
70624
|
+
const frame = (icon2, label, body) => `<div class="myio-welcome-meta-tip__header">
|
|
70625
|
+
<span class="myio-welcome-meta-tip__icon">${icon2}</span>
|
|
70626
|
+
<span class="myio-welcome-meta-tip__title">${label} (${esc8(card.title)})</span>
|
|
70627
|
+
<span class="myio-welcome-meta-tip__timestamp">${stamp}</span>
|
|
70628
|
+
<button type="button" class="myio-welcome-meta-tip__close" title="Fechar">\u2715</button>
|
|
70629
|
+
</div>
|
|
70630
|
+
<div class="myio-welcome-meta-tip__body">${body}</div>`;
|
|
70631
|
+
const total = (label, value) => `<div class="myio-welcome-meta-tip__total">
|
|
70632
|
+
<span class="myio-welcome-meta-tip__total-label">${label}</span>
|
|
70633
|
+
<span class="myio-welcome-meta-tip__total-value">${value}</span>
|
|
70553
70634
|
</div>`;
|
|
70635
|
+
const section = (title) => `<div class="myio-welcome-meta-tip__section-title">${title}</div>`;
|
|
70636
|
+
const empty = (text2) => `<div class="myio-welcome-meta-tip__empty">${text2}</div>`;
|
|
70637
|
+
const loadingBody = empty("Carregando\u2026");
|
|
70638
|
+
const row = (titleHtml, subHtml) => `<div class="myio-welcome-meta-tip__row">
|
|
70639
|
+
<div class="myio-welcome-meta-tip__row-title">${titleHtml}</div>
|
|
70640
|
+
${subHtml ? `<div class="myio-welcome-meta-tip__row-sub">${subHtml}</div>` : ""}
|
|
70641
|
+
</div>`;
|
|
70642
|
+
const more = (n) => n > 10 ? empty(`\u2026 e mais ${n - 10}`) : "";
|
|
70554
70643
|
if (type === "alarms") {
|
|
70555
|
-
if (meta.alarms === null) return
|
|
70644
|
+
if (meta.alarms === null) return frame("\u{1F6A8}", "Alarmes", loadingBody);
|
|
70556
70645
|
const alarms = details.alarms || [];
|
|
70557
70646
|
const byState = {};
|
|
70558
70647
|
for (const a of alarms) {
|
|
70559
70648
|
const s = a.state || "OPEN";
|
|
70560
70649
|
byState[s] = (byState[s] || 0) + 1;
|
|
70561
70650
|
}
|
|
70562
|
-
const chips = Object.entries(byState).map(([s, n]) => chip(`${s}: ${n}`)).join("")
|
|
70651
|
+
const chips = Object.entries(byState).map(([s, n]) => chip(`${s}: ${n}`)).join("");
|
|
70563
70652
|
const rows = alarms.slice(0, 10).map(
|
|
70564
70653
|
(a) => row(
|
|
70565
70654
|
esc8(a.deviceName ? `${a.deviceName} \u2014 ${a.title || "Alarme"}` : a.title || "Alarme"),
|
|
70566
|
-
|
|
70655
|
+
[a.severity, a.state].filter(Boolean).map(esc8).join(" \xB7 ")
|
|
70567
70656
|
)
|
|
70568
70657
|
).join("");
|
|
70569
|
-
return
|
|
70658
|
+
return frame(
|
|
70659
|
+
"\u{1F6A8}",
|
|
70660
|
+
"Alarmes",
|
|
70661
|
+
total("Total de Alarmes", meta.alarms ?? alarms.length) + (chips ? section("Por estado") + `<div class="myio-welcome-meta-tip__chips">${chips}</div>` : "") + section("Mais recentes") + (rows || empty("Sem alarmes ativos")) + more(alarms.length)
|
|
70662
|
+
);
|
|
70570
70663
|
}
|
|
70571
70664
|
if (type === "annotations-locked") {
|
|
70572
|
-
return
|
|
70665
|
+
return frame("\u{1F4CB}", "Anota\xE7\xF5es", empty("\u{1F512} Funcionalidade n\xE3o liberada ainda \u2014 em breve."));
|
|
70573
70666
|
}
|
|
70574
70667
|
if (type === "annotations") {
|
|
70575
|
-
if (meta.annotations === null) return
|
|
70668
|
+
if (meta.annotations === null) return frame("\u{1F4CB}", "Anota\xE7\xF5es", loadingBody);
|
|
70576
70669
|
const annotations = details.annotations || [];
|
|
70577
70670
|
const byType = {};
|
|
70578
70671
|
for (const a of annotations) {
|
|
70579
70672
|
const t = a.type || "observation";
|
|
70580
70673
|
byType[t] = (byType[t] || 0) + 1;
|
|
70581
70674
|
}
|
|
70582
|
-
const chips = Object.entries(byType).map(([t, n]) => chip(`${t}: ${n}`)).join("")
|
|
70675
|
+
const chips = Object.entries(byType).map(([t, n]) => chip(`${t}: ${n}`)).join("");
|
|
70583
70676
|
const rows = annotations.slice(0, 10).map((a) => {
|
|
70584
70677
|
const when = a.createdAt ? new Date(a.createdAt).toLocaleDateString("pt-BR") : "";
|
|
70585
70678
|
const text2 = a.text.length > 90 ? `${a.text.slice(0, 90)}\u2026` : a.text;
|
|
70586
70679
|
return row(esc8(a.deviceLabel || "Dispositivo"), `${esc8(text2)}${when ? ` \xB7 ${esc8(when)}` : ""}`);
|
|
70587
70680
|
}).join("");
|
|
70588
|
-
return
|
|
70681
|
+
return frame(
|
|
70682
|
+
"\u{1F4CB}",
|
|
70683
|
+
"Anota\xE7\xF5es",
|
|
70684
|
+
total("Total de Anota\xE7\xF5es", meta.annotations ?? annotations.length) + (chips ? section("Por tipo") + `<div class="myio-welcome-meta-tip__chips">${chips}</div>` : "") + section("Mais recentes") + (rows || empty("Sem anota\xE7\xF5es ativas")) + more(annotations.length)
|
|
70685
|
+
);
|
|
70589
70686
|
}
|
|
70590
70687
|
if (type === "users") {
|
|
70591
|
-
if (meta.users === null) return
|
|
70688
|
+
if (meta.users === null) return frame("\u{1F465}", "Usu\xE1rios", loadingBody);
|
|
70592
70689
|
const users = details.users || [];
|
|
70593
|
-
const rows = users.slice(0, 10).map((u) => row(esc8(u.name), esc8(u.email || ""))).join("")
|
|
70594
|
-
|
|
70595
|
-
|
|
70690
|
+
const rows = users.slice(0, 10).map((u) => row(esc8(u.name), esc8(u.email || ""))).join("");
|
|
70691
|
+
return frame(
|
|
70692
|
+
"\u{1F465}",
|
|
70693
|
+
"Usu\xE1rios",
|
|
70694
|
+
total("Total de Usu\xE1rios", meta.users ?? users.length) + section("Usu\xE1rios") + (rows || empty("Sem usu\xE1rios")) + more(users.length)
|
|
70695
|
+
);
|
|
70596
70696
|
}
|
|
70597
|
-
return
|
|
70697
|
+
return frame(
|
|
70698
|
+
"\u{1F514}",
|
|
70699
|
+
"Notifica\xE7\xF5es",
|
|
70700
|
+
total("Total de Notifica\xE7\xF5es", meta.notifications ?? 0) + empty("Sem notifica\xE7\xF5es")
|
|
70701
|
+
);
|
|
70598
70702
|
}
|
|
70599
70703
|
/**
|
|
70600
70704
|
* Handle tooltip icon click - shows the appropriate tooltip
|