Skip to content

Commit

Permalink
WIP: check-in types (generated with typescript@5.7.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Jan 10, 2025
1 parent 231b51c commit 74986ce
Show file tree
Hide file tree
Showing 182 changed files with 772 additions and 566 deletions.
10 changes: 5 additions & 5 deletions lib/Diagram.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ export default class Diagram<ServiceMap = null> {
clear(): void;
}

type InjectionContext = import('didi').InjectionContext;
type LocalsMap = import('didi').LocalsMap;
type ModuleDeclaration = import('didi').ModuleDeclaration;
type InjectionContext = import("didi").InjectionContext;
type LocalsMap = import("didi").LocalsMap;
type ModuleDeclaration = import("didi").ModuleDeclaration;

export type DiagramOptions = {
modules?: ModuleDeclaration[];
} & Record<string, any>;

type FactoryFunction<T> = import('didi').FactoryFunction<T>;
type ArrayFunc<T> = import('didi').ArrayFunc<T>;
type FactoryFunction<T> = import("didi").FactoryFunction<T>;
type ArrayFunc<T> = import("didi").ArrayFunc<T>;
import { Injector } from 'didi';
6 changes: 3 additions & 3 deletions lib/command/CommandInterceptor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,9 @@ export default class CommandInterceptor {
): void;
}

type ElementLike = import('../core/Types').ElementLike;
type EventBus = import('../core/EventBus').default;
type CommandContext = import('./CommandStack').CommandContext;
type ElementLike = import("../core/Types").ElementLike;
type EventBus = import("../core/EventBus").default;
type CommandContext = import("./CommandStack").CommandContext;
export type Events = string | string[];
export type HandlerFunction = (context: CommandContext) => ElementLike[] | void;
export type ComposeHandlerFunction = (context: CommandContext) => void;
17 changes: 10 additions & 7 deletions lib/command/CommandStack.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,18 @@ export default class CommandStack {
canRedo(): boolean;
}

type Injector = import('didi').Injector;
type ElementLike = import('../core/Types').ElementLike;
type EventBus = import('../core/EventBus').default;
type CommandHandler = import('./CommandHandler').default;
type Injector = import("didi").Injector;
type ElementLike = import("../core/Types").ElementLike;
type EventBus = import("../core/EventBus").default;
type CommandHandler = import("./CommandHandler").default;
export type CommandContext = any;
export type CommandHandlerConstructor = new (...args: any[]) => CommandHandler;

export type CommandHandlerConstructor = {
new (...args: any[]): CommandHandler;
};

export type CommandHandlerMap = {
[key: string]: import("./CommandHandler").default;
[key: string]: CommandHandler;
};

