myio-js-library 0.1.509 → 0.1.511

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 CHANGED
@@ -1193,7 +1193,7 @@ module.exports = __toCommonJS(index_exports);
1193
1193
  // package.json
1194
1194
  var package_default = {
1195
1195
  name: "myio-js-library",
1196
- version: "0.1.509",
1196
+ version: "0.1.511",
1197
1197
  description: "A clean, standalone JS SDK for MYIO projects",
1198
1198
  license: "MIT",
1199
1199
  repository: "github:gh-myio/myio-js-library",
@@ -141997,7 +141997,16 @@ var CustomerDeviceService = class {
141997
141997
  this.concurrency = cfg.concurrency ?? 5;
141998
141998
  this.chunkDelayMs = cfg.chunkDelayMs ?? 50;
141999
141999
  this.maxRetries = cfg.maxRetries ?? 3;
142000
- this.logger = cfg.logger ?? console;
142000
+ const raw = cfg.logger ?? console;
142001
+ const noop = () => {
142002
+ };
142003
+ const log = raw.log || noop;
142004
+ this.logger = {
142005
+ debug: raw.debug || log,
142006
+ info: raw.info || log,
142007
+ warn: raw.warn || log,
142008
+ error: raw.error || log
142009
+ };
142001
142010
  }
142002
142011
  get headers() {
142003
142012
  return {
@@ -142196,8 +142205,19 @@ var DOMAIN_LABELS2 = {
142196
142205
  unknown: "Indeterminado"
142197
142206
  };
142198
142207
  var BUCKET_NO_IDENTIFIER = "Sem Identificador";
142208
+ function _normalizeLogger(raw) {
142209
+ const noop = () => {
142210
+ };
142211
+ const log = raw && raw.log || noop;
142212
+ return {
142213
+ debug: raw?.debug || log,
142214
+ info: raw?.info || log,
142215
+ warn: raw?.warn || log,
142216
+ error: raw?.error || log
142217
+ };
142218
+ }
142199
142219
  async function buildAnnotationServiceOrchestrator(params) {
142200
- const logger = params.logger ?? console;
142220
+ const logger = _normalizeLogger(params.logger ?? console);
142201
142221
  const cacheTtlMs = params.cacheTtlMs ?? 6e4;
142202
142222
  const client = new CustomerDeviceService({
142203
142223
  customerId: params.customerId,
@@ -142539,28 +142559,44 @@ var HEADER_ANNOTATIONS_STYLES = `
142539
142559
  align-items: center;
142540
142560
  gap: 4px;
142541
142561
  }
142562
+ /* Header action buttons \u2014 mirror src/utils/InfoTooltip.ts pattern
142563
+ (24\xD724 button with white-ish bg, SVG 14\xD714, slate hover, emerald
142564
+ pinned state). RFC-0203 M7 follow-up: alignment with InfoTooltip. */
142542
142565
  .myio-annotations-panel-action {
142543
- width: 28px;
142544
- height: 28px;
142566
+ width: 24px;
142567
+ height: 24px;
142568
+ border: none;
142569
+ background: rgba(255, 255, 255, 0.7);
142570
+ border-radius: 4px;
142571
+ cursor: pointer;
142545
142572
  display: inline-flex;
142546
142573
  align-items: center;
142547
142574
  justify-content: center;
142548
- border: 1px solid transparent;
142549
- border-radius: 6px;
142550
- background: transparent;
142575
+ transition: background 0.15s ease, color 0.15s ease;
142551
142576
  color: #64748b;
142552
- cursor: pointer;
142553
- font-size: 14px;
142554
- transition: background 0.15s, color 0.15s;
142577
+ padding: 0;
142555
142578
  }
142556
142579
  .myio-annotations-panel-action:hover {
142557
- background: rgba(108, 92, 231, 0.1);
142558
- color: #4c3aac;
142580
+ background: rgba(255, 255, 255, 0.95);
142581
+ color: #1e293b;
142559
142582
  }
142560
142583
  .myio-annotations-panel-action:focus-visible {
142561
142584
  outline: 2px solid #6c5ce7;
142562
142585
  outline-offset: 2px;
142563
142586
  }
142587
+ /* Pinned state \u2014 emerald-700, matches InfoTooltip */
142588
+ .myio-annotations-panel-action.pinned {
142589
+ background: #047857;
142590
+ color: #ffffff;
142591
+ }
142592
+ .myio-annotations-panel-action.pinned:hover {
142593
+ background: #065f46;
142594
+ }
142595
+ .myio-annotations-panel-action svg {
142596
+ width: 14px;
142597
+ height: 14px;
142598
+ display: block;
142599
+ }
142564
142600
 
142565
142601
  /* Tabs */
142566
142602
  .myio-annotations-tabs {
@@ -142619,6 +142655,25 @@ var HEADER_ANNOTATIONS_STYLES = `
142619
142655
  padding-bottom: 6px;
142620
142656
  }
142621
142657
  .myio-annotations-toolbar-count { font-weight: 600; }
142658
+ .myio-annotations-toolbar-spacer { flex: 1; }
142659
+ .myio-annotations-toolbar-mini {
142660
+ font: inherit;
142661
+ font-size: 11px;
142662
+ font-weight: 600;
142663
+ color: #64748b;
142664
+ background: transparent;
142665
+ border: 1px solid #e2e8f0;
142666
+ border-radius: 4px;
142667
+ padding: 2px 8px;
142668
+ margin-left: 4px;
142669
+ cursor: pointer;
142670
+ transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
142671
+ }
142672
+ .myio-annotations-toolbar-mini:hover {
142673
+ background: rgba(108, 92, 231, 0.08);
142674
+ color: #4c3aac;
142675
+ border-color: rgba(108, 92, 231, 0.3);
142676
+ }
142622
142677
 
142623
142678
  .myio-annotations-toolbar-search {
142624
142679
  flex: 1;
@@ -142775,6 +142830,26 @@ var HEADER_ANNOTATIONS_STYLES = `
142775
142830
  font-size: 12px;
142776
142831
  font-weight: 700;
142777
142832
  color: #334155;
142833
+ cursor: pointer;
142834
+ user-select: none;
142835
+ transition: background 0.15s ease;
142836
+ }
142837
+ .myio-annotations-group-header:hover {
142838
+ background: #f1f5f9;
142839
+ }
142840
+ .myio-annotations-group-header:focus-visible {
142841
+ outline: 2px solid #6c5ce7;
142842
+ outline-offset: -2px;
142843
+ }
142844
+ .myio-annotations-group-chevron {
142845
+ display: inline-block;
142846
+ width: 10px;
142847
+ font-size: 10px;
142848
+ color: #94a3b8;
142849
+ transition: transform 0.15s ease;
142850
+ }
142851
+ .myio-annotations-group.is-collapsed .myio-annotations-group-header {
142852
+ border-bottom-color: transparent;
142778
142853
  }
142779
142854
  .myio-annotations-group-icon { font-size: 14px; }
142780
142855
  .myio-annotations-group-label { flex: 1; }
@@ -142792,13 +142867,21 @@ var HEADER_ANNOTATIONS_STYLES = `
142792
142867
  border-bottom-color: #fde68a;
142793
142868
  }
142794
142869
 
142795
- /* Item */
142870
+ /* Item \u2014 rendered as <button>, so must reset UA defaults
142871
+ (RFC-0203 M7 follow-up: black border + non-100% width came from
142872
+ browser default button styling). */
142796
142873
  .myio-annotations-item {
142797
142874
  display: grid;
142798
142875
  grid-template-columns: 22px 1fr auto;
142799
142876
  gap: 10px;
142800
142877
  padding: 10px 12px;
142878
+ width: 100%;
142879
+ border: none;
142801
142880
  border-bottom: 1px solid #f1f5f9;
142881
+ background: transparent;
142882
+ color: inherit;
142883
+ font: inherit;
142884
+ text-align: left;
142802
142885
  cursor: pointer;
142803
142886
  transition: background 0.12s;
142804
142887
  }
@@ -143739,7 +143822,7 @@ function _formatDate(iso) {
143739
143822
  // src/components/header-annotations-panel/HeaderAnnotationsPanel.ts
143740
143823
  var TABS = [
143741
143824
  { id: "identifier", label: "Por Identificador" },
143742
- { id: "device", label: "Por Device" },
143825
+ { id: "device", label: "Por Dispositivo" },
143743
143826
  { id: "domain", label: "Por Dom\xEDnio" }
143744
143827
  ];
143745
143828
  var TAB_STORAGE_KEY = "myio.annotations.activeTab";
@@ -143753,6 +143836,8 @@ var HeaderAnnotationsPanel = class {
143753
143836
  sortBy = DEFAULT_SORT;
143754
143837
  filter = createDefaultFilter();
143755
143838
  isOpen = false;
143839
+ // RFC-0203 follow-up — collapsible group state per (tab,key). Default: expanded.
143840
+ collapsedKeys = /* @__PURE__ */ new Set();
143756
143841
  // RFC-0203 M6 — Tooltip behaviors state
143757
143842
  isPinned = false;
143758
143843
  isMaximized = false;
@@ -144070,28 +144155,47 @@ var HeaderAnnotationsPanel = class {
144070
144155
  const bodyHtml = this._renderBody(groups);
144071
144156
  return `
144072
144157
  <div class="myio-annotations-panel-header" data-region="header" data-drag-handle>
144073
- <h2 class="myio-annotations-panel-title" id="${PANEL_DOM_ID}-title">
144074
- <span class="myio-annotations-icon" aria-hidden="true">\u{1F4CB}</span>Anota\xE7\xF5es
144075
- </h2>
144158
+ <span class="myio-annotations-icon" aria-hidden="true">\u{1F4CB}</span>
144159
+ <h2 class="myio-annotations-panel-title" id="${PANEL_DOM_ID}-title">Anota\xE7\xF5es</h2>
144076
144160
  <span class="myio-annotations-panel-meta">${totalAllUnfiltered} ativas \xB7 ${pending} pendentes \xB7 ${overdue} vencidas</span>
144077
144161
  <div class="myio-annotations-panel-actions">
144078
144162
  <button
144079
- class="myio-annotations-panel-action ${this.isMaximized ? "is-active" : ""}"
144163
+ class="myio-annotations-panel-action ${this.isPinned ? "pinned" : ""}"
144164
+ type="button"
144165
+ data-action="pin"
144166
+ title="${this.isPinned ? "Desafixar" : "Fixar na tela"}"
144167
+ aria-label="${this.isPinned ? "Desafixar painel" : "Fixar painel"}"
144168
+ aria-pressed="${this.isPinned}"
144169
+ >
144170
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
144171
+ <path d="M9 4v6l-2 4v2h10v-2l-2-4V4"/>
144172
+ <line x1="12" y1="16" x2="12" y2="21"/>
144173
+ <line x1="8" y1="4" x2="16" y2="4"/>
144174
+ </svg>
144175
+ </button>
144176
+ <button
144177
+ class="myio-annotations-panel-action"
144080
144178
  type="button"
144081
144179
  data-action="maximize"
144082
144180
  title="${this.isMaximized ? "Restaurar" : "Maximizar"}"
144083
144181
  aria-label="${this.isMaximized ? "Restaurar tamanho" : "Maximizar painel"}"
144084
144182
  aria-pressed="${this.isMaximized}"
144085
- >${this.isMaximized ? "\u{1F5D7}" : "\u2922"}</button>
144183
+ >
144184
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
144185
+ <rect x="3" y="3" width="18" height="18" rx="2"/>
144186
+ </svg>
144187
+ </button>
144086
144188
  <button
144087
- class="myio-annotations-panel-action ${this.isPinned ? "is-active" : ""}"
144189
+ class="myio-annotations-panel-action"
144088
144190
  type="button"
144089
- data-action="pin"
144090
- title="${this.isPinned ? "Desafixar" : "Afixar painel"}"
144091
- aria-label="${this.isPinned ? "Desafixar painel" : "Afixar painel"}"
144092
- aria-pressed="${this.isPinned}"
144093
- >\u{1F4CC}</button>
144094
- <button class="myio-annotations-panel-action" type="button" data-action="close" title="Fechar" aria-label="Fechar painel">\u2715</button>
144191
+ data-action="close"
144192
+ title="Fechar"
144193
+ aria-label="Fechar painel"
144194
+ >
144195
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
144196
+ <path d="M18 6L6 18M6 6l12 12"/>
144197
+ </svg>
144198
+ </button>
144095
144199
  </div>
144096
144200
  </div>
144097
144201
  <div class="myio-annotations-tabs" role="tablist" aria-label="Modo de agrupamento">${tabsHtml}</div>
@@ -144138,6 +144242,9 @@ ${this._renderToolbar(filteredCount, totalAllUnfiltered)}
144138
144242
  </div>
144139
144243
  <div class="myio-annotations-toolbar-row myio-annotations-toolbar-meta">
144140
144244
  <span class="myio-annotations-toolbar-count">${showingHtml}</span>
144245
+ <span class="myio-annotations-toolbar-spacer"></span>
144246
+ <button type="button" class="myio-annotations-toolbar-mini" data-action="expand-all" title="Expandir todos os grupos">\u25BC Expandir tudo</button>
144247
+ <button type="button" class="myio-annotations-toolbar-mini" data-action="collapse-all" title="Recolher todos os grupos">\u25B6 Recolher tudo</button>
144141
144248
  </div>
144142
144249
  <div id="myio-anno-filters" class="myio-annotations-filters" hidden>${this._renderFilters()}</div>
144143
144250
  </div>`;
@@ -144209,17 +144316,56 @@ ${this._renderToolbar(filteredCount, totalAllUnfiltered)}
144209
144316
  const items = group.devices.flatMap(
144210
144317
  (d) => d.annotations.map((a) => renderAnnotationItemCard(d, a, term))
144211
144318
  );
144212
- const groupClass = isNoIdentifier ? "myio-annotations-group myio-annotations-group--no-id" : "myio-annotations-group";
144319
+ const compoundKey = `${this.activeTab}::${group.key}`;
144320
+ const isCollapsed = this.collapsedKeys.has(compoundKey);
144321
+ const baseClass = isNoIdentifier ? "myio-annotations-group myio-annotations-group--no-id" : "myio-annotations-group";
144322
+ const groupClass = isCollapsed ? `${baseClass} is-collapsed` : baseClass;
144323
+ const itemsHtml = isCollapsed ? `<div class="myio-annotations-items" hidden></div>` : `<div class="myio-annotations-items">${items.join("\n")}</div>`;
144213
144324
  return `
144214
144325
  <section class="${groupClass}">
144215
- <header class="myio-annotations-group-header">
144326
+ <header class="myio-annotations-group-header" role="button" tabindex="0"
144327
+ data-group-toggle="${escapeHtml6(group.key)}"
144328
+ aria-expanded="${!isCollapsed}"
144329
+ title="${isCollapsed ? "Expandir grupo" : "Recolher grupo"}">
144330
+ <span class="myio-annotations-group-chevron" aria-hidden="true">${isCollapsed ? "\u25B6" : "\u25BC"}</span>
144216
144331
  ${group.icon ? `<span class="myio-annotations-group-icon" aria-hidden="true">${escapeHtml6(group.icon)}</span>` : ""}
144217
144332
  <span class="myio-annotations-group-label">${escapeHtml6(group.label)}</span>
144218
144333
  <span class="myio-annotations-group-count">${group.totalAnnotations}</span>
144219
144334
  </header>
144220
- ${items.join("\n")}
144335
+ ${itemsHtml}
144221
144336
  </section>`;
144222
144337
  }
144338
+ /** Toggle a single group's collapsed state (scoped to current tab). */
144339
+ _toggleGroupCollapsed(groupKey) {
144340
+ const compoundKey = `${this.activeTab}::${groupKey}`;
144341
+ if (this.collapsedKeys.has(compoundKey)) {
144342
+ this.collapsedKeys.delete(compoundKey);
144343
+ } else {
144344
+ this.collapsedKeys.add(compoundKey);
144345
+ }
144346
+ if (this.isOpen) this._render();
144347
+ }
144348
+ /** Expand every group in the current tab. */
144349
+ _expandAll() {
144350
+ const prefix = `${this.activeTab}::`;
144351
+ let changed = false;
144352
+ for (const k of Array.from(this.collapsedKeys)) {
144353
+ if (k.startsWith(prefix)) {
144354
+ this.collapsedKeys.delete(k);
144355
+ changed = true;
144356
+ }
144357
+ }
144358
+ if (changed && this.isOpen) this._render();
144359
+ }
144360
+ /** Collapse every group in the current tab. */
144361
+ _collapseAll() {
144362
+ const orch = this.opts.getOrchestrator();
144363
+ if (!orch) return;
144364
+ const rawGroups = orch.getGroups(this.activeTab, this.filter);
144365
+ const prefix = `${this.activeTab}::`;
144366
+ for (const g of rawGroups) this.collapsedKeys.add(`${prefix}${g.key}`);
144367
+ if (this.isOpen) this._render();
144368
+ }
144223
144369
  _bindInteractiveElements() {
144224
144370
  if (!this.root) return;
144225
144371
  const tabBtns = Array.from(this.root.querySelectorAll(".myio-annotations-tab"));
@@ -144291,6 +144437,22 @@ ${this._renderToolbar(filteredCount, totalAllUnfiltered)}
144291
144437
  if (exportBtn) {
144292
144438
  exportBtn.addEventListener("click", () => this._openExportFlow());
144293
144439
  }
144440
+ const expandAllBtn = this.root.querySelector('[data-action="expand-all"]');
144441
+ if (expandAllBtn) expandAllBtn.addEventListener("click", () => this._expandAll());
144442
+ const collapseAllBtn = this.root.querySelector('[data-action="collapse-all"]');
144443
+ if (collapseAllBtn) collapseAllBtn.addEventListener("click", () => this._collapseAll());
144444
+ const groupHeaders = this.root.querySelectorAll("[data-group-toggle]");
144445
+ groupHeaders.forEach((h) => {
144446
+ const key = h.getAttribute("data-group-toggle") || "";
144447
+ h.addEventListener("click", () => this._toggleGroupCollapsed(key));
144448
+ h.addEventListener("keydown", (e) => {
144449
+ const ke = e;
144450
+ if (ke.key === "Enter" || ke.key === " ") {
144451
+ ke.preventDefault();
144452
+ this._toggleGroupCollapsed(key);
144453
+ }
144454
+ });
144455
+ });
144294
144456
  const searchInput = this.root.querySelector('[data-input="search"]');
144295
144457
  if (searchInput) {
144296
144458
  searchInput.addEventListener("input", () => {
package/dist/index.d.cts CHANGED
@@ -19351,11 +19351,6 @@ interface BuildAnnotationServiceOrchestratorParams {
19351
19351
  * (AC-9 and AC-10 live in CustomerDeviceService.)
19352
19352
  */
19353
19353
 
19354
- /**
19355
- * Async factory. Fetches devices + attributes, parses log_annotations, builds
19356
- * indices, registers the `myio:annotation-changed` listener, and returns the
19357
- * orchestrator object.
19358
- */
19359
19354
  declare function buildAnnotationServiceOrchestrator(params: BuildAnnotationServiceOrchestratorParams): Promise<AnnotationServiceOrchestratorShape>;
19360
19355
 
19361
19356
  interface TbDeviceInfoFlat {
@@ -19494,6 +19489,7 @@ declare class HeaderAnnotationsPanel {
19494
19489
  private sortBy;
19495
19490
  private filter;
19496
19491
  private isOpen;
19492
+ private collapsedKeys;
19497
19493
  private isPinned;
19498
19494
  private isMaximized;
19499
19495
  private isDragging;
@@ -19551,6 +19547,12 @@ declare class HeaderAnnotationsPanel {
19551
19547
  private _activeFilterCount;
19552
19548
  private _renderBody;
19553
19549
  private _renderGroup;
19550
+ /** Toggle a single group's collapsed state (scoped to current tab). */
19551
+ private _toggleGroupCollapsed;
19552
+ /** Expand every group in the current tab. */
19553
+ private _expandAll;
19554
+ /** Collapse every group in the current tab. */
19555
+ private _collapseAll;
19554
19556
  private _bindInteractiveElements;
19555
19557
  /** After a re-render triggered by a filter checkbox, re-open the filter panel
19556
19558
  * so the user keeps the context visible. */