Releases: starfederation/datastar
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.
v0.20.1
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
- .NET
- DevOps
- added
make test
&make clean
to development Dockerfile
- added
Changed
- Client
- 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
- Devops
- fix
make dev
to work cross-platform - moved development Dockerfile from Alpine to Ubuntu
- fix
Removed
- DevOps
- Removed broken Github Actions
Full Changelog: v0.20.0...v0.20.1
v0.20.0
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 thestyle
attribute only. Modifiers have been removed. For anything custom, usedata-class
instead. - Renamed the
datastar-fragment
SSE event todatastar-merge-fragments
. - Renamed the
datastar-signal
SSE event todatastar-merge-signals
. - Renamed the
fragment
dataline literal for SSE events tofragments
. - Renamed the
store
dataline literal for SSE events tosignals
. - Renamed the
upsert_attributes
merge mode toupsertAttributes
in the fragment event. - Renamed the
settle
option tosettleDuration
in the fragment event and changed the default value to300
. - Renamed the
vt
option touseViewTransition
in the fragment event and changed the default value tofalse
. - Changed the second argument of SSE actions from
onlyRemoteSignals
to an optional object withheaders
andonlyRemoteSignals
keys, defaulting to{}
andtrue
respectively. - Error codes that roughly match HTTP status codes are now used.
Removed
- Removed the
~ref
syntax. Use the signal created bydata-ref
directly instead. - Removed the
local
andsession
modifiers fromdata-store
. Use the newdata-persist
attribute instead. - Removed the
data-teleport
attribute. - Removed the
data-header
attribute. Use theheaders
option in SSE actions instead. - Removed the
$$isFetching
action and thedata-fetch-indicator
attribute. Usedata-indicator
instead. - Removed the
$$remote
action. - Removed the
datastar-delete
SSE event. Use the newdatastar-remove-fragments
anddatastar-remove-signals
SSE events instead. - Removed the
datastar-redirect
anddatastar-console
SSE events. Use the newdatastar-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.