Repository navigation
kit: a lesson layout for the simulate view - #120
Merged
Merged
Conversation
This was referenced Nov 14, 2026
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
force-pushed
the
kit/lesson-mode
branch
from
November 14, 2026 14:06
f5df445 to
551e6b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 2 of #118, stacked on #119. GitHub retargets it to
masterwhen #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 tosetShape, as the tutorial'schat.lesson.jsonprovides.What a lesson leaves out
How it lays out
.cl-sim.lessoninsim.css).setShaperan 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-simnow resetsfont-family,colorandpaddingonp,a,labelandspan, and setstext-align: left. The tutorial styles everypandlabeland centres itsmain, and those rules reached into the view. The view's own rules are all.cl-sim .classor stronger, so they still win.Verified locally
yarn testpasses 39 kit tests and 26 app tests (8 passing, 18 skipped as onmaster). Four new tests cover a lesson's fixed scene, the offered behaviours and tabs,selectwith a call that shows its reply and frames, andclock: falsein a sandbox.masterin headless Chromium, in the editor and in the simulate view with a placed scene.send, and times out after the server is switched todrop. A Playwright test there does the same.