From 2b44826396dce4e190a8e08d8ffa071b0eeb07b5 Mon Sep 17 00:00:00 2001 From: Vishnu Vardhan Date: Fri, 10 Oct 2025 15:19:53 +0530 Subject: [PATCH 1/4] Test lens for action commands --- packages/app/src/components/workbench/logs.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/app/src/components/workbench/logs.ts b/packages/app/src/components/workbench/logs.ts index 945f2db..23d7b13 100644 --- a/packages/app/src/components/workbench/logs.ts +++ b/packages/app/src/components/workbench/logs.ts @@ -30,7 +30,6 @@ export class DevtoolsSource extends Element { connectedCallback(): void { super.connectedCallback() window.addEventListener('show-command', async (ev: CustomEvent) => { - this.closest('wdio-devtools-tabs')?.activateTab('Log') const command = ev.detail.command this.elapsedTime = ev.detail.elapsedTime @@ -49,6 +48,11 @@ export class DevtoolsSource extends Element { }, {} as Record) this.#commandDefinition = endpoints[command.command] this.command = command + console.log('show-command', command, this.#commandDefinition) + window.dispatchEvent(new CustomEvent('app-source-highlight', { + detail: this.command?.callSource + })) + this.closest('wdio-devtools-tabs')?.activateTab('Log') }) } From ec63a57f36341048d43062495b2f0c6012475972 Mon Sep 17 00:00:00 2001 From: Vishnu Vardhan Date: Mon, 13 Oct 2025 14:08:19 +0530 Subject: [PATCH 2/4] Removed console log --- packages/app/src/components/workbench/logs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/components/workbench/logs.ts b/packages/app/src/components/workbench/logs.ts index 23d7b13..aa483e2 100644 --- a/packages/app/src/components/workbench/logs.ts +++ b/packages/app/src/components/workbench/logs.ts @@ -48,7 +48,7 @@ export class DevtoolsSource extends Element { }, {} as Record) this.#commandDefinition = endpoints[command.command] this.command = command - console.log('show-command', command, this.#commandDefinition) + window.dispatchEvent(new CustomEvent('app-source-highlight', { detail: this.command?.callSource })) From 5998f4cae309937e316f26aae76124ffe3bae53e Mon Sep 17 00:00:00 2001 From: Vishnu Vardhan Date: Tue, 14 Oct 2025 18:35:03 +0530 Subject: [PATCH 3/4] Minor UI changes --- packages/app/src/components/workbench.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/components/workbench.ts b/packages/app/src/components/workbench.ts index 19bb870..f8c390f 100644 --- a/packages/app/src/components/workbench.ts +++ b/packages/app/src/components/workbench.ts @@ -142,7 +142,7 @@ export class DevtoolsWorkbench extends Element { ${!this.#toolbarCollapsed ? this.#dragVertical.getSlider('z-[999] -mt-[5px] pointer-events-auto') : nothing} - + From 6105f9264ea2c791b426673cf71db8071305dbd9 Mon Sep 17 00:00:00 2001 From: Vishnu Vardhan Date: Wed, 15 Oct 2025 19:24:11 +0530 Subject: [PATCH 4/4] Source file merger --- .../app/src/components/workbench/source.ts | 18 +++++------------- packages/app/src/controller/DataManager.ts | 8 ++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/app/src/components/workbench/source.ts b/packages/app/src/components/workbench/source.ts index 457cdcf..78dd53e 100644 --- a/packages/app/src/components/workbench/source.ts +++ b/packages/app/src/components/workbench/source.ts @@ -41,19 +41,12 @@ export class DevtoolsSource extends Element { } #renderEditor (filePath: string, highlightLine?: number) { - if (!this.sources) { - return - } - + if (!this.sources) return const source = this.sources[filePath] - if (!source) { - return - } + if (!source) return const container = this.shadowRoot?.querySelector('section') || this.shadowRoot?.querySelector('.cm-editor') - if (!container) { - return - } + if (!container) return const opts: EditorViewConfig = { root: this.shadowRoot!, @@ -64,14 +57,13 @@ export class DevtoolsSource extends Element { const editorView = new EditorView(opts) container.replaceWith(editorView.dom) - // Use CodeMirror API to select and scroll to the target line (1-based index) if (highlightLine && highlightLine > 0) { try { - const lineInfo = editorView.state.doc.line(highlightLine) // 1-based + const lineInfo = editorView.state.doc.line(highlightLine) requestAnimationFrame(() => { editorView.dispatch({ selection: { anchor: lineInfo.from }, - effects: EditorView.scrollIntoView(lineInfo.from, { y: 'center' }) // center the line + effects: EditorView.scrollIntoView(lineInfo.from, { y: 'center' }) }) }) } catch { /* ignore */ } diff --git a/packages/app/src/controller/DataManager.ts b/packages/app/src/controller/DataManager.ts index 2e611c2..541eab2 100644 --- a/packages/app/src/controller/DataManager.ts +++ b/packages/app/src/controller/DataManager.ts @@ -141,6 +141,14 @@ export class DataManagerController implements ReactiveController { ...this.consoleLogsContextProvider.value, ...data as string[] ]) + } + else if (scope === 'sources') { + const merged = { + ...(this.sourcesContextProvider.value || {}), + ...(data as Record) + } + this.sourcesContextProvider.setValue(merged) + console.debug('Merged sources keys', Object.keys(merged)) } else { const provider = this[`${scope}ContextProvider`] provider.setValue(data as any)