@hlang-org/editor-react
React bindings of the Lumen editor for hlang: hooks that connect @hlang-org/editor-core to React Flow. Version 0.1.1, 35 exports.
Interfaces
ClipboardState
Defined in: packages/editor-react/src/hooks/useClipboard.ts:34
Methods
canPaste()
canPaste(): boolean;Defined in: packages/editor-react/src/hooks/useClipboard.ts:51
Whether the in-memory clipboard holds something to paste.
Returns
boolean
copy()
copy(): void;Defined in: packages/editor-react/src/hooks/useClipboard.ts:36
Copy the current selection into the clipboard (no graph change).
Returns
void
cut()
cut(): void;Defined in: packages/editor-react/src/hooks/useClipboard.ts:38
Copy the selection, then delete it as one undo step.
Returns
void
duplicate()
duplicate(): void;Defined in: packages/editor-react/src/hooks/useClipboard.ts:47
Clone the current selection in place (offset), selecting the clones.
Returns
void
paste()
paste(flowPos?): void;Defined in: packages/editor-react/src/hooks/useClipboard.ts:45
Paste the clipboard as fresh nodes, selecting them. If flowPos is given
(the canvas cursor in flow space), the pasted set is anchored there; else a
small fixed offset is used. Prefers the system clipboard (cross-document),
falling back to the in-memory copy. Async because it reads the OS clipboard.
Parameters
| Parameter | Type |
|---|---|
flowPos? | Point |
Returns
void
remove()
remove(): void;Defined in: packages/editor-react/src/hooks/useClipboard.ts:49
Delete the current selection as one undo step.
Returns
void
DiagnosticsState
Defined in: packages/editor-react/src/hooks/useDiagnostics.ts:11
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
all | readonly | readonly Diagnostic[] | packages/editor-react/src/hooks/useDiagnostics.ts:12 |
byNode | readonly | ReadonlyMap<string, readonly Diagnostic[]> | packages/editor-react/src/hooks/useDiagnostics.ts:13 |
Methods
worstOf()
worstOf(id): Diagnostic | undefined;Defined in: packages/editor-react/src/hooks/useDiagnostics.ts:15
The most severe diagnostic on a node (error > warning), or undefined.
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Diagnostic | undefined
EditorProviderProps
Defined in: packages/editor-react/src/context.tsx:15
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
children | readonly | ReactNode | packages/editor-react/src/context.tsx:17 |
core | readonly | EditorCore | packages/editor-react/src/context.tsx:16 |
GraphView
Defined in: packages/editor-react/src/hooks/useGraphSync.ts:17
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
edges | readonly | readonly HlangRFEdge[] | packages/editor-react/src/hooks/useGraphSync.ts:19 |
nodes | readonly | readonly HlangRFNode[] | packages/editor-react/src/hooks/useGraphSync.ts:18 |
HistoryState
Defined in: packages/editor-react/src/hooks/useHistory.ts:11
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
canRedo | readonly | boolean | packages/editor-react/src/hooks/useHistory.ts:13 |
canUndo | readonly | boolean | packages/editor-react/src/hooks/useHistory.ts:12 |
Methods
redo()
redo(): void;Defined in: packages/editor-react/src/hooks/useHistory.ts:15
Returns
void
undo()
undo(): void;Defined in: packages/editor-react/src/hooks/useHistory.ts:14
Returns
void
HlangEdgeData
Defined in: packages/editor-react/src/mapping/types.ts:28
Data payload attached to a React Flow edge. Carries the hlang port ids so a custom edge can distinguish, e.g., an error-port edge from a normal one.
Extends
Record<string,unknown>
Indexable
[key: string]: unknownProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
isError | readonly | boolean | Whether the source port is the @node/error port. | packages/editor-react/src/mapping/types.ts:32 |
sourcePortId | readonly | string | - | packages/editor-react/src/mapping/types.ts:29 |
stream | readonly | "live" | "value" | The source port's stream mode ('live' default | 'value'), for edge visuals. | packages/editor-react/src/mapping/types.ts:34 |
targetPortId | readonly | string | - | packages/editor-react/src/mapping/types.ts:30 |
HlangFlowProps
Defined in: packages/editor-react/src/hooks/useHlangFlow.ts:40
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
edges | readonly | HlangRFEdge[] | - | packages/editor-react/src/hooks/useHlangFlow.ts:42 |
isValidConnection | readonly | IsValidConnection | - | packages/editor-react/src/hooks/useHlangFlow.ts:46 |
nodes | readonly | HlangRFNode[] | - | packages/editor-react/src/hooks/useHlangFlow.ts:41 |
onConnect | readonly | (connection) => void | - | packages/editor-react/src/hooks/useHlangFlow.ts:45 |
onEdgesChange | readonly | (changes) => void | - | packages/editor-react/src/hooks/useHlangFlow.ts:44 |
onNodesChange | readonly | (changes) => void | - | packages/editor-react/src/hooks/useHlangFlow.ts:43 |
resync | readonly | () => void | Force a full re-derivation from the core. The event-driven reconcile only fires on structural events; a BULK load (model.restore importing a whole IGraph) emits none, so the host calls this once after importing a graph. | packages/editor-react/src/hooks/useHlangFlow.ts:52 |
HlangNodeData
Defined in: packages/editor-react/src/mapping/types.ts:20
Data payload attached to a React Flow node. Carries the full EditorNode
so custom node components can render ports, params, kind, etc. The index
signature satisfies React Flow's Record<string, unknown> data constraint
while keeping our own field strongly typed.
Extends
Record<string,unknown>
Indexable
[key: string]: unknownProperties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
editorNode | readonly | EditorNode | packages/editor-react/src/mapping/types.ts:21 |
NodeBox
Defined in: packages/editor-react/src/hooks/useReconnect.ts:26
A node's live geometry (flow space) supplied by the host for hit-testing.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
height | readonly | number | - | packages/editor-react/src/hooks/useReconnect.ts:31 |
position | readonly | Point | Top-left in flow coords (React Flow's absolute position). | packages/editor-react/src/hooks/useReconnect.ts:28 |
width | readonly | number | Measured size in flow units; used to derive the centre + hit tolerance. | packages/editor-react/src/hooks/useReconnect.ts:30 |
NodeViewState
Defined in: packages/editor-react/src/mapping/convert.ts:19
Per-node view flags reflected into React Flow (from editor-core's view-state).
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
hidden | readonly | boolean | - | packages/editor-react/src/mapping/convert.ts:20 |
locked | readonly | boolean | - | packages/editor-react/src/mapping/convert.ts:21 |
selected? | readonly | boolean | Whether the node is selected in editor-core's selection service. | packages/editor-react/src/mapping/convert.ts:23 |
ReconnectHandle
Defined in: packages/editor-react/src/hooks/useReconnect.ts:34
Methods
hitTestEdge()
hitTestEdge(nodeId, box): string | undefined;Defined in: packages/editor-react/src/hooks/useReconnect.ts:43
Given a dragged node's live box, find the nearest edge its centre lands on (within a tolerance derived from the node's own size), or undefined. This owns the geometry (edge iteration + point-to-segment distance) so hosts don't re-implement it. Edges incident to the node itself are ignored.
Parameters
| Parameter | Type |
|---|---|
nodeId | string |
box | NodeBox |
Returns
string | undefined
insertOnEdge()
insertOnEdge(
nodeId,
edgeId,
at?
): boolean;Defined in: packages/editor-react/src/hooks/useReconnect.ts:48
Splice nodeId onto edgeId (drop-on-edge insert). Returns true if a legal
splice happened. Optionally snaps the node to at (e.g. the edge midpoint).
Parameters
| Parameter | Type |
|---|---|
nodeId | string |
edgeId | string |
at? | Point |
Returns
boolean
onReconnect()
onReconnect(oldEdge, connection): void;Defined in: packages/editor-react/src/hooks/useReconnect.ts:36
RF onReconnect: move an edge's endpoint to a new port (one undo step).
Parameters
| Parameter | Type |
|---|---|
oldEdge | HlangRFEdge |
connection | Connection |
Returns
void
RenameHandle
Defined in: packages/editor-react/src/hooks/useRename.ts:10
Methods
rename()
rename(id, name): void;Defined in: packages/editor-react/src/hooks/useRename.ts:11
Parameters
| Parameter | Type |
|---|---|
id | string |
name | string |
Returns
void
SelectionState
Defined in: packages/editor-react/src/hooks/useSelection.ts:14
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
selectedEdges | readonly | readonly string[] | packages/editor-react/src/hooks/useSelection.ts:16 |
selectedNodes | readonly | readonly string[] | packages/editor-react/src/hooks/useSelection.ts:15 |
Methods
clear()
clear(): void;Defined in: packages/editor-react/src/hooks/useSelection.ts:20
Returns
void
isSelected()
isSelected(id): boolean;Defined in: packages/editor-react/src/hooks/useSelection.ts:17
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
boolean
selectEdges()
selectEdges(ids, mode): void;Defined in: packages/editor-react/src/hooks/useSelection.ts:19
Parameters
| Parameter | Type |
|---|---|
ids | readonly string[] |
mode | SelectionMode |
Returns
void
selectNodes()
selectNodes(ids, mode): void;Defined in: packages/editor-react/src/hooks/useSelection.ts:18
Parameters
| Parameter | Type |
|---|---|
ids | readonly string[] |
mode | SelectionMode |
Returns
void
ViewStateState
Defined in: packages/editor-react/src/hooks/useViewState.ts:14
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
hiddenNodes | readonly | readonly string[] | packages/editor-react/src/hooks/useViewState.ts:15 |
lockedNodes | readonly | readonly string[] | packages/editor-react/src/hooks/useViewState.ts:16 |
Methods
clear()
clear(): void;Defined in: packages/editor-react/src/hooks/useViewState.ts:23
Returns
void
isHidden()
isHidden(id): boolean;Defined in: packages/editor-react/src/hooks/useViewState.ts:17
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
boolean
isLocked()
isLocked(id): boolean;Defined in: packages/editor-react/src/hooks/useViewState.ts:18
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
boolean
setHidden()
setHidden(id, hidden): void;Defined in: packages/editor-react/src/hooks/useViewState.ts:19
Parameters
| Parameter | Type |
|---|---|
id | string |
hidden | boolean |
Returns
void
setLocked()
setLocked(id, locked): void;Defined in: packages/editor-react/src/hooks/useViewState.ts:20
Parameters
| Parameter | Type |
|---|---|
id | string |
locked | boolean |
Returns
void
toggleHidden()
toggleHidden(id): void;Defined in: packages/editor-react/src/hooks/useViewState.ts:21
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void
toggleLocked()
toggleLocked(id): void;Defined in: packages/editor-react/src/hooks/useViewState.ts:22
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void
Type Aliases
HlangRFEdge
type HlangRFEdge = RFEdge<HlangEdgeData>;Defined in: packages/editor-react/src/mapping/types.ts:41
A React Flow edge specialized to hlang.
HlangRFNode
type HlangRFNode = RFNode<HlangNodeData, NodeKind>;Defined in: packages/editor-react/src/mapping/types.ts:38
A React Flow node specialized to hlang. type is the node kind (R/T/W).
Functions
EditorProvider()
function EditorProvider(__namedParameters): ReactElement;Defined in: packages/editor-react/src/context.tsx:20
@hlang-org/editor-react
React bindings for the hlang visual editor. Hooks and context that connect a
headless @hlang-org/editor-core to React Flow (@xyflow/react). This is the
ONLY layer that imports React Flow — the core stays framework-agnostic, and
design-system styling lives in @hlang-org/editor-ui, not here.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | EditorProviderProps |
Returns
ReactElement
endpointsFromConnection()
function endpointsFromConnection(connection):
| {
source: Endpoint;
target: Endpoint;
}
| undefined;Defined in: packages/editor-react/src/mapping/convert.ts:71
Extract the source (O) and target (I) endpoints from a React Flow
connection. Returns undefined when either handle is missing — hlang always
wires named ports, so a connection without handles cannot be represented.
Parameters
| Parameter | Type |
|---|---|
connection | Connection |
Returns
| {
source: Endpoint;
target: Endpoint;
}
| undefined
findPort()
function findPort(node, portId): PortDescriptor | undefined;Defined in: packages/editor-react/src/mapping/types.ts:44
Look up a port descriptor on an editor node by id.
Parameters
| Parameter | Type |
|---|---|
node | EditorNode |
portId | string |
Returns
PortDescriptor | undefined
toRFEdge()
function toRFEdge(edge, sourceNode): HlangRFEdge;Defined in: packages/editor-react/src/mapping/convert.ts:48
Convert an editor edge to a React Flow edge, preserving O->I direction.
Parameters
| Parameter | Type |
|---|---|
edge | EditorEdge |
sourceNode | EditorNode | undefined |
Returns
toRFNode()
function toRFNode(node, view?): HlangRFNode;Defined in: packages/editor-react/src/mapping/convert.ts:33
Convert an editor node to a React Flow node. Optional view flags map to
React Flow's native hidden (removed from the rendered canvas), selected
(so programmatic selection like ⌘A reflects on the canvas), and, when locked,
draggable/selectable: false (pinned). Kept pure — callers supply the flags
from core.viewState/core.selection, so this stays trivially testable.
Parameters
| Parameter | Type |
|---|---|
node | EditorNode |
view? | NodeViewState |
Returns
useClipboard()
function useClipboard(core): ClipboardState;Defined in: packages/editor-react/src/hooks/useClipboard.ts:132
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
useConnect()
function useConnect(core): (connection) => void;Defined in: packages/editor-react/src/hooks/useConnect.ts:37
Returns an onConnect handler that commits a validated ConnectCommand.
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
(connection) => void
useDiagnostics()
function useDiagnostics(core): DiagnosticsState;Defined in: packages/editor-react/src/hooks/useDiagnostics.ts:20
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
useEdgeChanges()
function useEdgeChanges(core): (changes) => void;Defined in: packages/editor-react/src/hooks/useChanges.ts:52
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
(changes) => void
useEditor()
function useEditor(): EditorCore;Defined in: packages/editor-react/src/context.tsx:25
Access the EditorCore from context. Throws if used outside a provider.
Returns
EditorCore
useGraphSync()
function useGraphSync(core): GraphView;Defined in: packages/editor-react/src/hooks/useGraphSync.ts:23
Subscribe to model changes and return the current React Flow view.
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
useHistory()
function useHistory(core): HistoryState;Defined in: packages/editor-react/src/hooks/useHistory.ts:18
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
useHlangFlow()
function useHlangFlow(core): HlangFlowProps;Defined in: packages/editor-react/src/hooks/useHlangFlow.ts:70
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
useIsValidConnection()
function useIsValidConnection(core): IsValidConnection;Defined in: packages/editor-react/src/hooks/useConnect.ts:18
Returns an isValidConnection predicate backed by the core validator.
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
IsValidConnection
useNodeChanges()
function useNodeChanges(core): (changes) => void;Defined in: packages/editor-react/src/hooks/useChanges.ts:24
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
(changes) => void
useReconnect()
function useReconnect(core): ReconnectHandle;Defined in: packages/editor-react/src/hooks/useReconnect.ts:51
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
useRename()
function useRename(core): RenameHandle;Defined in: packages/editor-react/src/hooks/useRename.ts:14
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
useSelection()
function useSelection(core): SelectionState;Defined in: packages/editor-react/src/hooks/useSelection.ts:23
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
useViewState()
function useViewState(core): ViewStateState;Defined in: packages/editor-react/src/hooks/useViewState.ts:26
Parameters
| Parameter | Type |
|---|---|
core | EditorCore |
Returns
Generated by TypeDoc from packages/editor-react/src at build time.