perf(khira): eliminate UI lag and jitter with GPU-composited glass, rAF translate3d lens, and zero-overhead borders

This commit is contained in:
2026-10-26 17:53:01 +05:30
parent 16c232a2d3
commit 889d959a70
3 changed files with 56 additions and 121 deletions
+18 -14
View File
@@ -170,36 +170,38 @@ function initKubeLens() {
let isDragging = false;
let startX = 0, startY = 0;
let initialLeft = 240, initialTop = 180;
let curX = 240, curY = 180;
let rafId = null;
lens.addEventListener('pointerdown', (e) => {
if (e.target.closest('.kube-lens-close')) return;
isDragging = true;
lens.setPointerCapture(e.pointerId);
startX = e.clientX;
startY = e.clientY;
const rect = lens.getBoundingClientRect();
initialLeft = rect.left;
initialTop = rect.top;
startX = e.clientX - curX;
startY = e.clientY - curY;
lens.style.transition = 'none';
});
lens.addEventListener('pointermove', (e) => {
if (!isDragging) return;
const dx = e.clientX - startX;
const dy = e.clientY - startY;
const maxW = Math.max(window.innerWidth - 220, 0);
const maxH = Math.max(window.innerHeight - 160, 0);
const newLeft = Math.max(0, Math.min(maxW, initialLeft + dx));
const newTop = Math.max(0, Math.min(maxH, initialTop + dy));
lens.style.left = `${newLeft}px`;
lens.style.top = `${newTop}px`;
curX = Math.max(0, Math.min(maxW, e.clientX - startX));
curY = Math.max(0, Math.min(maxH, e.clientY - startY));
if (!rafId) {
rafId = requestAnimationFrame(() => {
lens.style.transform = `translate3d(${curX}px, ${curY}px, 0)`;
rafId = null;
});
}
});
const stopDrag = (e) => {
if (!isDragging) return;
isDragging = false;
try { lens.releasePointerCapture(e.pointerId); } catch(_) {}
if (rafId) { cancelAnimationFrame(rafId); rafId = null; }
lens.style.transform = `translate3d(${curX}px, ${curY}px, 0)`;
lens.style.transition = 'transform 0.15s ease-out, box-shadow 0.2s ease';
};
@@ -235,9 +237,11 @@ async function logout(){
async function refresh(anim){
if(!S.u)return;
const[t,s,n,e,es]=await Promise.all(['tickets','stats','notifications','errors','errors/stats'].map(p=>api('/khira/api/'+p)));
S.t=t.tickets||S.t;S.ts=s._f?S.ts:s;S.e=e.errors||S.e;S.es=es._f?S.es:es;S.n=n.notifications||S.n;
const newT=t.tickets||S.t,newTs=s._f?S.ts:s,newE=e.errors||S.e,newEs=es._f?S.es:es,newN=n.notifications||S.n;
const changed=anim||newT.length!==S.t.length||newE.length!==S.e.length||JSON.stringify(newTs)!==JSON.stringify(S.ts)||JSON.stringify(newEs)!==JSON.stringify(S.es);
S.t=newT;S.ts=newTs;S.e=newE;S.es=newEs;S.n=newN;
$('#dot').hidden=!S.n.some(x=>!x.read);
render(anim);
if(changed)render(anim);
}
const render=a=>S.sec==='tickets'?renderT(a):renderE(a);
const tile=(n,l,k)=>`<button class="stat" data-k="${k}"><b>${n||0}</b><span>${l}</span></button>`;
+2 -44
View File
@@ -15,10 +15,10 @@
</head>
<body>
<!-- Kube.io SVG Liquid Glass Filters (Magnifying Glass Pipeline) -->
<!-- Kube.io SVG Liquid Glass Magnifying Lens Filter -->
<svg color-interpolation-filters="sRGB" style="position:fixed;width:0;height:0;pointer-events:none;z-index:-1;opacity:0" aria-hidden="true">
<defs>
<!-- 1. Kube.io Precision Magnifying Glass Filter -->
<!-- Kube.io Precision Magnifying Glass Filter -->
<filter id="kube-magnifying-glass-filter" color-interpolation-filters="sRGB" x="-20%" y="-20%" width="140%" height="140%">
<feImage href="/khira/assets/magnifying-map.png" x="0" y="0" width="210" height="150" result="magnifying_displacement_map"></feImage>
<feDisplacementMap in="SourceGraphic" in2="magnifying_displacement_map" xChannelSelector="R" yChannelSelector="G" result="magnified_source" scale="24"></feDisplacementMap>
@@ -34,48 +34,6 @@
<feBlend in="specular_saturated" in2="displaced" mode="normal" result="withSaturation"></feBlend>
<feBlend in="specular_faded" in2="withSaturation" mode="normal"></feBlend>
</filter>
<!-- 2. Kube.io Liquid Glass Panels, Modals & Sheets -->
<filter id="kube-glass-panel" color-interpolation-filters="sRGB" x="-10%" y="-10%" width="120%" height="120%">
<feImage href="/khira/assets/displacement-map-panel.png" x="0" y="0" width="100%" height="100%" preserveAspectRatio="none" result="disp_map"></feImage>
<feDisplacementMap in="SourceGraphic" in2="disp_map" xChannelSelector="R" yChannelSelector="G" result="displaced" scale="42"></feDisplacementMap>
<feColorMatrix in="displaced" type="saturate" result="saturated" values="6"></feColorMatrix>
<feImage href="/khira/assets/specular-map-panel.png" x="0" y="0" width="100%" height="100%" preserveAspectRatio="none" result="spec_layer"></feImage>
<feComposite in="saturated" in2="spec_layer" operator="in" result="spec_sat"></feComposite>
<feComponentTransfer in="spec_layer" result="spec_fade">
<feFuncA type="linear" slope="0.45"></feFuncA>
</feComponentTransfer>
<feBlend in="spec_sat" in2="displaced" mode="normal" result="withSat"></feBlend>
<feBlend in="spec_fade" in2="withSat" mode="normal"></feBlend>
</filter>
<!-- 3. Kube.io Liquid Glass Pills (Search, Buttons & Chips) -->
<filter id="kube-glass-pill" color-interpolation-filters="sRGB" x="-10%" y="-10%" width="120%" height="120%">
<feImage href="/khira/assets/displacement-map-pill.png" x="0" y="0" width="100%" height="100%" preserveAspectRatio="none" result="disp_map"></feImage>
<feDisplacementMap in="SourceGraphic" in2="disp_map" xChannelSelector="R" yChannelSelector="G" result="displaced" scale="32"></feDisplacementMap>
<feColorMatrix in="displaced" type="saturate" result="saturated" values="6"></feColorMatrix>
<feImage href="/khira/assets/specular-map-pill.png" x="0" y="0" width="100%" height="100%" preserveAspectRatio="none" result="spec_layer"></feImage>
<feComposite in="saturated" in2="spec_layer" operator="in" result="spec_sat"></feComposite>
<feComponentTransfer in="spec_layer" result="spec_fade">
<feFuncA type="linear" slope="0.4"></feFuncA>
</feComponentTransfer>
<feBlend in="spec_sat" in2="displaced" mode="normal" result="withSat"></feBlend>
<feBlend in="spec_fade" in2="withSat" mode="normal"></feBlend>
</filter>
<!-- 4. Kube.io Liquid Glass Bars (Header & Navigation) -->
<filter id="kube-glass-bar" color-interpolation-filters="sRGB" x="-5%" y="-5%" width="110%" height="110%">
<feImage href="/khira/assets/displacement-map-bar.png" x="0" y="0" width="100%" height="100%" preserveAspectRatio="none" result="disp_map"></feImage>
<feDisplacementMap in="SourceGraphic" in2="disp_map" xChannelSelector="R" yChannelSelector="G" result="displaced" scale="26"></feDisplacementMap>
<feColorMatrix in="displaced" type="saturate" result="saturated" values="5"></feColorMatrix>
<feImage href="/khira/assets/specular-map-bar.png" x="0" y="0" width="100%" height="100%" preserveAspectRatio="none" result="spec_layer"></feImage>
<feComposite in="saturated" in2="spec_layer" operator="in" result="spec_sat"></feComposite>
<feComponentTransfer in="spec_layer" result="spec_fade">
<feFuncA type="linear" slope="0.35"></feFuncA>
</feComponentTransfer>
<feBlend in="spec_sat" in2="displaced" mode="normal" result="withSat"></feBlend>
<feBlend in="spec_fade" in2="withSat" mode="normal"></feBlend>
</filter>
</defs>
</svg>
+36 -63
View File
@@ -49,25 +49,21 @@
--sc-hi: rgba(22, 30, 46, 0.8);
--sc-hh: rgba(30, 41, 62, 0.9);
/* Optical Refraction & Specular Bevel Variables (Kube.io Magnifying Glass Pipeline) */
--kube-glass-panel: url(#kube-glass-panel);
--kube-glass-pill: url(#kube-glass-pill);
--kube-glass-bar: url(#kube-glass-bar);
--kube-glass-mag: url(#kube-magnifying-glass-filter);
--glass-blur: var(--kube-glass-panel), blur(16px) saturate(180%);
/* Ultra-smooth GPU Composited Glass Variables */
--glass-blur: blur(14px) saturate(180%) contrast(104%);
--glass-shadow:
0px 8px 32px rgba(0, 0, 0, 0.65),
inset 0px 2px 20px rgba(0, 0, 0, 0.4),
inset 0px -1px 2px rgba(255, 255, 255, 0.25);
0px 8px 30px rgba(0, 0, 0, 0.65),
inset 0px 1.5px 1.5px rgba(255, 255, 255, 0.28),
inset 0px -1px 2px rgba(0, 0, 0, 0.75);
--glass-shadow-hover:
0px 14px 44px rgba(0, 0, 0, 0.8),
0 0 20px rgba(16, 185, 129, 0.18),
inset 0px 2px 24px rgba(0, 0, 0, 0.45),
inset 0px 2px 2px rgba(255, 255, 255, 0.45),
inset 0px -1px 2px rgba(255, 255, 255, 0.35);
--glass-shadow-lg:
0px 20px 60px rgba(0, 0, 0, 0.85),
inset 0px 2px 24px rgba(0, 0, 0, 0.4),
inset 0px -1px 2px rgba(255, 255, 255, 0.25);
inset 0px 2px 20px rgba(0, 0, 0, 0.35),
inset 0px -1px 2px rgba(255, 255, 255, 0.22);
/* Prismatic Refraction Border Gradient */
--liquid-prism-border: linear-gradient(
@@ -90,16 +86,26 @@
body {
font: 400 14px/1.45 "Roboto Flex", Roboto, system-ui, sans-serif;
background-color: var(--surf);
color: var(--on-s);
-webkit-font-smoothing: antialiased;
min-height: 100vh;
position: relative;
}
body::before {
content: "";
position: fixed;
inset: 0;
z-index: -1;
pointer-events: none;
background-image:
radial-gradient(circle at 14% 16%, rgba(16, 185, 129, 0.09) 0%, transparent 40%),
radial-gradient(circle at 86% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 45%),
radial-gradient(circle at 50% 85%, rgba(139, 92, 246, 0.07) 0%, transparent 50%),
radial-gradient(circle at 75% 75%, rgba(244, 63, 94, 0.05) 0%, transparent 40%),
linear-gradient(180deg, rgba(4, 6, 8, 0.98) 0%, #040608 100%);
background-attachment: fixed;
color: var(--on-s);
-webkit-font-smoothing: antialiased;
min-height: 100vh;
transform: translateZ(0);
will-change: transform;
}
[hidden] { display: none !important; }
@@ -306,11 +312,8 @@ button {
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1.5px;
background: var(--liquid-prism-border);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
border: 1px solid rgba(255, 255, 255, 0.12);
border-top: 1px solid rgba(255, 255, 255, 0.28);
pointer-events: none;
}
.logo {
@@ -441,11 +444,8 @@ button {
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1.5px;
background: var(--liquid-prism-border);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
border: 1px solid rgba(255, 255, 255, 0.12);
border-top: 1px solid rgba(255, 255, 255, 0.28);
pointer-events: none;
}
.search input {
@@ -741,11 +741,8 @@ button {
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1.5px;
background: var(--liquid-prism-border);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
border: 1px solid rgba(255, 255, 255, 0.1);
border-top: 1px solid rgba(255, 255, 255, 0.28);
pointer-events: none;
z-index: 2;
transition: opacity 0.2s var(--e);
@@ -812,11 +809,8 @@ button {
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1.5px;
background: var(--liquid-prism-border);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
border: 1px solid rgba(255, 255, 255, 0.08);
border-top: 1px solid rgba(255, 255, 255, 0.22);
pointer-events: none;
z-index: 2;
}
@@ -975,11 +969,8 @@ dialog::backdrop {
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1.5px;
background: var(--liquid-prism-border);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
border: 1px solid rgba(255, 255, 255, 0.12);
border-top: 1px solid rgba(255, 255, 255, 0.32);
pointer-events: none;
z-index: 2;
}
@@ -1625,8 +1616,8 @@ dd { word-break: break-word; }
══════════════════════════════════════════════════════════════════ */
.kube-lens-capsule {
position: fixed;
top: 180px;
left: 240px;
top: 0;
left: 0;
width: 210px;
height: 150px;
border-radius: 75px;
@@ -1642,12 +1633,12 @@ dd { word-break: break-word; }
user-select: none;
-webkit-user-select: none;
touch-action: none;
transform: translateZ(0);
transform: translate3d(240px, 180px, 0);
will-change: transform;
transition: transform 0.15s ease-out, box-shadow 0.2s ease;
}
.kube-lens-capsule:active {
cursor: grabbing;
transform: scale(1.05) translateZ(0);
box-shadow:
0px 24px 68px rgba(0, 0, 0, 0.9),
inset 0px 2px 28px rgba(0, 0, 0, 0.5),
@@ -1709,21 +1700,3 @@ dd { word-break: break-word; }
box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
}
/* Kube.io Glass UI Components */
.search {
backdrop-filter: url(#kube-glass-pill);
-webkit-backdrop-filter: url(#kube-glass-pill);
}
.bar, .nav {
backdrop-filter: url(#kube-glass-bar);
-webkit-backdrop-filter: url(#kube-glass-bar);
}
#dlg, #sheet, .ac {
backdrop-filter: url(#kube-glass-panel);
-webkit-backdrop-filter: url(#kube-glass-panel);
}
.fb, .fab, .chip.on, #btnLogAppErr, #btnLogMoreForApp {
backdrop-filter: url(#kube-glass-pill);
-webkit-backdrop-filter: url(#kube-glass-pill);
}