What's Changed
Added
Yoyo.dispatch()andYoyo.dispatchTo()JS API for triggering component events from JavaScript, matching Livewire 3's dispatch API. Thanks to @mucan54 for the original proposal in #35.- Named parameter support for JS dispatch — object params like
{ postId: 2 }map to listener method arguments by name. - Required parameter validation for named dispatch params — throws
InvalidArgumentExceptionif a required parameter is missing. - Documentation for all HTMX response header methods available via
$this->response(retarget,reswap,reselect,pushUrl,replaceUrl,location,redirect,refresh,trigger,triggerAfterSwap,triggerAfterSettle).
Fixed
- Fix
test_jsonempty-params decode bug wheneventParamsis an empty JSON object. - Add defensive null-guard in
triggerServerEmittedEventto prevent TypeError when source element is not inside a component.
Performance
- Add static cache to
getMethodParametersWithTypes()for consistency with otherClassHelperscaches. - Optimize props filtering in
YoyoCompilerby replacing repeatedin_arraychecks with a lookup map. - Skip re-processing already compiled nested Yoyo child components during compile.
Full Changelog: 0.14.0...0.15.0