Repository navigation
feat: read-only views, marked by the producer - #103
Merged
Merged
Conversation
`supportsElementCreation: false` empties the palette of every diagram a profile draws. A producer whose files are mostly editable also draws some it only reads (an NDF project's ASL units, its project overview), and one editor passes between both kinds in place; their palette offered creation tools that could only fail. A producer now marks one view read-only with `graph.meta.readOnly: true`: - the root carries `wf:readOnlyView` (`WorkflowDiagramMetadata.READ_ONLY_VIEW`); - `WorkflowToolPaletteItemProvider` returns no items for that view; - `ReadOnlyViewMarker`, a model-root listener, puts `wf-read-only-view` on the page while such a view is shown, and the stylesheet hides the palette's tools under it. The palette asks for its items once per editor, so this is what takes them away and gives them back on in-place navigation; the header (layout, fit, export) stays; - the context menu leaves out the items that write to the source (Rename Entity, Duplicate, Edit Parameters, the boundary-port edits). Moving nodes and laying them out stay: GLSP's own read-only edit mode would have disabled the move tool too, and with it saved layouts. A keyboard delete or a label edit still reaches the producer's sidecar, which is expected to refuse it. Tests: `read-only-view.test.ts` in the server (the root mark, an empty and a whole palette, the context menu with and without the editing items) and the client (the mark follows the view shown). The container-parity baseline gains the marker's two bindings. Claude-Session: https://claude.ai/code/session_01E8WfqKknDNN6xpNVcJL5K8
endrix
pushed a commit
to endrix/normative_language
that referenced
this pull request
Oct 23, 2026
ndf-sidecar writes Markdown documents only, so the project overview (ndf.yaml) and an ASL unit's view offered a palette whose every entry failed. Their graph now carries `meta.readOnly: true`, which Dialogram (endrix/dialogram#103) reads as a read-only view: an empty palette, no editing items in the context menu, moving and laying out kept. A Markdown document's views (its structure, its traces) stay editable. Claude-Session: https://claude.ai/code/session_01E8WfqKknDNN6xpNVcJL5K8
Review of #103: the palette provider returned no items for a read-only view, but the GLSP palette asks for its items once per editor. An editor that opened on a read-only view (an `.asl` unit in ndf-ide) kept an empty palette after navigating in place to an editable view, the opposite of what the change promised. The provider now serves the items whatever the view; `ReadOnlyViewMarker` and the stylesheet hide them while a read-only view is shown, and they show again on the next editable one. The test now asserts the items are served for both kinds of view. Claude-Session: https://claude.ai/code/session_01E8WfqKknDNN6xpNVcJL5K8
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.
What
A producer can mark one view read-only with
graph.meta.readOnly: true. Until now only a whole profile could be read-only (supportsElementCreation: false). ndf-ide needs the per-view form: its Markdown documents are editable, but its ASL units and its project overview are projections it only reads, and one editor moves between all three in place.For a view so marked:
wf:readOnlyView(WorkflowDiagramMetadata.READ_ONLY_VIEW);ReadOnlyViewMarker(a model-root listener) putswf-read-only-viewon the page while it is shown, and the stylesheet hides the palette's tools. The GLSP palette asks for its items only once per editor, so this class is what removes the tools and brings them back on in-place navigation. The palette header (layout, fit, export) stays;Moving nodes and laying them out still work. GLSP's own read-only edit mode would have disabled the move tool too, and saved layouts with it. A keyboard delete or a label edit still reaches the producer's sidecar, which is expected to refuse it; ndf-sidecar answers
read_only.Tests
diagram-server/test/read-only-view.test.ts: the root mark appears only whenreadOnlyistrue; the palette items are still served for a read-only view (the client hides them); the context menu keeps every non-editing item and drops the editing ones.diagram-client/test/read-only-view.test.ts: the mark follows the view shown, in both directions.Typecheck (5/5), neutrality (5/5) and all workspace tests (1234) pass.
Producer side: PTO-ISA/normative_language#8 sets
meta.readOnlyon every view not drawn from a Markdown document.Review fixes (8c9db8d)
The palette provider no longer empties the palette for a read-only view. The GLSP palette asks for its items only once per editor, so an editor that opened on a read-only view kept an empty palette after navigating to an editable one. The items are now always served, and the client's class hides them while a read-only view is shown.
https://claude.ai/code/session_01E8WfqKknDNN6xpNVcJL5K8