export type CommandStackAction = {
Expand All @@ -176,6 +179,6 @@ export type CommandStackAction = {
export type CurrentExecution = {
actions: CommandStackAction[];
dirty: ElementLike[];
trigger: 'execute' | 'undo' | 'redo' | 'clear' | null;
trigger: "execute" | "undo" | "redo" | "clear" | null;
atomic?: boolean;
};
5 changes: 4 additions & 1 deletion lib/command/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
declare const _default: import('didi').ModuleDeclaration;
declare const _default: {
commandStack: (string | typeof CommandStack)[];
};
export default _default;
import CommandStack from './CommandStack';
26 changes: 13 additions & 13 deletions lib/core/Canvas.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export default class Canvas {
*
* @return The set zoom level.
*/
zoom(newScale?: number | 'fit-viewport', center?: Point): number;
zoom(newScale?: number | "fit-viewport", center?: Point): number;

/**
* Returns the size of the canvas.
Expand All @@ -362,10 +362,10 @@ export default class Canvas {
resized(): void;
}

type ConnectionLike = import('./Types').ConnectionLike;
type RootLike = import('./Types').RootLike;
type ParentLike = import('./Types').ParentLike;
type ShapeLike = import('./Types').ShapeLike;
type ConnectionLike = import("./Types").ConnectionLike;
type RootLike = import("./Types").RootLike;
type ParentLike = import("./Types").ParentLike;
type ShapeLike = import("./Types").ShapeLike;

export type CanvasConfig = {
container?: HTMLElement;
Expand Down Expand Up @@ -396,11 +396,11 @@ export type CanvasViewbox = {
outer: Dimensions;
} & Rect;

type ElementRegistry = import('./ElementRegistry').default;
type EventBus = import('./EventBus').default;
type GraphicsFactory = import('./GraphicsFactory').default;
type Dimensions = import('../util/Types').Dimensions;
type Point = import('../util/Types').Point;
type Rect = import('../util/Types').Rect;
type RectTRBL = import('../util/Types').RectTRBL;
type ScrollDelta = import('../util/Types').ScrollDelta;
type ElementRegistry = import("./ElementRegistry").default;
type EventBus = import("./EventBus").default;
type GraphicsFactory = import("./GraphicsFactory").default;
type Dimensions = import("../util/Types").Dimensions;
type Point = import("../util/Types").Point;
type Rect = import("../util/Types").Rect;
type RectTRBL = import("../util/Types").RectTRBL;
type ScrollDelta = import("../util/Types").ScrollDelta;
12 changes: 6 additions & 6 deletions lib/core/ElementFactory.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* A factory for model elements.
*
*/
export default class ElementFactory<T extends import("../model/Types").Connection = import("../model/Types").Connection, U extends import("../model/Types").Label = import("../model/Types").Label, V extends import("../model/Types").Root = import("../model/Types").Root, W extends import("../model/Types").Shape = import("../model/Types").Shape> {
export default class ElementFactory<T extends Connection = import("../model/Types").Connection, U extends Label = import("../model/Types").Label, V extends Root = import("../model/Types").Root, W extends Shape = import("../model/Types").Shape> {
/**
* Create a root element.
*
Expand Down Expand Up @@ -76,8 +76,8 @@ export default class ElementFactory<T extends import("../model/Types").Connectio
create(type: 'root', attrs?: Partial<Root>): V;
}

type Element = import('../model/Types').Element;
type Connection = import('../model/Types').Connection;
type Label = import('../model/Types').Label;
type Root = import('../model/Types').Root;
type Shape = import('../model/Types').Shape;
type Element = import("../model/Types").Element;
type Connection = import("../model/Types").Connection;
type Label = import("../model/Types").Label;
type Root = import("../model/Types").Root;
type Shape = import("../model/Types").Shape;
4 changes: 2 additions & 2 deletions lib/core/ElementRegistry.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default class ElementRegistry {
getGraphics(filter: ElementLike | string, secondary?: boolean): SVGElement;
}

type ElementLike = import('./Types').ElementLike;
type EventBus = import('./EventBus').default;
type ElementLike = import("./Types").ElementLike;
type EventBus = import("./EventBus").default;
export type ElementRegistryFilterCallback = (element: ElementLike, gfx: SVGElement) => boolean | any;
export type ElementRegistryForEachCallback = (element: ElementLike, gfx: SVGElement) => any;
4 changes: 2 additions & 2 deletions lib/core/EventBus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export default class EventBus<EventMap = null> {
* @param events
* @param callback
*/
off(events: string | string[], callback?: any): void;
off(events: string | string[], callback?: EventBusEventCallback): void;

Check failure on line 246 in lib/core/EventBus.d.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Generic type 'EventBusEventCallback' requires 1 type argument(s).

/**
* Create an event recognized be the event bus.
Expand Down Expand Up @@ -394,7 +394,7 @@ export type Event = {
defaultPrevented: boolean;
returnValue: any;
};
export type EventBusEventCallback<E> = (event: E & Event, ...any: any[]) => any;
export type EventBusEventCallback<E> = (event: E & Event, ...any: any) => any;
export type EventBusListener = {
priority: number;
next: EventBusListener | null;
Expand Down
14 changes: 7 additions & 7 deletions lib/core/GraphicsFactory.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class GraphicsFactory {
*
* @return The graphical element.
*/
create(type: 'shape' | 'connection' | 'label' | 'root', element: ElementLike, parentIndex?: number): SVGElement;
create(type: "shape" | "connection" | "label" | "root", element: ElementLike, parentIndex?: number): SVGElement;

/**
* Update the containments of the given elements.
Expand Down Expand Up @@ -76,7 +76,7 @@ export default class GraphicsFactory {
* @param element
* @param gfx
*/
update(type: 'shape' | 'connection', element: ElementLike, gfx: SVGElement): void;
update(type: "shape" | "connection", element: ElementLike, gfx: SVGElement): void;

/**
* Remove a graphical element.
Expand All @@ -86,8 +86,8 @@ export default class GraphicsFactory {
remove(element: ElementLike): void;
}

type ConnectionLike = import('./Types').ConnectionLike;
type ElementLike = import('./Types').ElementLike;
type ShapeLike = import('./Types').ShapeLike;
type ElementRegistry = import('./ElementRegistry').default;
type EventBus = import('./EventBus').default;
type ConnectionLike = import("./Types").ConnectionLike;
type ElementLike = import("./Types").ElementLike;
type ShapeLike = import("./Types").ShapeLike;
type ElementRegistry = import("./ElementRegistry").default;
type EventBus = import("./EventBus").default;
13 changes: 12 additions & 1 deletion lib/core/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
declare const _default: import('didi').ModuleDeclaration;
declare const _default: {
canvas: (string | typeof Canvas)[];
elementRegistry: (string | typeof ElementRegistry)[];
elementFactory: (string | typeof ElementFactory)[];
eventBus: (string | typeof EventBus)[];
graphicsFactory: (string | typeof GraphicsFactory)[];
};
export default _default;
import Canvas from './Canvas';
import ElementRegistry from './ElementRegistry';
import ElementFactory from './ElementFactory';
import EventBus from './EventBus';
import GraphicsFactory from './GraphicsFactory';
8 changes: 4 additions & 4 deletions lib/draw/BaseRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class BaseRenderer {
getConnectionPath(connection: Connection): string;
}

type Element = import('../core/Types').ElementLike;
type Connection = import('../core/Types').ConnectionLike;
type Shape = import('../core/Types').ShapeLike;
type EventBus = import('../core/EventBus').default;
type Element = import("../core/Types").ElementLike;
type Connection = import("../core/Types").ConnectionLike;
type Shape = import("../core/Types").ShapeLike;
type EventBus = import("../core/EventBus").default;
4 changes: 2 additions & 2 deletions lib/draw/DefaultRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export default class DefaultRenderer extends BaseRenderer {
FRAME_STYLE: any;
}

type EventBus = import('../core/EventBus').default;
type Styles = import('./Styles').default;
type EventBus = import("../core/EventBus").default;
type Styles = import("./Styles").default;
import BaseRenderer from './BaseRenderer';
7 changes: 6 additions & 1 deletion lib/draw/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
declare const _default: import('didi').ModuleDeclaration;
declare const _default: {
defaultRenderer: (string | typeof DefaultRenderer)[];
styles: (string | typeof Styles)[];
};
export default _default;
import DefaultRenderer from './DefaultRenderer';
import Styles from './Styles';
12 changes: 6 additions & 6 deletions lib/features/align-elements/AlignElements.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export default class AlignElements {
trigger(elements: Element[], type: Alignment): void;
}

type Element = import('../../model/Types').Element;
type Modeling = import('../modeling/Modeling').default;
type Rules = import('../rules/Rules').default;
type Axis = import('../../util/Types').Axis;
type Dimension = import('../../util/Types').Dimension;
export type Alignment = 'top' | 'right' | 'bottom' | 'left' | 'center' | 'middle';
type Element = import("../../model/Types").Element;
type Modeling = import("../modeling/Modeling").default;
type Rules = import("../rules/Rules").default;
type Axis = import("../../util/Types").Axis;
type Dimension = import("../../util/Types").Dimension;
export type Alignment = "top" | "right" | "bottom" | "left" | "center" | "middle";
5 changes: 4 additions & 1 deletion lib/features/align-elements/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
declare const _default: import('didi').ModuleDeclaration;
declare const _default: {
alignElements: (string | typeof AlignElements)[];
};
export default _default;
import AlignElements from './AlignElements';
12 changes: 6 additions & 6 deletions lib/features/attach-support/AttachSupport.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export default class AttachSupport extends CommandInterceptor {
constructor(injector: Injector, eventBus: EventBus, canvas: Canvas, rules: Rules, modeling: Modeling);
}

type Injector = import('didi').Injector;
type Element = import('../../model/Types').Element;
type Canvas = import('../../core/Canvas').default;
type EventBus = import('../../core/EventBus').default;
type Rules = import('../rules/Rules').default;
type Modeling = import('../modeling/Modeling').default;
type Injector = import("didi").Injector;
type Element = import("../../model/Types").Element;
type Canvas = import("../../core/Canvas").default;
type EventBus = import("../../core/EventBus").default;
type Rules = import("../rules/Rules").default;
type Modeling = import("../modeling/Modeling").default;
import CommandInterceptor from '../../command/CommandInterceptor';
5 changes: 4 additions & 1 deletion lib/features/attach-support/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
declare const _default: import('didi').ModuleDeclaration;
declare const _default: {
attachSupport: (string | typeof AttachSupport)[];
};
export default _default;
import AttachSupport from './AttachSupport';
10 changes: 5 additions & 5 deletions lib/features/auto-place/AutoPlace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default class AutoPlace {
append: (source: Shape, shape: Shape, hints?: any) => Shape;
}

type Shape = import('../../core/Types').ShapeLike;
type Point = import('../../util/Types').Point;
type Canvas = import('../../core/Canvas').default;
type EventBus = import('../../core/EventBus').default;
type Modeling = import('../modeling/Modeling').default;
type Shape = import("../../core/Types").ShapeLike;
type Point = import("../../util/Types").Point;
type Canvas = import("../../core/Canvas").default;
type EventBus = import("../../core/EventBus").default;
type Modeling = import("../modeling/Modeling").default;
4 changes: 2 additions & 2 deletions lib/features/auto-place/AutoPlaceSelectionBehavior.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default class AutoPlaceSelectionBehavior {
constructor(eventBus: EventBus, selection: Selection);
}

type EventBus = import('../../core/EventBus').default;
type Selection = import('../selection/Selection').default;
type EventBus = import("../../core/EventBus").default;
type Selection = import("../selection/Selection").default;
10 changes: 5 additions & 5 deletions lib/features/auto-place/AutoPlaceUtil.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export function getConnectedDistance(source: Shape, hints?: {
filter?: (connection: Connection) => boolean;
getWeight?: (connection: Connection) => number;
maxDistance?: number;
reference?: 'start' | 'center' | 'end';
reference?: "start" | "center" | "end";
}): number;

export const DEFAULT_DISTANCE: number;
type Connection = import('../../model/Types').Connection;
type Element = import('../../model/Types').Element;
type Shape = import('../../model/Types').Shape;
type Point = import('../../util/Types').Point;
type Connection = import("../../model/Types").Connection;
type Element = import("../../model/Types").Element;
type Shape = import("../../model/Types").Shape;
type Point = import("../../util/Types").Point;
7 changes: 6 additions & 1 deletion lib/features/auto-place/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
declare const _default: import('didi').ModuleDeclaration;
declare const _default: {
autoPlace: (string | typeof AutoPlace)[];
autoPlaceSelectionBehavior: (string | typeof AutoPlaceSelectionBehavior)[];
};
export default _default;
import AutoPlace from './AutoPlace';
import AutoPlaceSelectionBehavior from './AutoPlaceSelectionBehavior';
18 changes: 9 additions & 9 deletions lib/features/auto-resize/AutoResize.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export default class AutoResize extends CommandInterceptor {
}): void;
}

type Element = import('../../model/Types').Element;
type Shape = import('../../model/Types').Shape;
type Direction = import('../../util/Types').Direction;
type Rect = import('../../util/Types').Rect;
type RectTRBL = import('../../util/Types').RectTRBL;
type ElementRegistry = import('../../core/ElementRegistry').default;
type EventBus = import('../../core/EventBus').default;
type Modeling = import('../modeling/Modeling').default;
type Rules = import('../rules/Rules').default;
type Element = import("../../model/Types").Element;
type Shape = import("../../model/Types").Shape;
type Direction = import("../../util/Types").Direction;
type Rect = import("../../util/Types").Rect;
type RectTRBL = import("../../util/Types").RectTRBL;
type ElementRegistry = import("../../core/ElementRegistry").default;
type EventBus = import("../../core/EventBus").default;
type Modeling = import("../modeling/Modeling").default;
type Rules = import("../rules/Rules").default;
import CommandInterceptor from '../../command/CommandInterceptor';
4 changes: 2 additions & 2 deletions lib/features/auto-resize/AutoResizeProvider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export default class AutoResizeProvider extends RuleProvider {
canResize(elements: Shape[], target: Shape): boolean;
}

type Shape = import('../../model/Types').Shape;
type EventBus = import('../../core/EventBus').default;
type Shape = import("../../model/Types").Shape;
type EventBus = import("../../core/EventBus").default;
import RuleProvider from '../rules/RuleProvider';
5 changes: 4 additions & 1 deletion lib/features/auto-resize/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
declare const _default: import('didi').ModuleDeclaration;
declare const _default: {
autoResize: (string | typeof AutoResize)[];
};
export default _default;
import AutoResize from './AutoResize';
6 changes: 3 additions & 3 deletions lib/features/auto-scroll/AutoScroll.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ export default class AutoScroll {
setOptions(options: any): void;
}

type Point = import('../../util/Types').Point;
type EventBus = import('../../core/EventBus').default;
type Canvas = import('../../core/Canvas').default;
type Point = import("../../util/Types").Point;
type EventBus = import("../../core/EventBus").default;
type Canvas = import("../../core/Canvas").default;
5 changes: 4 additions & 1 deletion lib/features/auto-scroll/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
declare const _default: import('didi').ModuleDeclaration;
declare const _default: {
autoScroll: (string | typeof AutoScroll)[];
};
export default _default;
import AutoScroll from './AutoScroll';
Loading

0 comments on commit 74986ce

Please sign in to comment.