@matter-server/dashboard 0.2.6 → 0.2.7-alpha.0-20260118-45c7af0

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 (53) hide show
  1. package/README.md +16 -0
  2. package/dist/esm/client/models/descriptions.js +1754 -1754
  3. package/dist/esm/components/dialogs/binding/node-binding-dialog.d.ts.map +1 -1
  4. package/dist/esm/components/dialogs/binding/node-binding-dialog.js +8 -4
  5. package/dist/esm/components/dialogs/binding/node-binding-dialog.js.map +1 -1
  6. package/dist/esm/components/dialogs/settings/log-level-dialog.d.ts +33 -0
  7. package/dist/esm/components/dialogs/settings/log-level-dialog.d.ts.map +1 -0
  8. package/dist/esm/components/dialogs/settings/log-level-dialog.js +185 -0
  9. package/dist/esm/components/dialogs/settings/log-level-dialog.js.map +6 -0
  10. package/dist/esm/components/dialogs/settings/show-log-level-dialog.d.ts +8 -0
  11. package/dist/esm/components/dialogs/settings/show-log-level-dialog.d.ts.map +1 -0
  12. package/dist/esm/components/dialogs/settings/show-log-level-dialog.js +15 -0
  13. package/dist/esm/components/dialogs/settings/show-log-level-dialog.js.map +6 -0
  14. package/dist/esm/entrypoint/main.d.ts +1 -1
  15. package/dist/esm/entrypoint/main.d.ts.map +1 -1
  16. package/dist/esm/entrypoint/main.js +1 -0
  17. package/dist/esm/entrypoint/main.js.map +1 -1
  18. package/dist/esm/pages/components/header.d.ts +9 -0
  19. package/dist/esm/pages/components/header.d.ts.map +1 -1
  20. package/dist/esm/pages/components/header.js +68 -6
  21. package/dist/esm/pages/components/header.js.map +1 -1
  22. package/dist/esm/pages/matter-dashboard-app.d.ts +6 -1
  23. package/dist/esm/pages/matter-dashboard-app.d.ts.map +1 -1
  24. package/dist/esm/pages/matter-dashboard-app.js +119 -24
  25. package/dist/esm/pages/matter-dashboard-app.js.map +1 -1
  26. package/dist/esm/util/theme-service.d.ts +27 -0
  27. package/dist/esm/util/theme-service.d.ts.map +1 -0
  28. package/dist/esm/util/theme-service.js +71 -0
  29. package/dist/esm/util/theme-service.js.map +6 -0
  30. package/dist/web/index.html +35 -0
  31. package/dist/web/js/{commission-node-dialog--19-sX9D.js → commission-node-dialog-CoaDIV2Y.js} +5 -5
  32. package/dist/web/js/{commission-node-existing-DY6SnsHb.js → commission-node-existing-DEU_mJjO.js} +5 -4
  33. package/dist/web/js/{commission-node-thread-CXquVvK5.js → commission-node-thread-DZ6DghSs.js} +5 -4
  34. package/dist/web/js/{commission-node-wifi-VQGVOrr7.js → commission-node-wifi-DOyin0q3.js} +5 -4
  35. package/dist/web/js/{dialog-box-qX-alVZJ.js → dialog-box-B5sunUPv.js} +2 -2
  36. package/dist/web/js/{fire_event-B13DcOc9.js → fire_event-C9Duc1j-.js} +1 -1
  37. package/dist/web/js/log-level-dialog-B7LsZYUL.js +3232 -0
  38. package/dist/web/js/main.js +163 -8
  39. package/dist/web/js/{matter-dashboard-app-CU3-L2nl.js → matter-dashboard-app-DlHSE_Qh.js} +13253 -13039
  40. package/dist/web/js/{node-binding-dialog-D4rr_G9I.js → node-binding-dialog-BifZsigR.js} +12 -7
  41. package/dist/web/js/outlined-text-field-D2BOt1yD.js +968 -0
  42. package/dist/web/js/{prevent_default-Dw7ifAL-.js → prevent_default-CuW2EnKR.js} +1 -1
  43. package/dist/web/js/validator-MOJiFndw.js +1122 -0
  44. package/package.json +4 -4
  45. package/src/client/models/descriptions.ts +1754 -1754
  46. package/src/components/dialogs/binding/node-binding-dialog.ts +8 -4
  47. package/src/components/dialogs/settings/log-level-dialog.ts +179 -0
  48. package/src/components/dialogs/settings/show-log-level-dialog.ts +14 -0
  49. package/src/entrypoint/main.ts +1 -0
  50. package/src/pages/components/header.ts +72 -8
  51. package/src/pages/matter-dashboard-app.ts +123 -26
  52. package/src/util/theme-service.ts +98 -0
  53. package/dist/web/js/outlined-text-field-CtlEkpbk.js +0 -2086
