Conversation
Finish converting core to ts, JSDoc conversion, consistency+conventio…
junsikshim
left a comment
There was a problem hiding this comment.
Nice work!
I had to remove NODE_OPTIONS=--openssl-legacy-provider to make it run though, people with older versions of node (< 17) would face this problem.
A couple of things to comment on.
- Please run prettier on all the files so that the styles stay the same.
- I think IDE configuration files should be excluded from git repository(add to .gitignore), but it's up for debate.
Thanks!
| */ | ||
| isLayer(cell: Cell) { | ||
| return this.isRoot(cell.getParent()); | ||
| return cell != null && this.isRoot(cell.getParent()); |
There was a problem hiding this comment.
If cell can be null or undefined, I think it's better change the method signature,
perhaps something like isLayer(cell?: Cell).
| * left side of the current selection. Default is false. | ||
| */ | ||
| guidesEnabled = false; | ||
| guidesEnabled = true; |
There was a problem hiding this comment.
If guidesEnabled should be true by default, please update the comments above. :)
| * Maximum number of cells for which live preview should be used. Default is 0 which means no live preview. | ||
| */ | ||
| maxLivePreview = 0; | ||
| maxLivePreview = 50; |
There was a problem hiding this comment.
Like above, please change the comment accordingly if the default value must change.
|
|
||
|
|
||
|
|
||
| for (var i = 0; i < childCount; i++) |
There was a problem hiding this comment.
Let's get rid of vars. :)
| container.style.width = `${args.width}px`; | ||
| container.style.height = `${args.height}px`; | ||
| container.style.width = '321px'; | ||
| container.style.height = '241px'; |
There was a problem hiding this comment.
It'd be great if we can set the pixel values using storybook arguments.
tbouffard
left a comment
There was a problem hiding this comment.
Thanks for sharing this Pull Request. This is a lot of work.
I am pretty sure that the Pull Request contains a lot of valuable work but it is too large to review.
It also contains too much unwanted formatting changes that makes it hard to read.
There are also some logic changes that requires to be discussed because I don't understand why they are needed. I don't have time to look at all commits to try to find where they could be required.
The lib has no automatic tests, and examples don't cover all use cases. It is also very easy to fix an example and break another one. The current proposal also contains several default changes that need to be discussed.
I suggest to split the work into several smaller Pull Requests: start with examples that only require storybook files changes. That way, we can review and merge working examples quickly and have more time to discuss tricky subjects
| "webpack-merge": "^5.8.0" | ||
| }, | ||
| "sideEffects": true | ||
|
|
| decode(node: Element, into?: any): any { | ||
|
|
||
|
|
||
| //****Edit note - there may be other classes needed here????****** |
| // @ts-ignore | ||
| ctor = window[node.nodeName]; | ||
| ctor = classMap[node.nodeName] | ||
| if (ctor == undefined) console.log(node.nodeName) |
There was a problem hiding this comment.
Please do proper Error management
| imageBorder?: ColorValue; | ||
| imageHeight?: number; | ||
| imageWidth?: number; | ||
| imageVerticalAlign?: VAlignValue; |
There was a problem hiding this comment.
For indicator only? There was no need for this in the original mxGraph code, why do we need this now?
| (transients == null || transients.indexOf(i) < 0) | ||
| ) { | ||
| if (!shallow && typeof obj[i] === 'object') { | ||
| if (!shallow && typeof obj[i] === 'object') { |
There was a problem hiding this comment.
Extra change + formatting issue
| "main": "index.js", | ||
| "scripts": { | ||
| "dev": "start-storybook -p 8901" | ||
| "dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 8901 ./public" |
There was a problem hiding this comment.
Please revert this: see #74 and #64 (reply in thread)
| } | ||
| }; | ||
|
|
||
| //getBBox of SVG element before rendered in DOM |
| bbox = new Rectangle( | ||
| (x + 1) * s.scale, | ||
| x * s.scale, | ||
| (y + 2) * s.scale, | ||
| w * s.scale, | ||
| (w +1) * s.scale, | ||
| (h + 1) * s.scale | ||
| ); |
There was a problem hiding this comment.
I am pretty sure the previous implementation cames from the orignal mxGraph.
There are a lot of place where there are +1 on position, width or height. It is very hard to do the review here. Unfortunately, I don't have time to dig into the 56 commits to find which example may need the change and how this change impacts other examples.
| if (point) { | ||
| perimeter = edge.style[source ? 'exitPerimeter' : 'entryPerimeter'] || false; | ||
|
|
||
| perimeter = edge.style[source ? 'exitPerimeter' : 'entryPerimeter'] || true; |
| >; | ||
| type PartialType = PartialGraph & PartialFolding; | ||
|
|
||
| Client.imageBasePath = '/images' |
There was a problem hiding this comment.
You are changing the configuration here and this impacts all users of the lib, not only the example.
|
Thanks both for reviewing and thanks for the feedback. I'll look into seeing how the PR can be improved by splitting and tidying up some of the formatting |
|
@gelvidge hi, I will have some time on Thursday (June, 9th) to work on the project. I can try to cherry-pick some commits that quickly fix the examples in a dedicated PR. |
|
Yes that is OK. I will aim to get around to submitting the new commits soon but all my contributions can be under Apache v2 |
|
@gelvidge hi, do you still plan to recreate some PR based on the fixes proposed here? So I suggest you synchronize together if you both want to set new stories. |
|
This PR is kept opened on purpose even if it won't be merged. There is no need to update it, nor rebase it, as it it too large. However, it contains a lot of valuable information and fixes. It can be used as a source of information to create new focused and small PR about a single topic. |
|
Closing this PR. |
Summary
Fixes majority of html examples. Some small bugs may remain but 99% ok
Description for the changelog
Updates example html files and fixes bugs in core code that were found when testing
Other info
covers #73