@matter-server/dashboard 0.6.1 → 0.6.2-alpha.0-20260421-bc2093e

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 (117) hide show
  1. package/README.md +19 -0
  2. package/dist/esm/client/models/descriptions.d.ts +10 -0
  3. package/dist/esm/client/models/descriptions.d.ts.map +1 -1
  4. package/dist/esm/client/models/descriptions.js +5684 -1881
  5. package/dist/esm/client/models/descriptions.js.map +1 -1
  6. package/dist/esm/components/dialog-box/dialog-box.d.ts.map +1 -1
  7. package/dist/esm/components/dialog-box/show-dialog-box.d.ts.map +1 -1
  8. package/dist/esm/components/dialogs/acl/model.d.ts.map +1 -1
  9. package/dist/esm/components/dialogs/binding/model.d.ts.map +1 -1
  10. package/dist/esm/components/dialogs/binding/node-binding-dialog.d.ts.map +1 -1
  11. package/dist/esm/components/dialogs/binding/show-node-binding-dialog.d.ts.map +1 -1
  12. package/dist/esm/components/dialogs/commission-node-dialog/commission-node-dialog.d.ts.map +1 -1
  13. package/dist/esm/components/dialogs/commission-node-dialog/commission-node-existing.d.ts.map +1 -1
  14. package/dist/esm/components/dialogs/commission-node-dialog/commission-node-thread.d.ts.map +1 -1
  15. package/dist/esm/components/dialogs/commission-node-dialog/commission-node-wifi.d.ts.map +1 -1
  16. package/dist/esm/components/dialogs/commission-node-dialog/show-commission-node-dialog.d.ts.map +1 -1
  17. package/dist/esm/components/dialogs/dev/attribute-write-dialog.d.ts +34 -0
  18. package/dist/esm/components/dialogs/dev/attribute-write-dialog.d.ts.map +1 -0
  19. package/dist/esm/components/dialogs/dev/attribute-write-dialog.js +187 -0
  20. package/dist/esm/components/dialogs/dev/attribute-write-dialog.js.map +6 -0
  21. package/dist/esm/components/dialogs/dev/command-invoke-dialog.d.ts +33 -0
  22. package/dist/esm/components/dialogs/dev/command-invoke-dialog.d.ts.map +1 -0
  23. package/dist/esm/components/dialogs/dev/command-invoke-dialog.js +221 -0
  24. package/dist/esm/components/dialogs/dev/command-invoke-dialog.js.map +6 -0
  25. package/dist/esm/components/dialogs/dev/parse-json-payload.d.ts +27 -0
  26. package/dist/esm/components/dialogs/dev/parse-json-payload.d.ts.map +1 -0
  27. package/dist/esm/components/dialogs/dev/parse-json-payload.js +25 -0
  28. package/dist/esm/components/dialogs/dev/parse-json-payload.js.map +6 -0
  29. package/dist/esm/components/dialogs/dev/show-attribute-write-dialog.d.ts +17 -0
  30. package/dist/esm/components/dialogs/dev/show-attribute-write-dialog.d.ts.map +1 -0
  31. package/dist/esm/components/dialogs/dev/show-attribute-write-dialog.js +21 -0
  32. package/dist/esm/components/dialogs/dev/show-attribute-write-dialog.js.map +6 -0
  33. package/dist/esm/components/dialogs/dev/show-command-invoke-dialog.d.ts +16 -0
  34. package/dist/esm/components/dialogs/dev/show-command-invoke-dialog.d.ts.map +1 -0
  35. package/dist/esm/components/dialogs/dev/show-command-invoke-dialog.js +20 -0
  36. package/dist/esm/components/dialogs/dev/show-command-invoke-dialog.js.map +6 -0
  37. package/dist/esm/components/dialogs/settings/log-level-dialog.d.ts +2 -11
  38. package/dist/esm/components/dialogs/settings/log-level-dialog.d.ts.map +1 -1
  39. package/dist/esm/components/dialogs/settings/log-level-dialog.js +13 -140
  40. package/dist/esm/components/dialogs/settings/log-level-dialog.js.map +1 -1
  41. package/dist/esm/components/dialogs/settings/log-level-section.d.ts +34 -0
  42. package/dist/esm/components/dialogs/settings/log-level-section.d.ts.map +1 -0
  43. package/dist/esm/components/dialogs/settings/log-level-section.js +181 -0
  44. package/dist/esm/components/dialogs/settings/log-level-section.js.map +6 -0
  45. package/dist/esm/components/dialogs/settings/settings-dialog.d.ts +31 -0
  46. package/dist/esm/components/dialogs/settings/settings-dialog.d.ts.map +1 -0
  47. package/dist/esm/components/dialogs/settings/settings-dialog.js +165 -0
  48. package/dist/esm/components/dialogs/settings/settings-dialog.js.map +6 -0
  49. package/dist/esm/components/dialogs/settings/show-log-level-dialog.d.ts.map +1 -1
  50. package/dist/esm/components/dialogs/settings/show-settings-dialog.d.ts +8 -0
  51. package/dist/esm/components/dialogs/settings/show-settings-dialog.d.ts.map +1 -0
  52. package/dist/esm/components/dialogs/settings/show-settings-dialog.js +15 -0
  53. package/dist/esm/components/dialogs/settings/show-settings-dialog.js.map +6 -0
  54. package/dist/esm/components/ha-svg-icon.d.ts.map +1 -1
  55. package/dist/esm/pages/cluster-commands/base-cluster-commands.d.ts.map +1 -1
  56. package/dist/esm/pages/cluster-commands/clusters/basic-information-commands.d.ts.map +1 -1
  57. package/dist/esm/pages/cluster-commands/clusters/level-control-commands.d.ts.map +1 -1
  58. package/dist/esm/pages/cluster-commands/clusters/on-off-commands.d.ts.map +1 -1
  59. package/dist/esm/pages/components/footer.d.ts.map +1 -1
  60. package/dist/esm/pages/components/header.d.ts +2 -0
  61. package/dist/esm/pages/components/header.d.ts.map +1 -1
  62. package/dist/esm/pages/components/header.js +47 -3
  63. package/dist/esm/pages/components/header.js.map +1 -1
  64. package/dist/esm/pages/components/node-details.d.ts.map +1 -1
  65. package/dist/esm/pages/components/server-details.d.ts.map +1 -1
  66. package/dist/esm/pages/matter-cluster-view.d.ts +13 -2
  67. package/dist/esm/pages/matter-cluster-view.d.ts.map +1 -1
  68. package/dist/esm/pages/matter-cluster-view.js +338 -4
  69. package/dist/esm/pages/matter-cluster-view.js.map +2 -2
  70. package/dist/esm/pages/matter-dashboard-app.d.ts.map +1 -1
  71. package/dist/esm/pages/matter-endpoint-view.d.ts.map +1 -1
  72. package/dist/esm/pages/matter-network-view.d.ts.map +1 -1
  73. package/dist/esm/pages/matter-node-view.d.ts.map +1 -1
  74. package/dist/esm/pages/matter-server-view.d.ts.map +1 -1
  75. package/dist/esm/pages/network/base-network-graph.d.ts.map +1 -1
  76. package/dist/esm/pages/network/device-panel.d.ts.map +1 -1
  77. package/dist/esm/pages/network/network-details.d.ts.map +1 -1
  78. package/dist/esm/pages/network/thread-graph.d.ts.map +1 -1
  79. package/dist/esm/pages/network/update-connections-dialog.d.ts.map +1 -1
  80. package/dist/esm/pages/network/wifi-graph.d.ts.map +1 -1
  81. package/dist/esm/util/clone_class.d.ts.map +1 -1
  82. package/dist/esm/util/dev-mode-service.d.ts +14 -0
  83. package/dist/esm/util/dev-mode-service.d.ts.map +1 -0
  84. package/dist/esm/util/dev-mode-service.js +37 -0
  85. package/dist/esm/util/dev-mode-service.js.map +6 -0
  86. package/dist/esm/util/fire_event.d.ts.map +1 -1
  87. package/dist/esm/util/prevent_default.d.ts.map +1 -1
  88. package/dist/esm/util/theme-service.d.ts.map +1 -1
  89. package/dist/web/index.html +6 -0
  90. package/dist/web/js/attribute-write-dialog-B1tIg_0G.js +166 -0
  91. package/dist/web/js/command-invoke-dialog-T_pcKaIB.js +192 -0
  92. package/dist/web/js/{commission-node-dialog-DfwKU9qk.js → commission-node-dialog-WS5qDOnU.js} +4 -4
  93. package/dist/web/js/{commission-node-existing-C7ITvNfj.js → commission-node-existing-Bb10H55l.js} +2 -2
  94. package/dist/web/js/{commission-node-thread-D-icSzto.js → commission-node-thread-B0wMe4Wq.js} +2 -2
  95. package/dist/web/js/{commission-node-wifi-DwUkXlWz.js → commission-node-wifi-Bjdqn47D.js} +2 -2
  96. package/dist/web/js/{dialog-box-BmpaTrvT.js → dialog-box-DtMt9N0h.js} +1 -1
  97. package/dist/web/js/{fire_event-2ZxL-AHZ.js → fire_event-BL87hqSP.js} +1 -1
  98. package/dist/web/js/main.js +2 -2
  99. package/dist/web/js/{matter-dashboard-app-BtHTmAPq.js → matter-dashboard-app-F5wNhZIe.js} +6200 -1897
  100. package/dist/web/js/{node-binding-dialog-MMx9rkCF.js → node-binding-dialog-BEs5k-yQ.js} +1 -1
  101. package/dist/web/js/parse-json-payload-DU9TWKdu.js +32 -0
  102. package/dist/web/js/{log-level-dialog-D4hubdib.js → settings-dialog-DNiYIToE.js} +583 -69
  103. package/package.json +29 -29
  104. package/src/client/models/descriptions.ts +5690 -1878
  105. package/src/components/dialogs/dev/attribute-write-dialog.ts +169 -0
  106. package/src/components/dialogs/dev/command-invoke-dialog.ts +204 -0
  107. package/src/components/dialogs/dev/parse-json-payload.ts +37 -0
  108. package/src/components/dialogs/dev/show-attribute-write-dialog.ts +30 -0
  109. package/src/components/dialogs/dev/show-command-invoke-dialog.ts +28 -0
  110. package/src/components/dialogs/settings/log-level-dialog.ts +15 -138
  111. package/src/components/dialogs/settings/log-level-section.ts +174 -0
  112. package/src/components/dialogs/settings/settings-dialog.ts +165 -0
  113. package/src/components/dialogs/settings/show-settings-dialog.ts +14 -0
  114. package/src/pages/components/header.ts +47 -3
  115. package/src/pages/matter-cluster-view.ts +366 -4
  116. package/src/tsconfig.json +7 -2
  117. package/src/util/dev-mode-service.ts +44 -0
