Version 1.13.0

April 30, 2022

Added

  • Added the s-listen attribute that allows you to specify one or more components that when refreshed, should trigger a refresh of the current element.

Version 1.12.4

April 14, 2022

Fixed

  • Fixed the minimum PHP requirement format to allow for PHP 8 (#215).

Version 1.12.3

April 14, 2022

Changed

  • Changed the minimum PHP requirement to 7.1.

Fixed

  • Fixed an issue where the Autocomplete helper could throw an exception if it encountered a ReflectionUnionType (#213).

Version 1.12.2

March 24, 2022

Fixed

  • Fixed nested components being parsed twice, resulting in duplicate attributes (#208).

Version 1.12.1

March 15, 2022

Fixed

  • Fixed an issue that caused htmx 1.7.0 to log console errors in some edge cases (#202).

Version 1.12.0

March 1, 2022

Added

  • Added the s-sync attribute that allows you to synchronize AJAX requests between multiple elements.
  • Added the s-disinherit attribute that allows you to control attribute inheritance.

Changed

Version 1.11.1

February 22, 2022

Changed

  • The response format is now explicitly set to HTML, to avoid a scenario in which it might be interpreted as JSON.

Version 1.11.0

February 1, 2022

Added

  • Added a sprig.isBoosted template variable that returns whether this is a boosted request (requires htmx 1.6.0 or later).
  • Added a sprig.retarget() template variable that overrides the element to target via a CSS selector (requires htmx 1.6.1 or later).

Changed

Version 1.10.4

October 22, 2021

Fixed

  • Fixed an issue in which attributes with spaces before or after the = were not being correctly parsed (#178).

Version 1.10.3

October 21, 2021

Fixed

  • Fixed a bug in which attributes could be double encoded in nested components (#176, #178).

Version 1.10.2

October 20, 2021

Fixed

  • Fixed a bug in which using s-action could throw an exception when parsed (#177).

Version 1.10.1

October 20, 2021

Fixed

  • Fixed a bug in which using s-vals with JSON encoded variables could throw an exception when parsed (#176).

Version 1.10.0

October 19, 2021

Added

  • Added sample components to the playground (#174 ❤️@nystudio107).

Changed

  • Increased the minimum required Craft version to 3.3.0.
  • The s-val:* attribute can now contain square brackets, for example s-val:fields[handle]="value".
  • General performance optimisations.

Fixed

  • Fixed a bug in which comments and script tags containing sprig could throw an exception when parsed (#3).

Version 1.9.3

October 14, 2021

Fixed

  • Fixed multibyte character strings not being correctly converted (#173).

Version 1.9.2

October 11, 2021

Changed

  • Optimised the performance and overhead of parsing large Sprig components (#2 ❤️@nystudio107).

Version 1.9.1

October 5, 2021

Fixed

  • Fixed an error in the CLI due to an undefined alias in Sprig core (#170).

Version 1.9.0

October 4, 2021

The core functionality of Sprig has been split out into the Sprig Core package.

Added

  • Added Craft API autocomplete and documentation to the code editor in the Sprig playground (#157 ❤️@nystudio107).
  • Sprig components now pass the token parameter along so that they work seamlessly in a live preview scenario (#162).

Changed

  • Split the core functionality of Sprig into the Sprig Core package that can be used by Craft plugins/modules without requiring that the Sprig plugin is installed.
  • Removed the hxDataPrefix config setting, opting to prefix hx- attributes with data- by default.
  • Updated htmx to version 1.6.0 (release notes).
  • An unminified version of htmx is now loaded from a CDN rather than locally when in a development environment.
  • Improved the performance of loading the htmx script from the CDN (#166).

Version 1.8.1

August 27, 2021

Changed

  • The PaginateVariable class now extends Craft’s Paginate class, adding more functionality and better compatibility with other plugins.

Version 1.8.0

August 23, 2021

Variables passed into Sprig components are now automatically JSON decoded, so you should remove any usage of the json_decode filter from Sprig components.

Added

  • Added the ability to pass variables as arrays into Sprig components, so you can now do this:
    {{ sprig('_components/entries', {entryIds: [1, 2, 3]}) }}
    

Changed

  • Variables passed into Sprig components are now automatically JSON decoded.

Version 1.7.0

July 14, 2021

Added

  • Added the s-request attribute that allows you to configure various aspects of the request.

Changed

  • Updated htmx to version 1.5.0 (release notes).
  • Improved autocomplete suggestions in playground.

Version 1.6.0

June 8, 2021

Changed

  • The CSRF token is now regenerated if the password is updated for the current user (#136).
  • CSRF tokens are now sent as request headers instead of body params.
  • Use of the javascript: prefix is disallowed for security reasons and results in an exception being thrown.
  • Updated htmx to version 1.4.1 (release notes).

Fixed

  • Fixed double encoding of ampersands in element attributes (#133).

Version 1.5.2

April 9, 2021

Fixed

  • Fixed an error that could occur when registering a new user.

Version 1.5.1

April 9, 2021

Changed

  • Sprig overrides the currentUser global variable with a fresh version if the current user is updated using the users/save-user controller action (#81).

Version 1.5.0

April 7, 2021

Added

  • Added the ability to prefix both sprig and s- attributes with data- for more valid HTML (#117).
  • Added the hxDataPrefix config setting that forces Sprig to use the data- prefix for hx- attributes.
  • Added the s-disable attribute that disables htmx processing for a given element and its children.

Changed

Version 1.4.0

February 24, 2021
  • Added the s-headers attribute that allows you to add to the headers that will be submitted with an AJAX request.

Changed

Version 1.3.3

February 3, 2021

Changed

  • Component classes are now created using the createObject method (#93).
  • Variables returned by controller actions called variables are now merged in to template variables (#94).

Version 1.3.2

January 29, 2021

Fixed

  • Fixed compatibility with Craft pre version 3.5.0 (#91).

Version 1.3.1

January 13, 2021

Fixed

  • Fixed missing variable methods (#79).

Version 1.3.0

January 6, 2021

Added

  • Added the following return variables when controller actions are called.
    • success (boolean) whether the action succeeded.
    • flashes (array) flash messages set by the action, keyed by type (notice or error).
    • id (integer) the ID of the model if one was successfully created/updated.
    • modelName (model) a model that failed validation, for example entry when entries/save-entry fails or user when users/save-user fails.
  • Added a new s-preserve attribute that ensures that an element remains unchanged even when the component is re-rendered.
  • Added a subresource integrity attribute to the htmx script tag when fetching from a CDN for added security.

Changed

  • Updated htmx to version 1.1.0 (release notes).
  • Requires Craft 3.1.19 or higher.

Removed

Deprecated

  • The errors variable has been deprecation. Use the getErrors() method on the model that is returned when validation fails.
{# OLD way of handling errors #}
{% if errors.title is defined %}
    {{ errors.title|first }}
{% endif

{# NEW way of handling errors (assumes `entry` failed validation) #}
{% if entry.hasErrors('title') %}
    {{ entry.getFirstError('title') }}
{% endif %}
  • The sprig.element, sprig.elementName, sprig.elementValue and sprig.eventTarget tags have been deprecated, will each return a blank string since being removed from htmx 1.1.0, and should be removed from templates.

Version 1.2.0

December 14, 2020

Added

  • Added a new s-encoding attribute that can be used to set the encoding of requests to multipart/form-data for file uploads (#9).

Changed

Deprecated

Version 1.1.1

November 24, 2020

Changed

Fixed

  • Fixed a bug that was preventing the s-push-url attribute from being parsed (#62).

Version 1.1.0

November 23, 2020

The s-vars attribute has been deprecated for security reasons, use the new s-vals or s-val:* attribute instead (read the details here). The magic _url and _events variables have been removed, use the new sprig.pushUrl() and sprig.triggerEvents() functions instead.

Added

  • Added new s-vals and s-val:* attributes that add values to a request and that should be used instead of the deprecated s-vars.
  • Added a new s-replace attribute that replaces only the specified element in the component.
  • Added a sprig.paginate() template variable that paginates an element query.
  • Added a sprig.pushUrl() template variable that pushes a URL into the history stack.
  • Added a sprig.redirect() template variable that redirects the browser to a URL.
  • Added a sprig.refresh() template variable that refreshes the browser.
  • Added a sprig.triggerEvents() template variable that triggers client-side events.

Changed

  • Updated htmx to version 0.4.0 (release notes).
  • Removed the magic _url variable, use the new sprig.pushUrl() function instead.
  • Removed the magic _events variable, use the new sprig.triggerEvents() function instead.
  • Made minor tweaks to default playground.

Fixed

  • Fixed how array variables are handled in the playground.

Deprecated

  • The s-vars attribute has been deprecated for security reasons. Use the new s-vals or s-val:* attribute instead.

Security

  • Fixed a potential XSS vulnerability.

Version 1.0.3

October 28, 2020

Added

  • Added a config setting to enable or disable the playground on a per environment basis.

Version 1.0.2

October 22, 2020

Added

  • Added a warning message if devMode is not enabled.

Changed

Version 1.0.1

October 21, 2020
  • Migration schema version release for beta updates.

Version 1.0.0

October 21, 2020

Added

  • Added the Sprig playground.
  • Added a new Sprig logo.

Version 1.0.0-beta.18.1

October 19, 2020

Fixed

  • Fixed an issue with the schema version in project config (#42).

Version 1.0.0-beta.18

October 16, 2020

Added

  • Added beforeCreateComponent and afterCreateComponent events to ComponentsService.

Changed

  • Duplicate IDs in components no longer throw an error (#40).
  • Removed the sprig.request template variable, use sprig.isRequest instead.
  • Removed the sprig.include template variable, use sprig.isInclude instead.

Version 1.0.0-beta.17

September 25, 2020

Changed

  • Uses a HTML5 compatible DOM parser.

Fixed

  • Fixed a bug in which HTML tags would be stripped when inside of <script> tags (#34).

Version 1.0.0-beta.16

September 18, 2020

Changed

Version 1.0.0-beta.15

September 14, 2020

Changed

  • Controller actions that return models are now dealt with accordingly.

Deprecated

  • The sprig.include template variable has been deprecated and will be removed in version 1.0.0. Use sprig.isInclude instead.
  • The sprig.request template variable has been deprecated and will be removed in version 1.0.0. Use sprig.isRequest instead.

Version 1.0.0-beta.14

September 10, 2020

Changed

  • Requests to controller actions are now forced to be AJAX requests.

Fixed

  • Fixed an error that could occur if a controller action did not return a JSON response (#26).

Version 1.0.0-beta.13

September 3, 2020

Added

  • Added the sprig.hyperscript tag.

Changed

  • Invalid variable exceptions include suggestions for how code could be fixed.

Version 1.0.0-beta.12

September 1, 2020

Added

  • Added a default class="sprig-component" to all components.

Changed

  • An exception is now thrown if an array, object or value that cannot be converted to a string is passed into a Sprig component as a variable.

Version 1.0.0-beta.11

August 18, 2020

The ability to override the component trigger using the trigger attribute has been removed. Use s-trigger instead.

Added

  • Added the ability to override all s- attributes on the component.

Changed

  • Removed the ability to override the component trigger using the trigger attribute.

Version 1.0.0-beta.10

August 4, 2020

Added

  • Added the ability to override the component trigger using the trigger attribute.

Changed

  • CSRF tokens are now added as vars instead of input fields (#6).
  • The current site is now maintained when rendering components (#13).

Version 1.0.0-beta.9

July 21, 2020

Added

  • Added support for nesting components (#6).
  • Added a refresh event trigger to components.

Changed

  • Request parameters are not hashed as variables when a component is created initially (#5).

Version 1.0.0-beta.8

July 9, 2020

Added

  • Added the sprig.htmxVersion variable back in.
  • Added unit tests to ensure that both local and remote versions of htmx exist.

Changed

  • Requires htmx 0.0.8 (release notes).
  • Uses the htmx script from unpkg.com unless in a dev environment, in which case it uses a local version.

Version 1.0.0-beta.7

July 6, 2020

Added

  • Added unit tests.

Changed

  • Returns a 400 error when submitted data is determined to be tampered.
  • Replaced htmx script from unpkg.com with a local version.
  • Removed the sprig.htmxVersion variable.

Version 1.0.0-beta.6

July 3, 2020

Added

  • Added the sprig.htmxVersion variable.

Changed

  • Request parameters are now added as variables to the initial sprig include.
  • Removed the ability to load extensions using the sprig.script tag.

Version 1.0.0-beta.5

July 1, 2020

Added

  • Added the ability to pass protected variables into components by prefixing them with an underscore.

Changed

Version 1.0.0-beta.4

June 29, 2020

Added

  • Added the s-vars attribute.

Fixed

  • Fixed characters not being encoded in UTF-8 in rendered components (#2).
  • Fixed a bug that could throw an error when creating a component class.

Version 1.0.0-beta.3

June 26, 2020

Added

  • Added the ability to send events and a URL back in the response header.
  • Added the ability to load extensions using the sprig.script tag.

Changed

  • Renamed the protected property template to _template in the component class.
  • Removed the error-url from the list of available attributes since it was dropped in htmx 0.0.6.

Version 1.0.0-beta.2

June 21, 2020

Added

  • Added the sprig.include variable.

Changed

Version 1.0.0-beta.1

June 15, 2020
  • Initial release.