Skip to content

pivotick v3.0.0


pivotick / GraphUI / RailModeDefinition

Interface: RailModeDefinition ​

Defined in: interfaces/GraphUI.ts:440

A mode registered onto the mode rail — the door an integrator builds their own Explore or Enrich mode through.

Registered modes render below a divider, after the four built-in modes, ordered by order. Register one at any point in the graph's life with graph.UIManager.addRailMode(), or from a plugin's install via ctx.addRailMode(). Either returns a disposer.

A 'pointer' mode owns the contextual tool panel: it declares tools, and may add anything else through render. A 'flyout' mode instead supplies a flyout factory whose panel opens while the mode is active.

Example ​

js
const dispose = graph.UIManager.addRailMode({
    id: 'explore', label: 'Explore', icon: compassSvg, shortcut: 'E',
    tools: [{ id: 'expand', label: 'Expand', icon: plusSvg, kind: 'action', run: () => … }],
})

Properties ​

defaultTool? ​

optional defaultTool: string | null

Defined in: interfaces/GraphUI.ts:469

The tool this mode rests on when nothing is armed.

Default ​

ts
null

flyout()? ​

optional flyout: (ui) => Flyout

Defined in: interfaces/GraphUI.ts:515

Builds this mode's flyout panel. Required for kind: 'flyout' and ignored otherwise. The panel is mounted into the flyout slot and torn down with the mode; the subclass's own mode must equal this definition's id.

Parameters ​

ui ​

UIManager

Returns ​

Flyout


icon ​

icon: string

Defined in: interfaces/GraphUI.ts:449

An SVG string, injected with innerHTML and not sanitised — it must be trusted. CSS sizes it to 20px on the rail.


id ​

id: string

Defined in: interfaces/GraphUI.ts:442

Stable identity: what the store holds, and the data-mode on the rail button.


keepPanelOpen? ​

optional keepPanelOpen: boolean

Defined in: interfaces/GraphUI.ts:499

Keep the panel open when one of this mode's tools is armed. Arming normally collapses the panel so the canvas is clear — right for Select's Lasso, wrong for a mode whose panel is the workspace and whose tools only say how to feed it.

Default ​

ts
false

kind? ​

optional kind: "pointer" | "flyout"

Defined in: interfaces/GraphUI.ts:455

'pointer' modes own the tool panel; 'flyout' modes open a settings overlay and have no tools.

Default ​

ts
'pointer'

label ​

label: string

Defined in: interfaces/GraphUI.ts:444

The rail button's label, used verbatim.


onEnter()? ​

optional onEnter: () => void

Defined in: interfaces/GraphUI.ts:517

Called when the mode becomes active.

Returns ​

void


onExit()? ​

optional onExit: () => void

Defined in: interfaces/GraphUI.ts:523

Called when the mode is left, and when it is unregistered while active. Disarm whatever the mode armed here. Not called on UI teardown — use the disposers your plugin already tracks for that.

Returns ​

void


order? ​

optional order: number

Defined in: interfaces/GraphUI.ts:467

Display order among registered modes, ascending. Equal orders keep registration order. Does not affect the built-in modes, which always come first.

Default ​

ts
0

panelOpen? ​

optional panelOpen: boolean

Defined in: interfaces/GraphUI.ts:475

Whether the tool panel is expanded the first time the mode is entered. Defaults to open so the mode's tools are discoverable.

Default ​

ts
true

panelResizable? ​

optional panelResizable: boolean

Defined in: interfaces/GraphUI.ts:492

Let the analyst drag this mode's panel wider or narrower by its right edge.

Off by default: a panel of icon rows has one right width, and a handle on it is a control with nothing to do. A mode whose panel is the workspace — a form, a list, a set of results — is where the choice is worth offering. The width is remembered per mode for the session and is not persisted, so a reload starts from panelWidth again.

Default ​

ts
false

panelWidth? ​

optional panelWidth: number

Defined in: interfaces/GraphUI.ts:481

How wide this mode's tool panel is, in pixels. The built-in width fits a row of icon + label; a mode whose render slot holds a form or a list needs more.

Default ​

ts
216

render()? ​

optional render: () => HTMLElement

Defined in: interfaces/GraphUI.ts:509

Extra panel content, appended below the tool rows — a slider, a search box, anything the rows cannot express. Re-invoked whenever the panel is rebuilt.

Returns ​

HTMLElement


shortcut? ​

optional shortcut: string

Defined in: interfaces/GraphUI.ts:461

A single key that activates the mode, or toggles its panel when it is already active. Registered through the normal keybinding manager, so a key already bound is shadowed (with a warning) until this mode is removed.


tools? ​

optional tools: RailTool[] | () => RailTool[]

Defined in: interfaces/GraphUI.ts:504

The mode's tools, as rows in its panel. Pass a function when the set depends on the current selection or data; it is re-read on every render.