Prestasi
Perlu perhatianKadar bingkai: purata 60 fps, p5 59.5 · Tugas panjang: 0 tugas, jumlah 0 ms, terpanjang 0 ms · Sumber gzip 5.3 KB · Masa jalan 153 KB
Wake sliderMITMedan inputBencho
Komponen React Medan input oleh Lorenzo Cabra. Dikumpul tanpa ubahan daripada Bencho di bawah lesen MIT dan dipaparkan secara langsung di sini.
Laporan kualiti
Gred dan skor datang daripada pemeriksaan automatik semasa binaan atau ujian. Jika suatu pemeriksaan tidak dijalankan, ia ditanda Belum diuji — nombor tidak pernah direka.
Kadar bingkai: purata 60 fps, p5 59.5 · Tugas panjang: 0 tugas, jumlah 0 ms, terpanjang 0 ms · Sumber gzip 5.3 KB · Masa jalan 153 KB
Isu 0 · Pembaca skrin: Lulus
Tiada gerakan berterusan
Tidak melimpah
Angka kadar bingkai dan tugas panjang diukur dalam Chromium tanpa paparan dengan WebGL perisian. Ia hanya boleh dibandingkan antara komponen di laman ini, dan tidak mewakili peranti sebenar.
Tidak berkenaan: tiada animasi yang kelihatan ketika rehat. Animasi yang dicetuskan oleh tuding tidak diuji.
Tiada pelanggaran axe-core.

