KQ-890 · CODE/SNIPPET

Code Snippet

A block of code sent into a thread, built to be taken. A hand tokeniser colours each line — comment, string, number, keyword — while the gutter of line numbers stays put and the body scrolls sideways inside its own box. Pressing copy writes the text, a hairline sweep takes the block top to bottom on a linear tween, and Copied stamps over the control on recoil, out of 1.5 and −6 degrees; a refused clipboard selects the block's own text and asks for Control or Command C instead. Long blocks fold to a height measured from one ResizeObserver, so the fold lands exactly on a line, and unfold on glide.

KQ-890 · CODE/SNIPPET
  1. routehold-4471.route
    # hold rules for order 4471, Coldbrook depotlet window = 0700 until 1230when parcel gate is "north" and parcel weight > 18  route parcel to bay 3  hold parcel until window openselse  route parcel to bay 1stop when bay 3 is fullsend note to depot "held 4471 for the morning run, release it once the first belt run clears the north line"let retry = 2when hold fails  send note to depot "gate 4 refused, retrying"  stop# checked by Rui
    09:41
  2. routefix.route
    when parcel gate is "north"  route parcel to bay 1stop
    09:44

hold-4471.route · 14 lines · folded at 8 · not copied

Install

One command — the source lands in your repo. Or copy it from the Code tab.

$ pnpm dlx shadcn@latest add @kinetiq/code-snippet

Props

snippets
CodeBlock[]
default
The thread, oldest first: id, side, language, code, filename, time and delivery.
foldLines
number
default 8
Lines shown before a block folds behind its fade.
open / defaultOpen
string[]
default []
Controlled or initial ids of unfolded blocks.
onOpenChange
(id: string, open: boolean) => void
default
Fires from the disclosure that folds or unfolds a block.
onCopy
(id: string, text: string) => void
default
Fires once the clipboard has taken a block's text.
onCopyFail
(id: string) => void
default
Fires when the clipboard refuses and the block falls back to selection.
copiedHold
number
default 1600
Milliseconds the stamp stays before the control reads Copy again.
peerName
string
default "Them"
Names the other side in the block and delivery sentences.
label
string
default
Names the thread list for assistive technology.