Coder Social home page Coder Social logo

Comments (4)

antoniandre avatar antoniandre commented on July 18, 2024

Hi @davidgraeff,
Thanks for your interest into contributing!

As I add features the code base is getting bigger and bigger and I agree it would be nice to split it into multiple files now. I actually had this in mind for a while.
But there is a tradeoff: code will be more complex and not significantly shorter in the main index.
The reason for that:

  • some logic needs to be shared across the different components and remain in the index
  • increased complexity because of nested slots, passing down props, calling parent methods

I have split the header into a different file in the refactoring branch I will think it over to see what can be improved and moved but if you want to have a look and give me some feedbacks, please do so!

from vue-cal.

davidgraeff avatar davidgraeff commented on July 18, 2024

some logic needs to be shared across the different components

Use ES6 modules and move utility methods into own files. The build system will care about joining everything. The "updateMutableEvents" method is a good candidate for example. Basically all methods that are not "reactive".

if you want to have a look and give me some feedbacks

Sounds promising, I'll have a look.

As I add features the code base is getting bigger and bigger

I have seen your ToDo list. If you are done with that, this component will be the most complete component for Vue that I've seen so far. But don't do the charts.js mistake, they are now in the second year of refactoring, from their original one-file monstrosity.

Vue provides you with a lot of tools to create small re-usable pieces. You can design (additional) features as Mixins for example (like Drag&Drop, Editable-cells, different View modes) and allow the user to add Mixins as he needs them. That way an ES6 ready build system will tree-shake your component for smaller file sizes (your component with all its features, non-gzipped is close to 100kb).

Cheers, David

from vue-cal.

antoniandre avatar antoniandre commented on July 18, 2024

Hi @davidgraeff,
I did a good refactoring and will stop here for the big part. Now merged into master.
I will keep improving as I develop new features but I am closing the refactoring branch.

  • Header is moved into a new component
  • Weekday headings is moved into a new component
  • Styles are split where it belongs into new components
  • Some of the logic is moved into the new components
  • The main big file is now down to less than 900 lines

I will keep in mind modularising the features into mixins, but it is not the priority now.
Thanks for your advice!

from vue-cal.

davidgraeff avatar davidgraeff commented on July 18, 2024

Thanks :)

from vue-cal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.