Skip to content

Latest commit

 

History

History
162 lines (112 loc) · 6.82 KB

CHANGELOG.md

File metadata and controls

162 lines (112 loc) · 6.82 KB

Changelog

  • Change default hx-include to this to improve event-to-request delay on forms with large number of elements.
  • Merge PR to add Falcon framework implementation.
  • Fix Safari/iOS errors due to evt.target and evt.srcElement now being null.
  • Add support for port in UrlStateManagerService.php
  • PHP 8.2/8.3 compat
  • Fix ResponseHeaders::refresh error due to missing parameter.
  • Fix headers already sent error when setting status code in response
  • Ensure components are compiled only once.
  • Bump htmx to v1.9.4 and include new config options.
  • New Request::set, Request::triggerName and Request::header methods.
  • New Response::reselect method for the HX-Reselect header.
  • New New Yoyo::actionArgs method.

New

  • Added Component::actionMatches method.
  • Add response HX header methods that can via accessed in Yoyo component via $this->response:
    • location
    • pushUrl
    • redirect
    • refresh
    • replace
    • reswap
    • retarget
    • trigger
    • triggerAfterSwap
    • triggerAfterSettle

Changed

  • Added composer support for illuminate/container v9.0

Fixed

  • Regex replacement in Yoyo compiler causing issues due to incorrect replacements.

Changed

- Updated htmx to v1.8.4.
- Add support for new htmx attributes to the Yoyo compiler: `replace-url`, `select-oob`, `validate`.
- Add support for PHP 8.1 installs.
- Add `yoyo:history="remove"` attribute to allow excluding elements from browser history cache snapshot.
- Renamed `Component::addDynamicProperties` to `Component::getDynamicProperties` to make it consistent with other component methods.
- Expose all htmx configuration options to Yoyo via `Clickfwd\Yoyo\Services\Configuration`.
- Breaking change! Compiler no longer makes buttons, links or inputs reactive by default. Previously any button, link or input would automatically receive the yoyo:get="render" attribute unless it already had a different request attribute. Now it's necessary to explicitly add the yoyo:{method} attribute if you want to make the element reactive. You can also just add an empty `yoyo` attribute if you want to make a request to the default yoyo:get="render" attribute on the component.    

Fixed

- Allow queryString parameters with value of zero to be pushed to URL.
- Javascript `Yoyo.on` throws undefined error when event detail is of type object.
- Issues working with dynamic properties.
- Lots of other changes and improvements.

Added

  • Support for adding dynamic properties to components via Component::addDynamicProperties method, which returns an array of property names. NOTE: renamed to Component::getDynamicProperties in next update.

    This can be useful when the names of the properties are not known in advanced (i.e. coming from the database). The code below shows how to use this together with queryStrings to push the dynamic property values to the URL. The dynamic properties are also available in templates like regular public properties.

    public function addDynamicProperties() 
    {
        return ['width', 'length'];
    }
    
    public function getQueryString()
    {
        return array_merge($this->queryString, $this->addDynamicProperties());
    }

Changed

  • Links that trigger Yoyo requests now automatically update the browser URL and push the component state to the browser history.

Fixed

  • Error retrieving parameter names for component action.

Fixed

  • Various fixes

Fixed

  • Allow component listeners to trigger the default refresh action.

    protected $listeners = ['updated' => 'refresh'];

Fixed

  • Initial component history snapshot taken even for components that don't push changes to the URL via queryString.

Added

  • Updated htmx to v1.3.1
  • Component emitToWithSelector method to differentiate from emitTo. emitTo targets Yoyo components specifically, while emitToWithSelector can target elements using a CSS selector.
  • Component skipRenderAndRemove method to allow removing components from the page.
  • Component addSwapModifiers method to dynamically set swap modifers when updating components.
  • Additional component lifecycle hooks
    • initialize - on component initialization, allows adding properties, setting listeners, etc.
    • mount - after component initialization
    • rendering - before component render method
    • rendered - after component render method, receives component output
  • Allow traits to implement lifecycle hooks which run after the component's equivalent. For example, a trait WithValidation in addition to adding its own properties and methods can also implement hooks with the format:
    • initializeWithValidation
    • mountWithValidation
    • renderingWithValidation
    • renderedWithValidation
  • Depedency Injection for lifecycle hooks and listener methods.
  • Yoyo\abort, Yoyo\abort_if, Yoyo\abort_unless functions allows throwing exceptions within components to stop execution while still sending any queued events back up to the browser.
  • Namespace support for view templates and component classes
  • Support for new htmx hx-headers attribute via yoyo:headers
  • Tests for Blade and Twig

Changed

  • Automatically re-spawn dynamically created target elements if these are removed on swap.

    When yoyo:target="#some-element" is used with an ID and the target element doesn't exist, Yoyo automatically creates an empty <div id="some-element"></div> and appends it to the document body.

  • Refactored component resolver

  • Events are sent to the browser even when throwing an exception within a component.

  • Components are resolved from the container.

Fixed

  • Cannot use Array property as prop.
  • Component props not persisted in POST request updates.
  • Variables passed directly to render method leaking to component props.