haltu / muuri

Infinite responsive, sortable, filterable and draggable layouts
https://muuri.dev
MIT License
10.8k stars 644 forks source link

Modular architecture #458

Open romgerman opened 3 years ago

romgerman commented 3 years ago

Hey. It would be nice if we could use only what we need. Ex I don't need dragging, sorting and filtering, only layout. But currently I need to include whole big library to do only portion of the things it can do.

Thanks!

niklasramo commented 3 years ago

Yep, it would be nice, but unfortunately that's not trivial to implement. If you have a suggestion how to implement that change I'm all ears :)

thednp commented 3 years ago

I've read some of the code, here's my 2cents:

The current version is awesome, flexible, but

The src/Grid/Grid can be split into 3 independent classes (probably more might be better)

The more I read, the more I think src/Packer/Packer is kinda mandatory in every and all situations.

Well?

niklasramo commented 3 years ago

@thednp Thanks so much for the suggestions and ideas :)

The next version ( in dev branch) version will drop support for IE and legacy Edge, so it will unfortunately give less jQuery shills, but I think it's the right move forward. The good side in this is that the codebase gets a bit lighter.

I haven't yet though out exactly how the Grid class should be split up, but I've been thinking that the core of Muuri should only handle the layout stuff and everything else should be a plugin/extension. This would mean that animations, filtering, sorting and everything drag n' drop related would be official extensions/plugins. This also requires refactoring Muuri to be easily extendable via some sort of plugin system (if needed).

thednp commented 3 years ago

I already have a valid ESLint version of Muuri with class definitions, except drag functionality which is something I don't need for front-end, I believe very few actually need it. The move to TS is something that I don't know much about. I know it's easy to create a .d.ts file to import ES6 stuff, usually other contributors help with me that.

But still I'm interested in the future versions regardless.