Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ import type {
PluginShareProjectOutcome,
WorkspaceProjectListView,
} from './state/projects';
import type { OpenDesignHostProjectImportSuccess } from '@open-design/host';
import { getOpenDesignHost, type OpenDesignHostProjectImportSuccess } from '@open-design/host';
import { useI18n } from './i18n';
import { liveArtifactTabId } from './types';
import type {
Expand Down Expand Up @@ -665,6 +665,7 @@ function AppInner() {
const { t } = useI18n();
const iframeKeepAlivePool = useIframeKeepAlivePool();
const clientType = useMemo(() => detectClientType(), []);
const hostPlatform = useMemo(() => getOpenDesignHost()?.client.platform, []);
useModalWindowDragGuard();
const workspaceContextState = useWorkspaceContext();
const {
Expand Down Expand Up @@ -716,7 +717,11 @@ function AppInner() {
// scrim to let the wallpaper show through more clearly; on focus the scrim
// returns to full strength (app-wash.css keys off this class).
useEffect(() => {
if (clientType !== 'desktop' || typeof window === 'undefined') return undefined;
if (
clientType !== 'desktop'
|| hostPlatform !== 'darwin'
|| typeof window === 'undefined'
) return undefined;
const root = document.documentElement;
const sync = () => root.classList.toggle('is-window-blurred', !document.hasFocus());
sync();
Expand All @@ -727,7 +732,7 @@ function AppInner() {
window.removeEventListener('blur', sync);
root.classList.remove('is-window-blurred');
};
}, [clientType]);
}, [clientType, hostPlatform]);
const [config, setConfig] = useState<AppConfig>(() => loadConfig());
const configRef = useRef(config);
configRef.current = config;
Expand Down Expand Up @@ -3497,6 +3502,7 @@ function AppInner() {
<div
className={`workspace-shell workspace-shell--${clientType}`}
data-client-type={clientType}
data-host-platform={hostPlatform}
>
<WorkspaceTabsBar
route={route}
Expand Down
21 changes: 11 additions & 10 deletions apps/web/src/styles/app-wash.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ body::before {
wallpaper blurs through the window, so the painted pastel blobs step aside.
html/body go fully transparent and the wash collapses to a translucent
cream scrim that keeps content readable over arbitrary wallpapers — the
Craft look. The .workspace-shell--desktop marker comes from the host
bridge (App.tsx data-client-type). Browsers never match this block. */
html:has(.workspace-shell--desktop) {
Craft look. The desktop and darwin markers come from the host bridge
(App.tsx data-client-type/data-host-platform). Windows desktop windows are
opaque, so they intentionally keep the normal pastel wash. */
html:has(.workspace-shell--desktop[data-host-platform='darwin']) {
/* Focused window: a firm scrim so content sits on a mostly solid ground.
The unfocused state below thins this back to ~21% (0.34 × 62%), which
preserves the airy see-through look while the window is in the back. */
Expand All @@ -88,17 +89,17 @@ html:has(.workspace-shell--desktop) {
);
background: transparent;
}
html:has(.workspace-shell--desktop) body {
html:has(.workspace-shell--desktop[data-host-platform='darwin']) body {
background: transparent;
}
/* Focus response: while the window is unfocused (App.tsx toggles
.is-window-blurred on <html> in desktop mode) the scrim thins out so the
wallpaper reads clearly through the glass; regaining focus fades it back
to full strength. Browsers never get the class, so web mode is untouched. */
html:has(.workspace-shell--desktop) body::before {
html:has(.workspace-shell--desktop[data-host-platform='darwin']) body::before {
transition: opacity 240ms cubic-bezier(0.23, 1, 0.32, 1);
}
html.is-window-blurred:has(.workspace-shell--desktop) body::before {
html.is-window-blurred:has(.workspace-shell--desktop[data-host-platform='darwin']) body::before {
opacity: 0.34;
}
/* The top project tab strip stays flush and seamless with the page below it:
Expand Down Expand Up @@ -126,8 +127,8 @@ html.is-window-blurred:has(.workspace-shell--desktop) body::before {
--veil-canvas: var(--bg);
--veil-panel: var(--bg-panel);
}
html:has(.workspace-shell--desktop),
html:has(.workspace-shell--desktop) body {
html:has(.workspace-shell--desktop[data-host-platform='darwin']),
html:has(.workspace-shell--desktop[data-host-platform='darwin']) body {
background: var(--bg-app);
}
}
Expand All @@ -143,8 +144,8 @@ html.is-window-blurred:has(.workspace-shell--desktop) body::before {
--veil-canvas: var(--bg);
--veil-panel: var(--bg-panel);
}
html:has(.workspace-shell--desktop),
html:has(.workspace-shell--desktop) body {
html:has(.workspace-shell--desktop[data-host-platform='darwin']),
html:has(.workspace-shell--desktop[data-host-platform='darwin']) body {
background: var(--bg-app);
}
}
17 changes: 17 additions & 0 deletions apps/web/tests/components/App.update-dialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,23 @@ describe('App updater dialog integration', () => {
vi.clearAllMocks();
});

it('exposes the desktop host platform on the workspace shell', () => {
restoreHost = installMockOpenDesignHost({
host: {
client: {
platform: 'win32',
},
},
});

const { container } = render(<App />);

expect(container.querySelector('.workspace-shell')).toHaveAttribute(
'data-host-platform',
'win32',
);
});

it('mounts the updater open-dialog subscription and handles the mac app menu request', async () => {
let openDialogListener: OpenDesignHostUpdaterOpenDialogListener | null = null;
const check = vi.fn(async () => idleStatus({ state: 'not-available' }));
Expand Down
21 changes: 21 additions & 0 deletions apps/web/tests/styles/app-wash-platform.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';

const appWashCss = readFileSync(
new URL('../../src/styles/app-wash.css', import.meta.url),
'utf8',
);

describe('desktop app wash platform contract', () => {
it('limits window-vibrancy material rules to macOS desktop hosts', () => {
const macDesktopSelector =
":has(.workspace-shell--desktop[data-host-platform='darwin'])";
const vibrancySelectors = appWashCss.match(
/html(?:\.is-window-blurred)?:has\(\.workspace-shell--desktop[^)]*\)(?: body(?:::before)?)?/g,
);

expect(vibrancySelectors).not.toBeNull();
expect(vibrancySelectors).not.toHaveLength(0);
expect(vibrancySelectors?.every((selector) => selector.includes(macDesktopSelector))).toBe(true);
});
});
Loading