Skip to content

rune-langium / visual-editor/src / EditorState

Interface: EditorState ​

Defined in: packages/visual-editor/src/store/editor-store.ts:171

Snapshot of visual editor state tracked by the zustand store.

Config ​

Read-only from outside the store — use EditorActions methods to mutate. Accessible via useEditorStore(selector).

Properties ​

PropertyTypeDescriptionDefined in
activeFiltersGraphFilters-packages/visual-editor/src/store/editor-store.ts:205
deferredExportsDeferredExportEntry[]Curated-bundle deferred-export entries, stored on the store so loadModels can re-merge their placeholder graph nodes after replacing nodes with new RosettaModel-derived nodes. Without this state, every loadModels call (e.g. from EditorPage's linkDocument callback) would silently lose the curated namespaces that loadDeferredExports previously created.packages/visual-editor/src/store/editor-store.ts:197
detailPanelOpenboolean-packages/visual-editor/src/store/editor-store.ts:206
edgesTypeGraphEdge[]-packages/visual-editor/src/store/editor-store.ts:174
edgesByIdMap<string, TypeGraphEdge>Canonical id→edge index — the edit substrate (invariant I1: edges === [...edgesById.values()]). See nodesById for the write contract.packages/visual-editor/src/store/editor-store.ts:188
focusModebooleanWhen true, selecting a node auto-isolates its focused cluster.packages/visual-editor/src/store/editor-store.ts:214
focusRelatedExcludedKindsSet<TypeKind>Node kinds excluded from focus-mode related clusters (selected node is always retained).packages/visual-editor/src/store/editor-store.ts:216
hydratedNamespacesstring[]Namespaces that have already been hydrated in the current session. Used by requestNamespaceHydration to deduplicate requests and by the App.tsx re-parse effect to build the cumulative hydrateNamespaces set (replacement-semantics worker hydration requires sending the full set).packages/visual-editor/src/store/editor-store.ts:235
hydrationNoncenumberMonotonically-incrementing counter, bumped by markNamespacesHydrated each time new AST content reaches the worker. Consumers (e.g. ExplorePerspective) can react to this to re-link a selected node whose initial link ran before the hydration round-trip completed.packages/visual-editor/src/store/editor-store.ts:242
layoutOptionsLayoutOptions-packages/visual-editor/src/store/editor-store.ts:210
nodesTypeGraphNode[]-packages/visual-editor/src/store/editor-store.ts:173
nodesByIdMap<string, TypeGraphNode>Canonical id→node index — the edit SUBSTRATE (Phase 3B). nodes above is a derived render cache (invariant I1: nodes === [...nodesById.values()]). Every source-affecting action writes this Map through a chokepoint (mutateGraph/updateGraphView/loadModels); the post-undo store.subscribe re-derives the arrays from the Maps after history restore. Do NOT write the Maps ad-hoc from a new action — go through a chokepoint.packages/visual-editor/src/store/editor-store.ts:183
parseEpochnumberMonotonically-incrementing counter bumped ONLY when the graph is (re)built from a parse result — i.e. inside loadModels. (loadDeferredExports is a state-only stash that does NOT rebuild nodes, so it does not bump it.) User-edit actions deliberately do NOT bump it. useModelSourceSync reads this to tell PARSE-origin nodes/edges changes apart from USER-EDIT-origin ones: it only serializes the graph back to source text when parseEpoch did NOT advance since the last emission. Without this, a degraded reparse (worker unavailable → attributes stripped, empty errors) would re-serialize the truncated graph over the real source and corrupt the file. See loadModels' degraded-parse guard for the complementary protection (rejecting a parse that shrinks the live graph).packages/visual-editor/src/store/editor-store.ts:257
pendingEditPatchesPatchesId-rooted Mutative patches for user edits that have NOT yet round-tripped through a reparse. Captured by mutateGraph (semantic edit actions), replayed by loadModels on top of each healthy parse so an edit made just before its own reparse lands is not momentarily reverted, then pruned as the parse catches up. See edit-reconcile.ts for the pure replay logic. Deliberately excluded from the zundo partialize set ({nodes, edges}), so it is not part of undo history — patches track in-flight intent, not state.packages/visual-editor/src/store/editor-store.ts:268
pendingHydrationNamespacesstring[]Namespaces queued for server-side hydration. An App.tsx effect watches this list and re-parses with hydrateNamespaces set to the cumulative union of these + hydratedNamespaces so the worker receives the full closure. Cleared by markNamespacesHydrated once the parse completes.packages/visual-editor/src/store/editor-store.ts:228
pendingInversePatchesPatches-packages/visual-editor/src/store/editor-store.ts:269
searchQuerystring-packages/visual-editor/src/store/editor-store.ts:203
searchResultsstring[]-packages/visual-editor/src/store/editor-store.ts:204
selectedNodeIdstring | null-packages/visual-editor/src/store/editor-store.ts:200
selectionRekey?{ from: string; intermediateIds?: string[]; to: string; }Rename-only identity change from the last explicit selection, preserved across model refreshes.packages/visual-editor/src/store/editor-store.ts:202
selectionRekey.fromstring-packages/visual-editor/src/store/editor-store.ts:202
selectionRekey.intermediateIds?string[]-packages/visual-editor/src/store/editor-store.ts:202
selectionRekey.tostring-packages/visual-editor/src/store/editor-store.ts:202
validationErrorsValidationError[]-packages/visual-editor/src/store/editor-store.ts:207
visibilityVisibilityState-packages/visual-editor/src/store/editor-store.ts:219

Core packages released under MIT. Studio app released under FSL-1.1-ALv2.