myio-js-library 0.1.206 → 0.1.207

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
@@ -36300,14 +36300,18 @@ function injectCSS7() {
36300
36300
  document.head.appendChild(style);
36301
36301
  cssInjected7 = true;
36302
36302
  }
36303
+ var HIDE_DELAY_MS = 2500;
36304
+ var SAFETY_TIMEOUT_MS = 15e3;
36303
36305
  var state3 = {
36304
36306
  hideTimer: null,
36307
+ safetyTimer: null,
36305
36308
  isMouseOverTooltip: false,
36306
36309
  isMaximized: false,
36307
36310
  isDragging: false,
36308
36311
  dragOffset: { x: 0, y: 0 },
36309
36312
  savedPosition: null,
36310
- pinnedCounter: 0
36313
+ pinnedCounter: 0,
36314
+ isPinned: false
36311
36315
  };
36312
36316
  function generateHeaderHTML3(icon, title) {
36313
36317
  return `
@@ -36343,6 +36347,7 @@ function setupHoverListeners3(container) {
36343
36347
  clearTimeout(state3.hideTimer);
36344
36348
  state3.hideTimer = null;
36345
36349
  }
36350
+ resetSafetyTimer();
36346
36351
  };
36347
36352
  container.onmouseleave = () => {
36348
36353
  state3.isMouseOverTooltip = false;
@@ -36524,15 +36529,42 @@ function toggleMaximize3(container) {
36524
36529
  }
36525
36530
  }
36526
36531
  function startDelayedHide3() {
36527
- if (state3.isMouseOverTooltip) return;
36532
+ if (state3.isMouseOverTooltip || state3.isPinned) return;
36528
36533
  if (state3.hideTimer) {
36529
36534
  clearTimeout(state3.hideTimer);
36530
36535
  }
36531
36536
  state3.hideTimer = setTimeout(() => {
36532
36537
  hideWithAnimation3();
36533
- }, 1500);
36538
+ }, HIDE_DELAY_MS);
36539
+ }
36540
+ function resetSafetyTimer() {
36541
+ if (state3.safetyTimer) {
36542
+ clearTimeout(state3.safetyTimer);
36543
+ state3.safetyTimer = null;
36544
+ }
36545
+ const container = document.getElementById("myio-info-tooltip");
36546
+ if (container && container.classList.contains("visible") && !state3.isPinned) {
36547
+ state3.safetyTimer = setTimeout(() => {
36548
+ console.log("[InfoTooltip] Safety timeout reached - forcing hide");
36549
+ InfoTooltip.destroy();
36550
+ }, SAFETY_TIMEOUT_MS);
36551
+ }
36552
+ }
36553
+ function clearAllTimers() {
36554
+ if (state3.hideTimer) {
36555
+ clearTimeout(state3.hideTimer);
36556
+ state3.hideTimer = null;
36557
+ }
36558
+ if (state3.safetyTimer) {
36559
+ clearTimeout(state3.safetyTimer);
36560
+ state3.safetyTimer = null;
36561
+ }
36534
36562
  }
36535
36563
  function hideWithAnimation3() {
36564
+ if (state3.safetyTimer) {
36565
+ clearTimeout(state3.safetyTimer);
36566
+ state3.safetyTimer = null;
36567
+ }
36536
36568
  const container = document.getElementById("myio-info-tooltip");
36537
36569
  if (container && container.classList.contains("visible")) {
36538
36570
  container.classList.add("closing");
@@ -36577,12 +36609,10 @@ var InfoTooltip = {
36577
36609
  * Show tooltip
36578
36610
  */
36579
36611
  show(triggerElement, options) {
36580
- if (state3.hideTimer) {
36581
- clearTimeout(state3.hideTimer);
36582
- state3.hideTimer = null;
36583
- }
36612
+ clearAllTimers();
36584
36613
  const container = this.getContainer();
36585
36614
  container.classList.remove("closing");
36615
+ state3.isPinned = false;
36586
36616
  container.innerHTML = `
36587
36617
  <div class="myio-info-tooltip__panel">
36588
36618
  ${generateHeaderHTML3(options.icon, options.title)}
@@ -36596,6 +36626,7 @@ var InfoTooltip = {
36596
36626
  setupHoverListeners3(container);
36597
36627
  setupButtonListeners3(container);
36598
36628
  setupDragListeners3(container);
36629
+ resetSafetyTimer();
36599
36630
  },
36600
36631
  /**
36601
36632
  * Start delayed hide
@@ -36607,10 +36638,7 @@ var InfoTooltip = {
36607
36638
  * Hide immediately
36608
36639
  */
36609
36640
  hide() {
36610
- if (state3.hideTimer) {
36611
- clearTimeout(state3.hideTimer);
36612
- state3.hideTimer = null;
36613
- }
36641
+ clearAllTimers();
36614
36642
  state3.isMouseOverTooltip = false;
36615
36643
  const container = document.getElementById(this.containerId);
36616
36644
  if (container) {
@@ -36621,19 +36649,36 @@ var InfoTooltip = {
36621
36649
  * Close and reset all states
36622
36650
  */
36623
36651
  close() {
36652
+ clearAllTimers();
36624
36653
  state3.isMaximized = false;
36625
36654
  state3.isDragging = false;
36626
36655
  state3.savedPosition = null;
36627
- if (state3.hideTimer) {
36628
- clearTimeout(state3.hideTimer);
36629
- state3.hideTimer = null;
36630
- }
36631
36656
  state3.isMouseOverTooltip = false;
36657
+ state3.isPinned = false;
36632
36658
  const container = document.getElementById(this.containerId);
36633
36659
  if (container) {
36634
36660
  container.classList.remove("visible", "pinned", "maximized", "dragging", "closing");
36635
36661
  }
36636
36662
  },
36663
+ /**
36664
+ * Destroy tooltip completely - guaranteed cleanup
36665
+ * Removes from DOM and clears all timers/state
36666
+ */
36667
+ destroy() {
36668
+ clearAllTimers();
36669
+ state3.isMaximized = false;
36670
+ state3.isDragging = false;
36671
+ state3.savedPosition = null;
36672
+ state3.isMouseOverTooltip = false;
36673
+ state3.isPinned = false;
36674
+ const container = document.getElementById(this.containerId);
36675
+ if (container) {
36676
+ container.remove();
36677
+ }
36678
+ const pinnedClones = document.querySelectorAll('[id^="myio-info-tooltip-pinned-"]');
36679
+ pinnedClones.forEach((clone) => clone.remove());
36680
+ console.log("[InfoTooltip] Destroyed - all tooltips removed");
36681
+ },
36637
36682
  /**
36638
36683
  * Attach tooltip to trigger element with hover behavior
36639
36684
  */
package/dist/index.d.cts CHANGED
@@ -3522,6 +3522,11 @@ declare const InfoTooltip: {
3522
3522
  * Close and reset all states
3523
3523
  */
3524
3524
  close(): void;
3525
+ /**
3526
+ * Destroy tooltip completely - guaranteed cleanup
3527
+ * Removes from DOM and clears all timers/state
3528
+ */
3529
+ destroy(): void;
3525
3530
  /**
3526
3531
  * Attach tooltip to trigger element with hover behavior
3527
3532
  */
package/dist/index.js CHANGED
@@ -36128,14 +36128,18 @@ function injectCSS7() {
36128
36128
  document.head.appendChild(style);
36129
36129
  cssInjected7 = true;
36130
36130
  }
36131
+ var HIDE_DELAY_MS = 2500;
36132
+ var SAFETY_TIMEOUT_MS = 15e3;
36131
36133
  var state3 = {
36132
36134
  hideTimer: null,
36135
+ safetyTimer: null,
36133
36136
  isMouseOverTooltip: false,
36134
36137
  isMaximized: false,
36135
36138
  isDragging: false,
36136
36139
  dragOffset: { x: 0, y: 0 },
36137
36140
  savedPosition: null,
36138
- pinnedCounter: 0
36141
+ pinnedCounter: 0,
36142
+ isPinned: false
36139
36143
  };
36140
36144
  function generateHeaderHTML3(icon, title) {
36141
36145
  return `
@@ -36171,6 +36175,7 @@ function setupHoverListeners3(container) {
36171
36175
  clearTimeout(state3.hideTimer);
36172
36176
  state3.hideTimer = null;
36173
36177
  }
36178
+ resetSafetyTimer();
36174
36179
  };
36175
36180
  container.onmouseleave = () => {
36176
36181
  state3.isMouseOverTooltip = false;
@@ -36352,15 +36357,42 @@ function toggleMaximize3(container) {
36352
36357
  }
36353
36358
  }
36354
36359
  function startDelayedHide3() {
36355
- if (state3.isMouseOverTooltip) return;
36360
+ if (state3.isMouseOverTooltip || state3.isPinned) return;
36356
36361
  if (state3.hideTimer) {
36357
36362
  clearTimeout(state3.hideTimer);
36358
36363
  }
36359
36364
  state3.hideTimer = setTimeout(() => {
36360
36365
  hideWithAnimation3();
36361
- }, 1500);
36366
+ }, HIDE_DELAY_MS);
36367
+ }
36368
+ function resetSafetyTimer() {
36369
+ if (state3.safetyTimer) {
36370
+ clearTimeout(state3.safetyTimer);
36371
+ state3.safetyTimer = null;
36372
+ }
36373
+ const container = document.getElementById("myio-info-tooltip");
36374
+ if (container && container.classList.contains("visible") && !state3.isPinned) {
36375
+ state3.safetyTimer = setTimeout(() => {
36376
+ console.log("[InfoTooltip] Safety timeout reached - forcing hide");
36377
+ InfoTooltip.destroy();
36378
+ }, SAFETY_TIMEOUT_MS);
36379
+ }
36380
+ }
36381
+ function clearAllTimers() {
36382
+ if (state3.hideTimer) {
36383
+ clearTimeout(state3.hideTimer);
36384
+ state3.hideTimer = null;
36385
+ }
36386
+ if (state3.safetyTimer) {
36387
+ clearTimeout(state3.safetyTimer);
36388
+ state3.safetyTimer = null;
36389
+ }
36362
36390
  }
36363
36391
  function hideWithAnimation3() {
36392
+ if (state3.safetyTimer) {
36393
+ clearTimeout(state3.safetyTimer);
36394
+ state3.safetyTimer = null;
36395
+ }
36364
36396
  const container = document.getElementById("myio-info-tooltip");
36365
36397
  if (container && container.classList.contains("visible")) {
36366
36398
  container.classList.add("closing");
@@ -36405,12 +36437,10 @@ var InfoTooltip = {
36405
36437
  * Show tooltip
36406
36438
  */
36407
36439
  show(triggerElement, options) {
36408
- if (state3.hideTimer) {
36409
- clearTimeout(state3.hideTimer);
36410
- state3.hideTimer = null;
36411
- }
36440
+ clearAllTimers();
36412
36441
  const container = this.getContainer();
36413
36442
  container.classList.remove("closing");
36443
+ state3.isPinned = false;
36414
36444
  container.innerHTML = `
36415
36445
  <div class="myio-info-tooltip__panel">
36416
36446
  ${generateHeaderHTML3(options.icon, options.title)}
@@ -36424,6 +36454,7 @@ var InfoTooltip = {
36424
36454
  setupHoverListeners3(container);
36425
36455
  setupButtonListeners3(container);
36426
36456
  setupDragListeners3(container);
36457
+ resetSafetyTimer();
36427
36458
  },
36428
36459
  /**
36429
36460
  * Start delayed hide
@@ -36435,10 +36466,7 @@ var InfoTooltip = {
36435
36466
  * Hide immediately
36436
36467
  */
36437
36468
  hide() {
36438
- if (state3.hideTimer) {
36439
- clearTimeout(state3.hideTimer);
36440
- state3.hideTimer = null;
36441
- }
36469
+ clearAllTimers();
36442
36470
  state3.isMouseOverTooltip = false;
36443
36471
  const container = document.getElementById(this.containerId);
36444
36472
  if (container) {
@@ -36449,19 +36477,36 @@ var InfoTooltip = {
36449
36477
  * Close and reset all states
36450
36478
  */
36451
36479
  close() {
36480
+ clearAllTimers();
36452
36481
  state3.isMaximized = false;
36453
36482
  state3.isDragging = false;
36454
36483
  state3.savedPosition = null;
36455
- if (state3.hideTimer) {
36456
- clearTimeout(state3.hideTimer);
36457
- state3.hideTimer = null;
36458
- }
36459
36484
  state3.isMouseOverTooltip = false;
36485
+ state3.isPinned = false;
36460
36486
  const container = document.getElementById(this.containerId);
36461
36487
  if (container) {
36462
36488
  container.classList.remove("visible", "pinned", "maximized", "dragging", "closing");
36463
36489
  }
36464
36490
  },
36491
+ /**
36492
+ * Destroy tooltip completely - guaranteed cleanup
36493
+ * Removes from DOM and clears all timers/state
36494
+ */
36495
+ destroy() {
36496
+ clearAllTimers();
36497
+ state3.isMaximized = false;
36498
+ state3.isDragging = false;
36499
+ state3.savedPosition = null;
36500
+ state3.isMouseOverTooltip = false;
36501
+ state3.isPinned = false;
36502
+ const container = document.getElementById(this.containerId);
36503
+ if (container) {
36504
+ container.remove();
36505
+ }
36506
+ const pinnedClones = document.querySelectorAll('[id^="myio-info-tooltip-pinned-"]');
36507
+ pinnedClones.forEach((clone) => clone.remove());
36508
+ console.log("[InfoTooltip] Destroyed - all tooltips removed");
36509
+ },
36465
36510
  /**
36466
36511
  * Attach tooltip to trigger element with hover behavior
36467
36512
  */
@@ -35942,14 +35942,18 @@
35942
35942
  document.head.appendChild(style);
35943
35943
  cssInjected7 = true;
35944
35944
  }
35945
+ var HIDE_DELAY_MS = 2500;
35946
+ var SAFETY_TIMEOUT_MS = 15e3;
35945
35947
  var state3 = {
35946
35948
  hideTimer: null,
35949
+ safetyTimer: null,
35947
35950
  isMouseOverTooltip: false,
35948
35951
  isMaximized: false,
35949
35952
  isDragging: false,
35950
35953
  dragOffset: { x: 0, y: 0 },
35951
35954
  savedPosition: null,
35952
- pinnedCounter: 0
35955
+ pinnedCounter: 0,
35956
+ isPinned: false
35953
35957
  };
35954
35958
  function generateHeaderHTML3(icon, title) {
35955
35959
  return `
@@ -35985,6 +35989,7 @@
35985
35989
  clearTimeout(state3.hideTimer);
35986
35990
  state3.hideTimer = null;
35987
35991
  }
35992
+ resetSafetyTimer();
35988
35993
  };
35989
35994
  container.onmouseleave = () => {
35990
35995
  state3.isMouseOverTooltip = false;
@@ -36166,15 +36171,42 @@
36166
36171
  }
36167
36172
  }
36168
36173
  function startDelayedHide3() {
36169
- if (state3.isMouseOverTooltip) return;
36174
+ if (state3.isMouseOverTooltip || state3.isPinned) return;
36170
36175
  if (state3.hideTimer) {
36171
36176
  clearTimeout(state3.hideTimer);
36172
36177
  }
36173
36178
  state3.hideTimer = setTimeout(() => {
36174
36179
  hideWithAnimation3();
36175
- }, 1500);
36180
+ }, HIDE_DELAY_MS);
36181
+ }
36182
+ function resetSafetyTimer() {
36183
+ if (state3.safetyTimer) {
36184
+ clearTimeout(state3.safetyTimer);
36185
+ state3.safetyTimer = null;
36186
+ }
36187
+ const container = document.getElementById("myio-info-tooltip");
36188
+ if (container && container.classList.contains("visible") && !state3.isPinned) {
36189
+ state3.safetyTimer = setTimeout(() => {
36190
+ console.log("[InfoTooltip] Safety timeout reached - forcing hide");
36191
+ InfoTooltip.destroy();
36192
+ }, SAFETY_TIMEOUT_MS);
36193
+ }
36194
+ }
36195
+ function clearAllTimers() {
36196
+ if (state3.hideTimer) {
36197
+ clearTimeout(state3.hideTimer);
36198
+ state3.hideTimer = null;
36199
+ }
36200
+ if (state3.safetyTimer) {
36201
+ clearTimeout(state3.safetyTimer);
36202
+ state3.safetyTimer = null;
36203
+ }
36176
36204
  }
36177
36205
  function hideWithAnimation3() {
36206
+ if (state3.safetyTimer) {
36207
+ clearTimeout(state3.safetyTimer);
36208
+ state3.safetyTimer = null;
36209
+ }
36178
36210
  const container = document.getElementById("myio-info-tooltip");
36179
36211
  if (container && container.classList.contains("visible")) {
36180
36212
  container.classList.add("closing");
@@ -36219,12 +36251,10 @@
36219
36251
  * Show tooltip
36220
36252
  */
36221
36253
  show(triggerElement, options) {
36222
- if (state3.hideTimer) {
36223
- clearTimeout(state3.hideTimer);
36224
- state3.hideTimer = null;
36225
- }
36254
+ clearAllTimers();
36226
36255
  const container = this.getContainer();
36227
36256
  container.classList.remove("closing");
36257
+ state3.isPinned = false;
36228
36258
  container.innerHTML = `
36229
36259
  <div class="myio-info-tooltip__panel">
36230
36260
  ${generateHeaderHTML3(options.icon, options.title)}
@@ -36238,6 +36268,7 @@
36238
36268
  setupHoverListeners3(container);
36239
36269
  setupButtonListeners3(container);
36240
36270
  setupDragListeners3(container);
36271
+ resetSafetyTimer();
36241
36272
  },
36242
36273
  /**
36243
36274
  * Start delayed hide
@@ -36249,10 +36280,7 @@
36249
36280
  * Hide immediately
36250
36281
  */
36251
36282
  hide() {
36252
- if (state3.hideTimer) {
36253
- clearTimeout(state3.hideTimer);
36254
- state3.hideTimer = null;
36255
- }
36283
+ clearAllTimers();
36256
36284
  state3.isMouseOverTooltip = false;
36257
36285
  const container = document.getElementById(this.containerId);
36258
36286
  if (container) {
@@ -36263,19 +36291,36 @@
36263
36291
  * Close and reset all states
36264
36292
  */
36265
36293
  close() {
36294
+ clearAllTimers();
36266
36295
  state3.isMaximized = false;
36267
36296
  state3.isDragging = false;
36268
36297
  state3.savedPosition = null;
36269
- if (state3.hideTimer) {
36270
- clearTimeout(state3.hideTimer);
36271
- state3.hideTimer = null;
36272
- }
36273
36298
  state3.isMouseOverTooltip = false;
36299
+ state3.isPinned = false;
36274
36300
  const container = document.getElementById(this.containerId);
36275
36301
  if (container) {
36276
36302
  container.classList.remove("visible", "pinned", "maximized", "dragging", "closing");
36277
36303
  }
36278
36304
  },
36305
+ /**
36306
+ * Destroy tooltip completely - guaranteed cleanup
36307
+ * Removes from DOM and clears all timers/state
36308
+ */
36309
+ destroy() {
36310
+ clearAllTimers();
36311
+ state3.isMaximized = false;
36312
+ state3.isDragging = false;
36313
+ state3.savedPosition = null;
36314
+ state3.isMouseOverTooltip = false;
36315
+ state3.isPinned = false;
36316
+ const container = document.getElementById(this.containerId);
36317
+ if (container) {
36318
+ container.remove();
36319
+ }
36320
+ const pinnedClones = document.querySelectorAll('[id^="myio-info-tooltip-pinned-"]');
36321
+ pinnedClones.forEach((clone) => clone.remove());
36322
+ console.log("[InfoTooltip] Destroyed - all tooltips removed");
36323
+ },
36279
36324
  /**
36280
36325
  * Attach tooltip to trigger element with hover behavior
36281
36326
  */