The vite built complained about an invalid "paths" settings in the root
tsconfig.json file.
It wasn't nested inside a "compilerOptions", so it was useless and this
configuration has been removed.
Explicitly call the elements to remove the side effects in
`CellRenderer` and `StyleRegistry`.
This prepares the possibility to mark the library as "side effects free"
and will allow to changes the defaults in the future.
Create a dedicated example with webpack to reproduce the problem. Names
used to retrieve the codecs are set directly in the codecs at
initialization to not depend on the actual constructor names.
This changes also partially fixe the export/encode. The Geometry is not
correctly encoded. More work is needed to make this work, probably by
modifying the way Codecs are registered and retrieved.
The position was incorrect for child using relative geometry.
Introduce a new const to avoid overriding other const with the
same name defined before.
This side effect had been introduced during the migration from mxGraph.
Implementation relies on both the declaration of aliases and the
introduction of dedicated codecs.
`Codec.getCodecByName` now takes aliases into account, so that importing
is fully functional.
The code of some `CodecRegistry` and `Codec` methods has been simplified
(check for nullity of method parameters).
The cell style is converted thanks to a specific utility function that
can serve as an example for those wishing to migrate their applications
from mxGraph to maxGraph.
test
- The `Codec` example has been restored from the stashed directory. It
is now available as a story written in TypeScript.
- The `ModelChecker` utility class was previously used only to validate
the imported model after import from the maxGraph model. It is now
shared and also used in mxGraph import tests. It has also been enhanced
to check the total number of cells in the model.
It was incorrectly defined as DIRECTION after the migration from
mxGraph.
Also improve the type signature and JSDoc of
mathUtils.getPortConstraints which is the only function that uses the
`portConstraintRotation` property in maxGraph.
The release process of the "examples" repository is directly documented
and managed in the repository.
This makes the 2 repositories more independent, and provides more
flexibility.
Declare generic `ObjectCodec` for `Cell` properties that are defined as
XML node. Codecs are currently only registered automatically during
encode/export, so for now, they have to be registered to be available
during decode/import.
Also improve some methods signatures in base Codec objects (use specific
types instead of `any`).
Fix Story by using `ModelXmlSerializer` to ensure that codecs are
correctly registered. Also move the code of the story to TypeScript to
better detect the errors.
In addition:
- update `DynamicStyle.stories.js` to improve comments and the code.
- change the `moduleResolution` to `node` in tsconfig to work in all
IDE. This is a temporary change.
Converted the following remaining "stashed" examples to Storybook:
- GraphLayout
- HtmlLabel
- MenuStyle
- ShowRegion
- Scrollbars (is starting to display, but appears to have a bug where `<g>` elements are inserted outside of the `<svg>` element)
- Wires
The examples are still not fully working. As the mxGraph examples were previously migrated to nextjs/react, some original code may not have been ported correctly.
Additional changes in @maxgraph/core:
- Fixes the default parameters in `MaxPopupMenu` and `Morphing` to restore the original `mxGraph` behavior.
- Graph: add new "create*" factory methods to ease the extension:
- createEdgeHandlerInstance(state: CellState): EdgeHandler
- createGraphDataModel(): GraphDataModel
- createSelectionModel()
---------
Co-authored-by: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com>
The changes are based on recent feedback from newcomers.
Also
- improve the link to the mxGraph documentation.
- README bundled in the npm package: add a link to GitHub repository
README to guide people to the getting started information.
Also update the name of the artifact by using a dedicated name per OS
With actions/upload-artifact@v4, it is not possible to upload to the same named Artifact multiple times.
This class was previously only available in test. It simplifies maxGraph
model import/export as:
- it hides `Codec` and `HTMLElement` management
- it registers codecs automagically
Previously, codec classes were defined and registered in the same file
as the class they targeted. This prevented efficient tree-shaking: as
soon as the target class was imported (e.g. `StyleSheet`), the
corresponding codec was also imported (`StyleSheetCodec`). As a result,
a large amount of codec code (and dependent code) was present in
applications incorporating maxGraph, even if they didn't use the codec
function. As there are currently many problems with the codec function
that make it almost unusable, this was a great waste.
Codecs are no longer registered by default, which reduces side effects
and coupling.
It also greatly improves tree-shaking.
For example, in the `ts-example` application included in this repository
which doesn't use the "codec" feature, the size of the minified
`maxGraph` chunk goes from `568.58 kB` to `467.90 kB`, which corresponds
to a size reduction of `17.7%`!
BREAKING CHANGE: Codecs supplied by `maxGraph` are no longer registered
by default. They MUST be registered before performing an `encode` or
`decode`. You can use one of the following functions to register codecs:
- `registerAllCodecs`
- `registerCoreCodecs`
- `registerEditorCodecs`
In addition, apply minor refactoring
- Codec.decodeCell: improve signature (default value)
- ObjectCodec
- use Codec type instead of value in import
- simplify implementation of ObjectCodec.isNumericAttribute
By default, `jest` runs tests in parallel. However, with the current
configuration of `ts-jest`, all workers run `tsc` in parallel, which is
very slow and consumes a lot of resources. This is what takes the
longest.
By running `jest` serially, `tsc` runs before starting the first test,
then all subsequent tests run faster. This will probably be improved by
customizing the configuration of `jest` or with future versions of
`ts-jest`.
Add guards to prevent accessing properties and methods on undefined
instances when a plugin is not loaded.
Also fix and improve the JSDoc of the `EdgeHandler` and `Guide` classes.
`maxGraph` was using `lerna` v4 to build and only used its "build
workspaces" support, not the "publishing" support as we only published a
single package and it is done manually, without using `lerna`.
The support for packages in `lerna` was removed in version 7. See
https://github.com/lerna/lerna/releases/tag/7.0.0 and
https://lerna.js.org/docs/legacy-package-management.
So, start using npm workspaces as we don't need to manage the publishing
of several packages for now.
This will allow to do more reproducible builds by locking dependencies
with a `package-lock.json` file. This didn't work well with `lerna` v4
and had been disabled.
Provide various improvements
- fix `InternalEvent`
- improve `Client`
- improve explanations about plugins
- removed `mxUtils` methods
- removed `isVisible` methods
Also use more admonitions.
Get rid of the UMD bundle: not pratical, not minimified so not ready for
production, nor for reuse.
This lets remove the webpack build which was not used anymore.
- core build: everything is done with tsc and simplify pack
- remove webpack configuration
- Move typedoc in the package where it is used (make it easier to detect
usage)
- remove unused dependencies:
- better-docs (use typedoc instead)
- webpack loaders (css, file, style, url)
- babel
- circular-dependency-plugin (webpack plugin)
- webpack
- cross-env
- core build: tsc only
BREAKING CHANGE: the UMD bundle is no more provided in the npm package
Initiate the website with Docusaurus v3.
Setup the site and includes the content that was already available in
the `docs` package.
The currently implementation mainly uses the default theme available
when using the Docusaurus scaffolding. It was initiated with:
`npx create-docusaurus@3.0.0 my-website classic`
Replicate the improvements done in the `maxgraph-integration-examples`
repository:
- introduce function to simplify the main file
- Remove out dated comments
- Simplify the code and use "type" imports when possible