Repository navigation
feat: a product's own webview bundle starts the stock diagram with its modules added - #130
Merged
Merged
Conversation
…s modules added
`startStockDiagram({ features })`, in `@dialogram/diagram-client/stock-starter`,
is the stock bundle's start-up: the one webview channel and the overlay
routing on GLSP's messenger, the stock views and feature UI, the palette header
controls and SVG export. A product's feature modules load after every stock
one, where a `rebind` replaces a stock binding. The stock entry is now that
call with nothing added.
The entry imports the starter before the stylesheets, because esbuild writes
CSS in the order it meets it and the starter's imports bring GLSP's own
stylesheets: imported the other way round, GLSP's sprotty and palette rules
would land after the stock ones and win the cascade. Built side by side with
main, the stock bundle's stylesheet is byte-identical (path comments aside) and
its script runs the same start-up in the same order.
A sidecar product names its bundle with `clientAssets` on the
`createSidecarDiagramProfile` input, threaded onto the profile as data, as a
hand-assembled profile (chisel-ide) already could.
This is the seam wfpy-ide's own bundle will use to carry wfpy's property-panel
and run-time agent UI out of the stock client.
Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
- The docs said a product's modules load after every stock one. They load after the stock views and feature UI; the VS Code integration and GLSP's grid, helper-line, hover and context-menu modules still load after them, and the context-menu service is rebound last. The starter, README and changelog now say so. - One place decides the stock order: `stockDiagramOptions` hands `composeDiagramModules` `withStockViews` and the stock feature UI, instead of a second list of the same modules. - A stock module passed again in `features` now throws a TypeError naming the mistake, instead of GLSP throwing on the duplicate registration and leaving the webview blank. - A second `startStockDiagram()` warns and does nothing, instead of acquiring the VS Code API twice. - `features` takes a read-only list, copied once. - The barrel's comment named the deleted `WorkflowDiagramStarter`; it now points at `startStockDiagram`. - README §3 shows the resolver a product needs for the path import (the package has no `exports` map), and `stock-starter-build.test.ts` builds the stock entry and a product entry through it, pinning the stylesheet order: GLSP's, then the stock diagram's, then the product's. Put the stylesheets before the starter and it fails. Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
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.
The first seam for moving wfpy's own features into wfpy-ide. wfpy's property-panel and run-time agent UI live in the webview, so wfpy-ide needs a webview bundle of its own (as chisel-ide already ships) that is the stock diagram plus wfpy's modules, without copying the stock start-up.
What changes
startStockDiagram({ features })inpackages/diagram-client/src/stock-starter.ts(imported by path,@dialogram/diagram-client/stock-starter, not from the barrel: it pulls in GLSP's VS Code webview integration, which only a bundle needs). It does exactly what the stock entry did:The product's feature modules load after the stock views and feature UI (
stockDiagramOptions, besidecomposeDiagramModules), so arebindthere replaces a stock feature binding. The VS Code integration and GLSP's grid, helper-line, hover and context-menu modules still load after them, and the context-menu service is rebound last. A stock module passed again throws a clear TypeError, not a blank webview, and a second call warns and does nothing.The stock entry (
diagram-client.ts) is nowstartStockDiagram()and its stylesheet imports.clientAssetsonSidecarProfileInput, threaded ontoDiagramProfile.clientAssetsas data. A hand-assembled profile could already name its own bundle; a sidecar product could not.README §4 shows the product bundle. §3 shows the resolver a product needs for the path import, since the package has no
exportsmap. Changelog entry under Added.stock-starter-build.test.tsbuilds the stock entry and a product entry (through that resolver) with esbuild and pins the stylesheet order: GLSP's, then the stock diagram's, then the product's. With the stylesheets imported before the starter, it fails.The cascade trap, and how it was checked
esbuild writes CSS in the order it meets it, and the starter's imports bring GLSP's own stylesheets (sprotty, tool palette, …). My first version imported the stylesheets before the starter, which put GLSP's rules after the stock ones and let them win. I caught that by building main and this branch side by side. The entry now imports the starter first. Results:
composeDiagramModulesplaced after the module it now imports, and two empty CSS stubs evaluated later.Checks
scripts/typecheck.sh: 5/5 packages.scripts/check-neutrality.sh: 5/5 gates.npm run build: OK.stock-feature-modules.test.tsandstock-starter-build.test.ts;client-assets.test.ts. The one failure is the known local timeout invariant-node-create-wizard.test.ts, which passes in CI.https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv