Skip to content

The VS Code of video editing, built for agents.

TypeScript

Enhance macOS desktop experience with native vibrancy and sidebar styling

konstantin-paulus29824441b8a7
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index 80ca2ec1..6982c2dd 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -67,7 +67,9 @@ function createWindow(show = true) {
height: 800,
titleBarStyle: "hiddenInset",
trafficLightPosition: { x: 14, y: 14 },
- backgroundColor: "#1c1c1c",
+ ...(process.platform === "darwin"
+ ? { vibrancy: "sidebar" as const, backgroundColor: "#00000000" }
+ : { backgroundColor: "#1c1c1c" }),
webPreferences: {
preload: join(app.getAppPath(), "dist", "preload.js"),
},
diff --git a/apps/web/src/components/canvas/canvas.tsx b/apps/web/src/components/canvas/canvas.tsx
index 13d97e82..3df07478 100644
--- a/apps/web/src/components/canvas/canvas.tsx
+++ b/apps/web/src/components/canvas/canvas.tsx
@@ -145,7 +145,7 @@ export function Canvas() {
}
return (
- <div class="relative size-full">
+ <div class="relative size-full bg-background">
<div class="absolute inset-0">
<Toolbar />
<DrawOverlay />
diff --git a/apps/web/src/components/engine/timeline/render/background.ts b/apps/web/src/components/engine/timeline/render/background.ts
index 7c078886..b9950a55 100644
--- a/apps/web/src/components/engine/timeline/render/background.ts
+++ b/apps/web/src/components/engine/timeline/render/background.ts
@@ -2,10 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-import { hasComponent } from "bitecs";
-import { getCurrentResolution, getCurrentScrollX, framesToPixels } from "../utils";
import { assert } from "@/utils";
-import { DEFAULT_DURATION_FRAMES } from "../../constants";
import type { EngineWorld } from "../../api/world";
import type { TimelineContext } from "../world";
@@ -13,13 +10,8 @@ import { clearComponent } from "../../api/events";
export function renderBackground(world: EngineWorld, timeline: TimelineContext) {
const canvas = timeline.canvas!;
- const ctx = timeline.ctx!;
const pointer = timeline.pointer!;
- const scrollX = getCurrentScrollX(world);
- const resolution = getCurrentResolution(world);
- const scene = world.selection.scene;
-
const c = world.components;
// Handle marquee selection
@@ -50,21 +42,4 @@ export function renderBackground(world: EngineWorld, timeline: TimelineContext)
timeline.marquee = undefined;
}
}
-
- // Draw workarea background
- if (scene !== null && hasComponent(world, scene, c.Trim)) {
- const start = c.Trim.start[scene] ?? 0;
- const stopFrame = c.Trim.end[scene] ?? DEFAULT_DURATION_FRAMES;
- ctx.save();
-
- ctx.translate(-(scrollX * resolution), 0);
-
- const inPx = framesToPixels(world, start);
- const outPx = framesToPixels(world, stopFrame);
-
- ctx.fillStyle = timeline.colors.background.default;
- ctx.fillRect(inPx, 0, outPx - inPx, canvas.height);
-
- ctx.restore();
- }
}
diff --git a/apps/web/src/components/engine/timeline/render/ruler.ts b/apps/web/src/components/engine/timeline/render/ruler.ts
index ad26b7df..25507373 100644
--- a/apps/web/src/components/engine/timeline/render/ruler.ts
+++ b/apps/web/src/components/engine/timeline/render/ruler.ts
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-import { hasComponent } from "bitecs";
import { assert } from "@/utils";
import { RULER_INTERVALS } from "../constants";
import { RULER_HEIGHT, RULER_LABEL_Y, RULER_TICK_HEIGHT_MAJOR, RULER_TICK_HEIGHT_MINOR, TARGET_MAJOR_TICK_DISTANCE } from "../config";
@@ -18,7 +17,6 @@ let workareaTxOpen = false;
export function renderRuler(world: EngineWorld, timeline: TimelineContext) {
const ctx = timeline.ctx!;
- const canvas = timeline.canvas!;
const pointer = timeline.pointer!;
const scrollX = getCurrentScrollX(world);
@@ -31,22 +29,8 @@ export function renderRuler(world: EngineWorld, timeline: TimelineContext) {
ctx.save();
- ctx.beginPath()
- ctx.rect(0, 0, canvas.width, RULER_HEIGHT);
- ctx.closePath();
- ctx.fillStyle = timeline.colors.background.default;
- ctx.fill();
-
ctx.translate(-(scrollX * resolution), 0);
- if (scene && hasComponent(world, scene, c.Trim)) {
- const inPx = framesToPixels(world, c.Trim.start[scene]);
- const outPx = framesToPixels(world, c.Trim.end[scene]);
-
- ctx.fillStyle = timeline.colors.background.default;
- ctx.fillRect(inPx, 0, outPx - inPx, RULER_HEIGHT);
- }
-
const layout = getRulerLayout(world);
const [minX, maxX] = getRelativeViewport(world, timeline);
diff --git a/apps/web/src/components/engine/timeline/timeline.ts b/apps/web/src/components/engine/timeline/timeline.ts
index c9f370d0..ce4f1958 100644
--- a/apps/web/src/components/engine/timeline/timeline.ts
+++ b/apps/web/src/components/engine/timeline/timeline.ts
@@ -14,7 +14,7 @@ import {
renderLayers,
} from "./render";
import { pixelsToFrames, updateTimelineTransform } from "./utils";
-import { DEFAULT_TIMELINE_RESOLUTION, TIMELINE_RESOLUTION_RANGE, TIMELINE_PADDING_LEFT } from "./config";
+import { DEFAULT_TIMELINE_RESOLUTION, TIMELINE_RESOLUTION_RANGE, TIMELINE_PADDING_LEFT, RULER_HEIGHT } from "./config";
import { useEngine } from "@/context/engine";
import { useCursor } from "@/hooks/use-cursor";
import { createTimelineContext } from "./world";
@@ -87,15 +87,20 @@ export function createTimeline() {
try {
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
- ctx.fillStyle = timeline.colors.background.default;
- ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
timeline.cursor = 'default';
renderBackground(world, timeline);
+
+ ctx.save();
+ ctx.beginPath();
+ ctx.rect(0, RULER_HEIGHT, canvas.width, canvas.height);
+ ctx.clip();
renderLayers(world, timeline);
renderMarquee(world, timeline);
+ ctx.restore();
+
renderRuler(world, timeline);
renderWorkarea(world, timeline);
renderPlayhead(world, timeline);
diff --git a/apps/web/src/components/sidebar-left/assets.tsx b/apps/web/src/components/sidebar-left/assets.tsx
index 4523dd8c..858e94be 100644
--- a/apps/web/src/components/sidebar-left/assets.tsx
+++ b/apps/web/src/components/sidebar-left/assets.tsx
@@ -302,7 +302,7 @@ export function Assets() {
on:dragover={handleDragOver}
on:dragenter={handleDragEnter}
on:dragleave={handleDragLeave}
- class="relative flex flex-col flex-1 min-h-0 bg-background text-foreground text-sm focus:outline-none"
+ class="relative flex flex-col flex-1 min-h-0 text-foreground text-sm focus:outline-none"
tabIndex={0}
ref={root}
onKeyDown={handleKeyDown}
diff --git a/apps/web/src/components/timeline/layers/layers.tsx b/apps/web/src/components/timeline/layers/layers.tsx
index 7980146c..e6cdf2ee 100644
--- a/apps/web/src/components/timeline/layers/layers.tsx
+++ b/apps/web/src/components/timeline/layers/layers.tsx
@@ -103,7 +103,7 @@ export function Layers() {
style={{ 'grid-template-rows': `${RULER_HEIGHT}px 1fr` }}
data-timeline-layers-container
>
- <div class="w-full z-10 flex flex-row gap-1 pl-2 pr-3 items-center text-muted-foreground bg-background">
+ <div class="w-full z-10 flex flex-row gap-1 pl-2 pr-3 items-center text-muted-foreground">
<Tooltip placement="top">
<TooltipTrigger<typeof Button>
as={(triggerProps) => (
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index 8f956ca5..2029955d 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -48,6 +48,7 @@
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
+ --color-sidebar: var(--sidebar);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
@@ -116,6 +117,7 @@
--canvas: hsla(0, 0%, 91%, 1);
--background: hsla(0, 0%, 100%, 1);
+ --sidebar: hsla(0, 0%, 97%, 1);
--foreground: hsla(240, 5%, 9%, 1);
--card: hsla(0, 0%, 100%, 1);
--card-foreground: hsla(240, 5%, 9%, 1);
@@ -167,6 +169,7 @@
[data-kb-theme="dark"] {
--canvas: hsla(0, 0%, 9%, 1);
--background: hsla(0, 0%, 11%, 1);
+ --sidebar: hsla(0, 0%, 0%, 1);
--foreground: hsla(0, 0%, 95%, 1);
--card: hsla(0, 0%, 11%, 1);
--card-foreground: hsla(0, 0%, 95%, 1);
@@ -215,6 +218,21 @@
--meter-clip: hsla(60, 100%, 50%, 1);
}
+/* macOS desktop: the BrowserWindow uses native vibrancy, so the page keeps a
+ transparent background and the sidebars go translucent to let the blur show. */
+[data-platform="darwin"],
+[data-platform="darwin"] body {
+ background: transparent;
+}
+
+[data-platform="darwin"] {
+ --sidebar: hsla(0, 0%, 98%, 0.6);
+}
+
+[data-platform="darwin"][data-kb-theme="dark"] {
+ --sidebar: hsla(0, 0%, 2%, 0.4);
+}
+
@layer base {
* {
@apply border-border outline-ring/50 select-none;
diff --git a/apps/web/src/index.tsx b/apps/web/src/index.tsx
index 1521b93b..375640f6 100644
--- a/apps/web/src/index.tsx
+++ b/apps/web/src/index.tsx
@@ -22,6 +22,8 @@ if (import.meta.env.PROD) {
document.addEventListener('contextmenu', (e) => e.preventDefault())
if (window.desktop) {
+ document.documentElement.dataset.platform = window.desktop.platform;
+
const origRequest = FileSystemHandle.prototype.requestPermission;
FileSystemHandle.prototype.queryPermission = async function (desc) {
try {
diff --git a/apps/web/src/pages/editor.tsx b/apps/web/src/pages/editor.tsx
index f569280c..e90d9296 100644
--- a/apps/web/src/pages/editor.tsx
+++ b/apps/web/src/pages/editor.tsx
@@ -54,7 +54,7 @@ export function EditorPage() {
return (
<div
- class="bg-background h-screen w-full overflow-hidden grid"
+ class="bg-sidebar h-screen w-full overflow-hidden grid"
classList={{
'grid-cols-[264px_1px_1fr_1px_264px]': sidebarsVisible(),
'grid-cols-[1fr]': !sidebarsVisible(),