Let UI plugins register custom Blade @event names - #432
Merged
simonhamp merged 3 commits intoOct 2, 2026
Merged
Conversation
Only registered names are wired at apply time, and registerUiPluginComponents is tested so nativephp.json element_events actually reach the precompiler. Co-authored-by: Cursor <cursoragent@cursor.com>
Member
|
This is great! Mind adding the docs for it over on the nativephp.com repo when you get the chance? |
Contributor
Author
|
@simonhamp Docs are up here: NativePHP/nativephp.com#552 |
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.
Summary
@link,@scan,@signed, …) instead of hijacking@change.components[].element_eventsinnativephp.jsonand/orElement::elementEvents(). Unregistered@foostill compiles as a child-component_event-foobinding ($this->emit())._link→onLink(),_scan→onScan(), including hyphenated names (@link-tapped→onLinkTapped()). Native renderers can keep sending the payload withsendTextChangeEvent; PHP already routes by callback id.Registered names are global at compile time, same as
@change. If a plugin registerslink,@linkon a nested child component is no longer$this->emit('link').Site docs at
plugins/ui-componentsstill show_change="updateLabel"— that page lives in nativephp.com and can follow once this lands.Test plan
vendor/bin/pest tests/Unit/Edge/ComponentEventBindingPrecompilerTest.php tests/Unit/Edge/NativeElementCollectorTest.php tests/Unit/Edge/UiPluginComponentBootTest.php tests/Unit/Plugins/PluginManifestValidationTest.php<native:markdown @link="open">compiles to_linkafter registeringlink, and that unregistered@order-shippedstill becomes_event-order-shipped@if/@endifare untouched_event-*attrs are still stripped from plain elementsonScan()receives the handler when@scanis declarednativephp.jsonelement_eventsare registered at boot viaregisterUiPluginComponents()Made with Cursor