Commit Graph

617 Commits (d33769fad5e6c2ee1dd216939e07deb4745381b7)

Author SHA1 Message Date
Thomas Bouffard d33769fad5
fix: declare default parameter values in xmlUtils.prettyXml (#181) 2023-03-05 12:03:24 +01:00
Thomas Bouffard 1447fd29fc
docs: reorganize the "migration from mxGraph" documentation (#171)
Move everything from the README to the dedicated migration doc.
Clarify the existing content.

Co-authored-by: Souchet Céline <4921914+csouchet@users.noreply.github.com>
2023-01-30 15:01:55 +01:00
Thomas Bouffard c4efba2952
docs: add the release process (#176)
It includes
  - code update
  - milestone and release notes management
  - npm package publish

Co-authored-by: Souchet Céline <4921914+csouchet@users.noreply.github.com>
2023-01-30 14:19:01 +01:00
Thomas Bouffard 3095aef7e6
refactor(CellState): simplify expressions and improve JSDoc (#170)
Improve the JSDoc of methods under the "appearance" group
2023-01-30 11:55:37 +01:00
Thomas Bouffard ca1914b582
refactor(style)!: rename/remove properties and types (#165)
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.
2023-01-30 11:44:06 +01:00
Thomas Bouffard 5ecfda6b2b
refactor!: remove helpers function processing string style (#173)
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.
2023-01-17 12:18:33 +01:00
Thomas Bouffard 6fc05a3876
refactor: simplify fontStyle code checking binary mask (#174)
Introduce the `styleUtils.matchBinaryMask` function to remove
duplication in the code checking binary mask on `fontStyle`.
2023-01-17 12:08:32 +01:00
Thomas Bouffard ed2ae41428
refactor(docs): move all docs sources to a dedicated docs package (#168)
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
2023-01-09 16:03:52 +01:00
Thomas Bouffard 3d1d68afd7
refactor: remove scripts used to migrate from mxGraph (#167) 2023-01-08 15:16:02 +01:00
Thomas Bouffard 171c8f8134
fix: SwimlaneMixin handles the 'style.horizontal' `undefined` value (#156)
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.
2023-01-06 16:59:18 +01:00
Thomas Bouffard 3fff754cd6
fix: correctly manage the markers fill style (#157)
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
2023-01-06 16:53:54 +01:00
Filip Wróbel a247b38268
fix: use the right convertPoints function in Stories (#166)
Changed `mathUtils` -> `styleUtils` in affected stories.
2023-01-06 14:16:46 +01:00
Thomas Bouffard ee7d0fce6c
fix: Graph importCells/moveCells declare optional parameters (#160)
Also move the JSDoc from implementation to the type declaration. The
documentation is thus made available to consumers.
2023-01-06 14:12:17 +01:00
Thomas Bouffard 5c53465c8e
fix: improve style configuration extensibility (#163)
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.
2023-01-06 10:52:53 +01:00
Thomas Bouffard 097cd90d50
docs: add JSDOc to CellStateStyle properties (#162)
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>
2023-01-05 11:10:31 +01:00
Thomas Bouffard 5a346079b5
fix: consider default style when computing effective style properties (#152)
`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.
2022-12-17 09:16:26 +01:00
Thomas Bouffard b7a322b36f
fix: CellOverlay constructor use all parameters to set properties (#159)
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`.
2022-12-16 16:51:51 +01:00
Thomas Bouffard e730207a3d
ci: use more recent OS versions when building (#155)
macos: 11 to 12
ubuntu: 20.04 to 22.04
windows: 2019 to 2022
2022-12-14 14:16:13 +01:00
Анатолий Майоров 3954001a84
fix: fire selection `CHANGE` event to correct listener (#118)
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.
2022-12-08 08:49:02 +01:00
Анатолий Майоров a3b5a60c60
fix: Fix for cells not removed (#115)
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.
2022-12-08 08:27:11 +01:00
Thomas Bouffard 7e9bc662be
docs: update README after the first public release (#145)
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.
2022-11-22 10:45:15 +01:00
Thomas Bouffard c60b8496a3
docs: update Changelog for version 0.1.0 (#146) 2022-11-22 08:28:59 +01:00
Thomas Bouffard 36c775bc37
docs: include License and Readme files in the npm package (#144)
The README included in the npm package contains mainly an extract of the
README of the repository and a link to it to avoid too many duplicates.
2022-11-22 07:49:05 +01:00
Thomas Bouffard e45b405c68
docs: list former mxGraph tags in CHANGELOG.md (#140)
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.
2022-11-22 07:07:34 +01:00
Thomas Bouffard 6fe7f7fde0
chore: force usage of a recent @types/node version (#143)
Use a recent version of `@types/node` that works with TypeScript 4.9,
older versions have types issues.
2022-11-22 07:03:48 +01:00
bihua 92aef9bf11
fix: TouchEvent is not available in Safari and Firefox Desktop (#127)
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>
2022-11-20 21:06:03 +01:00
Thomas Bouffard 24b0cda11a
docs: configure the auto-generated release notes (#142)
Add the configuration file for the GitHub releases.
2022-11-20 20:43:57 +01:00
Thomas Bouffard aeea27dcc8
chore(deps): bump typescript from 4.8.3 to 4.9.3 (#139)
Also bump typedoc 0.23.15 to 0.23.21 to get TS 4.9 support.
2022-11-20 17:23:46 +01:00
Thomas Bouffard 9e7a6034c7
Apply eslint and prettier autofixes on codebase (#133)
Refactor code based on eslint and prettier rules
2022-11-20 17:03:20 +01:00
Anatoliy Mayorov 53eb5c91a9 fix: typescript transpile error (#138) 2022-11-20 15:00:16 +03:00
Anatoliy Mayorov a3102afa74 refactor: abstract classes, empty methods
Add abstract definition to abstract classes
Fill empty methods blocks with return
Remove unnecessary escapes in regexes
2022-11-20 14:05:46 +03:00
Anatoliy Mayorov 5a29d2fa1a refactor: fix eslint errors
Eliminate unnecessary code
Eliminate var usage
2022-11-20 14:02:48 +03:00
Anatoliy Mayorov fa67c24df3 chore: eslint - switch no-this-alias error to warn
Switch rule to warn for now - too many
complicated code that uses `self` alias for this
2022-11-20 13:59:21 +03:00
Thomas Bouffard d30e3a239d
Fix edge segment handles not being rendered (#120)
Fixed rendering of handles on segments of edges
2022-11-14 07:23:34 +01:00
Thomas Bouffard 27f75a59f3
docs: set the minimum TypeScript requirement to 3.8 (#128)
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).
2022-11-07 18:31:40 +01:00
Thomas Bouffard 97d3ea76d1 ci: check that there is no lint errors 2022-11-07 18:20:38 +01:00
Anatoliy Mayorov 2ad1395aab refactor: run eslint and prettier on codebase 2022-10-29 22:53:09 +03:00
Anatoliy Mayorov 41c5e468ed chore: add missing eslint deps 2022-10-29 22:49:23 +03:00
Анатолий Майоров 9428ba2a4a
fix: DynamicLoading story, Codec and parseXml (#125)
Fix `DynamicLoading` story
Restored backward compatibility when using `parseXml`
Possible fix for `Codec.decode` method issue
2022-10-28 15:37:02 +02:00
Thomas Bouffard 5e05ba17c2
chore(tsconfig): add base tsconfig.json (#129)
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`
2022-10-23 11:18:38 +02:00
Anatoliy Mayorov d53ea1ad2b chore(tsconfig): move baseUrl to base tsconfig 2022-10-23 11:56:07 +03:00
Анатолий Майоров 3527a77eb6
chore: configure eslint (#123)
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.
```
2022-10-23 09:41:41 +02:00
Anatoliy Mayorov 7e5360ad97 chore(tsconfig): add base tsconfig.json 2022-10-23 10:33:45 +03:00
Thomas Bouffard 1eabc24777
deps: bump typescript to 4.8, fix Dictionary typings (#109)
- 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)
2022-10-22 11:57:52 +02:00
Thomas Bouffard ef76a1db87
Merge branch 'development' into development 2022-10-22 10:41:32 +02:00
Thomas Bouffard 5b1369b019
Merge pull request #119 from mayorovad/edge-mixin-typo
Fix wrong method signature in EdgeMixin (resetEdgesOnMove).
2022-10-10 07:22:42 +02:00
Thomas Bouffard f08b041c3d
Merge pull request #121 from mayorovad/overlays-stories-fix
Fix stories with overlays usage
2022-10-10 07:14:30 +02:00
Thomas Bouffard 4622527af8
Merge pull request #124 from mayorovad/issue-96 2022-10-09 22:32:39 +02:00
Thomas Bouffard a617bb644a
Merge pull request #113 from mayorovad/visibility-story-fix
Fixed `Visibility` story
2022-10-09 20:05:57 +02:00
Thomas Bouffard 4804767baf
Merge pull request #117 from mayorovad/guides-fix
Fixed `Guides` story.
2022-10-09 20:05:29 +02:00