GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat!: improve tree-shaking of `EdgeStyle` by tbouffard · Pull Request #791 · maxGraph/maxGraph

Conversation

@tbouffard

@tbouffard tbouffard commented Apr 29, 2025 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Previously, EdgeStyle was a class with only static properties referring to all EdgeStyleFunction builtin implementations provided by maxGraph.
This meant they were all included in the application even if only some values were used (i.e., only the edge styles registered in StyleRegistry).

EdgeStyle is now a namespace, allowing all bundlers to properly tree-shake and only keep the edge styles actually used by the application.
Note that currently this has limited impact on tree-shaking because most builtin implementations are referenced directly in the code, so they are still included in the application.
In the future, these references will be removed to further reduce bundle size.

The documentation now includes a new page explaining how to use and create EdgeStyle implementations.
The documentation about the "perimeters" have been updated to have a consistent content with the new page.

BREAKING CHANGES: EdgeStyle has been changed from a class with static properties to a namespace.
This has minimal impact for most applications that only read edge style values.
The breaking change only affects applications that modify EdgeStyle properties (add/update/remove values), which is no longer possible.
Instead, create your own EdgeStyle implementation and register it.

Notes

Closes #759

Impact on application size

Note

JS examples use Webpack, TS examples use Vite (Vite/Rollup does better tree-shaking!)

  • the JS and TS examples doesn't cover the same use case
  • the size mentioned here is the one of the whole application in the JS examples and the one of the maxGraph chunk in the TS examples
Example 0.18.0 #785 This PR
js-example 476.1 kB 475.92 kB 475.3 kB
js-example-selected-features 423.45 kB 415.59 kB 415.1 kB
js-example-without-default 347.86 kB 347.83 kB 347.33 kB
ts-example 439.30 kB 439.15 kB 438.64 kB
ts-example-selected-features 381.15 kB 381.14 kB 380.70 kB
ts-example-without-default 330.38 kB 330.38 kB 329.90 kB

Summary by CodeRabbit

Summary by CodeRabbit

  • Documentation

    • Added a comprehensive guide on using and creating EdgeStyles, including built-in and custom styles.
    • Enhanced perimeter documentation with clearer explanations and detailed instructions for custom perimeters.
    • Updated changelog to note a breaking change regarding EdgeStyle usage.
  • Refactor

    • Simplified EdgeStyle exports by removing the wrapper class and exporting functions directly.
    • Updated code references to use standalone EdgeStyle functions instead of class properties.
  • Style

    • Improved and added JSDoc comments for various edge style functions to enhance code clarity.
  • Chores

    • Adjusted build configuration chunk size warning limits for example projects.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tbouffard
feat!: improve tree-shaking of EdgeStyle
dd1944d
Previously, `EdgeStyle` was a class with only static properties referring to all `EdgeStyleFunction` builtin implementations provided by maxGraph.
This meant they were all included in the application even if only some values were used (i.e., only the edge styles registered in StyleRegistry).

`EdgeStyle` is now a namespace, allowing all bundlers to properly tree-shake and only keep the edge styles actually used by the application.
Note that currently this has limited impact on tree-shaking because most builtin implementations are referenced directly in the code, so they are still included in the application.
In the future, these references will be removed to further reduce bundle size.

The documentation now includes a new page explaining how to use and create `EdgeStyle` implementations.
The documentation about the "perimeters" have been updated to have a consistent content with the new page.

BREAKING CHANGES: `EdgeStyle` has been changed from a class with static properties to a namespace.
This has minimal impact for most applications that only read edge style values.
The breaking change only affects applications that modify EdgeStyle properties (add/update/remove values), which is no longer possible.
Instead, create your own EdgeStyle implementation and register it.
@tbouffard tbouffard added the enhancement New feature or request label Apr 29, 2025
@coderabbitai

coderabbitai Bot commented Apr 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Walkthrough

