Skip to content
D
Documentation

Models — types

reference
1 min readUpdated

Types

Import these from @grafloria/engine.

Types

GroupFitMode

Also has every member of String, listed on its own entry.

How {@link GroupModel.fitToContents} reconciles the freshly computed content rectangle with the group's current rectangle.

  • exact — snap to the content rectangle (default).
  • grow-only — never shrink below the current rectangle (union).
  • shrink-only— never grow beyond the current rectangle (intersection-ish).
ts
type GroupFitMode = 'exact' | 'grow-only' | 'shrink-only';

GroupPadding

Per-side padding (a scalar expands to all four sides).

ts
type GroupPadding =
  | number
  | { top?: number; right?: number; bottom?: number; left?: number };

Members

  • toString(radix?: number): string — Returns a string representation of an object.
  • valueOf(): number — Returns the primitive value of the specified object.
  • toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string — Converts a number to a string by using the current or specified locale.

LinkConnectorName

Also has every member of String, listed on its own entry.

ts
type LinkConnectorName =
  | 'straight'
  | 'rounded'
  | 'smooth'
  | 'bezier'
  | (string & {});

LinkRouterName

Also has every member of String, listed on its own entry.

. pathType conflated two independent choices: WHERE the line goes (routing geometry) and HOW the polyline is drawn (connector rendering). They are now two orthogonal, per-link, serializable settings, with pathType kept as the back-compat shorthand that derives both when the explicit fields are absent.

Router names resolve against the engine's RoutingEngine registry, so a custom registered router is addressable per link by its registration name.

ts
type LinkRouterName =
  | 'straight'
  | 'orthogonal'
  | 'manhattan'
  | 'avoid'
  | 'elk'
  | (string & {});

MembershipRule

A SERIALIZABLE declarative membership predicate over a node's data (never eval'd code). Leaves match one field with an operator; branches compose with all/any/not. Kept intentionally small and closed so it round- trips and can be reasoned about / edited as data.

ts
type MembershipRule =
  | MembershipLeaf
  | { all: MembershipRule[] }
  | { any: MembershipRule[] }
  | { not: MembershipRule };

MemberValidation

Predicate used to gate group membership. Return false to reject a candidate entity from joining the group.

ts
type MemberValidation = (candidateId: string, group: GroupModel) => boolean;

Parameters

  • candidateId: id of the node/group being added
  • group: the group the candidate would join

PositioningMode

Also has every member of String, listed on its own entry.

Positioning mode

  • absolute: Position relative to diagram origin (default, backward compatible)
  • relative: Position relative to parent
  • layout: Position managed by parent's layout algorithm (future)
ts
type PositioningMode = 'absolute' | 'relative' | 'layout';

Was this page helpful?

Models — types — Grafloria