-
Notifications
You must be signed in to change notification settings - Fork 199
feat: let efficiently not load default plugins and style builtins #776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Introduce BaseGraph, a variation of Graph that does not load default plugins and style builtins. A new AbstractGraph class is available to share the common logic between Graph and BaseGraph. The code now mostly use the AbstractGraph when possible to let use both graph classes indifferently.
WalkthroughThis change introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Graph (now extends AbstractGraph)
participant AbstractGraph
participant Collaborators
participant Plugins
User->>Graph: instantiate Graph(options)
Graph->>AbstractGraph: super(options)
AbstractGraph->>Collaborators: initializeCollaborators(options)
AbstractGraph->>Plugins: initialize plugins (if any)
AbstractGraph->>AbstractGraph: set up event listeners, state, view, etc.
User->>Graph: interact/call methods
Graph->>AbstractGraph: delegate to base class logic
AbstractGraph->>Collaborators: delegate to collaborators as needed
sequenceDiagram
participant User
participant BaseGraph
participant AbstractGraph
User->>BaseGraph: instantiate BaseGraph(options)
BaseGraph->>AbstractGraph: super(options)
BaseGraph->>BaseGraph: initializeCollaborators(options) (minimal, no built-ins)
AbstractGraph->>AbstractGraph: core setup, plugin init (if any)
Possibly related issues
Possibly related PRs
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Nitpick comments (6)
packages/core/src/view/mixins/PortsMixin.ts (1)
20-22: Pick members from AbstractGraph
Switching thePartialPortsalias to pick properties fromAbstractGraphcorrectly generalizes this mixin. Consider renaming the intermediatePartialTypealias (e.g.,PortsMixinType) or inlining the type for improved readability.packages/core/src/view/animate/Animation.ts (1)
33-34: Correct default delay annotation
The@defaulttag has been updated from30msto20msto match the constructor’s behavior. Consider adding the unit (ms) description in the main class JSDoc for clarity.packages/core/src/view/layout/ParallelEdgeLayout.ts (1)
66-68: Constructor can be removed.The constructor is unnecessary as it only calls the parent constructor without adding any functionality.
- constructor(graph: AbstractGraph) { - super(graph); - }🧰 Tools
🪛 Biome (1.9.4)
[error] 66-68: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
packages/core/src/view/layout/FastOrganicLayout.ts (1)
38-40: Constructor can be removed.The constructor is unnecessary as it only calls the parent constructor without adding any functionality.
- constructor(graph: AbstractGraph) { - super(graph); - }🧰 Tools
🪛 Biome (1.9.4)
[error] 38-40: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
packages/core/src/view/mixins/ValidationMixin.ts (1)
107-113: Avoid double casting if possible
The expression<AbstractGraph>(<unknown>this)works, but suggests that the mixin’s type definitions don’t align exactly. Consider updating the signature ofmultiplicity.check(or the mixin interface) to accept the correct context type and eliminate theunknowncast.packages/core/src/util/Clipboard.ts (1)
39-78: Consider updating example code in documentation.While the implementation has been correctly updated to use AbstractGraph, the example code in the documentation still references the concrete Graph type. Consider updating this in a future PR for complete consistency.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (107)
packages/core/__tests__/util/styleUtils.test.ts(3 hunks)packages/core/__tests__/utils.ts(1 hunks)packages/core/__tests__/view/Graph.test.ts(5 hunks)packages/core/src/editor/Editor.ts(15 hunks)packages/core/src/editor/EditorToolbar.ts(2 hunks)packages/core/src/i18n/Translations.ts(1 hunks)packages/core/src/i18n/config.ts(1 hunks)packages/core/src/index.ts(1 hunks)packages/core/src/serialization/codecs/GraphViewCodec.ts(1 hunks)packages/core/src/serialization/codecs/editor/EditorToolbarCodec.ts(1 hunks)packages/core/src/types.ts(16 hunks)packages/core/src/util/Clipboard.ts(6 hunks)packages/core/src/util/gestureUtils.ts(3 hunks)packages/core/src/util/printUtils.ts(4 hunks)packages/core/src/util/treeTraversal.ts(3 hunks)packages/core/src/util/xmlUtils.ts(2 hunks)packages/core/src/view/AbstractGraph.ts(1 hunks)packages/core/src/view/BaseGraph.ts(1 hunks)packages/core/src/view/Graph.ts(2 hunks)packages/core/src/view/GraphSelectionModel.ts(3 hunks)packages/core/src/view/GraphView.ts(8 hunks)packages/core/src/view/animate/Animation.ts(1 hunks)packages/core/src/view/animate/Effects.ts(3 hunks)packages/core/src/view/animate/Morphing.ts(2 hunks)packages/core/src/view/cell/Cell.ts(1 hunks)packages/core/src/view/cell/CellHighlight.ts(3 hunks)packages/core/src/view/cell/CellMarker.ts(3 hunks)packages/core/src/view/cell/CellOverlay.ts(1 hunks)packages/core/src/view/cell/CellStatePreview.ts(1 hunks)packages/core/src/view/cell/CellTracker.ts(2 hunks)packages/core/src/view/cell/VertexHandle.ts(2 hunks)packages/core/src/view/event/EventSource.ts(1 hunks)packages/core/src/view/event/InternalEvent.ts(3 hunks)packages/core/src/view/event/InternalMouseEvent.ts(2 hunks)packages/core/src/view/geometry/Geometry.ts(1 hunks)packages/core/src/view/handler/ConstraintHandler.ts(3 hunks)packages/core/src/view/handler/EdgeHandler.ts(4 hunks)packages/core/src/view/handler/ElbowEdgeHandler.ts(3 hunks)packages/core/src/view/handler/KeyHandler.ts(8 hunks)packages/core/src/view/handler/VertexHandler.ts(5 hunks)packages/core/src/view/image/ImageBundle.ts(1 hunks)packages/core/src/view/layout/CircleLayout.ts(2 hunks)packages/core/src/view/layout/CompactTreeLayout.ts(2 hunks)packages/core/src/view/layout/CompositeLayout.ts(2 hunks)packages/core/src/view/layout/EdgeLabelLayout.ts(2 hunks)packages/core/src/view/layout/FastOrganicLayout.ts(2 hunks)packages/core/src/view/layout/GraphLayout.ts(4 hunks)packages/core/src/view/layout/HierarchicalLayout.ts(2 hunks)packages/core/src/view/layout/LayoutManager.ts(4 hunks)packages/core/src/view/layout/ParallelEdgeLayout.ts(2 hunks)packages/core/src/view/layout/PartitionLayout.ts(2 hunks)packages/core/src/view/layout/RadialTreeLayout.ts(3 hunks)packages/core/src/view/layout/StackLayout.ts(2 hunks)packages/core/src/view/layout/SwimlaneLayout.ts(2 hunks)packages/core/src/view/layout/SwimlaneManager.ts(4 hunks)packages/core/src/view/layout/hierarchical/CoordinateAssignment.ts(6 hunks)packages/core/src/view/mixins/CellsMixin.ts(2 hunks)packages/core/src/view/mixins/CellsMixin.type.ts(1 hunks)packages/core/src/view/mixins/ConnectionsMixin.ts(1 hunks)packages/core/src/view/mixins/ConnectionsMixin.type.ts(1 hunks)packages/core/src/view/mixins/DragDropMixin.ts(1 hunks)packages/core/src/view/mixins/DragDropMixin.type.ts(1 hunks)packages/core/src/view/mixins/EdgeMixin.ts(2 hunks)packages/core/src/view/mixins/EdgeMixin.type.ts(1 hunks)packages/core/src/view/mixins/EditingMixin.ts(2 hunks)packages/core/src/view/mixins/EditingMixin.type.ts(1 hunks)packages/core/src/view/mixins/EventsMixin.ts(3 hunks)packages/core/src/view/mixins/EventsMixin.type.ts(1 hunks)packages/core/src/view/mixins/FoldingMixin.ts(2 hunks)packages/core/src/view/mixins/FoldingMixin.type.ts(1 hunks)packages/core/src/view/mixins/GroupingMixin.ts(2 hunks)packages/core/src/view/mixins/GroupingMixin.type.ts(1 hunks)packages/core/src/view/mixins/ImageMixin.ts(1 hunks)packages/core/src/view/mixins/ImageMixin.type.ts(1 hunks)packages/core/src/view/mixins/LabelMixin.ts(1 hunks)packages/core/src/view/mixins/LabelMixin.type.ts(1 hunks)packages/core/src/view/mixins/OrderMixin.ts(1 hunks)packages/core/src/view/mixins/OrderMixin.type.ts(1 hunks)packages/core/src/view/mixins/OverlaysMixin.ts(2 hunks)packages/core/src/view/mixins/OverlaysMixin.type.ts(1 hunks)packages/core/src/view/mixins/PageBreaksMixin.ts(2 hunks)packages/core/src/view/mixins/PageBreaksMixin.type.ts(1 hunks)packages/core/src/view/mixins/PanningMixin.ts(1 hunks)packages/core/src/view/mixins/PanningMixin.type.ts(1 hunks)packages/core/src/view/mixins/PortsMixin.ts(1 hunks)packages/core/src/view/mixins/PortsMixin.type.ts(1 hunks)packages/core/src/view/mixins/SelectionMixin.ts(2 hunks)packages/core/src/view/mixins/SelectionMixin.type.ts(1 hunks)packages/core/src/view/mixins/SnapMixin.ts(1 hunks)packages/core/src/view/mixins/SnapMixin.type.ts(1 hunks)packages/core/src/view/mixins/SwimlaneMixin.ts(2 hunks)packages/core/src/view/mixins/SwimlaneMixin.type.ts(1 hunks)packages/core/src/view/mixins/TerminalMixin.ts(1 hunks)packages/core/src/view/mixins/TerminalMixin.type.ts(1 hunks)packages/core/src/view/mixins/TooltipMixin.ts(1 hunks)packages/core/src/view/mixins/TooltipMixin.type.ts(1 hunks)packages/core/src/view/mixins/ValidationMixin.ts(3 hunks)packages/core/src/view/mixins/ValidationMixin.type.ts(1 hunks)packages/core/src/view/mixins/VertexMixin.ts(1 hunks)packages/core/src/view/mixins/VertexMixin.type.ts(5 hunks)packages/core/src/view/mixins/ZoomMixin.ts(1 hunks)packages/core/src/view/mixins/ZoomMixin.type.ts(1 hunks)packages/core/src/view/mixins/_graph-mixins-apply.ts(2 hunks)packages/core/src/view/other/AutoSaveManager.ts(4 hunks)packages/core/src/view/other/DragSource.ts(10 hunks)packages/core/src/view/other/Guide.ts(2 hunks)packages/core/src/view/other/Multiplicity.ts(5 hunks)
⛔ Files not processed due to max files limit (25)
- packages/core/src/view/other/Outline.ts
- packages/core/src/view/other/PanningManager.ts
- packages/core/src/view/other/PrintPreview.ts
- packages/core/src/view/plugins/CellEditorHandler.ts
- packages/core/src/view/plugins/ConnectionHandler.ts
- packages/core/src/view/plugins/FitPlugin.ts
- packages/core/src/view/plugins/PanningHandler.ts
- packages/core/src/view/plugins/PopupMenuHandler.ts
- packages/core/src/view/plugins/RubberBandHandler.ts
- packages/core/src/view/plugins/SelectionCellsHandler.ts
- packages/core/src/view/plugins/SelectionHandler.ts
- packages/core/src/view/plugins/TooltipHandler.ts
- packages/core/src/view/style/config.ts
- packages/core/src/view/undoable_changes/SelectionChange.ts
- packages/core/tsconfig.json
- packages/html/stories/DynamicToolbar.stories.ts
- packages/html/stories/MenuStyle.stories.ts
- packages/html/stories/Toolbar.stories.ts
- packages/js-example-selected-features/src/index.js
- packages/js-example-without-defaults/src/index.js
- packages/ts-example-selected-features/src/main.ts
- packages/ts-example-selected-features/vite.config.js
- packages/ts-example-without-defaults/src/main.ts
- packages/ts-example-without-defaults/vite.config.js
- packages/ts-example/vite.config.js
🧰 Additional context used
🧬 Code Graph Analysis (39)
packages/core/src/view/mixins/PortsMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/_graph-mixins-apply.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/EditingMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/DragDropMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/DragDropMixin.type.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/ZoomMixin.type.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/PageBreaksMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/cell/CellHighlight.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/ImageMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/GroupingMixin.type.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/animate/Effects.ts (3)
packages/core/src/index.ts (1)
AbstractGraph(20-20)packages/core/src/types.ts (1)
UndoableChange(37-41)packages/core/src/view/cell/Cell.ts (1)
Cell(66-892)
packages/core/src/view/mixins/VertexMixin.type.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/cell/CellTracker.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/OrderMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/PortsMixin.type.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/OrderMixin.type.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/TerminalMixin.type.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/layout/SwimlaneManager.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/editor/EditorToolbar.ts (2)
packages/core/src/view/other/DragSource.ts (1)
DropHandler(47-53)packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/CellsMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/util/xmlUtils.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/BaseGraph.ts (2)
packages/core/src/index.ts (1)
AbstractGraph(20-20)packages/core/src/types.ts (1)
GraphCollaboratorsOptions(1402-1408)
packages/core/src/view/GraphSelectionModel.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/mixins/TerminalMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/handler/KeyHandler.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/__tests__/view/Graph.test.ts (2)
packages/core/src/index.ts (1)
AbstractGraph(20-20)packages/core/__tests__/utils.ts (1)
createGraphWithoutPlugins(30-30)
packages/core/src/view/layout/GraphLayout.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/__tests__/util/styleUtils.test.ts (1)
packages/core/__tests__/utils.ts (1)
createGraphWithoutPlugins(30-30)
packages/core/src/view/handler/EdgeHandler.ts (2)
packages/core/src/types.ts (1)
MouseListenerSet(1140-1144)packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/__tests__/utils.ts (1)
packages/core/src/view/Graph.ts (1)
Graph(41-102)
packages/core/src/view/mixins/ConnectionsMixin.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/layout/LayoutManager.ts (4)
packages/core/src/index.ts (1)
AbstractGraph(20-20)packages/html/stories/HoverIcons.stories.js (1)
graph(119-119)packages/html/stories/DragSource.stories.js (1)
graph(96-96)packages/html/stories/HelloWorld.stories.js (1)
graph(50-50)
packages/core/src/view/other/AutoSaveManager.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/GraphView.ts (3)
packages/html/stories/Control.stories.js (1)
graph(141-141)packages/html/stories/Permissions.stories.js (1)
graph(55-55)packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/util/printUtils.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/layout/hierarchical/CoordinateAssignment.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
packages/core/src/view/other/Multiplicity.ts (2)
packages/core/src/index.ts (2)
AbstractGraph(20-20)Cell(202-202)packages/core/src/view/cell/Cell.ts (1)
Cell(66-892)
packages/core/src/view/Graph.ts (5)
packages/core/src/view/style/register.ts (3)
registerDefaultEdgeMarkers(109-128)registerDefaultEdgeStyles(38-56)registerDefaultPerimeters(67-82)packages/core/src/view/cell/register-shapes.ts (1)
registerDefaultShapes(46-72)packages/core/src/types.ts (2)
GraphCollaboratorsOptions(1402-1408)GraphPluginConstructor(1108-1111)packages/core/src/view/GraphDataModel.ts (1)
GraphDataModel(218-1182)packages/core/src/view/plugins/index.ts (1)
getDefaultPlugins(46-55)
packages/core/src/view/other/DragSource.ts (1)
packages/core/src/index.ts (1)
AbstractGraph(20-20)
🪛 Biome (1.9.4)
packages/core/src/view/animate/Effects.ts
[error] 59-59: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
packages/core/src/view/layout/ParallelEdgeLayout.ts
[error] 66-68: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
packages/core/src/view/layout/FastOrganicLayout.ts
[error] 38-40: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
packages/core/src/util/gestureUtils.ts
[error] 89-89: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
packages/core/src/view/AbstractGraph.ts
[error] 83-83: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
[error] 84-84: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
🔇 Additional comments (237)
packages/core/src/i18n/Translations.ts (1)
76-76: Docs: Reference updated to AbstractGraph
The JSDoc now correctly points toAbstractGraphinstead of the concreteGraphclass. No functional impact.packages/core/src/view/image/ImageBundle.ts (1)
55-55: Docs: Corrected postProcessCellStyle reference
The documentation now links toAbstractGraph.postProcessCellStyleinstead ofGraph#postProcessCellStyle, aligning with the new abstract graph API.packages/core/src/view/geometry/Geometry.ts (1)
48-48: Docs: Updated resetEdges hooks to AbstractGraph
The documentation for disabling control-point resets now referencesAbstractGraph.resetEdgesOnMove/resetEdgesOnResizeas intended.packages/core/src/view/event/InternalMouseEvent.ts (3)
83-83: Docs: Updated graphX setter reference
The JSDoc forgraphXnow correctly refers toAbstractGraph.fireMouseEventinstead of the oldGraphclass.
89-89: Docs: Updated graphY setter reference
Similarly, the JSDoc forgraphYnow links toAbstractGraph.fireMouseEventto reflect the abstraction.
100-100: Docs: Updated sourceState resolution reference
The comment now points toAbstractGraph.getEventState, matching the new abstract API for event state resolution.packages/core/src/view/cell/CellOverlay.ts (1)
30-32: Docs: Replaced Graph methods with AbstractGraph
The overlay JSDoc now referencesAbstractGraph.addCellOverlay,removeCellOverlay(s)andgetCellOverlays, ensuring consistency with the abstract graph interface.packages/core/src/view/mixins/PortsMixin.ts (1)
17-17: Adopt AbstractGraph for mixin typing
The import has been updated toAbstractGraph, aligning with the new abstraction layer. Ensure thatpackages/core/src/view/AbstractGraph.tsexports these members.packages/core/src/i18n/config.ts (1)
91-93: Update JSDoc to reference AbstractGraph resources
The links foralreadyConnectedResource,collapseExpandResource, andcontainsValidationErrorsResourcehave been updated to point toAbstractGraph, ensuring consistency with the new base class.packages/core/src/serialization/codecs/GraphViewCodec.ts (1)
54-54: Reference AbstractGraph.getLabel in JSDoc
The documentation now correctly points toAbstractGraph.getLabelinstead ofGraph.getLabel, aligning with the new abstraction.packages/core/src/view/cell/Cell.ts (1)
43-44: Doc links updated to AbstractGraph
The example JSDoc now referencesAbstractGraph.convertValueToStringandAbstractGraph.cellLabelChanged, keeping the documentation consistent with the refactored class hierarchy.packages/core/src/view/mixins/DragDropMixin.ts (2)
17-17: Update of import type aligns with architecture refactoring.The change from importing
GraphtoAbstractGraphsupports the new class hierarchy introduced in this PR.
19-22: Type references properly updated to use AbstractGraph.Both
PartialGraphandPartialDragDropnow correctly pick properties fromAbstractGraphinstead ofGraph, maintaining the same functionality while enabling compatibility with bothGraphand the newBaseGraphclass.packages/core/src/view/mixins/FoldingMixin.type.ts (1)
22-23: Module declaration correctly updated to augment AbstractGraph.The module augmentation now properly extends
AbstractGraphinstead ofGraph, ensuring these folding-related methods are available on all graph implementations.packages/core/src/view/mixins/GroupingMixin.ts (2)
24-24: Import type updated to AbstractGraph.The change from importing
GraphtoAbstractGraphaligns with the architecture refactoring.
26-28: Type references correctly updated to AbstractGraph.Both
PartialGraphandPartialGroupingtype aliases now properly referenceAbstractGraphinstead ofGraph, ensuring compatibility with all graph implementations.Also applies to: 51-53
packages/core/src/serialization/codecs/editor/EditorToolbarCodec.ts (1)
92-92: Documentation updated to reference AbstractGraph.The JSDoc comment is correctly updated to reference
AbstractGraph.getCellAtinstead ofGraph#getCellAt, reflecting the new class hierarchy.packages/core/src/view/layout/CircleLayout.ts (2)
20-20: Import type updated to AbstractGraph.The import now correctly references
AbstractGraphinstead ofGraph, supporting the new class hierarchy.
41-42: Constructor parameter and JSDoc updated to use AbstractGraph.The constructor parameter type and corresponding JSDoc comment now reference
AbstractGraphinstead ofGraph, making theCircleLayoutclass compatible with bothGraphandBaseGraphimplementations.Also applies to: 44-44
packages/core/src/index.ts (1)
20-21: Well-structured addition of new graph classes to the public API.The addition of
AbstractGraphandBaseGraphexports aligns perfectly with the PR's objective to introduce more efficient graph instantiation options that don't automatically load default plugins and style builtins.packages/core/src/view/layout/StackLayout.ts (1)
21-21: Good refactoring to use AbstractGraph instead of Graph.The update to use
AbstractGraphinstead of the concreteGraphimplementation allows the layout to work with bothGraphand the newBaseGraphclasses, supporting the architectural improvement described in the PR objectives.Also applies to: 40-40
packages/core/src/view/cell/VertexHandle.ts (1)
31-31: Proper type abstraction for graph dependency.Changing the
graphproperty type fromGraphtoAbstractGraphallowsVertexHandleto work with both graph implementations, maintaining compatibility while enabling the more efficientBaseGraphoption introduced in this PR.Also applies to: 43-43
packages/core/src/view/mixins/_graph-mixins-apply.ts (1)
18-18: Appropriate update to mixins application target.The change to apply mixins to
AbstractGraphinstead ofGraphis essential for the new architecture - it ensures that the mixins are applied to the abstract base class, making functionality available to bothGraphandBaseGraphimplementations.Also applies to: 43-43
packages/core/src/view/mixins/SnapMixin.ts (2)
17-17: Type import updated to use AbstractGraph.The import has been correctly updated to reference AbstractGraph instead of Graph, which aligns with the architectural changes introduced in this PR.
19-19: Type references properly updated to AbstractGraph.The type definitions for
PartialGraphandPartialSnaphave been correctly updated to pick properties from AbstractGraph instead of Graph, maintaining type consistency with the new class hierarchy.Also applies to: 21-21
packages/core/src/view/mixins/LabelMixin.ts (2)
17-17: Type import updated to use AbstractGraph.The import has been correctly updated to reference AbstractGraph instead of Graph, which aligns with the architectural changes introduced in this PR.
20-20: Type references properly updated to AbstractGraph.The type definitions for
PartialGraphandPartialLabelhave been correctly updated to pick properties from AbstractGraph instead of Graph, maintaining type consistency with the new class hierarchy.Also applies to: 28-28
packages/core/src/view/mixins/ZoomMixin.type.ts (1)
19-20: Module declaration properly updated to augment AbstractGraph.The module declaration has been correctly updated to augment the AbstractGraph interface instead of the Graph interface, which is consistent with the new class hierarchy. The interface members remain unchanged, preserving the existing functionality.
packages/core/src/view/mixins/EditingMixin.type.ts (1)
21-22: Module declaration properly updated to augment AbstractGraph.The module declaration has been correctly updated to augment the AbstractGraph interface instead of the Graph interface, which is consistent with the new class hierarchy. The interface members remain unchanged, preserving the existing functionality.
packages/core/src/view/layout/EdgeLabelLayout.ts (2)
23-23: The import type change aligns with the AbstractGraph refactoring.The change from importing Graph to AbstractGraph is consistent with the PR objectives of generalizing graph interface usage, allowing for either Graph or BaseGraph implementations to be used interchangeably.
42-42: Constructor parameter type updated to use AbstractGraph.This type change correctly implements the architectural shift from concrete Graph to AbstractGraph, enabling the EdgeLabelLayout to work with either Graph or the new BaseGraph implementations.
packages/core/src/view/mixins/EditingMixin.ts (3)
20-20: Import statement updated to use AbstractGraph.This import change supports the architectural refactoring described in the PR objectives, allowing EditingMixin to work with the new class hierarchy.
23-25: Type reference in PartialGraph updated to AbstractGraph.The PartialGraph type alias now correctly references AbstractGraph instead of Graph, ensuring type safety when the mixin is applied to either Graph or BaseGraph implementations.
36-38: Type reference in PartialEditing updated to AbstractGraph.The PartialEditing type alias now correctly references AbstractGraph, maintaining consistency with the new class hierarchy introduced in this PR.
packages/core/src/view/mixins/DragDropMixin.type.ts (1)
19-20: Module declaration updated to extend AbstractGraph.The module augmentation now correctly targets AbstractGraph instead of Graph, ensuring that drag-drop functionality is properly typed across both Graph and BaseGraph implementations. This change is essential for the architectural refactoring described in the PR objectives.
packages/core/src/view/mixins/PortsMixin.type.ts (1)
19-20: Module augmentation updated to target AbstractGraph.The module declaration now correctly extends AbstractGraph instead of Graph, ensuring that ports functionality is properly typed across both Graph and BaseGraph implementations. This change is consistent with the PR's goal of enabling interchangeable use of both Graph and BaseGraph classes.
packages/core/src/view/mixins/CellsMixin.type.ts (1)
23-24: Updated module augmentation target to AbstractGraphThis change correctly modifies the module augmentation to target the new
AbstractGraphinterface instead ofGraph, aligning with the architectural refactoring whereGraphnow extendsAbstractGraph. This is consistent with the PR objective of creating a more flexible graph implementation hierarchy.packages/core/src/view/mixins/SwimlaneMixin.type.ts (1)
21-22: Updated module augmentation target to AbstractGraphThe module augmentation has been properly updated to target the new
AbstractGraphinterface rather thanGraph. This change maintains the type integration pattern used throughout the codebase and supports the new class hierarchy.packages/core/src/view/mixins/SnapMixin.type.ts (1)
20-21: Updated module augmentation target to AbstractGraphThe module augmentation has been correctly modified to target the new
AbstractGraphinterface. This change is part of the broader refactoring to support both standardGraphand the new lightweightBaseGraphimplementation.packages/core/src/view/mixins/LabelMixin.type.ts (1)
19-20: Updated module augmentation target to AbstractGraphThe module augmentation has been appropriately changed to target
AbstractGraphinstead ofGraph. This ensures that label-related functionality is available to all implementations extending fromAbstractGraph.packages/core/src/view/mixins/ImageMixin.ts (1)
17-17: Type reference updated to use AbstractGraphThis change correctly updates the import and type reference from
GraphtoAbstractGraph, aligning with the architectural shift to use the new abstract base class. This allows the mixin to work with bothGraphandBaseGraphimplementations.Also applies to: 21-21
packages/core/src/view/mixins/ConnectionsMixin.type.ts (1)
23-24: Module augmentation now targets AbstractGraphThe module declaration correctly augments the new
AbstractGraphinterface instead ofGraph, which is consistent with the architectural changes introduced in this PR. This allows connection-related functionality to be available on all graph implementations.packages/core/src/view/mixins/SwimlaneMixin.ts (1)
22-22: Type references updated to use AbstractGraphThe import and type references have been properly updated from
GraphtoAbstractGraphfor bothPartialGraphandPartialSwimlanetypes. This change ensures that the swimlane functionality works with all graph implementations derived from the abstract base class.Also applies to: 26-26, 40-40
packages/core/src/view/mixins/EdgeMixin.type.ts (1)
20-21: Module augmentation now targets AbstractGraphThe module declaration has been correctly updated to augment the
AbstractGraphinterface instead ofGraph. This change ensures that edge-related functionality is available on all graph implementations, including the newBaseGraphclass mentioned in the PR objectives.packages/core/src/view/other/Guide.ts (1)
25-26: Consistent Graph abstraction applied in Guide.tsThe import, constructor signature, JSDoc, and class property have all been correctly updated from the concrete
Graphto the newAbstractGraphtype, aligning this helper with the refactored graph hierarchy.Also applies to: 35-36, 41-43
packages/core/src/view/mixins/VertexMixin.ts (1)
19-24: Type references updated to AbstractGraph in VertexMixinThe
import typeandPick<>aliases have been updated to referenceAbstractGraphinstead ofGraph. All required graph methods (addCell,getChildCells,createVertex, etc.) are now correctly sourced from the abstract interface.packages/core/src/view/layout/HierarchicalLayout.ts (1)
28-29: Refactor Graph dependency to AbstractGraph in HierarchicalLayoutThe
import, JSDoc@param, and constructor signature have been updated to useAbstractGraph, ensuring that this layout works against the generalized graph interface.Also applies to: 41-47
packages/core/src/view/mixins/GroupingMixin.type.ts (1)
20-21: Module augmentation refactored to AbstractGraphThe declaration merging target has been changed from
GraphtoAbstractGraph, and the interface name updated accordingly, ensuring the grouping APIs extend the correct abstract base.packages/core/src/view/mixins/TerminalMixin.ts (1)
19-23: TerminalMixin types adapted to AbstractGraphThe
import typeandPick<>definitions forgetView,isTerminalPointMovable, andgetOppositesnow correctly referenceAbstractGraph, keeping the mixin aligned with the new abstraction.packages/core/src/view/mixins/OverlaysMixin.type.ts (1)
21-22: LGTM!Good refactoring to use
AbstractGraphinstead ofGraphin the module declaration. This aligns with the PR objective of updating type references to use the abstract base class.packages/core/src/view/layout/PartitionLayout.ts (2)
21-21: LGTM!Correct import of
AbstractGraphtype to replace the previousGraphimport.
42-42: LGTM!Properly updated constructor parameter type from
GraphtoAbstractGraphto support bothGraphandBaseGraphinstances.packages/core/src/view/mixins/TooltipMixin.ts (2)
20-20: LGTM!Correct import of
AbstractGraphtype to replace the previousGraphimport.
25-32: LGTM!Good refactoring of the
PartialGraphandPartialTooltiptype aliases to pick properties fromAbstractGraphinstead ofGraph. This ensures compatibility with bothGraphandBaseGraphimplementations.packages/core/src/view/layout/RadialTreeLayout.ts (3)
25-25: LGTM!Correct import of
AbstractGraphtype to replace the previousGraphimport.
40-40: LGTM!Properly updated constructor parameter type from
GraphtoAbstractGraphto support bothGraphandBaseGraphinstances.
136-136: LGTM!Correctly updated JSDoc comment to reference
AbstractGraph.findTreeRootsinstead ofGraph.findTreeRoots, maintaining documentation consistency with the new abstraction.packages/core/src/view/event/EventSource.ts (2)
27-29: Update documentation to modern ES6 subclassing
The example now showsclass MyClass extends EventSource {…}, replacing legacy prototype patterns.
40-40: Replace Graph with AbstractGraph in known subclasses list
References were updated toAbstractGraph, aligning docs with the new class hierarchy.packages/core/src/util/xmlUtils.ts (2)
22-22: Switch import from Graph to AbstractGraph
The utility now types itsgraphparameter asAbstractGraph, matching the new abstraction layer.
42-42: Update getViewXml signature to use AbstractGraph
EnsuresgetViewXmlaccepts the abstract base class, supporting bothGraphandBaseGraph.packages/core/src/view/cell/CellTracker.ts (2)
21-21: Import AbstractGraph instead of Graph
Aligns the handler to depend on the abstract base class for broader compatibility.
81-81: Constructor parameter now AbstractGraph
Updates thegraphargument type toAbstractGraphwithout altering the handler logic.packages/core/src/view/mixins/EdgeMixin.ts (3)
21-21: Import AbstractGraph for mixin type definitions
Unifies all graph typings to the newAbstractGraphinterface.
29-30: Update PartialGraph to pick from AbstractGraph
ThePartialGraphalias now referencesAbstractGraphmethods, replacing the concreteGraphtype.
43-44: Update PartialEdge to pick from AbstractGraph
All edge-related methods are now typed againstAbstractGraphfor consistency.packages/core/src/view/mixins/CellsMixin.ts (2)
46-46: Import AbstractGraph in CellsMixin
Reflects the new abstraction by usingAbstractGraphin mixin typings.
50-51: Update PartialGraph alias to use AbstractGraph
Switches thePartialGraphdefinition to pull methods fromAbstractGraph, consistent with the refactor.packages/core/src/view/cell/CellStatePreview.ts (2)
23-23: Update import to use AbstractGraph consistentlyThe import statement now properly references
AbstractGraphfrom the updated path, aligning with the architectural changes in the codebase.
30-30: Update type annotations to use AbstractGraph instead of GraphThe constructor, property type, and JSDoc comments now reference
AbstractGraphinstead ofGraph, properly aligning with the new architecture whereAbstractGraphserves as the base class from which concrete implementations extend.Also applies to: 36-38
packages/core/src/view/handler/ConstraintHandler.ts (2)
34-34: Update import to use AbstractGraph consistentlyThe import statement now properly references
AbstractGraphfrom the updated path, aligning with the new class hierarchy.
54-56: Update type annotations to use AbstractGraph instead of GraphThe constructor parameter type, property type, and JSDoc comments now consistently reference
AbstractGraphinstead ofGraph, ensuring this component works with any implementation that extends theAbstractGraphbase class.Also applies to: 88-88
packages/core/src/view/cell/CellHighlight.ts (2)
28-28: Update import to use AbstractGraph consistentlyThe import statement now properly references
AbstractGraphfrom the updated path, aligning with the architectural refactoring.
62-64: Update type annotations to use AbstractGraph instead of GraphThe constructor parameter type, property type, and JSDoc comments now consistently reference
AbstractGraphinstead ofGraph, making this component compatible with any implementation that extends theAbstractGraphbase class.Also applies to: 85-85
packages/core/src/editor/EditorToolbar.ts (2)
28-28: Update import to use AbstractGraph consistentlyThe import statement now properly references
AbstractGraphfrom the updated path, aligning with the architectural refactoring of the graph classes.
303-306: Update dropHandler type to use AbstractGraphThe
dropHandlerfunction parameter has been properly updated to useAbstractGraphinstead ofGraph, ensuring compatibility with bothGraphand the newBaseGraphimplementations. The parameter is also renamed to_graphto indicate it's not used in the function body.packages/core/src/view/mixins/OrderMixin.type.ts (1)
19-20: LGTM - Correct module augmentation update.The update from augmenting
Graphto augmentingAbstractGraphis aligned with the PR's goal of introducingAbstractGraphas a base class. This change ensures that bothGraphand the newBaseGraphimplementations will have these methods.packages/core/src/view/layout/ParallelEdgeLayout.ts (1)
22-22: LGTM - Properly updated import from Graph to AbstractGraph.This change correctly updates the import to use the new
AbstractGraphtype, aligning with the PR's goal of generalizing code to work with bothGraphandBaseGraphimplementations.packages/core/src/view/layout/FastOrganicLayout.ts (1)
20-20: LGTM - Properly updated import from Graph to AbstractGraph.This change correctly updates the import to use the new
AbstractGraphtype, allowing the layout to work with bothGraphandBaseGraphimplementations.packages/core/src/view/mixins/SelectionMixin.ts (3)
21-21: LGTM - Properly updated import from Graph to AbstractGraph.This change correctly updates the import to use the new
AbstractGraphtype, aligning with the PR's goal of generalizing code to work with bothGraphandBaseGraphimplementations.
23-25: LGTM - Updated Pick utility type to use AbstractGraph.The
PartialGraphtype correctly referencesAbstractGraphnow, ensuring consistency with the new class hierarchy.
34-36: LGTM - Updated Pick utility type to use AbstractGraph.The
PartialCellstype correctly referencesAbstractGraphnow, ensuring consistency with the new class hierarchy.packages/core/src/view/mixins/ZoomMixin.ts (3)
19-19: Import replacement aligns with the new abstraction.The change from importing
GraphtoAbstractGraphcorrectly implements the architectural change described in the PR, allowing this mixin to work with bothGraphand the newBaseGraphimplementations.
22-23: Type reference update ensures compatibility with all graph implementations.Updating the
PartialGraphtype to referenceAbstractGraphrather thanGraphis necessary to support both the originalGraphclass and the newBaseGraphclass introduced in this PR.
25-27: Type reference update preserves zoom functionality across graph implementations.The
PartialZoomtype now correctly referencesAbstractGraph, ensuring that zoom capabilities work consistently regardless of whether a user is using the fullGraphor the more efficientBaseGraphclass.packages/core/src/view/mixins/PageBreaksMixin.type.ts (1)
21-22: Module declaration update supports the new abstract graph architecture.The module augmentation now correctly targets
AbstractGraphinstead ofGraph, which aligns with the PR's objective of creating an abstraction layer that supports both the full-featuredGraphand the lighterBaseGraphimplementations.packages/core/src/view/mixins/ValidationMixin.type.ts (1)
21-22: Module augmentation properly redirected to the new abstract type.Changing the module declaration to target
AbstractGraphensures that validation features are available to both graph implementations while maintaining type safety.packages/core/src/view/layout/CompositeLayout.ts (3)
20-20: Import refactoring for layout compatibility with both graph implementations.The updated import ensures CompositeLayout works with both
GraphandBaseGraphimplementations by depending on the commonAbstractGraphinterface rather than the concreteGraphclass.
45-46: JSDoc update maintains documentation accuracy.The JSDoc comment has been appropriately updated to reflect the parameter type change, ensuring that documentation remains consistent with the new type system.
49-49: Constructor parameter type correctly updated for abstraction.The constructor now accepts any implementation of
AbstractGraphrather than only the concreteGraphclass, supporting the PR's goal of allowing efficient instantiation withBaseGraphwhen default plugins aren't needed.packages/core/src/view/mixins/TerminalMixin.type.ts (1)
19-20: Module and interface update to support the new AbstractGraph classThis change aligns with the PR's architectural refactoring, updating the module declaration and interface name to use AbstractGraph instead of Graph. This is part of the broader effort to generalize graph handling through the AbstractGraph abstraction.
packages/core/src/view/event/InternalEvent.ts (3)
30-30: Updated import to use AbstractGraphThe import statement has been updated to reference the new AbstractGraph type, aligning with the architectural changes in this PR.
57-57: Updated documentation to reference AbstractGraphDocumentation now correctly references AbstractGraph instead of Graph, maintaining consistency with the new architectural approach.
241-241: Updated parameter type from Graph to AbstractGraphThe type annotation for the graph parameter has been updated to use AbstractGraph, allowing this method to work with any class that implements the AbstractGraph interface, including both Graph and the new BaseGraph.
packages/core/src/view/mixins/EventsMixin.type.ts (1)
24-25: Updated module declaration and interface nameThe module declaration and interface name have been updated to reflect the new AbstractGraph class. This change is part of the architectural refactoring that introduces AbstractGraph as a base class for Graph implementations.
packages/core/src/view/mixins/TooltipMixin.type.ts (1)
20-21: Updated module declaration and interface nameThe module declaration and interface name have been changed from Graph to AbstractGraph, consistent with the other mixin type files. This change supports the new class hierarchy where Graph and BaseGraph both extend AbstractGraph.
packages/core/src/view/mixins/OrderMixin.ts (3)
20-20: Properly updated the import statement to use AbstractGraphThis change correctly updates the import statement to use the newly introduced AbstractGraph type, aligning with the architectural changes in the PR.
24-25: Correctly updated type reference to AbstractGraphThe PartialGraph type definition now correctly uses AbstractGraph as its base type, maintaining compatibility with both Graph and BaseGraph implementations.
27-27: Correctly updated PartialOrder to use AbstractGraphThe type definition now properly references AbstractGraph, ensuring consistent type definitions throughout the mixin implementation.
packages/core/src/view/mixins/SelectionMixin.type.ts (1)
21-22: Updated module declaration to properly extend AbstractGraphThis change correctly updates the module declaration to augment the AbstractGraph interface instead of Graph, ensuring that selection-related properties and methods are properly attributed to the abstract base class. This enables consistent typing for both Graph and BaseGraph implementations.
packages/core/__tests__/utils.ts (2)
20-24: Added helpful JSDoc comments to explain utility function purposeThe added documentation clearly explains the purpose of the
createGraphWithoutContainerutility function, which is valuable for test readability and maintenance. The comment properly explains when this utility should be used (when tests don't check the view).
27-29: Added clear documentation for the createGraphWithoutPlugins functionThe JSDoc comment clearly describes that this function creates a Graph without plugins by passing an empty array of plugins. This documentation makes the function's purpose and behavior explicit for test authors.
packages/core/src/view/cell/CellMarker.ts (3)
32-32: Updated import statement to use AbstractGraphThis change correctly updates the import to use the new AbstractGraph type from its proper location, aligning with the architectural changes introduced in this PR.
62-64: Updated property JSDoc and type to use AbstractGraphThe JSDoc comment and type annotation for the
graphproperty have been correctly updated to reference AbstractGraph instead of Graph, maintaining consistent typing throughout the codebase.
116-123: Updated constructor parameter JSDoc and type to use AbstractGraphThe JSDoc for the constructor parameter and the type annotation have been properly updated to use AbstractGraph, ensuring type consistency.
packages/core/src/util/treeTraversal.ts (3)
19-19: Import updated to use AbstractGraph type.The import is correctly updated to use the new AbstractGraph type, aligning with the architectural changes where Graph now extends AbstractGraph.
30-31: Clear parameter documentation added.Good addition of explicit documentation for the graph parameter, improving code readability.
40-40: Parameter type updated to AbstractGraph.The parameter type is correctly updated from Graph to AbstractGraph, allowing this function to work with both Graph and BaseGraph instances, in line with the PR objectives.
packages/core/src/view/layout/CompactTreeLayout.ts (2)
27-27: Import updated to use AbstractGraph type.The import is correctly updated to use the new AbstractGraph type instead of Graph.
78-78: Constructor parameter type updated to AbstractGraph.The constructor parameter type is correctly updated from Graph to AbstractGraph, allowing this layout to work with both Graph and BaseGraph instances, in line with the PR objectives.
packages/core/src/view/handler/ElbowEdgeHandler.ts (3)
34-34: JSDoc updated to reference AbstractGraph.The JSDoc comment is correctly updated to reference AbstractGraph.createHandler instead of Graph.createHandler, reflecting the architectural change.
48-48: JSDoc updated to reference AbstractGraph.The JSDoc comment is correctly updated to reference AbstractGraph.flipEdge instead of Graph.flipEdge.
95-95: JSDoc updated to reference AbstractGraph.The JSDoc comment is correctly updated to reference AbstractGraph.flipEdge instead of Graph.flipEdge, maintaining documentation consistency with the new architecture.
packages/core/src/view/mixins/ImageMixin.type.ts (1)
19-20: Module augmentation updated to target AbstractGraph.The module augmentation is correctly updated to target the AbstractGraph interface in '../AbstractGraph' module instead of Graph in '../Graph'. This ensures that image-related functionalities are available to all implementations of AbstractGraph, supporting the new architecture.
packages/core/src/view/mixins/OverlaysMixin.ts (3)
21-21: Properly updated type import to use AbstractGraphThe import has been changed to use the new abstract base class, which aligns with the PR objective of making the codebase use AbstractGraph where possible.
23-25: Type reference correctly updated to AbstractGraphThe PartialGraph type now picks properties from AbstractGraph instead of Graph, maintaining the same functionality while supporting the new architecture.
33-35: Type reference correctly updated to AbstractGraphThe PartialOverlays type now picks properties from AbstractGraph instead of Graph, maintaining the same functionality while supporting the new architecture.
packages/core/src/view/mixins/VertexMixin.type.ts (5)
21-22: Module declaration properly updated to augment AbstractGraphThe module augmentation has been changed to target AbstractGraph instead of Graph, which is consistent with the architectural change introduced in this PR.
56-57: JSDoc reference updated to AbstractGraphThe JSDoc comment has been updated to refer to AbstractGraph instead of Graph, maintaining consistency in the documentation.
72-73: JSDoc reference updated to AbstractGraphThe JSDoc comment has been updated to refer to AbstractGraph instead of Graph, maintaining consistency in the documentation.
107-108: JSDoc reference updated to AbstractGraphThe JSDoc comment has been updated to refer to AbstractGraph instead of Graph, maintaining consistency in the documentation.
128-129: JSDoc reference updated to AbstractGraphThe JSDoc comment has been updated to refer to AbstractGraph instead of Graph, maintaining consistency in the documentation.
packages/core/src/view/mixins/PageBreaksMixin.ts (3)
20-20: Properly updated type import to use AbstractGraphThe import has been changed to use the new abstract base class, which aligns with the PR objective of making the codebase use AbstractGraph where possible.
22-24: Type reference correctly updated to AbstractGraphThe PartialGraph type now picks properties from AbstractGraph instead of Graph, maintaining the same functionality while supporting the new architecture.
33-35: Type reference correctly updated to AbstractGraphThe PartialPageBreaks type now picks properties from AbstractGraph instead of Graph, maintaining the same functionality while supporting the new architecture.
packages/core/src/view/layout/SwimlaneLayout.ts (3)
29-29: Properly updated type import to use AbstractGraphThe import has been changed to use the new abstract base class, which aligns with the PR objective of making the codebase use AbstractGraph where possible.
43-45: Updated JSDoc parameter type and fixed constant referenceThe JSDoc comment has been improved in two ways:
- Updated to refer to AbstractGraph instead of Graph
- Fixed the constant reference to use
DIRECTION.NORTHinstead ofDIRECTION_NORTHto match the actual implementationThese changes make the documentation more accurate and consistent with the code.
47-47: Constructor parameter type updated to AbstractGraphThe constructor parameter type has been updated to accept AbstractGraph rather than Graph, allowing instances to be created with either Graph or BaseGraph implementations.
packages/core/src/view/handler/KeyHandler.ts (4)
19-19: Import updated to reference AbstractGraphThe import statement is correctly updated to use the more abstract
AbstractGraphtype instead of the concreteGraphimplementation, aligning with the architectural changes to promote abstraction and flexibility.
37-37: Documentation updated to reference AbstractGraph.containerJSDoc comment properly updated to reference
AbstractGraph.containerproperty, maintaining documentation consistency with the type changes.
77-77: Type annotations updated to AbstractGraphConstructor parameter, property type, and associated JSDoc comments have been appropriately updated to use
AbstractGraphinstead ofGraph. This change enables theKeyHandlerto work with any implementation of theAbstractGraphinterface, including bothGraphand the new lightweightBaseGraph.Also applies to: 81-81, 98-100
228-229: JSDoc references updated to AbstractGraphDocumentation references to graph methods (
isEnabled,isEditing,stopEditing) have been properly updated to point toAbstractGraphimplementation, maintaining accurate API documentation.Also applies to: 299-299, 309-310
packages/core/__tests__/util/styleUtils.test.ts (3)
25-25: Import updated to include BaseGraphThe import statement has been correctly updated to import
BaseGraphalongside theCellStyletype, which will be used in the parameterized tests.
125-129: Test expanded to run with both Graph and BaseGraphExcellent enhancement to the test coverage. The test has been refactored to run against both the standard
Graphimplementation (viacreateGraphWithoutPlugins()) and the new minimalBaseGraphimplementation. This ensures that thesetCellStyleFlagsfunctionality works consistently across different graph implementations.The comment clearly explains why a graph instance is needed for this test (to have a view and ensure cell state updates).
145-149: Test expanded to run with both Graph and BaseGraphSimilar to the previous test case, this test for
setCellStyleshas been enhanced to run against both graph implementations, ensuring consistent behavior between them.The explanatory comment is helpful in understanding test requirements.
packages/core/src/view/animate/Morphing.ts (3)
24-24: Import updated to reference AbstractGraphThe import statement is correctly updated to use
AbstractGraphinstead ofGraph, aligning with the architectural changes.
53-54: Documentation updated to reference AbstractGraphJSDoc comment for the constructor parameter correctly updated to reference
AbstractGraph. Additionally, thedelayparameter documentation has been improved for clarity by adding the reference toAnimation.Also applies to: 56-57
59-59: Type annotations updated to AbstractGraphConstructor parameter and property type have been appropriately updated to use
AbstractGraphinstead ofGraph. This allows theMorphingclass to work with any implementation that follows theAbstractGraphinterface.Also applies to: 66-66
packages/core/src/view/layout/LayoutManager.ts (4)
32-32: Import updated to reference AbstractGraphThe import statement is correctly updated to use
AbstractGraphtype instead ofGraph, aligning with the architectural changes to improve abstraction.
60-62: Property documentation and type updated to AbstractGraphJSDoc comment and property type annotation have been appropriately updated to use
AbstractGraphinstead ofGraph, allowing theLayoutManagerto work with any implementation of theAbstractGraphinterface.
92-92: Constructor parameter type updated to AbstractGraphConstructor parameter type has been properly updated to accept an
AbstractGraphinstance instead of aGraphinstance, making the class more flexible and consistent with the architectural changes.
167-167: setGraph method parameter type updated to AbstractGraphThe
setGraphmethod parameter type has been correctly updated to accept anAbstractGraphinstance, maintaining consistency with the property type and constructor parameter.packages/core/src/view/mixins/PanningMixin.ts (3)
21-21: Type import updated to use AbstractGraph.The import has been correctly updated to use the new
AbstractGraphtype instead of the concreteGraphimplementation. This is a necessary change for the architectural shift outlined in the PR objectives.
26-29: Type alias references AbstractGraph instead of Graph.The
PartialGraphtype alias has been properly updated to pick properties fromAbstractGraphinstead ofGraph. This change is consistent with the overall refactoring to use the abstract base class.
30-32: Type reference updated for PartialPanning.The
PartialPanningtype alias now correctly picks properties fromAbstractGraphinstead ofGraph, maintaining type consistency across the mixin implementation.packages/core/src/view/mixins/PanningMixin.type.ts (1)
20-21: Module augmentation target changed to AbstractGraph.The module augmentation has been properly updated to augment the
AbstractGraphinterface instead ofGraph. This ensures that the panning functionality is properly attached to the abstract interface, allowing any implementation to inherit these properties and methods.packages/core/src/view/GraphView.ts (4)
44-44: Import updated to reference AbstractGraph.The import statement has been correctly updated to reference the new
AbstractGraphtype instead of the concreteGraphimplementation.
95-95: Constructor parameter type updated to AbstractGraph.The constructor parameter type has been updated to accept any implementation of
AbstractGraph. This change is crucial as it allowsGraphViewto work with both the originalGraphimplementation and the newBaseGraphimplementation mentioned in the PR objectives.
159-161: Property type and JSDoc updated to reference AbstractGraph.Both the property type and associated JSDoc comment have been correctly updated to reference
AbstractGraphinstead ofGraph. This maintains consistency in the codebase and documentation.
230-243: JSDoc references updated to AbstractGraph.All references to
Graphin JSDoc comments have been systematically updated toAbstractGraph. This ensures documentation remains accurate with the new architecture.Also applies to: 262-267, 381-394, 401-408, 1285-1289
packages/core/src/view/mixins/FoldingMixin.ts (3)
23-23: Import updated to use AbstractGraph.The import has been correctly updated to use the new
AbstractGraphtype instead of the concreteGraphimplementation, consistent with the architectural changes.
26-28: PartialGraph type now references AbstractGraph.The
PartialGraphtype alias has been updated to pick properties fromAbstractGraphinstead ofGraph, maintaining type consistency with the new architecture.
40-42: PartialFolding type updated to reference AbstractGraph.The
PartialFoldingtype alias now correctly picks properties fromAbstractGraphinstead ofGraph, ensuring type consistency across the mixin implementation.packages/core/src/view/layout/SwimlaneManager.ts (4)
22-22: Use abstract graph type for SwimlaneManager
The import was correctly updated fromGraphtoAbstractGraph, aligning this manager with the new abstraction layer.
36-36: Constructor signature updated to AbstractGraph
Changing the constructor parameter toAbstractGraphgeneralizes the manager to work with any graph implementation extending the new base class.
63-65: Doc comment and property type aligned with AbstractGraph
The JSDoc and thegraph!property declaration now referenceAbstractGraph, maintaining consistency across the codebase.
172-172: Allow null in setGraph for proper cleanup
ThesetGraphmethod signature now permitsnull, enabling the manager’sdestroy()method to remove listeners and clear its reference safely.packages/core/src/view/other/AutoSaveManager.ts (4)
21-21: Switch import to AbstractGraph
The import has been updated to useAbstractGraph, aligning with the overall refactor away from the concreteGraphtype.
36-36: Constructor now accepts AbstractGraph
The constructor signature change toAbstractGraphmakes the autosave manager compatible with any graph implementation extending the abstract base.
50-52: Doc and property updated for AbstractGraph
The JSDoc and thegraphproperty declaration now referenceAbstractGraph | null, ensuring the manager can detach from its graph.
118-118: setGraph signature generalized to allow null
UpdatingsetGraph(graph: AbstractGraph | null)enables safe listener removal when destroying the manager.packages/core/src/view/GraphSelectionModel.ts (4)
20-20: Update import to AbstractGraph
The import was correctly changed fromGraphtoAbstractGraph, reflecting the new abstraction for selection models.
29-34: Modernize JSDoc example
The code sample in the JSDoc has been updated to useconstandfor...of, improving readability and modern JS usage.
62-62: Constructor signature updated to AbstractGraph
Changingconstructor(graph: Graph)toconstructor(graph: AbstractGraph)ensures the selection model works with any graph subtype.
68-68: Property type switched to AbstractGraph
The class propertygraph: AbstractGraphnow matches the constructor and import, preserving type consistency.packages/core/src/view/animate/Effects.ts (3)
25-25: Switch import to AbstractGraph
The import statement for the graph type has been updated toAbstractGraph, aligning with the core refactor.
56-60: AnimateChanges signature uses AbstractGraph
Updating theanimateChangesstatic method to acceptAbstractGraphandUndoableChange[]ensures it works with any graph implementation and the new change interface.🧰 Tools
🪛 Biome (1.9.4)
[error] 59-59: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
131-136: CascadeOpacity signature updated to AbstractGraph
ThecascadeOpacitymethod and its JSDoc now referenceAbstractGraph, preserving consistency across animation utilities.packages/core/src/util/gestureUtils.ts (3)
20-20: Import updated to AbstractGraph
The import now correctly referencesAbstractGraph, matching the updated drag-and-drop utilities.
25-27: JSDoc parameter graphF now references AbstractGraph
The documentation forgraphFhas been updated to describe its abstract graph type and function behavior.
98-98: JSDoc for getDropTarget updated to AbstractGraph
The parametergraphin thegetDropTargetcallback now referencesAbstractGraph, ensuring accurate type annotations.packages/core/src/view/mixins/ValidationMixin.ts (3)
19-19: Consistent type import
The import ofAbstractGraphreplaces the concreteGraphtype, aligning with the new abstraction layer. No issues detected.
22-34: Update PartialGraph alias to useAbstractGraph
Switching thePicksource toAbstractGraphcorrectly captures only the intended subset of graph methods. The change is purely mechanical with no functional impact.
35-45: Update PartialValidation alias to useAbstractGraph
Similarly, switching this alias to pick fromAbstractGraphmaintains type consistency across mixins.packages/core/src/view/mixins/ConnectionsMixin.ts (1)
25-31: Migrate toAbstractGraphin mixin types
ImportingAbstractGraphand updating thePartialGraphandPartialConnectionsaliases is consistent with the architectural refactor. Type references now correctly point to the abstraction.packages/core/src/view/layout/GraphLayout.ts (4)
23-23: ImportAbstractGraphfor type annotations
The type import change aligns this layout class with the new base graph abstraction.
36-43: Replace concreteGraphreferences withAbstractGraph
Updating the constructor signature andgraphproperty ensures the layout works with anyAbstractGraphsubclass.
99-99: Return type updated toAbstractGraph
ThegetGraph()method now correctly returns the abstract type, supporting bothGraphandBaseGraphimplementations.
420-421: JSDoc references updated
The documentation forarrangeGroupsnow points toAbstractGraph.updateGroupBounds, keeping comments in sync with the code.packages/core/src/view/handler/EdgeHandler.ts (5)
56-56: Import abstract graph dependency
Switching the handler to depend onAbstractGraphensures compatibility with both graph implementations.
73-73: Update documentation to referenceAbstractGraph
The class-level JSDoc now correctly references the abstract graph’screateHandlermethod.
81-81: Handler’s internal graph reference
Changing thegraphproperty toAbstractGraphis consistent with type abstraction.
507-510: validateConnection JSDoc alignment
The doc now points toAbstractGraph.getEdgeValidationError, matching the new method owner.
2251-2252: EdgeHandlerCellMarker constructor signature updated
Thegraphparameter’s type is switched toAbstractGraph. Ensure that callers pass the correct abstract type.packages/core/src/view/BaseGraph.ts (2)
17-23: Introduce lightweightBaseGraphsubclass
The newBaseGraphimports only essential collaborators and avoids default plugin/style registrations for optimized builds. This aligns well with the PR objectives.
35-43: OverrideinitializeCollaboratorscorrectly
The override instantiates or injects core collaborators without loading defaults. Consider whether callingsuper.initializeCollaborators()is required (if the base provides essential setup), or document why it’s omitted.packages/core/src/util/printUtils.ts (4)
23-23: Import type updated appropriately.The import statement correctly references the new AbstractGraph type instead of the concrete Graph implementation, aligning with the architectural changes introduced in this PR.
33-40: Parameter type annotations updated correctly.The JSDoc parameter annotation and function parameter type have been properly updated to use AbstractGraph, allowing both Graph and the new BaseGraph implementations to be used with these utility functions.
165-174: JSDoc and parameter type annotation updated consistently.The parameter types in both JSDoc comments and function signatures have been consistently updated to AbstractGraph. This ensures that utility functions work with any concrete implementation of the abstract graph interface.
284-284: Function parameter type annotation updated correctly.The printScreen function parameter type has been properly updated to use AbstractGraph type, completing the consistent type updates throughout this utility file.
packages/core/src/view/mixins/EventsMixin.ts (4)
44-44: Import type updated appropriately.The import statement correctly references the AbstractGraph type, aligning with the architectural refactoring to use AbstractGraph as the base class.
47-49: Type Pick reference updated correctly.The PartialGraph type now correctly references AbstractGraph instead of Graph, ensuring that mixin types align with the new class hierarchy.
90-92: PartialEvents type updated consistently.The PartialEvents type now correctly references AbstractGraph, maintaining consistency with the architectural updates throughout the codebase.
576-576: Default parameter type casting updated correctly.The type cast for the default sender parameter has been properly updated to use AbstractGraph, ensuring type safety when the sender parameter isn't provided.
packages/core/src/view/handler/VertexHandler.ts (5)
29-29: Import type updated appropriately.The import statement correctly references the AbstractGraph type, aligning with the architectural refactoring to use AbstractGraph as the base class.
45-46: JSDoc reference updated correctly.The JSDoc comment is updated to reference AbstractGraph.createHandler instead of Graph.createHandler, reflecting the new class hierarchy.
56-58: Field type and documentation updated correctly.Both the JSDoc comment and the property type declaration have been updated to use AbstractGraph, ensuring the handler works with any implementation of the abstract interface.
788-789: JSDoc reference updated for checkTolerance method.The JSDoc comment correctly references AbstractGraph.tolerance instead of Graph.tolerance, maintaining consistency with the architectural changes.
1411-1412: JSDoc reference updated for resizeCell method.The JSDoc comment correctly references AbstractGraph.resizeCell instead of Graph.resizeCell, reflecting the method's location in the new class hierarchy.
packages/core/src/util/Clipboard.ts (6)
20-20: Import type updated appropriately.The import statement correctly references the AbstractGraph type instead of the concrete Graph implementation.
34-35: JSDoc references updated correctly.The documentation references to canExportCell and canImportCell methods have been properly updated to use AbstractGraph instead of Graph.
122-126: Method signature and documentation updated for cut method.Both the JSDoc comments and parameter type annotations have been updated to use AbstractGraph, allowing the method to work with any graph implementation that extends the abstract class.
137-140: Method signature and documentation updated for removeCells method.The parameter type annotations and JSDoc have been properly updated to use AbstractGraph instead of Graph.
149-152: Method signature and documentation updated for copy method.The parameter type annotations and JSDoc have been properly updated to use AbstractGraph instead of Graph.
163-167: Method signature and documentation updated for paste method.The parameter type annotations and JSDoc comments have been properly updated to use AbstractGraph, completing the consistent type updates throughout this utility class.
packages/core/__tests__/view/Graph.test.ts (4)
19-30: Import list updated correctly.The import list has been updated to include AbstractGraph, EdgeHandler, and VertexHandler, properly maintaining alphabetical order and aligning with the architectural changes.
71-79: Excellent helper function addition.The createCellState helper function is a good improvement that reduces code duplication and standardizes the creation of test cell states throughout the test file.
89-89: Refactored test code to use helper function.The tests have been properly updated to use the new createCellState helper function, improving consistency and reducing duplication.
Also applies to: 101-101, 112-112
117-129: Added tests for createHandler functionality.These new tests verify that the graph correctly creates VertexHandler or EdgeHandler instances based on the cell type, which is crucial functionality for the AbstractGraph implementation. This is a good addition to ensure the handler creation logic works correctly.
packages/core/src/view/other/Multiplicity.ts (5)
21-21: Correctly updated import to use AbstractGraph.The import statement has been properly updated to reference the new
AbstractGraphtype instead of the concreteGraphtype, aligning with the architectural changes introduced in this PR.
28-30: Documentation updated appropriately to reference AbstractGraph.JSDoc comment has been updated to reference
AbstractGraph.multiplicitiesinstead ofGraph.multiplicities, maintaining consistency with the type changes.
134-139: Parameter types in JSDoc updated to match implementation.The JSDoc parameter types have been updated to reference:
AbstractGraphinstead ofGraphfor the graph parameterCelltype for edge, source, and target parameters, which correctly aligns with the imported Cell typeThis change maintains consistency with the architectural shift to AbstractGraph.
142-144: Method signature updated to use AbstractGraph type.The
checkmethod signature has been updated to useAbstractGraphinstead ofGraph, ensuring consistent API typing throughout the application.
184-184: All method signatures consistently updated to use AbstractGraph.The remaining method signatures (
checkNeighbors,checkTerminal, andcheckType) have been properly updated to use theAbstractGraphtype. This consistent change throughout the class ensures type safety when using eitherGraphorBaseGraphimplementations.Also applies to: 208-208, 217-219
packages/core/src/view/layout/hierarchical/CoordinateAssignment.ts (6)
31-31: Import statement correctly updated to use AbstractGraph.The import statement has been properly updated to reference the
AbstractGraphtype from the correct path.
667-667: Method signature updated to use AbstractGraph type.The
initialCoordsmethod signature has been updated to useAbstractGraphinstead ofGraphfor thefacadeparameter, allowing the method to work with any implementation of AbstractGraph.
694-694: Method signature updated to use AbstractGraph type.The
rankCoordinatesmethod signature has been updated to useAbstractGraphfor thegraphparameter, maintaining consistency with the architectural changes.
762-762: Method signature updated to use AbstractGraph type.The
calculateWidestRankmethod signature has been properly updated to useAbstractGraph.
863-863: Method signature updated to use AbstractGraph type.The
minPathmethod signature has been properly updated to useAbstractGraphfor thegraphparameter.
1033-1033: Method signature updated to use AbstractGraph type.The
setCellLocationsmethod signature has been properly updated to useAbstractGraphtype, completing the consistent updates throughout this class.packages/core/src/types.ts (5)
17-18: Import statements updated to reference AbstractGraph.The import statements have been properly updated to import
AbstractGraphfrom the new location.
29-33: Imported additional collaborator types for graph construction.Added imports for
CellRenderer,GraphDataModel,Stylesheet,GraphSelectionModel, andGraphViewwhich are needed for the new collaborator options type definitions later in the file.
129-130: JSDoc references updated to AbstractGraph throughout the file.All JSDoc references to graph-related methods have been properly updated to reference
AbstractGraphinstead ofGraph, ensuring documentation consistency.Also applies to: 141-142, 175-176, 505-506, 608-609, 629-631, 845-846
1108-1111: Updated GraphPluginConstructor to use AbstractGraph.The
GraphPluginConstructorinterface has been updated to accept anAbstractGraphinstance in its constructor signature instead of aGraph. This enables plugins to work with any implementation of AbstractGraph, including both Graph and BaseGraph.
1354-1408: Added new types to support flexible graph instantiation.Two new types have been introduced:
GraphOptions- Defines options for instantiating an AbstractGraph, including container, plugins, and collaboratorsGraphCollaboratorsOptions- Defines optional collaborators that can be injected into a graph instanceThese types are crucial for the architectural changes in this PR, enabling customizable graph instances with or without default plugins and styles.
packages/core/src/editor/Editor.ts (11)
37-37: Import statement updated to use AbstractGraph.The import statement has been appropriately changed to import
AbstractGraphas a type, reflecting the architectural changes in the codebase.
509-513: Class property type updated to AbstractGraph.The
graphproperty type and its JSDoc comment have been updated to referenceAbstractGraphinstead ofGraph, allowing the Editor to work with different graph implementations.
1394-1395: Updated method return type and JSDoc.The
createGraphmethod's return type and documentation have been updated to indicate it returns anAbstractGraphinstance, providing better type safety for the architectural changes.
1452-1452: Method parameter type updated to AbstractGraph.The
createSwimlaneManagermethod has been updated to accept anAbstractGraphparameter instead of aGraph, maintaining consistent typing throughout the codebase.
1472-1472: Method parameter type updated to AbstractGraph.The
createLayoutManagermethod parameter type has been properly updated to useAbstractGraph.
1513-1514: JSDoc updated to reference AbstractGraph.The JSDoc comment for
setGraphContainerhas been updated to referenceAbstractGraph.initinstead ofGraph.init, maintaining documentation consistency.
1540-1540: Method parameter type updated to AbstractGraph.The
installDblClickHandlermethod parameter type has been properly updated to useAbstractGraph.
1556-1556: Method parameter type updated to AbstractGraph.The
installUndoHandlermethod parameter type has been properly updated to useAbstractGraph.
1579-1579: Method parameter type updated to AbstractGraph.The
installDrillHandlermethod parameter type has been properly updated to useAbstractGraph.
1594-1594: Method parameter type updated to AbstractGraph.The
installChangeHandlermethod parameter type has been properly updated to useAbstractGraph.
1627-1627: Method parameter type updated to AbstractGraph.The
installInsertHandlermethod parameter type has been properly updated to useAbstractGraph, completing the consistent updates throughout the Editor class.packages/core/src/view/other/DragSource.ts (1)
43-54: Type refactor looks goodAll usages of
Graphhave been migrated toAbstractGraphconsistently. No runtime behaviour is affected because the interface is a strict superset.Also applies to: 126-129



Historically, the
Graphclass has been the main entry point inmaxGraph. It loads default plugins and style elements automatically, making it convenient for prototyping by reducing initial setup. However, this approach is less ideal for production: it increases the bundle size by including features that might not be used.The changes here introduce a new way to control what is loaded, with a focus on modularity:
BaseGraph: an alternative toGraphthat does not load any default configuration. It gives full control to the application over which features are included.AbstractGraph: a new abstract class that holds the common logic shared byGraphandBaseGraph.nulljust to set one optional parameter).Graphclass is unchanged; it's now built on top ofAbstractGraph.The codebase has been updated to use
AbstractGraphwhere it makes sense, mostly to adjust types and reduce duplication.The high-level examples now use
BaseGraphto demonstrate its benefits. In particular, they show how tree shaking can significantly reduce the bundle size, with a minimal setup resulting in just 105 kB when no optional features (plugins, style elements) are used.Finally,
BaseGraphintroduces a simpler constructor model: using a single configuration object instead of multiple parameters. This makes the class easier to extend and avoids the need to override internal factory methods (likecreateXXX) when customizing behavior.Examples of Usage of
BaseGraphImpact of the new implementation on the size of examples
Note:
ℹ️ Rollup (used in TS examples) seems to tree-shake maxGraph better than webpack based on the size of js-example-without-defaults (the part of the application in not 17 kB). There’s room for improvement on the webpack side - maybe by adjusting how things are structured in maxGraph.
Notes
Covers #760
Summary by CodeRabbit
New Features
Refactor
Documentation
Tests