Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shared): add duplicate shared code from Vis * projects #720

Merged
merged 64 commits into from
Jan 8, 2021
Merged

Conversation

Thomaash
Copy link
Member

@Thomaash Thomaash commented Jan 7, 2021

This includes the lib/shared folder that is identical across our projects and also the Hammer helper as some code in lib/shared depends on it. Everything is exported via the main index except for styles which are located in styles folder so that we don't inline them into JS.

This isn't a breaking change from Vis Util's perspective but it's use will be a breaking change as it no longer uses innerHTML to set text/HTML in the popup (due to XSS concerns). No functionality is lost by this as those who want HTML can simply pass elements (it's easy to pass unsanitized string by accident, passing elements however has to be done intentionaly).

josdejong and others added 30 commits January 7, 2021 20:34
…twork was blocking click events in the web page.
not sure but for some reason, once the colorpicker is open, the buttons won't work correctly and the huecircle jumps back.
- Accepted pull request #1544, thanks @felixhayashi!
- Fixed documented bug in #1544.
…of physics.

added example. Improved handling of options for hierarchical view.
michel404 and others added 24 commits January 7, 2021 20:34
* Corrects usage of @static jsdoc annotation

* Correct unresolvable types

* Correct types in jsdoc and remove extraneous @Class & @constructor jsdoc

* Remove incorrect @static jsdoc

* Adds missing jsdoc for param copyFromGlobals

* correct jsdoc in util

* Corrects casing on jsdocs

* Swaps @inheritdoc to @ignore for constructors where constructor args are documented in the class

* Instantiates Errors with `new`

* Addresses improperly defined @callback tags.

* Split callbacks out to separate jsdoc

* Moves constructor jsdocs back to constructor and drop @ignore.
…nd Object prototypes (#3471)

* Added unit test for Array.prototype mangling - first passing version

* Enhanced unit test for prototype stressing to catch more illegal for-in loops

* Fixed all for-in linting violations
* Adds code coverage report the output of `npm test` and adds detailed html code coverage report using the command `npm run-script test-cov`

* Switch over to using functions in lib/ rather than dist/, so that code coverage stats are complete.

* Import vis at the top level to keep ItemSet passing

* Remove requirement for dist/vis in TimelineItemSet

* Adds tests for Popup

* Tests and sinon dependency introduced

* Code changes to modules to tighten up code

* Corrects broken tests and adds more tests to ColorPicker

* Adds additional tests to DataSet

* Adds tests for uuid

* Removes unused functions from util

* Adds tests for utils: recursiveDomDelete, isDate, convert and isType

* removes redundant code

* Adds additional util tests

* Address spacing, and unnecessary tests

* Correct test description

* Adds isDate tests

* Adds sanity check assertions to popup destroy tests
* chore: remove no longer needed bower.json

* chore: do not use gulp for linting

* chore: use individual js files for examples

* chore: change from require to import

* chore: use vis.min.js for basic examples for testing

* feat: use rollup to generate individual libs

* chore: remove gulp and its dependencies

* chore: add vscode mocha debug config

* fix: fix tests
* Update vis-data and commit package-lock

* Prepare the package for TypeScript

* Update dependencies

* Fix coverage reports

* Fix Mocha never finishing

* New package lock (who knows why)

* Regenerate package lock

If anybody has any advice about merging package locks I'm all ears.

* Add coverage to root index.html

* Set up ESLint with Prettier for TS files

Prettier is not used for JavaScript files at the moment.

* Add tsconfig

* Install missing deps

* Fix ESLint config

* Add NodesHandler test

Brings the coverage from red/yellow to yellow/green numbers.
* chore(build): bundle CSS using Rollup

* chore(package): remove no longer needed deps

* chore(dist): update
* feat(build): add standalone and peer builds

* chore(dist): update

* style: reformat new files

* fix(build): update to core-js 3

Also ditches rollup-plugin-babel-minify in favor of directly configuring
babel plugin as the former doesn't work with core-js 3.

* fix(build): make it actually work without errors

* chore(dist): update

* chore(package): fix clean script

It missed all the new vis-network.* files. Now it deletes them.

* fix(build): use folder structure instead of big mess

* chore(types): remove useless d.ts file

I have no idea why I put it there, it's not imported from anywhere.

* fix(build): fix image copying and watch

* chore(examples): use standalone build

* chore(examples): add standalone/peer build examples

* fix(build): get rid of default import from util

Every UMD package overwrites the default and breaks everything. This
will work as long as no two packages use the same name for one of their
exports (seems to be the case right now).

* fix(build): don't reexport data and util from peer

DataSet, utils etc. can't be reexported because that would cause stack
overflow in UMD builds. They all export vis namespace therefore
reexporting leads to loading vis to load vis to load vis…

* chore(dist): update

* fix(build): update d.ts files for recent changes

* chore(examples): fix script and style paths

* style: reformat

* chore(examples): add code examples to basic usage

* chore(examples): add new builds examples to the index

* chore(examples): add legacy build example

* chore(examples): fix URL errors

* docs: update how to

* docs: fix typo

* fix(build): don't capitalize nonconstructor objects

* docs: update Gephi and DOT exports

* chore(dist): update

* chore(build): transpile dependencies

This ensures that all dependencies match our browser list.

* chore(dist): update

* chore(build): don't ignore declarations

* chore(dist): update

* chore(build): use concat instead of flatMap

This greatly increases compatibility as Array.prototype.flatMap is quite
new and only recently supported by Node.

* chore(build): add styles to files

* chore(scripts): clean all generated files
“Wind”: a physics force that pushes all node in a given direction.
* feat(build): use common build process

#144

* test(cypress): update for the new .d.ts structure
* perf: use only named imports (mainly) from Vis Util

This slims down the standalone build by about 165 kB (due to an error in
importing, we had two copies of Vis Util so only about 60 kB is thanks
to named exports).

* perf: rewrite some more code to ESM + named imports
* style: reconfigure linting

* style: fix linting errors

* style: prefer const over let and let over var

* style: eslint --fix

* style: fix linting errors

Co-authored-by: Vis Bot <visjsbot@gmail.com>
* style: prohibit traling spaces

Trailing spaces are invisible to some and annoying to others. Also some
editors remove them by default which leads to weird unrelated changes in
PRs and then misleading git blame or annoying exchanges with
contributors about restoring the spaces.

Reformating also changes what git blame reports but with commits like
“style: eslint --fix” it's immediately obvious what happened.

* style: eslint --fix

Co-authored-by: Vis Bot <visjsbot@gmail.com>
* style: include lib in linting

* style: reformat

* style: manual tweaks

Co-authored-by: Vis Bot <visjsbot@gmail.com>
Array.isArray works with arrays that came from other contexts like web
workers, instanceof Array wouldn't consider such array to be an array
even though it is perfectly valid array.
Remove the dependency on Keycharm: All it really did was translate
`"esc"` to `event.keyCode === 27` (which is deprecated by the way). We
can just use `"key" in event ? event.key === "Escape" : event.keyCode
=== 27` instead of Keycharm and not relly solely on depracated APIs.

Remove the use of `addClassName` and `removeClassName`: These basically
polyfill IE9 and it's contemporaries (this is Windows Vista, iOS 4.3 and
Android Gingerbread era) which we don't otherwise polyfill so they don't
work one way or another.

