Skip to content

Commit a337ab5

Browse files
authored
refactor: Update iframe theme styles and improve Inspect iframe source handling (#91)
1 parent 97d2dbd commit a337ab5

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

.changeset/cool-impalas-wink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik.dev/devtools': patch
3+
---
4+
5+
refactor: Update iframe theme styles and improve Inspect iframe source handling

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ testem.log
6565
Thumbs.db
6666
.vite-inspect
6767
.pnpm-store/*
68-
qwik/*
68+
related-qwik/*
6969
.cursor/skills/*

packages/ui/src/features/inspect/Inspect.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
import { component$ } from '@qwik.dev/core';
1+
import { component$, isBrowser } from '@qwik.dev/core';
22
import { inspectorLink } from './constant';
33
import { setupIframeThemeSync } from './iframe-theme';
44

5+
/**
6+
* Inspect iframe must load under app root (Vite `BASE_URL` + origin), not `location.pathname`,
7+
* so deep routes do not produce `.../nested/route__inspect/`.
8+
* SSR: no `location` — return empty until the client runs.
9+
*/
10+
function getInspectIframeSrc(): string {
11+
if (!isBrowser) {
12+
return '';
13+
}
14+
const base = new URL(import.meta.env.BASE_URL ?? '/', location.origin);
15+
return new URL(inspectorLink, base).href;
16+
}
17+
518
export const Inspect = component$(() => {
619
return (
720
<div class="h-full w-full flex-1 overflow-hidden rounded-2xl border border-glass-border bg-card-item-bg">
821
<iframe
9-
src={`${location.href}${inspectorLink}`}
22+
src={getInspectIframeSrc()}
1023
width={'100%'}
1124
height={'100%'}
1225
id="inspect_qwik"

packages/ui/src/features/inspect/iframe-theme.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ const GLASSMORPHISM_CSS = `
1313
--c-bg-base: transparent !important;
1414
--c-bg-nav: transparent !important;
1515
--c-bg-active: transparent !important;
16-
--iframe-border: rgba(255, 255, 255, 0.08) !important;
17-
--iframe-hover: rgba(255, 255, 255, 0.06) !important;
18-
color-scheme: dark;
16+
--iframe-border: rgba(0, 0, 0, 0.1) !important;
17+
--iframe-hover: rgba(0, 0, 0, 0.04) !important;
18+
color-scheme: light;
1919
}
2020
/* 仅针对主视图容器做透明处理,不再暴力让所有 div/section 变透明 */
2121
html, body, #app, main, header, nav, footer { background-color: transparent !important; }

0 commit comments

Comments
 (0)