Repository navigation
Extract the editor and simulate view into comline-web-kit - #119
Merged
Merged
Conversation
The repo becomes a Yarn workspace: app/ (the playground site) and kit/ (comline-web-kit), the playground's machinery as a package the tutorial and other pages can use. - comline-web-kit/editor: the CodeMirror editor, the compile worker, and createCompiler, the worker client that main.ts had inline. - comline-web-kit/sim: createSim and the shape types, plus loadSim, the engine WASM init main.ts did. Its styles move to comline-web-kit/sim.css, scoped under .cl-sim (the view's root) and themed with --cl-* properties whose defaults are the playground's colours. - comline-web-kit/editor-wasm: the editor WASM, now built into kit/pkg-editor. The kit's prepack builds it when the kit is installed from git; COMLINE_KIT_EDITOR=0 skips that for a site that only uses the sim. The app imports all of it from the kit and looks and behaves as before. The tests move with their code: 34 in the kit, 26 in the app, the same 60.
A build resolves dynamic imports too, so the scripted engine's import in createSim made every page that uses the view need pkg-script/, including a site installed with COMLINE_SIMULATOR_SCRIPT=0. The loader is now its own entry point that a page passes to createSim; without it, the view doesn't offer the `script` behaviour. The playground passes it, as before.
This was referenced Nov 14, 2026
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 1 of #118. Nothing in the playground changes, for users or in the tests. The editor and the simulate view move into a package the tutorial can use.
Layout
The repo becomes a Yarn workspace with two members:
app/(the playground site) andkit/(comline-web-kit)..yarnrc.yml,yarn.lockand the Yarn release move to the root.comline-web-kit/editormountEditor,makeState,readOnlyExtensions, the compile worker, andcreateCompiler(the worker clientmain.tshad inline)app/src/editor.ts,worker.ts,main.tscomline-web-kit/simcreateSim, the shape types, andloadSim(the engine's WASM init thatmain.tsdid)app/src/sim/comline-web-kit/sim/scriptedview.tscomline-web-kit/sim.cssapp/src/style.csscomline-web-kit/editor-wasmkit/pkg-editorapp/src/wasmChanges beyond the move
sim.cssrules are prefixed with.cl-sim, a class the view's root now carries. Inside it,--bg,--fgand the rest are redefined from--cl-*properties, whose defaults are the playground's colours. A page sets--cl-bgand so on to theme the view; the playground sets nothing and looks the same.createSimused to import the scripted engine itself. A build resolves dynamic imports too, so every page using the view neededpkg-script/, and a build installed withCOMLINE_SIMULATOR_SCRIPT=0failed. The loader is nowcomline-web-kit/sim/scripted, passed ascreateSim({ loadScripted }). Without a loader,scriptisn't offered, and a new test covers that. The playground passes the loader, so it offers scripting as before.prepack(kit/scripts/prepare.sh, like the simulator's) builds the editor WASM when another site installs the kit from git.COMLINE_KIT_EDITOR=0skips it for a site that only uses the sim.CI and docs
deploy.ymlinstalls, tests and builds at the root, and builds the editor WASM intokit/pkg-editor..gitignorefollows the moves.Verified locally
yarn testruns the kit's 35 tests (34 moved, plus the new one), then the app's 26. That's 43 passing and 18 skipped (the WASI-generator cases that need CI's generator builds), the same asmasterplus the new test.yarn buildtypechecks and builds. The bundle still has the worker, the editor WASM and both engine WASMs.git+https://github.com/ComlineProject/playground.git#workspace=comline-web-kit&commit=<sha>installs the kit withCOMLINE_KIT_EDITOR=0 COMLINE_SIMULATOR_SCRIPT=0. A Vite page there usingcreateSimandsim.cssbuilds without the scripted engine, withoptimizeDeps.exclude: ["comline-web-kit"].master's build and this branch's build are byte-identical. That's in two states: the editor after compiling the first example, and the simulate view with a server and a client placed and the server selected. Neither logged any console errors.