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
Extract ViewComponent::Core class #1107
base: main
Are you sure you want to change the base?
Conversation
This extracts a new class, `ViewComponent::Core` which implements the minimum amount of functionality to have a functioning component library. The difference between `ViewComponent::Core` and `ViewComponent::Base` is that Base includes extra functionality and compatibility with Rails, such as slots, built-in route helpers, access to `request` and `controller`, etc. This new `Core` class is marked as private and should still be considered experimental.
@BlakeWilliams Excited to see progress on this! Let me know when it's at a point you'd like some testing outside of a Rails context (aka Bridgetown). |
* The private keyword is necessary for documentation to correctly generate. * Mark `original_view_context` as protected * Allow ViewComponent::Core methods to be documented as `ViewComponent::Base` methods.
@jaredcwhite I'd love to see us add some sort of test(s) that put us in the right direction towards better supporting Bridgetown with this change. Might you be up for suggesting some? |
I'm revisiting this now after some time has passed, and I think what I'm starting to wonder is if there could be some way to have a framework-agnostic component base class (aka one that's not directly subclassing Alternatively—and this is a much broader topic I realize—is to somehow come up with an external code interface which defines the basics of a "view component" (whether that's actual code in the form of a mixin or something more theoretical like a spec), and then ensure the The rationale for all this being in the Bridgetown framework, we have a Thoughts? |
@jaredcwhite I like it! We've toyed with removing our dependency on |
This extracts a new class,
ViewComponent::Core
which implements theminimum amount of functionality to have a functioning component library.
The difference between
ViewComponent::Core
andViewComponent::Base
is that Base includes extra functionality and compatibility with Rails,
such as slots, built-in route helpers, access to
request
andcontroller
, etc.This new
Core
class is marked as private and should still beconsidered experimental.