From 0370a9aeddf0dadc1be60a5a283059ec71e09e52 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Tue, 12 Mar 2024 10:57:56 +0100 Subject: [PATCH] chore: import explicit files This prepares us to migrate diagram-js to an ES module. Related to https://github.com/bpmn-io/diagram-js/issues/863 --- lib/Diagram.js | 2 +- lib/Diagram.spec.ts | 12 +-- lib/command/CommandHandler.spec.ts | 6 +- lib/command/CommandHandler.ts | 4 +- lib/command/CommandInterceptor.js | 8 +- lib/command/CommandInterceptor.spec.ts | 6 +- lib/command/CommandStack.js | 6 +- lib/command/CommandStack.spec.ts | 8 +- lib/command/index.js | 2 +- lib/core/Canvas.js | 28 +++---- lib/core/Canvas.spec.ts | 6 +- lib/core/ElementFactory.js | 12 +-- lib/core/ElementFactory.spec.ts | 6 +- lib/core/ElementRegistry.js | 4 +- lib/core/ElementRegistry.spec.ts | 8 +- lib/core/EventBus.spec.ts | 4 +- lib/core/GraphicsFactory.js | 16 ++-- lib/core/GraphicsFactory.spec.ts | 6 +- lib/core/Types.ts | 2 +- lib/core/index.js | 12 +-- lib/draw/BaseRenderer.js | 8 +- lib/draw/BaseRenderer.spec.ts | 10 +-- lib/draw/DefaultRenderer.js | 10 +-- lib/draw/DefaultRenderer.spec.ts | 8 +- lib/draw/index.js | 4 +- lib/features/align-elements/AlignElements.js | 10 +-- lib/features/align-elements/index.js | 2 +- lib/features/attach-support/AttachSupport.js | 18 ++--- lib/features/attach-support/index.js | 4 +- lib/features/auto-place/AutoPlace.js | 14 ++-- .../auto-place/AutoPlaceSelectionBehavior.js | 4 +- lib/features/auto-place/AutoPlaceUtil.js | 10 +-- lib/features/auto-place/AutoPlaceUtil.spec.ts | 6 +- lib/features/auto-place/index.js | 4 +- lib/features/auto-resize/AutoResize.js | 34 ++++---- .../auto-resize/AutoResizeProvider.js | 8 +- lib/features/auto-resize/index.js | 2 +- lib/features/auto-scroll/AutoScroll.js | 8 +- lib/features/auto-scroll/index.js | 4 +- lib/features/bendpoints/BendpointMove.js | 12 +-- .../bendpoints/BendpointMovePreview.js | 12 +-- lib/features/bendpoints/BendpointSnapping.js | 8 +- lib/features/bendpoints/BendpointUtil.js | 28 +++---- lib/features/bendpoints/Bendpoints.js | 36 ++++----- .../bendpoints/ConnectionSegmentMove.js | 43 +++++----- lib/features/bendpoints/GeometricUtil.js | 4 +- lib/features/bendpoints/index.js | 14 ++-- lib/features/change-support/ChangeSupport.js | 10 +-- lib/features/change-support/index.js | 2 +- lib/features/clipboard/index.js | 2 +- .../complex-preview/ComplexPreview.js | 14 ++-- lib/features/complex-preview/index.js | 4 +- lib/features/connect/Connect.js | 20 ++--- lib/features/connect/ConnectPreview.js | 6 +- lib/features/connect/index.js | 10 +-- .../connection-preview/ConnectionPreview.js | 20 ++--- lib/features/connection-preview/index.js | 2 +- lib/features/context-pad/ContextPad.js | 22 +++--- lib/features/context-pad/ContextPad.spec.ts | 10 +-- .../context-pad/ContextPadProvider.spec.ts | 4 +- .../context-pad/ContextPadProvider.ts | 4 +- lib/features/context-pad/index.js | 6 +- lib/features/copy-paste/CopyPaste.js | 31 ++++---- lib/features/copy-paste/index.js | 10 +-- lib/features/create/Create.js | 20 ++--- lib/features/create/CreateConnectPreview.js | 2 +- lib/features/create/CreatePreview.js | 22 +++--- lib/features/create/index.js | 12 +-- .../distribute-elements/DistributeElements.js | 12 +-- lib/features/distribute-elements/index.js | 2 +- lib/features/dragging/Dragging.js | 34 ++++---- lib/features/dragging/index.js | 6 +- lib/features/editor-actions/EditorActions.js | 2 +- lib/features/editor-actions/index.js | 2 +- lib/features/global-connect/GlobalConnect.js | 16 ++-- lib/features/global-connect/index.js | 12 +-- lib/features/grid-snapping/GridSnapping.js | 20 ++--- .../grid-snapping/behavior/ResizeBehavior.js | 12 +-- .../behavior/SpaceToolBehavior.js | 4 +- lib/features/grid-snapping/behavior/index.js | 4 +- lib/features/grid-snapping/index.js | 4 +- lib/features/hand-tool/HandTool.js | 14 ++-- lib/features/hand-tool/index.js | 6 +- lib/features/hover-fix/HoverFix.js | 6 +- lib/features/hover-fix/index.js | 2 +- .../interaction-events/InteractionEvents.js | 22 +++--- lib/features/interaction-events/index.js | 2 +- .../KeyboardMoveSelection.js | 8 +- lib/features/keyboard-move-selection/index.js | 6 +- lib/features/keyboard/Keyboard.js | 4 +- lib/features/keyboard/KeyboardBindings.js | 8 +- lib/features/keyboard/index.js | 4 +- lib/features/label-support/LabelSupport.js | 20 ++--- lib/features/label-support/index.js | 2 +- lib/features/lasso-tool/LassoTool.js | 20 ++--- lib/features/lasso-tool/index.js | 6 +- lib/features/modeling/Modeling.js | 78 +++++++++---------- lib/features/modeling/Modeling.spec.ts | 10 +-- .../modeling/cmd/AlignElementsHandler.js | 9 ++- .../modeling/cmd/AppendShapeHandler.js | 10 +-- .../modeling/cmd/CreateConnectionHandler.js | 12 +-- .../modeling/cmd/CreateElementsHandler.js | 6 +- .../modeling/cmd/CreateLabelHandler.js | 12 +-- .../modeling/cmd/CreateShapeHandler.js | 12 ++- .../modeling/cmd/DeleteConnectionHandler.js | 8 +- .../modeling/cmd/DeleteElementsHandler.js | 4 +- .../modeling/cmd/DeleteShapeHandler.js | 10 +-- .../modeling/cmd/DistributeElementsHandler.js | 2 +- .../modeling/cmd/LayoutConnectionHandler.js | 4 +- .../modeling/cmd/MoveConnectionHandler.js | 2 +- .../modeling/cmd/MoveElementsHandler.js | 4 +- lib/features/modeling/cmd/MoveShapeHandler.js | 8 +- .../cmd/ReconnectConnectionHandler.js | 2 +- .../modeling/cmd/ReplaceShapeHandler.js | 8 +- .../modeling/cmd/ResizeShapeHandler.js | 4 +- lib/features/modeling/cmd/SpaceToolHandler.js | 9 ++- .../cmd/ToggleShapeCollapseHandler.js | 4 +- .../modeling/cmd/UpdateAttachmentHandler.js | 4 +- .../modeling/cmd/UpdateWaypointsHandler.js | 4 + .../modeling/cmd/helper/AnchorsHelper.js | 22 +++--- .../modeling/cmd/helper/MoveClosure.js | 8 +- .../modeling/cmd/helper/MoveHelper.js | 12 +-- lib/features/modeling/index.js | 12 +-- lib/features/mouse/Mouse.js | 2 +- lib/features/mouse/index.js | 2 +- lib/features/move/Move.js | 38 ++++----- lib/features/move/MovePreview.js | 22 +++--- lib/features/move/index.js | 16 ++-- lib/features/ordering/OrderingProvider.js | 8 +- lib/features/outline/Outline.js | 18 ++--- lib/features/outline/OutlineProvider.spec.ts | 4 +- lib/features/outline/OutlineProvider.ts | 2 +- lib/features/outline/index.js | 2 +- lib/features/overlays/Overlays.js | 22 +++--- lib/features/overlays/Overlays.spec.ts | 8 +- lib/features/overlays/index.js | 2 +- lib/features/palette/Palette.js | 10 +-- lib/features/palette/Palette.spec.ts | 8 +- lib/features/palette/PaletteProvider.spec.ts | 2 +- lib/features/palette/index.js | 2 +- lib/features/popup-menu/PopupMenu.js | 22 +++--- lib/features/popup-menu/PopupMenu.spec.ts | 12 +-- lib/features/popup-menu/PopupMenuComponent.js | 31 ++++---- lib/features/popup-menu/PopupMenuItem.js | 4 +- lib/features/popup-menu/PopupMenuList.js | 6 +- .../popup-menu/PopupMenuProvider.spec.ts | 4 +- lib/features/popup-menu/PopupMenuProvider.ts | 4 +- lib/features/popup-menu/index.js | 2 +- .../preview-support/PreviewSupport.js | 14 ++-- lib/features/preview-support/index.js | 2 +- lib/features/replace/Replace.js | 11 ++- lib/features/replace/index.js | 4 +- lib/features/resize/Resize.js | 18 ++--- lib/features/resize/ResizeHandles.js | 18 ++--- lib/features/resize/ResizePreview.js | 6 +- lib/features/resize/ResizeUtil.js | 35 ++++----- lib/features/resize/index.js | 12 +-- .../root-elements/RootElementsBehavior.js | 4 +- lib/features/root-elements/index.js | 2 +- lib/features/rules/RuleProvider.js | 4 +- lib/features/rules/Rules.js | 2 +- lib/features/rules/Rules.test.ts | 6 +- lib/features/rules/index.js | 2 +- lib/features/search-pad/SearchPad.js | 24 +++--- lib/features/search-pad/SearchPadProvider.ts | 2 +- .../search-pad/SearchProvider.spec.ts | 4 +- lib/features/search-pad/index.js | 6 +- lib/features/selection/Selection.js | 4 +- lib/features/selection/Selection.test.ts | 8 +- lib/features/selection/SelectionBehavior.js | 10 +-- lib/features/selection/SelectionVisuals.js | 8 +- lib/features/selection/index.js | 10 +-- lib/features/snapping/CreateMoveSnapping.js | 24 +++--- lib/features/snapping/ResizeSnapping.js | 18 ++--- lib/features/snapping/SnapContext.js | 10 +-- lib/features/snapping/SnapUtil.js | 17 ++-- lib/features/snapping/Snapping.js | 16 ++-- lib/features/snapping/index.js | 6 +- lib/features/space-tool/SpaceTool.js | 45 +++++------ lib/features/space-tool/SpaceToolPreview.js | 30 ++++--- lib/features/space-tool/SpaceUtil.js | 15 ++-- lib/features/space-tool/index.js | 14 ++-- lib/features/tool-manager/ToolManager.js | 6 +- lib/features/tool-manager/index.js | 4 +- lib/features/tooltips/Tooltips.js | 8 +- lib/features/tooltips/index.js | 2 +- lib/i18n/I18N.js | 2 +- lib/i18n/index.js | 2 +- lib/i18n/translate/index.js | 2 +- lib/i18n/translate/translate.spec.ts | 2 +- lib/layout/BaseLayouter.js | 8 +- lib/layout/ConnectionDocking.js | 8 +- lib/layout/CroppingConnectionDocking.js | 6 +- lib/layout/LayoutUtil.js | 18 ++--- lib/layout/ManhattanLayout.js | 8 +- lib/model/Types.ts | 2 +- lib/model/index.js | 10 +-- lib/model/index.spec.ts | 2 +- lib/navigation/keyboard-move/KeyboardMove.js | 4 +- lib/navigation/keyboard-move/index.js | 4 +- lib/navigation/movecanvas/MoveCanvas.js | 12 +-- lib/navigation/movecanvas/index.js | 2 +- lib/navigation/zoomscroll/ZoomScroll.js | 12 +-- lib/navigation/zoomscroll/ZoomUtil.js | 2 +- lib/navigation/zoomscroll/index.js | 2 +- lib/util/AttachUtil.js | 10 +-- lib/util/ClickTrap.js | 2 +- lib/util/Elements.js | 8 +- lib/util/Event.js | 8 +- lib/util/Geometry.js | 6 +- lib/util/LineIntersection.js | 8 +- lib/util/Math.js | 2 +- lib/util/Mouse.js | 6 +- lib/util/PositionUtil.js | 4 +- lib/util/RenderUtil.js | 2 +- lib/util/RenderUtil.spec.ts | 2 +- lib/util/Text.js | 2 +- lib/util/Text.spec.ts | 2 +- test/helper/index.js | 2 +- 219 files changed, 1056 insertions(+), 1056 deletions(-) diff --git a/lib/Diagram.js b/lib/Diagram.js index c1bd69ed8..8785f4e65 100644 --- a/lib/Diagram.js +++ b/lib/Diagram.js @@ -1,6 +1,6 @@ import { Injector } from 'didi'; -import CoreModule from './core'; +import CoreModule from './core/index.js'; /** * @typedef {import('didi').InjectionContext} InjectionContext diff --git a/lib/Diagram.spec.ts b/lib/Diagram.spec.ts index 099014d4f..4f2d93cd0 100644 --- a/lib/Diagram.spec.ts +++ b/lib/Diagram.spec.ts @@ -1,12 +1,12 @@ -import Diagram from './Diagram'; +import Diagram from './Diagram.js'; -import CommandModule from './command'; +import CommandModule from './command/index.js'; -import CoreModule from './core'; -import EventBus from './core/EventBus'; +import CoreModule from './core/index.js'; +import EventBus from './core/EventBus.js'; -import ModelingModule from './features/modeling'; -import Modeling from './features/modeling/Modeling'; +import ModelingModule from './features/modeling/index.js'; +import Modeling from './features/modeling/Modeling.js'; let diagram = new Diagram(); diff --git a/lib/command/CommandHandler.spec.ts b/lib/command/CommandHandler.spec.ts index 3e230d0a1..6d33f977c 100644 --- a/lib/command/CommandHandler.spec.ts +++ b/lib/command/CommandHandler.spec.ts @@ -1,7 +1,7 @@ -import CommandHandler from './CommandHandler'; -import { CommandContext } from './CommandStack'; +import CommandHandler from './CommandHandler.js'; +import { CommandContext } from './CommandStack.js'; -import Canvas from '../core/Canvas'; +import Canvas from '../core/Canvas.js'; export class AddShapeHandler implements CommandHandler { private _canvas: Canvas; diff --git a/lib/command/CommandHandler.ts b/lib/command/CommandHandler.ts index 6571ac320..c568958df 100644 --- a/lib/command/CommandHandler.ts +++ b/lib/command/CommandHandler.ts @@ -1,5 +1,5 @@ -import { ElementLike } from "../core/Types"; -import { CommandContext } from "./CommandStack"; +import { ElementLike } from '../core/Types.js'; +import { CommandContext } from './CommandStack.js'; /** * A command handler that may be registered via diff --git a/lib/command/CommandInterceptor.js b/lib/command/CommandInterceptor.js index 747723cf1..5e039d9d3 100644 --- a/lib/command/CommandInterceptor.js +++ b/lib/command/CommandInterceptor.js @@ -7,9 +7,9 @@ import { } from 'min-dash'; /** - * @typedef {import('../core/Types').ElementLike} ElementLike - * @typedef {import('../core/EventBus').default} EventBus - * @typedef {import('./CommandStack').CommandContext} CommandContext + * @typedef {import('../core/Types.js').ElementLike} ElementLike + * @typedef {import('../core/EventBus.js').default} EventBus + * @typedef {import('./CommandStack.js').CommandContext} CommandContext * * @typedef {string|string[]} Events * @typedef { (context: CommandContext) => ElementLike[] | void } HandlerFunction @@ -28,7 +28,7 @@ var DEFAULT_PRIORITY = 1000; * @example * * ```javascript - * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; + * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor.js'; * * class CommandLogger extends CommandInterceptor { * constructor(eventBus) { diff --git a/lib/command/CommandInterceptor.spec.ts b/lib/command/CommandInterceptor.spec.ts index 0ace9b36b..670465e0a 100644 --- a/lib/command/CommandInterceptor.spec.ts +++ b/lib/command/CommandInterceptor.spec.ts @@ -1,8 +1,8 @@ -import CommandInterceptor from './CommandInterceptor'; +import CommandInterceptor from './CommandInterceptor.js'; -import EventBus from '../core/EventBus'; +import EventBus from '../core/EventBus.js'; -import Modeling from '../features/modeling/Modeling'; +import Modeling from '../features/modeling/Modeling.js'; export class AddShapeBehavior extends CommandInterceptor { static $inject = [ 'eventBus', 'modeling' ]; diff --git a/lib/command/CommandStack.js b/lib/command/CommandStack.js index 6deff9760..50aa13bd0 100644 --- a/lib/command/CommandStack.js +++ b/lib/command/CommandStack.js @@ -6,10 +6,10 @@ import { /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../core/Types').ElementLike} ElementLike + * @typedef {import('../core/Types.js').ElementLike} ElementLike * - * @typedef {import('../core/EventBus').default} EventBus - * @typedef {import('./CommandHandler').default} CommandHandler + * @typedef {import('../core/EventBus.js').default} EventBus + * @typedef {import('./CommandHandler.js').default} CommandHandler * * @typedef { any } CommandContext * @typedef { { diff --git a/lib/command/CommandStack.spec.ts b/lib/command/CommandStack.spec.ts index 9d1325fa0..ec76c78b7 100644 --- a/lib/command/CommandStack.spec.ts +++ b/lib/command/CommandStack.spec.ts @@ -1,9 +1,9 @@ -import Diagram from '../Diagram'; +import Diagram from '../Diagram.js'; -import CommandModule from '.'; -import CommandStack from './CommandStack'; +import CommandModule from './index.js'; +import CommandStack from './CommandStack.js'; -import { AddShapeHandler } from './CommandHandler.spec'; +import { AddShapeHandler } from './CommandHandler.spec.js'; const diagram = new Diagram({ modules: [ diff --git a/lib/command/index.js b/lib/command/index.js index e4d09b4d5..f9767d172 100644 --- a/lib/command/index.js +++ b/lib/command/index.js @@ -1,4 +1,4 @@ -import CommandStack from './CommandStack'; +import CommandStack from './CommandStack.js'; /** * @type { import('didi').ModuleDeclaration } diff --git a/lib/core/Canvas.js b/lib/core/Canvas.js index e1767b084..115faefb8 100644 --- a/lib/core/Canvas.js +++ b/lib/core/Canvas.js @@ -16,14 +16,14 @@ import { import { add as collectionAdd, remove as collectionRemove -} from '../util/Collections'; +} from '../util/Collections.js'; import { getType, getBBox as getBoundingBox -} from '../util/Elements'; +} from '../util/Elements.js'; -import { asTRBL } from '../layout/LayoutUtil'; +import { asTRBL } from '../layout/LayoutUtil.js'; import { append as svgAppend, @@ -38,10 +38,10 @@ import { createMatrix as createMatrix } from 'tiny-svg'; /** - * @typedef {import('./Types').ConnectionLike} ConnectionLike - * @typedef {import('./Types').RootLike} RootLike - * @typedef {import('./Types').ParentLike } ParentLike - * @typedef {import('./Types').ShapeLike} ShapeLike + * @typedef {import('./Types.js').ConnectionLike} ConnectionLike + * @typedef {import('./Types.js').RootLike} RootLike + * @typedef {import('./Types.js').ParentLike } ParentLike + * @typedef {import('./Types.js').ShapeLike} ShapeLike * * @typedef { { * container?: HTMLElement; @@ -67,14 +67,14 @@ import { createMatrix as createMatrix } from 'tiny-svg'; * outer: Dimensions; * } & Rect } CanvasViewbox * - * @typedef {import('./ElementRegistry').default} ElementRegistry - * @typedef {import('./EventBus').default} EventBus - * @typedef {import('./GraphicsFactory').default} GraphicsFactory + * @typedef {import('./ElementRegistry.js').default} ElementRegistry + * @typedef {import('./EventBus.js').default} EventBus + * @typedef {import('./GraphicsFactory.js').default} GraphicsFactory * - * @typedef {import('../util/Types').Dimensions} Dimensions - * @typedef {import('../util/Types').Point} Point - * @typedef {import('../util/Types').Rect} Rect - * @typedef {import('../util/Types').RectTRBL} RectTRBL + * @typedef {import('../util/Types.js').Dimensions} Dimensions + * @typedef {import('../util/Types.js').Point} Point + * @typedef {import('../util/Types.js').Rect} Rect + * @typedef {import('../util/Types.js').RectTRBL} RectTRBL */ function round(number, resolution) { diff --git a/lib/core/Canvas.spec.ts b/lib/core/Canvas.spec.ts index 3af59af05..392d868fe 100644 --- a/lib/core/Canvas.spec.ts +++ b/lib/core/Canvas.spec.ts @@ -1,7 +1,7 @@ -import Diagram from '../Diagram'; +import Diagram from '../Diagram.js'; -import Canvas from './Canvas'; -import ElementFactory from './ElementFactory'; +import Canvas from './Canvas.js'; +import ElementFactory from './ElementFactory.js'; const diagram = new Diagram(); diff --git a/lib/core/ElementFactory.js b/lib/core/ElementFactory.js index 51f79ad33..b4ffdfcd8 100644 --- a/lib/core/ElementFactory.js +++ b/lib/core/ElementFactory.js @@ -1,15 +1,15 @@ import { create -} from '../model'; +} from '../model/index.js'; import { assign } from 'min-dash'; /** - * @typedef {import('../model/Types').Element} Element - * @typedef {import('../model/Types').Connection} Connection - * @typedef {import('../model/Types').Label} Label - * @typedef {import('../model/Types').Root} Root - * @typedef {import('../model/Types').Shape} Shape + * @typedef {import('../model/Types.js').Element} Element + * @typedef {import('../model/Types.js').Connection} Connection + * @typedef {import('../model/Types.js').Label} Label + * @typedef {import('../model/Types.js').Root} Root + * @typedef {import('../model/Types.js').Shape} Shape */ /** diff --git a/lib/core/ElementFactory.spec.ts b/lib/core/ElementFactory.spec.ts index aed6ee1d6..df08c10d7 100644 --- a/lib/core/ElementFactory.spec.ts +++ b/lib/core/ElementFactory.spec.ts @@ -1,13 +1,13 @@ -import Diagram from '../Diagram'; +import Diagram from '../Diagram.js'; -import ElementFactory from './ElementFactory'; +import ElementFactory from './ElementFactory.js'; import { Connection, Label, Root, Shape -} from '../model/Types'; +} from '../model/Types.js'; const diagram = new Diagram(); diff --git a/lib/core/ElementRegistry.js b/lib/core/ElementRegistry.js index 54ba7ba0a..04f54612c 100644 --- a/lib/core/ElementRegistry.js +++ b/lib/core/ElementRegistry.js @@ -3,9 +3,9 @@ var ELEMENT_ID = 'data-element-id'; import { attr as svgAttr } from 'tiny-svg'; /** - * @typedef {import('./Types').ElementLike} ElementLike + * @typedef {import('./Types.js').ElementLike} ElementLike * - * @typedef {import('./EventBus').default} EventBus + * @typedef {import('./EventBus.js').default} EventBus * * @typedef { (element: ElementLike, gfx: SVGElement) => boolean|any } ElementRegistryFilterCallback * @typedef { (element: ElementLike, gfx: SVGElement) => any } ElementRegistryForEachCallback diff --git a/lib/core/ElementRegistry.spec.ts b/lib/core/ElementRegistry.spec.ts index 987071916..e2073135f 100644 --- a/lib/core/ElementRegistry.spec.ts +++ b/lib/core/ElementRegistry.spec.ts @@ -1,8 +1,8 @@ -import Diagram from '../Diagram'; +import Diagram from '../Diagram.js'; -import ElementFactory from './ElementFactory'; -import ElementRegistry from './ElementRegistry'; -import GraphicsFactory from './GraphicsFactory'; +import ElementFactory from './ElementFactory.js'; +import ElementRegistry from './ElementRegistry.js'; +import GraphicsFactory from './GraphicsFactory.js'; const diagram = new Diagram(); diff --git a/lib/core/EventBus.spec.ts b/lib/core/EventBus.spec.ts index 14b13d99d..a3b26724d 100644 --- a/lib/core/EventBus.spec.ts +++ b/lib/core/EventBus.spec.ts @@ -1,6 +1,6 @@ -import Diagram from '../Diagram'; +import Diagram from '../Diagram.js'; -import EventBus from './EventBus'; +import EventBus from './EventBus.js'; const diagram = new Diagram(); diff --git a/lib/core/GraphicsFactory.js b/lib/core/GraphicsFactory.js index 19e189078..9e18e3219 100644 --- a/lib/core/GraphicsFactory.js +++ b/lib/core/GraphicsFactory.js @@ -6,9 +6,9 @@ import { import { getChildren, getVisual -} from '../util/GraphicsUtil'; +} from '../util/GraphicsUtil.js'; -import { translate } from '../util/SvgTransformUtil'; +import { translate } from '../util/SvgTransformUtil.js'; import { clear as domClear } from 'min-dom'; @@ -22,15 +22,15 @@ import { import { isFrameElement -} from '../util/Elements'; +} from '../util/Elements.js'; /** - * @typedef {import('./Types').ConnectionLike} ConnectionLike - * @typedef {import('./Types').ElementLike} ElementLike - * @typedef {import('./Types').ShapeLike} ShapeLike + * @typedef {import('./Types.js').ConnectionLike} ConnectionLike + * @typedef {import('./Types.js').ElementLike} ElementLike + * @typedef {import('./Types.js').ShapeLike} ShapeLike * - * @typedef {import('./ElementRegistry').default} ElementRegistry - * @typedef {import('./EventBus').default} EventBus + * @typedef {import('./ElementRegistry.js').default} ElementRegistry + * @typedef {import('./EventBus.js').default} EventBus */ /** diff --git a/lib/core/GraphicsFactory.spec.ts b/lib/core/GraphicsFactory.spec.ts index cafcb1195..584a76eb0 100644 --- a/lib/core/GraphicsFactory.spec.ts +++ b/lib/core/GraphicsFactory.spec.ts @@ -1,7 +1,7 @@ -import Diagram from '../Diagram'; +import Diagram from '../Diagram.js'; -import ElementFactory from './ElementFactory'; -import GraphicsFactory from './GraphicsFactory'; +import ElementFactory from './ElementFactory.js'; +import GraphicsFactory from './GraphicsFactory.js'; const diagram = new Diagram(); diff --git a/lib/core/Types.ts b/lib/core/Types.ts index 7e1dac4f7..40a7799ea 100644 --- a/lib/core/Types.ts +++ b/lib/core/Types.ts @@ -5,4 +5,4 @@ export type { RootLike, ConnectionLike, LabelLike -} from '../model/Types'; \ No newline at end of file +} from '../model/Types.js'; \ No newline at end of file diff --git a/lib/core/index.js b/lib/core/index.js index 2392090e7..f904ae4dd 100644 --- a/lib/core/index.js +++ b/lib/core/index.js @@ -1,10 +1,10 @@ -import DrawModule from '../draw'; +import DrawModule from '../draw/index.js'; -import Canvas from './Canvas'; -import ElementRegistry from './ElementRegistry'; -import ElementFactory from './ElementFactory'; -import EventBus from './EventBus'; -import GraphicsFactory from './GraphicsFactory'; +import Canvas from './Canvas.js'; +import ElementRegistry from './ElementRegistry.js'; +import ElementFactory from './ElementFactory.js'; +import EventBus from './EventBus.js'; +import GraphicsFactory from './GraphicsFactory.js'; /** * @type { import('didi').ModuleDeclaration } diff --git a/lib/draw/BaseRenderer.js b/lib/draw/BaseRenderer.js index d71582c2a..6557177a0 100644 --- a/lib/draw/BaseRenderer.js +++ b/lib/draw/BaseRenderer.js @@ -1,11 +1,11 @@ var DEFAULT_RENDER_PRIORITY = 1000; /** - * @typedef {import('../core/Types').ElementLike} Element - * @typedef {import('../core/Types').ConnectionLike} Connection - * @typedef {import('../core/Types').ShapeLike} Shape + * @typedef {import('../core/Types.js').ElementLike} Element + * @typedef {import('../core/Types.js').ConnectionLike} Connection + * @typedef {import('../core/Types.js').ShapeLike} Shape * - * @typedef {import('../core/EventBus').default} EventBus + * @typedef {import('../core/EventBus.js').default} EventBus */ /** diff --git a/lib/draw/BaseRenderer.spec.ts b/lib/draw/BaseRenderer.spec.ts index aeaf18e7b..92911c680 100644 --- a/lib/draw/BaseRenderer.spec.ts +++ b/lib/draw/BaseRenderer.spec.ts @@ -1,11 +1,11 @@ -import { Element, Connection, Shape } from '../model'; +import { Element, Connection, Shape } from '../model/index.js'; -import Diagram from '../Diagram'; +import Diagram from '../Diagram.js'; -import ElementFactory from '../core/ElementFactory'; -import GraphicsFactory from '../core/GraphicsFactory'; +import ElementFactory from '../core/ElementFactory.js'; +import GraphicsFactory from '../core/GraphicsFactory.js'; -import BaseRenderer from './BaseRenderer'; +import BaseRenderer from './BaseRenderer.js'; class CustomRenderer extends BaseRenderer { canRender(element: Element): boolean { diff --git a/lib/draw/DefaultRenderer.js b/lib/draw/DefaultRenderer.js index eb3b23142..989df4562 100644 --- a/lib/draw/DefaultRenderer.js +++ b/lib/draw/DefaultRenderer.js @@ -1,11 +1,11 @@ import inherits from 'inherits-browser'; -import BaseRenderer from './BaseRenderer'; +import BaseRenderer from './BaseRenderer.js'; import { componentsToPath, createLine -} from '../util/RenderUtil'; +} from '../util/RenderUtil.js'; import { append as svgAppend, @@ -17,11 +17,11 @@ import { assign } from 'min-dash'; import { isFrameElement -} from '../util/Elements'; +} from '../util/Elements.js'; /** - * @typedef {import('../core/EventBus').default} EventBus - * @typedef {import('./Styles').default} Styles + * @typedef {import('../core/EventBus.js').default} EventBus + * @typedef {import('./Styles.js').default} Styles */ // apply default renderer with lowest possible priority diff --git a/lib/draw/DefaultRenderer.spec.ts b/lib/draw/DefaultRenderer.spec.ts index b344c158f..88429bcd0 100644 --- a/lib/draw/DefaultRenderer.spec.ts +++ b/lib/draw/DefaultRenderer.spec.ts @@ -1,9 +1,9 @@ -import Diagram from "../Diagram"; +import Diagram from '../Diagram.js'; -import DefaultRenderer from "./DefaultRenderer"; +import DefaultRenderer from './DefaultRenderer.js'; -import ElementFactory from "../core/ElementFactory"; -import GraphicsFactory from "../core/GraphicsFactory"; +import ElementFactory from '../core/ElementFactory.js'; +import GraphicsFactory from '../core/GraphicsFactory.js'; const diagram = new Diagram(); diff --git a/lib/draw/index.js b/lib/draw/index.js index dff1d12a6..e2da6cd3a 100644 --- a/lib/draw/index.js +++ b/lib/draw/index.js @@ -1,5 +1,5 @@ -import DefaultRenderer from './DefaultRenderer'; -import Styles from './Styles'; +import DefaultRenderer from './DefaultRenderer.js'; +import Styles from './Styles.js'; /** * @type { import('didi').ModuleDeclaration } diff --git a/lib/features/align-elements/AlignElements.js b/lib/features/align-elements/AlignElements.js index 313da0277..4ea41e0dc 100644 --- a/lib/features/align-elements/AlignElements.js +++ b/lib/features/align-elements/AlignElements.js @@ -6,13 +6,13 @@ import { } from 'min-dash'; /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules * - * @typedef {import('../../util/Types').Axis} Axis - * @typedef {import('../../util/Types').Dimension} Dimension + * @typedef {import('../../util/Types.js').Axis} Axis + * @typedef {import('../../util/Types.js').Dimension} Dimension * * @typedef { 'top' | 'right' | 'bottom' | 'left' | 'center' | 'middle' } Alignment */ diff --git a/lib/features/align-elements/index.js b/lib/features/align-elements/index.js index d3b432b72..7287f3187 100644 --- a/lib/features/align-elements/index.js +++ b/lib/features/align-elements/index.js @@ -1,4 +1,4 @@ -import AlignElements from './AlignElements'; +import AlignElements from './AlignElements.js'; /** * @type { import('didi').ModuleDeclaration } diff --git a/lib/features/attach-support/AttachSupport.js b/lib/features/attach-support/AttachSupport.js index c099d6d76..825a9e373 100644 --- a/lib/features/attach-support/AttachSupport.js +++ b/lib/features/attach-support/AttachSupport.js @@ -7,23 +7,23 @@ import { unionBy } from 'min-dash'; -import { saveClear } from '../../util/Removal'; +import inherits from 'inherits-browser'; -import { getNewAttachShapeDelta } from '../../util/AttachUtil'; +import { saveClear } from '../../util/Removal.js'; -import inherits from 'inherits-browser'; +import { getNewAttachShapeDelta } from '../../util/AttachUtil.js'; -import CommandInterceptor from '../../command/CommandInterceptor'; +import CommandInterceptor from '../../command/CommandInterceptor.js'; /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../rules/Rules').default} Rules - * @typedef {import('../modeling/Modeling').default} Modeling + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../rules/Rules.js').default} Rules + * @typedef {import('../modeling/Modeling.js').default} Modeling */ var LOW_PRIORITY = 251, diff --git a/lib/features/attach-support/index.js b/lib/features/attach-support/index.js index a254a46a1..28944f92a 100644 --- a/lib/features/attach-support/index.js +++ b/lib/features/attach-support/index.js @@ -1,6 +1,6 @@ -import RulesModule from '../rules'; +import RulesModule from '../rules/index.js'; -import AttachSupport from './AttachSupport'; +import AttachSupport from './AttachSupport.js'; /** * @type { import('didi').ModuleDeclaration } diff --git a/lib/features/auto-place/AutoPlace.js b/lib/features/auto-place/AutoPlace.js index 604c6a8c3..b9a5f8129 100644 --- a/lib/features/auto-place/AutoPlace.js +++ b/lib/features/auto-place/AutoPlace.js @@ -1,18 +1,18 @@ import { asTRBL, getMid -} from '../../layout/LayoutUtil'; +} from '../../layout/LayoutUtil.js'; -import { DEFAULT_DISTANCE } from './AutoPlaceUtil'; +import { DEFAULT_DISTANCE } from './AutoPlaceUtil.js'; /** - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling */ var LOW_PRIORITY = 100; diff --git a/lib/features/auto-place/AutoPlaceSelectionBehavior.js b/lib/features/auto-place/AutoPlaceSelectionBehavior.js index 930dc6ff2..fba040d32 100644 --- a/lib/features/auto-place/AutoPlaceSelectionBehavior.js +++ b/lib/features/auto-place/AutoPlaceSelectionBehavior.js @@ -1,6 +1,6 @@ /** - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../selection/Selection').default} Selection + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../selection/Selection.js').default} Selection */ /** diff --git a/lib/features/auto-place/AutoPlaceUtil.js b/lib/features/auto-place/AutoPlaceUtil.js index 2b378646c..d61f05044 100644 --- a/lib/features/auto-place/AutoPlaceUtil.js +++ b/lib/features/auto-place/AutoPlaceUtil.js @@ -2,7 +2,7 @@ import { asTRBL, getOrientation, getMid -} from '../../layout/LayoutUtil'; +} from '../../layout/LayoutUtil.js'; import { find, @@ -10,11 +10,11 @@ import { } from 'min-dash'; /** - * @typedef {import('../../model/Types').Connection} Connection - * @typedef {import('../../model/Types').Element} Element - * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('../../model/Types.js').Connection} Connection + * @typedef {import('../../model/Types.js').Element} Element + * @typedef {import('../../model/Types.js').Shape} Shape * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point */ // padding to detect element placement diff --git a/lib/features/auto-place/AutoPlaceUtil.spec.ts b/lib/features/auto-place/AutoPlaceUtil.spec.ts index 7a720c4bf..32a484f0b 100644 --- a/lib/features/auto-place/AutoPlaceUtil.spec.ts +++ b/lib/features/auto-place/AutoPlaceUtil.spec.ts @@ -1,12 +1,12 @@ -import Diagram from '../../Diagram'; +import Diagram from '../../Diagram.js'; -import ElementFactory from '../../core/ElementFactory'; +import ElementFactory from '../../core/ElementFactory.js'; import { findFreePosition, generateGetNextPosition, getConnectedDistance -} from './AutoPlaceUtil'; +} from './AutoPlaceUtil.js'; const diagram = new Diagram(); diff --git a/lib/features/auto-place/index.js b/lib/features/auto-place/index.js index 6129cdda8..5a82a34c9 100644 --- a/lib/features/auto-place/index.js +++ b/lib/features/auto-place/index.js @@ -1,5 +1,5 @@ -import AutoPlace from './AutoPlace'; -import AutoPlaceSelectionBehavior from './AutoPlaceSelectionBehavior'; +import AutoPlace from './AutoPlace.js'; +import AutoPlaceSelectionBehavior from './AutoPlaceSelectionBehavior.js'; /** diff --git a/lib/features/auto-resize/AutoResize.js b/lib/features/auto-resize/AutoResize.js index 69132d7ce..ebae9feaf 100644 --- a/lib/features/auto-resize/AutoResize.js +++ b/lib/features/auto-resize/AutoResize.js @@ -1,12 +1,5 @@ import inherits from 'inherits-browser'; -import { getBBox as getBoundingBox } from '../../util/Elements'; - -import { - asTRBL, - asBounds -} from '../../layout/LayoutUtil'; - import { assign, flatten, @@ -19,20 +12,27 @@ import { values } from 'min-dash'; -import CommandInterceptor from '../../command/CommandInterceptor'; +import { getBBox as getBoundingBox } from '../../util/Elements.js'; + +import { + asTRBL, + asBounds +} from '../../layout/LayoutUtil.js'; + +import CommandInterceptor from '../../command/CommandInterceptor.js'; /** - * @typedef {import('../../model/Types').Element} Element - * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('../../model/Types.js').Element} Element + * @typedef {import('../../model/Types.js').Shape} Shape * - * @typedef {import('../../util/Types').Direction} Direction - * @typedef {import('../../util/Types').Rect} Rect - * @typedef {import('../../util/Types').RectTRBL} RectTRBL + * @typedef {import('../../util/Types.js').Direction} Direction + * @typedef {import('../../util/Types.js').Rect} Rect + * @typedef {import('../../util/Types.js').RectTRBL} RectTRBL * - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules */ /** diff --git a/lib/features/auto-resize/AutoResizeProvider.js b/lib/features/auto-resize/AutoResizeProvider.js index edc676a1d..ae802d282 100644 --- a/lib/features/auto-resize/AutoResizeProvider.js +++ b/lib/features/auto-resize/AutoResizeProvider.js @@ -1,11 +1,11 @@ -import RuleProvider from '../rules/RuleProvider'; - import inherits from 'inherits-browser'; +import RuleProvider from '../rules/RuleProvider.js'; + /** - * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('../../model/Types.js').Shape} Shape * - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/EventBus.js').default} EventBus */ /** diff --git a/lib/features/auto-resize/index.js b/lib/features/auto-resize/index.js index a849be36e..e3720d87b 100644 --- a/lib/features/auto-resize/index.js +++ b/lib/features/auto-resize/index.js @@ -1,4 +1,4 @@ -import AutoResize from './AutoResize'; +import AutoResize from './AutoResize.js'; /** diff --git a/lib/features/auto-scroll/AutoScroll.js b/lib/features/auto-scroll/AutoScroll.js index 43872afae..13c81f738 100644 --- a/lib/features/auto-scroll/AutoScroll.js +++ b/lib/features/auto-scroll/AutoScroll.js @@ -2,13 +2,13 @@ import { assign } from 'min-dash'; import { toPoint -} from '../../util/Event'; +} from '../../util/Event.js'; /** - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../../core/Canvas').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas */ /** diff --git a/lib/features/auto-scroll/index.js b/lib/features/auto-scroll/index.js index 9cf09fdd2..2f4a556ea 100644 --- a/lib/features/auto-scroll/index.js +++ b/lib/features/auto-scroll/index.js @@ -1,6 +1,6 @@ -import DraggingModule from '../dragging'; +import DraggingModule from '../dragging/index.js'; -import AutoScroll from './AutoScroll'; +import AutoScroll from './AutoScroll.js'; /** diff --git a/lib/features/bendpoints/BendpointMove.js b/lib/features/bendpoints/BendpointMove.js index 0fa630253..c07923300 100644 --- a/lib/features/bendpoints/BendpointMove.js +++ b/lib/features/bendpoints/BendpointMove.js @@ -1,13 +1,13 @@ -import { filterRedundantWaypoints } from '../../layout/LayoutUtil'; +import { filterRedundantWaypoints } from '../../layout/LayoutUtil.js'; /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules */ var round = Math.round; diff --git a/lib/features/bendpoints/BendpointMovePreview.js b/lib/features/bendpoints/BendpointMovePreview.js index 636493985..cdaf67db3 100644 --- a/lib/features/bendpoints/BendpointMovePreview.js +++ b/lib/features/bendpoints/BendpointMovePreview.js @@ -3,18 +3,18 @@ import { remove as svgRemove } from 'tiny-svg'; -import { addBendpoint } from './BendpointUtil'; +import { addBendpoint } from './BendpointUtil.js'; -import { translate } from '../../util/SvgTransformUtil'; +import { translate } from '../../util/SvgTransformUtil.js'; -import { isReverse } from './BendpointMove'; +import { isReverse } from './BendpointMove.js'; /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../bendpoints/BendpointMove').default} BendpointMove - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../bendpoints/BendpointMove.js').default} BendpointMove + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus */ var RECONNECT_START = 'reconnectStart', diff --git a/lib/features/bendpoints/BendpointSnapping.js b/lib/features/bendpoints/BendpointSnapping.js index 9ff71d004..1e3fa177b 100644 --- a/lib/features/bendpoints/BendpointSnapping.js +++ b/lib/features/bendpoints/BendpointSnapping.js @@ -4,14 +4,14 @@ import { isArray } from 'min-dash'; -import { setSnapped } from '../snapping/SnapUtil'; +import { setSnapped } from '../snapping/SnapUtil.js'; -import { getClosestPointOnConnection } from './BendpointUtil'; +import { getClosestPointOnConnection } from './BendpointUtil.js'; -import { isConnection } from '../../util/ModelUtil'; +import { isConnection } from '../../util/ModelUtil.js'; /** - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/EventBus.js').default} EventBus */ var abs = Math.abs, round = Math.round; diff --git a/lib/features/bendpoints/BendpointUtil.js b/lib/features/bendpoints/BendpointUtil.js index 0571e0fb6..272587c02 100644 --- a/lib/features/bendpoints/BendpointUtil.js +++ b/lib/features/bendpoints/BendpointUtil.js @@ -1,12 +1,3 @@ -import { - toPoint -} from '../../util/Event'; - -import { - getMidPoint, - pointsAligned -} from '../../util/Geometry'; - import { append as svgAppend, attr as svgAttr, @@ -14,21 +5,30 @@ import { create as svgCreate } from 'tiny-svg'; +import { + toPoint +} from '../../util/Event.js'; + +import { + getMidPoint, + pointsAligned +} from '../../util/Geometry.js'; + import { rotate, translate -} from '../../util/SvgTransformUtil'; +} from '../../util/SvgTransformUtil.js'; import { getApproxIntersection -} from '../../util/LineIntersection'; +} from '../../util/LineIntersection.js'; -import { getDistancePointLine, perpendicularFoot } from './GeometricUtil'; +import { getDistancePointLine, perpendicularFoot } from './GeometricUtil.js'; /** - * @typedef {import('../../core/Types').ConnectionLike} Connection + * @typedef {import('../../core/Types.js').ConnectionLike} Connection * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point */ export var BENDPOINT_CLS = 'djs-bendpoint'; diff --git a/lib/features/bendpoints/Bendpoints.js b/lib/features/bendpoints/Bendpoints.js index 0e9b94cc8..21690032e 100644 --- a/lib/features/bendpoints/Bendpoints.js +++ b/lib/features/bendpoints/Bendpoints.js @@ -6,6 +6,14 @@ import { queryAll as domQueryAll } from 'min-dom'; +import { + append as svgAppend, + attr as svgAttr, + classes as svgClasses, + create as svgCreate, + remove as svgRemove +} from 'tiny-svg'; + import { BENDPOINT_CLS, SEGMENT_DRAGGER_CLS, @@ -13,39 +21,31 @@ import { addSegmentDragger, calculateSegmentMoveRegion, getConnectionIntersection -} from './BendpointUtil'; +} from './BendpointUtil.js'; import { escapeCSS -} from '../../util/EscapeUtil'; +} from '../../util/EscapeUtil.js'; import { pointsAligned, getMidPoint -} from '../../util/Geometry'; +} from '../../util/Geometry.js'; import { isPrimaryButton -} from '../../util/Mouse'; - -import { - append as svgAppend, - attr as svgAttr, - classes as svgClasses, - create as svgCreate, - remove as svgRemove -} from 'tiny-svg'; +} from '../../util/Mouse.js'; import { translate -} from '../../util/SvgTransformUtil'; +} from '../../util/SvgTransformUtil.js'; /** - * @typedef {import('../bendpoints/BendpointMove').default} BendpointMove - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../bendpoints/ConnectionSegmentMove').default} ConnectionSegmentMove - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../interaction-events/InteractionEvents').default} InteractionEvents + * @typedef {import('../bendpoints/BendpointMove.js').default} BendpointMove + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../bendpoints/ConnectionSegmentMove.js').default} ConnectionSegmentMove + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../interaction-events/InteractionEvents.js').default} InteractionEvents */ /** diff --git a/lib/features/bendpoints/ConnectionSegmentMove.js b/lib/features/bendpoints/ConnectionSegmentMove.js index 5fed2a6ba..188606101 100644 --- a/lib/features/bendpoints/ConnectionSegmentMove.js +++ b/lib/features/bendpoints/ConnectionSegmentMove.js @@ -1,45 +1,46 @@ +import { + classes as svgClasses, + remove as svgRemove +} from 'tiny-svg'; + import { pointsAligned, pointsOnLine -} from '../../util/Geometry'; +} from '../../util/Geometry.js'; import { addSegmentDragger, getConnectionIntersection -} from './BendpointUtil'; +} from './BendpointUtil.js'; import { getMid, getOrientation -} from '../../layout/LayoutUtil'; - -var MARKER_CONNECT_HOVER = 'connect-hover', - MARKER_CONNECT_UPDATING = 'djs-updating'; - -import { - classes as svgClasses, - remove as svgRemove -} from 'tiny-svg'; +} from '../../layout/LayoutUtil.js'; import { translate -} from '../../util/SvgTransformUtil'; +} from '../../util/SvgTransformUtil.js'; /** - * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../util/Types').Axis} Axis - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../model/Types.js').Shape} Shape * - * @typedef {import('didi').Injector} Injector + * @typedef {import('../../util/Types.js').Axis} Axis + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../../core/GraphicsFactory').default} GraphicsFactory - * @typedef {import('../modeling/Modeling').default} Modeling + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../../core/GraphicsFactory.js').default} GraphicsFactory + * @typedef {import('../modeling/Modeling.js').default} Modeling */ + +var MARKER_CONNECT_HOVER = 'connect-hover', + MARKER_CONNECT_UPDATING = 'djs-updating'; + function axisAdd(point, axis, delta) { return axisSet(point, axis, point[axis] + delta); } diff --git a/lib/features/bendpoints/GeometricUtil.js b/lib/features/bendpoints/GeometricUtil.js index d97244e85..15a7deffa 100644 --- a/lib/features/bendpoints/GeometricUtil.js +++ b/lib/features/bendpoints/GeometricUtil.js @@ -1,6 +1,6 @@ /** - * @typedef {import('../../util/Types').Point} Point - * @typedef {import('../../util/Types').Vector} Vector + * @typedef {import('../../util/Types.js').Point} Point + * @typedef {import('../../util/Types.js').Vector} Vector */ /** diff --git a/lib/features/bendpoints/index.js b/lib/features/bendpoints/index.js index c43a52492..f5282239d 100644 --- a/lib/features/bendpoints/index.js +++ b/lib/features/bendpoints/index.js @@ -1,11 +1,11 @@ -import DraggingModule from '../dragging'; -import RulesModule from '../rules'; +import DraggingModule from '../dragging/index.js'; +import RulesModule from '../rules/index.js'; -import Bendpoints from './Bendpoints'; -import BendpointMove from './BendpointMove'; -import BendpointMovePreview from './BendpointMovePreview'; -import ConnectionSegmentMove from './ConnectionSegmentMove'; -import BendpointSnapping from './BendpointSnapping'; +import Bendpoints from './Bendpoints.js'; +import BendpointMove from './BendpointMove.js'; +import BendpointMovePreview from './BendpointMovePreview.js'; +import ConnectionSegmentMove from './ConnectionSegmentMove.js'; +import BendpointSnapping from './BendpointSnapping.js'; /** diff --git a/lib/features/change-support/ChangeSupport.js b/lib/features/change-support/ChangeSupport.js index 206c44347..c72ec1e5f 100644 --- a/lib/features/change-support/ChangeSupport.js +++ b/lib/features/change-support/ChangeSupport.js @@ -1,12 +1,12 @@ import { getType as getElementType -} from '../../util/Elements'; +} from '../../util/Elements.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../../core/GraphicsFactory').default} GraphicsFactory + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../../core/GraphicsFactory.js').default} GraphicsFactory */ /** diff --git a/lib/features/change-support/index.js b/lib/features/change-support/index.js index 17d462cef..8ac28a30a 100644 --- a/lib/features/change-support/index.js +++ b/lib/features/change-support/index.js @@ -1,4 +1,4 @@ -import ChangeSupport from './ChangeSupport'; +import ChangeSupport from './ChangeSupport.js'; /** diff --git a/lib/features/clipboard/index.js b/lib/features/clipboard/index.js index d4efeacde..347907baa 100644 --- a/lib/features/clipboard/index.js +++ b/lib/features/clipboard/index.js @@ -1,4 +1,4 @@ -import Clipboard from './Clipboard'; +import Clipboard from './Clipboard.js'; /** diff --git a/lib/features/complex-preview/ComplexPreview.js b/lib/features/complex-preview/ComplexPreview.js index b93e74c27..1d7daaba6 100644 --- a/lib/features/complex-preview/ComplexPreview.js +++ b/lib/features/complex-preview/ComplexPreview.js @@ -3,17 +3,17 @@ import { create as svgCreate } from 'tiny-svg'; -import { getVisual } from '../../util/GraphicsUtil'; +import { getVisual } from '../../util/GraphicsUtil.js'; -import { isConnection } from '../../util/ModelUtil'; +import { isConnection } from '../../util/ModelUtil.js'; -import { translate } from '../../util/SvgTransformUtil'; +import { translate } from '../../util/SvgTransformUtil.js'; /** - * @typedef {import('../../model/Types').Element} Element - * @typedef {import('../../model/Types').Shape} Shape - * @typedef {import('../../util/Types').Point} Point - * @typedef {import('../../util/Types').Rect} Rect + * @typedef {import('../../model/Types.js').Element} Element + * @typedef {import('../../model/Types.js').Shape} Shape + * @typedef {import('../../util/Types.js').Point} Point + * @typedef {import('../../util/Types.js').Rect} Rect * * @typedef { { element: Element, delta: Point } } MovedOption * @typedef { { shape: Shape, bounds: Rect } } ResizedOption diff --git a/lib/features/complex-preview/index.js b/lib/features/complex-preview/index.js index 8d6dbe5b0..935752149 100644 --- a/lib/features/complex-preview/index.js +++ b/lib/features/complex-preview/index.js @@ -1,6 +1,6 @@ -import PreviewSupportModule from '../preview-support'; +import PreviewSupportModule from '../preview-support/index.js'; -import ComplexPreview from './ComplexPreview'; +import ComplexPreview from './ComplexPreview.js'; /** * @type { import('didi').ModuleDeclaration } diff --git a/lib/features/connect/Connect.js b/lib/features/connect/Connect.js index 779993d8e..a9ba5a65d 100644 --- a/lib/features/connect/Connect.js +++ b/lib/features/connect/Connect.js @@ -1,21 +1,21 @@ -import { - getMid -} from '../../layout/LayoutUtil'; - import { isNil, isObject } from 'min-dash'; +import { + getMid +} from '../../layout/LayoutUtil.js'; + /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules */ /** diff --git a/lib/features/connect/ConnectPreview.js b/lib/features/connect/ConnectPreview.js index 90cb4f906..bad847221 100644 --- a/lib/features/connect/ConnectPreview.js +++ b/lib/features/connect/ConnectPreview.js @@ -1,10 +1,10 @@ -import { isReverse } from './Connect'; +import { isReverse } from './Connect.js'; /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus */ var HIGH_PRIORITY = 1100, diff --git a/lib/features/connect/index.js b/lib/features/connect/index.js index b8174d2fb..c164b5beb 100644 --- a/lib/features/connect/index.js +++ b/lib/features/connect/index.js @@ -1,9 +1,9 @@ -import SelectionModule from '../selection'; -import RulesModule from '../rules'; -import DraggingModule from '../dragging'; +import SelectionModule from '../selection/index.js'; +import RulesModule from '../rules/index.js'; +import DraggingModule from '../dragging/index.js'; -import Connect from './Connect'; -import ConnectPreview from './ConnectPreview'; +import Connect from './Connect.js'; +import ConnectPreview from './ConnectPreview.js'; /** diff --git a/lib/features/connection-preview/ConnectionPreview.js b/lib/features/connection-preview/ConnectionPreview.js index 544baef7a..a19afc749 100644 --- a/lib/features/connection-preview/ConnectionPreview.js +++ b/lib/features/connection-preview/ConnectionPreview.js @@ -14,24 +14,24 @@ import { import { getElementLineIntersection, getMid -} from '../../layout/LayoutUtil'; +} from '../../layout/LayoutUtil.js'; import { createLine -} from '../../util/RenderUtil'; +} from '../../util/RenderUtil.js'; /** - * @typedef {import('../../model/Types').Element} Element - * @typedef {import('../../model/Types').Connection} Connection - * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../model/Types.js').Element} Element + * @typedef {import('../../model/Types.js').Connection} Connection + * @typedef {import('../../model/Types.js').Shape} Shape * - * @typedef {import('didi').Injector} Injector + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/ElementFactory').default} ElementFactory - * @typedef {import('../../core/GraphicsFactory').default} GraphicsFactory + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/ElementFactory.js').default} ElementFactory + * @typedef {import('../../core/GraphicsFactory.js').default} GraphicsFactory */ var MARKER_CONNECTION_PREVIEW = 'djs-dragger'; diff --git a/lib/features/connection-preview/index.js b/lib/features/connection-preview/index.js index d95acfce2..96c12e378 100644 --- a/lib/features/connection-preview/index.js +++ b/lib/features/connection-preview/index.js @@ -1,4 +1,4 @@ -import ConnectionPreview from './ConnectionPreview'; +import ConnectionPreview from './ConnectionPreview.js'; /** diff --git a/lib/features/context-pad/ContextPad.js b/lib/features/context-pad/ContextPad.js index c811e2c91..7b61805b6 100644 --- a/lib/features/context-pad/ContextPad.js +++ b/lib/features/context-pad/ContextPad.js @@ -17,28 +17,28 @@ import { domify as domify } from 'min-dom'; -import { getBBox } from '../../util/Elements'; +import { getBBox } from '../../util/Elements.js'; import { escapeCSS -} from '../../util/EscapeUtil'; +} from '../../util/EscapeUtil.js'; -import { isConnection } from '../../util/ModelUtil'; +import { isConnection } from '../../util/ModelUtil.js'; /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../../util/Types').Rect} Rect + * @typedef {import('../../util/Types.js').Rect} Rect * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../overlays/Overlays').default} Overlays + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../overlays/Overlays.js').default} Overlays * - * @typedef {import('../overlays/Overlays').Overlay} Overlay + * @typedef {import('../overlays/Overlays.js').Overlay} Overlay * - * @typedef {import('./ContextPadProvider').default} ContextPadProvider - * @typedef {import('./ContextPadProvider').ContextPadEntries} ContextPadEntries + * @typedef {import('./ContextPadProvider.js').default} ContextPadProvider + * @typedef {import('./ContextPadProvider.js').ContextPadEntries} ContextPadEntries * * @typedef { { * scale?: { diff --git a/lib/features/context-pad/ContextPad.spec.ts b/lib/features/context-pad/ContextPad.spec.ts index 12d5012f4..4b384dfa4 100644 --- a/lib/features/context-pad/ContextPad.spec.ts +++ b/lib/features/context-pad/ContextPad.spec.ts @@ -1,11 +1,11 @@ -import Diagram from '../../Diagram'; +import Diagram from '../../Diagram.js'; -import ElementFactory from '../../core/ElementFactory'; +import ElementFactory from '../../core/ElementFactory.js'; -import ContextPadModule from '.'; -import ContextPad from './ContextPad'; +import ContextPadModule from './index.js'; +import ContextPad from './ContextPad.js'; -import { FooContextPadProvider } from './ContextPadProvider.spec'; +import { FooContextPadProvider } from './ContextPadProvider.spec.js'; const diagram = new Diagram({ modules: [ diff --git a/lib/features/context-pad/ContextPadProvider.spec.ts b/lib/features/context-pad/ContextPadProvider.spec.ts index 047ec1792..0262077bf 100644 --- a/lib/features/context-pad/ContextPadProvider.spec.ts +++ b/lib/features/context-pad/ContextPadProvider.spec.ts @@ -1,6 +1,6 @@ -import ContextPadProvider, { ContextPadEntries } from './ContextPadProvider'; +import ContextPadProvider, { ContextPadEntries } from './ContextPadProvider.js'; -import { Element } from '../../model'; +import { Element } from '../../model/index.js'; export class FooContextPadProvider implements ContextPadProvider { getContextPadEntries(element: Element): ContextPadEntries { diff --git a/lib/features/context-pad/ContextPadProvider.ts b/lib/features/context-pad/ContextPadProvider.ts index fc18d6b12..866c20019 100644 --- a/lib/features/context-pad/ContextPadProvider.ts +++ b/lib/features/context-pad/ContextPadProvider.ts @@ -1,6 +1,6 @@ -import { Element } from '../../model/Types'; +import { Element } from '../../model/Types.js'; -import { ContextPadTarget } from './ContextPad'; +import { ContextPadTarget } from './ContextPad.js'; export type ContextPadEntry = { action: (event: Event, target: ContextPadTarget, autoActivate: boolean) => void; diff --git a/lib/features/context-pad/index.js b/lib/features/context-pad/index.js index eb0386812..cf1b8069b 100644 --- a/lib/features/context-pad/index.js +++ b/lib/features/context-pad/index.js @@ -1,7 +1,7 @@ -import InteractionEventsModule from '../interaction-events'; -import OverlaysModule from '../overlays'; +import InteractionEventsModule from '../interaction-events/index.js'; +import OverlaysModule from '../overlays/index.js'; -import ContextPad from './ContextPad'; +import ContextPad from './ContextPad.js'; /** diff --git a/lib/features/copy-paste/CopyPaste.js b/lib/features/copy-paste/CopyPaste.js index caaab18d2..d2721df56 100644 --- a/lib/features/copy-paste/CopyPaste.js +++ b/lib/features/copy-paste/CopyPaste.js @@ -12,30 +12,29 @@ import { import { getBBox, - getParents -} from '../../util/Elements'; - -import { eachElement } from '../../util/Elements'; + getParents, + eachElement +} from '../../util/Elements.js'; import { isConnection, isLabel -} from '../../util/ModelUtil'; +} from '../../util/ModelUtil.js'; /** - * @typedef {import('../../core/Types').ElementLike} Element - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ElementLike} Element + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../clipboard/Clipboard').default} Clipboard - * @typedef {import('../create/Create').default} Create - * @typedef {import('../../core/ElementFactory').default} ElementFactory - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../mouse/Mouse').default} Mouse - * @typedef {import('../rules/Rules').default} Rules + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../clipboard/Clipboard.js').default} Clipboard + * @typedef {import('../create/Create.js').default} Create + * @typedef {import('../../core/ElementFactory.js').default} ElementFactory + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../mouse/Mouse.js').default} Mouse + * @typedef {import('../rules/Rules.js').default} Rules */ /** diff --git a/lib/features/copy-paste/index.js b/lib/features/copy-paste/index.js index 5db04cb2a..ec32ba08b 100644 --- a/lib/features/copy-paste/index.js +++ b/lib/features/copy-paste/index.js @@ -1,9 +1,9 @@ -import ClipboardModule from '../clipboard'; -import CreateModule from '../create'; -import MouseModule from '../mouse'; -import RulesModule from '../rules'; +import ClipboardModule from '../clipboard/index.js'; +import CreateModule from '../create/index.js'; +import MouseModule from '../mouse/index.js'; +import RulesModule from '../rules/index.js'; -import CopyPaste from './CopyPaste'; +import CopyPaste from './CopyPaste.js'; /** diff --git a/lib/features/create/Create.js b/lib/features/create/Create.js index b8c7422e9..790270dfa 100644 --- a/lib/features/create/Create.js +++ b/lib/features/create/Create.js @@ -13,24 +13,24 @@ import { map } from 'min-dash'; -import { getBBox } from '../../util/Elements'; +import { getBBox } from '../../util/Elements.js'; import { isConnection, isLabel -} from '../../util/ModelUtil'; +} from '../../util/ModelUtil.js'; /** - * @typedef {import('../../core/Types').ElementLike} Element - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ElementLike} Element + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules */ var PREFIX = 'create'; diff --git a/lib/features/create/CreateConnectPreview.js b/lib/features/create/CreateConnectPreview.js index 348959966..7864aba73 100644 --- a/lib/features/create/CreateConnectPreview.js +++ b/lib/features/create/CreateConnectPreview.js @@ -3,7 +3,7 @@ var LOW_PRIORITY = 740; /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/EventBus.js').default} EventBus */ /** diff --git a/lib/features/create/CreatePreview.js b/lib/features/create/CreatePreview.js index 7d5b5972d..8d2cfde65 100644 --- a/lib/features/create/CreatePreview.js +++ b/lib/features/create/CreatePreview.js @@ -1,9 +1,3 @@ -import { - translate -} from '../../util/SvgTransformUtil'; - -import { getVisual } from '../../util/GraphicsUtil'; - import { append as svgAppend, attr as svgAttr, @@ -11,12 +5,18 @@ import { remove as svgRemove } from 'tiny-svg'; +import { + translate +} from '../../util/SvgTransformUtil.js'; + +import { getVisual } from '../../util/GraphicsUtil.js'; + /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../../core/GraphicsFactory').default} GraphicsFactory - * @typedef {import('../preview-support/PreviewSupport').default} PreviewSupport - * @typedef {import('../../draw/Styles').default} Styles + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../../core/GraphicsFactory.js').default} GraphicsFactory + * @typedef {import('../preview-support/PreviewSupport.js').default} PreviewSupport + * @typedef {import('../../draw/Styles.js').default} Styles */ var LOW_PRIORITY = 750; diff --git a/lib/features/create/index.js b/lib/features/create/index.js index 3906b2bcf..7602d3e49 100644 --- a/lib/features/create/index.js +++ b/lib/features/create/index.js @@ -1,10 +1,10 @@ -import DraggingModule from '../dragging'; -import PreviewSupportModule from '../preview-support'; -import RulesModule from '../rules'; -import SelectionModule from '../selection'; +import DraggingModule from '../dragging/index.js'; +import PreviewSupportModule from '../preview-support/index.js'; +import RulesModule from '../rules/index.js'; +import SelectionModule from '../selection/index.js'; -import Create from './Create'; -import CreatePreview from './CreatePreview'; +import Create from './Create.js'; +import CreatePreview from './CreatePreview.js'; /** diff --git a/lib/features/distribute-elements/DistributeElements.js b/lib/features/distribute-elements/DistributeElements.js index ca50695e8..ae3b47739 100644 --- a/lib/features/distribute-elements/DistributeElements.js +++ b/lib/features/distribute-elements/DistributeElements.js @@ -5,14 +5,14 @@ import { } from 'min-dash'; /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../../util/Types').Axis} Axis - * @typedef {import('../../util/Types').Dimension} Dimension - * @typedef {import('../../util/Types').Rect} Rect + * @typedef {import('../../util/Types.js').Axis} Axis + * @typedef {import('../../util/Types.js').Dimension} Dimension + * @typedef {import('../../util/Types.js').Rect} Rect * - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules * * @typedef { { * min: number; diff --git a/lib/features/distribute-elements/index.js b/lib/features/distribute-elements/index.js index 31f54cbfb..760fba710 100644 --- a/lib/features/distribute-elements/index.js +++ b/lib/features/distribute-elements/index.js @@ -1,4 +1,4 @@ -import DistributeElements from './DistributeElements'; +import DistributeElements from './DistributeElements.js'; /** diff --git a/lib/features/dragging/Dragging.js b/lib/features/dragging/Dragging.js index 127a66712..b6d66e7c8 100644 --- a/lib/features/dragging/Dragging.js +++ b/lib/features/dragging/Dragging.js @@ -1,5 +1,3 @@ -var round = Math.round; - import { assign } from 'min-dash'; import { @@ -10,30 +8,30 @@ import { getOriginal, toPoint, stopPropagation -} from '../../util/Event'; +} from '../../util/Event.js'; import { set as cursorSet, unset as cursorUnset -} from '../../util/Cursor'; +} from '../../util/Cursor.js'; import { install as installClickTrap -} from '../../util/ClickTrap'; +} from '../../util/ClickTrap.js'; import { delta as deltaPos -} from '../../util/PositionUtil'; +} from '../../util/PositionUtil.js'; -import { isKey } from '../keyboard/KeyboardUtil'; +import { isKey } from '../keyboard/KeyboardUtil.js'; /** - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../selection/Selection').default} Selection + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../selection/Selection.js').default} Selection */ var DRAG_ACTIVE_CLS = 'djs-drag-active'; @@ -217,8 +215,8 @@ export default function Dragging(eventBus, canvas, selection, elementRegistry) { // starting coordinates assign(payload, { - x: round(localStart.x + displacement.x), - y: round(localStart.y + displacement.y), + x: Math.round(localStart.x + displacement.x), + y: Math.round(localStart.y + displacement.y), dx: 0, dy: 0 }, { originalEvent: event }); @@ -252,10 +250,10 @@ export default function Dragging(eventBus, canvas, selection, elementRegistry) { // update payload with actual coordinates assign(payload, { - x: round(localCurrent.x + displacement.x), - y: round(localCurrent.y + displacement.y), - dx: round(localDelta.x), - dy: round(localDelta.y) + x: Math.round(localCurrent.x + displacement.x), + y: Math.round(localCurrent.y + displacement.y), + dx: Math.round(localDelta.x), + dy: Math.round(localDelta.y) }, { originalEvent: event }); // emit move event diff --git a/lib/features/dragging/index.js b/lib/features/dragging/index.js index 467749009..62bba8f1c 100644 --- a/lib/features/dragging/index.js +++ b/lib/features/dragging/index.js @@ -1,7 +1,7 @@ -import HoverFixModule from '../hover-fix'; -import SelectionModule from '../selection'; +import HoverFixModule from '../hover-fix/index.js'; +import SelectionModule from '../selection/index.js'; -import Dragging from './Dragging'; +import Dragging from './Dragging.js'; /** diff --git a/lib/features/editor-actions/EditorActions.js b/lib/features/editor-actions/EditorActions.js index 91f837bac..0ebb0bcf0 100644 --- a/lib/features/editor-actions/EditorActions.js +++ b/lib/features/editor-actions/EditorActions.js @@ -6,7 +6,7 @@ import { /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/EventBus.js').default} EventBus */ var NOT_REGISTERED_ERROR = 'is not a registered action', diff --git a/lib/features/editor-actions/index.js b/lib/features/editor-actions/index.js index 2ab7a2beb..931122d8f 100644 --- a/lib/features/editor-actions/index.js +++ b/lib/features/editor-actions/index.js @@ -1,4 +1,4 @@ -import EditorActions from './EditorActions'; +import EditorActions from './EditorActions.js'; /** diff --git a/lib/features/global-connect/GlobalConnect.js b/lib/features/global-connect/GlobalConnect.js index ec60aa1db..7062ece84 100644 --- a/lib/features/global-connect/GlobalConnect.js +++ b/lib/features/global-connect/GlobalConnect.js @@ -2,15 +2,15 @@ var MARKER_OK = 'connect-ok', MARKER_NOT_OK = 'connect-not-ok'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../connect/Connect').default} Connect - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../mouse/Mouse').default} Mouse - * @typedef {import('../rules/Rules').default} Rules - * @typedef {import('../tool-manager/ToolManager').default} ToolManager + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../connect/Connect.js').default} Connect + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../mouse/Mouse.js').default} Mouse + * @typedef {import('../rules/Rules.js').default} Rules + * @typedef {import('../tool-manager/ToolManager.js').default} ToolManager * - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element */ /** diff --git a/lib/features/global-connect/index.js b/lib/features/global-connect/index.js index 240ad4127..56f677a22 100644 --- a/lib/features/global-connect/index.js +++ b/lib/features/global-connect/index.js @@ -1,10 +1,10 @@ -import ConnectModule from '../connect'; -import RulesModule from '../rules'; -import DraggingModule from '../dragging'; -import ToolManagerModule from '../tool-manager'; -import MouseModule from '../mouse'; +import ConnectModule from '../connect/index.js'; +import RulesModule from '../rules/index.js'; +import DraggingModule from '../dragging/index.js'; +import ToolManagerModule from '../tool-manager/index.js'; +import MouseModule from '../mouse/index.js'; -import GlobalConnect from './GlobalConnect'; +import GlobalConnect from './GlobalConnect.js'; /** diff --git a/lib/features/grid-snapping/GridSnapping.js b/lib/features/grid-snapping/GridSnapping.js index ca8ec3b09..690a6b302 100644 --- a/lib/features/grid-snapping/GridSnapping.js +++ b/lib/features/grid-snapping/GridSnapping.js @@ -1,23 +1,23 @@ -import { - setSnapped, - isSnapped -} from '../snapping/SnapUtil'; - -import { isCmd } from '../keyboard/KeyboardUtil'; - import { assign, isNumber } from 'min-dash'; +import { + setSnapped, + isSnapped +} from '../snapping/SnapUtil.js'; + +import { isCmd } from '../keyboard/KeyboardUtil.js'; + import { SPACING, quantize -} from './GridUtil'; +} from './GridUtil.js'; /** - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus */ var LOWER_PRIORITY = 1200; diff --git a/lib/features/grid-snapping/behavior/ResizeBehavior.js b/lib/features/grid-snapping/behavior/ResizeBehavior.js index 72f55e9fa..155495780 100644 --- a/lib/features/grid-snapping/behavior/ResizeBehavior.js +++ b/lib/features/grid-snapping/behavior/ResizeBehavior.js @@ -1,19 +1,19 @@ import inherits from 'inherits-browser'; -import CommandInterceptor from '../../../command/CommandInterceptor'; - import { assign, isString } from 'min-dash'; +import CommandInterceptor from '../../../command/CommandInterceptor.js'; + /** - * @typedef {import('../../../model/Types').Shape} Shape + * @typedef {import('../../../model/Types.js').Shape} Shape * - * @typedef {import('../../../util/Types').Rect} Rect + * @typedef {import('../../../util/Types.js').Rect} Rect * - * @typedef {import('../../../core/EventBus').default} EventBus - * @typedef {import('../../grid-snapping/GridSnapping').default} GridSnapping + * @typedef {import('../../../core/EventBus.js').default} EventBus + * @typedef {import('../../grid-snapping/GridSnapping.js').default} GridSnapping */ /** diff --git a/lib/features/grid-snapping/behavior/SpaceToolBehavior.js b/lib/features/grid-snapping/behavior/SpaceToolBehavior.js index 4cd8118ed..fdfa8e2c9 100644 --- a/lib/features/grid-snapping/behavior/SpaceToolBehavior.js +++ b/lib/features/grid-snapping/behavior/SpaceToolBehavior.js @@ -1,6 +1,6 @@ /** - * @typedef {import('../../../core/EventBus').default} EventBus - * @typedef {import('../../grid-snapping/GridSnapping').default} GridSnapping + * @typedef {import('../../../core/EventBus.js').default} EventBus + * @typedef {import('../../grid-snapping/GridSnapping.js').default} GridSnapping */ var HIGH_PRIORITY = 2000; diff --git a/lib/features/grid-snapping/behavior/index.js b/lib/features/grid-snapping/behavior/index.js index 0755a11f9..fb824bd43 100644 --- a/lib/features/grid-snapping/behavior/index.js +++ b/lib/features/grid-snapping/behavior/index.js @@ -1,5 +1,5 @@ -import ResizeBehavior from './ResizeBehavior'; -import SpaceToolBehavior from './SpaceToolBehavior'; +import ResizeBehavior from './ResizeBehavior.js'; +import SpaceToolBehavior from './SpaceToolBehavior.js'; export default { __init__: [ diff --git a/lib/features/grid-snapping/index.js b/lib/features/grid-snapping/index.js index dbf213b8d..b470734f8 100644 --- a/lib/features/grid-snapping/index.js +++ b/lib/features/grid-snapping/index.js @@ -1,6 +1,6 @@ -import GridSnapping from './GridSnapping'; +import GridSnapping from './GridSnapping.js'; -import GridSnappingBehaviorModule from './behavior'; +import GridSnappingBehaviorModule from './behavior/index.js'; /** diff --git a/lib/features/hand-tool/HandTool.js b/lib/features/hand-tool/HandTool.js index fdd79da59..20d0c133b 100644 --- a/lib/features/hand-tool/HandTool.js +++ b/lib/features/hand-tool/HandTool.js @@ -1,17 +1,17 @@ import { hasPrimaryModifier -} from '../../util/Mouse'; +} from '../../util/Mouse.js'; -import { isKey } from '../../features/keyboard/KeyboardUtil'; +import { isKey } from '../../features/keyboard/KeyboardUtil.js'; /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../mouse/Mouse').default} Mouse - * @typedef {import('../tool-manager/ToolManager').default} ToolManager + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../mouse/Mouse.js').default} Mouse + * @typedef {import('../tool-manager/ToolManager.js').default} ToolManager */ var HIGH_PRIORITY = 1500; diff --git a/lib/features/hand-tool/index.js b/lib/features/hand-tool/index.js index 518939cb1..8a8173513 100644 --- a/lib/features/hand-tool/index.js +++ b/lib/features/hand-tool/index.js @@ -1,7 +1,7 @@ -import ToolManagerModule from '../tool-manager'; -import MouseModule from '../mouse'; +import ToolManagerModule from '../tool-manager/index.js'; +import MouseModule from '../mouse/index.js'; -import HandTool from './HandTool'; +import HandTool from './HandTool.js'; /** diff --git a/lib/features/hover-fix/HoverFix.js b/lib/features/hover-fix/HoverFix.js index c51c2e963..ccefaeed4 100644 --- a/lib/features/hover-fix/HoverFix.js +++ b/lib/features/hover-fix/HoverFix.js @@ -4,13 +4,13 @@ import { import { toPoint -} from '../../util/Event'; +} from '../../util/Event.js'; /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus */ var HIGH_PRIORITY = 1500; diff --git a/lib/features/hover-fix/index.js b/lib/features/hover-fix/index.js index 61027cafc..bc17abf50 100644 --- a/lib/features/hover-fix/index.js +++ b/lib/features/hover-fix/index.js @@ -1,4 +1,4 @@ -import HoverFix from './HoverFix'; +import HoverFix from './HoverFix.js'; /** diff --git a/lib/features/interaction-events/InteractionEvents.js b/lib/features/interaction-events/InteractionEvents.js index 9aeecef7d..44c33f5fd 100644 --- a/lib/features/interaction-events/InteractionEvents.js +++ b/lib/features/interaction-events/InteractionEvents.js @@ -9,11 +9,6 @@ import { queryAll as domQueryAll } from 'min-dom'; -import { - isPrimaryButton, - isAuxiliaryButton -} from '../../util/Mouse'; - import { append as svgAppend, attr as svgAttr, @@ -21,19 +16,24 @@ import { remove as svgRemove } from 'tiny-svg'; +import { + isPrimaryButton, + isAuxiliaryButton +} from '../../util/Mouse.js'; + import { createLine, updateLine -} from '../../util/RenderUtil'; +} from '../../util/RenderUtil.js'; /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../../draw/Styles').default} Styles + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../../draw/Styles.js').default} Styles * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point */ function allowAll(event) { return true; } diff --git a/lib/features/interaction-events/index.js b/lib/features/interaction-events/index.js index 35a912124..df01e85a7 100644 --- a/lib/features/interaction-events/index.js +++ b/lib/features/interaction-events/index.js @@ -1,4 +1,4 @@ -import InteractionEvents from './InteractionEvents'; +import InteractionEvents from './InteractionEvents.js'; /** diff --git a/lib/features/keyboard-move-selection/KeyboardMoveSelection.js b/lib/features/keyboard-move-selection/KeyboardMoveSelection.js index 64dffe122..3082e8aea 100644 --- a/lib/features/keyboard-move-selection/KeyboardMoveSelection.js +++ b/lib/features/keyboard-move-selection/KeyboardMoveSelection.js @@ -3,10 +3,10 @@ import { } from 'min-dash'; /** - * @typedef {import('../keyboard/Keyboard').default} Keyboard - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules - * @typedef {import('../selection/Selection').default} Selection + * @typedef {import('../keyboard/Keyboard.js').default} Keyboard + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules + * @typedef {import('../selection/Selection.js').default} Selection */ var DEFAULT_CONFIG = { diff --git a/lib/features/keyboard-move-selection/index.js b/lib/features/keyboard-move-selection/index.js index 74cd015cf..f5cac4315 100644 --- a/lib/features/keyboard-move-selection/index.js +++ b/lib/features/keyboard-move-selection/index.js @@ -1,7 +1,7 @@ -import KeyboardModule from '../keyboard'; -import SelectionModule from '../selection'; +import KeyboardModule from '../keyboard/index.js'; +import SelectionModule from '../selection/index.js'; -import KeyboardMoveSelection from './KeyboardMoveSelection'; +import KeyboardMoveSelection from './KeyboardMoveSelection.js'; /** diff --git a/lib/features/keyboard/Keyboard.js b/lib/features/keyboard/Keyboard.js index c15c10119..7e28dd11d 100644 --- a/lib/features/keyboard/Keyboard.js +++ b/lib/features/keyboard/Keyboard.js @@ -13,10 +13,10 @@ import { isCmd, isKey, isShift -} from './KeyboardUtil'; +} from './KeyboardUtil.js'; /** - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/EventBus.js').default} EventBus * * @typedef {({ keyEvent: KeyboardEvent }) => any} Listener */ diff --git a/lib/features/keyboard/KeyboardBindings.js b/lib/features/keyboard/KeyboardBindings.js index 9e4c8efea..d45129963 100644 --- a/lib/features/keyboard/KeyboardBindings.js +++ b/lib/features/keyboard/KeyboardBindings.js @@ -9,12 +9,12 @@ import { KEYS_PASTE, KEYS_UNDO, KEYS_REDO -} from './KeyboardUtil'; +} from './KeyboardUtil.js'; /** - * @typedef {import('../editor-actions/EditorActions').default} EditorActions - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('./Keyboard').default} Keyboard + * @typedef {import('../editor-actions/EditorActions.js').default} EditorActions + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('./Keyboard.js').default} Keyboard */ export { diff --git a/lib/features/keyboard/index.js b/lib/features/keyboard/index.js index 3500f109f..b01c64b45 100644 --- a/lib/features/keyboard/index.js +++ b/lib/features/keyboard/index.js @@ -1,5 +1,5 @@ -import Keyboard from './Keyboard'; -import KeyboardBindings from './KeyboardBindings'; +import Keyboard from './Keyboard.js'; +import KeyboardBindings from './KeyboardBindings.js'; /** diff --git a/lib/features/label-support/LabelSupport.js b/lib/features/label-support/LabelSupport.js index 4a615cf87..bd6cbbf77 100644 --- a/lib/features/label-support/LabelSupport.js +++ b/lib/features/label-support/LabelSupport.js @@ -5,27 +5,27 @@ import { import inherits from 'inherits-browser'; -var LOW_PRIORITY = 250, - HIGH_PRIORITY = 1400; - import { add as collectionAdd, indexOf as collectionIdx -} from '../../util/Collections'; +} from '../../util/Collections.js'; -import { saveClear } from '../../util/Removal'; +import { saveClear } from '../../util/Removal.js'; -import CommandInterceptor from '../../command/CommandInterceptor'; +import CommandInterceptor from '../../command/CommandInterceptor.js'; /** - * @typedef {import('../../model/Types').Element} Element - * * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling + * @typedef {import('../../model/Types.js').Element} Element + * + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling */ +var LOW_PRIORITY = 250, + HIGH_PRIORITY = 1400; + /** * A handler that makes sure labels are properly moved with * their label targets. diff --git a/lib/features/label-support/index.js b/lib/features/label-support/index.js index ae9352f2c..8b1c46afb 100644 --- a/lib/features/label-support/index.js +++ b/lib/features/label-support/index.js @@ -1,4 +1,4 @@ -import LabelSupport from './LabelSupport'; +import LabelSupport from './LabelSupport.js'; /** diff --git a/lib/features/lasso-tool/LassoTool.js b/lib/features/lasso-tool/LassoTool.js index a106aff36..6ec204d9c 100644 --- a/lib/features/lasso-tool/LassoTool.js +++ b/lib/features/lasso-tool/LassoTool.js @@ -1,10 +1,10 @@ import { values } from 'min-dash'; -import { getEnclosedElements } from '../../util/Elements'; +import { getEnclosedElements } from '../../util/Elements.js'; import { hasSecondaryModifier -} from '../../util/Mouse'; +} from '../../util/Mouse.js'; import { append as svgAppend, @@ -14,15 +14,15 @@ import { } from 'tiny-svg'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../mouse/Mouse').default} Mouse - * @typedef {import('../selection/Selection').default} Selection - * @typedef {import('../tool-manager/ToolManager').default} ToolManager + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../mouse/Mouse.js').default} Mouse + * @typedef {import('../selection/Selection.js').default} Selection + * @typedef {import('../tool-manager/ToolManager.js').default} ToolManager * - * @typedef {import('../../util/Types').Rect} Rect + * @typedef {import('../../util/Types.js').Rect} Rect */ var LASSO_TOOL_CURSOR = 'crosshair'; diff --git a/lib/features/lasso-tool/index.js b/lib/features/lasso-tool/index.js index 9d3f63b40..887a30de3 100644 --- a/lib/features/lasso-tool/index.js +++ b/lib/features/lasso-tool/index.js @@ -1,7 +1,7 @@ -import ToolManagerModule from '../tool-manager'; -import MouseModule from '../mouse'; +import ToolManagerModule from '../tool-manager/index.js'; +import MouseModule from '../mouse/index.js'; -import LassoTool from './LassoTool'; +import LassoTool from './LassoTool.js'; /** diff --git a/lib/features/modeling/Modeling.js b/lib/features/modeling/Modeling.js index bb981f590..1777de41c 100644 --- a/lib/features/modeling/Modeling.js +++ b/lib/features/modeling/Modeling.js @@ -4,47 +4,47 @@ import { isArray } from 'min-dash'; -import AlignElementsHandler from './cmd/AlignElementsHandler'; -import AppendShapeHandler from './cmd/AppendShapeHandler'; -import CreateConnectionHandler from './cmd/CreateConnectionHandler'; -import CreateElementsHandler from './cmd/CreateElementsHandler'; -import CreateLabelHandler from './cmd/CreateLabelHandler'; -import CreateShapeHandler from './cmd/CreateShapeHandler'; -import DeleteConnectionHandler from './cmd/DeleteConnectionHandler'; -import DeleteElementsHandler from './cmd/DeleteElementsHandler'; -import DeleteShapeHandler from './cmd/DeleteShapeHandler'; -import DistributeElementsHandler from './cmd/DistributeElementsHandler'; -import LayoutConnectionHandler from './cmd/LayoutConnectionHandler'; -import MoveConnectionHandler from './cmd/MoveConnectionHandler'; -import MoveElementsHandler from './cmd/MoveElementsHandler'; -import MoveShapeHandler from './cmd/MoveShapeHandler'; -import ReconnectConnectionHandler from './cmd/ReconnectConnectionHandler'; -import ReplaceShapeHandler from './cmd/ReplaceShapeHandler'; -import ResizeShapeHandler from './cmd/ResizeShapeHandler'; -import SpaceToolHandler from './cmd/SpaceToolHandler'; -import ToggleShapeCollapseHandler from './cmd/ToggleShapeCollapseHandler'; -import UpdateAttachmentHandler from './cmd/UpdateAttachmentHandler'; -import UpdateWaypointsHandler from './cmd/UpdateWaypointsHandler'; - -import { isModelElement } from '../../model'; +import AlignElementsHandler from './cmd/AlignElementsHandler.js'; +import AppendShapeHandler from './cmd/AppendShapeHandler.js'; +import CreateConnectionHandler from './cmd/CreateConnectionHandler.js'; +import CreateElementsHandler from './cmd/CreateElementsHandler.js'; +import CreateLabelHandler from './cmd/CreateLabelHandler.js'; +import CreateShapeHandler from './cmd/CreateShapeHandler.js'; +import DeleteConnectionHandler from './cmd/DeleteConnectionHandler.js'; +import DeleteElementsHandler from './cmd/DeleteElementsHandler.js'; +import DeleteShapeHandler from './cmd/DeleteShapeHandler.js'; +import DistributeElementsHandler from './cmd/DistributeElementsHandler.js'; +import LayoutConnectionHandler from './cmd/LayoutConnectionHandler.js'; +import MoveConnectionHandler from './cmd/MoveConnectionHandler.js'; +import MoveElementsHandler from './cmd/MoveElementsHandler.js'; +import MoveShapeHandler from './cmd/MoveShapeHandler.js'; +import ReconnectConnectionHandler from './cmd/ReconnectConnectionHandler.js'; +import ReplaceShapeHandler from './cmd/ReplaceShapeHandler.js'; +import ResizeShapeHandler from './cmd/ResizeShapeHandler.js'; +import SpaceToolHandler from './cmd/SpaceToolHandler.js'; +import ToggleShapeCollapseHandler from './cmd/ToggleShapeCollapseHandler.js'; +import UpdateAttachmentHandler from './cmd/UpdateAttachmentHandler.js'; +import UpdateWaypointsHandler from './cmd/UpdateWaypointsHandler.js'; + +import { isModelElement } from '../../model/index.js'; /** - * @typedef {import('../../model/Types').Element} Element - * @typedef {import('../../model/Types').Connection} Connection - * @typedef {import('../../model/Types').Parent} Parent - * @typedef {import('../../model/Types').Shape} Shape - * @typedef {import('../../model/Types').Label} Label - * - * @typedef {import('../../command/CommandStack').default} CommandStack - * @typedef {import('../../core/ElementFactory').default} ElementFactory - * @typedef {import('../../core/EventBus').default} EventBus - * - * @typedef {import('../../command/CommandStack').CommandHandlerConstructor} CommandHandlerConstructor - * - * @typedef {import('../../util/Types').Dimensions} Dimensions - * @typedef {import('../../util/Types').Direction} Direction - * @typedef {import('../../util/Types').Point} Point - * @typedef {import('../../util/Types').Rect} Rect + * @typedef {import('../../model/Types.js').Element} Element + * @typedef {import('../../model/Types.js').Connection} Connection + * @typedef {import('../../model/Types.js').Parent} Parent + * @typedef {import('../../model/Types.js').Shape} Shape + * @typedef {import('../../model/Types.js').Label} Label + * + * @typedef {import('../../command/CommandStack.js').default} CommandStack + * @typedef {import('../../core/ElementFactory.js').default} ElementFactory + * @typedef {import('../../core/EventBus.js').default} EventBus + * + * @typedef {import('../../command/CommandStack.js').CommandHandlerConstructor} CommandHandlerConstructor + * + * @typedef {import('../../util/Types.js').Dimensions} Dimensions + * @typedef {import('../../util/Types.js').Direction} Direction + * @typedef {import('../../util/Types.js').Point} Point + * @typedef {import('../../util/Types.js').Rect} Rect * * @typedef { 'x' | 'y' } ModelingDistributeAxis * diff --git a/lib/features/modeling/Modeling.spec.ts b/lib/features/modeling/Modeling.spec.ts index 73f8fc574..8e77f9407 100644 --- a/lib/features/modeling/Modeling.spec.ts +++ b/lib/features/modeling/Modeling.spec.ts @@ -1,9 +1,9 @@ -import Diagram from '../../Diagram'; +import Diagram from '../../Diagram.js'; -import ElementFactory from '../../core/ElementFactory'; +import ElementFactory from '../../core/ElementFactory.js'; -import ModelingModule from '.'; -import Modeling from './Modeling'; +import ModelingModule from './index.js'; +import Modeling from './Modeling.js'; import { Connection, @@ -11,7 +11,7 @@ import { Label, Root, Shape -} from '../../model'; +} from '../../model/index.js'; const diagram = new Diagram({ modules: [ diff --git a/lib/features/modeling/cmd/AlignElementsHandler.js b/lib/features/modeling/cmd/AlignElementsHandler.js index f4e707333..856b73e63 100644 --- a/lib/features/modeling/cmd/AlignElementsHandler.js +++ b/lib/features/modeling/cmd/AlignElementsHandler.js @@ -1,8 +1,11 @@ -import { forEach, isDefined } from 'min-dash'; +import { + forEach, + isDefined +} from 'min-dash'; /** - * @typedef {import('../../../core/Canvas').default} Canvas - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../../../core/Canvas.js').default} Canvas + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/AppendShapeHandler.js b/lib/features/modeling/cmd/AppendShapeHandler.js index 6aa60c6d7..1c40ee2d6 100644 --- a/lib/features/modeling/cmd/AppendShapeHandler.js +++ b/lib/features/modeling/cmd/AppendShapeHandler.js @@ -1,13 +1,13 @@ import { some } from 'min-dash'; /** - * @typedef {import('../../../model/Types').Element} Element - * @typedef {import('../../../model/Types').Parent} Parent - * @typedef {import('../../../model/Types').Shape} Shape + * @typedef {import('../../../model/Types.js').Element} Element + * @typedef {import('../../../model/Types.js').Parent} Parent + * @typedef {import('../../../model/Types.js').Shape} Shape * - * @typedef {import('../../../util/Types').Point} Point + * @typedef {import('../../../util/Types.js').Point} Point * - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/CreateConnectionHandler.js b/lib/features/modeling/cmd/CreateConnectionHandler.js index 2bf472596..c37cd5ed9 100644 --- a/lib/features/modeling/cmd/CreateConnectionHandler.js +++ b/lib/features/modeling/cmd/CreateConnectionHandler.js @@ -1,13 +1,13 @@ /** - * @typedef {import('../../../model/Types').Element} Element - * @typedef {import('../../../model/Types').Shape} Shape + * @typedef {import('../../../model/Types.js').Element} Element + * @typedef {import('../../../model/Types.js').Shape} Shape * - * @typedef {import('../../../util/Types').Point} Point + * @typedef {import('../../../util/Types.js').Point} Point * - * @typedef {import('../Modeling').ModelingHints} ModelingHints + * @typedef {import('../Modeling.js').ModelingHints} ModelingHints * - * @typedef {import('../../../core/Canvas').default} Canvas - * @typedef {import('../../../layout/BaseLayouter').default} Layouter + * @typedef {import('../../../core/Canvas.js').default} Canvas + * @typedef {import('../../../layout/BaseLayouter.js').default} Layouter */ /** diff --git a/lib/features/modeling/cmd/CreateElementsHandler.js b/lib/features/modeling/cmd/CreateElementsHandler.js index e5c3c4cfc..7742ad5a1 100644 --- a/lib/features/modeling/cmd/CreateElementsHandler.js +++ b/lib/features/modeling/cmd/CreateElementsHandler.js @@ -12,15 +12,15 @@ import { import { getBBox, getParents -} from '../../../util/Elements'; +} from '../../../util/Elements.js'; import { isConnection, isLabel -} from '../../../util/ModelUtil'; +} from '../../../util/ModelUtil.js'; /** - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ var round = Math.round; diff --git a/lib/features/modeling/cmd/CreateLabelHandler.js b/lib/features/modeling/cmd/CreateLabelHandler.js index c054b261a..ffcb11817 100644 --- a/lib/features/modeling/cmd/CreateLabelHandler.js +++ b/lib/features/modeling/cmd/CreateLabelHandler.js @@ -1,14 +1,14 @@ import inherits from 'inherits-browser'; -import CreateShapeHandler from './CreateShapeHandler'; +import CreateShapeHandler from './CreateShapeHandler.js'; /** - * @typedef {import('../../../core/Canvas').default} Canvas + * @typedef {import('../../../core/Canvas.js').default} Canvas * - * @typedef {import('../../../model/Types').Element} Element - * @typedef {import('../../../model/Types').Parent} Parent - * @typedef {import('../../../model/Types').Shape} Shape - * @typedef {import('../../../util/Types').Point} Point + * @typedef {import('../../../model/Types.js').Element} Element + * @typedef {import('../../../model/Types.js').Parent} Parent + * @typedef {import('../../../model/Types.js').Shape} Shape + * @typedef {import('../../../util/Types.js').Point} Point */ /** diff --git a/lib/features/modeling/cmd/CreateShapeHandler.js b/lib/features/modeling/cmd/CreateShapeHandler.js index 1c2b87dd7..707495fc9 100644 --- a/lib/features/modeling/cmd/CreateShapeHandler.js +++ b/lib/features/modeling/cmd/CreateShapeHandler.js @@ -1,14 +1,12 @@ import { assign } from 'min-dash'; /** - * @typedef {import('../../../model/Types').Element} Element - * @typedef {import('../../../util/Types').Point} Point + * @typedef {import('../../../model/Types.js').Element} Element + * @typedef {import('../../../util/Types.js').Point} Point * - * @typedef {import('../../../core/Canvas').default} Canvas + * @typedef {import('../../../core/Canvas.js').default} Canvas */ -var round = Math.round; - /** * A handler that implements reversible addition of shapes. @@ -54,8 +52,8 @@ CreateShapeHandler.prototype.execute = function(context) { assign(shape, positionOrBounds); } else { assign(shape, { - x: positionOrBounds.x - round(shape.width / 2), - y: positionOrBounds.y - round(shape.height / 2) + x: positionOrBounds.x - Math.round(shape.width / 2), + y: positionOrBounds.y - Math.round(shape.height / 2) }); } diff --git a/lib/features/modeling/cmd/DeleteConnectionHandler.js b/lib/features/modeling/cmd/DeleteConnectionHandler.js index 24c6b2ca8..c8b77a9d0 100644 --- a/lib/features/modeling/cmd/DeleteConnectionHandler.js +++ b/lib/features/modeling/cmd/DeleteConnectionHandler.js @@ -1,13 +1,13 @@ import { add as collectionAdd, indexOf as collectionIdx -} from '../../../util/Collections'; +} from '../../../util/Collections.js'; -import { saveClear } from '../../../util/Removal'; +import { saveClear } from '../../../util/Removal.js'; /** - * @typedef {import('../../../core/Canvas').default} Canvas - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../../../core/Canvas.js').default} Canvas + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/DeleteElementsHandler.js b/lib/features/modeling/cmd/DeleteElementsHandler.js index c9e44df20..7dd49a792 100644 --- a/lib/features/modeling/cmd/DeleteElementsHandler.js +++ b/lib/features/modeling/cmd/DeleteElementsHandler.js @@ -1,8 +1,8 @@ import { forEach } from 'min-dash'; /** - * @typedef {import('../../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/DeleteShapeHandler.js b/lib/features/modeling/cmd/DeleteShapeHandler.js index b67d4fda5..4cc2d4ea7 100644 --- a/lib/features/modeling/cmd/DeleteShapeHandler.js +++ b/lib/features/modeling/cmd/DeleteShapeHandler.js @@ -1,15 +1,15 @@ import { add as collectionAdd, indexOf as collectionIdx -} from '../../../util/Collections'; +} from '../../../util/Collections.js'; -import { saveClear } from '../../../util/Removal'; +import { saveClear } from '../../../util/Removal.js'; -import { isConnection } from '../../../util/ModelUtil'; +import { isConnection } from '../../../util/ModelUtil.js'; /** - * @typedef {import('../../../core/Canvas').default} Canvas - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../../../core/Canvas.js').default} Canvas + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/DistributeElementsHandler.js b/lib/features/modeling/cmd/DistributeElementsHandler.js index 53be4b55a..0417ae93a 100644 --- a/lib/features/modeling/cmd/DistributeElementsHandler.js +++ b/lib/features/modeling/cmd/DistributeElementsHandler.js @@ -4,7 +4,7 @@ import { } from 'min-dash'; /** - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/LayoutConnectionHandler.js b/lib/features/modeling/cmd/LayoutConnectionHandler.js index ea507b09a..5cf148c40 100644 --- a/lib/features/modeling/cmd/LayoutConnectionHandler.js +++ b/lib/features/modeling/cmd/LayoutConnectionHandler.js @@ -1,8 +1,8 @@ import { assign } from 'min-dash'; /** - * @typedef {import('../../../core/Canvas').default} Canvas - * @typedef {import('../../../layout/BaseLayouter').default} Layouter + * @typedef {import('../../../core/Canvas.js').default} Canvas + * @typedef {import('../../../layout/BaseLayouter.js').default} Layouter */ /** diff --git a/lib/features/modeling/cmd/MoveConnectionHandler.js b/lib/features/modeling/cmd/MoveConnectionHandler.js index de4d65323..62791eeb7 100644 --- a/lib/features/modeling/cmd/MoveConnectionHandler.js +++ b/lib/features/modeling/cmd/MoveConnectionHandler.js @@ -4,7 +4,7 @@ import { forEach } from 'min-dash'; import { add as collectionAdd, remove as collectionRemove -} from '../../../util/Collections'; +} from '../../../util/Collections.js'; /** diff --git a/lib/features/modeling/cmd/MoveElementsHandler.js b/lib/features/modeling/cmd/MoveElementsHandler.js index 8cf2bd25a..241580958 100644 --- a/lib/features/modeling/cmd/MoveElementsHandler.js +++ b/lib/features/modeling/cmd/MoveElementsHandler.js @@ -1,7 +1,7 @@ -import MoveHelper from './helper/MoveHelper'; +import MoveHelper from './helper/MoveHelper.js'; /** - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/MoveShapeHandler.js b/lib/features/modeling/cmd/MoveShapeHandler.js index 81565a06f..f82a7c5fe 100644 --- a/lib/features/modeling/cmd/MoveShapeHandler.js +++ b/lib/features/modeling/cmd/MoveShapeHandler.js @@ -4,20 +4,20 @@ import { pick } from 'min-dash'; -import MoveHelper from './helper/MoveHelper'; +import MoveHelper from './helper/MoveHelper.js'; import { add as collectionAdd, remove as collectionRemove -} from '../../../util/Collections'; +} from '../../../util/Collections.js'; import { getMovedSourceAnchor, getMovedTargetAnchor -} from './helper/AnchorsHelper'; +} from './helper/AnchorsHelper.js'; /** - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/ReconnectConnectionHandler.js b/lib/features/modeling/cmd/ReconnectConnectionHandler.js index 4114d41d7..4f69b6aae 100644 --- a/lib/features/modeling/cmd/ReconnectConnectionHandler.js +++ b/lib/features/modeling/cmd/ReconnectConnectionHandler.js @@ -1,7 +1,7 @@ import { isArray } from 'min-dash'; /** - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/ReplaceShapeHandler.js b/lib/features/modeling/cmd/ReplaceShapeHandler.js index 875632542..b4bd1fd4f 100644 --- a/lib/features/modeling/cmd/ReplaceShapeHandler.js +++ b/lib/features/modeling/cmd/ReplaceShapeHandler.js @@ -3,13 +3,13 @@ import { forEach } from 'min-dash'; import { getResizedSourceAnchor, getResizedTargetAnchor -} from './helper/AnchorsHelper'; +} from './helper/AnchorsHelper.js'; /** - * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('../../model/Types.js').Shape} Shape * - * @typedef {import('../Modeling').default} Modeling - * @typedef {import('../../rules/Rules').default} Rules + * @typedef {import('../Modeling.js').default} Modeling + * @typedef {import('../../rules/Rules.js').default} Rules */ /** diff --git a/lib/features/modeling/cmd/ResizeShapeHandler.js b/lib/features/modeling/cmd/ResizeShapeHandler.js index 73f6e4a17..74cade6a2 100644 --- a/lib/features/modeling/cmd/ResizeShapeHandler.js +++ b/lib/features/modeling/cmd/ResizeShapeHandler.js @@ -6,10 +6,10 @@ import { import { getResizedSourceAnchor, getResizedTargetAnchor -} from './helper/AnchorsHelper'; +} from './helper/AnchorsHelper.js'; /** - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/SpaceToolHandler.js b/lib/features/modeling/cmd/SpaceToolHandler.js index 11ce6828c..4c3c1a0dc 100644 --- a/lib/features/modeling/cmd/SpaceToolHandler.js +++ b/lib/features/modeling/cmd/SpaceToolHandler.js @@ -7,21 +7,22 @@ import { import { getWaypointsUpdatingConnections, resizeBounds -} from '../../space-tool/SpaceUtil'; +} from '../../space-tool/SpaceUtil.js'; import { getMovedSourceAnchor, getMovedTargetAnchor, getResizedSourceAnchor, getResizedTargetAnchor -} from './helper/AnchorsHelper'; +} from './helper/AnchorsHelper.js'; /** - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** - * Add or remove space by moving and resizing shapes and updating connection waypoints. + * Add or remove space by moving and resizing shapes and + * updating connection waypoints. * * @param {Modeling} modeling */ diff --git a/lib/features/modeling/cmd/ToggleShapeCollapseHandler.js b/lib/features/modeling/cmd/ToggleShapeCollapseHandler.js index ccfe61a7f..99bec0c1d 100644 --- a/lib/features/modeling/cmd/ToggleShapeCollapseHandler.js +++ b/lib/features/modeling/cmd/ToggleShapeCollapseHandler.js @@ -4,9 +4,9 @@ import { } from 'min-dash'; /** - * @typedef {import('../../model/Types').Shape} Shape + * @typedef {import('../../model/Types.js').Shape} Shape * - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/UpdateAttachmentHandler.js b/lib/features/modeling/cmd/UpdateAttachmentHandler.js index 2a6ecda04..d6f104984 100644 --- a/lib/features/modeling/cmd/UpdateAttachmentHandler.js +++ b/lib/features/modeling/cmd/UpdateAttachmentHandler.js @@ -1,10 +1,10 @@ import { add as collectionAdd, remove as collectionRemove -} from '../../../util/Collections'; +} from '../../../util/Collections.js'; /** - * @typedef {import('../Modeling').default} Modeling + * @typedef {import('../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/cmd/UpdateWaypointsHandler.js b/lib/features/modeling/cmd/UpdateWaypointsHandler.js index 393067058..42868166a 100644 --- a/lib/features/modeling/cmd/UpdateWaypointsHandler.js +++ b/lib/features/modeling/cmd/UpdateWaypointsHandler.js @@ -1,3 +1,7 @@ +/** + * A handler that implements reversible updating of + * connection waypoints. + */ export default function UpdateWaypointsHandler() { } UpdateWaypointsHandler.prototype.execute = function(context) { diff --git a/lib/features/modeling/cmd/helper/AnchorsHelper.js b/lib/features/modeling/cmd/helper/AnchorsHelper.js index 2863fedec..b7d698dfa 100644 --- a/lib/features/modeling/cmd/helper/AnchorsHelper.js +++ b/lib/features/modeling/cmd/helper/AnchorsHelper.js @@ -1,22 +1,22 @@ import { - getNewAttachPoint -} from '../../../../util/AttachUtil'; + filter, + map +} from 'min-dash'; import { - getOrientation -} from '../../../../layout/LayoutUtil'; + getNewAttachPoint +} from '../../../../util/AttachUtil.js'; import { - filter, - map -} from 'min-dash'; + getOrientation +} from '../../../../layout/LayoutUtil.js'; /** - * @typedef {import('../../../../core/Types').ConnectionLike} Connection - * @typedef {import('../../../../core/Types').ShapeLike} Shape + * @typedef {import('../../../../core/Types.js').ConnectionLike} Connection + * @typedef {import('../../../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../../../util/Types').Point} Point - * @typedef {import('../../../../util/Types').Rect} Rect + * @typedef {import('../../../../util/Types.js').Point} Point + * @typedef {import('../../../../util/Types.js').Rect} Rect */ /** diff --git a/lib/features/modeling/cmd/helper/MoveClosure.js b/lib/features/modeling/cmd/helper/MoveClosure.js index 0e4a7041f..105505d1c 100644 --- a/lib/features/modeling/cmd/helper/MoveClosure.js +++ b/lib/features/modeling/cmd/helper/MoveClosure.js @@ -4,12 +4,12 @@ import { import { getClosure -} from '../../../../util/Elements'; +} from '../../../../util/Elements.js'; /** - * @typedef {import('../../../../model/Types').Connection} Connection - * @typedef {import('../../../../model/Types').Element} Element - * @typedef {import('../../../../model/Types').Shape} Shape + * @typedef {import('../../../../model/Types.js').Connection} Connection + * @typedef {import('../../../../model/Types.js').Element} Element + * @typedef {import('../../../../model/Types.js').Shape} Shape */ export default function MoveClosure() { diff --git a/lib/features/modeling/cmd/helper/MoveHelper.js b/lib/features/modeling/cmd/helper/MoveHelper.js index e69f7cce9..e8409355e 100644 --- a/lib/features/modeling/cmd/helper/MoveHelper.js +++ b/lib/features/modeling/cmd/helper/MoveHelper.js @@ -5,17 +5,17 @@ import { import { getMovedSourceAnchor, getMovedTargetAnchor -} from './AnchorsHelper'; +} from './AnchorsHelper.js'; -import MoveClosure from './MoveClosure'; +import MoveClosure from './MoveClosure.js'; /** - * @typedef {import('../../../../core/Types').ElementLike} Element - * @typedef {import('../../../../core/Types').ShapeLike} Shape + * @typedef {import('../../../../core/Types.js').ElementLike} Element + * @typedef {import('../../../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../../../util/Types').Point} Point + * @typedef {import('../../../../util/Types.js').Point} Point * - * @typedef {import('../../Modeling').default} Modeling + * @typedef {import('../../Modeling.js').default} Modeling */ /** diff --git a/lib/features/modeling/index.js b/lib/features/modeling/index.js index 73cc7ca2b..8846e5d7d 100644 --- a/lib/features/modeling/index.js +++ b/lib/features/modeling/index.js @@ -1,10 +1,10 @@ -import CommandModule from '../../command'; -import ChangeSupportModule from '../change-support'; -import SelectionModule from '../selection'; -import RulesModule from '../rules'; +import CommandModule from '../../command/index.js'; +import ChangeSupportModule from '../change-support/index.js'; +import SelectionModule from '../selection/index.js'; +import RulesModule from '../rules/index.js'; -import Modeling from './Modeling'; -import BaseLayouter from '../../layout/BaseLayouter'; +import Modeling from './Modeling.js'; +import BaseLayouter from '../../layout/BaseLayouter.js'; /** diff --git a/lib/features/mouse/Mouse.js b/lib/features/mouse/Mouse.js index 945bcd244..2495bc6de 100644 --- a/lib/features/mouse/Mouse.js +++ b/lib/features/mouse/Mouse.js @@ -1,5 +1,5 @@ /** - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/EventBus.js').default} EventBus */ /** diff --git a/lib/features/mouse/index.js b/lib/features/mouse/index.js index 3295ca9db..4075e5077 100644 --- a/lib/features/mouse/index.js +++ b/lib/features/mouse/index.js @@ -1,4 +1,4 @@ -import Mouse from './Mouse'; +import Mouse from './Mouse.js'; /** diff --git a/lib/features/move/Move.js b/lib/features/move/Move.js index a01a17bdf..1b3861e48 100644 --- a/lib/features/move/Move.js +++ b/lib/features/move/Move.js @@ -9,33 +9,33 @@ import { classes as svgClasses } from 'tiny-svg'; +import { + getOriginal as getOriginalEvent +} from '../../util/Event.js'; + +import { + isPrimaryButton +} from '../../util/Mouse.js'; + /** - * @typedef {import('../../core/Types').ElementLike} Element - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ElementLike} Element + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules - * @typedef {import('../selection/Selection').default} Selection + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules + * @typedef {import('../selection/Selection.js').default} Selection */ var LOW_PRIORITY = 500, MEDIUM_PRIORITY = 1250, HIGH_PRIORITY = 1500; -import { getOriginal as getOriginalEvent } from '../../util/Event'; - -import { - isPrimaryButton -} from '../../util/Mouse'; - -var round = Math.round; - function mid(element) { return { - x: element.x + round(element.width / 2), - y: element.y + round(element.height / 2) + x: element.x + Math.round(element.width / 2), + y: element.y + Math.round(element.height / 2) }; } @@ -165,8 +165,8 @@ export default function MoveEvents( // ensure we have actual pixel values deltas // (important when zoom level was > 1 during move) - delta.x = round(delta.x); - delta.y = round(delta.y); + delta.x = Math.round(delta.x); + delta.y = Math.round(delta.y); if (delta.x === 0 && delta.y === 0) { diff --git a/lib/features/move/MovePreview.js b/lib/features/move/MovePreview.js index 3da4c6e7d..6e0093915 100644 --- a/lib/features/move/MovePreview.js +++ b/lib/features/move/MovePreview.js @@ -9,10 +9,6 @@ import { size } from 'min-dash'; -import { - selfAndAllChildren -} from '../../util/Elements'; - import { append as svgAppend, attr as svgAttr, @@ -20,17 +16,21 @@ import { remove as svgRemove } from 'tiny-svg'; -import { translate } from '../../util/SvgTransformUtil'; +import { + selfAndAllChildren +} from '../../util/Elements.js'; + +import { translate } from '../../util/SvgTransformUtil.js'; -import { isConnection } from '../../util/ModelUtil'; +import { isConnection } from '../../util/ModelUtil.js'; /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../preview-support/PreviewSupport').default} PreviewSupport - * @typedef {import('../../draw/Styles').default} Styles + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../preview-support/PreviewSupport.js').default} PreviewSupport + * @typedef {import('../../draw/Styles.js').default} Styles */ var LOW_PRIORITY = 499; diff --git a/lib/features/move/index.js b/lib/features/move/index.js index 7deb7a658..07df623a4 100644 --- a/lib/features/move/index.js +++ b/lib/features/move/index.js @@ -1,12 +1,12 @@ -import InteractionEventsModule from '../interaction-events'; -import SelectionModule from '../selection'; -import OutlineModule from '../outline'; -import RulesModule from '../rules'; -import DraggingModule from '../dragging'; -import PreviewSupportModule from '../preview-support'; +import InteractionEventsModule from '../interaction-events/index.js'; +import SelectionModule from '../selection/index.js'; +import OutlineModule from '../outline/index.js'; +import RulesModule from '../rules/index.js'; +import DraggingModule from '../dragging/index.js'; +import PreviewSupportModule from '../preview-support/index.js'; -import Move from './Move'; -import MovePreview from './MovePreview'; +import Move from './Move.js'; +import MovePreview from './MovePreview.js'; /** diff --git a/lib/features/ordering/OrderingProvider.js b/lib/features/ordering/OrderingProvider.js index 9c65f6153..883a3428d 100644 --- a/lib/features/ordering/OrderingProvider.js +++ b/lib/features/ordering/OrderingProvider.js @@ -1,12 +1,12 @@ import inherits from 'inherits-browser'; -import CommandInterceptor from '../../command/CommandInterceptor'; +import CommandInterceptor from '../../command/CommandInterceptor.js'; /** - * @typedef {import('../../core/Types').ElementLike} Element - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ElementLike} Element + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/EventBus.js').default} EventBus */ /** diff --git a/lib/features/outline/Outline.js b/lib/features/outline/Outline.js index 804fefa5e..2ef04d322 100644 --- a/lib/features/outline/Outline.js +++ b/lib/features/outline/Outline.js @@ -1,7 +1,3 @@ -import { getBBox } from '../../util/Elements'; - -var LOW_PRIORITY = 500; - import { append as svgAppend, attr as svgAttr, @@ -18,16 +14,20 @@ import { isFunction } from 'min-dash'; -var DEFAULT_PRIORITY = 1000; +import { getBBox } from '../../util/Elements.js'; /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('./OutlineProvider').default} OutlineProvider - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../../draw/Styles').default} Styles + * @typedef {import('./OutlineProvider.js').default} OutlineProvider + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../../draw/Styles.js').default} Styles */ +var DEFAULT_PRIORITY = 1000; +var LOW_PRIORITY = 500; + + /** * @class * diff --git a/lib/features/outline/OutlineProvider.spec.ts b/lib/features/outline/OutlineProvider.spec.ts index c9260c277..0894866c3 100644 --- a/lib/features/outline/OutlineProvider.spec.ts +++ b/lib/features/outline/OutlineProvider.spec.ts @@ -3,9 +3,9 @@ import { create as svgCreate } from 'tiny-svg'; -import { Element } from '../../model/Types'; +import { Element } from '../../model/Types.js'; -import OutlineProvider, { Outline } from './OutlineProvider'; +import OutlineProvider, { Outline } from './OutlineProvider.js'; export class FooOutlineProvider implements OutlineProvider { getOutline(element: Element): Outline { diff --git a/lib/features/outline/OutlineProvider.ts b/lib/features/outline/OutlineProvider.ts index 76a6fa2a2..9e8c65805 100644 --- a/lib/features/outline/OutlineProvider.ts +++ b/lib/features/outline/OutlineProvider.ts @@ -1,4 +1,4 @@ -import { Element } from '../../model/Types'; +import { Element } from '../../model/Types.js'; export type Outline = SVGSVGElement | SVGCircleElement | SVGRectElement; diff --git a/lib/features/outline/index.js b/lib/features/outline/index.js index c565faf1e..64a8bb475 100644 --- a/lib/features/outline/index.js +++ b/lib/features/outline/index.js @@ -1,4 +1,4 @@ -import Outline from './Outline'; +import Outline from './Outline.js'; /** diff --git a/lib/features/overlays/Overlays.js b/lib/features/overlays/Overlays.js index e4c6fc9d4..f916be4b7 100644 --- a/lib/features/overlays/Overlays.js +++ b/lib/features/overlays/Overlays.js @@ -21,21 +21,16 @@ import { import { getBBox -} from '../../util/Elements'; +} from '../../util/Elements.js'; -import Ids from '../../util/IdGenerator'; - -// document wide unique overlay ids -var ids = new Ids('ov'); - -var LOW_PRIORITY = 500; +import Ids from '../../util/IdGenerator.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus * - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * * @typedef { { * minZoom?: number, @@ -85,6 +80,11 @@ var LOW_PRIORITY = 500; * } | string } OverlaysFilter */ +// document wide unique overlay ids +var ids = new Ids('ov'); + +var LOW_PRIORITY = 500; + /** * A service that allows users to attach overlays to diagram elements. * diff --git a/lib/features/overlays/Overlays.spec.ts b/lib/features/overlays/Overlays.spec.ts index 1975f40b8..328e8db96 100644 --- a/lib/features/overlays/Overlays.spec.ts +++ b/lib/features/overlays/Overlays.spec.ts @@ -1,9 +1,9 @@ -import Diagram from '../../Diagram'; +import Diagram from '../../Diagram.js'; -import ElementFactory from '../../core/ElementFactory'; +import ElementFactory from '../../core/ElementFactory.js'; -import OverlaysModule from '.'; -import Overlays, { OverlayAttrs } from './Overlays'; +import OverlaysModule from './index.js'; +import Overlays, { OverlayAttrs } from './Overlays.js'; const diagram = new Diagram({ modules: [ diff --git a/lib/features/overlays/index.js b/lib/features/overlays/index.js index 4f22f6e47..8306861c4 100644 --- a/lib/features/overlays/index.js +++ b/lib/features/overlays/index.js @@ -1,4 +1,4 @@ -import Overlays from './Overlays'; +import Overlays from './Overlays.js'; /** diff --git a/lib/features/palette/Palette.js b/lib/features/palette/Palette.js index f8956fa3b..202d05a6a 100644 --- a/lib/features/palette/Palette.js +++ b/lib/features/palette/Palette.js @@ -17,14 +17,14 @@ import { import { escapeCSS -} from '../../util/EscapeUtil'; +} from '../../util/EscapeUtil.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus * - * @typedef {import('./PaletteProvider').PaletteEntries} PaletteEntries - * @typedef {import('./PaletteProvider').default} PaletteProvider + * @typedef {import('./PaletteProvider.js').PaletteEntries} PaletteEntries + * @typedef {import('./PaletteProvider.js').default} PaletteProvider */ var TOGGLE_SELECTOR = '.djs-palette-toggle', diff --git a/lib/features/palette/Palette.spec.ts b/lib/features/palette/Palette.spec.ts index 262e34f5f..70172eacb 100644 --- a/lib/features/palette/Palette.spec.ts +++ b/lib/features/palette/Palette.spec.ts @@ -1,9 +1,9 @@ -import Diagram from '../../Diagram'; +import Diagram from '../../Diagram.js'; -import PaletteModule from '.'; -import Palette from './Palette'; +import PaletteModule from './index.js'; +import Palette from './Palette.js'; -import { FooPaletteProvider } from './PaletteProvider.spec'; +import { FooPaletteProvider } from './PaletteProvider.spec.js'; const diagram = new Diagram({ modules: [ diff --git a/lib/features/palette/PaletteProvider.spec.ts b/lib/features/palette/PaletteProvider.spec.ts index 04fac6dbc..297e3eeb2 100644 --- a/lib/features/palette/PaletteProvider.spec.ts +++ b/lib/features/palette/PaletteProvider.spec.ts @@ -1,4 +1,4 @@ -import PaletteProvider, { PaletteEntries, PaletteEntriesCallback } from './PaletteProvider'; +import PaletteProvider, { PaletteEntries, PaletteEntriesCallback } from './PaletteProvider.js'; export class FooPaletteProvider implements PaletteProvider { getPaletteEntries(): PaletteEntries { diff --git a/lib/features/palette/index.js b/lib/features/palette/index.js index 5dd94c5d8..99f5c49a3 100644 --- a/lib/features/palette/index.js +++ b/lib/features/palette/index.js @@ -1,4 +1,4 @@ -import Palette from './Palette'; +import Palette from './Palette.js'; /** diff --git a/lib/features/popup-menu/PopupMenu.js b/lib/features/popup-menu/PopupMenu.js index 89e406045..9f39f17da 100644 --- a/lib/features/popup-menu/PopupMenu.js +++ b/lib/features/popup-menu/PopupMenu.js @@ -1,7 +1,7 @@ import { render, html -} from '../../ui'; +} from '../../ui/index.js'; import { domify, @@ -17,21 +17,21 @@ import { isDefined } from 'min-dash'; -import PopupMenuComponent from './PopupMenuComponent'; +import PopupMenuComponent from './PopupMenuComponent.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('./PopupMenuProvider').PopupMenuEntries} PopupMenuEntries - * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry - * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntries} PopupMenuHeaderEntries - * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntry} PopupMenuHeaderEntry - * @typedef {import('./PopupMenuProvider').default} PopupMenuProvider + * @typedef {import('./PopupMenuProvider.js').PopupMenuEntries} PopupMenuEntries + * @typedef {import('./PopupMenuProvider.js').PopupMenuEntry} PopupMenuEntry + * @typedef {import('./PopupMenuProvider.js').PopupMenuHeaderEntries} PopupMenuHeaderEntries + * @typedef {import('./PopupMenuProvider.js').PopupMenuHeaderEntry} PopupMenuHeaderEntry + * @typedef {import('./PopupMenuProvider.js').default} PopupMenuProvider * - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * * @typedef { { * scale?: { diff --git a/lib/features/popup-menu/PopupMenu.spec.ts b/lib/features/popup-menu/PopupMenu.spec.ts index eb2dcb5af..fe1b87661 100644 --- a/lib/features/popup-menu/PopupMenu.spec.ts +++ b/lib/features/popup-menu/PopupMenu.spec.ts @@ -1,12 +1,12 @@ -import Diagram from '../../Diagram'; +import Diagram from '../../Diagram.js'; -import ElementFactory from '../../core/ElementFactory'; +import ElementFactory from '../../core/ElementFactory.js'; -import PopupMenuModule from '.'; -import PopupMenu from './PopupMenu'; -import { PopupMenuEntry } from './PopupMenuProvider'; +import PopupMenuModule from './index.js'; +import PopupMenu from './PopupMenu.js'; +import { PopupMenuEntry } from './PopupMenuProvider.js'; -import { FooPopupMenuProvider } from './PopupMenuProvider.spec'; +import { FooPopupMenuProvider } from './PopupMenuProvider.spec.js'; const diagram = new Diagram({ modules: [ diff --git a/lib/features/popup-menu/PopupMenuComponent.js b/lib/features/popup-menu/PopupMenuComponent.js index 0561d22ed..d791338c6 100644 --- a/lib/features/popup-menu/PopupMenuComponent.js +++ b/lib/features/popup-menu/PopupMenuComponent.js @@ -1,3 +1,15 @@ +import classNames from 'clsx'; + +import { + isDefined, + isFunction +} from 'min-dash'; + +import { + closest as domClosest, + matches as domMatches +} from 'min-dom'; + import { useEffect, useRef, @@ -6,23 +18,16 @@ import { html, useMemo, useCallback -} from '../../ui'; +} from '../../ui/index.js'; -import { - closest as domClosest, - matches as domMatches -} from 'min-dom'; - -import PopupMenuList from './PopupMenuList'; -import classNames from 'clsx'; -import { isDefined, isFunction } from 'min-dash'; +import PopupMenuList from './PopupMenuList.js'; /** - * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry - * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntry} PopupMenuHeaderEntry - * @typedef {import('./PopupMenuProvider').PopupMenuEmptyPlaceholderProvider | import('./PopupMenuProvider').PopupMenuEmptyPlaceholder} PopupMenuEmptyPlaceholder + * @typedef {import('./PopupMenuProvider.js').PopupMenuEntry} PopupMenuEntry + * @typedef {import('./PopupMenuProvider.js').PopupMenuHeaderEntry} PopupMenuHeaderEntry + * @typedef {import('./PopupMenuProvider.js').PopupMenuEmptyPlaceholderProvider | import('./PopupMenuProvider.js').PopupMenuEmptyPlaceholder} PopupMenuEmptyPlaceholder * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point */ /** diff --git a/lib/features/popup-menu/PopupMenuItem.js b/lib/features/popup-menu/PopupMenuItem.js index 368ea710b..d727845bc 100644 --- a/lib/features/popup-menu/PopupMenuItem.js +++ b/lib/features/popup-menu/PopupMenuItem.js @@ -2,10 +2,10 @@ import classNames from 'clsx'; import { html -} from '../../ui'; +} from '../../ui/index.js'; /** - * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry + * @typedef {import('./PopupMenuProvider.js').PopupMenuEntry} PopupMenuEntry */ /** diff --git a/lib/features/popup-menu/PopupMenuList.js b/lib/features/popup-menu/PopupMenuList.js index fd6a9b335..5378585ab 100644 --- a/lib/features/popup-menu/PopupMenuList.js +++ b/lib/features/popup-menu/PopupMenuList.js @@ -3,12 +3,12 @@ import { useMemo, useLayoutEffect, useRef -} from '../../ui'; +} from '../../ui/index.js'; -import PopupMenuItem from './PopupMenuItem'; +import PopupMenuItem from './PopupMenuItem.js'; /** - * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry + * @typedef {import('./PopupMenuProvider.js').PopupMenuEntry} PopupMenuEntry */ /** diff --git a/lib/features/popup-menu/PopupMenuProvider.spec.ts b/lib/features/popup-menu/PopupMenuProvider.spec.ts index 0344dfc2d..2ab6398cd 100644 --- a/lib/features/popup-menu/PopupMenuProvider.spec.ts +++ b/lib/features/popup-menu/PopupMenuProvider.spec.ts @@ -1,11 +1,11 @@ -import { PopupMenuTarget } from './PopupMenu'; +import { PopupMenuTarget } from './PopupMenu.js'; import PopupMenuProvider, { PopupMenuEntries, PopupMenuHeaderEntries, PopupMenuEntriesProvider, PopupMenuProviderHeaderEntriesProvider -} from './PopupMenuProvider'; +} from './PopupMenuProvider.js'; export class FooPopupMenuProvider implements PopupMenuProvider { getPopupMenuEntries(target: PopupMenuTarget): PopupMenuEntries { diff --git a/lib/features/popup-menu/PopupMenuProvider.ts b/lib/features/popup-menu/PopupMenuProvider.ts index 1fc4ef765..59b23df83 100644 --- a/lib/features/popup-menu/PopupMenuProvider.ts +++ b/lib/features/popup-menu/PopupMenuProvider.ts @@ -1,6 +1,6 @@ -import { VNode } from '@bpmn-io/diagram-js-ui'; +import { VNode } from '../../ui/index.js'; -import { PopupMenuTarget } from './PopupMenu'; +import { PopupMenuTarget } from './PopupMenu.js'; export type PopupMenuEntryAction = (event: Event, entry: PopupMenuEntry, action?: string) => any; diff --git a/lib/features/popup-menu/index.js b/lib/features/popup-menu/index.js index 366a636d0..92d3fdfc8 100644 --- a/lib/features/popup-menu/index.js +++ b/lib/features/popup-menu/index.js @@ -1,4 +1,4 @@ -import PopupMenu from './PopupMenu'; +import PopupMenu from './PopupMenu.js'; /** diff --git a/lib/features/preview-support/PreviewSupport.js b/lib/features/preview-support/PreviewSupport.js index 889e4c64e..9fccd5fbf 100644 --- a/lib/features/preview-support/PreviewSupport.js +++ b/lib/features/preview-support/PreviewSupport.js @@ -13,16 +13,16 @@ import { import { query as domQuery } from 'min-dom'; -import { getVisual } from '../../util/GraphicsUtil'; +import { getVisual } from '../../util/GraphicsUtil.js'; /** - * @typedef {import('../../core/Types').ElementLike} Element - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ElementLike} Element + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../../draw/Styles').default} Styles + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../../draw/Styles.js').default} Styles */ var MARKER_TYPES = [ diff --git a/lib/features/preview-support/index.js b/lib/features/preview-support/index.js index ea7171472..82f794ec0 100644 --- a/lib/features/preview-support/index.js +++ b/lib/features/preview-support/index.js @@ -1,4 +1,4 @@ -import PreviewSupport from './PreviewSupport'; +import PreviewSupport from './PreviewSupport.js'; /** diff --git a/lib/features/replace/Replace.js b/lib/features/replace/Replace.js index 1eb95023b..ae18abc9a 100644 --- a/lib/features/replace/Replace.js +++ b/lib/features/replace/Replace.js @@ -3,13 +3,12 @@ import { } from 'min-dash'; /** - * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling + * @typedef {import('diagram-js/lib/core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling * - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ShapeLike} Shape */ -var round = Math.round; /** * Service that allows replacing of elements. @@ -58,8 +57,8 @@ Replace.prototype.replaceElement = function(oldElement, attrs, hints) { height = attrs.height || oldElement.height, x = attrs.x || oldElement.x, y = attrs.y || oldElement.y, - centerX = round(x + width / 2), - centerY = round(y + height / 2); + centerX = Math.round(x + width / 2), + centerY = Math.round(y + height / 2); // modeling API requires center coordinates, // account for that when handling shape bounds diff --git a/lib/features/replace/index.js b/lib/features/replace/index.js index a4c4f7ff5..dc17b2b21 100644 --- a/lib/features/replace/index.js +++ b/lib/features/replace/index.js @@ -1,5 +1,5 @@ -import Replace from './Replace'; -import ReplaceSelectionBehavior from './ReplaceSelectionBehavior'; +import Replace from './Replace.js'; +import ReplaceSelectionBehavior from './ReplaceSelectionBehavior.js'; /** diff --git a/lib/features/resize/Resize.js b/lib/features/resize/Resize.js index c3cc21ebc..c30e59761 100644 --- a/lib/features/resize/Resize.js +++ b/lib/features/resize/Resize.js @@ -8,24 +8,24 @@ import { ensureConstraints, computeChildrenBBox, getMinResizeBounds -} from './ResizeUtil'; +} from './ResizeUtil.js'; import { asTRBL, getMid, roundBounds -} from '../../layout/LayoutUtil'; +} from '../../layout/LayoutUtil.js'; /** - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../util/Types').Direction} Direction - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Direction} Direction + * @typedef {import('../../util/Types.js').Point} Point * - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../rules/Rules').default} Rules + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../rules/Rules.js').default} Rules */ var DEFAULT_MIN_WIDTH = 10; diff --git a/lib/features/resize/ResizeHandles.js b/lib/features/resize/ResizeHandles.js index d5f04566a..187ce4e10 100644 --- a/lib/features/resize/ResizeHandles.js +++ b/lib/features/resize/ResizeHandles.js @@ -17,23 +17,23 @@ import { import { isPrimaryButton -} from '../../util/Mouse'; +} from '../../util/Mouse.js'; import { transform -} from '../../util/SvgTransformUtil'; +} from '../../util/SvgTransformUtil.js'; -import { getReferencePoint } from './Resize'; +import { getReferencePoint } from './Resize.js'; -import { isConnection } from '../../util/ModelUtil'; +import { isConnection } from '../../util/ModelUtil.js'; /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../resize/Resize').default} Resize - * @typedef {import('../selection/Selection').default} Selection + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../resize/Resize.js').default} Resize + * @typedef {import('../selection/Selection.js').default} Selection */ var HANDLE_OFFSET = -6, diff --git a/lib/features/resize/ResizePreview.js b/lib/features/resize/ResizePreview.js index 156590a29..94126bcd6 100644 --- a/lib/features/resize/ResizePreview.js +++ b/lib/features/resize/ResizePreview.js @@ -10,9 +10,9 @@ import { } from 'tiny-svg'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../preview-support/PreviewSupport').default} PreviewSupport + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../preview-support/PreviewSupport.js').default} PreviewSupport */ /** diff --git a/lib/features/resize/ResizeUtil.js b/lib/features/resize/ResizeUtil.js index 99542258b..970746e0b 100644 --- a/lib/features/resize/ResizeUtil.js +++ b/lib/features/resize/ResizeUtil.js @@ -3,30 +3,27 @@ import { isNumber } from 'min-dash'; -var max = Math.max, - min = Math.min; - -var DEFAULT_CHILD_BOX_PADDING = 20; - import { getBBox -} from '../../util/Elements'; +} from '../../util/Elements.js'; import { asTRBL, asBounds -} from '../../layout/LayoutUtil'; +} from '../../layout/LayoutUtil.js'; /** - * @typedef {import('../../core/Types').ElementLike} Element - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ElementLike} Element + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../util/Types').Direction} Direction - * @typedef {import('../../util/Types').Point} Point - * @typedef {import('../../util/Types').Rect} Rect - * @typedef {import('../../util/Types').RectTRBL} RectTRBL + * @typedef {import('../../util/Types.js').Direction} Direction + * @typedef {import('../../util/Types.js').Point} Point + * @typedef {import('../../util/Types.js').Rect} Rect + * @typedef {import('../../util/Types.js').RectTRBL} RectTRBL */ +var DEFAULT_CHILD_BOX_PADDING = 20; + /** * Substract a TRBL from another * @@ -120,11 +117,11 @@ function applyConstraints(attr, trbl, resizeConstraints) { maxValue = resizeConstraints.max && resizeConstraints.max[attr]; if (isNumber(minValue)) { - value = (/top|left/.test(attr) ? min : max)(value, minValue); + value = (/top|left/.test(attr) ? Math.min : Math.max)(value, minValue); } if (isNumber(maxValue)) { - value = (/top|left/.test(attr) ? max : min)(value, maxValue); + value = (/top|left/.test(attr) ? Math.max : Math.min)(value, maxValue); } return value; @@ -161,10 +158,10 @@ export function getMinResizeBounds(direction, currentBounds, minDimensions, chil var childrenBox = childrenBounds ? asTRBL(childrenBounds) : minBox; var combinedBox = { - top: min(minBox.top, childrenBox.top), - left: min(minBox.left, childrenBox.left), - bottom: max(minBox.bottom, childrenBox.bottom), - right: max(minBox.right, childrenBox.right) + top: Math.min(minBox.top, childrenBox.top), + left: Math.min(minBox.left, childrenBox.left), + bottom: Math.max(minBox.bottom, childrenBox.bottom), + right: Math.max(minBox.right, childrenBox.right) }; return asBounds(combinedBox); diff --git a/lib/features/resize/index.js b/lib/features/resize/index.js index 727b5b8db..a281528ff 100644 --- a/lib/features/resize/index.js +++ b/lib/features/resize/index.js @@ -1,10 +1,10 @@ -import RulesModule from '../rules'; -import DraggingModule from '../dragging'; -import PreviewSupportModule from '../preview-support'; +import RulesModule from '../rules/index.js'; +import DraggingModule from '../dragging/index.js'; +import PreviewSupportModule from '../preview-support/index.js'; -import Resize from './Resize'; -import ResizePreview from './ResizePreview'; -import ResizeHandles from './ResizeHandles'; +import Resize from './Resize.js'; +import ResizePreview from './ResizePreview.js'; +import ResizeHandles from './ResizeHandles.js'; /** diff --git a/lib/features/root-elements/RootElementsBehavior.js b/lib/features/root-elements/RootElementsBehavior.js index fb7301f55..7ec7f6bc5 100644 --- a/lib/features/root-elements/RootElementsBehavior.js +++ b/lib/features/root-elements/RootElementsBehavior.js @@ -1,11 +1,11 @@ import inherits from 'inherits-browser'; -import CommandInterceptor from '../../command/CommandInterceptor'; +import CommandInterceptor from '../../command/CommandInterceptor.js'; /** * @typedef {import('didi').Injector} Injector * - * @typedef {import('../../core/Canvas').default} Canvas + * @typedef {import('../../core/Canvas.js').default} Canvas */ /** diff --git a/lib/features/root-elements/index.js b/lib/features/root-elements/index.js index 85d1d8124..69746cc55 100644 --- a/lib/features/root-elements/index.js +++ b/lib/features/root-elements/index.js @@ -1,4 +1,4 @@ -import RootElementsBehavior from './RootElementsBehavior'; +import RootElementsBehavior from './RootElementsBehavior.js'; /** diff --git a/lib/features/rules/RuleProvider.js b/lib/features/rules/RuleProvider.js index d98093d64..fff420e3d 100644 --- a/lib/features/rules/RuleProvider.js +++ b/lib/features/rules/RuleProvider.js @@ -1,9 +1,9 @@ import inherits from 'inherits-browser'; -import CommandInterceptor from '../../command/CommandInterceptor'; +import CommandInterceptor from '../../command/CommandInterceptor.js'; /** - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/EventBus.js').default} EventBus */ /** diff --git a/lib/features/rules/Rules.js b/lib/features/rules/Rules.js index dc3a6c597..aceb4f858 100644 --- a/lib/features/rules/Rules.js +++ b/lib/features/rules/Rules.js @@ -9,7 +9,7 @@ * to perform the actual rule evaluation. Make sure to provide the * `commandStack` service with this module if you plan to use it. * - * Together with this implementation you may use the {@link import('./RuleProvider').default} + * Together with this implementation you may use the {@link import('./RuleProvider.js').default} * to implement your own rule checkers. * * This module is ment to be easily replaced, thus the tiny foot print. diff --git a/lib/features/rules/Rules.test.ts b/lib/features/rules/Rules.test.ts index 6cc68506b..079b8109e 100644 --- a/lib/features/rules/Rules.test.ts +++ b/lib/features/rules/Rules.test.ts @@ -1,7 +1,7 @@ -import Diagram from '../../Diagram'; +import Diagram from '../../Diagram.js'; -import RulesModule from '.'; -import Rules from './Rules'; +import RulesModule from './index.js'; +import Rules from './Rules.js'; const diagram = new Diagram({ modules: [ diff --git a/lib/features/rules/index.js b/lib/features/rules/index.js index 4c9040654..8d9881a2a 100644 --- a/lib/features/rules/index.js +++ b/lib/features/rules/index.js @@ -1,4 +1,4 @@ -import Rules from './Rules'; +import Rules from './Rules.js'; /** diff --git a/lib/features/search-pad/SearchPad.js b/lib/features/search-pad/SearchPad.js index d02eb39d3..b1a825c9f 100644 --- a/lib/features/search-pad/SearchPad.js +++ b/lib/features/search-pad/SearchPad.js @@ -10,27 +10,27 @@ import { import { getBBox as getBoundingBox -} from '../../util/Elements'; +} from '../../util/Elements.js'; import { escapeHTML -} from '../../util/EscapeUtil'; +} from '../../util/EscapeUtil.js'; -import { isKey } from '../keyboard/KeyboardUtil'; +import { isKey } from '../keyboard/KeyboardUtil.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../overlays/Overlays').default} Overlays - * @typedef {import('../selection/Selection').default} Selection + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../overlays/Overlays.js').default} Overlays + * @typedef {import('../selection/Selection.js').default} Selection * - * @typedef {import('../overlays/Overlays').OverlayAttrs} OverlayAttrs + * @typedef {import('../overlays/Overlays.js').OverlayAttrs} OverlayAttrs * - * @typedef {import('../../util/Types').Dimensions} Dimensions + * @typedef {import('../../util/Types.js').Dimensions} Dimensions * - * @typedef {import('./SearchPadProvider').default} SearchPadProvider - * @typedef {import('./SearchPadProvider').SearchResult} SearchResult - * @typedef {import('./SearchPadProvider').Token} Token + * @typedef {import('./SearchPadProvider.js').default} SearchPadProvider + * @typedef {import('./SearchPadProvider.js').SearchResult} SearchResult + * @typedef {import('./SearchPadProvider.js').Token} Token */ /** diff --git a/lib/features/search-pad/SearchPadProvider.ts b/lib/features/search-pad/SearchPadProvider.ts index 65eec51ae..12f2198e4 100644 --- a/lib/features/search-pad/SearchPadProvider.ts +++ b/lib/features/search-pad/SearchPadProvider.ts @@ -1,4 +1,4 @@ -import { Element } from '../../model/Types'; +import { Element } from '../../model/Types.js'; export type Token = { matched: string; diff --git a/lib/features/search-pad/SearchProvider.spec.ts b/lib/features/search-pad/SearchProvider.spec.ts index c9f647ca3..8315de949 100644 --- a/lib/features/search-pad/SearchProvider.spec.ts +++ b/lib/features/search-pad/SearchProvider.spec.ts @@ -1,6 +1,6 @@ -import SearchProvider, { SearchResult } from './SearchPadProvider'; +import SearchProvider, { SearchResult } from './SearchPadProvider.js'; -import { create } from '../../model'; +import { create } from '../../model/index.js'; export class FooSearchProvider implements SearchProvider { find(pattern: string): SearchResult[] { diff --git a/lib/features/search-pad/index.js b/lib/features/search-pad/index.js index bdc38a44b..c6021fc24 100644 --- a/lib/features/search-pad/index.js +++ b/lib/features/search-pad/index.js @@ -1,7 +1,7 @@ -import OverlaysModule from '../overlays'; -import SelectionModule from '../selection'; +import OverlaysModule from '../overlays/index.js'; +import SelectionModule from '../selection/index.js'; -import SearchPad from './SearchPad'; +import SearchPad from './SearchPad.js'; /** diff --git a/lib/features/selection/Selection.js b/lib/features/selection/Selection.js index 1f7908dd7..2c5863935 100644 --- a/lib/features/selection/Selection.js +++ b/lib/features/selection/Selection.js @@ -4,8 +4,8 @@ import { } from 'min-dash'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus */ /** diff --git a/lib/features/selection/Selection.test.ts b/lib/features/selection/Selection.test.ts index 099fd0ae3..610d5d8ed 100644 --- a/lib/features/selection/Selection.test.ts +++ b/lib/features/selection/Selection.test.ts @@ -1,9 +1,9 @@ -import Diagram from '../../Diagram'; +import Diagram from '../../Diagram.js'; -import ElementFactory from '../../core/ElementFactory'; +import ElementFactory from '../../core/ElementFactory.js'; -import SelectionModule from '.'; -import Selection from './Selection'; +import SelectionModule from './index.js'; +import Selection from './Selection.js'; const diagram = new Diagram({ modules: [ diff --git a/lib/features/selection/SelectionBehavior.js b/lib/features/selection/SelectionBehavior.js index e5ba72968..0cad4f602 100644 --- a/lib/features/selection/SelectionBehavior.js +++ b/lib/features/selection/SelectionBehavior.js @@ -1,7 +1,7 @@ import { hasSecondaryModifier, isPrimaryButton -} from '../../util/Mouse'; +} from '../../util/Mouse.js'; import { find, @@ -9,10 +9,10 @@ import { } from 'min-dash'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('./Selection').default} Selection + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('./Selection.js').default} Selection */ /** diff --git a/lib/features/selection/SelectionVisuals.js b/lib/features/selection/SelectionVisuals.js index a2183b262..ead98e3c2 100644 --- a/lib/features/selection/SelectionVisuals.js +++ b/lib/features/selection/SelectionVisuals.js @@ -11,12 +11,12 @@ import { create as svgCreate } from 'tiny-svg'; -import { getBBox } from '../../util/Elements'; +import { getBBox } from '../../util/Elements.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('./Selection').default} Selection + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('./Selection.js').default} Selection */ var MARKER_HOVER = 'hover', diff --git a/lib/features/selection/index.js b/lib/features/selection/index.js index 27cb76763..867dd7c3a 100644 --- a/lib/features/selection/index.js +++ b/lib/features/selection/index.js @@ -1,9 +1,9 @@ -import InteractionEventsModule from '../interaction-events'; -import OutlineModule from '../outline'; +import InteractionEventsModule from '../interaction-events/index.js'; +import OutlineModule from '../outline/index.js'; -import Selection from './Selection'; -import SelectionVisuals from './SelectionVisuals'; -import SelectionBehavior from './SelectionBehavior'; +import Selection from './Selection.js'; +import SelectionVisuals from './SelectionVisuals.js'; +import SelectionBehavior from './SelectionBehavior.js'; /** diff --git a/lib/features/snapping/CreateMoveSnapping.js b/lib/features/snapping/CreateMoveSnapping.js index 04f42271d..e257107c4 100644 --- a/lib/features/snapping/CreateMoveSnapping.js +++ b/lib/features/snapping/CreateMoveSnapping.js @@ -1,27 +1,27 @@ -import SnapContext from './SnapContext'; +import { + forEach, + isNumber +} from 'min-dash'; + +import SnapContext from './SnapContext.js'; import { getChildren, isSnapped, mid -} from './SnapUtil'; +} from './SnapUtil.js'; -import { isCmd } from '../keyboard/KeyboardUtil'; - -import { - forEach, - isNumber -} from 'min-dash'; +import { isCmd } from '../keyboard/KeyboardUtil.js'; import { isConnection, isLabel -} from '../../util/ModelUtil'; +} from '../../util/ModelUtil.js'; /** - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('./Snapping').default} Snapping + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('./Snapping.js').default} Snapping */ var HIGHER_PRIORITY = 1250; diff --git a/lib/features/snapping/ResizeSnapping.js b/lib/features/snapping/ResizeSnapping.js index 17e5d98fe..4575d2cf8 100644 --- a/lib/features/snapping/ResizeSnapping.js +++ b/lib/features/snapping/ResizeSnapping.js @@ -1,4 +1,6 @@ -import SnapContext from './SnapContext'; +import { forEach } from 'min-dash'; + +import SnapContext from './SnapContext.js'; import { bottomRight, @@ -6,25 +8,23 @@ import { isSnapped, setSnapped, topLeft, -} from './SnapUtil'; +} from './SnapUtil.js'; -import { isCmd } from '../keyboard/KeyboardUtil'; +import { isCmd } from '../keyboard/KeyboardUtil.js'; import { asTRBL, getMid -} from '../../layout/LayoutUtil'; - -import { forEach } from 'min-dash'; +} from '../../layout/LayoutUtil.js'; import { isConnection, isLabel -} from '../../util/ModelUtil'; +} from '../../util/ModelUtil.js'; /** - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('./Snapping').default} Snapping + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('./Snapping.js').default} Snapping */ var HIGHER_PRIORITY = 1250; diff --git a/lib/features/snapping/SnapContext.js b/lib/features/snapping/SnapContext.js index 8f576b25b..506b5fdda 100644 --- a/lib/features/snapping/SnapContext.js +++ b/lib/features/snapping/SnapContext.js @@ -4,14 +4,14 @@ import { import { snapTo -} from './SnapUtil'; +} from './SnapUtil.js'; /** - * @typedef {import('../../model/Types').Element} Element + * @typedef {import('../../model/Types.js').Element} Element * - * @typedef {import('../../util/Types').Axis} Axis - * @typedef {import('../../util/Types').DirectionTRBL} DirectionTRBL - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Axis} Axis + * @typedef {import('../../util/Types.js').DirectionTRBL} DirectionTRBL + * @typedef {import('../../util/Types.js').Point} Point * * @typedef {DirectionTRBL & 'mid'} SnapLocation */ diff --git a/lib/features/snapping/SnapUtil.js b/lib/features/snapping/SnapUtil.js index 941591314..1d2622f30 100644 --- a/lib/features/snapping/SnapUtil.js +++ b/lib/features/snapping/SnapUtil.js @@ -1,15 +1,12 @@ /** - * @typedef {import('../../core/Types').ConnectionLike} Connection - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ConnectionLike} Connection + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../core/EventBus').Event} Event + * @typedef {import('../../core/EventBus.js').Event} Event * - * @typedef {import('../../util/Types').Axis} Axis + * @typedef {import('../../util/Types.js').Axis} Axis */ -var abs = Math.abs, - round = Math.round; - /** * Snap value to a collection of reference values. @@ -28,7 +25,7 @@ export function snapTo(value, values, tolerance) { for (idx = 0; idx < values.length; idx++) { snapValue = values[idx]; - if (abs(snapValue - value) <= tolerance) { + if (Math.abs(snapValue - value) <= tolerance) { return snapValue; } } @@ -70,8 +67,8 @@ export function mid(bounds, defaultValue) { } return { - x: round(bounds.x + bounds.width / 2), - y: round(bounds.y + bounds.height / 2) + x: Math.round(bounds.x + bounds.width / 2), + y: Math.round(bounds.y + bounds.height / 2) }; } diff --git a/lib/features/snapping/Snapping.js b/lib/features/snapping/Snapping.js index 12d003574..ca4ccac51 100644 --- a/lib/features/snapping/Snapping.js +++ b/lib/features/snapping/Snapping.js @@ -6,11 +6,6 @@ import { isObject } from 'min-dash'; -import { - isSnapped, - setSnapped -} from './SnapUtil'; - import { append as svgAppend, attr as svgAttr, @@ -18,12 +13,17 @@ import { create as svgCreate } from 'tiny-svg'; +import { + isSnapped, + setSnapped +} from './SnapUtil.js'; + /** - * @typedef {import('../../core/Canvas').default} Canvas + * @typedef {import('../../core/Canvas.js').default} Canvas * - * @typedef {import('../../core/EventBus').Event} Event + * @typedef {import('../../core/EventBus.js').Event} Event * - * @typedef {import('./SnapContext').SnapPoints} SnapPoints + * @typedef {import('./SnapContext.js').SnapPoints} SnapPoints */ var SNAP_TOLERANCE = 7; diff --git a/lib/features/snapping/index.js b/lib/features/snapping/index.js index c21bac40e..90dba04bf 100644 --- a/lib/features/snapping/index.js +++ b/lib/features/snapping/index.js @@ -1,6 +1,6 @@ -import CreateMoveSnapping from './CreateMoveSnapping'; -import ResizeSnapping from './ResizeSnapping'; -import Snapping from './Snapping'; +import CreateMoveSnapping from './CreateMoveSnapping.js'; +import ResizeSnapping from './ResizeSnapping.js'; +import Snapping from './Snapping.js'; /** diff --git a/lib/features/space-tool/SpaceTool.js b/lib/features/space-tool/SpaceTool.js index 2d47cbfe4..ed1b66dfc 100644 --- a/lib/features/space-tool/SpaceTool.js +++ b/lib/features/space-tool/SpaceTool.js @@ -8,45 +8,42 @@ import { import { asTRBL, getMid -} from '../../layout/LayoutUtil'; +} from '../../layout/LayoutUtil.js'; -import { getBBox } from '../../util/Elements'; +import { getBBox } from '../../util/Elements.js'; -import { getDirection } from './SpaceUtil'; +import { getDirection } from './SpaceUtil.js'; import { hasPrimaryModifier, hasSecondaryModifier -} from '../../util/Mouse'; +} from '../../util/Mouse.js'; -import { set as setCursor } from '../../util/Cursor'; +import { set as setCursor } from '../../util/Cursor.js'; -import { selfAndAllChildren } from '../../util/Elements'; +import { selfAndAllChildren } from '../../util/Elements.js'; import { isConnection, isLabel -} from '../../util/ModelUtil'; +} from '../../util/ModelUtil.js'; /** - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../modeling/Modeling').default} Modeling - * @typedef {import('../mouse/Mouse').default} Mouse - * @typedef {import('../rules/Rules').default} Rules - * @typedef {import('../tool-manager/ToolManager').default} ToolManager + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../modeling/Modeling.js').default} Modeling + * @typedef {import('../mouse/Mouse.js').default} Mouse + * @typedef {import('../rules/Rules.js').default} Rules + * @typedef {import('../tool-manager/ToolManager.js').default} ToolManager * - * @typedef {import('../../util/Types').Axis} Axis - * @typedef {import('../../util/Types').Direction} Direction - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Axis} Axis + * @typedef {import('../../util/Types.js').Direction} Direction + * @typedef {import('../../util/Types.js').Point} Point */ -var abs = Math.abs, - round = Math.round; - var AXIS_TO_DIMENSION = { x: 'width', y: 'height' @@ -142,7 +139,7 @@ export default function SpaceTool( y: 0 }; - delta[ axis ] = round(event[ 'd' + axis ]); + delta[ axis ] = Math.round(event[ 'd' + axis ]); self.makeSpace(movingShapes, resizingShapes, delta, direction, start); @@ -221,11 +218,11 @@ SpaceTool.prototype.makeSpace = function(movingShapes, resizingShapes, delta, di * @return {boolean} */ SpaceTool.prototype.init = function(event, context) { - var axis = abs(event.dx) > abs(event.dy) ? 'x' : 'y', + var axis = Math.abs(event.dx) > Math.abs(event.dy) ? 'x' : 'y', delta = event[ 'd' + axis ], start = event[ axis ] - delta; - if (abs(delta) < 5) { + if (Math.abs(delta) < 5) { return false; } diff --git a/lib/features/space-tool/SpaceToolPreview.js b/lib/features/space-tool/SpaceToolPreview.js index 8addcedcd..3965080df 100644 --- a/lib/features/space-tool/SpaceToolPreview.js +++ b/lib/features/space-tool/SpaceToolPreview.js @@ -2,11 +2,6 @@ import { forEach } from 'min-dash'; -var MARKER_DRAGGING = 'djs-dragging', - MARKER_RESIZING = 'djs-resizing'; - -var LOW_PRIORITY = 250; - import { append as svgAppend, attr as svgAttr, @@ -17,18 +12,21 @@ import { import { translate -} from '../../util/SvgTransformUtil'; +} from '../../util/SvgTransformUtil.js'; -import { isConnection } from '../../util/ModelUtil'; +import { isConnection } from '../../util/ModelUtil.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../../core/EventBus').default} EventBus - * @typedef {import('../../draw/Styles').default} Styles + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../../core/EventBus.js').default} EventBus + * @typedef {import('../../draw/Styles.js').default} Styles */ -var max = Math.max; +var MARKER_DRAGGING = 'djs-dragging', + MARKER_RESIZING = 'djs-resizing'; + +var LOW_PRIORITY = 250; /** @@ -233,10 +231,10 @@ export default function SpaceToolPreview( if (context.direction === 'e') { svgAttr(element, { - width: max(initialBounds.width + delta.x, 5) + width: Math.max(initialBounds.width + delta.x, 5) }); } else { - width = max(initialBounds.width - delta.x, 5); + width = Math.max(initialBounds.width - delta.x, 5); svgAttr(element, { width: width, @@ -246,10 +244,10 @@ export default function SpaceToolPreview( if (context.direction === 's') { svgAttr(element, { - height: max(initialBounds.height + delta.y, 5) + height: Math.max(initialBounds.height + delta.y, 5) }); } else { - height = max(initialBounds.height - delta.y, 5); + height = Math.max(initialBounds.height - delta.y, 5); svgAttr(element, { height: height, diff --git a/lib/features/space-tool/SpaceUtil.js b/lib/features/space-tool/SpaceUtil.js index 8921a9251..b2d3ef22e 100644 --- a/lib/features/space-tool/SpaceUtil.js +++ b/lib/features/space-tool/SpaceUtil.js @@ -1,14 +1,15 @@ +import { forEach } from 'min-dash'; + /** - * @typedef {import('../../core/Types').ConnectionLike} Connection - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ConnectionLike} Connection + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../util/Types').Axis} Axis - * @typedef {import('../../util/Types').Direction} Direction - * @typedef {import('../../util/Types').Point} Point - * @typedef {import('../../util/Types').Rect} Rect + * @typedef {import('../../util/Types.js').Axis} Axis + * @typedef {import('../../util/Types.js').Direction} Direction + * @typedef {import('../../util/Types.js').Point} Point + * @typedef {import('../../util/Types.js').Rect} Rect */ -import { forEach } from 'min-dash'; /** * Return direction given axis and delta. diff --git a/lib/features/space-tool/index.js b/lib/features/space-tool/index.js index 714aa3c95..b206b3195 100644 --- a/lib/features/space-tool/index.js +++ b/lib/features/space-tool/index.js @@ -1,11 +1,11 @@ -import DraggingModule from '../dragging'; -import RulesModule from '../rules'; -import ToolManagerModule from '../tool-manager'; -import PreviewSupportModule from '../preview-support'; -import MouseModule from '../mouse'; +import DraggingModule from '../dragging/index.js'; +import RulesModule from '../rules/index.js'; +import ToolManagerModule from '../tool-manager/index.js'; +import PreviewSupportModule from '../preview-support/index.js'; +import MouseModule from '../mouse/index.js'; -import SpaceTool from './SpaceTool'; -import SpaceToolPreview from './SpaceToolPreview'; +import SpaceTool from './SpaceTool.js'; +import SpaceToolPreview from './SpaceToolPreview.js'; /** diff --git a/lib/features/tool-manager/ToolManager.js b/lib/features/tool-manager/ToolManager.js index d13e1b408..8ea58a535 100644 --- a/lib/features/tool-manager/ToolManager.js +++ b/lib/features/tool-manager/ToolManager.js @@ -7,10 +7,10 @@ import { } from 'min-dom'; /** - * @typedef {import('../dragging/Dragging').default} Dragging - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../dragging/Dragging.js').default} Dragging + * @typedef {import('../../core/EventBus.js').default} EventBus * - * @typedef {import('../../core/EventBus').Event} Event + * @typedef {import('../../core/EventBus.js').Event} Event */ var LOW_PRIORITY = 250; diff --git a/lib/features/tool-manager/index.js b/lib/features/tool-manager/index.js index ee32f9918..7b0215463 100644 --- a/lib/features/tool-manager/index.js +++ b/lib/features/tool-manager/index.js @@ -1,6 +1,6 @@ -import DraggingModule from '../dragging'; +import DraggingModule from '../dragging/index.js'; -import ToolManager from './ToolManager'; +import ToolManager from './ToolManager.js'; /** diff --git a/lib/features/tooltips/Tooltips.js b/lib/features/tooltips/Tooltips.js index 620f87a9a..4c40e6359 100644 --- a/lib/features/tooltips/Tooltips.js +++ b/lib/features/tooltips/Tooltips.js @@ -13,13 +13,13 @@ import { delegate as domDelegate } from 'min-dom'; -import Ids from '../../util/IdGenerator'; +import Ids from '../../util/IdGenerator.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus * - * @typedef {import('../../util/Types').RectTRBL} RectTRBL + * @typedef {import('../../util/Types.js').RectTRBL} RectTRBL * * @typedef { { * html: string | HTMLElement; diff --git a/lib/features/tooltips/index.js b/lib/features/tooltips/index.js index 33b45db3d..15b8f0f78 100644 --- a/lib/features/tooltips/index.js +++ b/lib/features/tooltips/index.js @@ -1,4 +1,4 @@ -import Tooltips from './Tooltips'; +import Tooltips from './Tooltips.js'; /** diff --git a/lib/i18n/I18N.js b/lib/i18n/I18N.js index 1fb31bb91..86a9a69ed 100644 --- a/lib/i18n/I18N.js +++ b/lib/i18n/I18N.js @@ -1,5 +1,5 @@ /** - * @typedef {import('../core/EventBus').default} EventBus + * @typedef {import('../core/EventBus.js').default} EventBus */ /** diff --git a/lib/i18n/index.js b/lib/i18n/index.js index 5220346c8..ca689fcc0 100644 --- a/lib/i18n/index.js +++ b/lib/i18n/index.js @@ -1,4 +1,4 @@ -import I18N from './I18N'; +import I18N from './I18N.js'; /** diff --git a/lib/i18n/translate/index.js b/lib/i18n/translate/index.js index 02bd94f35..f34f8a6ae 100644 --- a/lib/i18n/translate/index.js +++ b/lib/i18n/translate/index.js @@ -1,4 +1,4 @@ -import translate from './translate'; +import translate from './translate.js'; /** diff --git a/lib/i18n/translate/translate.spec.ts b/lib/i18n/translate/translate.spec.ts index 4d2a0a4f3..cda708bd6 100644 --- a/lib/i18n/translate/translate.spec.ts +++ b/lib/i18n/translate/translate.spec.ts @@ -1,4 +1,4 @@ -import translate from './translate'; +import translate from './translate.js'; translate('foo {{bar}}', { bar: 'baz' }); translate('foo {{bar}}'); \ No newline at end of file diff --git a/lib/layout/BaseLayouter.js b/lib/layout/BaseLayouter.js index 2d61e2e2f..03ee3b9e4 100644 --- a/lib/layout/BaseLayouter.js +++ b/lib/layout/BaseLayouter.js @@ -1,8 +1,8 @@ /** - * @typedef {import('../core/Types').ElementLike} Element - * @typedef {import('../core/Types').ConnectionLike} Connection + * @typedef {import('../core/Types.js').ElementLike} Element + * @typedef {import('../core/Types.js').ConnectionLike} Connection * - * @typedef {import('../util').Point} Point + * @typedef {import('../util/Types.js').Point} Point * * @typedef { { * connectionStart?: Point; @@ -14,7 +14,7 @@ import { getMid -} from './LayoutUtil'; +} from './LayoutUtil.js'; /** diff --git a/lib/layout/ConnectionDocking.js b/lib/layout/ConnectionDocking.js index a940c03bf..fe31230c7 100644 --- a/lib/layout/ConnectionDocking.js +++ b/lib/layout/ConnectionDocking.js @@ -1,9 +1,9 @@ /** - * @typedef {import('../../core/Types').ElementLike} Element - * @typedef {import('../../core/Types').ConnectionLike} Connection - * @typedef {import('../../core/Types').ShapeLike} Shape + * @typedef {import('../../core/Types.js').ElementLike} Element + * @typedef {import('../../core/Types.js').ConnectionLike} Connection + * @typedef {import('../../core/Types.js').ShapeLike} Shape * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point */ /** diff --git a/lib/layout/CroppingConnectionDocking.js b/lib/layout/CroppingConnectionDocking.js index 0c7b430bb..db91afe91 100644 --- a/lib/layout/CroppingConnectionDocking.js +++ b/lib/layout/CroppingConnectionDocking.js @@ -4,11 +4,11 @@ import { import { getElementLineIntersection -} from './LayoutUtil'; +} from './LayoutUtil.js'; /** - * @typedef {import('../core/ElementRegistry').default} ElementRegistry - * @typedef {import('../core/GraphicsFactory').default} GraphicsFactory + * @typedef {import('../core/ElementRegistry.js').default} ElementRegistry + * @typedef {import('../core/GraphicsFactory.js').default} GraphicsFactory */ function dockingToPoint(docking) { diff --git a/lib/layout/LayoutUtil.js b/lib/layout/LayoutUtil.js index dba2c43fa..3ecafc74f 100644 --- a/lib/layout/LayoutUtil.js +++ b/lib/layout/LayoutUtil.js @@ -6,21 +6,21 @@ import { import { pointDistance, pointsOnLine -} from '../util/Geometry'; +} from '../util/Geometry.js'; import intersectPaths from 'path-intersection'; -import { isConnection } from '../util/ModelUtil'; +import { isConnection } from '../util/ModelUtil.js'; /** - * @typedef {import('../core/Types').ElementLike} Element - * @typedef {import('../core/Types').ConnectionLike} Connection + * @typedef {import('../core/Types.js').ElementLike} Element + * @typedef {import('../core/Types.js').ConnectionLike} Connection * - * @typedef {import('../util/Types').DirectionTRBL} DirectionTRBL - * @typedef {import('../util/Types').Intersection} Intersection - * @typedef {import('../util/Types').Point} Point - * @typedef {import('../util/Types').Rect} Rect - * @typedef {import('../util/Types').RectTRBL} RectTRBL + * @typedef {import('../util/Types.js').DirectionTRBL} DirectionTRBL + * @typedef {import('../util/Types.js').Intersection} Intersection + * @typedef {import('../util/Types.js').Point} Point + * @typedef {import('../util/Types.js').Rect} Rect + * @typedef {import('../util/Types.js').RectTRBL} RectTRBL */ /** diff --git a/lib/layout/ManhattanLayout.js b/lib/layout/ManhattanLayout.js index 8661cd8a2..cb57707ec 100644 --- a/lib/layout/ManhattanLayout.js +++ b/lib/layout/ManhattanLayout.js @@ -8,18 +8,18 @@ import { import { getOrientation, getMid -} from './LayoutUtil'; +} from './LayoutUtil.js'; import { pointInRect, pointDistance, pointsAligned, pointsOnLine -} from '../util/Geometry'; +} from '../util/Geometry.js'; /** - * @typedef {import('../util/Types').Point} Point - * @typedef {import('../util/Types').Rect} Rect + * @typedef {import('../util/Types.js').Point} Point + * @typedef {import('../util/Types.js').Rect} Rect */ var MIN_SEGMENT_LENGTH = 20, diff --git a/lib/model/Types.ts b/lib/model/Types.ts index 5cfb686c0..d87d7334d 100644 --- a/lib/model/Types.ts +++ b/lib/model/Types.ts @@ -1,4 +1,4 @@ -import type { Point } from '../util/Types'; +import type { Point } from '../util/Types.js'; export type ElementLike = { id: string; diff --git a/lib/model/index.js b/lib/model/index.js index 6ad90b2f7..08b0cfbc8 100644 --- a/lib/model/index.js +++ b/lib/model/index.js @@ -10,11 +10,11 @@ var parentRefs = new Refs({ name: 'children', enumerable: true, collection: true incomingRefs = new Refs({ name: 'incoming', collection: true }, { name: 'target' }); /** - * @typedef {import('./Types').Element} Element - * @typedef {import('./Types').Shape} Shape - * @typedef {import('./Types').Root} Root - * @typedef {import('./Types').Label} Label - * @typedef {import('./Types').Connection} Connection + * @typedef {import('./Types.js').Element} Element + * @typedef {import('./Types.js').Shape} Shape + * @typedef {import('./Types.js').Root} Root + * @typedef {import('./Types.js').Label} Label + * @typedef {import('./Types.js').Connection} Connection */ /** diff --git a/lib/model/index.spec.ts b/lib/model/index.spec.ts index 395dd8572..c81a7c850 100644 --- a/lib/model/index.spec.ts +++ b/lib/model/index.spec.ts @@ -1,4 +1,4 @@ -import { create } from './index'; +import { create } from './index.js'; const connection = create('connection', { id: 'foo', diff --git a/lib/navigation/keyboard-move/KeyboardMove.js b/lib/navigation/keyboard-move/KeyboardMove.js index 194ea9fe6..f35367cc7 100644 --- a/lib/navigation/keyboard-move/KeyboardMove.js +++ b/lib/navigation/keyboard-move/KeyboardMove.js @@ -1,8 +1,8 @@ import { assign } from 'min-dash'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../features/keyboard/Keyboard').default} Keyboard + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../features/keyboard/Keyboard.js').default} Keyboard */ var DEFAULT_CONFIG = { diff --git a/lib/navigation/keyboard-move/index.js b/lib/navigation/keyboard-move/index.js index 14a786793..49761a28a 100644 --- a/lib/navigation/keyboard-move/index.js +++ b/lib/navigation/keyboard-move/index.js @@ -1,6 +1,6 @@ -import KeyboardModule from '../../features/keyboard'; +import KeyboardModule from '../../features/keyboard/index.js'; -import KeyboardMove from './KeyboardMove'; +import KeyboardMove from './KeyboardMove.js'; /** diff --git a/lib/navigation/movecanvas/MoveCanvas.js b/lib/navigation/movecanvas/MoveCanvas.js index 255ddffbe..3d944d242 100644 --- a/lib/navigation/movecanvas/MoveCanvas.js +++ b/lib/navigation/movecanvas/MoveCanvas.js @@ -1,15 +1,15 @@ import { set as cursorSet, unset as cursorUnset -} from '../../util/Cursor'; +} from '../../util/Cursor.js'; import { install as installClickTrap -} from '../../util/ClickTrap'; +} from '../../util/ClickTrap.js'; import { delta as deltaPos -} from '../../util/PositionUtil'; +} from '../../util/PositionUtil.js'; import { event as domEvent, @@ -18,11 +18,11 @@ import { import { toPoint -} from '../../util/Event'; +} from '../../util/Event.js'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus */ var THRESHOLD = 15; diff --git a/lib/navigation/movecanvas/index.js b/lib/navigation/movecanvas/index.js index 4f84c7808..892e24dea 100644 --- a/lib/navigation/movecanvas/index.js +++ b/lib/navigation/movecanvas/index.js @@ -1,4 +1,4 @@ -import MoveCanvas from './MoveCanvas'; +import MoveCanvas from './MoveCanvas.js'; /** diff --git a/lib/navigation/zoomscroll/ZoomScroll.js b/lib/navigation/zoomscroll/ZoomScroll.js index a34313357..d81ccbd5b 100644 --- a/lib/navigation/zoomscroll/ZoomScroll.js +++ b/lib/navigation/zoomscroll/ZoomScroll.js @@ -6,25 +6,25 @@ import { import { getStepSize, cap -} from './ZoomUtil'; +} from './ZoomUtil.js'; import { log10 -} from '../../util/Math'; +} from '../../util/Math.js'; import { isMac -} from '../../util/Platform'; +} from '../../util/Platform.js'; import { bind } from 'min-dash'; /** - * @typedef {import('../../core/Canvas').default} Canvas - * @typedef {import('../../core/EventBus').default} EventBus + * @typedef {import('../../core/Canvas.js').default} Canvas + * @typedef {import('../../core/EventBus.js').default} EventBus * - * @typedef {import('../../util/Types').Point} Point + * @typedef {import('../../util/Types.js').Point} Point */ var sign = Math.sign || function(n) { diff --git a/lib/navigation/zoomscroll/ZoomUtil.js b/lib/navigation/zoomscroll/ZoomUtil.js index 8a3c6fd90..afa488f4b 100644 --- a/lib/navigation/zoomscroll/ZoomUtil.js +++ b/lib/navigation/zoomscroll/ZoomUtil.js @@ -1,6 +1,6 @@ import { log10 -} from '../../util/Math'; +} from '../../util/Math.js'; /** * Get step size for given range and number of steps. diff --git a/lib/navigation/zoomscroll/index.js b/lib/navigation/zoomscroll/index.js index 9ed057c40..24d1b0f9b 100644 --- a/lib/navigation/zoomscroll/index.js +++ b/lib/navigation/zoomscroll/index.js @@ -1,4 +1,4 @@ -import ZoomScroll from './ZoomScroll'; +import ZoomScroll from './ZoomScroll.js'; /** diff --git a/lib/util/AttachUtil.js b/lib/util/AttachUtil.js index c0754bf51..6c97c9f9d 100644 --- a/lib/util/AttachUtil.js +++ b/lib/util/AttachUtil.js @@ -2,18 +2,18 @@ import { asTRBL, getOrientation, roundPoint -} from '../layout/LayoutUtil'; +} from '../layout/LayoutUtil.js'; import { center, delta -} from './PositionUtil'; +} from './PositionUtil.js'; /** - * @typedef {import('../model/Types').Shape} Shape + * @typedef {import('../model/Types.js').Shape} Shape * - * @typedef {import('../util/Types').Point} Point - * @typedef {import('../util/Types').Rect} Rect + * @typedef {import('../util/Types.js').Point} Point + * @typedef {import('../util/Types.js').Rect} Rect */ /** diff --git a/lib/util/ClickTrap.js b/lib/util/ClickTrap.js index 7ac36e970..dcddfb08e 100644 --- a/lib/util/ClickTrap.js +++ b/lib/util/ClickTrap.js @@ -1,5 +1,5 @@ /** - * @typedef {import('../core/EventBus').default} EventBus + * @typedef {import('../core/EventBus.js').default} EventBus */ var TRAP_PRIORITY = 5000; diff --git a/lib/util/Elements.js b/lib/util/Elements.js index cc82554ca..945f1fcc6 100644 --- a/lib/util/Elements.js +++ b/lib/util/Elements.js @@ -11,11 +11,11 @@ import { } from 'min-dash'; /** - * @typedef {import('../model/Types').Connection} Connection - * @typedef {import('../model/Types').Element} Element - * @typedef {import('../model/Types').Shape} Shape + * @typedef {import('../model/Types.js').Connection} Connection + * @typedef {import('../model/Types.js').Element} Element + * @typedef {import('../model/Types.js').Shape} Shape * - * @typedef {import('../util/Types').Rect} Rect + * @typedef {import('../util/Types.js').Rect} Rect * * @typedef { { * allShapes: Record, diff --git a/lib/util/Event.js b/lib/util/Event.js index 4d3ab7c25..559f15eae 100644 --- a/lib/util/Event.js +++ b/lib/util/Event.js @@ -1,5 +1,7 @@ /** - * @typedef {import('../util/Types').Point} Point + * @typedef {import('../util/Types.js').Point} Point + * + * @typedef {import('../core/EventBus.js').Event} EventBusEvent */ function __stopPropagation(event) { @@ -11,7 +13,7 @@ function __stopPropagation(event) { } /** - * @param {import('../core/EventBus').Event} event + * @param {EventBusEvent} event * * @return {Event} */ @@ -20,7 +22,7 @@ export function getOriginal(event) { } /** - * @param {Event|import('../core/EventBus').Event} event + * @param {Event|EventBusEvent} event */ export function stopPropagation(event) { __stopPropagation(event); diff --git a/lib/util/Geometry.js b/lib/util/Geometry.js index e61ba9cea..797000b63 100644 --- a/lib/util/Geometry.js +++ b/lib/util/Geometry.js @@ -3,9 +3,9 @@ import { } from 'min-dash'; /** - * @typedef {import('../util/Types').Axis} Axis - * @typedef {import('../util/Types').Point} Point - * @typedef {import('../util/Types').Rect} Rect + * @typedef {import('../util/Types.js').Axis} Axis + * @typedef {import('../util/Types.js').Point} Point + * @typedef {import('../util/Types.js').Rect} Rect */ /** diff --git a/lib/util/LineIntersection.js b/lib/util/LineIntersection.js index 475c9e02f..86ca86352 100644 --- a/lib/util/LineIntersection.js +++ b/lib/util/LineIntersection.js @@ -1,11 +1,11 @@ +import intersectPaths from 'path-intersection'; + import { pointDistance -} from './Geometry'; - -import intersectPaths from 'path-intersection'; +} from './Geometry.js'; /** - * @typedef {import('../util/Types').Point} Point + * @typedef {import('../util/Types.js').Point} Point * * @typedef { { * bendpoint?: boolean; diff --git a/lib/util/Math.js b/lib/util/Math.js index 3e0b2b558..3d85221db 100644 --- a/lib/util/Math.js +++ b/lib/util/Math.js @@ -7,4 +7,4 @@ export function log10(x) { return Math.log(x) / Math.log(10); } -export { delta as substract } from './PositionUtil'; +export { delta as substract } from './PositionUtil.js'; diff --git a/lib/util/Mouse.js b/lib/util/Mouse.js index 16727b5db..abecfa296 100644 --- a/lib/util/Mouse.js +++ b/lib/util/Mouse.js @@ -1,14 +1,14 @@ import { getOriginal as getOriginalEvent -} from './Event'; +} from './Event.js'; import { isMac -} from './Platform'; +} from './Platform.js'; export { isMac -} from './Platform'; +} from './Platform.js'; /** * @param {MouseEvent} event diff --git a/lib/util/PositionUtil.js b/lib/util/PositionUtil.js index 3bf1bfd86..9937d279c 100644 --- a/lib/util/PositionUtil.js +++ b/lib/util/PositionUtil.js @@ -1,6 +1,6 @@ /** - * @typedef {import('../util/Types').Point} Point - * @typedef {import('../util/Types').Rect} Rect + * @typedef {import('../util/Types.js').Point} Point + * @typedef {import('../util/Types.js').Rect} Rect */ /** diff --git a/lib/util/RenderUtil.js b/lib/util/RenderUtil.js index 7bb3af13e..fe1d5eedc 100644 --- a/lib/util/RenderUtil.js +++ b/lib/util/RenderUtil.js @@ -11,7 +11,7 @@ import { /** * @typedef {(string|number)[]} Component * - * @typedef {import('../util/Types').Point} Point + * @typedef {import('../util/Types.js').Point} Point */ /** diff --git a/lib/util/RenderUtil.spec.ts b/lib/util/RenderUtil.spec.ts index b8821b227..4af318fa1 100644 --- a/lib/util/RenderUtil.spec.ts +++ b/lib/util/RenderUtil.spec.ts @@ -1,7 +1,7 @@ import { toSVGPoints, componentsToPath -} from './RenderUtil'; +} from './RenderUtil.js'; toSVGPoints([ { x: 10, y: 100 }, diff --git a/lib/util/Text.js b/lib/util/Text.js index 88e21d2f1..cc09823a4 100644 --- a/lib/util/Text.js +++ b/lib/util/Text.js @@ -18,7 +18,7 @@ import { /** - * @typedef {import('../util/Types').Dimensions} Dimensions + * @typedef {import('../util/Types.js').Dimensions} Dimensions * * @typedef { { * top: number; diff --git a/lib/util/Text.spec.ts b/lib/util/Text.spec.ts index 6205d686d..93b537cd7 100644 --- a/lib/util/Text.spec.ts +++ b/lib/util/Text.spec.ts @@ -1,6 +1,6 @@ // instantiation -import Text from './Text'; +import Text from './Text.js'; const text = new Text({ style: { diff --git a/test/helper/index.js b/test/helper/index.js index a14fe8e83..f340a7476 100644 --- a/test/helper/index.js +++ b/test/helper/index.js @@ -6,7 +6,7 @@ import { import TestContainer from 'mocha-test-container-support'; -import Diagram from '../../lib/Diagram'; +import Diagram from '../../lib/Diagram.js'; var OPTIONS, DIAGRAM_JS;