# DiagramRegistry

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.

```ts
class 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 } ): Disposer`
- `registerPathShape(type: string, path: PathGeometry, options?: PathShapeOptions): Disposer`
- `unregisterShape(type: string): boolean`
- `hasShape(type: string): boolean`
- `listShapes(): string[]`
- `getShapeDefinition(type: string): ShapeDefinition | undefined`
- `defineStyle(name: string, style: NamedStyle): Disposer`
- `defineStyles(styles: Record<string, NamedStyle>): Disposer`
- `removeStyle(name: string): boolean`
- `clearStyles(): 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 | undefined`
- `hasStyle(name: string): boolean`
- `listStyles(): string[]`
- `registerLinkTemplate(name: string, template: LinkTemplate): Disposer`
- `registerLabelTemplate(name: string, template: LabelTemplate): Disposer`
- `registerMarker(name: string, definition: MarkerDefinition): Disposer`
- `getLinkTemplate(name: string): LinkTemplate | undefined`
- `getLabelTemplate(name: string): LabelTemplate | undefined`
- `getMarker(name: string): MarkerDefinition | undefined`
- `hasMarker(name: string): boolean`
- `listLinkTemplates(): string[]`
- `listLabelTemplates(): string[]`
- `listMarkers(): string[]`
- `registerAnchor(name: string, anchor: AnchorFn): Disposer`
- `registerConnectionPoint(name: string, strategy: ConnectionPointFn): Disposer`
- `registerConnector(name: string, connector: ConnectorFn): Disposer`
- `listAnchors(): 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.
