@colyseus/sdk 0.17.40 → 0.17.41

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.
Files changed (47) hide show
  1. package/build/3rd_party/discord.cjs +1 -1
  2. package/build/3rd_party/discord.mjs +1 -1
  3. package/build/Auth.cjs +1 -1
  4. package/build/Auth.mjs +1 -1
  5. package/build/Client.cjs +1 -1
  6. package/build/Client.mjs +1 -1
  7. package/build/Connection.cjs +1 -1
  8. package/build/Connection.mjs +1 -1
  9. package/build/HTTP.cjs +1 -1
  10. package/build/HTTP.mjs +1 -1
  11. package/build/Room.cjs +1 -1
  12. package/build/Room.mjs +1 -1
  13. package/build/Storage.cjs +1 -1
  14. package/build/Storage.mjs +1 -1
  15. package/build/core/nanoevents.cjs +1 -1
  16. package/build/core/nanoevents.mjs +1 -1
  17. package/build/core/signal.cjs +1 -1
  18. package/build/core/signal.mjs +1 -1
  19. package/build/core/utils.cjs +1 -1
  20. package/build/core/utils.mjs +1 -1
  21. package/build/debug.cjs +70 -44
  22. package/build/debug.cjs.map +1 -1
  23. package/build/debug.mjs +70 -44
  24. package/build/debug.mjs.map +1 -1
  25. package/build/errors/Errors.cjs +1 -1
  26. package/build/errors/Errors.mjs +1 -1
  27. package/build/fetchXHR.cjs +1 -1
  28. package/build/fetchXHR.mjs +1 -1
  29. package/build/index.cjs +1 -1
  30. package/build/index.mjs +1 -1
  31. package/build/legacy.cjs +1 -1
  32. package/build/legacy.mjs +1 -1
  33. package/build/serializer/NoneSerializer.cjs +1 -1
  34. package/build/serializer/NoneSerializer.mjs +1 -1
  35. package/build/serializer/SchemaSerializer.cjs +1 -1
  36. package/build/serializer/SchemaSerializer.mjs +1 -1
  37. package/build/serializer/Serializer.cjs +1 -1
  38. package/build/serializer/Serializer.mjs +1 -1
  39. package/build/transport/H3Transport.cjs +1 -1
  40. package/build/transport/H3Transport.mjs +1 -1
  41. package/build/transport/WebSocketTransport.cjs +1 -1
  42. package/build/transport/WebSocketTransport.mjs +1 -1
  43. package/dist/colyseus.js +1 -1
  44. package/dist/debug.js +70 -44
  45. package/dist/debug.js.map +1 -1
  46. package/package.json +3 -3
  47. package/src/debug.ts +69 -43
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  /**
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  /**
8
8
  * Discord Embedded App SDK
9
9
  * https://github.com/colyseus/colyseus/issues/707
package/build/Auth.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/Auth.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  import { getItem, removeItem, setItem } from './Storage.mjs';
8
8
  import { createNanoEvents } from './core/nanoevents.mjs';
9
9
 
package/build/Client.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/Client.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  import { Protocol, CloseCode } from '@colyseus/shared-types';
8
8
  import { ServerError, MatchMakeError } from './errors/Errors.mjs';
9
9
  import { Room } from './Room.mjs';
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  import { H3TransportTransport } from './transport/H3Transport.mjs';
8
8
  import { WebSocketTransport } from './transport/WebSocketTransport.mjs';
9
9
  import { CloseCode } from '@colyseus/shared-types';
package/build/HTTP.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/HTTP.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  import { ServerError } from './errors/Errors.mjs';
8
8
  import { xhrFetch } from './fetchXHR.mjs';
9
9
 
package/build/Room.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/Room.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  import { CloseCode, Protocol } from '@colyseus/shared-types';
8
8
  import { Decoder, encode, decode } from '@colyseus/schema';
9
9
  import { Packr, unpack } from '@colyseus/msgpackr';
package/build/Storage.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
package/build/Storage.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  /// <reference path="../typings/cocos-creator.d.ts" />
8
8
  /**
9
9
  * We do not assign 'storage' to window.localStorage immediatelly for React
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  /**
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  /**
8
8
  * The MIT License (MIT)
9
9
  *
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  class EventEmitter {
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  class EventEmitter {
8
8
  handlers = [];
9
9
  register(cb, once = false) {
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  function now() {
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  function now() {
8
8
  return typeof (performance) !== 'undefined' ? performance.now() : Date.now();
9
9
  }
package/build/debug.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // This software is released under the MIT License.
4
4
  // https://opensource.org/license/MIT
5
5
  //
6
- // colyseus.js@0.17.40
6
+ // colyseus.js@0.17.41
7
7
  'use strict';
8
8
 
9
9
  var Client = require('./Client.cjs');
@@ -88,6 +88,19 @@ let modalStack = [];
88
88
  const BASE_MODAL_ZINDEX = 10000;
89
89
  // Load preferences on script load
90
90
  loadPreferences();
91
+ // Shadow DOM root — isolates all debug UI from page-level CSS.
92
+ // Every SDK element is appended here so page rules like `canvas { width: 100vw }`
93
+ // can't reach (or stretch) the debug panel's sparklines, logo, menu, or modals.
94
+ let _debugShadowRoot = null;
95
+ function getDebugRoot() {
96
+ if (_debugShadowRoot)
97
+ return _debugShadowRoot;
98
+ const host = document.createElement('div');
99
+ host.id = 'colyseus-debug-shadow-host';
100
+ _debugShadowRoot = host.attachShadow({ mode: 'open' });
101
+ document.body.appendChild(host);
102
+ return _debugShadowRoot;
103
+ }
91
104
  // Function to select a modal (bring to front)
92
105
  function selectModal(modal) {
93
106
  if (!modal)
@@ -100,8 +113,9 @@ function selectModal(modal) {
100
113
  // Add to end of stack (most recent)
101
114
  modalStack.push(modal);
102
115
  // Update z-indexes for all modals based on their position in stack
116
+ var root = getDebugRoot();
103
117
  modalStack.forEach((m, i) => {
104
- if (document.body.contains(m)) {
118
+ if (root.contains(m)) {
105
119
  m.style.zIndex = (BASE_MODAL_ZINDEX + i).toString();
106
120
  }
107
121
  });
@@ -118,7 +132,7 @@ document.addEventListener('keydown', function (e) {
118
132
  if (e.key === 'Escape' && modalStack.length > 0) {
119
133
  // Get the most recent modal (top of stack)
120
134
  const topModal = modalStack[modalStack.length - 1];
121
- if (topModal && document.body.contains(topModal)) {
135
+ if (topModal && getDebugRoot().contains(topModal)) {
122
136
  topModal.remove();
123
137
  }
124
138
  }
@@ -368,7 +382,7 @@ function initialize() {
368
382
  // Use insertAdjacentHTML for better Safari compatibility with SVG
369
383
  icon.insertAdjacentHTML('beforeend', logoIcon);
370
384
  container.appendChild(icon);
371
- document.body.appendChild(container);
385
+ getDebugRoot().appendChild(container);
372
386
  // Create menu first
373
387
  createMenu(container);
374
388
  // Apply initial position after menu is created
@@ -495,7 +509,8 @@ function createMenu(logoContainer) {
495
509
  gradient = `linear-gradient(to right, #00c800 0%, ${yellowColor} ${yellowPercent}%, ${color} ${valuePercent}%, #333 ${valuePercent}%, #333 100%)`;
496
510
  }
497
511
  var styleId = 'latency-slider-style';
498
- var existingStyle = document.getElementById(styleId);
512
+ var root = getDebugRoot();
513
+ var existingStyle = root.getElementById(styleId);
499
514
  if (existingStyle) {
500
515
  existingStyle.remove();
501
516
  }
@@ -515,7 +530,7 @@ function createMenu(logoContainer) {
515
530
  border: none;
516
531
  }
517
532
  `;
518
- document.head.appendChild(style);
533
+ root.appendChild(style);
519
534
  }
520
535
  // Initialize slider color
521
536
  updateSliderColor(parseInt(latencySlider.value));
@@ -559,10 +574,10 @@ function createMenu(logoContainer) {
559
574
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
560
575
  }
561
576
  `;
562
- document.head.appendChild(style);
577
+ getDebugRoot().appendChild(style);
563
578
  // Function to update container border color
564
579
  function updateContainerBackgroundColor() {
565
- var container = document.getElementById('debug-logo-container');
580
+ var container = getDebugRoot().getElementById('debug-logo-container');
566
581
  if (container) {
567
582
  // Update to normal state (hover handlers will update on hover)
568
583
  container.style.borderColor = getBorderColor(preferences.latencySimulation.delay, 0.7);
@@ -622,7 +637,7 @@ function createMenu(logoContainer) {
622
637
  openSettingsModal();
623
638
  });
624
639
  menu.appendChild(settingsOption);
625
- document.body.appendChild(menu);
640
+ getDebugRoot().appendChild(menu);
626
641
  // Toggle menu on logo click
627
642
  var menuVisible = false;
628
643
  var hostUpdateInterval = null;
@@ -642,9 +657,15 @@ function createMenu(logoContainer) {
642
657
  }
643
658
  }
644
659
  });
645
- // Close menu when clicking outside
660
+ // Close menu when clicking outside.
661
+ // Because menu/logo live inside a shadow root, event.target is retargeted
662
+ // to the shadow host for document-level listeners, so we walk the composed
663
+ // path to see whether the real click target was inside the menu or logo.
646
664
  document.addEventListener('click', function (e) {
647
- if (menuVisible && !menu.contains(e.target) && !logoContainer.contains(e.target)) {
665
+ var path = typeof e.composedPath === 'function' ? e.composedPath() : [e.target];
666
+ var clickedInsideMenu = path.indexOf(menu) !== -1;
667
+ var clickedInsideLogo = path.indexOf(logoContainer) !== -1;
668
+ if (menuVisible && !clickedInsideMenu && !clickedInsideLogo) {
648
669
  menuVisible = false;
649
670
  menu.style.display = 'none';
650
671
  if (hostUpdateInterval) {
@@ -657,7 +678,7 @@ function createMenu(logoContainer) {
657
678
  // Create and open Settings modal
658
679
  function openSettingsModal() {
659
680
  // Remove existing modal if present
660
- var existingModal = document.getElementById('debug-settings-modal');
681
+ var existingModal = getDebugRoot().getElementById('debug-settings-modal');
661
682
  if (existingModal) {
662
683
  existingModal.remove();
663
684
  }
@@ -836,7 +857,7 @@ function openSettingsModal() {
836
857
  hideContainer.appendChild(hideButton);
837
858
  modal.appendChild(hideContainer);
838
859
  overlay.appendChild(modal);
839
- document.body.appendChild(overlay);
860
+ getDebugRoot().appendChild(overlay);
840
861
  // Mark as selected modal when opened
841
862
  selectModal(overlay);
842
863
  // Update close button to cleanup from modal stack
@@ -871,7 +892,7 @@ function openSendMessagesModal(uniquePanelId) {
871
892
  return;
872
893
  }
873
894
  // Remove existing modal if present
874
- var existingModal = document.getElementById('debug-send-messages-modal');
895
+ var existingModal = getDebugRoot().getElementById('debug-send-messages-modal');
875
896
  if (existingModal) {
876
897
  existingModal.remove();
877
898
  }
@@ -1269,7 +1290,7 @@ function openSendMessagesModal(uniquePanelId) {
1269
1290
  });
1270
1291
  formContainer.appendChild(sendButton);
1271
1292
  modal.appendChild(formContainer);
1272
- document.body.appendChild(modal);
1293
+ getDebugRoot().appendChild(modal);
1273
1294
  }
1274
1295
  // Create and open State Inspector modal
1275
1296
  function openStateInspectorModal(uniquePanelId) {
@@ -1281,7 +1302,7 @@ function openStateInspectorModal(uniquePanelId) {
1281
1302
  }
1282
1303
  var room = debugInfo.room;
1283
1304
  // Remove existing modal if present
1284
- var existingModal = document.getElementById('debug-state-inspector-modal');
1305
+ var existingModal = getDebugRoot().getElementById('debug-state-inspector-modal');
1285
1306
  if (existingModal) {
1286
1307
  existingModal.remove();
1287
1308
  }
@@ -1671,7 +1692,7 @@ function openStateInspectorModal(uniquePanelId) {
1671
1692
  */
