index.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930
  1. import { Point } from '@antv/x6-geometry';
  2. import { KeyValue } from '@antv/x6-common';
  3. import { Registry } from '../registry';
  4. import { Edge } from '../../model/edge';
  5. import { EdgeView } from '../../view';
  6. import * as anchors from './main';
  7. export declare namespace EdgeAnchor {
  8. type Definition<T> = (this: EdgeView, view: EdgeView, magnet: SVGElement, ref: Point | Point.PointLike | SVGElement, options: T, type: Edge.TerminalType) => Point;
  9. type CommonDefinition = Definition<KeyValue>;
  10. type ResolvedDefinition<T> = (this: EdgeView, view: EdgeView, magnet: SVGElement, refPoint: Point, options: T) => Point;
  11. }
  12. export declare namespace EdgeAnchor {
  13. type Presets = (typeof EdgeAnchor)['presets'];
  14. type OptionsMap = {
  15. readonly [K in keyof Presets]-?: Parameters<Presets[K]>[3];
  16. };
  17. type NativeNames = keyof Presets;
  18. interface NativeItem<T extends NativeNames = NativeNames> {
  19. name: T;
  20. args?: OptionsMap[T];
  21. }
  22. interface ManaualItem {
  23. name: Exclude<string, NativeNames>;
  24. args?: KeyValue;
  25. }
  26. }
  27. export declare namespace EdgeAnchor {
  28. const presets: typeof anchors;
  29. const registry: Registry<CommonDefinition, typeof anchors, never>;
  30. }