Disemak 15 Nov 2026 · Angka datang daripada skrip automatik, bukan sampel tulisan tangan.
Dipaparkan pada saiz sebenar.
Salinan bermula dengan notis lesen. Kekalkannya apabila anda menggunakan kod.
<div id="root"></div>:root{--bg:#f6f4f0;--ink:#17181a;--background:40 20% 96%;--foreground:24 10% 8%;--card:0 0% 100%}html,body{min-height:100%;margin:0;background:var(--bg);color:var(--ink)}html,body{height:100%;overflow:hidden}body{display:grid;place-items:center}#root{display:grid;place-items:center;max-width:100%;max-height:100%;box-sizing:border-box;padding:16px;color:hsl(var(--foreground))}#root.full{width:100%;height:100%;padding:0}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-play-state:paused!important;transition-duration:0s!important}}
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
/* ── Bencho tokens ─────────────────────────────────────────
The custom properties the free blocks read, at the values
bencho.dev draws them with. Light by default; dark under
[data-theme="dark"] on any ancestor, or automatically with
the system setting unless [data-theme="light"] says otherwise.
Map these to your own theme rather than keeping two: a block
only ever reads the names, never the values. */
:root {
--font-ui: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
--bg: #ffffff;
--board: #ffffff;
--card: #f7f7f6;
--surface: #f7f7f6;
--surface-2: #f1f1f0;
--surface-3: #ecebe7;
--ink: #17181a;
--ink-rgb: 23, 24, 26;
--ink-2: #3c3b37;
--ink-3: #5c5b56;
--ink-4: #6f6e68;
--ink-5: #85847e;
--on-ink: #ffffff;
--on-ink-rgb: 255, 255, 255;
--slab: #17181a;
--on-slab: #ffffff;
--slab-dark: #0e0f11;
--fill-slab: #ffffff;
--fill-on: #17181a;
--fill-on-rgb: 23, 24, 26;
--pane: var(--fill-slab);
--pane-edge: rgba(23, 24, 26, 0.08);
--pane-thumb: rgba(23, 24, 26, 0.07);
--inlay: rgba(255, 255, 255, 0.55);
--inlay-hi: rgba(23, 24, 26, 0.09);
--elev-rgb: 255, 255, 255;
--glass-rgb: 255, 255, 255;
--shadow-rgb: 23, 24, 26;
--wash: 0.06;
--pick: #0d99ff;
--signal: #2231dd;
--focus: #2231dd;
--ok: #15803d;
--ember: #b8431c;
color-scheme: light;
}
[data-theme="dark"] {
--bg: #000000;
--board: #1a1a1a;
--card: #0a0a0a;
--surface: #0f0f0f;
--surface-2: #181818;
--surface-3: #202020;
--ink: #ffffff;
--ink-rgb: 255, 255, 255;
--ink-2: #b4b4b4;
--ink-3: #9a9a9a;
--ink-4: #828282;
--ink-5: #6b6b6b;
--on-ink: #000000;
--on-ink-rgb: 0, 0, 0;
--slab: #1a1a1a;
--on-slab: #ffffff;
--slab-dark: #262626;
--fill-slab: #262626;
--fill-on: #ffffff;
--fill-on-rgb: 255, 255, 255;
--pane-edge: rgba(255, 255, 255, 0.08);
--pane-thumb: rgba(255, 255, 255, 0.07);
--inlay: rgba(255, 255, 255, 0.1);
--inlay-hi: rgba(255, 255, 255, 0.09);
--elev-rgb: 32, 32, 32;
--shadow-rgb: 0, 0, 0;
--wash: 0.09;
--pick: #3aa9ff;
--ok: #34d17a;
color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #000000;
--board: #1a1a1a;
--card: #0a0a0a;
--surface: #0f0f0f;
--surface-2: #181818;
--surface-3: #202020;
--ink: #ffffff;
--ink-rgb: 255, 255, 255;
--ink-2: #b4b4b4;
--ink-3: #9a9a9a;
--ink-4: #828282;
--ink-5: #6b6b6b;
--on-ink: #000000;
--on-ink-rgb: 0, 0, 0;
--slab: #1a1a1a;
--on-slab: #ffffff;
--slab-dark: #262626;
--fill-slab: #262626;
--fill-on: #ffffff;
--fill-on-rgb: 255, 255, 255;
--pane-edge: rgba(255, 255, 255, 0.08);
--pane-thumb: rgba(255, 255, 255, 0.07);
--inlay: rgba(255, 255, 255, 0.1);
--inlay-hi: rgba(255, 255, 255, 0.09);
--elev-rgb: 32, 32, 32;
--shadow-rgb: 0, 0, 0;
--wash: 0.09;
--pick: #3aa9ff;
--ok: #34d17a;
color-scheme: dark;
}
}
/* WakeSlider.css */
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
/* ══ Wake slider ══════════════════════════════════════════
lab/WakeSlider.tsx. Thin bars, the reading beside them. The bars
are data marks, so they take the ink strengths: ink when lit,
faint after the value. Heights are written by the component */
.wks {
display: flex;
align-items: center;
gap: 16px;
padding: 16px;
color: var(--fill-on, #17181a);}
.wks-track {
display: flex;
align-items: center;
gap: 4px;
cursor: ew-resize;
touch-action: none;
user-select: none;
-webkit-user-select: none;
-webkit-tap-highlight-color: transparent;
border-radius: 6px;}
.wks-track:focus-visible { outline: 2px solid #2231dd; outline-offset: 6px; }
.wks-bar {
flex: none;
width: 3px;
border-radius: 3px;
background: color-mix(in srgb, var(--fill-on, #17181a) 32%, var(--fill-slab, #fff));
transform-origin: 50% 50%;
transition: background-color 160ms ease;}
.wks-bar[data-on] { background: var(--fill-on, #17181a); }
.wks-value {
min-width: 3ch;
font-size: 14px;
font-weight: 500;
letter-spacing: -0.01em;
font-variant-numeric: tabular-nums;
color: color-mix(in srgb, var(--fill-on, #17181a) 72%, var(--fill-slab, #fff));}
// bencho source (MIT). npm i motion react · Tailwind CSS v4
// ── blocks/wake-slider/WakeSlider.tsx (https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/wake-slider/WakeSlider.tsx)
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
import { useEffect, useRef, useState } from "react";
/* ══ Wake slider ══════════════════════════════════════════
A range with no thumb: a row of thin bars, solid up to the
value and faint after it, with the reading beside them. Drag
anywhere along it. Drag slowly and the bars simply fill; drag
fast and every bar the value sweeps past springs up, taller the
faster you went, and settles back — a wake left behind the hand.
── EACH BAR HOLDS A LITTLE ENERGY ──────────────────────
When the value crosses a bar, that bar takes energy from the
speed of the drag. Every frame all of it decays at the same
rate, so the bars crossed longest ago have fallen furthest: the
tallest ones are always at the hand and the run tails off
behind it. That falloff IS the wake; nothing draws it.
── WRITTEN, NOT RENDERED ───────────────────────────────
The heights change every frame, so they go straight onto each
bar's transform from a ref. React renders when the value
changes, which is what the reading and the colours need, and
the loop runs only while some bar still has energy. */
const H = 20; // a bar at rest, px
const GAP = 4; // bar pitch minus its width
const BAR = 3;
const clamp = (v: number, a: number, b: number) => Math.min(b, Math.max(a, v));
export function WakeSlider({
/* how many bars make the track */
bars = 36,
/* how high the wake rises, 0..100 */
wake = 60,
}: {
bars?: number;
wake?: number;
} = {}) {
const n = Math.round(clamp(bars, 12, 64));
const [value, setValue] = useState(50);
const track = useRef<HTMLDivElement | null>(null);
const els = useRef<(HTMLSpanElement | null)[]>([]);
const st = useRef({
energy: new Float32Array(n),
down: false,
lastX: 0,
lastT: 0,
speed: 0,
raf: 0,
at: 0.5, // the value as a fraction, without React in the way
lastBar: -1,
});
const knob = useRef(wake);
knob.current = wake;
/* a new bar count is a new row */
useEffect(() => {
st.current.energy = new Float32Array(n);
}, [n]);
const loop = () => {
const s = st.current;
if (s.raf) return;
let prev = performance.now();
const run = (now: number) => {
const dt = Math.min(0.05, (now - prev) / 1000);
prev = now;
let live = false;
const fall = Math.exp(-dt * 6.5);
for (let i = 0; i < s.energy.length; i++) {
s.energy[i] *= fall;
if (s.energy[i] < 0.002) s.energy[i] = 0;
else live = true;
const b = els.current[i];
/* up to 2.6 times as tall at the very top of the knob */
if (b) b.style.transform = `scaleY(${(1 + s.energy[i] * 1.6).toFixed(3)})`;
}
s.raf = live || s.down ? requestAnimationFrame(run) : 0;
};
s.raf = requestAnimationFrame(run);
};
useEffect(() => () => cancelAnimationFrame(st.current.raf), []);
/* move the value to a fraction, waking every bar it passes */
const to = (f: number, speed: number) => {
const s = st.current;
f = clamp(f, 0, 1);
const from = s.at;
s.at = f;
const a = Math.round(from * (n - 1)), b = Math.round(f * (n - 1));
/* how hard: the drag's speed in bars per second, through a
curve that saturates, scaled by the knob */
const push = (1 - Math.exp(-speed / 900)) * (knob.current / 60);
const lo = Math.min(a, b), hi = Math.max(a, b);
for (let i = lo; i <= hi; i++) s.energy[i] = Math.max(s.energy[i], push);
if (b !== s.lastBar) {
s.lastBar = b;
}
setValue(Math.round(f * 100));
loop();
};
const frac = (clientX: number) => {
const r = track.current!.getBoundingClientRect();
return (clientX - r.left) / r.width;
};
const lit = Math.round((value / 100) * (n - 1));
return (
<div className="wks">
<div
ref={track}
className="wks-track"
role="slider"
tabIndex={0}
aria-label="Value"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={value}
style={{ width: n * (BAR + GAP) - GAP, height: H * 2.6 }}
onPointerDown={(e) => {
const s = st.current;
try { e.currentTarget.setPointerCapture(e.pointerId); } catch { /* a scripted pointer */ }
s.down = true;
s.lastX = e.clientX;
s.lastT = performance.now();
s.speed = 0;
to(frac(e.clientX), 0);
}}
onPointerMove={(e) => {
const s = st.current;
if (!s.down) return;
const now = performance.now();
const dt = Math.max(0.008, (now - s.lastT) / 1000);
/* speed in px per second, smoothed so one jittery frame
cannot fake a fling */
const v = Math.abs(e.clientX - s.lastX) / dt;
s.speed = s.speed * 0.5 + v * 0.5;
s.lastX = e.clientX;
s.lastT = now;
to(frac(e.clientX), s.speed);
}}
onPointerUp={(e) => {
st.current.down = false;
try { e.currentTarget.releasePointerCapture(e.pointerId); } catch { /* never captured */ }
}}
onPointerCancel={() => { st.current.down = false; }}
onKeyDown={(e) => {
const step = e.shiftKey ? 10 : 1;
let next: number | null = null;
if (e.key === "ArrowRight" || e.key === "ArrowUp") next = value + step;
if (e.key === "ArrowLeft" || e.key === "ArrowDown") next = value - step;
if (e.key === "Home") next = 0;
if (e.key === "End") next = 100;
if (next === null) return;
e.preventDefault();
/* a key press is a small, quick step: a little wake */
to(clamp(next, 0, 100) / 100, 600);
}}
>
{Array.from({ length: n }, (_, i) => (
<span
key={i}
ref={(b) => { els.current[i] = b; }}
className="wks-bar"
data-on={(value > 0 && i <= lit) || undefined}
style={{ height: H }}
/>
))}
</div>
<span className="wks-value">{value}</span>
</div>
);
}Kawalan · HTML · CSS · JS
Sunting kod dan laraskan dengan kawalan. Pratonton dikemas kini semasa anda menaip.

Komponen ini berjalan daripada binaan berpakej, jadi skripnya baca sahaja di sini. Sunting HTML dan CSS; sumber penuh ada dalam tab Kod.
Sunting setiap komponen secara langsung, laraskan dengan kawalan, muat turun sumber penuh dan salin prompt lanjutan.
$49 sekali bayarHarga sementara
Mod ujian: tiada bayaran sebenar dikenakan.
Percuma: pratonton, butang salin dan nota pelajaran.
Label yang kelihatan, sempadan yang tenang dan fokus yang jelas membimbing menaip.
Carian, log masuk dan medan teks pendek.
Laras ketinggian, warna sempadan dan sinaran fokus.
Tambahkan komponen "Wake slider" daripada Bencho (github.com/cabralorenzo/bencho) (MIT) ke aplikasi React + Tailwind CSS saya. Fail sumber: https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/wake-slider/WakeSlider.tsx. Label yang kelihatan, sempadan yang tenang dan fokus yang jelas membimbing menaip. Gunakan untuk: Carian, log masuk dan medan teks pendek. Tetapan untuk dilaras: Laras ketinggian, warna sempadan dan sinaran fokus. Sokong tema cerah dan gelap serta hormati prefers-reduced-motion. Kekalkan notis lesen MIT.
Prompt lebih panjang dengan langkah pelarasan, kebolehcapaian dan integrasi.