summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app.mjs706
-rw-r--r--src/web/index.html17
-rw-r--r--src/web/libc.c152
-rw-r--r--src/web/libc/include/assert.h14
-rw-r--r--src/web/libc/include/ctype.h7
-rw-r--r--src/web/libc/include/endian.h21
-rw-r--r--src/web/libc/include/inttypes.h8
-rw-r--r--src/web/libc/include/limits.h9
-rw-r--r--src/web/libc/include/stdio.h19
-rw-r--r--src/web/libc/include/stdlib.h16
-rw-r--r--src/web/libc/include/string.h17
-rw-r--r--src/web/libc/include/wchar.h9
-rw-r--r--src/web/libc/include/wctype.h18
-rw-r--r--src/web/pardes.css99
-rw-r--r--src/web/zstbi.zig30
15 files changed, 0 insertions, 1142 deletions
diff --git a/src/web/app.mjs b/src/web/app.mjs
deleted file mode 100644
index 1a8036c0..00000000
--- a/src/web/app.mjs
+++ /dev/null
@@ -1,706 +0,0 @@
-const CELL_SIZE = 20;
-const ATTR_TAGLINE = 1 << 7;
-const DEFAULT_FG = "#cccccc";
-const DEFAULT_BG = "#121212";
-const decoder = new TextDecoder();
-const encoder = new TextEncoder();
-
-const BUTTON = Object.freeze({ left: 0, middle: 1, right: 2, wheelUp: 3, wheelDown: 4, wheelLeft: 5, wheelRight: 6, none: 7, back: 8, forward: 9 });
-const MOUSE = Object.freeze({ press: 0, release: 1, motion: 2, drag: 3 });
-const SPECIAL_KEYS = Object.freeze({
- Enter: 0x0d,
- Backspace: 0x7f,
- Tab: 0x09,
- Escape: 0x1b,
- ArrowUp: 0xf0001,
- ArrowDown: 0xf0002,
- ArrowLeft: 0xf0003,
- ArrowRight: 0xf0004,
- Home: 0xf0005,
- End: 0xf0006,
- PageUp: 0xf0007,
- PageDown: 0xf0008,
- Delete: 0xf0009,
-});
-
-export class DomRenderer {
- constructor(root, wasm) {
- this.root = root;
- this.wasm = wasm;
- this.rows = [];
- this.cells = [];
- this.cols = 0;
- this.rowCount = 0;
- this.snapshot = null;
- this.gripFonts = new Map();
- this.gripMetrics = new Map();
- this.root.ownerDocument.fonts?.addEventListener("loadingdone", () => this.resetGripMetrics());
- const taglinePercent = this.wasm.pardes_gui_tagline_font_percent();
- if (taglinePercent < 1 || taglinePercent > 100) throw new Error(`bad tagline font percentage ${taglinePercent}`);
- this.root.style.setProperty("--pardes-tagline-font-size", `${taglinePercent}%`);
- }
-
- render() {
- const count = this.wasm.pardes_frame();
- const shape = this.wasm.pardes_pointer_shape();
- this.root.style.cursor = shape === 1 ? "pointer" : shape === 3 ? "move" : "text";
- const cols = this.wasm.pardes_frame_cols();
- const rows = this.wasm.pardes_frame_rows();
- if (count !== cols * rows) throw new Error(`bad frame: ${count} cells for ${cols}x${rows}`);
- this.ensureGrid(cols, rows);
-
- const ptr = this.wasm.pardes_frame_ptr();
- const view = new DataView(this.wasm.memory.buffer, ptr, count * CELL_SIZE);
- const bytes = new Uint8Array(this.wasm.memory.buffer);
- const cursorX = this.wasm.pardes_cursor_x();
- const cursorY = this.wasm.pardes_cursor_y();
- const cursorBar = this.wasm.pardes_cursor_bar() !== 0;
- const raw = new Array(count);
- const tagCovered = new Uint8Array(count);
- const tagPrefixBands = new Map();
- const paneIndicators = new Set();
- if (this.wasm.pardes_tag_layer_limit) {
- for (let i = 0; i < this.wasm.pardes_tag_layer_limit(); i++) {
- const val = field => this.wasm.pardes_tag_layer_value(i, field);
- if (!val(0)) continue;
- const gripCols = this.wasm.pardes_grip_columns?.() ?? 2;
- const textInset = this.wasm.pardes_tag_text_inset?.() ?? gripCols;
- // A row to each line of a taller tag.
- for (let y = val(5); y < val(5) + Math.max(1, val(11)); y++) {
- if (val(1) !== 0 && val(4) >= textInset && this.cellHeight) {
- const offset = this.wasm.pardes_tagline_band_offset(y,rows*this.cellHeight*256,Math.round(this.cellHeight*256),Math.round(this.taglineHeight*256))/256;
- for (let x = val(4)-textInset; x < val(4); x++) tagPrefixBands.set(y*cols+x,offset);
- if (val(1) === 2) paneIndicators.add(y*cols+val(4)-textInset);
- }
- for (let x = val(4); x < Math.min(cols, val(4) + val(6)); x++) {
- if (y < rows) tagCovered[y * cols + x] = 1;
- }
- }
- }
- }
-
- for (let index = 0; index < count; index += 1) {
- const off = index * CELL_SIZE;
- const len = view.getUint8(off + 18);
- const fg = view.getUint32(off + 8, true);
- const bg = view.getUint32(off + 12, true);
- const attrs = view.getUint16(off + 16, true);
- const text = decoder.decode(bytes.subarray(ptr + off, ptr + off + len)) || " ";
- const x = index % cols;
- const y = Math.floor(index / cols);
- const cursor = x === cursorX && y === cursorY;
- const cell = this.cells[index];
- cell.style.visibility = tagCovered[index] ? "hidden" : "";
- const gripOffset = tagPrefixBands.get(index);
- cell.style.height = gripOffset === undefined ? "" : `${this.taglineHeight}px`;
- cell.style.lineHeight = gripOffset === undefined ? "" : `${this.taglineHeight}px`;
- cell.style.marginTop = gripOffset === undefined ? "" : `${gripOffset}px`;
- const displayedText = paneIndicators.has(index) ? " " : text;
- if (cell.textContent !== displayedText) cell.textContent = displayedText;
- const styleKey = `${fg}:${bg}:${attrs}:${cursor ? 1 : 0}:${cursorBar ? 1 : 0}`;
- if (cell.pardesStyle !== styleKey) {
- applyStyle(cell, fg, bg, attrs, cursor, cursorBar);
- cell.pardesStyle = styleKey;
- }
- raw[index] = { text, fg, bg, attrs };
- }
- this.renderBodyLayers();
- this.renderTagLayers(raw);
- this.snapshot = { cols, rows, cells: raw, cursorX, cursorY, cursorBar };
- return this.snapshot;
- }
-
- renderTagLayers(canonical) {
- if (!this.wasm.pardes_tag_layer_limit || !this.cellWidth) return;
- if (!this.tagRoot?.isConnected) {
- this.tagRoot = this.root.ownerDocument.createElement("div");
- this.tagRoot.style.cssText = "position:absolute;inset:0;pointer-events:none;overflow:hidden";
- this.root.style.position = "relative";
- this.root.append(this.tagRoot);
- }
- this.tagNodes ??= new Map();
- const nodes = [];
- const bw = this.cellWidth, bh = this.cellHeight, tw = this.taglineWidth, th = this.taglineHeight;
- for (let i = 0; i < this.wasm.pardes_tag_layer_limit(); i++) {
- const layerValues = Array.from({length:13}, (_,field) => this.wasm.pardes_tag_layer_value(i,field));
- const cols = layerValues[0];
- if (!cols) continue;
- const ptr = this.wasm.pardes_tag_layer_cells(i);
- if (!ptr) continue;
- // A row to each line of a taller tag, each drawn as a band of its own.
- for (let line = 0; line < Math.max(1, layerValues[11]); line++) {
- const key = i*64+line;
- const values = layerValues.slice(0,11);
- values[5] = layerValues[5] + line;
- values[7] = 1;
- values[8] = layerValues[12] === line ? layerValues[8] : 65535;
- const bytes = new Uint8Array(this.wasm.memory.buffer,ptr+line*cols*CELL_SIZE,cols*CELL_SIZE);
- const offset = this.wasm.pardes_tagline_band_offset(values[5],this.rowCount*bh*256,Math.round(bh*256),Math.round(th*256))/256;
- const gripCols = this.wasm.pardes_grip_columns?.() ?? 2;
- const gripX = values[4] - (this.wasm.pardes_tag_text_inset?.() ?? gripCols);
- const gripCell = canonical[values[5]*this.cols+gripX];
- const grip = values[1] === 2 && gripX >= 0 && gripCell && th >= 1 && tw >= 1;
- const geometry = [bw,bh,tw,th,offset,...values,grip,gripCell?.fg,gripCell?.bg,gripCell?.attrs,gripCell?.text,globalThis.devicePixelRatio].join(":");
- const cached = this.tagNodes.get(key);
- if (cached && cached.geometry === geometry && cached.bytes.length === bytes.length && cached.bytes.every((byte,index)=>byte===bytes[index])) {
- nodes.push(cached.node);
- if (cached.grip) nodes.push(cached.grip);
- continue;
- }
- const view = new DataView(this.wasm.memory.buffer,ptr+line*cols*CELL_SIZE,cols*CELL_SIZE);
- const layer = this.root.ownerDocument.createElement("div");
- layer.dataset.tagLayer = String(i);
- layer.dataset.tagLine = String(line);
- layer.style.cssText = `position:absolute;overflow:hidden;white-space:pre;left:${values[4]*bw}px;top:${values[5]*bh+offset}px;width:${values[6]*bw}px;height:${th}px;background:${color(values[10],DEFAULT_BG)}`;
- for (let col = 0; col < cols; col++) {
- const off = col*CELL_SIZE;
- const cell = this.root.ownerDocument.createElement("span");
- cell.className = "pardes-cell";
- cell.textContent = decoder.decode(bytes.subarray(off,off+view.getUint8(off+18))) || " ";
- applyStyle(cell,view.getUint32(off+8,true),view.getUint32(off+12,true),view.getUint16(off+16,true),col===values[8],values[9]!==0);
- cell.style.textAlign = "left";
- cell.style.width = `${tw}px`;
- cell.style.height = `${th}px`;
- cell.style.lineHeight = `${th}px`;
- layer.append(cell);
- }
- let gripNode = null;
- if (grip && gripCell.text.trim()) {
- const cell = this.cells[values[5]*this.cols+gripX];
- gripNode = this.drawGripGlyph(cell, gripCell, gripCols*bw, th);
- gripNode.dataset.tagGrip = String(i);
- gripNode.style.left = `${gripX*bw}px`;
- gripNode.style.top = `${values[5]*bh+offset}px`;
- } else if (grip && th >= 6 && tw >= 3) {
- gripNode = this.root.ownerDocument.createElement("div");
- gripNode.dataset.tagGrip = String(i);
- const centerX = (gripX+gripCols/2)*bw, centerY = values[5]*bh+offset+th/2;
- const half = Math.max(1,Math.min(3,bw-2));
- gripNode.style.cssText = "position:absolute;inset:0;pointer-events:none";
- for (const dy of [-2,1]) {
- const mark = this.root.ownerDocument.createElement("div");
- mark.style.cssText = `position:absolute;left:${Math.floor(centerX-half)}px;top:${Math.floor(centerY+dy)}px;width:${2*half}px;height:1px;background:${color(gripCell.fg,DEFAULT_FG)}`;
- gripNode.append(mark);
- }
- }
- this.tagNodes.set(key,{geometry,bytes:bytes.slice(),node:layer,grip:gripNode});
- nodes.push(layer);
- if (gripNode) nodes.push(gripNode);
- }
- }
- if (nodes.length !== this.tagRoot.childNodes.length || nodes.some((node,index)=>node!==this.tagRoot.childNodes[index])) this.tagRoot.replaceChildren(...nodes);
- }
-
- resetGripMetrics() {
- this.gripFonts.clear();
- this.gripMetrics.clear();
- this.tagNodes?.clear();
- }
-
- drawGripGlyph(cell, glyph, width, height) {
- const canvas = this.root.ownerDocument.createElement("canvas");
- const ratio = globalThis.devicePixelRatio || 1;
- canvas.width = Math.max(1, Math.ceil(width*ratio));
- canvas.height = Math.max(1, Math.ceil(height*ratio));
- canvas.style.cssText = `position:absolute;pointer-events:none;width:${width}px;height:${height}px`;
- canvas.setAttribute("aria-label", glyph.text);
- const ctx = canvas.getContext("2d");
- // Resolve a face once per style, then retain its ink bearings for each
- // symbol. Font loading and runtime metric changes clear both caches.
- let font = this.gripFonts.get(glyph.attrs);
- if (!font) {
- const style = this.root.ownerDocument.defaultView.getComputedStyle(cell);
- font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
- this.gripFonts.set(glyph.attrs, font);
- }
- ctx.scale(ratio, ratio);
- ctx.font = font;
- const key = `${font}:${ratio}:${glyph.text}`;
- let ink = this.gripMetrics.get(key);
- if (!ink) {
- const measured = ctx.measureText(glyph.text);
- ink = { left:measured.actualBoundingBoxLeft, right:measured.actualBoundingBoxRight,
- ascent:measured.actualBoundingBoxAscent, descent:measured.actualBoundingBoxDescent };
- this.gripMetrics.set(key, ink);
- }
- ctx.fillStyle = cell.style.color;
- ctx.fillText(glyph.text, (width-ink.right+ink.left)/2, (height+ink.ascent-ink.descent)/2);
- return canvas;
- }
-
- renderBodyLayers() {
- if (!this.wasm.pardes_body_layer_limit || !this.cellWidth) return;
- if (!this.layerRoot?.isConnected) {
- this.layerRoot = this.root.ownerDocument.createElement("div");
- this.layerRoot.style.cssText = "position:absolute;inset:0;pointer-events:none;overflow:hidden";
- this.root.style.position = "relative";
- this.root.append(this.layerRoot);
- }
- const nodes = [];
- this.layerNodes ??= new Map();
- const bw = this.cellWidth, bh = this.cellHeight;
- const tw = this.taglineWidth, th = this.taglineHeight;
- for (let i = 0; i < this.wasm.pardes_body_layer_limit(); i++) {
- const val = (field) => this.wasm.pardes_body_layer_value(i, field);
- const rows = val(0), cols = val(1), contexts = val(2);
- if (!rows) continue;
- const ptr = this.wasm.pardes_body_layer_cells(i);
- if (!ptr) continue;
- const view = new DataView(this.wasm.memory.buffer, ptr, rows * cols * CELL_SIZE);
- const bytes = new Uint8Array(this.wasm.memory.buffer);
- const geometry = [bw,bh,tw,th,...Array.from({length:11+contexts},(_,field)=>val(field))].join(":");
- const encoded = bytes.subarray(ptr,ptr+rows*cols*CELL_SIZE);
- const cached = this.layerNodes.get(i);
- if (cached && cached.geometry===geometry && cached.bytes.length===encoded.length && cached.bytes.every((byte,index)=>byte===encoded[index])) {
- nodes.push(cached.node);
- continue;
- }
- const layer = this.root.ownerDocument.createElement("div");
- layer.style.cssText = `position:absolute;overflow:hidden;left:${val(3)*bw}px;top:${val(4)*bh}px;width:${val(5)*bw}px;height:${val(6)*bh}px;background:${DEFAULT_BG}`;
- for (let row = 0; row < rows; row++) {
- const compact = row < contexts;
- const height = compact ? th : bh, width = compact ? tw : bw;
- const top = Math.min(row, contexts)*th + Math.max(0,row-contexts)*bh;
- if (top >= val(6)*bh) break;
- const line = this.root.ownerDocument.createElement("div");
- line.style.cssText = `position:absolute;left:0;right:0;top:${top}px;height:${height}px;line-height:${height}px;white-space:pre;overflow:hidden`;
- line.style.backgroundColor = color(view.getUint32(row*cols*CELL_SIZE+12,true),DEFAULT_BG);
- for (let col = 0; col < cols; col++) {
- const off = (row*cols+col)*CELL_SIZE;
- const cell = this.root.ownerDocument.createElement("span");
- cell.className = "pardes-cell";
- cell.textContent = decoder.decode(bytes.subarray(ptr+off,ptr+off+view.getUint8(off+18))) || " ";
- applyStyle(cell, view.getUint32(off+8,true), view.getUint32(off+12,true), view.getUint16(off+16,true), col===val(8)&&row===val(9), val(10)!==0);
- cell.style.textAlign = "left";
- cell.style.width = `${width}px`;
- cell.style.height = `${height}px`;
- cell.style.lineHeight = `${height}px`;
- line.append(cell);
- }
- layer.append(line);
- }
- for (let row = 0; row < contexts; row++) {
- if (!val(11 + row)) continue;
- const border = this.root.ownerDocument.createElement("div");
- border.dataset.contextBorder = String(row);
- border.style.cssText = `position:absolute;left:0;right:0;top:${(row+1)*th}px;height:1px;background:currentColor;opacity:.45`;
- layer.append(border);
- }
- this.layerNodes.set(i,{geometry,bytes:encoded.slice(),node:layer});
- nodes.push(layer);
- }
- if (nodes.length!==this.layerRoot.childNodes.length || nodes.some((node,index)=>node!==this.layerRoot.childNodes[index])) this.layerRoot.replaceChildren(...nodes);
- }
-
- ensureGrid(cols, rows) {
- if (cols === this.cols && rows === this.rowCount) return;
- const document = this.root.ownerDocument;
- const rowNodes = [];
- const cells = [];
- for (let y = 0; y < rows; y += 1) {
- const row = document.createElement("div");
- row.className = "pardes-row";
- row.setAttribute("role", "row");
- row.dataset.row = String(y);
- const rowCells = [];
- for (let x = 0; x < cols; x += 1) {
- const cell = document.createElement("span");
- cell.className = "pardes-cell";
- cell.setAttribute("role", "gridcell");
- cell.dataset.col = String(x);
- cell.dataset.row = String(y);
- cell.textContent = " ";
- rowCells.push(cell);
- cells.push(cell);
- }
- row.replaceChildren(...rowCells);
- rowNodes.push(row);
- }
- this.root.replaceChildren(...rowNodes);
- this.root.setAttribute("aria-colcount", String(cols));
- this.root.setAttribute("aria-rowcount", String(rows));
- this.rows = rowNodes;
- this.cells = cells;
- this.cols = cols;
- this.rowCount = rows;
- }
-}
-
-export class PardesRuntime {
- constructor(root, wasm) {
- this.root = root;
- this.wasm = wasm;
- this.renderer = new DomRenderer(root, wasm);
- this.cellWidth = 1;
- this.cellHeight = 1;
- this.running = false;
- this.pointer = null;
- this.frameHandle = 0;
- this.bindEvents();
- }
-
- start() {
- this.measure();
- const { cols, rows } = this.gridSize();
- const error = this.wasm.pardes_init(cols, rows);
- if (error) throw new Error(`Pardes wasm init failed (${error})`);
- this.resize();
- this.wasm.pardes_tick();
- this.renderer.render();
- this.running = true;
- this.frameHandle = requestAnimationFrame((timestamp) => this.frame(timestamp));
- this.root.focus({ preventScroll: true });
- }
-
- stop() {
- this.running = false;
- if (this.frameHandle) cancelAnimationFrame(this.frameHandle);
- this.wasm.pardes_deinit();
- }
-
- frame(timestamp) {
- if (!this.running) return;
- if (this.wasm.pardes_gui_tagline_font_percent() !== this.measuredTaglinePercent) {
- this.resize();
- this.root.style.setProperty("--pardes-tagline-font-size", `${this.measuredTaglinePercent}%`);
- }
- // The core's clock is this timestamp: it steps its own animations
- // by it, however fast the display refreshes.
- this.wasm.pardes_tick(timestamp);
- if (this.wasm.pardes_should_quit()) this.running = false;
- this.renderer.render();
- this.frameHandle = requestAnimationFrame((nextTimestamp) => this.frame(nextTimestamp));
- }
-
- measure() {
- const probe = this.root.ownerDocument.createElement("span");
- probe.className = "pardes-probe";
- probe.textContent = "M";
- this.root.ownerDocument.body.append(probe);
- const rect = probe.getBoundingClientRect();
- probe.remove();
- this.cellWidth = Math.max(1, rect.width);
- this.cellHeight = Math.max(1, rect.height);
- const ratio = this.wasm.pardes_gui_tagline_font_percent() / 100;
- this.measuredTaglinePercent = this.wasm.pardes_gui_tagline_font_percent();
- this.taglineWidth = this.cellWidth * ratio;
- this.taglineHeight = this.cellHeight * ratio;
- Object.assign(this.renderer, { cellWidth:this.cellWidth, cellHeight:this.cellHeight, taglineWidth:this.taglineWidth, taglineHeight:this.taglineHeight });
- const style = this.root.ownerDocument.defaultView.getComputedStyle(this.root);
- const fontKey = [style.fontFamily,style.fontSize,style.fontWeight,style.fontStyle,ratio,globalThis.devicePixelRatio].join(":");
- if (fontKey !== this.gripFontKey) {
- this.renderer.resetGripMetrics();
- this.gripFontKey = fontKey;
- }
- }
-
- gridSize() {
- return {
- cols: Math.max(1, Math.floor(this.root.clientWidth / this.cellWidth)),
- rows: Math.max(1, Math.floor(this.root.clientHeight / this.cellHeight)),
- };
- }
-
- resize() {
- this.measure();
- const { cols, rows } = this.gridSize();
- this.wasm.pardes_resize(cols, rows);
- this.wasm.pardes_row_metrics?.(Math.max(1,Math.round(this.cellWidth)),Math.max(1,Math.round(this.cellHeight)),Math.max(1,Math.round(this.taglineWidth)),Math.max(1,Math.round(this.taglineHeight)));
- }
-
- writeInput(text) {
- return putInput(this.wasm, text);
- }
-
- key(event) {
- const mods = modifiers(event);
- let cp = SPECIAL_KEYS[event.key];
- let text = "";
- if (cp === undefined && event.key.length > 0 && [...event.key].length === 1) {
- text = mods & 3 ? "" : event.key;
- const shortcut = event.code?.match(/^Key([A-Z])$/);
- cp = shortcut && (mods & 3) ? shortcut[1].toLowerCase().codePointAt(0) : event.key.codePointAt(0);
- }
- if (cp === undefined) return;
- event.preventDefault();
- this.wasm.pardes_key(cp, this.writeInput(text), mods);
- }
-
- point(event) {
- const rect = this.root.getBoundingClientRect();
- this.sampledPointer = { x:event.clientX-rect.left, y:event.clientY-rect.top };
- return {
- col: clamp(Math.floor((event.clientX - rect.left) / this.cellWidth), 0, Math.max(0, this.wasm.pardes_frame_cols() - 1)),
- row: clamp(Math.floor((event.clientY - rect.top) / this.cellHeight), 0, Math.max(0, this.wasm.pardes_frame_rows() - 1)),
- };
- }
-
- cellPoint(col, row) {
- const rect = this.root.getBoundingClientRect();
- return { x: rect.left + (col + 0.5) * this.cellWidth, y: rect.top + (row + 0.5) * this.cellHeight };
- }
-
- mouse(button, kind, col, row, mods) {
- if (this.wasm.pardes_mouse_pixel && this.sampledPointer) {
- this.wasm.pardes_mouse_pixel(button,kind,col,row,mods,this.sampledPointer.x*256,this.sampledPointer.y*256,Math.round(this.cellWidth*256),Math.round(this.cellHeight*256),Math.round(this.taglineWidth*256),Math.round(this.taglineHeight*256));
- } else this.wasm.pardes_mouse(button,kind,col,row,mods);
- }
-
- mouseDown(event) {
- event.preventDefault();
- if (event.button !== 3 && event.button !== 4) return;
- this.root.focus({ preventScroll: true });
- const point = this.point(event);
- this.mouse(pointerButton(event.button), MOUSE.press, point.col, point.row, modifiers(event));
- }
-
- pointerDown(event) {
- // Mouse defaults are cancelled by mousedown. Cancelling pointerdown
- // would suppress that stream, including thumb presses while left is held.
- if (event.button === 3 || event.button === 4) return;
- if (event.pointerType === "touch") event.preventDefault();
- this.root.focus({ preventScroll: true });
- const point = this.point(event);
- this.root.setPointerCapture?.(event.pointerId);
- if (event.pointerType === "touch") {
- const packed = this.wasm.pardes_chrome_target(point.col, point.row) >>> 0;
- const chrome = packed !== 0xffffffff;
- const snapped = chrome ? { col: packed & 0xffff, row: packed >>> 16 } : point;
- this.pointer = { id: event.pointerId, touch: true, chrome, startX: event.clientX, startY: event.clientY, lastX: event.clientX, lastY: event.clientY, point: snapped, scrolling: false, accum: 0 };
- if (chrome) this.mouse(BUTTON.left, MOUSE.press, snapped.col, snapped.row, modifiers(event));
- return;
- }
- const button = pointerButton(event.button);
- this.pointer = { id: event.pointerId, touch: false, button };
- this.mouse(button, MOUSE.press, point.col, point.row, modifiers(event));
- }
-
- pointerMove(event) {
- if (event.button === 3 || event.button === 4) return;
- const point = this.point(event);
- const active = this.pointer?.id === event.pointerId ? this.pointer : null;
- if (!active) {
- if (event.pointerType !== "touch") this.mouse(BUTTON.none, MOUSE.motion, point.col, point.row, modifiers(event));
- return;
- }
- event.preventDefault();
- if (!active.touch) {
- this.mouse(active.button, MOUSE.drag, point.col, point.row, modifiers(event));
- return;
- }
- if (active.chrome) {
- this.mouse(BUTTON.left, MOUSE.drag, point.col, point.row, modifiers(event));
- return;
- }
- const travel = Math.hypot(event.clientX - active.startX, event.clientY - active.startY);
- if (travel > 8) active.scrolling = true;
- if (active.scrolling) {
- const dy = event.clientY - active.lastY;
- active.accum += dy / this.cellHeight;
- while (active.accum <= -1) {
- this.mouse(BUTTON.wheelDown, MOUSE.press, point.col, point.row, 0);
- active.accum += 1;
- }
- while (active.accum >= 1) {
- this.mouse(BUTTON.wheelUp, MOUSE.press, point.col, point.row, 0);
- active.accum -= 1;
- }
- }
- active.lastX = event.clientX;
- active.lastY = event.clientY;
- }
-
- pointerUp(event) {
- if (event.button === 3 || event.button === 4) {
- event.preventDefault();
- return;
- }
- const active = this.pointer?.id === event.pointerId ? this.pointer : null;
- if (!active) return;
- event.preventDefault();
- const point = this.point(event);
- if (active.touch) {
- if (active.chrome) this.mouse(BUTTON.left, MOUSE.release, point.col, point.row, modifiers(event));
- else if (!active.scrolling) {
- this.mouse(BUTTON.right, MOUSE.press, point.col, point.row, 0);
- this.mouse(BUTTON.right, MOUSE.release, point.col, point.row, 0);
- }
- } else {
- this.mouse(active.button, MOUSE.release, point.col, point.row, modifiers(event));
- }
- if (this.root.hasPointerCapture?.(event.pointerId)) this.root.releasePointerCapture(event.pointerId);
- this.pointer = null;
- }
-
- wheel(event) {
- event.preventDefault();
- const point = this.point(event);
- if (event.deltaY) this.mouse(event.deltaY < 0 ? BUTTON.wheelUp : BUTTON.wheelDown, MOUSE.press, point.col, point.row, modifiers(event));
- if (event.deltaX) this.mouse(event.deltaX < 0 ? BUTTON.wheelLeft : BUTTON.wheelRight, MOUSE.press, point.col, point.row, modifiers(event));
- }
-
- paste(event) {
- const text = event.clipboardData?.getData("text/plain");
- if (text === undefined) return;
- event.preventDefault();
- this.wasm.pardes_paste(this.writeInput(text));
- }
-
- bindEvents() {
- this.root.addEventListener("keydown", (event) => this.key(event));
- this.root.addEventListener("paste", (event) => this.paste(event));
- this.root.addEventListener("contextmenu", (event) => event.preventDefault());
- this.root.addEventListener("auxclick", (event) => event.preventDefault());
- // Mouse events retain additional button presses while another button is held.
- this.root.addEventListener("mousedown", (event) => this.mouseDown(event));
- this.root.addEventListener("pointerdown", (event) => this.pointerDown(event));
- this.root.addEventListener("pointermove", (event) => this.pointerMove(event));
- this.root.addEventListener("pointerup", (event) => this.pointerUp(event));
- this.root.addEventListener("pointercancel", (event) => this.pointerUp(event));
- this.root.addEventListener("pointerleave", () => this.wasm.pardes_pointer_leave());
- this.root.addEventListener("wheel", (event) => this.wheel(event), { passive: false });
- globalThis.addEventListener?.("resize", () => this.resize());
- }
-}
-
-export function browserHost() {
- const host = { wasm: null };
- const view = (ptr, len) => new Uint8Array(host.wasm.memory.buffer, ptr, len);
- const text = (ptr, len) => decoder.decode(view(ptr, len));
- host.imports = {
- pardes: {
- host_open_link: (ptr, len) => {
- globalThis.open?.(text(ptr, len), "_blank", "noopener,noreferrer");
- },
- host_set_clipboard: (ptr, len) => {
- globalThis.navigator?.clipboard?.writeText(text(ptr, len)).catch(() => {});
- },
- // Async and permission-gated, unlike every other import here: a refused
- // or unsupported read is simply a paste that never happens, which is
- // what the core already tolerates from an empty clipboard.
- host_read_clipboard: () => {
- globalThis.navigator?.clipboard?.readText()
- .then((clip) => host.wasm.pardes_paste(putInput(host.wasm, clip)))
- .catch(() => {});
- },
- // A file a page writes is a download; the core already resolved the path
- // and the bytes, and the Blob needs its own copy of them.
- host_download: (pathPtr, pathLen, ptr, len) => {
- const name = text(pathPtr, pathLen).split("/").pop() || "pardes.txt";
- download(view(ptr, len).slice(), name, "text/plain;charset=utf-8");
- },
- },
- };
- return host;
-}
-
-export async function instantiate(url = "./pardes.wasm") {
- const host = browserHost();
- const response = await fetch(url);
- if (!response.ok) throw new Error(`fetch ${url}: HTTP ${response.status}`);
- if (WebAssembly.instantiateStreaming) {
- try {
- const { instance } = await WebAssembly.instantiateStreaming(response.clone(), host.imports);
- host.wasm = instance.exports;
- return host.wasm;
- } catch (error) {
- if (!/mime|content-type/i.test(String(error))) throw error;
- }
- }
- const { instance } = await WebAssembly.instantiate(await response.arrayBuffer(), host.imports);
- host.wasm = instance.exports;
- return host.wasm;
-}
-
-export async function boot(root, url = "./pardes.wasm") {
- if (!root) throw new Error("Pardes DOM root is missing");
- const wasm = await instantiate(url);
- const runtime = new PardesRuntime(root, wasm);
- runtime.start();
- const test = {
- grid: () => runtime.renderer.snapshot,
- cellPoint: (col, row) => runtime.cellPoint(col, row),
- };
- globalThis.pardes = { runtime, wasm, test };
- return runtime;
-}
-
-function applyStyle(cell, fgCode, bgCode, attrs, cursor, cursorBar) {
- let fg = color(fgCode, DEFAULT_FG);
- let bg = color(bgCode, DEFAULT_BG);
- if (attrs & (1 << 4)) [fg, bg] = [bg, fg];
- if (attrs & (1 << 5)) fg = bg;
- if (attrs & (1 << 1)) fg = dim(fg);
- cell.style.color = fg;
- cell.style.backgroundColor = bg;
- cell.style.fontWeight = attrs & 1 ? "700" : "400";
- cell.style.fontStyle = attrs & (1 << 2) ? "italic" : "normal";
- const underline = (attrs >>> 8) & 7;
- cell.style.textDecorationLine = `${underline ? "underline " : ""}${attrs & (1 << 6) ? "line-through" : ""}`.trim() || "none";
- cell.style.textDecorationStyle = ["solid", "solid", "double", "wavy", "dotted", "dashed"][underline] || "solid";
- cell.style.setProperty("--cell-fg", fg);
- cell.style.setProperty("--cell-bg", bg);
- cell.classList.toggle("is-cursor", cursor);
- cell.classList.toggle("is-bar", cursor && cursorBar);
- cell.classList.toggle("is-blinking", Boolean(attrs & (1 << 3)));
- cell.classList.toggle("is-tagline", Boolean(attrs & ATTR_TAGLINE));
-}
-
-function color(encoded, fallback) {
- if (encoded === 0x01000000) return fallback;
- if ((encoded & 0xff000000) === 0x02000000) return indexedColor(encoded & 0xff);
- return `#${(encoded & 0xffffff).toString(16).padStart(6, "0")}`;
-}
-
-function indexedColor(index) {
- const ansi = [
- "#000000", "#cc0000", "#4e9a06", "#c4a000", "#3465a4", "#75507b", "#06989a", "#d3d7cf",
- "#555753", "#ef2929", "#8ae234", "#fce94f", "#729fcf", "#ad7fa8", "#34e2e2", "#eeeeec",
- ];
- if (index < 16) return ansi[index];
- if (index >= 232) {
- const level = 8 + (index - 232) * 10;
- return rgb(level, level, level);
- }
- const n = index - 16;
- const level = (part) => part === 0 ? 0 : 55 + part * 40;
- return rgb(level(Math.floor(n / 36)), level(Math.floor(n / 6) % 6), level(n % 6));
-}
-
-function dim(value) {
- const n = Number.parseInt(value.slice(1), 16);
- return rgb(((n >>> 16) & 0xff) * 0.6, ((n >>> 8) & 0xff) * 0.6, (n & 0xff) * 0.6);
-}
-
-function rgb(r, g, b) {
- return `#${[r, g, b].map((part) => Math.round(part).toString(16).padStart(2, "0")).join("")}`;
-}
-
-function modifiers(event) {
- return (event.ctrlKey ? 1 : 0) | (event.altKey ? 2 : 0) | (event.shiftKey ? 4 : 0) | (event.metaKey ? 8 : 0);
-}
-
-function pointerButton(button) {
- return button === 1 ? BUTTON.middle : button === 2 ? BUTTON.right : button === 3 ? BUTTON.back : button === 4 ? BUTTON.forward : BUTTON.left;
-}
-
-function clamp(value, low, high) {
- return Math.max(low, Math.min(high, value));
-}
-
-function putInput(wasm, text) {
- const data = encoder.encode(text);
- if (data.length > wasm.pardes_input_capacity()) throw new Error("browser input exceeds wasm transfer buffer");
- new Uint8Array(wasm.memory.buffer, wasm.pardes_input_ptr(), data.length).set(data);
- return data.length;
-}
-
-function download(bytes, name, type) {
- if (typeof document === "undefined") return;
- const url = URL.createObjectURL(new Blob([bytes], { type }));
- const anchor = document.createElement("a");
- anchor.href = url;
- anchor.download = name;
- anchor.click();
- setTimeout(() => URL.revokeObjectURL(url), 0);
-}
diff --git a/src/web/index.html b/src/web/index.html
deleted file mode 100644
index 4012c313..00000000
--- a/src/web/index.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Pardes</title>
- <link rel="stylesheet" href="pardes.css">
-</head>
-<body>
- <main id="pardes" class="pardes" role="grid" aria-label="Pardes text environment" tabindex="0"></main>
- <noscript>Pardes needs JavaScript to drive its WebAssembly core.</noscript>
- <script type="module">
- import { boot } from "./app.mjs";
- boot(document.getElementById("pardes"));
- </script>
-</body>
-</html>
diff --git a/src/web/libc.c b/src/web/libc.c
deleted file mode 100644
index c49fa03e..00000000
--- a/src/web/libc.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Minimal libc-shaped surface used by Tree-sitter inside the freestanding
- * browser module. Allocation lives in web.zig so it shares Zig's wasm heap;
- * these routines neither import browser functions nor perform IO. */
-#include <ctype.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <wctype.h>
-
-_Noreturn void abort(void) {
- __builtin_trap();
-}
-
-size_t strlen(const char *str) {
- const char *end = str;
- while (*end) end++;
- return (size_t)(end - str);
-}
-
-char *strchr(const char *str, int character) {
- const unsigned char needle = (unsigned char)character;
- do {
- if ((unsigned char)*str == needle) return (char *)str;
- } while (*str++);
- return (char *)0;
-}
-
-void *memchr(const void *ptr, int value, size_t count) {
- const unsigned char *bytes = (const unsigned char *)ptr;
- const unsigned char needle = (unsigned char)value;
- for (size_t index = 0; index < count; index++) {
- if (bytes[index] == needle) return (void *)(bytes + index);
- }
- return (void *)0;
-}
-
-int strcmp(const char *lhs, const char *rhs) {
- while (*lhs && (unsigned char)*lhs == (unsigned char)*rhs) {
- lhs++;
- rhs++;
- }
- return (int)(unsigned char)*lhs - (int)(unsigned char)*rhs;
-}
-
-int strncmp(const char *lhs, const char *rhs, size_t count) {
- while (count && *lhs && (unsigned char)*lhs == (unsigned char)*rhs) {
- lhs++;
- rhs++;
- count--;
- }
- return count ? (int)(unsigned char)*lhs - (int)(unsigned char)*rhs : 0;
-}
-
-char *strncpy(char *restrict dest, const char *restrict src, size_t count) {
- char *result = dest;
- while (count && *src) {
- *dest++ = *src++;
- count--;
- }
- while (count--) *dest++ = '\0';
- return result;
-}
-
-int isprint(int character) {
- return character >= 0x20 && character <= 0x7e;
-}
-
-int isdigit(int character) {
- return character >= '0' && character <= '9';
-}
-
-int iswspace(wint_t character) {
- return character == ' ' || (character >= '\t' && character <= '\r');
-}
-
-int iswalnum(wint_t character) {
- return iswdigit(character) || iswalpha(character);
-}
-
-int iswalpha(wint_t character) {
- return (character >= 'A' && character <= 'Z') ||
- (character >= 'a' && character <= 'z') || character >= 0x80;
-}
-
-int iswblank(wint_t character) {
- return character == ' ' || character == '\t';
-}
-
-int iswdigit(wint_t character) {
- return character >= '0' && character <= '9';
-}
-
-int iswlower(wint_t character) {
- return character >= 'a' && character <= 'z';
-}
-
-int iswupper(wint_t character) {
- return character >= 'A' && character <= 'Z';
-}
-
-int iswxdigit(wint_t character) {
- return iswdigit(character) || (character >= 'A' && character <= 'F') ||
- (character >= 'a' && character <= 'f');
-}
-
-wint_t towupper(wint_t character) {
- return iswlower(character) ? character - ('a' - 'A') : character;
-}
-
-int vsnprintf(char *restrict buffer, size_t size, const char *restrict format, va_list args) {
- (void)format;
- (void)args;
- if (size) buffer[0] = '\0';
- return 0;
-}
-
-int snprintf(char *restrict buffer, size_t size, const char *restrict format, ...) {
- va_list args;
- va_start(args, format);
- int result = vsnprintf(buffer, size, format, args);
- va_end(args);
- return result;
-}
-
-int fprintf(FILE *stream, const char *format, ...) {
- (void)stream;
- (void)format;
- return 0;
-}
-
-int fclose(FILE *stream) {
- (void)stream;
- return 0;
-}
-
-FILE *fdopen(int descriptor, const char *mode) {
- (void)descriptor;
- (void)mode;
- return (FILE *)0;
-}
-
-int fputc(int character, FILE *stream) {
- (void)stream;
- return character;
-}
-
-int fputs(const char *string, FILE *stream) {
- (void)stream;
- return (int)strlen(string);
-}
diff --git a/src/web/libc/include/assert.h b/src/web/libc/include/assert.h
deleted file mode 100644
index fd018947..00000000
--- a/src/web/libc/include/assert.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef PARDES_WEB_ASSERT_H
-#define PARDES_WEB_ASSERT_H
-
-#ifndef static_assert
-#define static_assert _Static_assert
-#endif
-
-#ifdef NDEBUG
-#define assert(expression) ((void)0)
-#else
-#define assert(expression) ((expression) ? (void)0 : __builtin_trap())
-#endif
-
-#endif
diff --git a/src/web/libc/include/ctype.h b/src/web/libc/include/ctype.h
deleted file mode 100644
index 985c8759..00000000
--- a/src/web/libc/include/ctype.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef PARDES_WEB_CTYPE_H
-#define PARDES_WEB_CTYPE_H
-
-int isprint(int character);
-int isdigit(int character);
-
-#endif
diff --git a/src/web/libc/include/endian.h b/src/web/libc/include/endian.h
deleted file mode 100644
index a047c88f..00000000
--- a/src/web/libc/include/endian.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef PARDES_WEB_ENDIAN_H
-#define PARDES_WEB_ENDIAN_H
-
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-#define __BYTE_ORDER __LITTLE_ENDIAN
-
-#define htole16(value) (value)
-#define le16toh(value) (value)
-#define htole32(value) (value)
-#define le32toh(value) (value)
-#define htole64(value) (value)
-#define le64toh(value) (value)
-#define htobe16(value) __builtin_bswap16(value)
-#define be16toh(value) __builtin_bswap16(value)
-#define htobe32(value) __builtin_bswap32(value)
-#define be32toh(value) __builtin_bswap32(value)
-#define htobe64(value) __builtin_bswap64(value)
-#define be64toh(value) __builtin_bswap64(value)
-
-#endif
diff --git a/src/web/libc/include/inttypes.h b/src/web/libc/include/inttypes.h
deleted file mode 100644
index 7e795746..00000000
--- a/src/web/libc/include/inttypes.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef PARDES_WEB_INTTYPES_H
-#define PARDES_WEB_INTTYPES_H
-
-#include <stdint.h>
-
-#define PRId32 "d"
-
-#endif
diff --git a/src/web/libc/include/limits.h b/src/web/libc/include/limits.h
deleted file mode 100644
index 6ba31375..00000000
--- a/src/web/libc/include/limits.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef PARDES_WEB_LIMITS_H
-#define PARDES_WEB_LIMITS_H
-
-#define CHAR_BIT __CHAR_BIT__
-#define INT_MAX __INT_MAX__
-#define UINT_MAX (__INT_MAX__ * 2U + 1U)
-#define USHRT_MAX (__SHRT_MAX__ * 2U + 1U)
-
-#endif
diff --git a/src/web/libc/include/stdio.h b/src/web/libc/include/stdio.h
deleted file mode 100644
index 92895054..00000000
--- a/src/web/libc/include/stdio.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef PARDES_WEB_STDIO_H
-#define PARDES_WEB_STDIO_H
-
-#include <stdarg.h>
-#include <stddef.h>
-
-typedef struct PardesWebFile FILE;
-
-#define stderr ((FILE *)0)
-
-int fprintf(FILE *stream, const char *format, ...);
-int fclose(FILE *stream);
-FILE *fdopen(int descriptor, const char *mode);
-int fputc(int character, FILE *stream);
-int fputs(const char *string, FILE *stream);
-int snprintf(char *restrict buffer, size_t size, const char *restrict format, ...);
-int vsnprintf(char *restrict buffer, size_t size, const char *restrict format, va_list args);
-
-#endif
diff --git a/src/web/libc/include/stdlib.h b/src/web/libc/include/stdlib.h
deleted file mode 100644
index cb280904..00000000
--- a/src/web/libc/include/stdlib.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef PARDES_WEB_STDLIB_H
-#define PARDES_WEB_STDLIB_H
-
-#include <stddef.h>
-
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-
-void *malloc(size_t size);
-void *calloc(size_t count, size_t size);
-void *realloc(void *ptr, size_t size);
-void free(void *ptr);
-_Noreturn void abort(void);
-
-#endif
diff --git a/src/web/libc/include/string.h b/src/web/libc/include/string.h
deleted file mode 100644
index 7e5b8783..00000000
--- a/src/web/libc/include/string.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef PARDES_WEB_STRING_H
-#define PARDES_WEB_STRING_H
-
-#include <stddef.h>
-
-void *memchr(const void *ptr, int value, size_t count);
-int memcmp(const void *lhs, const void *rhs, size_t count);
-void *memcpy(void *restrict dest, const void *restrict src, size_t count);
-void *memmove(void *dest, const void *src, size_t count);
-void *memset(void *dest, int value, size_t count);
-size_t strlen(const char *str);
-char *strchr(const char *str, int character);
-int strcmp(const char *lhs, const char *rhs);
-int strncmp(const char *lhs, const char *rhs, size_t count);
-char *strncpy(char *restrict dest, const char *restrict src, size_t count);
-
-#endif
diff --git a/src/web/libc/include/wchar.h b/src/web/libc/include/wchar.h
deleted file mode 100644
index 4888631e..00000000
--- a/src/web/libc/include/wchar.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef PARDES_WEB_WCHAR_H
-#define PARDES_WEB_WCHAR_H
-
-#include <stddef.h>
-#include <wctype.h>
-
-typedef __WCHAR_TYPE__ wchar_t;
-
-#endif
diff --git a/src/web/libc/include/wctype.h b/src/web/libc/include/wctype.h
deleted file mode 100644
index 77bbabe9..00000000
--- a/src/web/libc/include/wctype.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef PARDES_WEB_WCTYPE_H
-#define PARDES_WEB_WCTYPE_H
-
-#include <stddef.h>
-
-typedef unsigned int wint_t;
-
-int iswalnum(wint_t character);
-int iswalpha(wint_t character);
-int iswblank(wint_t character);
-int iswdigit(wint_t character);
-int iswlower(wint_t character);
-int iswspace(wint_t character);
-int iswupper(wint_t character);
-int iswxdigit(wint_t character);
-wint_t towupper(wint_t character);
-
-#endif
diff --git a/src/web/pardes.css b/src/web/pardes.css
deleted file mode 100644
index 5cb44f88..00000000
--- a/src/web/pardes.css
+++ /dev/null
@@ -1,99 +0,0 @@
-@font-face {
- font-family: "Pardes Mono";
- src: url("./AdwaitaMono-Regular.ttf") format("truetype");
- font-display: swap;
-}
-
-:root {
- color-scheme: dark;
- --pardes-bg: #121212;
- --pardes-fg: #cccccc;
- --pardes-font-size: 18px;
- --pardes-cell-width: 9.333333px;
- --pardes-cell-height: 19.459459px;
-}
-
-html,
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- overflow: hidden;
- background: var(--pardes-bg);
-}
-
-.pardes {
- box-sizing: border-box;
- width: 100vw;
- height: 100vh;
- overflow: hidden;
- color: var(--pardes-fg);
- background: var(--pardes-bg);
- font-family: "Pardes Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
- font-size: var(--pardes-font-size);
- font-variant-ligatures: none;
- line-height: 1;
- outline: none;
- touch-action: none;
- user-select: text;
- cursor: text;
-}
-
-.pardes-row {
- display: flex;
- width: max-content;
- height: var(--pardes-cell-height);
- line-height: var(--pardes-cell-height);
- white-space: pre;
-}
-
-.pardes-cell {
- box-sizing: border-box;
- display: inline-block;
- flex: 0 0 var(--pardes-cell-width);
- width: var(--pardes-cell-width);
- height: var(--pardes-cell-height);
- overflow: hidden;
- text-align: left;
- white-space: pre;
-}
-
-/* The browser keeps the canonical DOM grid body-sized for native text
- selection. The inherited fixed line-height centers the smaller face, and
- each glyph remains centered in its original DOM column. */
-.pardes-cell.is-tagline {
- font-size: var(--pardes-tagline-font-size, 100%);
- text-align: center;
-}
-
-.pardes-cell.is-cursor {
- color: var(--cell-bg) !important;
- background: var(--cell-fg) !important;
-}
-
-.pardes-cell.is-cursor.is-bar {
- color: var(--cell-fg) !important;
- background: var(--cell-bg) !important;
- box-shadow: inset 2px 0 var(--cell-fg);
-}
-
-.pardes-cell.is-blinking {
- animation: pardes-blink 1s step-end infinite;
-}
-
-.pardes-probe {
- position: fixed;
- left: -10000px;
- top: -10000px;
- width: var(--pardes-cell-width);
- height: var(--pardes-cell-height);
- visibility: hidden;
-}
-
-@keyframes pardes-blink {
- 50% { opacity: 0; }
-}
-
-@media (prefers-reduced-motion: reduce) {
- .pardes-cell.is-blinking { animation: none; }
-}
diff --git a/src/web/zstbi.zig b/src/web/zstbi.zig
deleted file mode 100644
index 76b144f7..00000000
--- a/src/web/zstbi.zig
+++ /dev/null
@@ -1,30 +0,0 @@
-//! Freestanding image-decoder shim.
-//!
-//! The browser core has no libc or C allocator ABI. Image bytes still survive
-//! dumps, but decoding belongs in the JavaScript IO layer rather than pulling
-//! stb_image and an Emscripten runtime into the state machine.
-
-const std = @import("std");
-
-pub fn init(_: std.Io, _: std.mem.Allocator) void {}
-pub fn deinit() void {}
-
-pub const Image = struct {
- data: []u8 = &.{},
- width: u32 = 0,
- height: u32 = 0,
- num_components: u32 = 4,
- bytes_per_component: u32 = 1,
- bytes_per_row: u32 = 0,
- is_hdr: bool = false,
-
- pub fn loadFromMemory(_: []const u8, _: u32) !Image {
- return error.ImageDecodeUnavailable;
- }
-
- pub fn resize(_: *const Image, _: u32, _: u32) Image {
- return .{};
- }
-
- pub fn deinit(_: *Image) void {}
-};