Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #374
Resolves #417
This is a pretty big one--it's definitely a breaking change, so maybe hold off on merging until 0.7.0 gets a stable release and this can become part of 0.8.0.
This migrates the entire codebase over to ES6 modules, combined together using Rollup.
It builds on my work removing Underscore functions from the codebase. If you want, I can squash all those commits together, but I've kept them apart for ease of reviewing.
Because the changes involve removing a "wrapper" function from every file, everything has been decreased by one indentation level. To make the diff readable, you'll probably want to disable whitespace in the diff view.
The biggest change by far is that
Two.Utils
is gone. Every utility function previously present inTwo.Utils
has been moved to various modules in thesrc/utils
folder. Because of this, they are no longer publicly accessible, which is the largest breaking change.The sole exception is
Two.Utils.Events
, which I have chosen to leave under theTwo.Utils
namespace to avoid confusion withTwo.Events
, the list of event types. For a future version, I think it's a good idea to renameTwo.Events
to something likeTwo.EventTypes
(which is what I named it internally), and then changeTwo.Utils.Events
to be accessible asTwo.Events
.utils/build.js
should function exactly the same as before. I have changed Closure Compiler out for Terser because it's much faster; the minified code also seems slightly smaller but this could just be down to bundling differences. I have also added abuild
script topackage.json
which callsutils/build.js
.I've exposed
Collection
asTwo.Collection
; I'm not sure if this is desired. Should I keep it in theTwo.Utils
namespace?ZUI
is now included as part of the bundle; it currently depends on some private utility functions that it needs to pull in. The choice is between making ZUI part of the maintwo.js
bundle, or packaging it separately and duplicating the dependencies.I have not yet updated the JSDoc comments to indicate that the new classes are members of the Two.js namespace. I'll eventually address that in an additional commit.