- Updated htmx to version 2.0.8 (changelog).
- Updated htmx to version 2.0.7 (changelog).
- Improved the check for Twig globals.
- Updated htmx to version 2.0.6 (changelog).
- Variables named the same as Twig globals are now disallowed (#422).
- Updated htmx to version 2.0.4 (changelog).
- Fixed a bug in which
s-actionattributes were being inherited by descendent elements (#408).
- Updated htmx to version 2.0.3 (changelog).
- The fetch function is now called inside an event listener when calling
sprig.triggerRefreshOnLoad(), making it more robust. - Reverted some variable method name changes to improve autocompletion in PhpStorm.
- Fixed the ability to pass a JSON encoded string into the
sprig.triggerEvents()function (#15).
- Added the ability to assign an ID to a component by passing a string as the third argument to the
sprig()function.
- Updated htmx to version 2.0.2 (changelog).
- Fixed the positioning of the JavaScript output by the
sprig.triggerRefreshOnLoadfunction.
- Fixed a bug that was breaking the
Sprigvariable in the browser console withdevModeenabled.
- The
sprig.registerJs(js)function now executes the registered JavaScript after htmx settles, and is now the recommended way of outputting JavaScript in Sprig components. - Components no longer render markup added via
{% html %},{% css %}and{% js %}tags during Sprig requests.
- Fixed a bug in which asset bundles were being registered and rendered in control panel Sprig requests (#383).
- Fixed CSRF tokens not being sent with requests using a method other than
GET.
- Added the component configurations to a
Sprigvariable in the browser console whendevModeis enabled. - Added the ability to pass any value into
s-method, including theput,patchanddeleteverbs. - Added the
sprig.registerJs(js)function.
- The
sprig.triggerRefresh(selector, variables)function now prevents cyclical requests.
- The
sprig.swapOob()function now accepts a string, in addition to a template to be rendered, in the second argument.
- Added the
sprig.swapOob(selector, template, variables)function that swaps a template out-of-band. - Added the
sprig.triggerRefresh(selector, variables)function that triggers a refresh on a Sprig component.
- Components now render markup added via
{% html %},{% css %}and{% js %}tags. - The
sprig.triggerRefreshOnLoad(selector)function now appends output to the end of the body and should be called using{% do sprig.triggerRefreshOnLoad(selector) %}.
Important
This update introduces htmx 2. Read about the changes →
- Added the s-inherit attribute that allows you to control and enable automatic attribute inheritance for child nodes, if it has been disabled by default.
- Updated htmx to version 2.0.1 (2.0.0 release notes).
- The htmx file is now output even when Sprig components are used inside of
{% cache %}tags (#329).
- Removed the
s-sseands-wsattributes.
- Fixed a bug in which variables passed into a component were being converted to strings (#369).
- Made it possible to pass a fully namespaced component class into the
sprig()function (#14).
- Updated htmx to version 1.9.12 (changelog).
- Fixed a bug in which some
sprigvariables were incorrectly persisting across requests (#363).
{warning} Template caches and static page caches should be cleared after performing this update.
- Added compatibility with Craft 5.
- Changed how the component configuration is encoded.
- Removed the
sprig.scriptvariable. - Removed the
s-onattribute. - Removed the
successvariable. Usesprig.isSuccessorsprig.isErrorinstead. - Removed the
flashesvariable. Usesprig.messageinstead. - Removed the
idvariable. Usesprig.modelIdinstead.