mirror of
https://github.com/Sn3akyy1/lucid.git
synced 2026-11-20 13:41:51 +03:00
The docs rail's pill, as Settings' rail and Lumen's sidebar move it
The highlight no longer slides on a spring and wobbles. Its two edges move apart from each other the way the shell's glider does: the edge on the way leads (200ms, emphasized decelerate) and the other closes up behind it (330ms, standard), stretching with nothing overshooting the row. Each row's words and glyph light by how much of it the pill covers, the row it stops on turns its glyph filled and its words a weight up, and a glyph swells under the pointer and gives under a press. On phones the section you are on is a filled chip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -211,7 +211,7 @@
|
||||
|
||||
/* -------------------------------------------------------------- the bar */
|
||||
|
||||
// Theme.curveDefaultSpatial and curveStandard, as easing functions
|
||||
// Theme.curveDefaultSpatial, curveStandard and easeEmphasizedDecel, as easing functions
|
||||
function bezier(x1, y1, x2, y2) {
|
||||
return function (t) {
|
||||
if (t <= 0) return 0;
|
||||
@@ -226,7 +226,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
var spatial = bezier(0.38, 1.21, 0.22, 1), standard = bezier(0.2, 0, 0, 1);
|
||||
var spatial = bezier(0.38, 1.21, 0.22, 1), standard = bezier(0.2, 0, 0, 1), emphDecel = bezier(0.05, 0.7, 0.1, 1);
|
||||
|
||||
// the pages by name, the one you are on in the bar's accent pill, moving as lucidbar's
|
||||
// Workspaces does: the pill rides the lit name's own geometry, and a change starts it
|
||||
@@ -838,18 +838,78 @@
|
||||
var targets = links.map(function (a) { return document.getElementById(a.getAttribute("href").slice(1)); });
|
||||
var cur = -1, locked = false, unlock = 0, lockCap = 0;
|
||||
|
||||
function setOn(i) {
|
||||
if (i === cur) return;
|
||||
var first = cur < 0;
|
||||
// the pill for the section you are in, as Settings' rail and Lumen's sidebar draw
|
||||
// it. going to another row it stretches: the edge on the way leads (200ms,
|
||||
// emphasized decelerate), the other follows and closes up behind it (330ms,
|
||||
// standard), with nothing overshooting the row. from no row at all it appears in place
|
||||
var upper = 0, lower = 0, settled = false, edges = null, frame = 0;
|
||||
|
||||
// each row lights by how much of it the pill covers; the one it stops on arrives
|
||||
function lightRows() {
|
||||
var shown = pill && pill.offsetParent !== null;
|
||||
links.forEach(function (a, k) {
|
||||
var lit = 0;
|
||||
if (!shown) {
|
||||
lit = k === cur ? 1 : 0;
|
||||
} else if (settled) {
|
||||
var t = a.offsetTop, b = t + a.offsetHeight;
|
||||
lit = Math.max(0, Math.min(1, (Math.min(b, lower) - Math.max(t, upper)) / Math.max(1, a.offsetHeight)));
|
||||
}
|
||||
a.style.setProperty("--lit", lit.toFixed(3));
|
||||
a.classList.toggle("arrived", k === cur && lit > 0.5);
|
||||
});
|
||||
}
|
||||
|
||||
function drawPill() {
|
||||
pill.style.translate = "0 " + upper.toFixed(2) + "px";
|
||||
pill.style.height = Math.max(0, lower - upper).toFixed(2) + "px";
|
||||
lightRows();
|
||||
}
|
||||
|
||||
function step(now) {
|
||||
frame = 0;
|
||||
if (!edges) return;
|
||||
var e = edges, tu = Math.min(1, (now - e.t0) / e.du), tl = Math.min(1, (now - e.t0) / e.dl);
|
||||
upper = e.u0 + (e.u1 - e.u0) * e.eu(tu);
|
||||
lower = e.l0 + (e.l1 - e.l0) * e.el(tl);
|
||||
drawPill();
|
||||
if (tu < 1 || tl < 1) frame = requestAnimationFrame(step);
|
||||
else edges = null;
|
||||
}
|
||||
|
||||
function follow(i, jump) {
|
||||
var a = links[i];
|
||||
if (!pill) return lightRows();
|
||||
if (!a || pill.offsetParent === null || a.offsetParent === null) {
|
||||
settled = false;
|
||||
edges = null;
|
||||
pill.classList.remove("shown");
|
||||
return lightRows();
|
||||
}
|
||||
var t = a.offsetTop, b = t + a.offsetHeight;
|
||||
if (!settled || jump || reduce) {
|
||||
edges = null;
|
||||
upper = t;
|
||||
lower = b;
|
||||
settled = true;
|
||||
pill.classList.add("shown");
|
||||
return drawPill();
|
||||
}
|
||||
if (Math.abs(t - upper) < 0.5 && Math.abs(b - lower) < 0.5) return;
|
||||
var down = t > upper;
|
||||
edges = {
|
||||
t0: performance.now(), u0: upper, l0: lower, u1: t, l1: b,
|
||||
du: down ? 330 : 200, dl: down ? 200 : 330,
|
||||
eu: down ? standard : emphDecel, el: down ? emphDecel : standard
|
||||
};
|
||||
if (!frame) frame = requestAnimationFrame(step);
|
||||
}
|
||||
|
||||
function setOn(i, jump) {
|
||||
if (i === cur && !jump) return;
|
||||
cur = i;
|
||||
links.forEach(function (a, k) { a.classList.toggle("on", k === i); });
|
||||
if (pill && links[i]) {
|
||||
if (!first) pill.classList.add("glide");
|
||||
pill.style.translate = "0 " + links[i].offsetTop + "px";
|
||||
pill.style.height = links[i].offsetHeight + "px";
|
||||
pill.style.opacity = links[i].offsetParent ? 1 : 0;
|
||||
if (!first) setTimeout(function () { jelly(pill, 0.05, 0.2); }, 200);
|
||||
}
|
||||
follow(i, jump);
|
||||
// the rail keeps the lit row in sight when it scrolls itself
|
||||
var r = $("[data-rail]");
|
||||
if (r && links[i] && r.scrollHeight > r.clientHeight) {
|
||||
@@ -906,11 +966,7 @@
|
||||
mark();
|
||||
});
|
||||
}, { passive: true });
|
||||
addEventListener("resize", function () {
|
||||
var i = cur;
|
||||
cur = -1;
|
||||
setOn(Math.max(0, i));
|
||||
});
|
||||
addEventListener("resize", function () { setOn(Math.max(0, cur), true); });
|
||||
mark();
|
||||
|
||||
// search: what doesn't match folds away, part by part, the way Settings filters
|
||||
|
||||
+56
-13
@@ -2465,38 +2465,73 @@ html:not(.js) .pg-row > .pg.on {
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
/* Settings' rail and Lumen's sidebar: a row's words and glyph take the pill's colour by
|
||||
how much of the row it covers right now (--lit, set by script.js each frame), so they
|
||||
light as it arrives and the rows it passes only flicker; the row it stops on turns
|
||||
its glyph filled and its words a weight up */
|
||||
.rail-nav a {
|
||||
--lit: 0;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
column-gap: 14px;
|
||||
height: 48px;
|
||||
padding: 0 16px;
|
||||
border-radius: 999px;
|
||||
color: var(--text);
|
||||
font-weight: 560;
|
||||
color: color-mix(in oklab, var(--on-accent-c) calc(var(--lit) * 100%), var(--text-2));
|
||||
font-weight: 500;
|
||||
text-decoration: none !important;
|
||||
transition: color var(--d-medium) var(--ease-std), background-color var(--d-quick) var(--ease-std);
|
||||
transition: background-color var(--d-quick) var(--ease-std);
|
||||
}
|
||||
|
||||
.rail-nav a:hover {
|
||||
background: var(--hover);
|
||||
}
|
||||
|
||||
.rail-nav a.on {
|
||||
color: var(--on-accent-c);
|
||||
background: transparent;
|
||||
.rail-nav a.on:hover {
|
||||
background: color-mix(in oklab, var(--on-accent-c) 8%, transparent);
|
||||
}
|
||||
|
||||
.rail-nav a .i {
|
||||
transition: scale var(--d-spring-fast) var(--spring-fast);
|
||||
.rail-nav a.arrived {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.rail-nav a.on .i {
|
||||
/* the glyph swells under the pointer and gives under a press, on the spatial curve */
|
||||
.rail-nav a > .i {
|
||||
grid-row: 1;
|
||||
grid-column: 1;
|
||||
transition: scale 500ms cubic-bezier(0.38, 1.21, 0.22, 1), opacity var(--d-short) var(--ease-std);
|
||||
}
|
||||
|
||||
.rail-nav a:hover > .i {
|
||||
scale: 1.12;
|
||||
}
|
||||
|
||||
.rail-nav a:active > .i {
|
||||
scale: 0.92;
|
||||
}
|
||||
|
||||
.rail-nav a > .i:nth-of-type(2),
|
||||
.rail-nav a.arrived > .i:nth-of-type(1) {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.rail-nav a.arrived > .i:nth-of-type(2) {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.rail-nav a > span {
|
||||
grid-column: 2;
|
||||
}
|
||||
|
||||
/* before script.js, or without it, the section you are on is still lit */
|
||||
html:not(.js) .rail-nav a.on {
|
||||
--lit: 1;
|
||||
background: var(--accent-c);
|
||||
}
|
||||
|
||||
.rail-pill {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
@@ -2506,11 +2541,14 @@ html:not(.js) .pg-row > .pg.on {
|
||||
border-radius: 999px;
|
||||
background: var(--accent-c);
|
||||
opacity: 0;
|
||||
scale: 0.94;
|
||||
pointer-events: none;
|
||||
transition: opacity var(--d-short) var(--ease-std), scale var(--d-short) cubic-bezier(0.2, 0, 0, 1);
|
||||
}
|
||||
|
||||
.rail-pill.glide {
|
||||
transition: translate var(--d-spring) var(--spring), opacity var(--d-short) var(--ease-std);
|
||||
.rail-pill.shown {
|
||||
opacity: 1;
|
||||
scale: 1;
|
||||
}
|
||||
|
||||
.rail-nav a span {
|
||||
@@ -3576,6 +3614,11 @@ main,
|
||||
background: var(--s3);
|
||||
}
|
||||
|
||||
/* chips here, no pill to glide: the one you are on is filled */
|
||||
.rail-nav a.on {
|
||||
background: var(--accent-c);
|
||||
}
|
||||
|
||||
.support,
|
||||
.palette-grid,
|
||||
.closing {
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
<nav class="rail-nav" data-rail-nav aria-label="Docs">
|
||||
<span class="rail-pill" aria-hidden="true"></span>
|
||||
<p class="rail-group">Getting started</p>
|
||||
<a href="#install">{{icon download}}<span>Install</span></a>
|
||||
<a href="#updating">{{icon update}}<span>Updating</span></a>
|
||||
<a href="#install">{{icon download}}{{icon download fill}}<span>Install</span></a>
|
||||
<a href="#updating">{{icon update}}{{icon update fill}}<span>Updating</span></a>
|
||||
<p class="rail-group">The desktop</p>
|
||||
<a href="#whats-in-it">{{icon widgets}}<span>What's in it</span></a>
|
||||
<a href="#theming">{{icon palette}}<span>Theming</span></a>
|
||||
<a href="#whats-in-it">{{icon widgets}}{{icon widgets fill}}<span>What's in it</span></a>
|
||||
<a href="#theming">{{icon palette}}{{icon palette fill}}<span>Theming</span></a>
|
||||
<p class="rail-group">Reference</p>
|
||||
<a href="#keybinds">{{icon keyboard}}<span>Keybinds</span></a>
|
||||
<a href="#ipc-reference">{{icon terminal}}<span>IPC</span></a>
|
||||
<a href="#requirements">{{icon inventory_2}}<span>Requirements</span></a>
|
||||
<a href="#faq">{{icon help}}<span>Questions</span></a>
|
||||
<a href="#keybinds">{{icon keyboard}}{{icon keyboard fill}}<span>Keybinds</span></a>
|
||||
<a href="#ipc-reference">{{icon terminal}}{{icon terminal fill}}<span>IPC</span></a>
|
||||
<a href="#requirements">{{icon inventory_2}}{{icon inventory_2 fill}}<span>Requirements</span></a>
|
||||
<a href="#faq">{{icon help}}{{icon help fill}}<span>Questions</span></a>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user