Conversation
…space Destructure mxGraph objects from the mxgraph factory export so internal code imports them directly (e.g. `mxGraph`, `mxConstants`) rather than accessing them through `mxgraph.mxGraph`, `mxgraph.mxConstants`. This enables tree-shaking since bundlers can track individual named imports, improves readability by removing the repetitive `mxgraph.` prefix, and makes imports explicit about which mxGraph objects each module actually depends on. mxGraph is exported separately with an explicit `typeof` annotation to work around api-extractor losing constructor type information during .d.ts rollup, which caused TS2507 in downstream type checks.
|
♻️ PR Preview 22e2ff4 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
|
♻️ PR Preview 22e2ff4 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
There was a problem hiding this comment.
Pull request overview
This PR refactors mxGraph usage so modules import mxGraph objects as direct named exports from the initializer (e.g. mxConstants, mxRhombus) instead of accessing them via the mxgraph.* namespace, aiming to improve readability and tree-shaking and to address api-extractor constructor typing issues.
Changes:
- Updated multiple mxGraph-related modules to extend/use mxGraph classes via direct imports (
mxEllipse,mxRhombus,mxConnector,mxText,mxCellOverlay, etc.). - Reworked
src/component/mxgraph/initializer.tsto export a set of destructured mxGraph objects plus a separately exportedmxGraphwith an explicit constructor type annotation. - Adjusted tests and dev tooling code to use the new named exports.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/integration/mxGraph.model.bpmn.elements.test.ts | Uses mxGeometry via direct import instead of mxgraph.mxGeometry. |
| src/component/mxgraph/shape/gateway-shapes.ts | Extends mxRhombus via direct import. |
| src/component/mxgraph/shape/event-shapes.ts | Extends mxEllipse via direct import. |
| src/component/mxgraph/shape/edges.ts | Extends mxConnector via direct import. |
| src/component/mxgraph/overlay/shapes.ts | Extends mxText via direct import. |
| src/component/mxgraph/overlay/custom-overlay.ts | Extends mxCellOverlay via direct import. |
| src/component/mxgraph/initializer.ts | Adds destructured exports and exports mxGraph separately with explicit typing. |
| src/component/mxgraph/config/register-style-definitions.ts | Uses mxMarker directly instead of mxgraph.mxMarker. |
| src/component/mxgraph/BpmnGraph.ts | Extends mxGraph and mxGraphView via direct imports; resolves type/value name conflicts. |
| src/component/mxgraph/BpmnCellRenderer.ts | Extends mxCellRenderer and uses mxDictionary/mxImageShape via direct imports. |
| dev/ts/component/SvgExporter.ts | Uses mxImageExport via direct import instead of mxgraph.mxImageExport. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|




Destructure mxGraph objects from the mxgraph factory export so internal
code imports them directly (e.g.
mxGraph,mxConstants) rather thanaccessing them through
mxgraph.mxGraph,mxgraph.mxConstants.This enables tree-shaking since bundlers can track individual named
imports, improves readability by removing the repetitive
mxgraph.prefix, and makes imports explicit about which mxGraph objects each
module actually depends on.
mxGraph is exported separately with an explicit
typeofannotation towork around api-extractor losing constructor type information during
.d.ts rollup, which caused TS2507 in downstream type checks.