Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions kit/src/sim/sim.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
.cl-sim *::after {
box-sizing: inherit;
}
/* The host page's element styles (a font or padding on every p, a centred
main) stop at the view: its own classes style what's inside. */
.cl-sim {
text-align: left;
}
.cl-sim p,
.cl-sim a,
.cl-sim label,
.cl-sim span {
font-family: inherit;
color: inherit;
padding: 0;
}

/* general utilities the view uses */
.cl-sim .is-hidden {
Expand Down Expand Up @@ -921,3 +934,36 @@
.cl-sim .insp-crumb:hover {
color: var(--accent);
}

/* ── lesson layout ───────────────────────────────────────────────────────
One column (canvas, inspector, frames) that grows with its content, to sit
in a page rather than fill a window. */
.cl-sim.lesson {
height: auto;
grid-template-columns: 1fr;
grid-template-rows: auto auto auto;
grid-template-areas:
"canvas"
"inspector"
"frames";
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
}
.cl-sim.lesson .sim-canvas {
overflow: hidden;
}
.cl-sim.lesson .sim-inspector-wrap {
border-top: 1px solid var(--border);
}
.cl-sim.lesson .sim-frames {
border-top: 1px solid var(--border);
max-height: 16rem;
}
.cl-sim.lesson .sim-node-group,
.cl-sim.lesson .sim-wire .wire-hit {
cursor: default;
}
.cl-sim .clock-bar:empty {
display: none;
}
14 changes: 11 additions & 3 deletions kit/src/sim/ui/framelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ function storedHeight(): number | null {
}
}

export function frameLog(): FrameLog {
export interface FrameLogOpts {
/** A grip that resizes the `.sim` grid's bottom row, and the height kept
* from last time. Default true; off in a layout that isn't that grid. */
resizable?: boolean;
}

export function frameLog(opts: FrameLogOpts = {}): FrameLog {
const resizable = opts.resizable ?? true;
const el = document.createElement("div");
el.className = "sim-frames";

Expand All @@ -126,7 +133,7 @@ export function frameLog(): FrameLog {
/* private mode — just don't persist */
}
};
const saved = storedHeight();
const saved = resizable ? storedHeight() : null;
if (saved !== null && typeof requestAnimationFrame === "function") {
const apply = () => (el.closest(".sim") ? applyHeight(saved) : requestAnimationFrame(apply));
requestAnimationFrame(apply);
Expand Down Expand Up @@ -216,7 +223,8 @@ export function frameLog(): FrameLog {
const list = document.createElement("div");
list.className = "sim-frames-list";
list.append(table);
el.append(grip, head, list);
if (resizable) el.append(grip);
el.append(head, list);

let sources: LogSource[] = [];
let api: FrameSource = { frames: () => [], detail: () => null };
Expand Down
Loading
Loading