Giter Site home page Giter Site logo

RFC: API redesign about ember-validated-form HOT 7 CLOSED

anehx avatar anehx commented on June 2, 2024 3
RFC: API redesign

from ember-validated-form.

Comments (7)

anehx avatar anehx commented on June 2, 2024 3

Hi @makepanic

Thank you for your feedback! 👍

A random thought from my side would be to decouple any css framework compatibility from core.

Do you mean putting the themes in separate addons (e.g ember-validated-form-bootstrap)? Or would it maybe be enough to just filter out all unneeded code on build?

So something like the following configuration would allow a user to specify which component will be used for any validated-form form field type. This reduces copy pasting when specifying a custom rendering component.

You're absolutely right! We had the same idea but forgot to mention it in the RFC. I added it to the optional features, since this is not something crucial.

One could maybe also allow aliasing so "render": "bootstrap" would tell the addon to bundle the default set of bootstrap form components ("render": "foundation" to bundle foundation components and so on).

A global option for a default set of components is definitely reasonable.

FYI: I already added a very very basic partial implementation of this RFC in #128. If you want, take a look at it and give us your feedback!

from ember-validated-form.

makepanic avatar makepanic commented on June 2, 2024 2

Do you mean putting the themes in separate addons (e.g ember-validated-form-bootstrap)? Or would it maybe be enough to just filter out all unneeded code on build?

I think both are valid solutions. Filtering the addon tree on build would be easier for you, i guess.

FYI: I already added a very very basic partial implementation of this RFC in #128. If you want, take a look at it and give us your feedback!

Thanks, I'll try to take a look and add feedback

from ember-validated-form.

makepanic avatar makepanic commented on June 2, 2024

Great idea!

A random thought from my side would be to decouple any css framework compatibility from core.

This has an advantage of others not having to bundle components/styles that aren't needed (similar to other addons which strip module from the addon tree).
ember-validated-form could still ship defaults for any well-known css frameworks.

So something like the following configuration would allow a user to specify which component will be used for any validated-form form field type. This reduces copy pasting when specifying a custom rendering component.

// config/environment.js
...
"ember-validated-form": {
  "render": {
     "text": "validated-input",
     "textarea": "validated-textarea",
     "label": "validated-label",
     "checkbox": "validated-checkbox",
     ...
  }
}
...

One could maybe also allow aliasing so "render": "bootstrap" would tell the addon to bundle the default set of bootstrap form components ("render": "foundation" to bundle foundation components and so on).

This could mean that the developer could still overwrite the renderComponent on a per form field basis but also get custom rendering for the whole project without having to copy paste it all over the place.

I guess one could even combine it to allow default rendering for all form components but overwrite some:

// config/environment.js
"ember-validated-form": {
  "extends": "bootstrap",
  "render": {
     "label": "some-special-label"
     ...
  }
}

It's also possible to not have any magical extension logic but export some objects, which could be Object.assign'd to create the final render configuration:

// config/environment.js
const {bootstrap} = require('ember-validated-form/configs');

"ember-validated-form": {
  "render": Object.assign(bootstrap, {
     "label": "some-special-label"
     ...
  })
}

from ember-validated-form.

anehx avatar anehx commented on June 2, 2024

I think both are valid solutions. Filtering the addon tree on build would be easier for you, i guess.

I think filtering it brings the advantage of not having to maintain x other addons for every existing framework while still decreasing the payload significantly.. Like this, we have all of the ember-validated-form related code in one place.

from ember-validated-form.

makepanic avatar makepanic commented on June 2, 2024

I think with lerna or yarn workspaces there wouldn't be much additional maintenance overhead while still having all ember-validated-form code in one repo.

With filtering you also have to maintain additional broccoli code that filters the addon tree.

But it's up to you for what's easier to maintain.

from ember-validated-form.

anehx avatar anehx commented on June 2, 2024

Well, we'd still have to maintain all of the dependencies for every addon even if we have it in one repo.. Or did I miss something?

from ember-validated-form.

czosel avatar czosel commented on June 2, 2024

I'll go ahead and close this since the redesign has landed since a while 🙂

from ember-validated-form.

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.