Various other minor refactoring such as prefixing private properties
with underscore.
We had a lot of instances of innerHTML that were simply setting text, in
quite a few cases parsing it as HTML was even counter productive as it
could theoreticly result in syntax errors and corrupted output (e.g. the
output of JSON.stringify definitely shouldn't be parsed as HTML).

There is only one occurence of innerHTML left and that is for the
node/edge title as the docs clearly state that any string passed will be
parsed as HTML.
…ion (#1255)

* refactor: rework all imports and exports to ESM

* refactor(color-picker): inline onTouch from hammerUtil

Similarly as with the Activator, it was used only for one very simple
thing so there isn't really a need to drag this over to Vis Util.

* refactor(hammer): move it into shared

Everything from shared will be moved to Vis Util so that it can be
shared among all of the projects. The code in shared already depends on
Hammer heavily so it needs to be there. Vis Util can export this
together with the other shared stuff.

* refactor(shared): turn into an encapsulated module

This way it will be quite easy to import from Vis Util later on.
* refactor(configurator): final refactoring before extraction

- Exctract hardcoded physics solver and wind code from the configurator into reusable hideOptions function passed in the constructor.
- Add TS types explicitly declaring the structure of the input (in other words: formally declare the API of the configurator).

* chore: update copyright
BREAKING CHANGE: This fixes potential XSS issues that recless people may
unintentionally introduce. Those who sanitize the HTML or have other
strategy (e.g. hardcoded HTML) to prevent XSS (or don't care) can pass
an element.
@Thomaash Thomaash requested a review from a team January 7, 2021 20:42
@yotamberk yotamberk merged commit 7b9a2f8 into master Jan 8, 2021
@yotamberk yotamberk deleted the shared branch January 8, 2021 09:25
@vis-bot
Copy link
Collaborator

vis-bot commented Jan 8, 2021

🎉 This PR is included in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.