Import it from @grafloria/renderer.
The contribution surface. Obtained from a diagram as diagram.registry, or as
{@link GLOBAL_DIAGRAM_REGISTRY} for the process-wide one.
tsclass DiagramRegistry
Methods
constructor(private readonly scope: RegistryScope | null = null)get isScoped(): boolean— True when writes here are private to one diagram.registerShape( type: string, definition: Omit<ShapeDefinition, 'type'> & { type?: string } ): DisposerregisterPathShape(type: string, path: PathGeometry, options?: PathShapeOptions): DisposerunregisterShape(type: string): booleanhasShape(type: string): booleanlistShapes(): string[]getShapeDefinition(type: string): ShapeDefinition | undefineddefineStyle(name: string, style: NamedStyle): DisposerdefineStyles(styles: Record<string, NamedStyle>): DisposerremoveStyle(name: string): booleanclearStyles(): void— Drop THIS diagram's named styles. The process-global ones are untouched and become visible again — which is what makes this safe to call from a teardown that has no idea what else is on the page.getStyle(name: string): NamedStyle | undefinedhasStyle(name: string): booleanlistStyles(): string[]registerLinkTemplate(name: string, template: LinkTemplate): DisposerregisterLabelTemplate(name: string, template: LabelTemplate): DisposerregisterMarker(name: string, definition: MarkerDefinition): DisposergetLinkTemplate(name: string): LinkTemplate | undefinedgetLabelTemplate(name: string): LabelTemplate | undefinedgetMarker(name: string): MarkerDefinition | undefinedhasMarker(name: string): booleanlistLinkTemplates(): string[]listLabelTemplates(): string[]listMarkers(): string[]registerAnchor(name: string, anchor: AnchorFn): DisposerregisterConnectionPoint(name: string, strategy: ConnectionPointFn): DisposerregisterConnector(name: string, connector: ConnectorFn): DisposerlistAnchors(): string[]listConnectionPoints(): string[]listConnectors(): string[]get animations(): CustomAnimationRegistry— This diagram's own {@link CustomAnimationRegistry}, or the process-global singleton when unscoped.
Lazy: the constructor appends a <style> element to the document, so a
diagram that never contributes an animation must not pay for one.
dispose(): void— Drop every contribution this diagram made. No-op on the global registry.
Was this page helpful?