@@ -31,13 +31,77 @@ function toBigIntAwareJson(value, spaces) {
31
31
  return result;
32
32
  }
33
33
  function parseBigIntAwareJson(json) {
34
- const processed = json.replace(/([:,[])\s*(\d{15,})(?=[,}\]\s])/g, (match, prefix, number) => {
35
- const num = BigInt(number);
36
- if (num > Number.MAX_SAFE_INTEGER) {
37
- return `${prefix}"${BIGINT_MARKER}${number}"`;
34
+ const result = [];
35
+ let i = 0;
36
+ let inString = false;
37
+ while (i < json.length) {
38
+ const char = json[i];
39
+ if (inString) {
40
+ if (char === "\\") {
41
+ result.push(char);
42
+ i++;
43
+ if (i < json.length) {
44
+ result.push(json[i]);
45
+ i++;
46
+ }
47
+ } else if (char === '"') {
48
+ result.push(char);
49
+ inString = false;
50
+ i++;
51
+ } else {
52
+ result.push(char);
53
+ i++;
54
+ }
55
+ } else {
56
+ if (char === '"') {
57
+ result.push(char);
58
+ inString = true;
59
+ i++;
60
+ } else if (char >= "0" && char <= "9") {
61
+ const hasMinus = result.length > 0 && result[result.length - 1] === "-";
62
+ if (hasMinus) {
63
+ result.pop();
64
+ }
65
+ const start = i;
66
+ while (i < json.length && json[i] >= "0" && json[i] <= "9") {
67
+ i++;
68
+ }
69
+ let isFloat = false;
70
+ if (i < json.length && json[i] === ".") {
71
+ isFloat = true;
72
+ i++;
73
+ while (i < json.length && json[i] >= "0" && json[i] <= "9") {
74
+ i++;
75
+ }
76
+ }
77
+ if (i < json.length && (json[i] === "e" || json[i] === "E")) {
78
+ isFloat = true;
79
+ i++;
80
+ if (i < json.length && (json[i] === "+" || json[i] === "-")) {
81
+ i++;
82
+ }
83
+ while (i < json.length && json[i] >= "0" && json[i] <= "9") {
84
+ i++;
85
+ }
86
+ }
87
+ const numberStr = (hasMinus ? "-" : "") + json.slice(start, i);
88
+ if (!isFloat && numberStr.length - (hasMinus ? 1 : 0) >= 15) {
89
+ const num = BigInt(numberStr);
90
+ if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
91
+ result.push(`"${BIGINT_MARKER}${numberStr}"`);
92
+ } else {
93
+ result.push(numberStr);
94
+ }
95
+ } else {
96
+ result.push(numberStr);
97
+ }
98
+ } else {
99
+ result.push(char);
100
+ i++;
101
+ }
38
102
  }
39
- return match;
40
- });
103
+ }
104
+ const processed = result.join("");
41
105
  return JSON.parse(processed, (_key, value) => {
42
106
  if (typeof value === "string" && value.startsWith(BIGINT_MARKER)) {
43
107
  return BigInt(value.slice(BIGINT_MARKER.length));
@@ -82,6 +146,8 @@ class Connection {
82
146
  };
83
147
  this.socket.onclose = () => {
84
148
  console.log("WebSocket Closed");
149
+ this.socket = void 0;
150
+ this.serverInfo = void 0;
85
151
  onConnectionLost();
86
152
  };
87
153
  this.socket.onerror = error => {
@@ -106,6 +172,7 @@ class Connection {
106
172
  this.socket.close();
107
173
  this.socket = void 0;
108
174
  }
175
+ this.serverInfo = void 0;
109
176
  }
110
177
  sendMessage(message) {
111
178
  if (!this.socket) {
@@ -364,6 +431,26 @@ class MatterClient {
364
431
  label
365
432
  });
366
433
  }
434
+ /**
435
+ * Get the current log levels for console and file logging.
436
+ * @returns The current log level configuration
437
+ */
438
+ async getLogLevel() {
439
+ return await this.sendCommand("get_loglevel", 0, {});
440
+ }
441
+ /**
442
+ * Set the log level for console and/or file logging.
443
+ * Changes are temporary and will be reset when the server restarts.
444
+ * @param consoleLoglevel Console log level to set (optional)
445
+ * @param fileLoglevel File log level to set, only applied if file logging is enabled (optional)
446
+ * @returns The log level configuration after the change
447
+ */
448
+ async setLogLevel(consoleLoglevel, fileLoglevel) {
449
+ return await this.sendCommand("set_loglevel", 0, {
450
+ console_loglevel: consoleLoglevel,
451
+ file_loglevel: fileLoglevel
452
+ });
453
+ }
367
454
  sendCommand(command, require_schema = void 0, args) {
368
455
  if (require_schema && this.serverInfo.schema_version < require_schema) {
369
456
  throw new InvalidServerVersion(`Command not available due to incompatible server version. Update the Matter Server to a version that supports at least api schema ${require_schema}.`);
@@ -503,13 +590,81 @@ class MatterClient {
503
590
  onRawEvent(_event) {}
504
591
  }
505
592
 
593
+ /**
594
+ * @license
595
+ * Copyright 2025-2026 Open Home Foundation
596
+ * SPDX-License-Identifier: Apache-2.0
597
+ */
598
+ const STORAGE_KEY = "matterTheme";
599
+ class ThemeServiceImpl {
600
+ constructor() {
601
+ this._preference = "system";
602
+ this._listeners = /* @__PURE__ */new Set();
603
+ this._mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
604
+ this._mediaQuery.addEventListener("change", () => this._applyTheme());
605
+ this._loadPreference();
606
+ this._applyTheme();
607
+ }
608
+ get preference() {
609
+ return this._preference;
610
+ }
611
+ get effectiveTheme() {
612
+ if (this._preference === "system") {
613
+ return this._mediaQuery.matches ? "dark" : "light";
614
+ }
615
+ return this._preference;
616
+ }
617
+ setPreference(pref) {
618
+ this._preference = pref;
619
+ localStorage.setItem(STORAGE_KEY, pref);
620
+ this._applyTheme();
621
+ }
622
+ cycleTheme() {
623
+ const cycle = ["light", "dark", "system"];
624
+ const currentIndex = cycle.indexOf(this._preference);
625
+ const nextIndex = (currentIndex + 1) % cycle.length;
626
+ this.setPreference(cycle[nextIndex]);
627
+ return this._preference;
628
+ }
629
+ subscribe(callback) {
630
+ this._listeners.add(callback);
631
+ return () => this._listeners.delete(callback);
632
+ }
633
+ _loadPreference() {
634
+ const urlParams = new URLSearchParams(window.location.search);
635
+ const themeParam = urlParams.get("theme");
636
+ if (themeParam && ["light", "dark", "system"].includes(themeParam)) {
637
+ this._preference = themeParam;
638
+ localStorage.setItem(STORAGE_KEY, themeParam);
639
+ urlParams.delete("theme");
640
+ const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams.toString()}${window.location.hash}` : `${window.location.pathname}${window.location.hash}`;
641
+ history.replaceState({}, "", newUrl);
642
+ return;
643
+ }
644
+ const stored = localStorage.getItem(STORAGE_KEY);
645
+ if (stored && ["light", "dark", "system"].includes(stored)) {
646
+ this._preference = stored;
647
+ }
648
+ }
649
+ _applyTheme() {
650
+ const effective = this.effectiveTheme;
651
+ document.documentElement.classList.toggle("dark-theme", effective === "dark");
652
+ const metaThemeColor = document.querySelector('meta[name="theme-color"]');
653
+ if (metaThemeColor) {
654
+ metaThemeColor.setAttribute("content", effective === "dark" ? "#1e1e1e" : "#03a9f4");
655
+ }
656
+ this._listeners.forEach(cb => cb(effective));
657
+ }
658
+ }
659
+ const ThemeService = new ThemeServiceImpl();
660
+
506
661
  /**
507
662
  * @license
508
663
  * Copyright 2025-2026 Open Home Foundation
509
664
  * SPDX-License-Identifier: Apache-2.0
510
665
  */
511
666
  async function main() {
512
- import('./matter-dashboard-app-CU3-L2nl.js').then(function (n) { return n.s; });
667
+ import('./matter-dashboard-app-DlHSE_Qh.js').then(function (n) { return n.z; });
513
668
  let url = "";
514
669
  const isProductionServer = location.origin.includes(":5580") || location.href.includes("hassio_ingress") || location.href.includes("/api/ingress/");
515
670
  if (!isProductionServer) {
@@ -544,4 +699,4 @@ async function main() {
544
699
  }
545
700
  main();
546
701
 
547
- export { toBigIntAwareJson as t };
702
+ export { ThemeService as T, toBigIntAwareJson as t };