<f-my-component attribute="value" /> support#710
Draft
fadrian06 wants to merge 21 commits into
Draft
Conversation
Collaborator
|
So I think this is ok minus the one change, but you probably should add to the Flight docs for the docs related to this change. The other thing that I don't know right now is if this will break for people using the current view class. There might be some future issues related to this you should be prepared to fix if they get surfaced. |
Contributor
Author
|
don't worry, I am testing this is personal apps and it works as expected, both old and new syntax... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces significant enhancements to the
Viewtemplate system, most notably adding support for component-based templates (including class and functional components with props, styles, and scripts), refactoring and modernizing theViewclass, and improving the test suite for better coverage and maintainability.Component System and Template Rendering Enhancements:
Componentabstract class inflight/template/Component.php, enabling templates to be defined as PHP classes withhtml(),css(), andjs()methods for encapsulated markup, styles, and scripts.Viewclass to support rendering components: detects when a template returns aComponentinstance or a callable, and renders their output accordingly. Also adds support for parsing and rendering custom component tags (e.g.,<f-my-component />) with props, and recursively renders subcomponents.Refactoring and Modernization of the
ViewClass:Viewclass for clarity and modern PHP practices: improved docblocks, replaced deprecated or verbose code with concise alternatives, used strict types, and streamlined variable handling. [1] [2] [3] [4] [5]Testing Improvements:
tests/ViewTest.phpto useself::assert*methods for consistency, added new tests for component rendering (including class, functional, and nested components, as well as components with props, styles, and scripts), and improved test data providers. [1] [2]Other Improvements:
View.phpfor accuracy and modern links..editorconfigrule for test views and updated the author's homepage incomposer.json. [1] [2]These changes collectively modernize the template system, introduce a flexible component architecture, and ensure robust, maintainable testing.
References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]