Skip to content

Releases: starfederation/datastar

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.

v0.20.1

26 Nov 01:33
207f120
Compare
Choose a tag to compare

Release Notes for Datastar

0.20.1 - 2024-11-25

VersionClientByteSize = 35970->35789
VersionClientByteSizeGzip = 12647->12568

Added

  • SDKs
    • .NET
      • Initial SDK release! #231
    • PHP
      • Allow KV pairs
      • Author
  • DevOps
    • added make test & make clean to development Dockerfile

Changed

  • Client
    • Function expression optimizations #234
    • Truthy Attributes were not getting set correctly #234
    • Fix invalid headers sent via SSE #241
    • Added hooks so NPM will package the correct files
  • SDKs
    • updated README for clarity around contributing
    • Go
      • Fix inverted logic for ViewTransitions #238
    • PHP
      • tagged SDK 1.0.0-alpha.1
      • fixed retry duration
      • general cleanup
  • Website
    • Bundler getting create valid zip for Windows #228
    • General site improvements
    • Actions section in getting started
    • Fixed broken links for SDKs and CDN #225
    • Try to fix Safari bug around caching SSE connections #239
  • Devops
    • fix make dev to work cross-platform
    • moved development Dockerfile from Alpine to Ubuntu

Removed

  • DevOps
    • Removed broken Github Actions

Full Changelog: v0.20.0...v0.20.1

v0.20.0

22 Nov 09:14
Compare
Choose a tag to compare

Warning

This update contains breaking changes to attributes, actions and SSE events.

Added

  • Added a custom bundle bundler.
  • Added SDKs for Go, PHP and .NET.
  • Added the data-persist attribute.
  • Added the data-replace-url attribute.
  • Added the data-indicator attribute.
  • Added the datastar-remove-fragments SSE event.
  • Added the datastar-remove-signals SSE event.
  • Added the datastar-execute-script SSE event.

Changed

  • Changed the $$ prefix to $ for action plugins.
  • The data-model attribute now upserts signals into the store.
  • The data-ref attribute now upserts a signal into the store.
  • The data-show attribute now shows/hides an element using the style attribute only. Modifiers have been removed. For anything custom, use data-class instead.
  • Renamed the datastar-fragment SSE event to datastar-merge-fragments.
  • Renamed the datastar-signal SSE event to datastar-merge-signals.
  • Renamed the fragment dataline literal for SSE events to fragments.
  • Renamed the store dataline literal for SSE events to signals.
  • Renamed the upsert_attributes merge mode to upsertAttributes in the fragment event.
  • Renamed the settle option to settleDuration in the fragment event and changed the default value to 300.
  • Renamed the vt option to useViewTransition in the fragment event and changed the default value to false.
  • Changed the second argument of SSE actions from onlyRemoteSignals to an optional object with headers and onlyRemoteSignals keys, defaulting to {} and true respectively.
  • Error codes that roughly match HTTP status codes are now used.

Removed

  • Removed the ~ref syntax. Use the signal created by data-ref directly instead.
  • Removed the local and session modifiers from data-store. Use the new data-persist attribute instead.
  • Removed the data-teleport attribute.
  • Removed the data-header attribute. Use the headers option in SSE actions instead.
  • Removed the $$isFetching action and the data-fetch-indicator attribute. Use data-indicator instead.
  • Removed the $$remote action.
  • Removed the datastar-delete SSE event. Use the new datastar-remove-fragments and datastar-remove-signals SSE events instead.
  • Removed the datastar-redirect and datastar-console SSE events. Use the new datastar-execute-script SSE event instead.
  • Removed sendDatastarEvent from ctx. We have to rethink how to expose events for a better try at the inspector.
  • Removed the concept of _dsPlugins, made unnecessary by a more consistent architecture.