@@ -8,18 +8,22 @@ import { provide } from "@lit/context";
8
8
  import "@material/web/button/outlined-button";
9
9
  import "@material/web/divider/divider";
10
10
  import "@material/web/iconbutton/icon-button";
11
+ import "@material/web/iconbutton/outlined-icon-button";
11
12
  import "@material/web/list/list";
12
13
  import "@material/web/list/list-item";
13
14
  import { isTestNodeId, MatterClient, MatterNode, toBigIntAwareJson } from "@matter-server/ws-client";
14
- import { mdiAlertCircleOutline } from "@mdi/js";
15
- import { css, html, LitElement } from "lit";
16
- import { customElement, property } from "lit/decorators.js";
15
+ import { mdiAlertCircleOutline, mdiPencil, mdiPlay, mdiRefresh } from "@mdi/js";
16
+ import { css, html, LitElement, nothing, type TemplateResult } from "lit";
17
+ import { customElement, property, state } from "lit/decorators.js";
17
18
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
18
19
  import { clusters } from "../client/models/descriptions.js";
19
20
  import { showAlertDialog } from "../components/dialog-box/show-dialog-box.js";
21
+ import { showAttributeWriteDialog } from "../components/dialogs/dev/show-attribute-write-dialog.js";
22
+ import { showCommandInvokeDialog } from "../components/dialogs/dev/show-command-invoke-dialog.js";
20
23
  import "../components/ha-svg-icon";
