Skip to content

feat: read-only views, marked by the producer - #103

Merged
endrix merged 2 commits into
mainfrom
feat/read-only-views
Oct 24, 2026
Merged

endrix merged 2 commits into
mainfrom
feat/read-only-views

Conversation

@endrix

@endrix endrix commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

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:

  • the root carries wf:readOnlyView (WorkflowDiagramMetadata.READ_ONLY_VIEW);
  • ReadOnlyViewMarker (a model-root listener) puts wf-read-only-view on 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;
  • the context menu leaves out the items that write to the source: Rename Entity, Duplicate, Edit Parameters and the boundary-port edits.

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 when readOnly is true; 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.
  • The container-parity baseline gains the marker's two bindings, and the test's comment lists them.

Typecheck (5/5), neutrality (5/5) and all workspace tests (1234) pass.

Producer side: PTO-ISA/normative_language#8 sets meta.readOnly on 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

`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
@endrix
endrix merged commit bd9eebb into main Oct 24, 2026
1 check passed
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