Releases: starfederation/datastar
v1.0.0-beta.5
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
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 thedata-on-*
attribute that wraps the expression indocument.startViewTransition()
when the View Transition API is available (#627). - Added a
__case
modifier to thedata-signals-*
,data-computed-*
,data-ref-*
,data-indicator-*
,data-persist-*
,data-bind-*
,data-class-*
, anddata-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
v1.0.0-beta.3
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 ofdata-*
.
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 onselect
andtextarea
elements, in addition toinput
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 thedata-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
v1.0.0-beta.2
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 todata-on-*
attributes. - Added the
__self
modifier to thedata-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
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 todata-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
Added
- Added a
contentType
option to thesse()
action that, when set toform
, submits the closest form element, or one specified using theselector
option (#400). - Added a
retryInterval
option to thesse()
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
v0.21.3
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
- The Datastar module is now exported, exposing public methods and properties (#358).
v0.21.2
v0.21.1
v0.21.0
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
anddata-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 todata-signals
. - Renamed the
data-bind
attribute todata-attributes
. - Renamed the
data-model
attribute todata-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()
anddelete()
plugins have been replaced by a singlesse()
plugin that accepts a method as an option (sse(url, {method: 'post'})
), defaulting toget
. - The
setAll()
andtoggleAll
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.