Skip to content

kit: a lesson layout for the simulate view - #120

Merged
Kinflou merged 3 commits into
masterfrom
kit/lesson-mode
Nov 14, 2026
Merged

Kinflou merged 3 commits into
masterfrom
kit/lesson-mode

Conversation

@Kinflou

@Kinflou Kinflou commented Nov 14, 2026

Copy link
Copy Markdown
Member

Step 2 of #118, stacked on #119. GitHub retargets it to master when #119 merges.

createSim({ layout: "lesson" }) shows a fixed scene for a guided page, such as a tutorial step. The scene comes from the session link passed to setShape, as the tutorial's chat.lesson.json provides.

What a lesson leaves out

  • The palette, the ports, drops onto the canvas, and box controls. Boxes can't be moved, renamed, selected or removed, and wires don't open the connection inspector.
  • Every inspector tab except a server's behaviours and a client's call, plus the box crumb and the call form's compare button.
  • The resize grips, and the sizes saved from the sandbox.

How it lays out

  • Canvas, inspector and frames stack in one column that grows with its content (.cl-sim.lesson in sim.css).
  • The scene is fitted to the canvas. The session's positions were placed for some other width, so on a narrow page the boxes overflowed. A lesson keeps the boxes' order and rows, shrinks horizontal gaps when the scene is wider than the canvas, and centres it. It re-fits on resize, or on the next frame if setShape ran before the view was attached.

New options (they work in a sandbox too)

  • behaviours: the behaviour kinds a server offers. The one already set is always kept.
  • clock: shows or hides the clock bar. Hidden by default in a lesson.
  • select: an instance, by id or name, to select once the session loads.

Host page styles

.cl-sim now resets font-family, color and padding on p, a, label and span, and sets text-align: left. The tutorial styles every p and label and centres its main, and those rules reached into the view. The view's own rules are all .cl-sim .class or stronger, so they still win.

Verified locally

  • Tests: yarn test passes 39 kit tests and 26 app tests (8 passing, 18 skipped as on master). Four new tests cover a lesson's fixed scene, the offered behaviours and tabs, select with a call that shows its reply and frames, and clock: false in a sandbox.
  • The playground looks the same: its build still renders byte-identical to master in headless Chromium, in the editor and in the simulate view with a placed scene.
  • In the tutorial: with the tutorial pinned to this branch (ComlineProject/tutorial, linked from Share the editor and simulate view with the tutorial (comline-web-kit) #118), the lesson renders themed, fits a narrow column, answers send, and times out after the server is switched to drop. A Playwright test there does the same.

createSim({ layout: "lesson" }) shows a fixed scene, given by the session
link passed to setShape, for a guided page such as a tutorial step:

- no palette, no ports, no drops, and the boxes can't be moved, renamed,
  selected or removed;
- the inspector shows only a server's behaviours and a client's calls, with
  no compare button;
- canvas, inspector and frames stack in one column that grows to its
  content, with no resize grips or saved sizes.

Three more options serve it, and work in the sandbox too: `behaviours`
limits the behaviour kinds a server offers, `clock` shows or hides the clock
bar (hidden in a lesson by default), and `select` picks an instance, by id or
name, once the session loads.
A page that sets a font, colour or padding on every p, a, label or span, or
centres its main, no longer reaches into the view: .cl-sim resets those, and
the view's own classes style what's inside. The playground sets none of
them and looks the same.
A lesson's session link carries positions placed for some other width, so a
narrow page clipped the boxes on the right. The lesson layout now maps them
onto its canvas: rows and order stay, horizontal gaps shrink when the scene
is wider than the canvas, and the scene is centred. It re-fits on resize,
and once the view is attached when setShape came first.
@Kinflou
Kinflou changed the base branch from kit/extract to master November 14, 2026 14:05
@Kinflou
Kinflou merged commit fe53d2e into master Nov 14, 2026
8 checks passed
@Kinflou
Kinflou deleted the kit/lesson-mode branch November 14, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant