Skip to content

Commit 4915617

Browse files
committed
chore: import explicit files
This prepares us to migrate diagram-js to an ES module. Related to #863
1 parent bdb80c9 commit 4915617

File tree

217 files changed

+1052
-1052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+1052
-1052
lines changed

lib/Diagram.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injector } from 'didi';
22

3-
import CoreModule from './core';
3+
import CoreModule from './core/index.js';
44

55
/**
66
* @typedef {import('didi').InjectionContext} InjectionContext

lib/Diagram.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import Diagram from './Diagram';
1+
import Diagram from './Diagram.js';
22

3-
import CommandModule from './command';
3+
import CommandModule from './command/index.js';
44

5-
import CoreModule from './core';
6-
import EventBus from './core/EventBus';
5+
import CoreModule from './core/index.js';
6+
import EventBus from './core/EventBus.js';
77

8-
import ModelingModule from './features/modeling';
9-
import Modeling from './features/modeling/Modeling';
8+
import ModelingModule from './features/modeling/index.js';
9+
import Modeling from './features/modeling/Modeling.js';
1010

1111
let diagram = new Diagram();
1212

lib/command/CommandHandler.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import CommandHandler from './CommandHandler';
2-
import { CommandContext } from './CommandStack';
1+
import CommandHandler from './CommandHandler.js';
2+
import { CommandContext } from './CommandStack.js';
33

4-
import Canvas from '../core/Canvas';
4+
import Canvas from '../core/Canvas.js';
55

66
export class AddShapeHandler implements CommandHandler {
77
private _canvas: Canvas;

lib/command/CommandHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ElementLike } from "../core/Types";
2-
import { CommandContext } from "./CommandStack";
1+
import { ElementLike } from '../core/Types.js';
2+
import { CommandContext } from './CommandStack.js';
33

44
/**
55
* A command handler that may be registered via

lib/command/CommandInterceptor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
} from 'min-dash';
88

99
/**
10-
* @typedef {import('../core/Types').ElementLike} ElementLike
11-
* @typedef {import('../core/EventBus').default} EventBus
12-
* @typedef {import('./CommandStack').CommandContext} CommandContext
10+
* @typedef {import('../core/Types.js').ElementLike} ElementLike
11+
* @typedef {import('../core/EventBus.js').default} EventBus
12+
* @typedef {import('./CommandStack.js').CommandContext} CommandContext
1313
*
1414
* @typedef {string|string[]} Events
1515
* @typedef { (context: CommandContext) => ElementLike[] | void } HandlerFunction
@@ -28,7 +28,7 @@ var DEFAULT_PRIORITY = 1000;
2828
* @example
2929
*
3030
* ```javascript
31-
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
31+
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor.js';
3232
*
3333
* class CommandLogger extends CommandInterceptor {
3434
* constructor(eventBus) {

lib/command/CommandInterceptor.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import CommandInterceptor from './CommandInterceptor';
1+
import CommandInterceptor from './CommandInterceptor.js';
22

3-
import EventBus from '../core/EventBus';
3+
import EventBus from '../core/EventBus.js';
44

5-
import Modeling from '../features/modeling/Modeling';
5+
import Modeling from '../features/modeling/Modeling.js';
66

77
export class AddShapeBehavior extends CommandInterceptor {
88
static $inject = [ 'eventBus', 'modeling' ];

lib/command/CommandStack.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import {
66
/**
77
* @typedef {import('didi').Injector} Injector
88
*
9-
* @typedef {import('../core/Types').ElementLike} ElementLike
9+
* @typedef {import('../core/Types.js').ElementLike} ElementLike
1010
*
11-
* @typedef {import('../core/EventBus').default} EventBus
12-
* @typedef {import('./CommandHandler').default} CommandHandler
11+
* @typedef {import('../core/EventBus.js').default} EventBus
12+
* @typedef {import('./CommandHandler.js').default} CommandHandler
1313
*
1414
* @typedef { any } CommandContext
1515
* @typedef { {

lib/command/CommandStack.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import Diagram from '../Diagram';
1+
import Diagram from '../Diagram.js';
22

3-
import CommandModule from '.';
4-
import CommandStack from './CommandStack';
3+
import CommandModule from './index.js';
4+
import CommandStack from './CommandStack.js';
55

6-
import { AddShapeHandler } from './CommandHandler.spec';
6+
import { AddShapeHandler } from './CommandHandler.spec.js';
77

88
const diagram = new Diagram({
99
modules: [

lib/command/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import CommandStack from './CommandStack';
1+
import CommandStack from './CommandStack.js';
22

33
/**
44
* @type { import('didi').ModuleDeclaration }

lib/core/Canvas.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ import {
1616
import {
1717
add as collectionAdd,
1818
remove as collectionRemove
19-
} from '../util/Collections';
19+
} from '../util/Collections.js';
2020

2121
import {
2222
getType,
2323
getBBox as getBoundingBox
24-
} from '../util/Elements';
24+
} from '../util/Elements.js';
2525

26-
import { asTRBL } from '../layout/LayoutUtil';
26+
import { asTRBL } from '../layout/LayoutUtil.js';
2727

2828
import {
2929
append as svgAppend,
@@ -38,10 +38,10 @@ import { createMatrix as createMatrix } from 'tiny-svg';
3838

3939

4040
/**
41-
* @typedef {import('./Types').ConnectionLike} ConnectionLike
42-
* @typedef {import('./Types').RootLike} RootLike
43-
* @typedef {import('./Types').ParentLike } ParentLike
44-
* @typedef {import('./Types').ShapeLike} ShapeLike
41+
* @typedef {import('./Types.js').ConnectionLike} ConnectionLike
42+
* @typedef {import('./Types.js').RootLike} RootLike
43+
* @typedef {import('./Types.js').ParentLike } ParentLike
44+
* @typedef {import('./Types.js').ShapeLike} ShapeLike
4545
*
4646
* @typedef { {
4747
* container?: HTMLElement;
@@ -67,14 +67,14 @@ import { createMatrix as createMatrix } from 'tiny-svg';
6767
* outer: Dimensions;
6868
* } & Rect } CanvasViewbox
6969
*
70-
* @typedef {import('./ElementRegistry').default} ElementRegistry
71-
* @typedef {import('./EventBus').default} EventBus
72-
* @typedef {import('./GraphicsFactory').default} GraphicsFactory
70+
* @typedef {import('./ElementRegistry.js').default} ElementRegistry
71+
* @typedef {import('./EventBus.js').default} EventBus
72+
* @typedef {import('./GraphicsFactory.js').default} GraphicsFactory
7373
*
74-
* @typedef {import('../util/Types').Dimensions} Dimensions
75-
* @typedef {import('../util/Types').Point} Point
76-
* @typedef {import('../util/Types').Rect} Rect
77-
* @typedef {import('../util/Types').RectTRBL} RectTRBL
74+
* @typedef {import('../util/Types.js').Dimensions} Dimensions
75+
* @typedef {import('../util/Types.js').Point} Point
76+
* @typedef {import('../util/Types.js').Rect} Rect
77+
* @typedef {import('../util/Types.js').RectTRBL} RectTRBL
7878
*/
7979

8080
function round(number, resolution) {

0 commit comments

Comments
 (0)