1672
1693
  };
1673
1694
  modal.appendChild(contentContainer);
1674
- document.body.appendChild(modal);
1695
+ getDebugRoot().appendChild(modal);
1675
1696
  // Drag and resize state variables
1676
1697
  var isDragging = false;
1677
1698
  var dragStartX = 0;
@@ -1876,9 +1897,10 @@ function openStateInspectorModal(uniquePanelId) {
1876
1897
  }
1877
1898
  // Apply panel position based on current setting
1878
1899
  function applyPanelPosition() {
1879
- var logoContainer = document.getElementById('debug-logo-container');
1880
- var menu = document.getElementById('debug-menu');
1881
- var panels = document.querySelectorAll('[id^="debug-panel-"]');
1900
+ var root = getDebugRoot();
1901
+ var logoContainer = root.getElementById('debug-logo-container');
1902
+ var menu = root.getElementById('debug-menu');
1903
+ var panels = root.querySelectorAll('[id^="debug-panel-"]');
1882
1904
  var positions = {
1883
1905
  'bottom-right': { bottom: '14px', right: '14px', top: 'auto', left: 'auto' },
1884
1906
  'bottom-left': { bottom: '14px', left: '14px', top: 'auto', right: 'auto' },
@@ -1914,9 +1936,10 @@ function applyPanelPosition() {
1914
1936
  function hidePanelsForSession() {
1915
1937
  panelsHidden = true;
1916
1938
  savePreferences(); // Save the hidden state
1917
- var logoContainer = document.getElementById('debug-logo-container');
1918
- var menu = document.getElementById('debug-menu');
1919
- var panels = document.querySelectorAll('[id^="debug-panel-"]');
1939
+ var root = getDebugRoot();
1940
+ var logoContainer = root.getElementById('debug-logo-container');
1941
+ var menu = root.getElementById('debug-menu');
1942
+ var panels = root.querySelectorAll('[id^="debug-panel-"]');
1920
1943
  if (logoContainer) {
1921
1944
  logoContainer.style.display = 'none';
1922
1945
  }
@@ -1943,7 +1966,7 @@ function formatBytes(bytes) {
1943
1966
  // Helper function to create debug panel for a room
1944
1967
  function createDebugPanel(uniquePanelId, debugInfo) {
1945
1968
  // Check if panel already exists
1946
- var existingPanel = document.getElementById('debug-panel-' + uniquePanelId);
1969
+ var existingPanel = getDebugRoot().getElementById('debug-panel-' + uniquePanelId);
1947
1970
  if (existingPanel) {
1948
1971
  return existingPanel;
1949
1972
  }
@@ -2072,11 +2095,12 @@ function createDebugPanel(uniquePanelId, debugInfo) {
2072
2095
  labelSpan.textContent = 'Reconnecting...';
2073
2096
  }
2074
2097
  // Inject CSS animation if not already present
2075
- if (!document.getElementById('debug-pulse-animation')) {
2098
+ var pulseRoot = getDebugRoot();
2099
+ if (!pulseRoot.getElementById('debug-pulse-animation')) {
2076
2100
  var style = document.createElement('style');
2077
2101
  style.id = 'debug-pulse-animation';
2078
2102
  style.textContent = '@keyframes debug-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }';
2079
- document.head.appendChild(style);
2103
+ pulseRoot.appendChild(style);
2080
2104
  }
2081
2105
  // Apply initial style
2082
2106
  applyNormalStyle();
@@ -2134,12 +2158,13 @@ function createDebugPanel(uniquePanelId, debugInfo) {
2134
2158
  panel.appendChild(title);
2135
2159
  panel.appendChild(content);
2136
2160
  panel.appendChild(actionsContainer);
2137
- // Prepend panel to body so new panels appear first
2138
- if (document.body.firstChild) {
2139
- document.body.insertBefore(panel, document.body.firstChild);
2161
+ // Prepend panel inside the shadow root so new panels appear first
2162
+ var root = getDebugRoot();
2163
+ if (root.firstChild) {
2164
+ root.insertBefore(panel, root.firstChild);
2140
2165
  }
2141
2166
  else {
2142
- document.body.appendChild(panel);
2167
+ root.appendChild(panel);
2143
2168
  }
2144
2169
  return panel;
2145
2170
  }
@@ -2147,7 +2172,7 @@ function createDebugPanel(uniquePanelId, debugInfo) {
2147
2172
  function repositionDebugPanels() {
2148
2173
  if (panelsHidden)
2149
2174
  return;
2150
- var panels = Array.from(document.querySelectorAll('[id^="debug-panel-"]'))
2175
+ var panels = Array.from(getDebugRoot().querySelectorAll('[id^="debug-panel-"]'))
2151
2176
  .filter(function (panel) { return panel.style.display !== 'none'; })
2152
2177
  .reverse(); // Reverse to get oldest first (since new panels are prepended)
2153
2178
  // Calculate logoIcon container width: 22px width + 10px padding on each side = 42px
@@ -2189,35 +2214,36 @@ function repositionDebugPanels() {
2189
2214
  }
2190
2215
  // Update debug panel content
2191
2216
  function updateDebugPanel(uniquePanelId, debugInfo) {
2217
+ var root = getDebugRoot();
2192
2218
  var contentId = 'debug-content-' + uniquePanelId;
2193
2219
  var panelId = 'debug-panel-' + uniquePanelId;
2194
2220
  var titleId = 'debug-title-' + uniquePanelId;
2195
- var content = document.getElementById(contentId);
2196
- var panel = document.getElementById(panelId);
2197
- var title = document.getElementById(titleId);
2221
+ var content = root.getElementById(contentId);
2222
+ var panel = root.getElementById(panelId);
2223
+ var title = root.getElementById(titleId);
2198
2224
  if (!content || !panel) {
2199
2225
  // Only create if panel doesn't exist
2200
2226
  if (!panel) {
2201
2227
  createDebugPanel(uniquePanelId, debugInfo);
2202
- content = document.getElementById(contentId);
2203
- title = document.getElementById(titleId);
2228
+ content = root.getElementById(contentId);
2229
+ title = root.getElementById(titleId);
2204
2230
  repositionDebugPanels();
2205
2231
  }
2206
2232
  else {
2207
- content = document.getElementById(contentId);
2208
- title = document.getElementById(titleId);
2233
+ content = root.getElementById(contentId);
2234
+ title = root.getElementById(titleId);
2209
2235
  }
2210
2236
  }
2211
2237
  // Update title with room name only (roomId and sessionId are in tooltip)
2212
- var titleTextEl = document.getElementById('debug-title-text-' + uniquePanelId);
2238
+ var titleTextEl = root.getElementById('debug-title-text-' + uniquePanelId);
2213
2239
  var roomNameEl = titleTextEl === null || titleTextEl === void 0 ? void 0 : titleTextEl.querySelector('.debug-room-name');
2214
2240
  if (roomNameEl)
2215
2241
  roomNameEl.textContent = debugInfo.roomName;
2216
- document.getElementById('debug-tooltip-' + uniquePanelId).innerHTML = '<div><strong>Room ID:</strong> ' + debugInfo.roomId + '</div><div><strong>Session ID:</strong> ' + debugInfo.sessionId + '</div>';
2242
+ root.getElementById('debug-tooltip-' + uniquePanelId).innerHTML = '<div><strong>Room ID:</strong> ' + debugInfo.roomId + '</div><div><strong>Session ID:</strong> ' + debugInfo.sessionId + '</div>';
2217
2243
  // Update ping in header
2218
2244
  var pingDisplay = debugInfo.pingMs !== null ? debugInfo.pingMs + 'ms' : '--';
2219
2245
  var pingColor = debugInfo.pingMs !== null ? (debugInfo.pingMs < 100 ? '#22c55e' : debugInfo.pingMs < 200 ? '#eab308' : '#ef4444') : '#888';
2220
- var pingElement = document.getElementById('debug-ping-' + uniquePanelId);
2246
+ var pingElement = root.getElementById('debug-ping-' + uniquePanelId);
2221
2247
  if (pingElement) {
2222
2248
  pingElement.textContent = pingDisplay;
2223
2249
  pingElement.style.color = pingColor;
@@ -2243,7 +2269,7 @@ function updateDebugPanel(uniquePanelId, debugInfo) {
2243
2269
  }
2244
2270
  // Draw graph on canvas
2245
2271
  function drawGraph(canvasId, data, color) {
2246
- var canvas = document.getElementById(canvasId);
2272
+ var canvas = getDebugRoot().getElementById(canvasId);
2247
2273
  if (!canvas)
2248
2274
  return;
2249
2275
  var ctx = canvas.getContext('2d');
@@ -2405,7 +2431,7 @@ function applyMonkeyPatches() {
2405
2431
  room.onMessage('__playground_message_types', (messageTypes) => {
2406
2432
  debugInfo.messageTypes = messageTypes;
2407
2433
  // Show/hide message button based on message types availability
2408
- var messageBtnElement = document.getElementById('debug-message-btn-' + uniquePanelId);
2434
+ var messageBtnElement = getDebugRoot().getElementById('debug-message-btn-' + uniquePanelId);
2409
2435
  if (messageBtnElement) {
2410
2436
  messageBtnElement.style.display = messageTypes ? 'flex' : 'none';
2411
2437
  }
@@ -2539,7 +2565,7 @@ function applyMonkeyPatches() {
2539
2565
  debugInfo.pingInterval = null;
2540
2566
  }
2541
2567
  roomDebugInfo.delete(uniquePanelId);
2542
- var panel = document.getElementById('debug-panel-' + uniquePanelId);
2568
+ var panel = getDebugRoot().getElementById('debug-panel-' + uniquePanelId);
2543
2569
  if (panel) {
2544
2570
  panel.remove();
2545
2571
  repositionDebugPanels();