Skip to content

Releases: starfederation/datastar

v1.0.0-beta.5

10 Feb 02:39
29c7d52
Compare
Choose a tag to compare

Fixed

  • Fixed a bug in the morph merge mode (that raised its fists in rebellion) when merging multiple top-level fragments.

v1.0.0-beta.4

10 Feb 02:37
dff91de
Compare
Choose a tag to compare

In this release we tuned the engine, added the ability to react to specific signal changes, and added some new modifiers. Idiomorph got an upgrade, and a few bugs were squashed.

The most exciting part of this beta release is that it marks the final round of planned changes before we move to a stable v1 release 🚀

Added

  • Added the ability to add a signal path to the data-on-signals-change-* attribute (#587).
  • Added a __viewtransition modifier to the data-on-* attribute that wraps the expression in document.startViewTransition() when the View Transition API is available (#627).
  • Added a __case modifier to the data-signals-*, data-computed-*, data-ref-*, data-indicator-*, data-persist-*, data-bind-*, data-class-*, and data-on-* attributes, allowing you to modify the casing of the key by adding .kebab, .snake or .pascal.
  • Added a retrying event type that is dispatched when the SSE plugin is trying to reconnect (#583).

Changed

  • Idiomorph was updated to version 0.5.0 (pre-release) and is now imported as a module, making it easier to import future versions (#608, #633).
  • Class names are no longer converted to kebab case when used in the data-class-* attribute (#610).
  • Event names are no longer converted to kebab case when used in the data-on-* attribute.

Fixed

  • Fixed a bug in which signals were being cleared when merge fragments were sending down data-signals attributes (#588).
  • Fixed a bug in which using the __ifmissing modifier with the data-signals-* attribute was not having any effect (#615).

v1.0.0-beta.3

01 Feb 14:53
8b604f6
Compare
Choose a tag to compare

This release adds the ability to use an alias prefix when using the bundler, making it possible to use your own custom data-*-* attributes. It also changes how plugins are applied and cleaned up to use MutationObserver, which is more efficient and allowed us to solve some timing issues with debouncing and intervals.

We had uptick in community PRs for this release, and a big push in terms of SDKs, so a big thank you to everyone who contributed 🚀

Added

  • Added the ability to use an alias prefix when using the bundler. This makes it possible to use data-customPrefix-* attributes instead of data-*.

Changed

  • Changed the data-on-interval attribute to accept a __duration modifier instead of a __delay modifier (#513).
  • The data-custom-validity attribute can now be used on select and textarea elements, in addition to input elements (534).
  • Changed how plugins are applied and cleaned up to use MutationObserver (#528).
  • Changed the parsing of Datastar expressions so that only semicolons can be used to explicitly indicate a statement delimiter (#525).

Fixed

  • Fixed a bug when using the __delay modifier on the data-on-load attribute (#511).
  • Fixed how Datastar expressions are evaluated to allow regular expressions and strings that contain semicolons and new lines (#508).
  • Fixed a bug with the inner merge mode that was causing only the inner HTML of a fragment to be merged (#524).
  • Fixed a bug in which signal values could get out of sync when populated by an input element by Chrome’s back/forward cache (#530).
  • Fixed a bug when generating IDs for elements that could result in duplicate IDs (#533).

Removed

  • Removed the apply function from the JavaScript API (#528).
  • Removed the version property from the JavaScript API (#545).

v1.0.0-beta.2

21 Jan 15:36
77e73bf
Compare
Choose a tag to compare

This release adds some quality-of-life improvements. The main things to write home about are that error handling has been significantly improved, and the order in which plugins are applied to elements is now more deterministic and transparent (depth-first per element, then per data attribute).

Enjoy 🚀

Added

  • Added the data-on-interval attribute.
  • Added the __delay modifier to data-on-* attributes.
  • Added the __self modifier to the data-star-ignore attribute.
  • Added the entire context to error messages output in the browser console.
  • Added the ability to use an empty value when using the data-signals-* syntax, which sets the value to an empty string.

Changed

  • Changed the order in which plugins are applied to elements to be depth-first per element, then per data attribute (#495).
  • Improved the handling of invalid expressions and signals, and made error handling generally more granular (#452).
  • The data-star-ignore attribute now ignores descendant elements by default.

Fixed

  • Fixed dashes not being trimmed from keys when double dashes were used (#450).

Removed

  • Removed the now redundant method option from backend plugin actions (#443).
  • Removed the concept of macro plugins.

v1.0.0-beta.1

02 Jan 15:05
2f57404
Compare
Choose a tag to compare

Happy new 2025! We’ve tied up loose ends, made all final breaking changes to the API and, after a grueling couple of months, we’re delighted to finally release Datastar v1.0.0-beta.1 🚀

After stabilising how nested signals work and living with the signal suffix .value for a while, we realised that it wasn’t as ergonomic as we wanted. So, honing our regex fu, we managed to switch (back) to a $ prefix for signals and a @ prefix for actions.

These symbols act as Datastar-specific namespacing – $ for a signal, @ for an action – so it’s immediately obvious what you’re working with, and you end up with much fewer characters to read and write!!

Added

  • Added the @get(), @post(), @put(), @patch() and @delete() actions, which replace the @sse() action.
  • Added the data-custom-validity attribute (#410).

Changed

  • Signals now have a $ prefix (again) instead of a .value suffix (the regex search and replace from (\w+(\.\w+)*)\.value to \$$1 may be helpful when updating your code).
  • Actions now have a @ prefix (again) instead of no suffix.
  • Changed the data-attributes attribute to data-attr (#422).
  • Changed TypeScript import paths back to relative paths, so that no config is required in the build step.
  • Removed the @sse() action. Use @get(), @post(), @put(), @patch() and @delete() instead.

Fixed

  • Fixed the __outside modifier so that elements contained within it are ignored (#425).

0.21.4

23 Dec 17:42
6a12354
Compare
Choose a tag to compare

Added

  • Added a contentType option to the sse() action that, when set to form, submits the closest form element, or one specified using the selector option (#400).
  • Added a retryInterval option to the sse() action, defaulting to 1 second (#393).
  • Added the version number in a comment at the top of bundled files (#401).

Changed

  • The data-on-submit event listener now prevents the default submission behavior of forms.

Fixed

  • Fixed a bug in which local signals were being unintentionally sent with requests (#387).
  • Fixed a bug in which the bundler was not exporting Datastar (#403).
  • Fixed a bug in which the persist plugin was not maintain values if the values were signals (#413).

v0.21.3

16 Dec 16:40
Compare
Choose a tag to compare

Added

  • Added the ability to tell Datastar to ignore an element if data-star-ignore exists on it. Useful for preventing naming conflicts with third-party libraries.

Changed

v0.21.2

11 Dec 23:11
dc06f31
Compare
Choose a tag to compare

Fixed

  • Fixed events from preventing default behaviour and stopping propagation by default in data-on-* attributes.

v0.21.1

11 Dec 17:34
418cc3a
Compare
Choose a tag to compare

Fixed

  • Fixed the Attributes plugin being loaded too early.
  • Fixed the path prefix tests in the setAll() and toggleAll() actions.
  • Fixed error message links.

v0.21.0

11 Dec 05:58
Compare
Choose a tag to compare

We’ve overhauled Datastar in v0.21.0, doubling down on making nestable signals declarative. To that end, we’ve removed special characters, made the API more explicit and consistent, and fixed restrictions to nested signals that we discovered. Signal values are now accessed in expressions using the syntax signalName.value, actions no longer have a prefix, and attribute keys support nested signals using dot-delimited paths.

The new Datastar VSCode extension and IntelliJ plugin have autocomplete for all v0.21.0 attributes, and we’ve painstakingly added error pages for every error that can be thrown.

Added

  • Added the ability to merge one-off signals using the syntax data-signals-foo="value".
  • Added the ability to use dot-delimited paths to denote nested signals in applicable attribute keys (data-signals-foo.bar="value").
  • Added the ability to use multiple attributes using the syntax data-attributes="{attrName1: value1, attrName2: value2}".
  • Added the ability to use a single classes using the syntax data-class-hidden="foo.value".
  • Added the ability to use a key instead of a value to denote a signal name in the data-bind, data-indicator and data-ref attributes (data-bind-foo, data-indicator-foo, data-ref-foo).
  • Added error codes and links to descriptions in the console for every error thrown.
  • Retries and backoff are now configurable for SSE connections.

Changed

  • Signals no longer have the $ prefix and must be acessed using a .value suffix (signalName.value).
  • Action plugins no longer have the $ prefix.
  • Renamed the data-store attribute to data-signals.
  • Renamed the data-bind attribute to data-attributes.
  • Renamed the data-model attribute to data-bind.
  • Changed the data-* attribute modifier delimiter from . to __ for modifiers and from _ to . for arguments. This is to be spec compliant while still parseable with new nested signal syntax (data-on-keydown__debounce.100ms__throttle.noLead="value").
  • The the get(), post(), put(), patch() and delete() plugins have been replaced by a single sse() plugin that accepts a method as an option (sse(url, {method: 'post'})), defaulting to get.
  • The setAll() and toggleAll plugins now accept a path prefix, instead of a regular expression.
  • Nested signals no longer allow __ in the key, which causes a conflict with modifiers.

Fixed

  • Fixed headers not merging correctly.
  • Fixed new lines in the SDK protocol for paths.