mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 02:39:13 +00:00
Hovering used to move and resize the dock window, and WebView2 presents one stale frame at every window change, which read as the rail drifting and glitching. One transparent window is now sized once per placement for the fully expanded rail plus the bubble's reach and never moves on hover. A 60 Hz cursor poll, the counterpart of the mac's global event monitor, makes the window click-through everywhere but the painted shapes, synthesizes hover for the page, and drives dragging. Drag follows CapacityDockController: the page owns the 3 px threshold and passes the press point, Rust keeps the rail under the pointer, morphs the flare away as it leaves an edge, and on release snaps to any edge within 44 px or leaves the rail floating, then hands the page the old rail rect so it glides into place with the mac's attach and detach curves. Placement (docked edge, orientation, normalized offsets) persists in windows-dock.json. Top and bottom give a horizontal rail with the bubble below or above; a floating rail keeps its orientation and puts the bubble where there is room. The context menu gains Dock to Edge with all four edges. The layout stays a pure function with unit tests, and every window metric stays a whole pixel. windows-sys gains one feature flag for the cursor and button reads; no versions change.
300 lines
6 KiB
CSS
300 lines
6 KiB
CSS
/* Capacity Dock, the Windows twin of mac/Sources/CodeBurnMenubar/Views/CapacityDockView.swift.
|
|
Metrics come from src/dockGeometry.ts (the mac values at its 0.6 default scale) and the
|
|
window that holds them is sized in src-tauri/src/dock.rs; all three stay in step. The dock is
|
|
always the mac's dark graphite surface, whichever theme the popover is in. */
|
|
|
|
:root {
|
|
/* Warm off-white: a mild orange tint so bright labels on the dark card read softer. */
|
|
--dock-text: #FAF2E6;
|
|
--dock-green: #30D158;
|
|
--dock-yellow: #FFD60A;
|
|
--dock-orange: #FF9F0A;
|
|
--dock-red: #FF453A;
|
|
--dock-rail-expand: cubic-bezier(0.22, 1, 0.36, 1);
|
|
--dock-detail-present: cubic-bezier(0.16, 1, 0.3, 1);
|
|
--dock-detail-follow: cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
--dock-detail-dismiss: cubic-bezier(0.4, 0, 1, 1);
|
|
}
|
|
|
|
.dock {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
font-family: var(--font-sans);
|
|
color: var(--dock-text);
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
}
|
|
|
|
.dock-surface {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: block;
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* Rail */
|
|
|
|
.dock-rail {
|
|
position: absolute;
|
|
box-sizing: border-box;
|
|
will-change: left, top, width, height;
|
|
touch-action: none;
|
|
}
|
|
|
|
.dock-rail.is-dragging {
|
|
cursor: grabbing;
|
|
}
|
|
|
|
.dock-rows {
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 7px;
|
|
}
|
|
|
|
.dock-row {
|
|
appearance: none;
|
|
border: 0;
|
|
margin: 0;
|
|
padding: 0;
|
|
background: none;
|
|
color: inherit;
|
|
font: inherit;
|
|
cursor: default;
|
|
height: 50px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 4px;
|
|
}
|
|
|
|
.dock-row:focus-visible {
|
|
outline: none;
|
|
}
|
|
|
|
.dock-gauge {
|
|
position: relative;
|
|
width: 31px;
|
|
height: 31px;
|
|
display: grid;
|
|
place-items: center;
|
|
}
|
|
|
|
.dock-ring {
|
|
position: absolute;
|
|
top: -3px;
|
|
left: -3px;
|
|
overflow: visible;
|
|
}
|
|
|
|
.dock-ring-arc {
|
|
transition: stroke-dasharray 240ms var(--ease-ui), stroke 240ms var(--ease-ui);
|
|
}
|
|
|
|
.dock-glyph {
|
|
position: relative;
|
|
display: grid;
|
|
place-items: center;
|
|
color: #fff;
|
|
}
|
|
|
|
.dock-glyph.is-loading {
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.dock-row-alert {
|
|
position: absolute;
|
|
top: -3px;
|
|
right: -3px;
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 50%;
|
|
background: var(--dock-red);
|
|
box-shadow: 0 0 0 1.5px #000;
|
|
}
|
|
|
|
.dock-pct {
|
|
font-size: 10px;
|
|
font-weight: 500;
|
|
line-height: 12px;
|
|
font-variant-numeric: tabular-nums;
|
|
color: var(--dock-text);
|
|
}
|
|
|
|
.dock-pct.is-empty { color: rgba(250, 242, 230, 0.72); }
|
|
.dock-pct.is-warning { color: var(--dock-yellow); }
|
|
.dock-pct.is-critical { color: var(--dock-orange); }
|
|
.dock-pct.is-danger { color: var(--dock-red); }
|
|
|
|
/* Detail bubble */
|
|
|
|
.dock-detail {
|
|
position: absolute;
|
|
box-sizing: border-box;
|
|
transition:
|
|
transform 200ms var(--dock-detail-present),
|
|
opacity 200ms var(--dock-detail-present),
|
|
top 220ms var(--dock-detail-follow),
|
|
left 220ms var(--dock-detail-follow);
|
|
}
|
|
|
|
/* Measured before it is placed: laid out at full size, but neither seen nor hit. */
|
|
.dock-detail.is-measuring {
|
|
visibility: hidden;
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* Starts a step toward the rail so the bubble emerges from the dock. */
|
|
.dock-detail.is-entering {
|
|
opacity: 0;
|
|
transition: none;
|
|
}
|
|
.dock-detail.is-entering.is-tail-right { transform: translateX(10px); }
|
|
.dock-detail.is-entering.is-tail-left { transform: translateX(-10px); }
|
|
.dock-detail.is-entering.is-tail-top { transform: translateY(-10px); }
|
|
.dock-detail.is-entering.is-tail-bottom { transform: translateY(10px); }
|
|
|
|
.dock-detail.is-dismissing.is-tail-right { transform: translateX(6px); }
|
|
.dock-detail.is-dismissing.is-tail-left { transform: translateX(-6px); }
|
|
.dock-detail.is-dismissing.is-tail-top { transform: translateY(-6px); }
|
|
.dock-detail.is-dismissing.is-tail-bottom { transform: translateY(6px); }
|
|
|
|
.dock-detail.is-dismissing {
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
transition:
|
|
transform 140ms var(--dock-detail-dismiss),
|
|
opacity 140ms var(--dock-detail-dismiss);
|
|
}
|
|
|
|
.dock-detail-body {
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
}
|
|
|
|
.dock-detail-head {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 7px;
|
|
}
|
|
|
|
.dock-detail-glyph {
|
|
display: grid;
|
|
place-items: center;
|
|
color: var(--dock-text);
|
|
flex: 0 0 auto;
|
|
}
|
|
|
|
.dock-detail-title {
|
|
font-size: 17px;
|
|
font-weight: 600;
|
|
line-height: 1.2;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.dock-detail-plan {
|
|
margin-left: auto;
|
|
font-size: 10px;
|
|
font-weight: 500;
|
|
color: rgba(250, 242, 230, 0.62);
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.dock-conn,
|
|
.dock-conn-reason,
|
|
.dock-conn-hint,
|
|
.dock-conn-instruction {
|
|
margin: 0;
|
|
}
|
|
|
|
.dock-conn-block {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 3px;
|
|
}
|
|
|
|
.dock-conn.is-loading {
|
|
font-size: 10px;
|
|
color: rgba(250, 242, 230, 0.52);
|
|
}
|
|
|
|
.dock-conn.is-disconnected {
|
|
font-size: 11px;
|
|
color: rgba(250, 242, 230, 0.6);
|
|
}
|
|
|
|
.dock-conn.is-failed {
|
|
font-size: 11px;
|
|
font-weight: 600;
|
|
color: var(--dock-red);
|
|
}
|
|
|
|
.dock-conn-reason {
|
|
font-size: 10px;
|
|
color: rgba(250, 242, 230, 0.58);
|
|
}
|
|
|
|
.dock-conn-hint {
|
|
font-size: 10px;
|
|
color: rgba(250, 242, 230, 0.72);
|
|
}
|
|
|
|
.dock-conn-instruction {
|
|
font-size: 12px;
|
|
color: rgba(250, 242, 230, 0.62);
|
|
}
|
|
|
|
.dock-window {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 5px;
|
|
}
|
|
|
|
.dock-window-top {
|
|
display: flex;
|
|
align-items: baseline;
|
|
justify-content: space-between;
|
|
gap: 7px;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.dock-window-label {
|
|
color: rgba(250, 242, 230, 0.82);
|
|
}
|
|
|
|
.dock-window-pct {
|
|
font-variant-numeric: tabular-nums;
|
|
color: var(--dock-text);
|
|
}
|
|
|
|
.dock-track {
|
|
height: 5px;
|
|
border-radius: 999px;
|
|
background: rgba(250, 242, 230, 0.14);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.dock-fill {
|
|
height: 100%;
|
|
border-radius: 999px;
|
|
background: var(--dock-green);
|
|
}
|
|
|
|
.dock-fill.is-warning { background: var(--dock-yellow); }
|
|
.dock-fill.is-critical { background: var(--dock-orange); }
|
|
.dock-fill.is-danger { background: var(--dock-red); }
|
|
|
|
.dock-window-resets {
|
|
align-self: flex-end;
|
|
font-size: 10px;
|
|
font-variant-numeric: tabular-nums;
|
|
color: rgba(250, 242, 230, 0.5);
|
|
}
|