Remove the `StyleMap` class. It is not used anymore since the
introduction of the `CellStateStyle` interface.
Changes in `CellStateStyle`
- remove `defaultEdge` and `defaultVertex` that have been introduced by
mistake. They have never been used.
- rename `autosize` into `autoSize` for naming consistency. All
properties use camelCase.
- change types from "number" to "boolean" + fix default management in
the Shape classes
- `backgroundOutline`
- `absoluteArcSize`
Other `CellStateStyle` changes: remove a property in favor of another
property
The following properties were introduced by mistake while removing
mxConstants.STYLE_* references in
707605cedd (2021-05-02). Their counterpart
was used in `mxGraph` and is used in all
`maxGraph` examples
- `backgroundColor` in favor of `labelBackgroundColor`. The
`STYLE_LABEL_BACKGROUNDCOLOR` constant was replaced by
'backgroundColor' instead of 'labelBackgroundColor'
- `loop` in favor of `loopStyle`. The `STYLE_LOOP` constant was replaced
by 'loop' instead of 'loopStyle'
Other types that changed
- `CellStateStyle`: better type guidance for the `indicatorShape`
property
- `CanvasState`: order properties alphabetically + add JSDoc on some
properties
- Rename `ArrowType` into `ArrowValue` for consistency with other types
(they all end with the 'Value' post-fix)
Documentation update
- CHANGELOG.md: mention the breaking changes
- Initiate a specific document to help migration from mxGraph: start by
adding the changes on style
--------------------------------------------------------------------------------
**BREAKING CHANGES**: some `CellStateStyle` properties and types have
been removed/renamed.
Helper functions involving "style in the string form" have been removed
from `styleUtils`. Styles are defined using the `CellStateStyle` and it
is no longer necessary to process strings.
Removed functions
- addStylename
- getStylename
- getStylenames
- indexOfStylename
- removeStylename
- removeAllStylenames
- setStyle
**BREAKING CHANGES**: some `styleUtils` functions have been removed.
Keep the former mxGraph documentation to allow a later documentation
migration.
Remove both the former mxGraph and the new maxGraph API docs as they can
be generated.
Remove the former mxGraph examples home page as it has been replaced by
Storybook.
Update the configuration to generate the maxGraph API docs
- remove jsdoc resources as it is not used anymore
- configure the core package to generate the API docs in the docs
package
- add a GitHub workflow to ensure we can generate the API docs without
errors
The horizontal value was considered as true only if was set to true.
It is now also considered as true when set to undefined, as everywhere
else in maxGraph.
SwimLanes.stories.js: update configuration to display nodes.
This update is just a starting point. There is still much to do to match the previous mxGraph example.
Previously, when setting startFill/endFill, the display was inverted
comparing to the configuration.
The marker was filled when set to false, not filled when set to true.
When not set, the marker was filled, which is the expected default.
The issue came from a wrong condition to manage the default value and
was reproduced with the Markers Story.
In addition to the code fix, update the Markers.stories.js to fix style
configurations
- use number instead of string for markers size
- use boolean instead of number for start/end fill
The type of the `endArrow`, `startArrow` and `shape` properties in
`CellStateStyle` were too strict. They prevented to
use custom registered shapes in the style configuration without using a
cast.
Markers of the arrow and custom shapes can be registered by using
methods in `MarkerShape` and `CellRenderer` respectively.
The key to identify the shapes is a string so the types of the
properties in `CellStateStyle` now allow `string` as well.
These offer both the type guidance for standard maxGraph registered
shapes (via a dedicated type) and the extensibility
for custom shapes.
These properties were not documented after the style configuration was
changed (move from the string-based to the object-based configuration).
In mxGraph, the properties were documented in `mxConstants`.
The documentation is created based on `mxGraph`, `typed-mxgraph` and the
current `maxGraph` implementation.
Some properties remains undocumented because they are not used, some
have a wrong type (mainly number instead of boolean). This will be managed
in a next commit.
Co-authored-by: Souchet Céline <4921914+csouchet@users.noreply.github.com>
`StyleSheet.getCellStyle` didn't keep the properties of the default
style when `baseStyleNames` was set in the `cellStyle` parameter.
The JSDoc was incorrect (it came from mxGraph) about how the style is
computed, in particular about the default style. It probably leads to
the erroneous implementation during migration. It is now fixed and
clearly describe the rules followed to merge style properties.
The 'Stylesheet' story has been updated to correctly use the maxGraph
API. It also includes more examples involving `baseStyleNames` to
show the 'properties merge' in action.
The `align` and `verticalAlign` values passed to the constructor weren't
set, so the overlay position was always set to
the default one.
The `align` and `verticalAlign` properties are now using the AlignValue
and VAlignValue types respectively instead of
defining inline types. This improves the consistent in the whole code.
To demonstrate the fix, the Overlays story now set 'align' and
'verticalAlign' randomly.
Also introduce `jest` to test the fix and the whole
implementation of the changed method. Types check support is provided by
`ts-jest`. As maxGraph uses a lot of browser objects, also setup
`jest-jsdom-environment`.
The `CHANGE` event is now fired to `GraphSelectionModel` instead of `Graph`.
This is the behavior of mxGraph that was mistakenly modified during the migration of the code.
There was a logical error in processing `ChildChange` in `Graph`. When cell was removed, `ChildChange` created to change parent of removed cell to `null`. But in code, if parent is null, code to destroy child cell state was not called, so cell stayed rendered on canvas.
The fix add a check for "falsy" parent, so correct branch of code is executed and cells are destroyed.
Update the project status.
npm package availability:
- add a badge to display the latest version available in the npm
registry.
- explain how to install maxGraph in applications.
The former mxGraph tags have been removed. List them in the changelog
for history.
Also update the project status in the README as there is no more
blocking issue for a first release.
Add the `window.TouchEvent` guard prior code involving `TouchEvent`.
`TouchEvent` is not available in Safari and Firefox Desktop.
Co-authored-by: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com>
Co-authored-by: Анатолий Майоров <mayorov.ad@outlook.com>
We use a recent TypeScript version to build maxGraph but applications
that integrates it may be forced to use old TypeScript versions.
We never explain what is the minimum TypeScript version requires to use
`maxGraph`. The changes proposed here are a first step to make this
information available.
It is only informative for now (mentioned in the README) and the minimum
TypeScript version is tested in the `ts-support` package (part of the
'build' GitHub workflow).
Add base `tsconfig.json` to root of repository and extend packages upon
it. Refactoring `src` values of `tsconfig.json` of packages.
- Moved repeating declarations in base `tsconfig.json`
- Removed `ESNext` target/module/lib from `ts-example`, which will lead
to use of `es2020` from base `tsconfig.json`
Added `eslint` to project and configured it. The fixes will be applied later.
```
Found 1855 problems (709 errors, 1146 warnings) 🙈
628 errors and 291 warnings potentially fixable with the `--fix` option.
```
- Bumped Typescript to 4.8.3 and typedoc to 0.23.15
- Moved types IdentityObject and IdentityFunction to types.ts
- Renamed const FIELD_NAME to IDENTITY_FIELD_NAME and moved it to
util/Constants.ts
- Set Cell and CellOverlay to implement IdentityObject (found only them
using in Dictionary as key)