This change refactors the export and usage of EdgeStyle from a static-only class to a namespace-style export to enable tree shaking and reduce bundle size. All references and imports of EdgeStyle are updated accordingly across the codebase. The update includes documentation changes, such as new and revised markdown files explaining edge styles and perimeters, and the changelog is updated to note the breaking change. JSDoc comments are added or revised for edge style functions, and related configuration and example files are updated to reflect the new export pattern.

Changes

File(s) Change Summary
packages/core/src/view/style/edge/index.ts Removed EdgeStyle static class; exported edge style functions directly.
packages/core/src/view/style/builtin-style-elements.ts Changed EdgeStyle export to namespace export with JSDoc.
packages/core/src/view/AbstractGraph.ts,
packages/core/src/view/handler/EdgeHandler.ts,
packages/core/src/view/style/register.ts
Updated imports to use new EdgeStyle namespace export location.
packages/html/stories/Wires.stories.js Updated custom edge style usage to standalone function, removed EdgeStyle object references.
packages/core/src/view/style/edge/Elbow.ts,
EntityRelation.ts,
Loop.ts,
Segment.ts,
TopToBottom.ts
Added JSDoc comments to exported edge style functions.
packages/core/src/view/style/edge/Orthogonal.ts Merged lines in JSDoc for result parameter.
packages/core/src/view/style/edge/SideToSide.ts Added JSDoc comment for SideToSide function.
packages/core/src/view/style/edge/shared.ts Marked scalePointArray as @private and @internal in JSDoc.
packages/website/docs/usage/edge-styles.md Added new documentation file explaining EdgeStyles and custom edge style creation.
packages/website/docs/usage/perimeters.md Updated and expanded documentation for builtin and custom perimeters.
CHANGELOG.md Documented breaking change for EdgeStyle export refactor.
packages/ts-example-selected-features/vite.config.js,
packages/ts-example-without-defaults/vite.config.js,
packages/ts-example/vite.config.js
Reduced chunk size warning limits by 1 in Vite configs.

Sequence Diagram(s)

sequenceDiagram
    participant UserApp
    participant StyleRegistry
    participant EdgeStyle (namespace)
    participant CustomEdgeStyle

    UserApp->>EdgeStyle (namespace): import { ElbowConnector }
    UserApp->>StyleRegistry: StyleRegistry.putValue('customEdge', CustomEdgeStyle)
    UserApp->>EdgeStyle (namespace): Use built-in edge styles via namespace
    UserApp->>CustomEdgeStyle: Use custom edge style function directly
