Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

perf(hub): fix iPhone instability and hero counter jank on clianything.cc

yuhao39634a640cf2
diff --git a/docs/hub/demos.html b/docs/hub/demos.html
index 262c4bd49..63df160e7 100644
--- a/docs/hub/demos.html
+++ b/docs/hub/demos.html
@@ -76,13 +76,15 @@
/* ambient + grain + glass (shared) */
.ambient { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
- .ambient i { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.7; }
+ /* no filter:blur() — pre-blurred gradients read the same and cost a fraction on mobile GPUs */
+ .ambient i { position: absolute; border-radius: 50%; opacity: 0.7; }
.ambient .a { width: 60vw; max-width: 760px; aspect-ratio: 1; top: -18vw; right: -10vw;
- background: radial-gradient(circle at 38% 38%, hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.26), transparent 64%); }
+ background: radial-gradient(circle at 38% 38%, hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.26), hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.10) 40%, transparent 68%); }
.ambient .b { width: 50vw; max-width: 620px; aspect-ratio: 1; bottom: -16vw; left: -12vw;
- background: radial-gradient(circle at 60% 42%, hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.24), transparent 62%); }
+ background: radial-gradient(circle at 60% 42%, hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.24), hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.09) 38%, transparent 66%); }
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.04; mix-blend-mode: overlay;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
+ @media (hover: none), (pointer: coarse) { .grain { display: none; } }
.glass { position: relative; background: var(--glass-bg-fallback); border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--glass-shadow); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
.glass { background: var(--glass-bg); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); } }
@@ -170,6 +172,8 @@
/* ===================== Editorial gallery ===================== */
.editorial { max-width: 1100px; margin: 56px auto 0; padding: 0 22px; display: flex; flex-direction: column; gap: 64px; }
.ed-row { display: grid; grid-template-columns: 1.22fr 1fr; gap: 40px; align-items: center; }
+ /* grid items default to min-width:auto — media was pushing the page wider than phones */
+ .ed-row > * { min-width: 0; }
.ed-row:nth-child(even) .ed-media { order: 2; }
@media (max-width: 840px) { .ed-row { grid-template-columns: 1fr; gap: 22px; } .ed-row:nth-child(even) .ed-media { order: 0; } }
.ed-num { font-family: 'Newsreader', serif; font-style: italic; font-size: 1.05rem; color: var(--ink-3); }
diff --git a/docs/hub/docs.html b/docs/hub/docs.html
index 683620bd0..f87a8adb4 100644
--- a/docs/hub/docs.html
+++ b/docs/hub/docs.html
@@ -76,13 +76,15 @@
/* ambient + grain + glass (shared) */
.ambient { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
- .ambient i { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.7; }
+ /* no filter:blur() — pre-blurred gradients read the same and cost a fraction on mobile GPUs */
+ .ambient i { position: absolute; border-radius: 50%; opacity: 0.7; }
.ambient .a { width: 60vw; max-width: 760px; aspect-ratio: 1; top: -18vw; right: -10vw;
- background: radial-gradient(circle at 38% 38%, hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.26), transparent 64%); }
+ background: radial-gradient(circle at 38% 38%, hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.26), hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.10) 40%, transparent 68%); }
.ambient .b { width: 50vw; max-width: 620px; aspect-ratio: 1; bottom: -16vw; left: -12vw;
- background: radial-gradient(circle at 60% 42%, hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.24), transparent 62%); }
+ background: radial-gradient(circle at 60% 42%, hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.24), hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.09) 38%, transparent 66%); }
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.04; mix-blend-mode: overlay;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
+ @media (hover: none), (pointer: coarse) { .grain { display: none; } }
/* ===================== Nav (shared with Hub) ===================== */
.nav { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid transparent; transition: border-color .3s, background .3s, backdrop-filter .3s; }
diff --git a/docs/hub/index.html b/docs/hub/index.html
index b7e71c45f..127f869d5 100644
--- a/docs/hub/index.html
+++ b/docs/hub/index.html
@@ -125,16 +125,22 @@
/* ===================== Ambient backdrop ===================== */
.ambient { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
- .ambient i { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.7; will-change: transform; }
+ /* No filter:blur() here — a 100px blur over three ~700px fixed layers is one of the most
+ expensive things a page can ask a mobile GPU to hold. The radial gradients below fade
+ to transparent well before their edge, which reads identically to the blurred version. */
+ .ambient i { position: absolute; border-radius: 50%; opacity: 0.7; }
.ambient .a { width: 60vw; max-width: 760px; aspect-ratio: 1; top: -18vw; right: -10vw;
- background: radial-gradient(circle at 38% 38%, hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.26), transparent 64%); }
+ background: radial-gradient(circle at 38% 38%, hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.26), hsl(calc(var(--accent-band) + 28) var(--tint-s) 58% / 0.10) 40%, transparent 68%); }
.ambient .b { width: 54vw; max-width: 680px; aspect-ratio: 1; bottom: -16vw; left: -12vw;
- background: radial-gradient(circle at 60% 42%, hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.24), transparent 62%); }
+ background: radial-gradient(circle at 60% 42%, hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.24), hsl(var(--accent-band) calc(var(--tint-s) + 12%) 56% / 0.09) 38%, transparent 66%); }
.ambient .c { width: 46vw; max-width: 560px; aspect-ratio: 1; top: 42%; left: 50%;
- background: radial-gradient(circle, hsl(calc(var(--accent-band) - 22) var(--tint-s) 54% / 0.14), transparent 66%); }
+ background: radial-gradient(circle, hsl(calc(var(--accent-band) - 22) var(--tint-s) 54% / 0.14), hsl(calc(var(--accent-band) - 22) var(--tint-s) 54% / 0.06) 40%, transparent 70%); }
[data-theme="light"] .ambient i { opacity: 0.55; }
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.04; mix-blend-mode: overlay;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
+ /* The full-viewport blend layer forces the whole page through an offscreen compositing
+ group; on phone GPUs that costs more than the texture is worth. */
+ @media (hover: none), (pointer: coarse) { .grain { display: none; } }
/* ===================== Glass primitive ===================== */
.glass {
@@ -144,9 +150,15 @@
border-radius: var(--radius);
box-shadow: var(--glass-shadow);
}
- @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- .glass { background: var(--glass-bg);
- -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); }
+ /* Real backdrop blur is desktop-only. Each blurred surface is its own composited layer
+ that re-reads the backdrop, and this page has dozens at once — enough to blow past
+ iOS Safari's per-tab GPU budget (the page reloads/white-flashes on iPhone). Touch
+ devices get the tuned --glass-bg-fallback, which was designed to stand alone. */
+ @media (hover: hover) and (pointer: fine) {
+ @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
+ .glass { background: var(--glass-bg);
+ -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); }
+ }
}
.glass::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 0 0 1px rgba(255,255,255,0.02); }
@@ -280,8 +292,10 @@
.stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.stat { padding: 13px 24px; border-radius: 15px; text-align: center; min-width: 130px;
background: var(--glass-bg-fallback); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); position: relative; }
- @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- .stat { background: var(--glass-bg); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); }
+ @media (hover: hover) and (pointer: fine) {
+ @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
+ .stat { background: var(--glass-bg); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); }
+ }
}
/* Stat figures use the SAME two-token accent rule as the italic "Anything" word in the
title (accent2 in light, accent in dark), so they recolor with palette + theme, and
@@ -295,12 +309,17 @@
/* align-items: stretch makes the two side-by-side cards equal height; each card is a
column flexbox so its inner content distributes evenly down to the matched height. */
.empower-row { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; margin-top: 38px; text-align: left; align-items: stretch; }
+ /* grid items default to min-width:auto, so the no-wrap install command was forcing the
+ card — and the whole page — wider than a phone screen (627px on a 390px viewport) */
+ .empower-row > .empower-card { min-width: 0; }
@media (max-width: 820px) { .empower-row { grid-template-columns: 1fr; } }
.empower-card { padding: 24px 24px 22px; border-radius: var(--radius); border: 1px solid var(--glass-border);
background: var(--glass-bg-fallback); box-shadow: var(--glass-shadow); position: relative;
display: flex; flex-direction: column; }
- @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- .empower-card { background: var(--glass-bg); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); }
+ @media (hover: hover) and (pointer: fine) {
+ @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
+ .empower-card { background: var(--glass-bg); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); }
+ }
}
.empower-card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
box-shadow: inset 0 1px 0 var(--glass-edge); }
@@ -365,8 +384,10 @@
.typing-shell { width: 100%; max-width: 720px; margin: 0 auto; border-radius: var(--radius-sm); overflow: hidden;
padding: 13px 15px 14px; border: 1px solid var(--glass-border); background: var(--glass-bg-fallback);
box-shadow: var(--glass-shadow); position: relative; }
- @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- .typing-shell { background: var(--glass-bg); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); }
+ @media (hover: hover) and (pointer: fine) {
+ @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
+ .typing-shell { background: var(--glass-bg); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); }
+ }
}
.typing-shell-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
margin-bottom: 9px; }
@@ -406,7 +427,11 @@
.deck-stage { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.deck-viewport { overflow: hidden; touch-action: pan-y; cursor: grab; }
.deck-viewport.dragging { cursor: grabbing; }
- .deck-track { display: flex; transition: transform .5s var(--spring); will-change: transform; }
+ /* will-change only while the deck actually moves (deck-sliding is armed on every drag or
+ animated switch) — a permanent will-change would pin the full-height two-panel track
+ as a composited layer, a large standing GPU allocation on phones. */
+ .deck-track { display: flex; transition: transform .5s var(--spring); }
+ html.deck-sliding .deck-track { will-change: transform; }
.deck-track.is-dragging { transition: none; }
/* Each panel is exactly one viewport wide; the track slides by one full panel width
between decks. (Replaces the old over-wide "peek" carousel that mis-measured its
@@ -469,16 +494,29 @@
/* Cap to the visible viewport (not the over-wide carousel panel) so the grid's own width
tracks the real screen — this lets masonryColumnCount pick 3/2/1 columns responsively. */
.grid { display: flex; align-items: flex-start; gap: 18px; max-width: min(1044px, calc(100vw - 108px)); padding-bottom: 24px; }
+ /* phones: the panel is exactly viewport-wide now, so let cards use the full column
+ instead of the desktop's defensive 100vw-108px cap (which left ~60px dead space) */
+ @media (max-width: 640px) { .grid { max-width: 100%; } }
.grid-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
/* the .empty / error state is a direct child of .grid (not wrapped in a column) */
.grid > .empty { flex: 1 1 100%; }
- .card { perspective: 1600px; position: relative; }
+ /* Cards are FLAT by default. Safari cannot flatten a perspective + preserve-3d +
+ backface-visibility context and re-renders each one per frame — with ~150 of them this
+ is the biggest static cost on the page (the deck-slide suspender below already proved
+ the flat state renders the correct face via backface-visibility with no glitch).
+ The real 3D context is enabled per-card only while it is hovered or mid-flip (.is-3d,
+ set by setCardFlipped for the duration of the flip transition). */
+ .card { position: relative; }
.card-inner { position: absolute; inset: 0; width: 100%; height: 100%;
- transform-style: preserve-3d; transition: transform .72s var(--flip-ease); }
+ transform-style: flat; transition: transform .72s var(--flip-ease); }
.card.flipped .card-inner { transform: rotateY(180deg); }
+ .card.is-3d { perspective: 1600px; }
+ .card.is-3d .card-inner { transform-style: preserve-3d; }
/* subtle hover tilt hint (does not auto-flip) */
@media (hover: hover) {
+ .card:hover { perspective: 1600px; }
+ .card:hover .card-inner { transform-style: preserve-3d; }
.card:not(.flipped):hover .card-inner { transform: rotateY(-5deg) rotateX(2.5deg); }
}
.card-face {
@@ -490,11 +528,15 @@
var(--glass-bg-fallback);
box-shadow: var(--glass-shadow); overflow: hidden;
}
- @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- .card-face { background:
- radial-gradient(120% 90% at 0% 0%, hsl(var(--ch, var(--hue-default)) var(--tint-s) var(--tint-l) / 0.18), transparent 56%),
- var(--glass-bg);
- -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); }
+ /* ~110 live card faces at once — the single biggest backdrop-filter population on the
+ page. Desktop pointers only (see the .glass note above). */
+ @media (hover: hover) and (pointer: fine) {
+ @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
+ .card-face { background:
+ radial-gradient(120% 90% at 0% 0%, hsl(var(--ch, var(--hue-default)) var(--tint-s) var(--tint-l) / 0.18), transparent 56%),
+ var(--glass-bg);
+ -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); }
+ }
}
.card-face::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
box-shadow: inset 0 1px 0 var(--glass-edge); z-index: 3; }
@@ -647,8 +689,10 @@
min-width: 240px; max-width: 320px; padding: 12px; border-radius: 12px; border: 1px solid var(--glass-border);
background: var(--glass-bg-fallback); box-shadow: var(--glass-shadow-hi); z-index: 20;
opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; display: flex; flex-direction: column; gap: 8px; }
- @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- .skill-popover-panel { background: var(--glass-bg); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); }
+ @media (hover: hover) and (pointer: fine) {
+ @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
+ .skill-popover-panel { background: var(--glass-bg); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); }
+ }
}
.skill-popover.is-open .skill-popover-panel { opacity: 1; pointer-events: auto; transform: translateX(-50%); }
.skill-popover-label { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
@@ -680,11 +724,18 @@
.shelf > .mcard { flex: 0 0 84%; scroll-snap-align: center; }
}
/* matrix flip card — reuses .card / .card-inner / .card-face machinery, taller min-height */
- .mcard { perspective: 1600px; min-height: 372px; position: relative; }
+ /* flat-by-default like .card above; 3D only on hover / mid-flip */
+ .mcard { min-height: 372px; position: relative; }
.mcard .card-inner { position: absolute; inset: 0; width: 100%; height: 100%;
- transform-style: preserve-3d; transition: transform .72s var(--flip-ease); }
+ transform-style: flat; transition: transform .72s var(--flip-ease); }
.mcard.flipped .card-inner { transform: rotateY(180deg); }
- @media (hover: hover) { .mcard:not(.flipped):hover .card-inner { transform: rotateY(-4deg) rotateX(2deg); } }
+ .mcard.is-3d { perspective: 1600px; }
+ .mcard.is-3d .card-inner { transform-style: preserve-3d; }
+ @media (hover: hover) {
+ .mcard:hover { perspective: 1600px; }
+ .mcard:hover .card-inner { transform-style: preserve-3d; }
+ .mcard:not(.flipped):hover .card-inner { transform: rotateY(-4deg) rotateX(2deg); }
+ }
.mcard .card-sizer { position: relative; width: 100%; min-height: inherit; }
.mcard .card-sizer .card-face { position: relative; box-shadow: none; border: 1px solid transparent; background: none; visibility: hidden;
-webkit-backdrop-filter: none; backdrop-filter: none; }
@@ -853,8 +904,10 @@
}
.dposter { display: flex; flex-direction: column; padding: 14px; border-radius: var(--radius); text-decoration: none; color: inherit;
background: var(--glass-bg-fallback); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); position: relative; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
- @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- .dposter { background: var(--glass-bg); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); } }
+ @media (hover: hover) and (pointer: fine) {
+ @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
+ .dposter { background: var(--glass-bg); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); } }
+ }
.dposter:hover { transform: translateY(-4px); box-shadow: var(--glass-shadow-hi); }
.dt-media { position: relative; border-radius: 13px; overflow: hidden; border: 1px solid var(--line); background: #05070b; }
[data-theme="light"] .dt-media { background: #e9edf3; }
@@ -1702,8 +1755,8 @@
async function loadRegistries() {
try {
- const [harnessData, publicData, dates] = await Promise.all([
- fetchJson(REGISTRY_URLS), fetchJson(PUBLIC_REGISTRY_URLS), fetchJson(DATES_URLS),
+ const [harnessData, publicData, dates, matrixData] = await Promise.all([
+ fetchJson(REGISTRY_URLS), fetchJson(PUBLIC_REGISTRY_URLS), fetchJson(DATES_URLS), fetchJson(MATRIX_URLS),
]);
if (!harnessData) throw new Error('Registry load failed');
@@ -1716,8 +1769,6 @@
const totalClis = harnessClis.length + publicClis.length;
const allCategories = [...new Set([...harnessClis, ...publicClis].map(c => c.category))];
- animateCount(document.getElementById('cli-count'), totalClis, 980);
- animateCount(document.getElementById('category-count'), allCategories.length, 860);
document.getElementById('deck-count-harness').textContent = harnessClis.length;
document.getElementById('deck-count-public').textContent = publicClis.length;
@@ -1731,23 +1782,37 @@
publicClis.forEach(c => { c._deck = 'public'; STATE.byName.set(c.name, c); });
harnessClis.forEach(c => { c._deck = 'harness'; STATE.byName.set(c.name, c); });
+ // Ingest matrices BEFORE the first deck render so membership chips land in the one
+ // and only render. (The old flow rendered both decks, then re-rendered BOTH again
+ // when the matrix registry arrived — doubling the heaviest work on the page, right
+ // under the hero counter animation.)
+ ingestMatrices(matrixData);
+
renderDeck('harness');
- renderDeck('public');
- loadMatrices();
+ // Start the hero counters only after the visible deck has rendered AND painted
+ // (double rAF) — started before, their animation frames were starved by the big
+ // render and the count visibly stuttered.
+ requestAnimationFrame(() => requestAnimationFrame(() => {
+ animateCount(document.getElementById('cli-count'), totalClis, 980);
+ animateCount(document.getElementById('category-count'), allCategories.length, 860);
+ }));
+
+ // The public deck sits on the offscreen carousel panel and the matrix shelf is far
+ // below the fold — render them after the counters finish rather than competing with
+ // the animation for the main thread. switchDeck() renders on demand if the user
+ // swipes over first.
+ setTimeout(renderDeferredSections, 1100);
} catch (e) {
document.getElementById('grid-harness').innerHTML =
'<div class="empty">Failed to load registry. <a href="' + REPO + '/blob/main/registry.json" style="color:var(--accent)">View source</a></div>';
}
}
- // ── Matrices (the unification): fetch registry, build membership, render flip cards ──
- async function loadMatrices() {
- const data = await fetchJson(MATRIX_URLS);
- const shelf = document.getElementById('shelf');
+ // ── Matrices (the unification): build membership from the already-fetched registry ──
+ function ingestMatrices(data) {
if (!data || !Array.isArray(data.matrices) || !data.matrices.length) {
- if (shelf) shelf.innerHTML = '<div class="empty">Could not load the matrix registry right now &mdash; the catalog below is unaffected. Try refreshing, or browse on <a href="' + REPO + '" target="_blank" rel="noopener">GitHub</a>.</div>';
- const ms = document.getElementById('mat-stat'); if (ms) ms.textContent = '';
+ STATE.matrices = [];
return;
}
STATE.matrices = data.matrices;
@@ -1761,10 +1826,21 @@
const capCount = STATE.matrices.reduce((s, m) => s + ((m.capabilities && m.capabilities.length) || 0), 0);
const ms = document.getElementById('mat-stat');
if (ms) ms.textContent = STATE.matrices.length + ' matrices · ' + capCount + ' capabilities';
- renderShelf();
- // re-render decks so membership chips appear on catalog cards
- renderDeck('harness');
+ }
+
+ // Deferred second wave: the offscreen public deck + the below-the-fold matrix shelf.
+ let deferredSectionsDone = false;
+ function renderDeferredSections() {
+ if (deferredSectionsDone) return;
+ deferredSectionsDone = true;
renderDeck('public');
+ const shelf = document.getElementById('shelf');
+ if (!STATE.matrices.length) {
+ if (shelf) shelf.innerHTML = '<div class="empty">Could not load the matrix registry right now &mdash; the catalog below is unaffected. Try refreshing, or browse on <a href="' + REPO + '" target="_blank" rel="noopener">GitHub</a>.</div>';
+ const ms = document.getElementById('mat-stat'); if (ms) ms.textContent = '';
+ } else {
+ renderShelf();
+ }
syncFlipA11y();
}
@@ -1804,6 +1880,8 @@
}
function switchDeck(deck) {
+ // the public deck's first render is deferred; materialize it before sliding to it
+ if (deck === 'public') renderDeferredSections();
activeDeck = deck;
const track = document.getElementById('deck-track');
track.dataset.active = deck;
@@ -2489,12 +2567,14 @@
const finalValue = Number(target) || 0;
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { el.textContent = finalValue; return; }
const start = performance.now();
+ let shown = null;
function step(now) {
const progress = Math.min((now - start) / duration, 1);
const eased = 1 - Math.pow(1 - progress, 3);
- el.textContent = Math.round(finalValue * eased);
+ const value = progress < 1 ? Math.round(finalValue * eased) : finalValue;
+ // write only when the displayed integer changes — most frames it doesn't
+ if (value !== shown) { shown = value; el.textContent = value; }
if (progress < 1) window.requestAnimationFrame(step);
- else el.textContent = finalValue;
}
window.requestAnimationFrame(step);
}
@@ -2532,6 +2612,11 @@
// ── Flip interaction (delegated) ──
function setCardFlipped(card, flipped) {
+ // Cards are flat by default (see the .card CSS notes); grant this card its real 3D
+ // context just for the flip transition, then drop back to the cheap flat state.
+ card.classList.add('is-3d');
+ clearTimeout(card._flip3dTimer);
+ card._flip3dTimer = setTimeout(() => card.classList.remove('is-3d'), 780);
card.classList.toggle('flipped', flipped);
const inner = card.querySelector('.card-inner');
if (!inner) return;