21
24
  import "../pages/components/node-details";
22
25
  // Cluster command components (auto-register on import)
26
+ import { DevModeService } from "../util/dev-mode-service.js";
23
27
  import { formatHex, formatNodeAddress, getEffectiveFabricIndex } from "../util/format_hex.js";
24
28
  import { notFoundStyles } from "../util/shared-styles.js";
25
29
  import { getClusterCommandsTag } from "./cluster-commands/index.js";
@@ -35,6 +39,14 @@ declare global {
35
39
  const GLOBAL_ATTRIBUTE_MIN = 0xfff0;
36
40
  const GLOBAL_ATTRIBUTE_MAX = 0xffff;
37
41
 
42
+ // AcceptedCommandList global attribute (lists server-supported command IDs per cluster instance)
43
+ const ACCEPTED_COMMAND_LIST_ATTR = 0xfff9;
44
+
45
+ // How long to flash the refresh icon in success state.
46
+ const REFRESH_SUCCESS_MS = 600;
47
+
48
+ type RefreshState = "idle" | "loading" | "success";
49
+
38
50
  function isGlobalAttribute(id: number): boolean {
39
51
  return id >= GLOBAL_ATTRIBUTE_MIN && id <= GLOBAL_ATTRIBUTE_MAX;
40
52
  }
@@ -74,6 +86,25 @@ class MatterClusterView extends LitElement {
74
86
  @property()
75
87
  public cluster?: number;
76
88
 
89
+ @state() private _devMode = DevModeService.active;
90
+
91
+ // Per-attribute refresh state, keyed by attribute id (within the current ep/cluster)
92
+ @state() private _refreshState: Record<number, RefreshState> = {};
93
+
94
+ private _unsubscribeDev?: () => void;
95
+
96
+ override connectedCallback() {
97
+ super.connectedCallback();
98
+ this._unsubscribeDev = DevModeService.subscribe(active => {
99
+ this._devMode = active;
100
+ });
101
+ }
102
+
103
+ override disconnectedCallback() {
104
+ super.disconnectedCallback();
105
+ this._unsubscribeDev?.();
106
+ }
107
+
77
108
  override render() {
78
109
  if (!this.node || this.endpoint == undefined || this.cluster == undefined) {
79
110
  return html`
@@ -108,6 +139,9 @@ class MatterClusterView extends LitElement {
108
139
  <!-- Cluster commands section (if available for this cluster) -->
109
140
  ${this._renderClusterCommands()}
110
141
 
142
+ <!-- Developer-mode commands panel -->
143
+ ${this._devMode ? this._renderDevCommandsPanel() : nothing}
144
+
111
145
  <!-- Cluster attributes listing -->
112
146
  <div class="container">
113
147
  <md-list>
@@ -132,7 +166,10 @@ class MatterClusterView extends LitElement {
132
166
  AttributeId: ${attribute.key} (${formatHex(attribute.key)}) - Value type:
133
167
  ${clusters[this.cluster!]?.attributes[attribute.key]?.type ?? "unknown"}
134
168
  </div>
135
- <div slot="end">
169
+ <div slot="end" class="row-end">
170
+ ${this._devMode
171
+ ? this._renderAttributeDevActions(attribute.key, attribute.value)
172
+ : nothing}
136
173
  ${toBigIntAwareJson(attribute.value).length > 30
137
174
  ? html`<md-outlined-button
138
175
  @click=${() => {
@@ -151,6 +188,152 @@ class MatterClusterView extends LitElement {
151
188
  `;
152
189
  }
153
190
 
191
+ private _renderAttributeDevActions(attributeId: number, currentValue: unknown): TemplateResult {
192
+ const meta = clusters[this.cluster!]?.attributes[attributeId];
193
+ const online = this.node?.available === true;
194
+ const state = this._refreshState[attributeId] ?? "idle";
195
+ const refreshClasses = `dev-action refresh refresh-${state}`;
196
+
197
+ return html`
198
+ <span class="dev-actions">
199
+ <md-outlined-icon-button
200
+ class=${refreshClasses}
201
+ title="Read attribute now"
202
+ aria-label="Read attribute now"
203
+ ?disabled=${!online || state === "loading"}
204
+ @click=${() => this._refreshAttribute(attributeId)}
205
+ >
206
+ <ha-svg-icon .path=${mdiRefresh}></ha-svg-icon>
207
+ </md-outlined-icon-button>
208
+ ${meta?.writable
209
+ ? html`
210
+ <md-outlined-icon-button
211
+ class="dev-action pencil"
212
+ title="Write attribute…"
213
+ aria-label="Write attribute"
214
+ ?disabled=${!online}
215
+ @click=${() => this._openAttributeWriteDialog(attributeId, currentValue, meta.label)}
216
+ >
217
+ <ha-svg-icon .path=${mdiPencil}></ha-svg-icon>
218
+ </md-outlined-icon-button>
219
+ `
220
+ : nothing}
221
+ </span>
222
+ `;
223
+ }
224
+
225
+ private async _refreshAttribute(attributeId: number) {
226
+ if (!this.node) return;
227
+ // Snapshot the context at click time so a late-arriving response cannot leak
228
+ // state into a different cluster view after navigation.
229
+ const nodeId = this.node.node_id;
230
+ const endpoint = this.endpoint;
231
+ const cluster = this.cluster;
232
+ const path = `${endpoint}/${cluster}/${attributeId}`;
233
+ const isSameContext = () =>
234
+ this.isConnected && this.node?.node_id === nodeId && this.endpoint === endpoint && this.cluster === cluster;
235
+
236
+ this._refreshState = { ...this._refreshState, [attributeId]: "loading" };
237
+ try {
238
+ const result = await this.client.readAttribute(nodeId, path);
239
+ if (!isSameContext()) return;
240
+ // Defensive merge — attribute_updated events usually do this already.
241
+ for (const [key, value] of Object.entries(result)) {
242
+ this.node.attributes[key] = value;
243
+ }
244
+ this.requestUpdate();
245
+ this._refreshState = { ...this._refreshState, [attributeId]: "success" };
246
+ setTimeout(() => {
247
+ if (!isSameContext()) return;
248
+ if (this._refreshState[attributeId] === "success") {
249
+ this._refreshState = { ...this._refreshState, [attributeId]: "idle" };
250
+ }
251
+ }, REFRESH_SUCCESS_MS);
252
+ } catch (err) {
253
+ if (!isSameContext()) return;
254
+ this._refreshState = { ...this._refreshState, [attributeId]: "idle" };
255
+ const message = err instanceof Error ? err.message : String(err);
256
+ showAlertDialog({ title: "Read failed", text: message });
257
+ }
258
+ }
259
+
260
+ private _openAttributeWriteDialog(attributeId: number, currentValue: unknown, label: string) {
261
+ if (!this.node || this.cluster === undefined) return;
262
+ showAttributeWriteDialog({
263
+ client: this.client,
264
+ nodeId: this.node.node_id,
265
+ endpointId: this.endpoint,
266
+ clusterId: this.cluster,
267
+ attributeId,
268
+ label,
269
+ currentValue,
270
+ });
271
+ }
272
+
273
+ private _renderDevCommandsPanel(): TemplateResult {
274
+ const clusterMeta = this.cluster !== undefined ? clusters[this.cluster] : undefined;
275
+ const rawAcceptedList = this.node?.attributes[`${this.endpoint}/${this.cluster}/${ACCEPTED_COMMAND_LIST_ATTR}`];
276
+ const acceptedList = Array.isArray(rawAcceptedList) ? (rawAcceptedList as number[]) : [];
277
+
278
+ const commands = acceptedList
279
+ .map(id => clusterMeta?.commands[id])
280
+ .filter((cmd): cmd is NonNullable<typeof cmd> => cmd !== undefined);
281
+
282
+ const online = this.node?.available === true;
283
+
284
+ return html`
285
+ <div class="container">
286
+ <details class="dev-commands-panel">
287
+ <summary>
288
+ <span class="dev-chip">DEV</span>
289
+ Commands
290
+ </summary>
291
+ <div class="dev-commands-content">
292
+ ${commands.length === 0
293
+ ? html`<p class="empty">No invokable commands for this cluster.</p>`
294
+ : html`
295
+ <ul class="command-list">
296
+ ${commands.map(
297
+ cmd => html`
298
+ <li class="command-row">
299
+ <div class="command-meta">
300
+ <span class="command-label">${cmd.label}</span>
301
+ <span class="command-sub"
302
+ >CommandId ${cmd.id} (${formatHex(cmd.id)}) ·
303
+ <code>${cmd.name}</code></span
304
+ >
305
+ </div>
306
+ <md-outlined-button
307
+ class="dev-invoke-button"
308
+ ?disabled=${!online}
309
+ @click=${() => this._openCommandInvokeDialog(cmd.name, cmd.label)}
310
+ >
311
+ <ha-svg-icon slot="icon" .path=${mdiPlay}></ha-svg-icon>
312
+ Invoke
313
+ </md-outlined-button>
314
+ </li>
315
+ `,
316
+ )}
317
+ </ul>
318
+ `}
319
+ </div>
320
+ </details>
321
+ </div>
322
+ `;
323
+ }
324
+
325
+ private _openCommandInvokeDialog(commandName: string, commandLabel: string) {
326
+ if (!this.node || this.cluster === undefined) return;
327
+ showCommandInvokeDialog({
328
+ client: this.client,
329
+ nodeId: this.node.node_id,
330
+ endpointId: this.endpoint,
331
+ clusterId: this.cluster,
332
+ commandName,
333
+ commandLabel,
334
+ });
335
+ }
336
+
154
337
  private async _showAttributeValue(value: any) {
155
338
  showAlertDialog({
156
339
  title: "Attribute value",
@@ -180,6 +363,11 @@ class MatterClusterView extends LitElement {
180
363
  override updated(changedProperties: Map<string, unknown>) {
181
364
  super.updated(changedProperties);
182
365
 
366
+ // Reset per-attribute refresh state when navigating to a different cluster/endpoint.
367
+ if (changedProperties.has("cluster") || changedProperties.has("endpoint")) {
368
+ this._refreshState = {};
369
+ }
370
+
183
371
  // After render, find and configure the cluster commands component
184
372
  const container = this.shadowRoot?.getElementById("cluster-commands-container");
185
373
  if (container) {
@@ -239,6 +427,180 @@ class MatterClusterView extends LitElement {
239
427
  md-list-item.alternate-row {
240
428
  background-color: var(--md-sys-color-surface-container-low);
241
429
  }
430
+
431
+ .row-end {
432
+ display: flex;
433
+ align-items: center;
434
+ gap: 8px;
435
+ }
436
+
437
+ /* Framed dev-mode actions, clearly separated from the value display. */
438
+ .dev-actions {
439
+ display: inline-flex;
440
+ align-items: center;
441
+ gap: 6px;
442
+ padding-right: 10px;
443
+ margin-right: 2px;
444
+ border-right: 1px solid var(--md-sys-color-outline-variant);
445
+ }
446
+
447
+ .dev-action {
448
+ /* Compact, visible outlined frame in dev-mode accent (deep violet). */
449
+ --md-outlined-icon-button-container-width: 32px;
450
+ --md-outlined-icon-button-container-height: 32px;
451
+ --md-outlined-icon-button-icon-size: 18px;
452
+ --md-outlined-icon-button-outline-color: var(--dev-color);
453
+ --md-outlined-icon-button-outline-width: 1px;
454
+ --md-outlined-icon-button-icon-color: var(--dev-color);
455
+ --md-outlined-icon-button-hover-state-layer-color: var(--dev-color);
456
+ --md-outlined-icon-button-focus-state-layer-color: var(--dev-color);
457
+ --md-outlined-icon-button-pressed-state-layer-color: var(--dev-color);
458
+ --icon-primary-color: var(--dev-color);
459
+ /* Round container kept constant so the success-fill transitions smoothly. */
460
+ border-radius: 9999px;
461
+ background: transparent;
462
+ margin-right: 0;
463
+ transition: background 300ms ease-out;
464
+ }
465
+
466
+ .dev-action.refresh-loading ha-svg-icon {
467
+ animation: dev-spin 0.9s linear infinite;
468
+ }
469
+
470
+ .dev-action.refresh-success {
471
+ --md-outlined-icon-button-icon-color: var(--dev-on-color);
472
+ --icon-primary-color: var(--dev-on-color);
473
+ background: var(--dev-color);
474
+ }
475
+
476
+ @keyframes dev-spin {
477
+ from {
478
+ transform: rotate(0deg);
479
+ }
480
+ to {
481
+ transform: rotate(360deg);
482
+ }
483
+ }
484
+
485
+ @media (prefers-reduced-motion: reduce) {
486
+ .dev-action.refresh-loading ha-svg-icon {
487
+ animation: none;
488
+ }
489
+ }
490
+
491
+ details.dev-commands-panel {
492
+ background-color: var(--md-sys-color-surface-container);
493
+ border: 1px solid var(--dev-color);
494
+ border-radius: 12px;
495
+ overflow: hidden;
496
+ }
497
+
498
+ details.dev-commands-panel summary {
499
+ padding: 14px 16px;
500
+ font-weight: 500;
501
+ color: var(--md-sys-color-on-surface);
502
+ cursor: pointer;
503
+ user-select: none;
504
+ display: flex;
505
+ align-items: center;
506
+ gap: 10px;
507
+ }
508
+
509
+ details.dev-commands-panel summary:hover {
510
+ background-color: color-mix(in srgb, var(--dev-color) 8%, transparent);
511
+ }
512
+
513
+ details.dev-commands-panel summary::before {
514
+ content: "▶";
515
+ font-size: 12px;
516
+ color: var(--dev-color);
517
+ transition: transform 0.2s ease;
518
+ }
519
+
520
+ details.dev-commands-panel[open] summary::before {
521
+ transform: rotate(90deg);
522
+ }
523
+
524
+ details.dev-commands-panel summary::-webkit-details-marker {
525
+ display: none;
526
+ }
527
+
528
+ .dev-chip {
529
+ font-family: var(--monospace-font);
530
+ font-size: 0.7rem;
531
+ font-weight: 600;
532
+ letter-spacing: 0.08em;
533
+ padding: 2px 6px;
534
+ border-radius: 4px;
535
+ background: var(--dev-color);
536
+ color: var(--dev-on-color);
537
+ line-height: 1;
538
+ }
539
+
540
+ .dev-commands-content {
541
+ padding: 0 16px 16px 16px;
542
+ }
543
+
544
+ .empty {
545
+ color: var(--md-sys-color-on-surface-variant);
546
+ font-size: 0.9rem;
547
+ margin: 0;
548
+ }
549
+
550
+ .command-list {
551
+ list-style: none;
552
+ margin: 0;
553
+ padding: 0;
554
+ display: flex;
555
+ flex-direction: column;
556
+ gap: 8px;
557
+ }
558
+
559
+ .command-row {
560
+ display: flex;
561
+ align-items: center;
562
+ justify-content: space-between;
563
+ gap: 16px;
564
+ padding: 8px 12px;
565
+ background: var(--md-sys-color-surface-container-low);
566
+ border-radius: 8px;
567
+ }
568
+
569
+ .dev-invoke-button {
570
+ --md-outlined-button-outline-color: var(--dev-color);
571
+ --md-outlined-button-label-text-color: var(--dev-color);
572
+ --md-outlined-button-hover-state-layer-color: var(--dev-color);
573
+ --md-outlined-button-focus-state-layer-color: var(--dev-color);
574
+ --md-outlined-button-pressed-state-layer-color: var(--dev-color);
575
+ --md-outlined-button-icon-color: var(--dev-color);
576
+ --md-outlined-button-hover-label-text-color: var(--dev-color);
577
+ --md-outlined-button-focus-label-text-color: var(--dev-color);
578
+ --md-outlined-button-pressed-label-text-color: var(--dev-color);
579
+ }
580
+
581
+ .command-meta {
582
+ display: flex;
583
+ flex-direction: column;
584
+ gap: 2px;
585
+ min-width: 0;
586
+ }
587
+
588
+ .command-label {
589
+ font-weight: 500;
590
+ color: var(--md-sys-color-on-surface);
591
+ }
592
+
593
+ .command-sub {
594
+ font-size: 0.825rem;
595
+ color: var(--md-sys-color-on-surface-variant);
596
+ }
597
+
598
+ .command-sub code {
599
+ font-family: var(--monospace-font);
600
+ background: var(--md-sys-color-surface-container-high);
601
+ padding: 0 4px;
602
+ border-radius: 3px;
603
+ }
242
604
  `,
243
605
  ];
244
606
  }
package/src/tsconfig.json CHANGED
@@ -1,7 +1,12 @@
1
+ // Managed by nacho-build. Nacho will update references automatically but otherwise preserves your edits.
2
+ // Use `nacho-build configure` to overwrite with defaults.
1
3
  {
2
- "extends": "../../tools/tsc/tsconfig.lib.json",
4
+ "extends": "../../../tsc/tsconfig.lib.json",
3
5
  "compilerOptions": {
4
- "lib": ["es2023", "dom"],
6
+ "lib": [
7
+ "es2023",
8
+ "dom"
9
+ ],
5
10
  "types": [
6
11
  "globals"
7
12
  ],
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025-2026 Open Home Foundation
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * Developer-mode state backed by the `?dev` URL query parameter.
9
+ *
10
+ * Activation: any non-empty value (e.g. `?dev=on`, `?dev=1`). No persistence;
11
+ * dev mode is gone when the URL is.
12
+ */
13
+
14
+ const URL_PARAM = "dev";
15
+
16
+ class DevModeServiceImpl {
17
+ private _listeners: Set<(active: boolean) => void> = new Set();
18
+
19
+ get active(): boolean {
20
+ const value = new URLSearchParams(window.location.search).get(URL_PARAM);
21
+ return value !== null && value !== "";
22
+ }
23
+
24
+ setActive(on: boolean): void {
25
+ const url = new URL(window.location.href);
26
+ if (on) {
27
+ url.searchParams.set(URL_PARAM, "on");
28
+ } else {
29
+ url.searchParams.delete(URL_PARAM);
30
+ }
31
+ history.replaceState(null, "", url.toString());
32
+ const active = this.active;
33
+ this._listeners.forEach(cb => cb(active));
34
+ }
35
+
36
+ subscribe(callback: (active: boolean) => void): () => void {
37
+ this._listeners.add(callback);
38
+ return () => {
39
+ this._listeners.delete(callback);
40
+ };
41
+ }
42
+ }
43
+
44
+ export const DevModeService = new DevModeServiceImpl();