Loading

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Refactor EdgeStyle to a namespace to support tree shaking (#759) ✅
Update imports and usages throughout the codebase to use new namespace export (#759) ✅
Move or revise JSDoc/documentation for edge styles as appropriate (#759) ✅
Add or update documentation for custom edge styles and perimeters (#759) ✅

Possibly related PRs

  • feat!: improve tree-shaking of Perimeter #785: Refactors Perimeter similarly to EdgeStyle by converting from static class/value object to namespace to enable tree shaking.
  • refactor!: extract Orthogonal and Manhattan connectors #684: Internal restructuring of EdgeStyle by extracting connectors into separate files and modifying static properties.
  • refactor: reorganize builtin style elements #775: Reorganizes exports of builtin style elements including EdgeStyle but retains class export, related to export structure changes.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f38d2f5 and 5bd94da.

📒 Files selected for processing (3)
  • packages/website/docs/usage/edge-styles.md (1 hunks)
  • packages/website/docs/usage/perimeters.md (3 hunks)
  • packages/website/docs/usage/plugins.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/website/docs/usage/plugins.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/website/docs/usage/perimeters.md
  • packages/website/docs/usage/edge-styles.md

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.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tbouffard
Merge branch 'main' into feat/edgestyle_tree-shaking
f0572fa
coderabbitai[bot]
coderabbitai Bot reviewed Apr 29, 2025
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (7)
packages/core/src/view/style/edge/Loop.ts (1)

26-28: Enhance JSDoc with parameter and behavior details

The short description is helpful, but consider adding @param tags for each argument (state, source, target, points, result) and a note that the function appends computed loop points to result. This will boost IDE autocomplete and keep documentation consistent.

packages/core/src/view/style/edge/TopToBottom.ts (1)

25-27: Enhance JSDoc with parameter documentation

The new summary is concise, but adding @param annotations for state, source, target, points, and result will align this comment block with others in the codebase and improve the developer experience.

packages/core/src/view/style/edge/shared.ts (1)

27-28: Consider JSDoc tag redundancy and documentation generator compatibility
You’ve marked scalePointArray as both @private and @internal. Depending on your documentation toolchain (e.g., TypeDoc), you may only need one of these tags—@internal is often sufficient to hide it from public docs. Verify that your chosen tag is recognized by your docs generator, and remove the redundant tag to keep the comment concise.

packages/core/src/view/style/edge/Elbow.ts (1)

27-30: Add parameter annotations for consistency
The new overview is clear, but other connectors include @param tags describing each argument. For consistency and IDE-assisted documentation, consider adding @param annotations for state, source, target, points, and result.

CHANGELOG.md (1)

15-16: Fix Markdown list formatting
There’s no space after the - on the EdgeStyle entry. For consistency with the other list items, add a space:

--`EdgeStyle` has been changed ...
+- `EdgeStyle` has been changed ...
packages/website/docs/usage/edge-styles.md (2)

1-4: Fix frontmatter description grammar.

The description field currently reads “How-to use use builtin EdgeStyles…” which has a duplicate “use” and missing hyphen in “built-in”. Consider updating to:

-description: How-to use use builtin EdgeStyles and create new EdgeStyles.
+description: How to use built-in EdgeStyles and create new EdgeStyles.

15-17: Capitalize “Manhattan” for consistency.

In “using manhattan distance as its metric,” capitalize “Manhattan” to match the proper noun.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 447862e and dd1944d.

📒 Files selected for processing (20)
  • CHANGELOG.md (1 hunks)
  • packages/core/src/view/AbstractGraph.ts (1 hunks)
  • packages/core/src/view/handler/EdgeHandler.ts (1 hunks)
  • packages/core/src/view/style/builtin-style-elements.ts (1 hunks)
  • packages/core/src/view/style/edge/Elbow.ts (1 hunks)
  • packages/core/src/view/style/edge/EntityRelation.ts (1 hunks)
  • packages/core/src/view/style/edge/Loop.ts (1 hunks)
  • packages/core/src/view/style/edge/Orthogonal.ts (1 hunks)
  • packages/core/src/view/style/edge/Segment.ts (1 hunks)
  • packages/core/src/view/style/edge/SideToSide.ts (1 hunks)
  • packages/core/src/view/style/edge/TopToBottom.ts (1 hunks)
  • packages/core/src/view/style/edge/index.ts (1 hunks)
  • packages/core/src/view/style/edge/shared.ts (1 hunks)
  • packages/core/src/view/style/register.ts (1 hunks)
  • packages/html/stories/Wires.stories.js (3 hunks)
  • packages/ts-example-selected-features/vite.config.js (1 hunks)
  • packages/ts-example-without-defaults/vite.config.js (1 hunks)
  • packages/ts-example/vite.config.js (1 hunks)
  • packages/website/docs/usage/edge-styles.md (1 hunks)
  • packages/website/docs/usage/perimeters.md (3 hunks)
🧰 Additional context used
🪛 LanguageTool
packages/website/docs/usage/edge-styles.md

[uncategorized] ~102-~102: Possible missing comma found.
Context: ...edgeStyle` key in a style of a specific edge as follows: ```javascript style.edgeSty...

(AI_HYDRA_LEO_MISSING_COMMA)

🪛 ESLint
packages/html/stories/Wires.stories.js

[error] 156-156: 'WireConnector' is not defined.

(no-undef)


[error] 611-611: 'WireConnector' is not defined.

(no-undef)


[error] 702-702: 'WireConnector' is not defined.

(no-undef)

🔇 Additional comments (27)
packages/ts-example-without-defaults/vite.config.js (1)

30-30: Updated chunk size warning limit
The warning limit was decreased from 331 to 330 to align with similar example projects. This is a straightforward configuration change and looks correct.

packages/ts-example-selected-features/vite.config.js (1)

30-30: Adjusted chunk size warning threshold
Lowering the warning limit from 382 to 381 matches the coordinated updates across example configs. No issues detected.

packages/core/src/view/AbstractGraph.ts (1)

42-42: Import EdgeStyle from new namespace
The import path was updated to point at style/builtin-style-elements, reflecting the refactor of EdgeStyle from a class to a namespace. Ensure that all referred members on EdgeStyle (e.g., .Loop, .ElbowConnector) are present in the aggregated namespace export.

packages/core/src/view/style/edge/SideToSide.ts (1)

25-27: Added JSDoc for SideToSide
The new comment “Implements a horizontal elbow edge.” improves clarity and maintains consistency with other edge style modules.

packages/core/src/view/handler/EdgeHandler.ts (1)

48-48: Updated EdgeStyle import in handler
Aligned this import with the new namespace-based exports. Confirm that EdgeHandler logic continues to correctly reference all needed style functions on EdgeStyle.

packages/core/src/view/style/register.ts (1)

17-17: Consolidated imports improve tree-shaking and maintainability

Combining EdgeStyle, EdgeMarker, and Perimeter into a single import from './builtin-style-elements' aligns with the new namespace-based exports and simplifies the code. This will help bundlers drop unused symbols more effectively.

packages/core/src/view/style/edge/Orthogonal.ts (1)

151-151: JSDoc consolidation maintains clarity

The merged @param result description accurately conveys that this array holds the computed edge points. Ensure that adjacent parameters (state, sourceScaled, targetScaled, controlHints) remain documented in the surrounding comments for full coverage.

packages/core/src/view/style/builtin-style-elements.ts (1)

17-22: Accurate and concise namespace documentation
Great addition of a JSDoc comment and @category EdgeStyle on the EdgeStyle namespace export. This will help users discover and understand the purpose of the namespace when browsing the API docs.

packages/website/docs/usage/perimeters.md (4)

3-3: Good description enhancement!

The updated description clearly communicates that this documentation covers both builtin and custom perimeters, making it more obvious to readers what they can expect to learn.


17-19: Improved precision in perimeter configuration description.

The revised description more accurately describes where perimeters are configured - "within the style properties of the Cell that relates to the Vertex" instead of "within the vertex style", providing better technical precision.


23-26: Better formatting using callout blocks.

Reformatting the note into a proper callout block improves readability and draws appropriate attention to this important information about StyleRegistry registration.


125-163: Excellent new "Custom Perimeter" section!

This comprehensive new section significantly enhances the documentation by providing:

  1. Clear instructions for creating custom perimeter functions
  2. The proper function signature with typed parameters
  3. Step-by-step guidelines for registering custom perimeters
  4. Examples for using custom perimeters with both individual vertices and globally

This addition makes the documentation more complete and actionable for developers.

packages/core/src/view/style/edge/EntityRelation.ts (1)

27-43: Great JSDoc comment addition!

This comprehensive JSDoc block significantly improves the code's maintainability by:

  1. Explaining the purpose of the EntityRelation edge style
  2. Detailing how the function operates on the result array
  3. Clarifying the role of each parameter
  4. Describing the expected behavior for terminal points

This documentation enhancement aligns perfectly with the PR's goal of improving the structure and documentation of edge styles.

packages/html/stories/Wires.stories.js (1)

702-702: Registration of WireConnector correctly updated.

The registration of the custom edge style has been correctly updated to match the new pattern, using the direct function reference instead of accessing it through the EdgeStyle class.

🧰 Tools
🪛 ESLint

[error] 702-702: 'WireConnector' is not defined.

(no-undef)

packages/core/src/view/style/edge/index.ts (1)

19-26: Excellent restructuring to support tree-shaking!

This change perfectly implements the core PR objective by:

  1. Replacing the static-only class with individual named exports
  2. Enabling bundlers to tree-shake unused edge styles
  3. Providing cleaner, more modular access to edge style functions
  4. Maintaining the aliasing of OrthogonalConnector as OrthConnector for backward compatibility

This structural change will help reduce bundle sizes when only a subset of edge styles is used.

packages/website/docs/usage/edge-styles.md (12)

8-11: Great: TypeScript/JavaScript information.

The info block clearly indicates language usage and guides users to adapt examples between TypeScript and JavaScript.


21-24: Note block is clear.

The registration note and link to Global Configuration effectively direct users to related documentation.


29-31: Info block on CellStateStyle.edgeStyle is helpful.

This guidance directs users to detailed API docs for edgeStyle.


33-34: Introduction of EdgeStyle namespace is clear.

The description succinctly explains how the namespace keys map to style properties.


35-39: ElbowEdgeStyle example is correct.

The code snippet clearly demonstrates setting the elbowEdgeStyle key.


41-45: Tip block is informative.

The note on CellStateStyle.edgeStyle type helps users understand type constraints.


66-77: Custom EdgeStyle example is clear.

The TypeScript snippet properly demonstrates implementing a custom style function.


79-82: Registration example is correct.

The StyleRegistry.putValue call clearly shows how to register the custom style.


87-90: Usage example is correct.

This snippet demonstrates setting the custom style for an individual edge.


92-94: Verify API reference consistency.

The doc mentions both CellState.edgeStyle and CellStateStyle.edgeStyle in different places. Please verify the correct interface/type name and make it consistent throughout.


95-100: Global custom EdgeStyle application snippet is clear.

The example correctly shows setting the default edge style for all edges.


102-105: No action needed.

This final snippet aligns with the previous usage examples; the static analysis hint about a missing comma appears to be a false positive.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~102-~102: Possible missing comma found.
Context: ...edgeStyle` key in a style of a specific edge as follows: ```javascript style.edgeSty...

(AI_HYDRA_LEO_MISSING_COMMA)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/ts-example/vite.config.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/core/src/view/style/edge/Segment.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/html/stories/Wires.stories.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/html/stories/Wires.stories.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/website/docs/usage/edge-styles.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/website/docs/usage/edge-styles.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

tbouffard added 5 commits April 29, 2025 15:27
@tbouffard
Wire story: fix WireConnector declaration
9f34d97
@tbouffard
edge styles doc: fix wrong key
236ff0a
@tbouffard
edge styles doc: replace wrong reference to perimeter [skip ci]
807e682
@tbouffard
story: remove unused import [skip ci]
4aa8e05
@tbouffard
Merge branch 'main' into feat/edgestyle_tree-shaking
f38d2f5
coderabbitai[bot]
coderabbitai Bot reviewed Apr 30, 2025
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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: 0

🧹 Nitpick comments (5)
packages/website/docs/usage/edge-styles.md (5)

3-4: Fix duplicate wording in the description.

The front-matter description currently reads “How-to use use builtin EdgeStyles and create new EdgeStyles.”
Consider removing the extra “use” and hyphenating “built-in”:

- description: How-to use use builtin EdgeStyles and create new EdgeStyles.
+ description: How-to use built-in EdgeStyles and create new EdgeStyles.

8-11: Refine the TypeScript/JavaScript admonition.

The info block could be made more concise and fix minor punctuation:

- :::info
- The code examples provided on this page are written in `TypeScript`.
- Don't forget to adapt them if you use `JavaScript`.
- :::
+ :::info
+ The examples use `TypeScript`; adapt them if you write `JavaScript`.
+ :::

33-39: Clarify connector name vs. registry key.

The text says “sets the edge style to ElbowConnector” but the example uses the 'elbowEdgeStyle' key. To avoid confusion, align the terminology:

- The following example sets the edge style to `ElbowConnector` which is registered by default under the `elbowEdgeStyle` key:
+ The following example uses the built-in ElbowConnector (registered under the `elbowEdgeStyle` key):

80-83: Include necessary imports for registration snippet.

The example registers MyStyle without showing imports. For completeness, add:

+ import { StyleRegistry } from '@maxgraph/core';
+ import type { EdgeStyleFunction } from '@maxgraph/core';

above the registration call.


89-90: Remove duplicate usage example.

The custom EdgeStyle usage is shown twice (lines 89–90 and 104–105). Consider consolidating one of these to keep the guide concise.

Also applies to: 104-105

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 236ff0a and f38d2f5.

📒 Files selected for processing (2)
  • packages/html/stories/Wires.stories.js (3 hunks)
  • packages/website/docs/usage/edge-styles.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/html/stories/Wires.stories.js
🧰 Additional context used
🧠 Learnings (1)
packages/website/docs/usage/edge-styles.md (2)
Learnt from: tbouffard
PR: maxGraph/maxGraph#791
File: packages/website/docs/usage/edge-styles.md:59-63
Timestamp: 2025-04-29T13:32:14.559Z
Learning: In the EdgeStyles documentation, the sentence "A perimeter is a function matching the `EdgeStyleFunction` type" contains an incorrect term - "perimeter" should be replaced with "EdgeStyle" or "custom EdgeStyle" as the document is specifically about EdgeStyles.
Learnt from: tbouffard
PR: maxGraph/maxGraph#791
File: packages/website/docs/usage/edge-styles.md:59-63
Timestamp: 2025-04-29T13:30:18.658Z
Learning: In the EdgeStyles documentation, tbouffard prefers the existing text "A perimeter is a function matching the `EdgeStyleFunction` type" over suggestions that might create redundancy, even if terminology might be technically misaligned.
🪛 LanguageTool
packages/website/docs/usage/edge-styles.md

[uncategorized] ~102-~102: Possible missing comma found.
Context: ...edgeStyle` key in a style of a specific edge as follows: ```javascript style.edgeSty...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build (windows-2022)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: build
🔇 Additional comments (2)
packages/website/docs/usage/edge-styles.md (2)

66-77: Verify return semantics of the custom EdgeStyle function.

The snippet pushes a point into result but does not explicitly return it. Please confirm whether the EdgeStyleFunction contract requires return result; or relies on in-place mutation.


102-102: Skip false-positive punctuation warning.

The static analysis tool flagged a missing comma here, but the sentence flows correctly without it.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~102-~102: Possible missing comma found.
Context: ...edgeStyle` key in a style of a specific edge as follows: ```javascript style.edgeSty...

(AI_HYDRA_LEO_MISSING_COMMA)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tbouffard added 4 commits April 30, 2025 07:23
@tbouffard
docs: improve page description
444a32f
@tbouffard
docs: use more concise info to mention that examples are written in TS
28f0cd3
@tbouffard
docs: improve examples [skip ci]
ab66e24
@tbouffard
docs: add links to the Wires story to demonstrate custom EdgeStyle [s…
5bd94da
…kip ci]
@sonarqubecloud

sonarqubecloud Bot commented Apr 30, 2025

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tbouffard
tbouffard merged commit 7c0e421 into main Apr 30, 2025
@tbouffard
tbouffard deleted the feat/edgestyle_tree-shaking branch April 30, 2025 05:27
This was referenced Jul 23, 2025
fix: consistently compute the arcSize for edges and vertices #884
Merged
test: add more tests for FitPlugin.fit #888
Merged
feat: accept more nullish parameter in various methods #892
Merged
refactor: fix most problems in the Wires story #893
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Nov 6, 2025
chore(deps-dev): bump vite from 6.3.5 to 7.2.1 #941
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Mar 26, 2026
docs: fix orthogonal projection description and add cross-links #1030
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Aug 20, 2026
chore(examples): add bundle analysis and blocking size budgets #1145
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Refactor Perimeter and EdgeStyle to support tree shaking

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@tbouffard
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.